From 2a95b1375b1f3af8dad9be49ea7876ca0f627778 Mon Sep 17 00:00:00 2001 From: Eduardo Menges Mattje Date: Wed, 17 Jul 2024 17:26:07 -0300 Subject: [PATCH] Disabled whole gRPC_host build for protbuf only --- .github/workflows/test-build.yml | 4 +- build/CommonTargets.CMake | 91 ++++++++++++++------------------ grpc | 2 +- 3 files changed, 42 insertions(+), 55 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 3d52bc8..d56510f 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -55,9 +55,7 @@ jobs: brew install ccache ninja echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV - - name: Add Darwin toolchain - if: ${{ matrix.target == 'OSX'}} - run: rustup target add x86_64-apple-darwin + rustup target add x86_64-apple-darwin - name: Add iOS toolchain if: ${{ matrix.target == 'iOS' }} diff --git a/build/CommonTargets.CMake b/build/CommonTargets.CMake index 038fb63..0ec7b63 100644 --- a/build/CommonTargets.CMake +++ b/build/CommonTargets.CMake @@ -8,65 +8,38 @@ ExternalProject_Add(GTest ) set(_FINDPACKAGE_GTEST_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/GTest/lib/cmake/GTest") -set(COMMON_GRPC_CACHE_ARGS - -DABSL_ENABLE_INSTALL:BOOL=ON - -DABSL_PROPAGATE_CXX_STD:BOOL=ON - -DBUILD_SHARED_LIBS:BOOL=OFF - -DBUILD_TESTING:BOOL=OFF - -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} - -DgRPC_BUILD_CSHARP_EXT:BOOL=OFF - -DgRPC_BUILD_GRPC_CPP_PLUGIN:BOOL=ON - -DgRPC_BUILD_GRPC_CSHARP_PLUGIN:BOOL=OFF - -DgRPC_BUILD_GRPC_NODE_PLUGIN:BOOL=OFF - -DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN:BOOL=OFF - -DgRPC_BUILD_GRPC_PHP_PLUGIN:BOOL=OFF - -DgRPC_BUILD_GRPC_PYTHON_PLUGIN:BOOL=OFF - -DgRPC_BUILD_GRPC_RUBY_PLUGIN:BOOL=OFF - -DgRPC_INSTALL:BOOL=ON - -Dprotobuf_ABSL_PROVIDER:STRING=package - -Dprotobuf_MODULE_COMPATIBLE:BOOL=ON - -Dprotobuf_MSVC_STATIC_RUNTIME:BOOL=ON - -DRE2_BUILD_TESTING:BOOL=OFF - ${_MSVC_RUNTIME_LIBRARY} -) - -# Build gRPC and protoc for host OS. -# gRPC build is needed for `grpc_plugin_cpp`. +# Build protoc for host OS. if(CMAKE_CROSSCOMPILING) - set(GRPC_HOST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/gRPC_host") - set(PROTOBUF_TARGET gRPC_host) - set(GRPC_HOST_TARGET gRPC_host) - set(gRPC_BUILD_CODEGEN OFF) - - ExternalProject_Add(gRPC_host - PREFIX ${GRPC_HOST_PREFIX} - SOURCE_DIR "${THIRDPARTY_DIR}/grpc" + set(PROTOBUF_HOST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/protobuf_host") + set(PROTOBUF_TARGET protobuf_host) + + ExternalProject_Add(protobuf_host + PREFIX ${PROTOBUF_HOST_PREFIX} + SOURCE_DIR "${THIRDPARTY_DIR}/grpc/third_party/protobuf" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= CMAKE_CACHE_ARGS - ${COMMON_GRPC_CACHE_ARGS} - ) - - set(_grpc_EXTRA_PARAM - -DgRPC_BUILD_GRPC_CPP_PLUGIN:BOOL=OFF - -DCMAKE_PROGRAM_PATH:STRING=${GRPC_HOST_PREFIX}/bin;${CMAKE_PROGRAM_PATH} + -DABSL_BUILD_TESTING:BOOL=OFF + -DBUILD_TESTING:BOOL=OFF + -DCMAKE_BUILD_TYPE:STRING=Release + -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} + -Dprotobuf_BUILD_TESTS:BOOL=OFF + -Dprotobuf_MODULE_COMPATIBLE:BOOL=ON + -Dprotobuf_INSTALL:BOOL=ON ) else() - set(GRPC_HOST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/grpc") + set(PROTOBUF_HOST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/grpc") set(PROTOBUF_TARGET grpc) - set(gRPC_BUILD_CODEGEN ON) endif() -set(PROTOBUF_HOST_PREFIX "${GRPC_HOST_PREFIX}") - if(MSVC) set(Protobuf_HOST_DIR "${PROTOBUF_HOST_PREFIX}/cmake") else() set(Protobuf_HOST_DIR "${PROTOBUF_HOST_PREFIX}/lib/cmake/protobuf") endif() -set(absl_HOST_DIR "${GRPC_HOST_PREFIX}/lib/cmake/absl") -set(utf8_range_HOST_DIR "${GRPC_HOST_PREFIX}/lib/cmake/utf8_range") +set(absl_HOST_DIR "${PROTOBUF_HOST_PREFIX}/lib/cmake/absl") +set(utf8_range_HOST_DIR "${PROTOBUF_HOST_PREFIX}/lib/cmake/utf8_range") set(PROTOBUF_HOST_INCLUDE_DIR "${PROTOBUF_HOST_PREFIX}/include") set(PROTOBUF_HOST_LIB_DIR "${PROTOBUF_HOST_PREFIX}/lib") @@ -110,17 +83,33 @@ ExternalProject_Add(grpc -DCMAKE_INSTALL_PREFIX:PATH= CMAKE_CACHE_ARGS ${_CMAKE_COMMON_CACHE_ARGS} - ${COMMON_GRPC_CACHE_ARGS} - -DgRPC_BUILD_CODEGEN:BOOL=${gRPC_BUILD_CODEGEN} + -DABSL_ENABLE_INSTALL:BOOL=ON + -DABSL_PROPAGATE_CXX_STD:BOOL=ON + -DBUILD_SHARED_LIBS:BOOL=OFF + -DBUILD_TESTING:BOOL=OFF + -Dc-ares_DIR:PATH=${_FINDPACKAGE_CARES_CONFIG_DIR} + -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} + -DgRPC_BUILD_CODEGEN:BOOL=OFF + -DgRPC_BUILD_CSHARP_EXT:BOOL=OFF + -DgRPC_BUILD_GRPC_CPP_PLUGIN:BOOL=OFF + -DgRPC_BUILD_GRPC_CSHARP_PLUGIN:BOOL=OFF + -DgRPC_BUILD_GRPC_NODE_PLUGIN:BOOL=OFF + -DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN:BOOL=OFF + -DgRPC_BUILD_GRPC_PHP_PLUGIN:BOOL=OFF + -DgRPC_BUILD_GRPC_PYTHON_PLUGIN:BOOL=OFF + -DgRPC_BUILD_GRPC_RUBY_PLUGIN:BOOL=OFF + -DgRPC_CARES_PROVIDER:STRING=package + -DgRPC_INSTALL:BOOL=ON + -DgRPC_SSL_PROVIDER:STRING=package -DgRPC_ZLIB_PROVIDER:STRING=package + -Dprotobuf_ABSL_PROVIDER:STRING=package + -Dprotobuf_MODULE_COMPATIBLE:BOOL=ON + -Dprotobuf_MSVC_STATIC_RUNTIME:BOOL=ON + -DRE2_BUILD_TESTING:BOOL=OFF -DZLIB_ROOT:PATH=${ZLIB_ROOT} -DZLIB_USE_STATIC_LIBS:BOOL=ON - -DgRPC_SSL_PROVIDER:STRING=package - -DgRPC_CARES_PROVIDER:STRING=package - -Dc-ares_DIR:PATH=${_FINDPACKAGE_CARES_CONFIG_DIR} ${_OPENSSL_CACHE_ARGS} - ${_grpc_EXTRA_PARAM} - DEPENDS openssl ${GRPC_HOST_TARGET} zlib cares + DEPENDS openssl zlib cares ) ExternalProject_Get_Property(grpc INSTALL_DIR) diff --git a/grpc b/grpc index 9761d15..9713d45 160000 --- a/grpc +++ b/grpc @@ -1 +1 @@ -Subproject commit 9761d15cb208fbde52de7bab5d356810aa2a1f6d +Subproject commit 9713d459ed9a4716dccf8e69a9fff58bff684812