From 5a6155f6a38a2d5515667406a5926c39753627e5 Mon Sep 17 00:00:00 2001 From: Gil Date: Wed, 3 Jan 2018 07:00:54 -0800 Subject: Build and test both C++ loggers where possible (#595) * Rename FIREBASE_BINARY_DIR to FIREBASE_INSTALL_DIR Make this consistent with the outer superbuild and also make the association with CMAKE_INSTALL_PREFIX more obvious. * Build and test log_stdio separate from the rest of util This is in preparation for adding a test for log_apple * Build and test log_apple under CMake Also add notes about how FIRLogger's debug mode can break this test * Refactor log_apple to cut down duplicate switch statements There's also a slight reduction in final binary size. --- .../src/firebase/firestore/util/CMakeLists.txt | 43 +++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'Firestore/core/src/firebase/firestore/util/CMakeLists.txt') diff --git a/Firestore/core/src/firebase/firestore/util/CMakeLists.txt b/Firestore/core/src/firebase/firestore/util/CMakeLists.txt index ebb2301..d70397d 100644 --- a/Firestore/core/src/firebase/firestore/util/CMakeLists.txt +++ b/Firestore/core/src/firebase/firestore/util/CMakeLists.txt @@ -15,6 +15,47 @@ add_library( firebase_firestore_util autoid.cc - log_stdio.cc secure_random_arc4random.cc ) + +# log_stdio can be built and tested everywhere +add_library( + firebase_firestore_util_log_stdio + log_stdio.cc +) + +# log_apple can only built and tested on apple plaforms +if(APPLE) + add_library( + firebase_firestore_util_log_apple + log_apple.mm + ) + target_compile_options( + firebase_firestore_util_log_apple + PRIVATE + ${OBJC_FLAGS} + ) + target_link_libraries( + firebase_firestore_util_log_apple + PUBLIC + FirebaseCore + ) +endif(APPLE) + +# Export a dependency on the correct logging library for this platform. All +# buildable libraries are built and tested but only the best fit is exported. +if(APPLE) + target_link_libraries( + firebase_firestore_util + PUBLIC + firebase_firestore_util_log_apple + ) + +else(NOT APPLE) + target_link_libraries( + firebase_firestore_util + PUBLIC + firebase_firestore_util_log_stdio + ) + +endif(APPLE) -- cgit v1.2.3