diff options
author | Gil <mcg@google.com> | 2018-06-12 10:55:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-12 10:55:48 -0700 |
commit | 0db8ef7dbe6c8c191252d33090dbb88b98735148 (patch) | |
tree | 35ada9d92eddbe4b43e8850eb52f5855755f8895 /cmake/external/grpc.cmake | |
parent | 9e14b80e0716c2be71c6100cad7aa7c61ac46c6e (diff) |
Fix protobuf/nanopb builds on Windows (#1392)
* Build protobuf with CMake for compatibility with Windows.
Fixes b/74067357
* Update to nanopb 0.3.9.1
This release includes functional CMake support for building the protoc
plugin.
* Fix license
* Build nanopb out-of-source
This is possible now that the build is CMake-based.
* Find protoc on windows
* Define CMAKE_ARGS in a more straightforward way
* Adjust libprotobuf locations to account for CMake build
Diffstat (limited to 'cmake/external/grpc.cmake')
-rw-r--r-- | cmake/external/grpc.cmake | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/cmake/external/grpc.cmake b/cmake/external/grpc.cmake index d545087..d192e94 100644 --- a/cmake/external/grpc.cmake +++ b/cmake/external/grpc.cmake @@ -33,6 +33,17 @@ else() -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DgRPC_BUILD_TESTS:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=OFF + + # TODO(rsgowman): We're currently building nanopb twice; once via grpc, and + # once via nanopb. The version from grpc is the one that actually ends up + # being used. We need to fix this such that either: + # a) we instruct grpc to use our nanopb + # b) we rely on grpc's nanopb instead of using our own. + # For now, we'll pass in the necessary nanopb cflags into grpc. (We require + # 16 bit fields. Without explicitly requesting this, nanopb uses 8 bit + # fields.) + -DCMAKE_C_FLAGS=-DPB_FIELD_16BIT + -DCMAKE_CXX_FLAGS=-DPB_FIELD_16BIT ) # zlib can be built by grpc but we can avoid it on platforms that provide it @@ -68,15 +79,8 @@ else() PREFIX ${PROJECT_BINARY_DIR}/external/grpc - # TODO(rsgowman): We're currently building nanopb twice; once via grpc, and - # once via nanopb. The version from grpc is the one that actually ends up - # being used. We need to fix this such that either: - # a) we instruct grpc to use our nanopb - # b) we rely on grpc's nanopb instead of using our own. - # For now, we'll pass in the necessary nanopb cflags into grpc. (We require - # 16 bit fields. Without explicitly requesting this, nanopb uses 8 bit - # fields.) - CMAKE_ARGS ${CMAKE_ARGS};-DCMAKE_C_FLAGS=-DPB_FIELD_16BIT;DCMAKE_CXX_FLAGS=-DPB_FIELD_16BIT + CMAKE_ARGS + ${CMAKE_ARGS} BUILD_COMMAND ${CMAKE_COMMAND} --build . --target grpc |