aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore
diff options
context:
space:
mode:
authorGravatar Gil <mcg@google.com>2018-07-16 08:50:53 -0700
committerGravatar GitHub <noreply@github.com>2018-07-16 08:50:53 -0700
commitcda87fa3afdacf20a097cf6ed90c5c2ef64e0437 (patch)
treeaeda6e64b1b925b7bb8a5dc8189d3c35efa31c4a /Firestore
parente963b606f3e90033086e08c1b989153467015ecd (diff)
Convert grpc and protobuf CMake builds to add_subdirectory (#1537)
* Build zlib with grpc's add_subdirectory * Build grpc and its children with add_subdirectory. * Build c-ares with grpc's add_subdirectory * Convert protobuf to a download-only ExternalProject * Temporarily break protobuf within grpc This works because libgrpc has no actual dependency on protobuf * Update boringssl to master@{2018-07-10}
Diffstat (limited to 'Firestore')
-rw-r--r--Firestore/CMakeLists.txt45
-rw-r--r--Firestore/Protos/CMakeLists.txt5
-rw-r--r--Firestore/core/src/firebase/firestore/remote/CMakeLists.txt2
3 files changed, 44 insertions, 8 deletions
diff --git a/Firestore/CMakeLists.txt b/Firestore/CMakeLists.txt
index cbcd49d..039cb06 100644
--- a/Firestore/CMakeLists.txt
+++ b/Firestore/CMakeLists.txt
@@ -42,9 +42,8 @@ if(APPLE)
find_package(FirebaseCore REQUIRED)
find_package(GoogleUtilities REQUIRED)
endif()
-find_package(GRPC REQUIRED)
find_package(LevelDB REQUIRED)
-find_package(Protobuf REQUIRED)
+find_package(ZLIB)
# Googletest
@@ -64,6 +63,48 @@ add_subdirectory(
)
+# gRPC
+if(ZLIB_FOUND)
+ set(gRPC_ZLIB_PROVIDER package CACHE STRING "Use external ZLIB")
+endif()
+
+set(gRPC_BUILD_TESTS OFF CACHE BOOL "Disable gRPC tests")
+add_subdirectory(
+ ${FIREBASE_BINARY_DIR}/src/grpc
+ ${FIREBASE_BINARY_DIR}/src/grpc-build
+ EXCLUDE_FROM_ALL
+)
+
+# Fix up targets included by gRPC's build
+add_alias(OpenSSL::Crypto crypto)
+target_include_directories(
+ crypto
+ INTERFACE
+ $<BUILD_INTERFACE:${FIREBASE_BINARY_DIR}/src/grpc/third_party/boringssl/include>
+)
+
+add_alias(OpenSSL::SSL ssl)
+target_include_directories(
+ ssl
+ INTERFACE
+ $<BUILD_INTERFACE:${FIREBASE_BINARY_DIR}/src/grpc/third_party/boringssl/include>
+)
+
+add_alias(protobuf::libprotobuf libprotobuf)
+target_compile_options(
+ libprotobuf
+ PUBLIC -Wno-unused-parameter
+)
+
+if(NOT ZLIB_FOUND)
+ target_include_directories(
+ zlibstatic
+ INTERFACE
+ $<BUILD_INTERFACE:${FIREBASE_BINARY_DIR}/src/grpc/third_party/zlib>
+ )
+endif()
+
+
# nanopb
set(nanopb_BUILD_GENERATOR ON CACHE BOOL "Enable the nanopb generator")
set(nanopb_PROTOC_PATH ${NANOPB_PROTOC_BIN} CACHE STRING "Protoc location")
diff --git a/Firestore/Protos/CMakeLists.txt b/Firestore/Protos/CMakeLists.txt
index 214c15f..c2132ae 100644
--- a/Firestore/Protos/CMakeLists.txt
+++ b/Firestore/Protos/CMakeLists.txt
@@ -97,8 +97,3 @@ target_include_directories(
firebase_firestore_protos_libprotobuf PUBLIC
${FIREBASE_SOURCE_DIR}/Firestore/Protos/cpp
)
-
-set_target_properties(
- firebase_firestore_protos_libprotobuf
- PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter"
-)
diff --git a/Firestore/core/src/firebase/firestore/remote/CMakeLists.txt b/Firestore/core/src/firebase/firestore/remote/CMakeLists.txt
index af62ab1..5de4648 100644
--- a/Firestore/core/src/firebase/firestore/remote/CMakeLists.txt
+++ b/Firestore/core/src/firebase/firestore/remote/CMakeLists.txt
@@ -29,5 +29,5 @@ cc_library(
firebase_firestore_nanopb
firebase_firestore_protos_nanopb
firebase_firestore_util
- grpc::grpc
+ grpc
)