From e0ce9a9e94584775ee5f0cf0db95b4f204a5d115 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 | 6 ++- build/CommonTargets.CMake | 91 ++++++++++++++------------------ 2 files changed, 45 insertions(+), 52 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 3d52bc8..42813d0 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -89,5 +89,9 @@ jobs: if: ${{ matrix.target != 'OSX' && matrix.target != 'iOS' }} run: cmake -S build/${{matrix.target}} -B build/${{matrix.target}}/${{matrix.build_type}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} + - name: See protobuf-host cache + if: ${{matrix.target == 'Android'}} + run: cat build/${{matrix.target}}/${{matrix.build_type}}/protobuf_host/src/protobuf_host-build/CMakeCache.txt + - name: Build project - run: cmake --build build/${{matrix.target}}/${{matrix.build_type}} --config ${{matrix.build_type}} -j + run: cmake --build build/${{matrix.target}}/${{matrix.build_type}} --config ${{matrix.build_type}} -j --target protobuf-plugin 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)