From 9d8c327c0763229939c52fd7d3bf994f243c609f Mon Sep 17 00:00:00 2001 From: Seth Shelnutt Date: Sun, 7 Jun 2020 13:19:31 -0400 Subject: [PATCH] GCS Build Patch for TileDB --- CMakeLists.txt | 5 +++ super/CMakeLists.txt | 19 +++++++--- super/external/abseil.cmake | 5 ++- super/external/c-ares.cmake | 5 ++- super/external/crc32c.cmake | 5 ++- super/external/curl.cmake | 63 --------------------------------- super/external/googletest.cmake | 5 ++- super/external/grpc.cmake | 15 ++++++-- super/external/protobuf.cmake | 7 ++-- super/external/ssl.cmake | 26 -------------- super/external/zlib.cmake | 46 ------------------------ 11 files changed, 52 insertions(+), 149 deletions(-) delete mode 100644 super/external/curl.cmake delete mode 100644 super/external/ssl.cmake delete mode 100644 super/external/zlib.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 0dcf55c56..55074b7f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,11 @@ endif () option(GOOGLE_CLOUD_CPP_ENABLE_MACOS_OPENSSL_CHECK "If enabled, check that the user has defined OPENSSL_ROOT_DIR on macOS" ON) + + if (NOT DEFINED ENV{OPENSSL_ROOT_DIR} AND DEFINED OPENSSL_ROOT_DIR) + set(ENV{OPENSSL_ROOT_DIR} ${OPENSSL_ROOT_DIR}) + endif() + if (APPLE) # This is an easy mistake to make, and the error messages are very # confusing. Help our users by giving them some guidance. diff --git a/super/CMakeLists.txt b/super/CMakeLists.txt index 01b41dd3a..2c1de0078 100644 --- a/super/CMakeLists.txt +++ b/super/CMakeLists.txt @@ -38,7 +38,6 @@ if ("${GOOGLE_CLOUD_CPP_ENABLE_CCACHE}") endif () include(external/abseil) -include(external/curl) include(external/crc32c) include(external/grpc) include(external/googletest) @@ -51,8 +50,11 @@ set_external_project_build_parallel_level(PARALLEL) set_external_project_vars() set(GOOGLE_CLOUD_CPP_DEPENDENCIES_LIST - abseil-cpp-project grpc-project curl-project crc32c-project - googletest-project benchmark-project) + abseil-cpp-project + grpc-project + crc32c-project + googletest-project + benchmark-project) include(ExternalProject) ExternalProject_Add( @@ -70,6 +72,14 @@ ExternalProject_Add( -DCMAKE_PREFIX_PATH=${GOOGLE_CLOUD_CPP_PREFIX_PATH} -DCMAKE_INSTALL_RPATH=${GOOGLE_CLOUD_CPP_INSTALL_RPATH} -DCMAKE_INSTALL_PREFIX= + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} + -DBUILD_SAMPLES=${BUILD_SAMPLES} + -DCMAKE_CXX_FLAGS=-fPIC + -DCMAKE_C_FLAGS=-fPIC + -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR} + -DGOOGLE_CLOUD_CPP_ENABLE_MACOS_OPENSSL_CHECK=OFF + -DBUILD_TESTING=${BUILD_TESTING} BUILD_COMMAND ${CMAKE_COMMAND} --build ${PARALLEL} TEST_COMMAND ${CMAKE_CTEST_COMMAND} @@ -82,7 +92,8 @@ ExternalProject_Add( LOG_DOWNLOAD OFF LOG_CONFIGURE OFF LOG_BUILD OFF - LOG_INSTALL OFF) + LOG_INSTALL OFF + LOG_OUTPUT_ON_FAILURE ON) # This makes it easy to compile the dependencies before the code. add_custom_target(project-dependencies) diff --git a/super/external/abseil.cmake b/super/external/abseil.cmake index 10321e5e4..c0dbd3ce5 100644 --- a/super/external/abseil.cmake +++ b/super/external/abseil.cmake @@ -45,6 +45,8 @@ if (NOT TARGET abseil-cpp-project) -DCMAKE_PREFIX_PATH=${GOOGLE_CLOUD_CPP_PREFIX_PATH} -DCMAKE_INSTALL_RPATH=${GOOGLE_CLOUD_CPP_INSTALL_RPATH} -DCMAKE_INSTALL_PREFIX= + -DCMAKE_CXX_FLAGS=-fPIC + -DCMAKE_C_FLAGS=-fPIC BUILD_COMMAND ${CMAKE_COMMAND} --build @@ -57,5 +59,6 @@ if (NOT TARGET abseil-cpp-project) LOG_DOWNLOAD OFF LOG_CONFIGURE OFF LOG_BUILD ON - LOG_INSTALL ON) + LOG_INSTALL ON + LOG_OUTPUT_ON_FAILURE ON) endif () diff --git a/super/external/c-ares.cmake b/super/external/c-ares.cmake index 5b898e3f7..63bd708b6 100644 --- a/super/external/c-ares.cmake +++ b/super/external/c-ares.cmake @@ -40,9 +40,12 @@ if (NOT TARGET c-ares-project) -DCMAKE_PREFIX_PATH=${GOOGLE_CLOUD_CPP_PREFIX_PATH} -DCMAKE_INSTALL_RPATH=${GOOGLE_CLOUD_CPP_INSTALL_RPATH} -DCMAKE_INSTALL_PREFIX= + -DCMAKE_CXX_FLAGS=-fPIC + -DCMAKE_C_FLAGS=-fPIC BUILD_COMMAND ${CMAKE_COMMAND} --build ${PARALLEL} LOG_DOWNLOAD ON LOG_CONFIGURE ON LOG_BUILD ON - LOG_INSTALL ON) + LOG_INSTALL ON + LOG_OUTPUT_ON_FAILURE ON) endif () diff --git a/super/external/crc32c.cmake b/super/external/crc32c.cmake index ed35de175..7d54c5ae8 100644 --- a/super/external/crc32c.cmake +++ b/super/external/crc32c.cmake @@ -43,9 +43,12 @@ if (NOT TARGET crc32c-project) -DCRC32C_BUILD_TESTS=OFF -DCRC32C_BUILD_BENCHMARKS=OFF -DCRC32C_USE_GLOG=OFF + -DCMAKE_CXX_FLAGS=-fPIC + -DCMAKE_C_FLAGS=-fPIC BUILD_COMMAND ${CMAKE_COMMAND} --build ${PARALLEL} LOG_DOWNLOAD ON LOG_CONFIGURE ON LOG_BUILD ON - LOG_INSTALL ON) + LOG_INSTALL ON + LOG_OUTPUT_ON_FAILURE ON) endif () diff --git a/super/external/curl.cmake b/super/external/curl.cmake deleted file mode 100644 index 1a695e098..000000000 --- a/super/external/curl.cmake +++ /dev/null @@ -1,63 +0,0 @@ -# ~~~ -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ~~~ - -include(external/c-ares) -include(external/ssl) -include(external/zlib) - -if (NOT TARGET curl-project) - # Give application developers a hook to configure the version and hash - # downloaded from GitHub. - set(GOOGLE_CLOUD_CPP_CURL_URL - "https://curl.haxx.se/download/curl-7.69.1.tar.gz") - set(GOOGLE_CLOUD_CPP_CURL_SHA256 - "01ae0c123dee45b01bbaef94c0bc00ed2aec89cb2ee0fd598e0d302a6b5e0a98") - - set_external_project_build_parallel_level(PARALLEL) - set_external_project_vars() - - include(ExternalProject) - ExternalProject_Add( - curl-project - DEPENDS c-ares-project ssl-project zlib-project - EXCLUDE_FROM_ALL ON - PREFIX "${CMAKE_BINARY_DIR}/external/curl" - INSTALL_DIR "${GOOGLE_CLOUD_CPP_EXTERNAL_PREFIX}" - URL ${GOOGLE_CLOUD_CPP_CURL_URL} - URL_HASH SHA256=${GOOGLE_CLOUD_CPP_CURL_SHA256} - LIST_SEPARATOR | - CMAKE_ARGS ${GOOGLE_CLOUD_CPP_EXTERNAL_PROJECT_CMAKE_FLAGS} - -DCMAKE_PREFIX_PATH=${GOOGLE_CLOUD_CPP_PREFIX_PATH} - -DCMAKE_INSTALL_RPATH=${GOOGLE_CLOUD_CPP_INSTALL_RPATH} - -DCMAKE_INSTALL_PREFIX= - # libcurl automatically enables a number of protocols. With - # static libraries this is a problem. The indirect - # dependencies, such as libldap, become hard to predict and - # manage. Setting HTTP_ONLY=ON disables all optional - # protocols and meets our needs. If the application needs a - # version of libcurl with other protocols enabled they can - # compile against it by using find_package() and defining the - # `curl_project` target. - -DHTTP_ONLY=ON - -DCMAKE_ENABLE_OPENSSL=ON - -DENABLE_ARES=ON - -DCMAKE_DEBUG_POSTFIX= - BUILD_COMMAND ${CMAKE_COMMAND} --build ${PARALLEL} - LOG_DOWNLOAD ON - LOG_CONFIGURE ON - LOG_BUILD ON - LOG_INSTALL ON) -endif () diff --git a/super/external/googletest.cmake b/super/external/googletest.cmake index a4e5220e0..f7cd15b61 100644 --- a/super/external/googletest.cmake +++ b/super/external/googletest.cmake @@ -40,9 +40,12 @@ if (NOT TARGET googletest-project) -DCMAKE_PREFIX_PATH=${GOOGLE_CLOUD_CPP_PREFIX_PATH} -DCMAKE_INSTALL_RPATH=${GOOGLE_CLOUD_CPP_INSTALL_RPATH} -DCMAKE_INSTALL_PREFIX= + -DCMAKE_CXX_FLAGS=-fPIC + -DCMAKE_C_FLAGS=-fPIC BUILD_COMMAND ${CMAKE_COMMAND} --build ${PARALLEL} LOG_DOWNLOAD ON LOG_CONFIGURE ON LOG_BUILD ON - LOG_INSTALL ON) + LOG_INSTALL ON + LOG_OUTPUT_ON_FAILURE ON) endif () diff --git a/super/external/grpc.cmake b/super/external/grpc.cmake index 91f70eaa9..3cac5cfef 100644 --- a/super/external/grpc.cmake +++ b/super/external/grpc.cmake @@ -17,7 +17,6 @@ include(ExternalProjectHelper) include(external/abseil) include(external/c-ares) -include(external/ssl) include(external/protobuf) if (NOT TARGET grpc-project) @@ -34,7 +33,7 @@ if (NOT TARGET grpc-project) include(ExternalProject) ExternalProject_Add( grpc-project - DEPENDS c-ares-project protobuf-project ssl-project abseil-cpp-project + DEPENDS c-ares-project protobuf-project abseil-cpp-project EXCLUDE_FROM_ALL ON PREFIX "${CMAKE_BINARY_DIR}/external/grpc" INSTALL_DIR "${GOOGLE_CLOUD_CPP_EXTERNAL_PREFIX}" @@ -52,9 +51,19 @@ if (NOT TARGET grpc-project) -DgRPC_PROTOBUF_PROVIDER=package -DgRPC_SSL_PROVIDER=package -DgRPC_ZLIB_PROVIDER=package + -DCMAKE_CXX_FLAGS=-fPIC + -DCMAKE_C_FLAGS=-fPIC + -DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF + -DgRPC_BUILD_GRPC_NODE_PLUGIN=OFF + -DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=OFF + -DgRPC_BUILD_GRPC_PHP_PLUGIN=OFF + -DgRPC_BUILD_GRPC_PYTHON_PLUGIN=OFF + -DgRPC_BUILD_GRPC_RUBY_PLUGIN=OFF + -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR} BUILD_COMMAND ${CMAKE_COMMAND} --build ${PARALLEL} LOG_DOWNLOAD ON LOG_CONFIGURE ON LOG_BUILD ON - LOG_INSTALL ON) + LOG_INSTALL ON + LOG_OUTPUT_ON_FAILURE ON) endif () diff --git a/super/external/protobuf.cmake b/super/external/protobuf.cmake index 7cc0aae1e..9351ef34f 100644 --- a/super/external/protobuf.cmake +++ b/super/external/protobuf.cmake @@ -17,7 +17,6 @@ find_package(Threads REQUIRED) include(ExternalProjectHelper) -include(external/zlib) if (NOT TARGET protobuf-project) # Give application developers a hook to configure the version and hash @@ -33,7 +32,6 @@ if (NOT TARGET protobuf-project) include(ExternalProject) ExternalProject_Add( protobuf-project - DEPENDS zlib-project EXCLUDE_FROM_ALL ON PREFIX "${CMAKE_BINARY_DIR}/external/protobuf" INSTALL_DIR "${GOOGLE_CLOUD_CPP_EXTERNAL_PREFIX}" @@ -51,9 +49,12 @@ if (NOT TARGET protobuf-project) -Dprotobuf_DEBUG_POSTFIX= -H/cmake -B + -DCMAKE_CXX_FLAGS=-fPIC + -DCMAKE_C_FLAGS=-fPIC BUILD_COMMAND ${CMAKE_COMMAND} --build ${PARALLEL} LOG_DOWNLOAD ON LOG_CONFIGURE ON LOG_BUILD ON - LOG_INSTALL ON) + LOG_INSTALL ON + LOG_OUTPUT_ON_FAILURE ON) endif () diff --git a/super/external/ssl.cmake b/super/external/ssl.cmake deleted file mode 100644 index 251eed2da..000000000 --- a/super/external/ssl.cmake +++ /dev/null @@ -1,26 +0,0 @@ -# ~~~ -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ~~~ - -if (NOT TARGET ssl-project) - # For OpenSSL we don't really support external projects. OpenSSL build - # system is notoriously finicky. Use vcpkg on Windows, or install OpenSSL - # using your operating system packages instead. - # - # This file is here to simplify the definition of external projects, such as - # curl and gRPC, that depend on a SSL library. - find_package(OpenSSL REQUIRED) - add_custom_target(ssl-project) -endif () diff --git a/super/external/zlib.cmake b/super/external/zlib.cmake deleted file mode 100644 index f9df5e4cc..000000000 --- a/super/external/zlib.cmake +++ /dev/null @@ -1,46 +0,0 @@ -# ~~~ -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ~~~ - -if (NOT TARGET zlib-project) - # Give application developers a hook to configure the version and hash - # downloaded from GitHub. - set(GOOGLE_CLOUD_CPP_ZLIB_URL - "https://github.com/madler/zlib/archive/v1.2.11.tar.gz") - set(GOOGLE_CLOUD_CPP_ZLIB_SHA256 - "629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff") - - set_external_project_build_parallel_level(PARALLEL) - set_external_project_vars() - - include(ExternalProject) - ExternalProject_Add( - zlib-project - EXCLUDE_FROM_ALL ON - PREFIX "${CMAKE_BINARY_DIR}/external/zlib" - INSTALL_DIR "${GOOGLE_CLOUD_CPP_EXTERNAL_PREFIX}" - URL ${GOOGLE_CLOUD_CPP_ZLIB_URL} - URL_HASH SHA256=${GOOGLE_CLOUD_CPP_ZLIB_SHA256} - LIST_SEPARATOR | - CMAKE_ARGS ${GOOGLE_CLOUD_CPP_EXTERNAL_PROJECT_CMAKE_FLAGS} - -DCMAKE_PREFIX_PATH=${GOOGLE_CLOUD_CPP_PREFIX_PATH} - -DCMAKE_INSTALL_RPATH=${GOOGLE_CLOUD_CPP_INSTALL_RPATH} - -DCMAKE_INSTALL_PREFIX= - BUILD_COMMAND ${CMAKE_COMMAND} --build ${PARALLEL} - LOG_DOWNLOAD ON - LOG_CONFIGURE ON - LOG_BUILD ON - LOG_INSTALL ON) -endif () -- 2.28.0