grpc.cmake 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # Copyright 2018 Google
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. include(ExternalProject)
  15. if(TARGET grpc)
  16. return()
  17. endif()
  18. ExternalProject_Add(
  19. grpc-download
  20. DOWNLOAD_DIR ${FIREBASE_DOWNLOAD_DIR}
  21. DOWNLOAD_NAME grpc-1.24.3.tar.gz
  22. URL https://github.com/grpc/grpc/archive/v1.24.3.tar.gz
  23. URL_HASH SHA256=c84b3fa140fcd6cce79b3f9de6357c5733a0071e04ca4e65ba5f8d306f10f033
  24. PREFIX ${PROJECT_BINARY_DIR}
  25. SOURCE_DIR ${PROJECT_BINARY_DIR}/src/grpc
  26. CONFIGURE_COMMAND ""
  27. BUILD_COMMAND ""
  28. TEST_COMMAND ""
  29. INSTALL_COMMAND ""
  30. # TODO(b/136119129): Get a common version of nanopb with gRPC.
  31. # We need to resolve how to arrange for gRPC and Firestore to get a common
  32. # version of nanopb.
  33. PATCH_COMMAND sed -i.bak "/third_party\\/nanopb/ d" ${PROJECT_BINARY_DIR}/src/grpc/CMakeLists.txt
  34. )
  35. # gRPC depends upon these projects, so from an IWYU point of view should
  36. # include these files. Unfortunately gRPC's build requires these to be
  37. # subdirectories in its own source tree and CMake's ExternalProject download
  38. # step clears the source tree so these must be declared to depend upon the grpc
  39. # target. ExternalProject dependencies must already exist when declared so
  40. # these must come after the ExternalProject_Add block above.
  41. include(boringssl)
  42. include(c-ares)
  43. include(protobuf)
  44. include(zlib)
  45. add_custom_target(
  46. grpc
  47. DEPENDS
  48. boringssl
  49. c-ares
  50. grpc-download
  51. protobuf
  52. zlib
  53. )