From b15283bd27d6ac5eb784efc52ab13bc40b35a625 Mon Sep 17 00:00:00 2001 From: Gil Date: Sat, 13 Jan 2018 15:21:01 -0800 Subject: Build gRPC for Firestore C++ (#652) * Clean up quoting and other minor issues * Reorganize CMake build output Make it clearer which parts of the output pertain to external projects. * Use a consistent ordering of ExternalProject arguments * Prevent the top-level build from running in parallel This prevents spurious failures when running make -j. * Actually parse arguments in the xcodebuild function * Use ExternalProject features when available * submodule limits from CMake 3.0 * shallow clones from CMake 3.6 * git progress output from CMake 3.8 * Only build the parts of leveldb we need Skip building the tools and other libraries * Avoid installing ExternalProjects Consume build output directly so that we can build just the targets we need. Installing causes all targets to be built. This doesn't matter as much for these targets but the gRPC build includes a ton of stuff we don't need so it's worth adopting this as a general strategy. * Define an external build for grpc * Test that grpc can link successfully. * Add a FindGRPC CMake module * Actually comment ExternalProjext_GitSource --- cmake/external/leveldb.cmake | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'cmake/external/leveldb.cmake') diff --git a/cmake/external/leveldb.cmake b/cmake/external/leveldb.cmake index b3b3fe1..5b2068a 100644 --- a/cmake/external/leveldb.cmake +++ b/cmake/external/leveldb.cmake @@ -13,6 +13,7 @@ # limitations under the License. include(ExternalProject) +include(ExternalProjectFlags) if(WIN32 OR LEVELDB_ROOT) # If the user has supplied a LEVELDB_ROOT then just use it. Add an empty @@ -41,23 +42,38 @@ else() $<$:${CMAKE_CXX_FLAGS_RELEASE}>" ) + ExternalProject_GitSource( + LEVELDB_GIT + GIT_REPOSITORY "https://github.com/google/leveldb.git" + GIT_TAG "v1.20" + ) + ExternalProject_Add( leveldb + DEPENDS + googletest # for sequencing - GIT_REPOSITORY "https://github.com/google/leveldb.git" - GIT_TAG "v1.20" + ${LEVELDB_GIT} - PREFIX ${PROJECT_BINARY_DIR}/third_party/leveldb + PREFIX ${PROJECT_BINARY_DIR}/external/leveldb + # LevelDB's configuration is done in the Makefile CONFIGURE_COMMAND "" - BUILD_ALWAYS ON + + # The Makefile-based build of leveldb does not support building + # out-of-source. BUILD_IN_SOURCE ON + + # Only build the leveldb library skipping the tools and in-memory + # implementation we don't use. BUILD_COMMAND - env CXXFLAGS=${LEVELDB_CXX_FLAGS} OPT=${LEVELDB_OPT} make -j all + env CXXFLAGS=${LEVELDB_CXX_FLAGS} OPT=${LEVELDB_OPT} + make -j out-static/libleveldb.a INSTALL_DIR ${FIREBASE_INSTALL_DIR} INSTALL_COMMAND "" TEST_COMMAND "" ) + endif(WIN32 OR LEVELDB_ROOT) -- cgit v1.2.3