diff --git a/cmake/Modules/FindAzureCore_EP.cmake b/cmake/Modules/FindAzureCore_EP.cmake deleted file mode 100644 index f58739fdac1..00000000000 --- a/cmake/Modules/FindAzureCore_EP.cmake +++ /dev/null @@ -1,148 +0,0 @@ -# -# FindAzureCore_EP.cmake -# -# -# The MIT License -# -# Copyright (c) 2018-2021 TileDB, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -# This module finds the Azure core SDK, installing it with an ExternalProject if -# necessary. It then defines the imported by target Azure::azure-core. - -# Include some common helper functions. -include(TileDBCommon) - -# Azure dependencies -if (TILEDB_VCPKG) - return() -endif() - -############################################################################### -# Start superbuild/unmanaged/legacy version -############################################################################### - -# First check for a static version in the EP prefix. -find_library(AZURECORE_LIBRARIES - NAMES - libazure-core${CMAKE_STATIC_LIBRARY_SUFFIX} - azure-core${CMAKE_STATIC_LIBRARY_SUFFIX} - PATHS "${TILEDB_EP_INSTALL_PREFIX}" - PATH_SUFFIXES lib lib64 - NO_DEFAULT_PATH - ) - -#on win32... '.lib' also used for lib ref'ing .dll!!! -#So, if perchance, in some environments, a .lib existed along with its corresponding .dll, -#then we could be incorrectly assuming/attempting a static build and probably will fail to -#appropriately include/package the .dll, since the code is (incorrectly) assuming .lib is indicative of a -#static library being used. - -if (AZURECORE_LIBRARIES) - set(AZURECORE_STATIC_EP_FOUND TRUE) - find_path(AZURECORE_INCLUDE_DIR - NAMES azure/core.hpp - PATHS "${TILEDB_EP_INSTALL_PREFIX}" - PATH_SUFFIXES include - NO_DEFAULT_PATH - ) -elseif(NOT TILEDB_FORCE_ALL_DEPS) - set(AZURECORE_STATIC_EP_FOUND FALSE) - # Static EP not found, search in system paths. - find_library(AZURECORE_LIBRARIES - NAMES - libazure-core #*nix name - azure-core #windows name - PATH_SUFFIXES lib64 lib bin - ${TILEDB_DEPS_NO_DEFAULT_PATH} - ) - find_path(AZURECORE_INCLUDE_DIR - NAMES azure/core.hpp - PATH_SUFFIXES include - ${TILEDB_DEPS_NO_DEFAULT_PATH} - ) -endif() - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Azurecore - REQUIRED_VARS AZURECORE_LIBRARIES AZURECORE_INCLUDE_DIR - ) - -if (NOT AZURECORE_FOUND) - if (TILEDB_SUPERBUILD) - message(STATUS "Could NOT find azure-core") - message(STATUS "Adding azure-core as an external project") - - set(DEPENDS) - if (TARGET ep_openssl) - list(APPEND DEPENDS ep_openssl) - endif() - if (TARGET ep_curl) - list(APPEND DEPENDS ep_curl) - endif() - # Define windows dependencies - if (WIN32) - if(TARGET ep_wil) - list(APPEND DEPENDS ep_wil) - endif() - endif() - - ExternalProject_Add(ep_azure_core - PREFIX "externals" - URL "https://github.com/Azure/azure-sdk-for-cpp/archive/azure-core_1.10.0.zip" - URL_HASH SHA1=95fd8d56b439145228570c16ade5c0a73bbf6904 - DOWNLOAD_NAME azure-core_1.10.0.zip - SOURCE_SUBDIR sdk/core/azure-core - CMAKE_ARGS - -DCMAKE_BUILD_TYPE=$ - -DBUILD_SHARED_LIBS=OFF - -DCMAKE_POSITION_INDEPENDENT_CODE=ON - -DCMAKE_PREFIX_PATH=${TILEDB_EP_INSTALL_PREFIX} - -DCMAKE_INSTALL_PREFIX=${TILEDB_EP_INSTALL_PREFIX} - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} - -DWARNINGS_AS_ERRORS=OFF - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -DDISABLE_AZURE_CORE_OPENTELEMETRY=ON - LOG_DOWNLOAD TRUE - LOG_CONFIGURE TRUE - LOG_BUILD TRUE - LOG_INSTALL TRUE - LOG_OUTPUT_ON_FAILURE ${TILEDB_LOG_OUTPUT_ON_FAILURE} - DEPENDS ${DEPENDS} - ) - - list(APPEND TILEDB_EXTERNAL_PROJECTS ep_azure_core) - list(APPEND FORWARD_EP_CMAKE_ARGS - -DTILEDB_AZURE_CORE_EP_BUILT=TRUE - ) - else () - message(FATAL_ERROR "Could not find ep_azure_core (required).") - endif () -endif () - -if (AZURECORE_FOUND AND NOT TARGET Azure::azure-core) - add_library(Azure::azure-core UNKNOWN IMPORTED) - set_target_properties(Azure::azure-core PROPERTIES - IMPORTED_LOCATION "${AZURECORE_LIBRARIES}" - INTERFACE_INCLUDE_DIRECTORIES "${AZURECORE_INCLUDE_DIR}" - ) -endif() diff --git a/cmake/Modules/FindAzureStorageBlobs_EP.cmake b/cmake/Modules/FindAzureStorageBlobs_EP.cmake deleted file mode 100644 index fa1fb8677c8..00000000000 --- a/cmake/Modules/FindAzureStorageBlobs_EP.cmake +++ /dev/null @@ -1,136 +0,0 @@ -# -# FindAzureStorageBlobs_EP.cmake -# -# -# The MIT License -# -# Copyright (c) 2018-2021 TileDB, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -# This module finds the Azure Storage Blobs SDK, installing it with an ExternalProject if -# necessary. It then defines the imported by target Azure_Storage_Blobs::Azure_Storage_Blobs. - -# Include some common helper functions. -include(TileDBCommon) - -# Azure dependencies -if (TILEDB_VCPKG) - return() -endif() - -############################################################################### -# Start superbuild/unmanaged/legacy version -############################################################################### - -find_library(AZURE_STORAGE_BLOBS_LIBRARIES - NAMES - libazure-storage-blobs${CMAKE_STATIC_LIBRARY_SUFFIX} - azure-storage-blobs${CMAKE_STATIC_LIBRARY_SUFFIX} - PATHS "${TILEDB_EP_INSTALL_PREFIX}" - PATH_SUFFIXES lib lib64 - NO_DEFAULT_PATH - ) - -#on win32... '.lib' also used for lib ref'ing .dll!!! -#So, if perchance, in some environments, a .lib existed along with its corresponding .dll, -#then we could be incorrectly assuming/attempting a static build and probably will fail to -#appropriately include/package the .dll, since the code is (incorrectly) assuming .lib is indicative of a -#static library being used. - -if (AZURE_STORAGE_BLOBS_LIBRARIES) - set(AZURE_STORAGE_BLOBS_STATIC_EP_FOUND TRUE) - find_path(AZURE_STORAGE_BLOBS_INCLUDE_DIR - NAMES azure/storage/blobs.hpp - PATHS "${TILEDB_EP_INSTALL_PREFIX}" - PATH_SUFFIXES include - NO_DEFAULT_PATH - ) -elseif(NOT TILEDB_FORCE_ALL_DEPS) - set(AZURE_STORAGE_BLOBS_STATIC_EP_FOUND FALSE) - # Static EP not found, search in system paths. - find_library(AZURE_STORAGE_BLOBS_LIBRARIES - NAMES - libazure-storage-blobs #*nix name - azure-storage-blobs #windows name - PATH_SUFFIXES lib64 lib bin - ${TILEDB_DEPS_NO_DEFAULT_PATH} - ) - find_path(AZURE_STORAGE_BLOBS_INCLUDE_DIR - NAMES azure/storage/blobs.hpp - PATH_SUFFIXES include - ${TILEDB_DEPS_NO_DEFAULT_PATH} - ) -endif() - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Azure_Storage_Blobs - REQUIRED_VARS AZURE_STORAGE_BLOBS_LIBRARIES AZURE_STORAGE_BLOBS_INCLUDE_DIR - ) - - -if (NOT AZURE_STORAGE_BLOBS_FOUND) - if (TILEDB_SUPERBUILD) - message(STATUS "Could NOT find azure-storage-blobs") - message(STATUS "Adding azure-storage-blobs as an external project") - - set(DEPENDS ep_azure_storage_common) - - ExternalProject_Add(ep_azure_storage_blobs - PREFIX "externals" - URL "https://github.com/Azure/azure-sdk-for-cpp/archive/azure-storage-blobs_12.6.0.zip" - URL_HASH SHA1=4d033a68b74f486284542528e558509c8624f21d - DOWNLOAD_NAME azure-storage-blobs_12.6.0.zip - SOURCE_SUBDIR sdk/storage/azure-storage-blobs - CMAKE_ARGS - -DCMAKE_BUILD_TYPE=$ - -DBUILD_SHARED_LIBS=OFF - -DCMAKE_POSITION_INDEPENDENT_CODE=ON - -DCMAKE_PREFIX_PATH=${TILEDB_EP_INSTALL_PREFIX} - -DCMAKE_INSTALL_PREFIX=${TILEDB_EP_INSTALL_PREFIX} - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} - -DWARNINGS_AS_ERRORS=OFF - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -DDISABLE_AZURE_CORE_OPENTELEMETRY=ON - LOG_DOWNLOAD TRUE - LOG_CONFIGURE TRUE - LOG_BUILD TRUE - LOG_INSTALL TRUE - LOG_OUTPUT_ON_FAILURE ${TILEDB_LOG_OUTPUT_ON_FAILURE} - DEPENDS ${DEPENDS} - ) - - list(APPEND TILEDB_EXTERNAL_PROJECTS ep_azure_storage_blobs) - list(APPEND FORWARD_EP_CMAKE_ARGS - -DTILEDB_AZURE_STORAGE_BLOBS_EP_BUILT=TRUE - ) - else () - message(FATAL_ERROR "Could not find ep_azure_storage_blobs (required).") - endif () -endif () - -if (AZURE_STORAGE_BLOBS_FOUND AND NOT TARGET Azure::azure-storage-blobs) - add_library(Azure::azure-storage-blobs UNKNOWN IMPORTED) - set_target_properties(Azure::azure-storage-blobs PROPERTIES - IMPORTED_LOCATION "${AZURE_STORAGE_BLOBS_LIBRARIES}" - INTERFACE_INCLUDE_DIRECTORIES "${AZURE_STORAGE_BLOBS_INCLUDE_DIR}" - ) -endif() diff --git a/cmake/Modules/FindAzureStorageCommon_EP.cmake b/cmake/Modules/FindAzureStorageCommon_EP.cmake deleted file mode 100644 index d750c623e8a..00000000000 --- a/cmake/Modules/FindAzureStorageCommon_EP.cmake +++ /dev/null @@ -1,142 +0,0 @@ -# -# FindAzureStorageCommon_EP.cmake -# -# -# The MIT License -# -# Copyright (c) 2018-2021 TileDB, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -# This module finds the Azure Storage Common SDK, installing it with an ExternalProject if -# necessary. It then defines the imported by target Azure_Storage_Common::Azure_Storage_Common. - -# Include some common helper functions. -include(TileDBCommon) - -# Azure dependencies -if (TILEDB_VCPKG) - return() -endif() - -############################################################################### -# Start superbuild/unmanaged/legacy version -############################################################################### - -find_library(AZURE_STORAGE_COMMON_LIBRARIES - NAMES - libazure-storage-common${CMAKE_STATIC_LIBRARY_SUFFIX} - azure-storage-common${CMAKE_STATIC_LIBRARY_SUFFIX} - PATHS "${TILEDB_EP_INSTALL_PREFIX}" - PATH_SUFFIXES lib lib64 - NO_DEFAULT_PATH - ) - -#on win32... '.lib' also used for lib ref'ing .dll!!! -#So, if perchance, in some environments, a .lib existed along with its corresponding .dll, -#then we could be incorrectly assuming/attempting a static build and probably will fail to -#appropriately include/package the .dll, since the code is (incorrectly) assuming .lib is indicative of a -#static library being used. - -if (AZURE_STORAGE_COMMON_LIBRARIES) - set(AZURE_STORAGE_COMMON_STATIC_EP_FOUND TRUE) - find_path(AZURE_STORAGE_COMMON_INCLUDE_DIR - NAMES azure/storage/common/storage_common.hpp - PATHS "${TILEDB_EP_INSTALL_PREFIX}" - PATH_SUFFIXES include - NO_DEFAULT_PATH - ) -elseif(NOT TILEDB_FORCE_ALL_DEPS) - set(AZURE_STORAGE_COMMON_STATIC_EP_FOUND FALSE) - # Static EP not found, search in system paths. - find_library(AZURE_STORAGE_COMMON_LIBRARIES - NAMES - libazure-storage-common #*nix name - azure-storage-common #windows name - PATH_SUFFIXES lib64 lib bin - ${TILEDB_DEPS_NO_DEFAULT_PATH} - ) - find_path(AZURE_STORAGE_COMMON_INCLUDE_DIR - NAMES azure/storage/common/storage_common.hpp - PATH_SUFFIXES include - ${TILEDB_DEPS_NO_DEFAULT_PATH} - ) -endif() - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Azure_Storage_Common - REQUIRED_VARS AZURE_STORAGE_COMMON_LIBRARIES AZURE_STORAGE_COMMON_INCLUDE_DIR - ) - - -if (NOT AZURE_STORAGE_COMMON_FOUND) - if (TILEDB_SUPERBUILD) - message(STATUS "Could NOT find azure-storage-common") - message(STATUS "Adding azure-storage-common as an external project") - - set(DEPENDS ep_azure_core) - if (TARGET ep_openssl) - list(APPEND DEPENDS ep_openssl) - endif() - - ExternalProject_Add(ep_azure_storage_common - PREFIX "externals" - URL "https://github.com/Azure/azure-sdk-for-cpp/archive/azure-storage-common_12.3.2.zip" - URL_HASH SHA1=09fc97b3f4c4f8e8976704dfc1ecefd14b2ed1bc - DOWNLOAD_NAME azure-storage-common_12.3.2.zip - SOURCE_SUBDIR sdk/storage/azure-storage-common - CMAKE_ARGS - -DCMAKE_BUILD_TYPE=$ - -DBUILD_SHARED_LIBS=OFF - -DCMAKE_POSITION_INDEPENDENT_CODE=ON - -DCMAKE_PREFIX_PATH=${TILEDB_EP_INSTALL_PREFIX} - -DCMAKE_INSTALL_PREFIX=${TILEDB_EP_INSTALL_PREFIX} - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} - -DWARNINGS_AS_ERRORS=OFF - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -DDISABLE_AZURE_CORE_OPENTELEMETRY=ON - LOG_DOWNLOAD TRUE - LOG_CONFIGURE TRUE - LOG_BUILD TRUE - LOG_INSTALL TRUE - LOG_OUTPUT_ON_FAILURE ${TILEDB_LOG_OUTPUT_ON_FAILURE} - DEPENDS ${DEPENDS} - ) - - list(APPEND TILEDB_EXTERNAL_PROJECTS ep_azure_storage_common) - list(APPEND FORWARD_EP_CMAKE_ARGS - -DTILEDB_AZURE_STORAGE_COMMON_EP_BUILT=TRUE - ) - else () - message(FATAL_ERROR "Could not find ep_azure_storage_common (required).") - endif () -endif () - -if (AZURE_STORAGE_COMMON_FOUND AND NOT TARGET Azure::azure-storage-common) - add_library(Azure::azure-storage-common UNKNOWN IMPORTED) - set_target_properties(Azure::azure-storage-common PROPERTIES - IMPORTED_LOCATION "${AZURE_STORAGE_COMMON_LIBRARIES}" - INTERFACE_INCLUDE_DIRECTORIES "${AZURE_STORAGE_COMMON_INCLUDE_DIR}" - ) - if (WIN32) - target_link_libraries(Azure::azure-storage-common INTERFACE WebServices) - endif() -endif() diff --git a/cmake/Modules/FindWIL_EP.cmake b/cmake/Modules/FindWIL_EP.cmake deleted file mode 100644 index 7f2f301a0ee..00000000000 --- a/cmake/Modules/FindWIL_EP.cmake +++ /dev/null @@ -1,95 +0,0 @@ -# -# FindWIL_EP.cmake -# -# -# The MIT License -# -# Copyright (c) 2018-2021 TileDB, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -# This module finds the Windows Implementation Libraries, installing it with an ExternalProject if -# necessary. It then defines the imported by target wil::wil. - -# Include some common helper functions. -include(TileDBCommon) - -# Azure dependencies -if (TILEDB_VCPKG) - return() -endif() - -############################################################################### -# Start superbuild/unmanaged/legacy version -############################################################################### - -# First check for a static version in the EP prefix. -find_package(wil - PATHS "${TILEDB_EP_INSTALL_PREFIX}" - ${TILEDB_DEPS_NO_DEFAULT_PATH} -) - -if (NOT wil_FOUND) - if (TILEDB_SUPERBUILD) - message(STATUS "Could NOT find wil") - message(STATUS "Adding wil as an external project") - - ExternalProject_Add(ep_wil - PREFIX "externals" - URL "https://github.com/microsoft/wil/archive/refs/tags/v1.0.230629.1.zip" - URL_HASH SHA1=e4a542a323c070376f7c2d1973d0f7ddbc1d2fa5 - DOWNLOAD_NAME wil-v1.0.230629.1.zip - CMAKE_ARGS - -DCMAKE_BUILD_TYPE=$ - -DCMAKE_POSITION_INDEPENDENT_CODE=ON - -DCMAKE_PREFIX_PATH=${TILEDB_EP_INSTALL_PREFIX} - -DCMAKE_INSTALL_PREFIX=${TILEDB_EP_INSTALL_PREFIX} - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - "-DCMAKE_C_FLAGS=${CFLAGS_DEF}" - "-DCMAKE_CXX_FLAGS=${CXXFLAGS_DEF}" - -DWIL_BUILD_PACKAGING=OFF - -DWIL_BUILD_TESTS=OFF - LOG_DOWNLOAD TRUE - LOG_CONFIGURE TRUE - LOG_BUILD TRUE - LOG_INSTALL TRUE - LOG_OUTPUT_ON_FAILURE ${TILEDB_LOG_OUTPUT_ON_FAILURE} - DEPENDS ${DEPENDS} - ) - - list(APPEND TILEDB_EXTERNAL_PROJECTS ep_wil) - list(APPEND FORWARD_EP_CMAKE_ARGS - -DTILEDB_wil_EP_BUILT=TRUE - ) - else () - message(FATAL_ERROR "Could not find ep_wil (required).") - endif () -endif () - - -if (wil_FOUND AND NOT TARGET wil::wil) - add_library(wil::wil UNKNOWN IMPORTED) - set_target_properties(wil::wil PROPERTIES - IMPORTED_LOCATION "${wil_LIBRARIES}" - INTERFACE_INCLUDE_DIRECTORIES "${wil_INCLUDE_DIR}" - ) -endif() diff --git a/cmake/TileDB-Superbuild.cmake b/cmake/TileDB-Superbuild.cmake index cd1b81f9307..f963294790c 100644 --- a/cmake/TileDB-Superbuild.cmake +++ b/cmake/TileDB-Superbuild.cmake @@ -129,15 +129,6 @@ if (TILEDB_S3 AND NOT TILEDB_VCPKG) include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindAWSSDK_EP.cmake) endif() -if (TILEDB_AZURE AND NOT TILEDB_VCPKG) - if (WIN32) - include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindWIL_EP.cmake) - endif() - include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindAzureCore_EP.cmake) - include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindAzureStorageCommon_EP.cmake) - include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindAzureStorageBlobs_EP.cmake) -endif() - if (TILEDB_TESTS) include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindCatch_EP.cmake) endif() diff --git a/cmake/inputs/Config.cmake.in b/cmake/inputs/Config.cmake.in index 6723ff3b036..df94a0f00a1 100644 --- a/cmake/inputs/Config.cmake.in +++ b/cmake/inputs/Config.cmake.in @@ -27,6 +27,7 @@ if(NOT @BUILD_SHARED_LIBS@) # NOT BUILD_SHARED_LIBS find_dependency(AWSSDK COMPONENTS @AWS_SERVICES@) endif() if(@TILEDB_AZURE@) # TILEDB_AZURE + find_dependency(azure-identity-cpp) find_dependency(azure-storage-blobs-cpp) endif() if(@TILEDB_GCS@) # TILEDB_GCS diff --git a/tiledb/CMakeLists.txt b/tiledb/CMakeLists.txt index 2d59b59cd80..bdb707f371b 100644 --- a/tiledb/CMakeLists.txt +++ b/tiledb/CMakeLists.txt @@ -540,31 +540,13 @@ endif() if (TILEDB_AZURE) message(STATUS "The TileDB library is compiled with Azure support.") - if (TILEDB_VCPKG) - find_package(azure-storage-blobs-cpp CONFIG REQUIRED) - target_link_libraries(TILEDB_CORE_OBJECTS_ILIB - INTERFACE - Azure::azure-storage-blobs - ) - else() - find_package(AzureCore_EP REQUIRED) - find_package(AzureStorageCommon_EP REQUIRED) - find_package(AzureStorageBlobs_EP REQUIRED) - if (NOT WIN32) - if (NOT TARGET LibXml2::LibXml2) - find_package(LibXml2 REQUIRED) - endif() - endif() - target_link_libraries(TILEDB_CORE_OBJECTS_ILIB - INTERFACE - Azure::azure-storage-blobs - Azure::azure-storage-common - Azure::azure-core) - # Link xml after Azure to allow symbol resolution on all platforms - if (NOT WIN32) - target_link_libraries(TILEDB_CORE_OBJECTS_ILIB INTERFACE LibXml2::LibXml2) - endif() - endif() + find_package(azure-identity-cpp CONFIG REQUIRED) + find_package(azure-storage-blobs-cpp CONFIG REQUIRED) + target_link_libraries(TILEDB_CORE_OBJECTS_ILIB + INTERFACE + Azure::azure-identity + Azure::azure-storage-blobs + ) endif() if (TILEDB_GCS) diff --git a/tiledb/sm/filesystem/azure.cc b/tiledb/sm/filesystem/azure.cc index 4da5bfc33d6..8b8f2d88245 100644 --- a/tiledb/sm/filesystem/azure.cc +++ b/tiledb/sm/filesystem/azure.cc @@ -35,6 +35,7 @@ #include #include +#include #include #include "tiledb/common/common.h" @@ -112,6 +113,17 @@ std::string get_blob_endpoint( return result; } +/** + * Check if config has a SAS token set + * @param config Configuration parameters. + * @return whether there is a SAS token in the config + */ +static bool has_sas_token(const Config& config) { + std::string sas_token = get_config_with_env_fallback( + config, "vfs.azure.storage_sas_token", "AZURE_STORAGE_SAS_TOKEN"); + return !sas_token.empty(); +} + AzureParameters::AzureParameters(const Config& config) : max_parallel_ops_( config.get("vfs.azure.max_parallel_ops", Config::must_find)) @@ -131,7 +143,8 @@ AzureParameters::AzureParameters(const Config& config) , account_key_(get_config_with_env_fallback( config, "vfs.azure.storage_account_key", "AZURE_STORAGE_KEY")) , blob_endpoint_(get_blob_endpoint(config, account_name_)) - , ssl_cfg_(config) { + , ssl_cfg_(config) + , has_sas_token_(has_sas_token(config)) { } Status Azure::init(const Config& config, ThreadPool* const thread_pool) { @@ -174,33 +187,77 @@ Azure::AzureClientSingleton::get(const AzureParameters& params) { std::lock_guard lck(client_init_mtx_); - if (!client_) { - ::Azure::Storage::Blobs::BlobClientOptions options; - options.Retry.MaxRetries = params.max_retries_; - options.Retry.RetryDelay = params.retry_delay_; - options.Retry.MaxRetryDelay = params.max_retry_delay_; - - options.Transport.Transport = create_transport(params.ssl_cfg_); - - // Construct the Azure SDK blob service client. - // We pass a shared key if it was specified. - if (!params.account_key_.empty()) { - client_ = - tdb_unique_ptr<::Azure::Storage::Blobs::BlobServiceClient>(tdb_new( - ::Azure::Storage::Blobs::BlobServiceClient, - params.blob_endpoint_, - make_shared<::Azure::Storage::StorageSharedKeyCredential>( - HERE(), params.account_name_, params.account_key_), - options)); - } else { + if (client_) { + return *client_; + } + + ::Azure::Storage::Blobs::BlobClientOptions options; + options.Retry.MaxRetries = params.max_retries_; + options.Retry.RetryDelay = params.retry_delay_; + options.Retry.MaxRetryDelay = params.max_retry_delay_; + options.Transport.Transport = create_transport(params.ssl_cfg_); + + // Construct the Azure SDK blob service client. + // We pass a shared key if it was specified. + if (!params.account_key_.empty()) { + client_ = + tdb_unique_ptr<::Azure::Storage::Blobs::BlobServiceClient>(tdb_new( + ::Azure::Storage::Blobs::BlobServiceClient, + params.blob_endpoint_, + make_shared<::Azure::Storage::StorageSharedKeyCredential>( + HERE(), params.account_name_, params.account_key_), + options)); + return *client_; + } + + // Otherwise, if we did not specify an SAS token + // and we are connecting to an HTTPS endpoint, + // use ChainedTokenCredential to authenticate using Microsoft Entra ID. + if (!params.has_sas_token_ && + utils::parse::starts_with(params.blob_endpoint_, "https://")) { + try { + ::Azure::Core::Credentials::TokenCredentialOptions cred_options; + cred_options.Retry = options.Retry; + cred_options.Transport = options.Transport; + auto credential = make_shared<::Azure::Identity::ChainedTokenCredential>( + HERE(), + std::vector< + std::shared_ptr<::Azure::Core::Credentials::TokenCredential>>{ + make_shared<::Azure::Identity::EnvironmentCredential>( + HERE(), cred_options), + make_shared<::Azure::Identity::AzureCliCredential>( + HERE(), cred_options), + make_shared<::Azure::Identity::ManagedIdentityCredential>( + HERE(), cred_options), + make_shared<::Azure::Identity::WorkloadIdentityCredential>( + HERE(), cred_options)}); + // If a token is not available we wouldn't know it until we make a + // request and it would be too late. Try getting a token, and if it + // fails fall back to anonymous authentication. + ::Azure::Core::Credentials::TokenRequestContext tokenContext; + + // https://github.com/Azure/azure-sdk-for-cpp/blob/azure-storage-blobs_12.7.0/sdk/storage/azure-storage-blobs/src/blob_service_client.cpp#L84 + tokenContext.Scopes.emplace_back("https://storage.azure.com/.default"); + std::ignore = credential->GetToken(tokenContext, {}); client_ = tdb_unique_ptr<::Azure::Storage::Blobs::BlobServiceClient>(tdb_new( ::Azure::Storage::Blobs::BlobServiceClient, params.blob_endpoint_, + credential, options)); + return *client_; + } catch (...) { + LOG_INFO( + "Failed to get Microsoft Entra ID token, falling back to anonymous " + "authentication"); } } + client_ = tdb_unique_ptr<::Azure::Storage::Blobs::BlobServiceClient>(tdb_new( + ::Azure::Storage::Blobs::BlobServiceClient, + params.blob_endpoint_, + options)); + return *client_; } @@ -964,8 +1021,8 @@ Status Azure::write_blocks( } state = &state_iter->second; - // We're done reading and writing from 'block_list_upload_states_'. Mutating - // the 'state' element does not affect the thread-safety of + // We're done reading and writing from 'block_list_upload_states_'. + // Mutating the 'state' element does not affect the thread-safety of // 'block_list_upload_states_'. } diff --git a/tiledb/sm/filesystem/azure.h b/tiledb/sm/filesystem/azure.h index 3d5ca37e6a7..fdd059947b9 100644 --- a/tiledb/sm/filesystem/azure.h +++ b/tiledb/sm/filesystem/azure.h @@ -104,6 +104,9 @@ struct AzureParameters { /** SSL configuration. */ SSLConfig ssl_cfg_; + + /** Whether the config specifies a SAS token. */ + bool has_sas_token_; }; class Azure { diff --git a/vcpkg.json b/vcpkg.json index eccafa372ca..fec72703d0e 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -17,6 +17,7 @@ "description": "Support Azure Blob Storage", "dependencies": [ "azure-storage-blobs-cpp", + "azure-identity-cpp", { "name": "libxml2", "default-features": false,