From e404054a9fe258f46a0fa2600a1114be4e5c4bca Mon Sep 17 00:00:00 2001 From: Gil Date: Tue, 10 Mar 2020 20:50:13 -0700 Subject: [PATCH] Refactor and clean up the CMake build ahead of CMake/iOS support (#5051) * Use early exit in objc_framework CMakeLists.txt * Clean up objc_framework CMakeLists.txt * Use `version` consistently * Use `firebase_ios_version` for the repo-level version * Remove INCLUDE directories that are no longer needed * Sort dependencies * Simplify Example/App/CMakeLists.txt * Add `OBJC_FLAGS` directly, avoiding a separate `sources` variable. * Add resources directly * Rename test host app to firebase_firestore_example_app * Add a firebase_ios prefix to functions and variables This reduces the chance of collision with other projects. * Simplify compiler_setup Now that compiler_setup.cmake no longer has side-effects, fold compiler_id.cmake and archive_options.cmake into it and move the include of compiler_setup up to the top of the main build. --- CMakeLists.txt | 20 +++-- FirebaseCore/CMakeLists.txt | 54 ++++++------- Firestore/Example/App/CMakeLists.txt | 57 ++++++------- Firestore/Example/Benchmarks/CMakeLists.txt | 2 +- Firestore/Example/Tests/API/CMakeLists.txt | 6 +- .../Example/Tests/Integration/CMakeLists.txt | 54 +++++++------ .../Example/Tests/SpecTests/CMakeLists.txt | 6 +- Firestore/Example/Tests/Util/CMakeLists.txt | 4 +- Firestore/Protos/CMakeLists.txt | 8 +- Firestore/Source/CMakeLists.txt | 4 +- .../src/firebase/firestore/CMakeLists.txt | 6 +- .../src/firebase/firestore/api/CMakeLists.txt | 4 +- .../firebase/firestore/auth/CMakeLists.txt | 8 +- .../firebase/firestore/core/CMakeLists.txt | 12 +-- .../firestore/immutable/CMakeLists.txt | 4 +- .../firebase/firestore/local/CMakeLists.txt | 8 +- .../firebase/firestore/model/CMakeLists.txt | 4 +- .../firebase/firestore/nanopb/CMakeLists.txt | 6 +- .../firebase/firestore/objc/CMakeLists.txt | 4 +- .../firebase/firestore/remote/CMakeLists.txt | 16 ++-- .../firebase/firestore/util/CMakeLists.txt | 32 ++++---- .../test/firebase/firestore/CMakeLists.txt | 4 +- .../firebase/firestore/api/CMakeLists.txt | 4 +- .../firebase/firestore/auth/CMakeLists.txt | 6 +- .../firebase/firestore/core/CMakeLists.txt | 4 +- .../firestore/immutable/CMakeLists.txt | 4 +- .../firebase/firestore/local/CMakeLists.txt | 6 +- .../firebase/firestore/model/CMakeLists.txt | 6 +- .../firebase/firestore/nanopb/CMakeLists.txt | 4 +- .../firebase/firestore/objc/CMakeLists.txt | 4 +- .../firebase/firestore/remote/CMakeLists.txt | 6 +- .../firestore/testutil/CMakeLists.txt | 6 +- .../firebase/firestore/util/CMakeLists.txt | 28 +++---- Firestore/fuzzing/CMakeLists.txt | 20 ++--- GoogleUtilities/CMakeLists.txt | 78 +++++++++--------- Interop/Auth/CMakeLists.txt | 26 +++--- Interop/CoreDiagnostics/CMakeLists.txt | 31 ++++--- cmake/archive_options.cmake | 28 ------- cmake/cc_rules.cmake | 81 ++++++++++--------- cmake/compiler_id.cmake | 23 ------ cmake/compiler_setup.cmake | 29 +++++-- cmake/fuzzing_options.cmake | 4 +- cmake/sanitizer_options.cmake | 4 +- 43 files changed, 345 insertions(+), 380 deletions(-) delete mode 100644 cmake/archive_options.cmake delete mode 100644 cmake/compiler_id.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index f549e1626c..ba24e93195 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2017 Google +# Copyright 2017 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ endif() # Generate Ninja phony rules for unknown dependencies in the build tree and # don't complain about doing so. Our dependencies aren't good about declaring -# BYPRODUCTS and we mix them all into a single uber build so we can't enable +# BYPRODUCTS and we mix them all into a single superbuild so we can't enable # this policy until all dependencies are capable of doing so. if(POLICY CMP0058) cmake_policy(SET CMP0058 OLD) @@ -68,8 +68,7 @@ option( list(INSERT CMAKE_MODULE_PATH 0 ${PROJECT_SOURCE_DIR}/cmake) -include(compiler_id) -include(archive_options) +include(compiler_setup) include(sanitizer_options) include(fuzzing_options) @@ -101,9 +100,9 @@ download_external_sources() # Googletest set(gtest_force_shared_crt ON CACHE BOOL "Use shared run-time") add_external_subdirectory(googletest) -add_alias(GTest::GTest gtest) -add_alias(GTest::Main gtest_main) -add_alias(GMock::GMock gmock) +firebase_ios_add_alias(GTest::GTest gtest) +firebase_ios_add_alias(GTest::Main gtest_main) +firebase_ios_add_alias(GMock::GMock gmock) # Benchmark @@ -179,14 +178,14 @@ if(OPENSSL_FOUND) else() # Not using outboard OpenSSL so set up BoringSSL to look like it. - add_alias(OpenSSL::Crypto crypto) + firebase_ios_add_alias(OpenSSL::Crypto crypto) target_include_directories( crypto INTERFACE $ ) - add_alias(OpenSSL::SSL ssl) + firebase_ios_add_alias(OpenSSL::SSL ssl) target_include_directories( ssl INTERFACE @@ -223,7 +222,7 @@ set(LEVELDB_BUILD_TESTS OFF CACHE BOOL "Firestore disabled") set(LEVELDB_BUILD_BENCHMARKS OFF CACHE BOOL "Firestore disabled") set(LEVELDB_INSTALL OFF CACHE BOOL "Firestore disabled") add_external_subdirectory(leveldb) -add_alias(LevelDB::LevelDB leveldb) +firebase_ios_add_alias(LevelDB::LevelDB leveldb) # nanopb @@ -254,7 +253,6 @@ endif() if(FIREBASE_IOS_BUILD_TESTS) enable_testing() endif() -include(compiler_setup) add_subdirectory(FirebaseCore) add_subdirectory(Firestore) diff --git a/FirebaseCore/CMakeLists.txt b/FirebaseCore/CMakeLists.txt index 937547766e..b08dee6a3c 100644 --- a/FirebaseCore/CMakeLists.txt +++ b/FirebaseCore/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2019 Google +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,30 +12,30 @@ # See the License for the specific language governing permissions and # limitations under the License. -if(APPLE) - file(GLOB sources Sources/*.m) - file(GLOB headers Sources/Private/*.h Sources/Public/*.h) - - podspec_version(core_version ${PROJECT_SOURCE_DIR}/FirebaseCore.podspec) - firebase_version(fb_version ${PROJECT_SOURCE_DIR}/FirebaseCore.podspec) - - objc_framework( - FirebaseCore - SOURCES ${sources} - HEADERS ${headers} - VERSION ${core_version} - DEFINES - FIRCore_VERSION=${core_version} - Firebase_VERSION=${fb_version} - INCLUDES - Sources/Private - Sources/Public - ${PROJECT_SOURCE_DIR} - DEPENDS - GoogleUtilities - FirebaseCoreDiagnosticsInterop - "-framework Foundation" - "-framework AppKit" - EXCLUDE_FROM_ALL - ) +if(NOT APPLE) + return() endif() + +file(GLOB sources Sources/*.m) +file(GLOB headers Sources/Private/*.h Sources/Public/*.h) + +podspec_version(version ${PROJECT_SOURCE_DIR}/FirebaseCore.podspec) +firebase_version(firebase_ios_version ${PROJECT_SOURCE_DIR}/FirebaseCore.podspec) + +firebase_ios_objc_framework( + FirebaseCore + SOURCES ${sources} + HEADERS ${headers} + VERSION ${version} + DEFINES + FIRCore_VERSION=${version} + Firebase_VERSION=${firebase_ios_version} + INCLUDES + ${PROJECT_SOURCE_DIR} + DEPENDS + FirebaseCoreDiagnosticsInterop + GoogleUtilities + "-framework AppKit" + "-framework Foundation" + EXCLUDE_FROM_ALL +) diff --git a/Firestore/Example/App/CMakeLists.txt b/Firestore/Example/App/CMakeLists.txt index 0281fedd2c..612de04eb3 100644 --- a/Firestore/Example/App/CMakeLists.txt +++ b/Firestore/Example/App/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2019 Google +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,38 +12,31 @@ # See the License for the specific language governing permissions and # limitations under the License. -if(APPLE) - set( - sources - macOS/main.m - macOS/AppDelegate.m - macOS/AppDelegate.h - ) +if(NOT APPLE) + return() +endif() - set( - resources - GoogleService-Info.plist - ) +add_executable( + firebase_firestore_example_app MACOSX_BUNDLE + macOS/AppDelegate.h + macOS/AppDelegate.m + macOS/main.m +) - add_executable( - firestore_example_app_macos MACOSX_BUNDLE - ${sources} - ) +target_compile_options( + firebase_firestore_example_app + PRIVATE ${FIREBASE_IOS_OBJC_FLAGS} +) - add_objc_flags( - firestore_example_app_macos - ${sources} - ) +target_link_libraries( + firebase_firestore_example_app + PRIVATE + "-framework AppKit" + "-framework Foundation" +) - target_link_libraries( - firestore_example_app_macos - PRIVATE "-framework AppKit" - ) - - set_target_properties( - firestore_example_app_macos PROPERTIES - MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/macOS/Info.plist - RESOURCE "${resources}" - ) - -endif(APPLE) +set_target_properties( + firebase_firestore_example_app PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/macOS/Info.plist + RESOURCE GoogleService-Info.plist +) diff --git a/Firestore/Example/Benchmarks/CMakeLists.txt b/Firestore/Example/Benchmarks/CMakeLists.txt index 4199bca9cb..e4da288632 100644 --- a/Firestore/Example/Benchmarks/CMakeLists.txt +++ b/Firestore/Example/Benchmarks/CMakeLists.txt @@ -13,7 +13,7 @@ # limitations under the License. if(APPLE) - cc_binary( + firebase_ios_cc_binary( firebase_firestore_remote_document_cache_benchmark SOURCES remote_document_cache_benchmark.mm diff --git a/Firestore/Example/Tests/API/CMakeLists.txt b/Firestore/Example/Tests/API/CMakeLists.txt index 6611a8a697..3c357c6106 100644 --- a/Firestore/Example/Tests/API/CMakeLists.txt +++ b/Firestore/Example/Tests/API/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2019 Google +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,9 +13,9 @@ # limitations under the License. if(APPLE) - objc_test( + firebase_ios_objc_test( firebase_firestore_objc_api_test - HOST firestore_example_app_macos + HOST firebase_firestore_example_app SOURCES FIRCollectionReferenceTests.mm FIRDocumentReferenceTests.mm diff --git a/Firestore/Example/Tests/Integration/CMakeLists.txt b/Firestore/Example/Tests/Integration/CMakeLists.txt index 1e5c94e96b..8ebde83844 100644 --- a/Firestore/Example/Tests/Integration/CMakeLists.txt +++ b/Firestore/Example/Tests/Integration/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2019 Google +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,28 +12,30 @@ # See the License for the specific language governing permissions and # limitations under the License. -if(APPLE) - objc_test( - firebase_firestore_objc_integration_test - HOST firestore_example_app_macos - SOURCES - FSTSmokeTests.mm - FSTDatastoreTests.mm - FSTTransactionTests.mm - API/FIRArrayTransformTests.mm - API/FIRFieldsTests.mm - API/FIRNumericTransformTests.mm - API/FIRTypeTests.mm - API/FIRCursorTests.mm - API/FIRFirestoreSourceTests.mm - API/FIRQueryTests.mm - API/FIRValidationTests.mm - API/FIRDatabaseTests.mm - API/FIRListenerRegistrationTests.mm - API/FIRServerTimestampTests.mm - API/FIRWriteBatchTests.mm - DEPENDS - FirebaseFirestore - firebase_firestore_objc_test_util - ) -endif(APPLE) +if(NOT APPLE) + return() +endif() + +firebase_ios_objc_test( + firebase_firestore_objc_integration_test + HOST firebase_firestore_example_app + SOURCES + FSTSmokeTests.mm + FSTDatastoreTests.mm + FSTTransactionTests.mm + API/FIRArrayTransformTests.mm + API/FIRFieldsTests.mm + API/FIRNumericTransformTests.mm + API/FIRTypeTests.mm + API/FIRCursorTests.mm + API/FIRFirestoreSourceTests.mm + API/FIRQueryTests.mm + API/FIRValidationTests.mm + API/FIRDatabaseTests.mm + API/FIRListenerRegistrationTests.mm + API/FIRServerTimestampTests.mm + API/FIRWriteBatchTests.mm + DEPENDS + FirebaseFirestore + firebase_firestore_objc_test_util +) diff --git a/Firestore/Example/Tests/SpecTests/CMakeLists.txt b/Firestore/Example/Tests/SpecTests/CMakeLists.txt index 3ed290169e..382f20011e 100644 --- a/Firestore/Example/Tests/SpecTests/CMakeLists.txt +++ b/Firestore/Example/Tests/SpecTests/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2019 Google +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,9 +13,9 @@ # limitations under the License. if(APPLE) - objc_test( + firebase_ios_objc_test( firebase_firestore_objc_spec_test - HOST firestore_example_app_macos + HOST firebase_firestore_example_app SOURCES FSTLevelDBSpecTests.mm FSTMemorySpecTests.mm diff --git a/Firestore/Example/Tests/Util/CMakeLists.txt b/Firestore/Example/Tests/Util/CMakeLists.txt index 8a6c450fdc..7c0af89668 100644 --- a/Firestore/Example/Tests/Util/CMakeLists.txt +++ b/Firestore/Example/Tests/Util/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2019 Google +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ # limitations under the License. if(APPLE) - cc_library( + firebase_ios_cc_library( firebase_firestore_objc_test_util HEADERS FSTEventAccumulator.h diff --git a/Firestore/Protos/CMakeLists.txt b/Firestore/Protos/CMakeLists.txt index d089e1399b..282416423b 100644 --- a/Firestore/Protos/CMakeLists.txt +++ b/Firestore/Protos/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ set( google/rpc/status google/type/latlng ) + # Full filenames (i.e. with the .proto) from within the proto directory, # excluding anything in google/protobuf foreach(root ${PROTO_FILE_ROOTS}) @@ -58,6 +59,7 @@ set( google/protobuf/timestamp google/protobuf/wrappers ) + # Full filenames (i.e. with the .proto) from within the proto directory, from # the google/protobuf package. foreach(root ${WELL_KNOWN_PROTO_FILE_ROOTS}) @@ -111,7 +113,7 @@ function(snake_case_to_camel_case str var) set(${var} ${str} PARENT_SCOPE) endfunction() -cc_library( +firebase_ios_cc_library( firebase_firestore_protos_nanopb SOURCES ${NANOPB_GENERATED_SOURCES} @@ -141,7 +143,6 @@ if(CXX_CLANG OR CXX_GNU) ) endif() - target_include_directories( firebase_firestore_protos_libprotobuf PUBLIC ${FIREBASE_SOURCE_DIR}/Firestore/Protos/cpp @@ -172,7 +173,6 @@ add_custom_command( ${PROTOBUF_PROTO} ) - # Generate the python representation of nanopb's protos set(NANOPB_DIR ${FIREBASE_BINARY_DIR}/external/src/nanopb) set( diff --git a/Firestore/Source/CMakeLists.txt b/Firestore/Source/CMakeLists.txt index e997dabff1..b8043eb5e9 100644 --- a/Firestore/Source/CMakeLists.txt +++ b/Firestore/Source/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2019 Google +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ if(APPLE) ${PROJECT_SOURCE_DIR}/FirebaseFirestore.podspec ) - objc_framework( + firebase_ios_objc_framework( FirebaseFirestore SHARED HEADERS diff --git a/Firestore/core/src/firebase/firestore/CMakeLists.txt b/Firestore/core/src/firebase/firestore/CMakeLists.txt index f7a6d15918..fed9a7bc1b 100644 --- a/Firestore/core/src/firebase/firestore/CMakeLists.txt +++ b/Firestore/core/src/firebase/firestore/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ # limitations under the License. # Public types to be used both internally and externally. -cc_library( +firebase_ios_cc_library( firebase_firestore_types SOURCES geo_point.cc @@ -24,7 +24,7 @@ cc_library( firebase_firestore_util ) -cc_library( +firebase_ios_cc_library( firebase_firestore_version SOURCES firestore_version.cc diff --git a/Firestore/core/src/firebase/firestore/api/CMakeLists.txt b/Firestore/core/src/firebase/firestore/api/CMakeLists.txt index 34e8e81d55..74ffd138f5 100644 --- a/Firestore/core/src/firebase/firestore/api/CMakeLists.txt +++ b/Firestore/core/src/firebase/firestore/api/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2019 Google +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cc_library( +firebase_ios_cc_library( firebase_firestore_api SOURCES api_fwd.h diff --git a/Firestore/core/src/firebase/firestore/auth/CMakeLists.txt b/Firestore/core/src/firebase/firestore/auth/CMakeLists.txt index e586d86837..75ca914a35 100644 --- a/Firestore/core/src/firebase/firestore/auth/CMakeLists.txt +++ b/Firestore/core/src/firebase/firestore/auth/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cc_library( +firebase_ios_cc_library( firebase_firestore_auth_base SOURCES credentials_provider.cc @@ -26,7 +26,7 @@ cc_library( firebase_firestore_util ) -cc_library( +firebase_ios_cc_library( firebase_firestore_auth_apple SOURCES firebase_credentials_provider_apple.h @@ -42,7 +42,7 @@ if(APPLE) list(APPEND AUTH_DEPENDS firebase_firestore_auth_apple) endif() -cc_library( +firebase_ios_cc_library( firebase_firestore_auth SOURCES empty_credentials_provider.cc diff --git a/Firestore/core/src/firebase/firestore/core/CMakeLists.txt b/Firestore/core/src/firebase/firestore/core/CMakeLists.txt index ab7c272280..ac7352eb70 100644 --- a/Firestore/core/src/firebase/firestore/core/CMakeLists.txt +++ b/Firestore/core/src/firebase/firestore/core/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cc_library( +firebase_ios_cc_library( firebase_firestore_core_query SOURCES array_contains_any_filter.cc @@ -47,7 +47,7 @@ cc_library( firebase_firestore_model ) -cc_library( +firebase_ios_cc_library( firebase_firestore_core_target_id_generator SOURCES target_id_generator.cc @@ -57,7 +57,7 @@ cc_library( firebase_firestore_util ) -cc_library( +firebase_ios_cc_library( firebase_firestore_core_transaction SOURCES transaction.cc @@ -69,7 +69,7 @@ cc_library( ) -cc_library( +firebase_ios_cc_library( firebase_firestore_core_view SOURCES query_listener.cc @@ -84,7 +84,7 @@ cc_library( firebase_firestore_model ) -cc_library( +firebase_ios_cc_library( firebase_firestore_core SOURCES core_fwd.h diff --git a/Firestore/core/src/firebase/firestore/immutable/CMakeLists.txt b/Firestore/core/src/firebase/firestore/immutable/CMakeLists.txt index 821f391b74..433bb0743f 100644 --- a/Firestore/core/src/firebase/firestore/immutable/CMakeLists.txt +++ b/Firestore/core/src/firebase/firestore/immutable/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cc_library( +firebase_ios_cc_library( firebase_firestore_immutable SOURCES append_only_list.h diff --git a/Firestore/core/src/firebase/firestore/local/CMakeLists.txt b/Firestore/core/src/firebase/firestore/local/CMakeLists.txt index 292ebf0620..829a3e9a5f 100644 --- a/Firestore/core/src/firebase/firestore/local/CMakeLists.txt +++ b/Firestore/core/src/firebase/firestore/local/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cc_library( +firebase_ios_cc_library( firebase_firestore_local_base SOURCES document_key_reference.cc @@ -38,7 +38,7 @@ cc_library( ) -cc_library( +firebase_ios_cc_library( firebase_firestore_local_persistence_leveldb SOURCES leveldb_index_manager.cc @@ -76,7 +76,7 @@ cc_library( EXCLUDE_FROM_ALL ) -cc_library( +firebase_ios_cc_library( firebase_firestore_local SOURCES document_key_reference.cc diff --git a/Firestore/core/src/firebase/firestore/model/CMakeLists.txt b/Firestore/core/src/firebase/firestore/model/CMakeLists.txt index 75e4269d6b..42da817650 100644 --- a/Firestore/core/src/firebase/firestore/model/CMakeLists.txt +++ b/Firestore/core/src/firebase/firestore/model/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cc_library( +firebase_ios_cc_library( firebase_firestore_model SOURCES base_path.h diff --git a/Firestore/core/src/firebase/firestore/nanopb/CMakeLists.txt b/Firestore/core/src/firebase/firestore/nanopb/CMakeLists.txt index 816a956bbd..9754687b3a 100644 --- a/Firestore/core/src/firebase/firestore/nanopb/CMakeLists.txt +++ b/Firestore/core/src/firebase/firestore/nanopb/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cc_library( +firebase_ios_cc_library( firebase_firestore_nanopb_runtime SOURCES byte_string.cc @@ -28,7 +28,7 @@ cc_library( protobuf-nanopb-static ) -cc_library( +firebase_ios_cc_library( firebase_firestore_nanopb SOURCES fields_array.h diff --git a/Firestore/core/src/firebase/firestore/objc/CMakeLists.txt b/Firestore/core/src/firebase/firestore/objc/CMakeLists.txt index d14dadcec1..10719a83e0 100644 --- a/Firestore/core/src/firebase/firestore/objc/CMakeLists.txt +++ b/Firestore/core/src/firebase/firestore/objc/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2019 Google +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ # libraries in here are an implementation detail of making this a # mutli-platform build. -cc_library( +firebase_ios_cc_library( firebase_firestore_objc HEADER_ONLY # Still true on non-Apple platforms SOURCES diff --git a/Firestore/core/src/firebase/firestore/remote/CMakeLists.txt b/Firestore/core/src/firebase/firestore/remote/CMakeLists.txt index 4d7c38a7d4..334a5da173 100644 --- a/Firestore/core/src/firebase/firestore/remote/CMakeLists.txt +++ b/Firestore/core/src/firebase/firestore/remote/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cc_library( +firebase_ios_cc_library( firebase_firestore_remote_connectivity_monitor_apple SOURCES connectivity_monitor.cc @@ -25,7 +25,7 @@ cc_library( EXCLUDE_FROM_ALL ) -cc_library( +firebase_ios_cc_library( firebase_firestore_remote_connectivity_monitor_noop SOURCES connectivity_monitor.cc @@ -37,7 +37,7 @@ cc_library( EXCLUDE_FROM_ALL ) -cc_select( +firebase_ios_cc_select( firebase_firestore_remote_connectivity_monitor APPLE firebase_firestore_remote_connectivity_monitor_apple DEFAULT firebase_firestore_remote_connectivity_monitor_noop @@ -82,7 +82,7 @@ add_custom_target( ${GRPC_ROOT_CERTIFICATE_SOURCES} ) -cc_library( +firebase_ios_cc_library( firebase_firestore_remote_grpc SOURCES grpc_call.h @@ -115,7 +115,7 @@ cc_library( protobuf-nanopb-static ) -cc_library( +firebase_ios_cc_library( firebase_firestore_remote_datastore SOURCES datastore.cc @@ -139,7 +139,7 @@ cc_library( firebase_firestore_remote_serializer ) -cc_library( +firebase_ios_cc_library( firebase_firestore_remote_serializer SOURCES serializer.cc @@ -150,7 +150,7 @@ cc_library( protobuf-nanopb-static ) -cc_library( +firebase_ios_cc_library( firebase_firestore_remote SOURCES existence_filter.h diff --git a/Firestore/core/src/firebase/firestore/util/CMakeLists.txt b/Firestore/core/src/firebase/firestore/util/CMakeLists.txt index 420b7c5b7b..2e257dc58b 100644 --- a/Firestore/core/src/firebase/firestore/util/CMakeLists.txt +++ b/Firestore/core/src/firebase/firestore/util/CMakeLists.txt @@ -24,7 +24,7 @@ include(CheckIncludeFiles) check_symbol_exists(dispatch_async_f dispatch/dispatch.h HAVE_LIBDISPATCH) -cc_library( +firebase_ios_cc_library( firebase_firestore_util_async_std SOURCES async_queue.cc @@ -41,7 +41,7 @@ cc_library( EXCLUDE_FROM_ALL ) -cc_library( +firebase_ios_cc_library( firebase_firestore_util_async_libdispatch SOURCES async_queue.cc @@ -59,7 +59,7 @@ cc_library( EXCLUDE_FROM_ALL ) -cc_select( +firebase_ios_cc_select( firebase_firestore_util_async HAVE_LIBDISPATCH firebase_firestore_util_async_libdispatch DEFAULT firebase_firestore_util_async_std @@ -68,7 +68,7 @@ cc_select( ## base -cc_library( +firebase_ios_cc_library( firebase_firestore_util_base_stdio SOURCES exception.cc @@ -87,7 +87,7 @@ cc_library( EXCLUDE_FROM_ALL ) -cc_library( +firebase_ios_cc_library( firebase_firestore_util_base_apple SOURCES exception.cc @@ -109,7 +109,7 @@ cc_library( EXCLUDE_FROM_ALL ) -cc_select( +firebase_ios_cc_select( firebase_firestore_util_base APPLE firebase_firestore_util_base_apple DEFAULT firebase_firestore_util_base_stdio @@ -118,7 +118,7 @@ cc_select( ## filesystem -cc_library( +firebase_ios_cc_library( firebase_firestore_util_filesystem_apple SOURCES filesystem.h @@ -133,7 +133,7 @@ cc_library( EXCLUDE_FROM_ALL ) -cc_library( +firebase_ios_cc_library( firebase_firestore_util_filesystem_posix SOURCES filesystem.h @@ -147,7 +147,7 @@ cc_library( EXCLUDE_FROM_ALL ) -cc_library( +firebase_ios_cc_library( firebase_firestore_util_filesystem_win SOURCES filesystem.h @@ -161,7 +161,7 @@ cc_library( EXCLUDE_FROM_ALL ) -cc_select( +firebase_ios_cc_select( firebase_firestore_util_filesystem APPLE firebase_firestore_util_filesystem_apple WIN32 firebase_firestore_util_filesystem_win @@ -172,7 +172,7 @@ cc_select( ## random check_symbol_exists(arc4random stdlib.h HAVE_ARC4RANDOM) -cc_library( +firebase_ios_cc_library( firebase_firestore_util_random_arc4random SOURCES secure_random.h @@ -186,7 +186,7 @@ if(TARGET OpenSSL::Crypto) OpenSSL::Crypto INTERFACE_INCLUDE_DIRECTORIES ) check_include_files(openssl/rand.h HAVE_OPENSSL_RAND_H) - cc_library( + firebase_ios_cc_library( firebase_firestore_util_random_openssl SOURCES secure_random.h @@ -197,7 +197,7 @@ if(TARGET OpenSSL::Crypto) ) endif() -cc_select( +firebase_ios_cc_select( firebase_firestore_util_random HAVE_ARC4RANDOM firebase_firestore_util_random_arc4random HAVE_OPENSSL_RAND_H firebase_firestore_util_random_openssl @@ -206,7 +206,7 @@ cc_select( ## status -cc_library( +firebase_ios_cc_library( firebase_firestore_util_status SOURCES error_apple.h @@ -236,7 +236,7 @@ configure_file( config.h # NOLINT(generated) ) -cc_library( +firebase_ios_cc_library( firebase_firestore_util_autoid SOURCES autoid.cc @@ -245,7 +245,7 @@ cc_library( firebase_firestore_util_random ) -cc_library( +firebase_ios_cc_library( firebase_firestore_util SOURCES bits.cc diff --git a/Firestore/core/test/firebase/firestore/CMakeLists.txt b/Firestore/core/test/firebase/firestore/CMakeLists.txt index 35a0e17c56..5fc266cc70 100644 --- a/Firestore/core/test/firebase/firestore/CMakeLists.txt +++ b/Firestore/core/test/firebase/firestore/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ # Xcode, but that's not necessary in CMake which directly supports running # GoogleTest-based tests. -cc_test( +firebase_ios_cc_test( firebase_firestore_types_test SOURCES geo_point_test.cc diff --git a/Firestore/core/test/firebase/firestore/api/CMakeLists.txt b/Firestore/core/test/firebase/firestore/api/CMakeLists.txt index 7442c0e1a3..f40f645cbc 100644 --- a/Firestore/core/test/firebase/firestore/api/CMakeLists.txt +++ b/Firestore/core/test/firebase/firestore/api/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2019 Google +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cc_test( +firebase_ios_cc_test( firebase_firestore_api_test SOURCES cc_compilation_test.cc diff --git a/Firestore/core/test/firebase/firestore/auth/CMakeLists.txt b/Firestore/core/test/firebase/firestore/auth/CMakeLists.txt index a6aa2ef71c..e286009a9f 100644 --- a/Firestore/core/test/firebase/firestore/auth/CMakeLists.txt +++ b/Firestore/core/test/firebase/firestore/auth/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cc_test( +firebase_ios_cc_test( firebase_firestore_auth_test SOURCES credentials_provider_test.cc @@ -24,7 +24,7 @@ cc_test( ) if(APPLE) - cc_test( + firebase_ios_cc_test( firebase_firestore_auth_apple_test SOURCES firebase_credentials_provider_test.mm diff --git a/Firestore/core/test/firebase/firestore/core/CMakeLists.txt b/Firestore/core/test/firebase/firestore/core/CMakeLists.txt index 20c13d1169..27590c3d65 100644 --- a/Firestore/core/test/firebase/firestore/core/CMakeLists.txt +++ b/Firestore/core/test/firebase/firestore/core/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cc_test( +firebase_ios_cc_test( firebase_firestore_core_test SOURCES database_info_test.cc diff --git a/Firestore/core/test/firebase/firestore/immutable/CMakeLists.txt b/Firestore/core/test/firebase/firestore/immutable/CMakeLists.txt index 9166bfd573..34334a7d11 100644 --- a/Firestore/core/test/firebase/firestore/immutable/CMakeLists.txt +++ b/Firestore/core/test/firebase/firestore/immutable/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cc_test( +firebase_ios_cc_test( firebase_firestore_immutable_test SOURCES append_only_list_test.cc diff --git a/Firestore/core/test/firebase/firestore/local/CMakeLists.txt b/Firestore/core/test/firebase/firestore/local/CMakeLists.txt index b3d220e71b..7bff56a388 100644 --- a/Firestore/core/test/firebase/firestore/local/CMakeLists.txt +++ b/Firestore/core/test/firebase/firestore/local/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cc_library( +firebase_ios_cc_library( firebase_firestore_local_testing SOURCES counting_query_engine.cc @@ -24,7 +24,7 @@ cc_library( firebase_firestore_local_persistence_leveldb ) -cc_test( +firebase_ios_cc_test( firebase_firestore_local_test SOURCES index_free_query_engine_test.cc diff --git a/Firestore/core/test/firebase/firestore/model/CMakeLists.txt b/Firestore/core/test/firebase/firestore/model/CMakeLists.txt index 7b862e8c2d..1966c950df 100644 --- a/Firestore/core/test/firebase/firestore/model/CMakeLists.txt +++ b/Firestore/core/test/firebase/firestore/model/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cc_test( +firebase_ios_cc_test( firebase_firestore_model_test SOURCES database_id_test.cc @@ -35,7 +35,7 @@ cc_test( GMock::GMock ) -cc_binary( +firebase_ios_cc_binary( firebase_firestore_model_field_value_benchmark SOURCES field_value_benchmark.cc diff --git a/Firestore/core/test/firebase/firestore/nanopb/CMakeLists.txt b/Firestore/core/test/firebase/firestore/nanopb/CMakeLists.txt index f496a69e38..8fa8075ce1 100644 --- a/Firestore/core/test/firebase/firestore/nanopb/CMakeLists.txt +++ b/Firestore/core/test/firebase/firestore/nanopb/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cc_test( +firebase_ios_cc_test( firebase_firestore_nanopb_test SOURCES byte_string_test.cc diff --git a/Firestore/core/test/firebase/firestore/objc/CMakeLists.txt b/Firestore/core/test/firebase/firestore/objc/CMakeLists.txt index 5357dcb1d1..5723ef92cd 100644 --- a/Firestore/core/test/firebase/firestore/objc/CMakeLists.txt +++ b/Firestore/core/test/firebase/firestore/objc/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2019 Google +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ # limitations under the License. if(APPLE) - cc_test( + firebase_ios_cc_test( firebase_firestore_objc_test SOURCES objc_type_traits_apple_test.mm diff --git a/Firestore/core/test/firebase/firestore/remote/CMakeLists.txt b/Firestore/core/test/firebase/firestore/remote/CMakeLists.txt index fa1f596699..df57a66b6b 100644 --- a/Firestore/core/test/firebase/firestore/remote/CMakeLists.txt +++ b/Firestore/core/test/firebase/firestore/remote/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cc_library( +firebase_ios_cc_library( firebase_firestore_remote_testing SOURCES fake_target_metadata_provider.cc @@ -21,7 +21,7 @@ cc_library( firebase_firestore_remote ) -cc_test( +firebase_ios_cc_test( firebase_firestore_remote_test SOURCES datastore_test.cc diff --git a/Firestore/core/test/firebase/firestore/testutil/CMakeLists.txt b/Firestore/core/test/firebase/firestore/testutil/CMakeLists.txt index 1b399f44b5..2c6d1fc7d9 100644 --- a/Firestore/core/test/firebase/firestore/testutil/CMakeLists.txt +++ b/Firestore/core/test/firebase/firestore/testutil/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cc_library( +firebase_ios_cc_library( firebase_firestore_testutil_apple SOURCES app_testing.h @@ -29,7 +29,7 @@ if(APPLE) list(APPEND TESTUTIL_DEPENDS firebase_firestore_testutil_apple) endif() -cc_library( +firebase_ios_cc_library( firebase_firestore_testutil SOURCES async_testing.cc diff --git a/Firestore/core/test/firebase/firestore/util/CMakeLists.txt b/Firestore/core/test/firebase/firestore/util/CMakeLists.txt index 3e876a6f9a..8122d8de8d 100644 --- a/Firestore/core/test/firebase/firestore/util/CMakeLists.txt +++ b/Firestore/core/test/firebase/firestore/util/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2017 Google +# Copyright 2017 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ endif() ## async -cc_test( +firebase_ios_cc_test( firebase_firestore_util_async_std_test SOURCES async_queue_std_test.cc @@ -37,7 +37,7 @@ cc_test( ) if(HAVE_LIBDISPATCH) - cc_test( + firebase_ios_cc_test( firebase_firestore_util_async_libdispatch_test SOURCES async_queue_libdispatch_test.mm @@ -56,7 +56,7 @@ endif() ## base if(APPLE) - cc_test( + firebase_ios_cc_test( firebase_firestore_util_base_apple_test SOURCES hard_assert_test.cc @@ -67,7 +67,7 @@ if(APPLE) ) endif(APPLE) -cc_test( +firebase_ios_cc_test( firebase_firestore_util_base_stdio_test SOURCES hard_assert_test.cc @@ -80,7 +80,7 @@ cc_test( ## filesystem if(APPLE) - cc_test( + firebase_ios_cc_test( firebase_firestore_util_filesystem_apple_test SOURCES filesystem_test.cc @@ -95,7 +95,7 @@ if(APPLE) endif() if(NOT APPLE AND NOT WIN32) - cc_test( + firebase_ios_cc_test( firebase_firestore_util_filesystem_posix_test SOURCES filesystem_test.cc @@ -110,7 +110,7 @@ if(NOT APPLE AND NOT WIN32) endif() if(WIN32) - cc_test( + firebase_ios_cc_test( firebase_firestore_util_filesystem_win_test SOURCES filesystem_test.cc @@ -128,7 +128,7 @@ endif() ## random if(HAVE_ARC4RANDOM) - cc_test( + firebase_ios_cc_test( firebase_firestore_util_random_arc4random_test SOURCES secure_random_test.cc @@ -138,7 +138,7 @@ if(HAVE_ARC4RANDOM) endif() if(HAVE_OPENSSL_RAND_H) - cc_test( + firebase_ios_cc_test( firebase_firestore_util_random_openssl_test SOURCES secure_random_test.cc @@ -150,7 +150,7 @@ endif() ## main library -cc_test( +firebase_ios_cc_test( firebase_firestore_util_test SOURCES autoid_test.cc @@ -182,7 +182,7 @@ cc_test( # Helper utilities -cc_library( +firebase_ios_cc_library( firebase_firestore_remote_test_util SOURCES create_noop_connectivity_monitor.h @@ -204,7 +204,7 @@ cc_library( # Benchmarks -cc_binary( +firebase_ios_cc_binary( firebase_firestore_util_ordered_code_benchmark SOURCES ordered_code_benchmark.cc @@ -215,7 +215,7 @@ cc_binary( ) if(APPLE) - cc_binary( + firebase_ios_cc_binary( firebase_firestore_util_string_apple_benchmark SOURCES string_apple_benchmark.mm diff --git a/Firestore/fuzzing/CMakeLists.txt b/Firestore/fuzzing/CMakeLists.txt index b7255ce5c1..c84f1f7c4a 100644 --- a/Firestore/fuzzing/CMakeLists.txt +++ b/Firestore/fuzzing/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,11 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Builds all fuzzing targets using cc_fuzz_test build rule, which copies the -# provided dictionary and corpus to the destination directory. A fuzzing target -# that tests xyz must be called 'xyz_fuzzer'. The copied dictionary will be -# called 'xyz_fuzzer.dict' and its corpus 'xyz_fuzzer_seed_corpus'. See -# cc_rules.cmake for more information. +# Builds all fuzzing targets using firebase_ios_cc_fuzz_test build rule, which +# copies the provided dictionary and corpus to the destination directory. A +# fuzzing target that tests xyz must be called 'xyz_fuzzer'. The copied +# dictionary will be called 'xyz_fuzzer.dict' and its corpus +# 'xyz_fuzzer_seed_corpus'. See cc_rules.cmake for more information. if(NOT FUZZING) return() @@ -30,7 +30,7 @@ set(fuzzing_resources ${FIREBASE_SOURCE_DIR}/Firestore/Example/FuzzTests/Fuzzing # the serializer corpus by converting the text protos from the serializer # corpus in the iOS FuzzingResources to binary protos. This conversion requires # the protoc binary that is not currently available. -cc_fuzz_test( +firebase_ios_cc_fuzz_test( serializer_fuzzer DICTIONARY ${fuzzing_resources}/Serializer/serializer.dictionary CORPUS ${fuzzing_resources}/Serializer/Corpus/BinaryProtos @@ -40,7 +40,7 @@ cc_fuzz_test( # FieldPath fuzzing target. -cc_fuzz_test( +firebase_ios_cc_fuzz_test( fieldpath_fuzzer DICTIONARY ${fuzzing_resources}/FieldPath/fieldpath.dictionary CORPUS ${fuzzing_resources}/FieldPath/Corpus @@ -49,7 +49,7 @@ cc_fuzz_test( ) # ResourcePath fuzzing target. Use the same corpus and dict as FieldPath. -cc_fuzz_test( +firebase_ios_cc_fuzz_test( resourcepath_fuzzer DICTIONARY ${fuzzing_resources}/FieldPath/fieldpath.dictionary CORPUS ${fuzzing_resources}/FieldPath/Corpus @@ -58,7 +58,7 @@ cc_fuzz_test( ) # LevelDB fuzzer. -cc_fuzz_test( +firebase_ios_cc_fuzz_test( leveldb_fuzzer DICTIONARY ${fuzzing_resources}/LevelDb/leveldb.dictionary SOURCES leveldb_fuzzer.cc diff --git a/GoogleUtilities/CMakeLists.txt b/GoogleUtilities/CMakeLists.txt index f0a5f11691..e1837bb0e7 100644 --- a/GoogleUtilities/CMakeLists.txt +++ b/GoogleUtilities/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2019 Google +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,41 +12,43 @@ # See the License for the specific language governing permissions and # limitations under the License. -if(APPLE) - # Environment and Logger subspecs - file( - GLOB sources - Environment/*.m - Environment/third_party/*.m - Logger/*.m - ) - file( - GLOB headers - Environment/Public/*.h - Environment/third_party/*.h - Logger/Private/*.h - Logger/Public/*.h - ) - - podspec_version(version ${PROJECT_SOURCE_DIR}/GoogleUtilities.podspec) - - objc_framework( - GoogleUtilities - SOURCES ${sources} - HEADERS ${headers} - VERSION ${version} - INCLUDES - Private - Public - ${PROJECT_SOURCE_DIR} - DEPENDS - "-framework Foundation" - EXCLUDE_FROM_ALL - ) - - target_compile_options( - GoogleUtilities - PRIVATE - -Wno-deprecated-declarations - ) +if(NOT APPLE) + return() endif() + +# Environment and Logger subspecs +file( + GLOB sources + Environment/*.m + Environment/third_party/*.m + Logger/*.m +) +file( + GLOB headers + Environment/Public/*.h + Environment/third_party/*.h + Logger/Private/*.h + Logger/Public/*.h +) + +podspec_version(version ${PROJECT_SOURCE_DIR}/GoogleUtilities.podspec) + +firebase_ios_objc_framework( + GoogleUtilities + SOURCES ${sources} + HEADERS ${headers} + VERSION ${version} + INCLUDES + Private + Public + ${PROJECT_SOURCE_DIR} + DEPENDS + "-framework Foundation" + EXCLUDE_FROM_ALL +) + +target_compile_options( + GoogleUtilities + PRIVATE + -Wno-deprecated-declarations +) diff --git a/Interop/Auth/CMakeLists.txt b/Interop/Auth/CMakeLists.txt index b55ed7b6c0..9016605309 100644 --- a/Interop/Auth/CMakeLists.txt +++ b/Interop/Auth/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2019 Google +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,15 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -if(APPLE) - file(GLOB headers Public/*.h) - - podspec_version(version ${PROJECT_SOURCE_DIR}/FirebaseAuthInterop.podspec) - - objc_framework( - FirebaseAuthInterop - HEADERS ${headers} - VERSION ${version} - EXCLUDE_FROM_ALL - ) +if(NOT APPLE) + return() endif() + +file(GLOB headers Public/*.h) + +podspec_version(version ${PROJECT_SOURCE_DIR}/FirebaseAuthInterop.podspec) + +firebase_ios_objc_framework( + FirebaseAuthInterop + HEADERS ${headers} + VERSION ${version} + EXCLUDE_FROM_ALL +) diff --git a/Interop/CoreDiagnostics/CMakeLists.txt b/Interop/CoreDiagnostics/CMakeLists.txt index 5a8752dc7c..199e35385f 100644 --- a/Interop/CoreDiagnostics/CMakeLists.txt +++ b/Interop/CoreDiagnostics/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2019 Google +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,16 +12,21 @@ # See the License for the specific language governing permissions and # limitations under the License. -if(APPLE) - file(GLOB headers Public/*.h) - - podspec_version(version ${PROJECT_SOURCE_DIR}/FirebaseCoreDiagnosticsInterop.podspec) - - objc_framework( - FirebaseCoreDiagnosticsInterop - HEADERS ${headers} - VERSION ${version} - INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} - EXCLUDE_FROM_ALL - ) +if(NOT APPLE) + return() endif() + +file(GLOB headers Public/*.h) + +podspec_version( + version + ${PROJECT_SOURCE_DIR}/FirebaseCoreDiagnosticsInterop.podspec +) + +firebase_ios_objc_framework( + FirebaseCoreDiagnosticsInterop + HEADERS ${headers} + VERSION ${version} + INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} + EXCLUDE_FROM_ALL +) diff --git a/cmake/archive_options.cmake b/cmake/archive_options.cmake deleted file mode 100644 index f22a5afdef..0000000000 --- a/cmake/archive_options.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2019 Google -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -if(APPLE) - # When building on Apple platforms, ranlib complains about "file has no - # symbols". Unfortunately, most of our dependencies implement their - # cross-platform build with preprocessor symbols so translation units that - # don't target the current platform end up empty (and trigger this warning). - # - # Note this can't be set in compiler_setup.cmake because that is included - # late so as not to affect our dependencies. These variables have to be set - # early so that they do affect our dependencies. - set(CMAKE_C_ARCHIVE_CREATE " Scr ") - set(CMAKE_CXX_ARCHIVE_CREATE " Scr ") - set(CMAKE_C_ARCHIVE_FINISH " -no_warning_for_no_symbols -c ") - set(CMAKE_CXX_ARCHIVE_FINISH " -no_warning_for_no_symbols -c ") -endif() diff --git a/cmake/cc_rules.cmake b/cmake/cc_rules.cmake index 78a26209c0..a5cdd0ac5e 100644 --- a/cmake/cc_rules.cmake +++ b/cmake/cc_rules.cmake @@ -1,4 +1,4 @@ -# Copyright 2017 Google +# Copyright 2017 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ include(CMakeParseArguments) include(FindASANDylib) -# cc_library( +# firebase_ios_cc_library( # target # SOURCES sources... # DEPENDS libraries... @@ -24,18 +24,19 @@ include(FindASANDylib) # # Defines a new library target with the given target name, sources, and # dependencies. -function(cc_library name) +function(firebase_ios_cc_library name) set(flag EXCLUDE_FROM_ALL HEADER_ONLY) set(multi DEPENDS SOURCES) cmake_parse_arguments(ccl "${flag}" "" "${multi}" ${ARGN}) if(ccl_HEADER_ONLY) - generate_dummy_source(${name} ccl_SOURCES) + firebase_ios_generate_dummy_source(${name} ccl_SOURCES) endif() - maybe_remove_objc_sources(sources ${ccl_SOURCES}) + firebase_ios_maybe_remove_objc_sources(sources ${ccl_SOURCES}) add_library(${name} ${sources}) - add_objc_flags(${name} ${sources}) + firebase_ios_add_objc_flags(${name} ${sources}) + target_include_directories( ${name} PUBLIC @@ -45,7 +46,7 @@ function(cc_library name) ${FIREBASE_SOURCE_DIR} ) - target_compile_options(${name} PRIVATE ${FIREBASE_CXX_FLAGS}) + target_compile_options(${name} PRIVATE ${FIREBASE_IOS_CXX_FLAGS}) target_link_libraries(${name} PUBLIC ${ccl_DEPENDS}) if(ccl_EXCLUDE_FROM_ALL) @@ -56,7 +57,7 @@ function(cc_library name) endif() endfunction() -# cc_select( +# firebase_ios_cc_select( # interface_library # CONDITION1 implementation_library1 # [CONDITION2 implementation_library2 ...] @@ -73,7 +74,7 @@ endfunction() # # If no condition matches, fails the configuration cycle with an error message # indicating that no suitable implementation was found. -function(cc_select library_name) +function(firebase_ios_cc_select library_name) add_library(${library_name} INTERFACE) list(LENGTH ARGN length) @@ -97,7 +98,7 @@ function(cc_select library_name) message(FATAL_ERROR "Could not find implementation for ${library_name}") endfunction() -# cc_binary( +# firebase_ios_cc_binary( # target # SOURCES sources... # DEPENDS libraries... @@ -106,14 +107,14 @@ endfunction() # # Defines a new executable target with the given target name, sources, and # dependencies. -function(cc_binary name) +function(firebase_ios_cc_binary name) set(flag EXCLUDE_FROM_ALL) set(multi DEPENDS SOURCES) cmake_parse_arguments(ccb "${flag}" "" "${multi}" ${ARGN}) - maybe_remove_objc_sources(sources ${ccb_SOURCES}) + firebase_ios_maybe_remove_objc_sources(sources ${ccb_SOURCES}) add_executable(${name} ${sources}) - add_objc_flags(${name} ${sources}) + firebase_ios_add_objc_flags(${name} ${sources}) target_compile_options(${name} PRIVATE ${FIREBASE_CXX_FLAGS}) target_include_directories(${name} PRIVATE ${FIREBASE_SOURCE_DIR}) @@ -127,7 +128,7 @@ function(cc_binary name) endif() endfunction() -# cc_test( +# firebase_ios_cc_test( # target # SOURCES sources... # DEPENDS libraries... @@ -135,7 +136,7 @@ endfunction() # # Defines a new test executable target with the given target name, sources, and # dependencies. Implicitly adds DEPENDS on GTest::GTest and GTest::Main. -function(cc_test name) +function(firebase_ios_cc_test name) if(NOT FIREBASE_IOS_BUILD_TESTS) return() endif() @@ -145,9 +146,9 @@ function(cc_test name) list(APPEND cct_DEPENDS GTest::GTest GTest::Main) - maybe_remove_objc_sources(sources ${cct_SOURCES}) + firebase_ios_maybe_remove_objc_sources(sources ${cct_SOURCES}) add_executable(${name} ${sources}) - add_objc_flags(${name} ${sources}) + firebase_ios_add_objc_flags(${name} ${sources}) add_test(${name} ${name}) target_compile_options(${name} PRIVATE ${FIREBASE_CXX_FLAGS}) @@ -155,7 +156,7 @@ function(cc_test name) target_link_libraries(${name} PRIVATE ${cct_DEPENDS}) endfunction() -# cc_fuzz_test( +# firebase_ios_cc_fuzz_test( # target # DICTIONARY dict_file # CORPUS corpus_dir @@ -171,19 +172,19 @@ endfunction() # and copies the CORPUS directory as '${target}_seed_corpus' after building the # target. This naming convention is critical for OSS Fuzz build script to # capture new fuzzing targets. -function(cc_fuzz_test name) +function(firebase_ios_cc_fuzz_test name) # Finds the fuzzer library that is either provided by OSS Fuzz or libFuzzer # that is manually built from sources. find_package(Fuzzer REQUIRED) - # Parse arguments of the cc_fuzz_test macro. + # Parse arguments of the firebase_ios_cc_fuzz_test macro. set(single DICTIONARY CORPUS) set(multi DEPENDS SOURCES) cmake_parse_arguments(ccf "" "${single}" "${multi}" ${ARGN}) list(APPEND ccf_DEPENDS Fuzzer) - cc_binary( + firebase_ios_cc_binary( ${name} SOURCES ${ccf_SOURCES} DEPENDS ${ccf_DEPENDS} @@ -212,7 +213,7 @@ endfunction() # # Removes Objective-C/C++ sources from the given sources if not on an Apple # platform. Stores the resulting list in the variable named by `output_var`. -function(maybe_remove_objc_sources output_var) +function(firebase_ios_maybe_remove_objc_sources output_var) unset(sources) foreach(source ${ARGN}) get_filename_component(ext ${source} EXT) @@ -224,11 +225,11 @@ function(maybe_remove_objc_sources output_var) set(${output_var} ${sources} PARENT_SCOPE) endfunction() -# add_objc_flags(target sources...) +# firebase_ios_add_objc_flags(target sources...) # -# Adds OBJC_FLAGS to the compile options of the given target if any of the -# sources have filenames that indicate they are Objective-C. -function(add_objc_flags target) +# Adds FIREBASE_IOS_OBJC_FLAGS to the compile options of the given target if +# any of the sources have filenames that indicate they are Objective-C. +function(firebase_ios_add_objc_flags target) set(_has_objc OFF) foreach(source ${ARGN}) @@ -242,7 +243,7 @@ function(add_objc_flags target) target_compile_options( ${target} PRIVATE - ${OBJC_FLAGS} + ${FIREBASE_IOS_OBJC_FLAGS} ) target_link_libraries( @@ -253,23 +254,23 @@ function(add_objc_flags target) endif() endfunction() -# add_alias(alias_target actual_target) +# firebase_ios_add_alias(alias_target actual_target) # # Adds a library alias target `alias_target` if it does not already exist, # aliasing to the given `actual_target` target. This allows library dependencies # to be specified uniformly in terms of the targets found in various # find_package modules even if the library is being built internally. -function(add_alias ALIAS_TARGET ACTUAL_TARGET) +function(firebase_ios_add_alias ALIAS_TARGET ACTUAL_TARGET) if(NOT TARGET ${ALIAS_TARGET}) add_library(${ALIAS_TARGET} ALIAS ${ACTUAL_TARGET}) endif() endfunction() -# objc_framework( +# firebase_ios_objc_framework( # target # HEADERS headers... # SOURCES sources... -# INCLUDES inlude_directories... +# INCLUDES include_directories... # DEFINES macros... # DEPENDS libraries... # [EXCLUDE_FROM_ALL] @@ -278,7 +279,7 @@ endfunction() # Defines a new framework target with the given target name and parameters. # # If SOURCES is not included, a dummy file will be generated. -function(objc_framework target) +function(firebase_ios_objc_framework target) if(APPLE) set(flag SHARED EXCLUDE_FROM_ALL) set(single VERSION) @@ -286,7 +287,7 @@ function(objc_framework target) cmake_parse_arguments(of "${flag}" "${single}" "${multi}" ${ARGN}) if (NOT cf_SOURCES) - generate_dummy_source(${target} of_SOURCES) + firebase_ios_generate_dummy_source(${target} of_SOURCES) endif() if(of_SHARED) @@ -300,7 +301,7 @@ function(objc_framework target) ${of_SOURCES} ) - add_objc_flags(${target} ${of_SOURCES}) + firebase_ios_add_objc_flags(${target} ${of_SOURCES}) set_property(TARGET ${target} PROPERTY PUBLIC_HEADER ${of_HEADERS}) set_property(TARGET ${target} PROPERTY FRAMEWORK ON) @@ -321,8 +322,8 @@ function(objc_framework target) INTERFACE -F${CMAKE_CURRENT_BINARY_DIR} PRIVATE - ${FIREBASE_CXX_FLAGS} - ${OBJC_FLAGS} + ${FIREBASE_IOS_CXX_FLAGS} + ${FIREBASE_IOS_OBJC_FLAGS} -fno-autolink -Wno-unused-parameter ) @@ -363,7 +364,7 @@ function(objc_framework target) endif() endfunction() -function(objc_test target) +function(firebase_ios_objc_test target) if(NOT APPLE OR NOT FIREBASE_IOS_BUILD_TESTS) return() endif() @@ -379,7 +380,7 @@ function(objc_test target) ${ot_SOURCES} ) - add_objc_flags( + firebase_ios_add_objc_flags( ${target} ${ot_SOURCES} ) @@ -416,13 +417,13 @@ function(objc_test target) endif() endfunction() -# generate_dummy_source(name, sources_list) +# firebase_ios_generate_dummy_source(name, sources_list) # # Generates a dummy source file containing a single symbol, suitable for use as # a source file in when defining a header-only library. # # Appends the generated source file name to the list named by sources_list. -macro(generate_dummy_source name sources_list) +macro(firebase_ios_generate_dummy_source name sources_list) set(__empty_header_only_file "${CMAKE_CURRENT_BINARY_DIR}/${name}_header_only_empty.cc") if(NOT EXISTS ${__empty_header_only_file}) diff --git a/cmake/compiler_id.cmake b/cmake/compiler_id.cmake deleted file mode 100644 index ce7aad0efe..0000000000 --- a/cmake/compiler_id.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2018 Google -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Adds cheap tests for various compilers - -if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(CXX_CLANG TRUE) -endif() - -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(CXX_GNU TRUE) -endif() diff --git a/cmake/compiler_setup.cmake b/cmake/compiler_setup.cmake index 1d531d6a96..91c30ca073 100644 --- a/cmake/compiler_setup.cmake +++ b/cmake/compiler_setup.cmake @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,19 @@ # C++ Compiler setup -include(compiler_id) - # We use C++11 set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CXX_CLANG ON) +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(CXX_GNU ON) +endif() + if(CMAKE_GENERATOR STREQUAL "Ninja") set(NINJA ON) endif() @@ -77,7 +83,7 @@ if(APPLE) # enabling modules and other clang extensions would apply even to regular C++ # sources which is nonportable. Keep these flags separate to avoid misuse. set( - OBJC_FLAGS + FIREBASE_IOS_OBJC_FLAGS -Werror=deprecated-objc-isa-usage -Werror=non-modular-include-in-framework-module -Werror=objc-root-class @@ -117,9 +123,20 @@ if(MSVC) endif() foreach(flag ${common_flags} ${c_flags}) - list(APPEND FIREBASE_C_FLAGS ${flag}) + list(APPEND FIREBASE_IOS_C_FLAGS ${flag}) endforeach() foreach(flag ${common_flags} ${cxx_flags}) - list(APPEND FIREBASE_CXX_FLAGS ${flag}) + list(APPEND FIREBASE_IOS_CXX_FLAGS ${flag}) endforeach() + +if(APPLE) + # When building on Apple platforms, ranlib complains about "file has no + # symbols". Unfortunately, most of our dependencies implement their + # cross-platform build with preprocessor symbols so translation units that + # don't target the current platform end up empty (and trigger this warning). + set(CMAKE_C_ARCHIVE_CREATE " Scr ") + set(CMAKE_CXX_ARCHIVE_CREATE " Scr ") + set(CMAKE_C_ARCHIVE_FINISH " -no_warning_for_no_symbols -c ") + set(CMAKE_CXX_ARCHIVE_FINISH " -no_warning_for_no_symbols -c ") +endif() diff --git a/cmake/fuzzing_options.cmake b/cmake/fuzzing_options.cmake index 15deb42912..b1dc98345c 100644 --- a/cmake/fuzzing_options.cmake +++ b/cmake/fuzzing_options.cmake @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,8 +14,6 @@ # Add fuzz testing options to the current build. -include(compiler_id) - option(FUZZING "Build for Fuzz Testing (local fuzzing and OSS Fuzz)" OFF) # Assume OSS Fuzz if LIB_FUZZING_ENGINE environment variable is set. OSS Fuzz diff --git a/cmake/sanitizer_options.cmake b/cmake/sanitizer_options.cmake index b07c700733..09735b0b73 100644 --- a/cmake/sanitizer_options.cmake +++ b/cmake/sanitizer_options.cmake @@ -1,4 +1,4 @@ -# Copyright 2018 Google +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,8 +14,6 @@ # Adds Sanitzer options to the current build. -include(compiler_id) - option(WITH_ASAN "Build with Address Sanitizer" OFF) # TODO(varconst): msan # Memory sanitizer is more complicated: