From e483166227014b391005f90fedc756a32ed8b5a2 Mon Sep 17 00:00:00 2001 From: Isaiah Norton Date: Mon, 13 Feb 2023 16:31:29 -0500 Subject: [PATCH] Support building against external, updated google-cloud-cpp install (#3891) URL: https://github.com/TileDB-Inc/TileDB/commit/e483166227014b391005f90fedc756a32ed8b5a2.patch * Support building against external, updated google-cloud-cpp install * GCS SDK should not be required; breaks the EP build fallback --- TYPE: NO_HISTORY --- cmake/Modules/FindGCSSDK_EP.cmake | 67 ++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 24 deletions(-) diff --git a/cmake/Modules/FindGCSSDK_EP.cmake b/cmake/Modules/FindGCSSDK_EP.cmake index 05ee10e981..0f8365ec55 100644 --- a/cmake/Modules/FindGCSSDK_EP.cmake +++ b/cmake/Modules/FindGCSSDK_EP.cmake @@ -47,7 +47,20 @@ if (NOT TILEDB_FORCE_ALL_DEPS OR TILEDB_GCSSDK_EP_BUILT) PATHS ${TILEDB_EP_INSTALL_PREFIX} ${TILEDB_DEPS_NO_DEFAULT_PATH} ) - set(GCSSDK_FOUND ${storage_client_FOUND}) + if (${storage_client_FOUND}) + message(STATUS "Found GCS SDK as 'storage_client'") + set(GCSSDK_FOUND ${storage_client_FOUND}) + endif() + + if (NOT storage_client_FOUND) + message(STATUS "DID NOT find GCSSDK as 'storage_client'") + find_package(google_cloud_cpp_storage CONFIG) + set(GCSSDK_FOUND ${google_cloud_cpp_storage_FOUND}) + endif() + if (${google_cloud_cpp_storage_FOUND}) + message(STATUS "Found GCS SDK as 'google_cloud_cpp_storage'") + set(GCSSDK_FOUND ${google_cloud_cpp_storage_FOUND}) + endif() endif() if (NOT GCSSDK_FOUND) @@ -128,31 +141,37 @@ endif() # If we found the SDK but it didn't have a cmake target build them if (GCSSDK_FOUND AND NOT TARGET storage_client) - # Build a list of all GCS libraries to link with. - list(APPEND GCSSDK_LINKED_LIBS "storage_client" - "google_cloud_cpp_common" - "crc32c") + # ExternalProject target + if (${storage_client_FOUND}) + # Build a list of all GCS libraries to link with. + list(APPEND GCSSDK_LINKED_LIBS "storage_client" + "google_cloud_cpp_common" + "crc32c") - foreach (LIB ${GCSSDK_LINKED_LIBS}) - find_library(GCS_FOUND_${LIB} - NAMES lib${LIB}${CMAKE_STATIC_LIBRARY_SUFFIX} - PATHS ${TILEDB_EP_INSTALL_PREFIX} - PATH_SUFFIXES lib lib64 - ${TILEDB_DEPS_NO_DEFAULT_PATH} - ) - message(STATUS "Found GCS lib: ${LIB} (${GCS_FOUND_${LIB}})") + foreach (LIB ${GCSSDK_LINKED_LIBS}) + find_library(GCS_FOUND_${LIB} + NAMES lib${LIB}${CMAKE_STATIC_LIBRARY_SUFFIX} + PATHS ${TILEDB_EP_INSTALL_PREFIX} + PATH_SUFFIXES lib lib64 + ${TILEDB_DEPS_NO_DEFAULT_PATH} + ) + message(STATUS "Found GCS lib: ${LIB} (${GCS_FOUND_${LIB}})") - # If we built a static EP, install it if required. - if (GCSSDK_STATIC_EP_FOUND AND TILEDB_INSTALL_STATIC_DEPS) - install_target_libs(GCSSDK::${LIB}) - endif() - endforeach () + # If we built a static EP, install it if required. + if (GCSSDK_STATIC_EP_FOUND AND TILEDB_INSTALL_STATIC_DEPS) + install_target_libs(GCSSDK::${LIB}) + endif() + endforeach () - if (NOT TARGET storage_client) - add_library(storage_client UNKNOWN IMPORTED) - set_target_properties(storage_client PROPERTIES - IMPORTED_LOCATION "${GCS_FOUND_storage_client};${GCS_FOUND_google_cloud_cpp_common};${GCS_FOUND_crc32c}" - INTERFACE_INCLUDE_DIRECTORIES ${TILEDB_EP_INSTALL_PREFIX}/include - ) + if (NOT TARGET storage_client) + add_library(storage_client UNKNOWN IMPORTED) + set_target_properties(storage_client PROPERTIES + IMPORTED_LOCATION "${GCS_FOUND_storage_client};${GCS_FOUND_google_cloud_cpp_common};${GCS_FOUND_crc32c}" + INTERFACE_INCLUDE_DIRECTORIES ${TILEDB_EP_INSTALL_PREFIX}/include + ) + endif() + elseif(google_cloud_cpp_storage_FOUND) + add_library(storage_client INTERFACE IMPORTED) + target_link_libraries(storage_client INTERFACE CURL::libcurl google-cloud-cpp::storage google-cloud-cpp::experimental-storage-grpc) endif() endif()