Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
cb78297
Add a toolchain and logic for building 32-bit Linux libraries
a-maurice Jan 23, 2020
b6511ea
Project import generated by Copybara.
a-googler Jan 23, 2020
e4b6bed
[RemoteConfig]iOS impl
Jan 23, 2020
74ac8dd
Have open source use the static openssl libraries
a-maurice Jan 24, 2020
e98e844
[c++] Remove outdated TODO
a-googler Jan 25, 2020
fb10033
Quick fix to a doc comment.
var-const Jan 27, 2020
6593560
Fix the Linux 32-bit toolchain to append to the flags, not override
a-maurice Jan 27, 2020
5cb3b17
Pack the darwin build based on the architecture
a-maurice Jan 28, 2020
b3aa8e1
Initial implementation of the FTL game SDK for Android (C++)
a-googler Jan 28, 2020
bce5da3
Import Firestore release 1.10.0 from GitHub (Firebase 6.16.0, M63).
var-const Jan 29, 2020
c7d7fba
[c++] port ARRAY_CONTAINS_ANY and IN queries
a-googler Jan 29, 2020
154157b
Fix deadlock when callback is executing.
chkuang-g Jan 29, 2020
bb1a02d
Enable iOS/Android integration tests as part of presubmit check_tests.
wu-hui Jan 30, 2020
94fed95
Fix deadlock between scheduler thread and websocket thread when serve…
chkuang-g Jan 31, 2020
31ecf59
Update README.md to reflect latest status
wu-hui Jan 31, 2020
ba56ec1
[c++] port addSnapshotsInSyncListener
a-googler Jan 31, 2020
6ac1c44
[c++] Adding doc comments for EventListener java files
a-googler Feb 1, 2020
b6e5f79
Add Linux emulator integration tests
wu-hui Feb 3, 2020
91d6995
Unstub Unity desktop builds.
var-const Feb 3, 2020
4466d2c
Added NoopPersistenceManager, removed NoopPersistenceStorageEngine.
Feb 3, 2020
e7575d4
[c++] Add comments on EventListener
a-googler Feb 3, 2020
071bfba
Update Android C++ and Unity dependencies to M63
a-maurice Feb 4, 2020
59937af
Fixed the filename in a test case, and moved the test file to the proper
Feb 4, 2020
8efba31
Move all integration tests to separate `tests` folder.
wu-hui Feb 5, 2020
4776f4e
Import of the hotfix to Firestore release 1.10.0 from GitHub.
var-const Feb 5, 2020
8bbec4a
Fixed path of flatbuffer include for open source build environment.
DellaBitta Feb 7, 2020
024b36b
Update Firebase C++ and Unity to use iOS 6.16.0
a-maurice Feb 8, 2020
c4347fb
Update Firebase games Podfiles to use Firebase 6.16.0
a-maurice Feb 10, 2020
e0780a8
Cmake gtest build support for iOS.
DellaBitta Feb 12, 2020
8a8d6ac
Add copyright and license headers to java sources required for Androi…
DellaBitta Feb 13, 2020
5277df7
Make `Promise`s participate in cleanup.
var-const Feb 13, 2020
128cc77
Use the default option's project id if not provided.
a-maurice Feb 14, 2020
ba13533
Copyright and License header for testing/ sources
DellaBitta Feb 14, 2020
6bdf911
Update Games SDK versions to 6.11.0 for M64
a-maurice Feb 14, 2020
437caee
Gradle build support for testing/ directory, and resource archiving o…
DellaBitta Feb 14, 2020
81343cb
Make `FirestoreInternal` store a pointer to the corresponding public …
var-const Feb 14, 2020
16e385a
Add performance to the release build files.
a-maurice Feb 19, 2020
7294a59
Temporarily avoid usage of `util::ThrowInvalidArgument` in google3.
var-const Feb 19, 2020
59b515f
Fix Android crashing when a `FieldValue` is initialized with an inval…
var-const Feb 25, 2020
8377e20
Small fixes to Firestore doc comments.
var-const Feb 26, 2020
14f476d
Update to latest Android release for M64.
jonsimantov Feb 26, 2020
7582a1e
Comment typo.
a-googler Feb 26, 2020
521e96d
[OpenSource][CPP][Android] reduce redundant building process
Feb 26, 2020
0a7ae15
Add CMake options that were accidentally removed
a-maurice Feb 26, 2020
b4dee0e
Fix missing includes
wilhuff Feb 27, 2020
90b0e7a
Modify external builds to download archives
wilhuff Feb 27, 2020
767eafc
Update Firebase C++ and Unity SDK versions to 6.12.0, plus Unity guids.
jonsimantov Feb 27, 2020
3314fe5
Update to latest iOS cocoapods version for M64, 6.17.0.
jonsimantov Feb 27, 2020
ce26e06
Add an external download for Firestore
wilhuff Feb 27, 2020
5140990
Build Firestore with CMake
wilhuff Feb 28, 2020
fc30ac9
Actually add the Firestore CMakeLists.txt
wilhuff Feb 28, 2020
a11e114
Change the open source logic to use firebase_cpp_cc_test instead of c…
a-maurice Mar 2, 2020
89e1a48
Correctly rename the cmake testing function
a-maurice Mar 2, 2020
c759ca7
Make `ListenerRegistration::Cleanup` delegate to `Remove`.
var-const Mar 3, 2020
95c7ab7
Port LimitToLast to C++ SDK.
wu-hui Mar 4, 2020
9fec657
Fix Firestore builds on non-Apple platforms
a-maurice Mar 5, 2020
587b95d
Address control reaches end of non-void function warning
wilhuff Mar 6, 2020
e66b3aa
Bump required firebase-ios-sdk version to include #5027
wilhuff Mar 6, 2020
82d6eea
Use available hardware parallelism for test runs
wilhuff Mar 6, 2020
54c8e46
BEGIN_PUBLIC
a-googler Mar 9, 2020
2eab58e
Update the Firebase open source version of Flatbuffers
a-maurice Mar 10, 2020
5bf9760
Add open source build logic for Firestore Android
a-maurice Mar 11, 2020
b53ca7d
Fix open source Firestore Android for building the testapp with
a-maurice Mar 11, 2020
3d8787b
Build Firestore C++ for iOS against CocoaPods
wilhuff Mar 12, 2020
d508ad1
Update build configuration files so C++ testapps can be built via tes…
a-googler Mar 16, 2020
2926bf4
Update Flatbuffers to include CPack fix
a-maurice Mar 17, 2020
f09babb
Update the pinned firestore version to include the googletest changes
a-maurice Mar 17, 2020
8253a33
Add #Enhanced_ECommerce predefined events and parameters.
a-googler Mar 17, 2020
101ee48
Fix desktop build broken in cl/301452780
wilhuff Mar 18, 2020
deded6b
Move NOMINMAX to the top level CMake file
a-maurice Mar 19, 2020
75daa0d
Change a preprocessor if to and ifdef
a-maurice Mar 19, 2020
4e8d126
This contains a port of the integration tests for Numeric Transforms.…
a-googler Mar 26, 2020
5cd1da6
Remove C++ snippets from google3.
var-const Mar 27, 2020
c0309d5
Small fixes to the public API:
var-const Mar 27, 2020
358d596
Correct ordering of level_end and level_start
a-googler Mar 30, 2020
2c039ed
Clearly call out that STLPort support is deprecated.
var-const Apr 1, 2020
4f5c6e1
Update to latest iOS cocoapods version for M67, 6.21.0.
DellaBitta Apr 3, 2020
d99daf9
Updating Firebase CPP/Unity SDK Android dependencies to prep for m67 …
DellaBitta Apr 6, 2020
99aad3c
Release: Firebase CPP SDK version number update to 6.14.0 for m67 rel…
DellaBitta Apr 7, 2020
3adca56
Exposed Flexbuffer/Variant conversion functions that have Flexbuffer …
Apr 16, 2020
950d57a
LSC: Change for loops to use const refs, per performance-for-range-co…
a-googler Apr 17, 2020
208a20b
Import Firestore release 1.12.0 from GitHub (Firebase 6.22.0, M68).
var-const Apr 17, 2020
3fa4a73
LSC: Mark static const class/struct members as constexpr. This change…
a-googler Apr 20, 2020
b98f0be
Small fixes to the public C++ API:
var-const Apr 21, 2020
e3074ab
Removed file_io class as it is no longer necessary.
Apr 21, 2020
da09cb9
Added equality operator for TrackedQuery, to make unit testing easier.
Apr 21, 2020
e672db7
Don't expose `FooLastResult` functions in the public C++ API.
var-const Apr 21, 2020
d422b2b
A couple of fixes in Future, which modify the way that each Future's …
jonsimantov Apr 22, 2020
e595a55
Updated signature of ServerCache, as not all implementations will be …
Apr 23, 2020
6761854
Use a single function, `FieldValue::Increment`, for both integer and …
var-const Apr 24, 2020
bae970f
Revert deprecation of "select_content" event.
a-googler Apr 27, 2020
a4e922f
Add support to parse first instance of the Oauth Android Client Id
a-googler May 6, 2020
b0b7b87
No assing around here, please.
a-googler May 7, 2020
e10e6ac
Implement the first part of API review feedback.
var-const May 7, 2020
285b351
Update Android dependencies for M70
a-maurice May 12, 2020
541eb15
Fix passing of future handle through Java, now passes a FutureHandleI…
jonsimantov May 12, 2020
387921e
Update to latest iOS Cocoapods for M70, 6.24.0
a-maurice May 12, 2020
c1122d9
Cleaned up some warnings that manifest on the open source build.
May 12, 2020
aa27589
On iOS for nonce-based Apple Sign In link failures where the Apple ac…
DellaBitta May 13, 2020
1686b0f
Update C++ and Unity versions to 6.14.1
a-maurice May 13, 2020
9a55c6a
Un-deprecate "view_search_results" event for iOS.
a-googler May 13, 2020
e2b574f
Import Firestore release 1.13.0 from GitHub (Firebase 6.24.0, M70).
var-const May 13, 2020
ded1467
Added schemas for the flatbuffer types that will be written to disk f…
May 14, 2020
382a2b6
Add content provider support to the FTL Android initialization
a-googler May 14, 2020
c9f5e58
Fix the issue that create_first_app is not set as true when client cr…
a-googler May 14, 2020
3b3a8de
LSC: Change for loops to use const refs, per performance-for-range-copy
a-googler May 18, 2020
36e839a
Change the signature of `RunTransaction` callback to `Error (Transact…
var-const May 19, 2020
b8a41e7
Use a single, shared executor for running transactions
wilhuff May 19, 2020
b2ea286
Update Firebase C++ and Unity to 6.15.0
a-maurice May 20, 2020
c4222f7
[RemoteConfig V2] desktop impl 1/n
May 20, 2020
28eaff9
Code sample for Apple Sign In on link failure for CPP and Unity deviste.
DellaBitta May 21, 2020
ce57da6
Move type_traits header to be public internal
a-maurice May 21, 2020
9c85c88
Add `FirebaseFirestore.ListenForSnapshotsInSync()`
a-googler May 21, 2020
99bb00e
Implementation of the LevelDb Storage Engine, which will allow the Da…
May 21, 2020
5cfcc96
Fixed implicit fallthroughs in switch statement.
May 21, 2020
e878f09
Add GetAppDataPath() to get application-specific data path for storin…
jonsimantov May 28, 2020
26e6ba4
Fix Dynamic Links on Android not passing a future handle correctly
a-maurice May 28, 2020
32312d3
LSC: Add std:: qualifications to all references to std::string and st…
a-googler May 29, 2020
7ad0d98
[C++] Provide a default executor with settings on iOS
wu-hui Jun 2, 2020
250359b
Fix most Unity leaks caused by incorrect SWIG configuration.
var-const Jun 5, 2020
1b8c6ce
Fix SWIG build.
var-const Jun 5, 2020
c39f54b
The QUOTA_EXCEEDED error is not just for SMS quota, but applies to all
jonsimantov Jun 6, 2020
7442e86
Fix almost all the remaining Unity leaks.
var-const Jun 8, 2020
740f448
Add ListenerRegistration.ListenerTask property.
a-googler Jun 9, 2020
0ce4e7e
Firebase C++ open source fixes
a-maurice Jun 9, 2020
0c3f6ec
Change Firebase C++ usage of Flatbuffer CMake back to old method
a-maurice Jun 9, 2020
6112cec
Import Firestore release 1.15.0 from GitHub (Firebase 6.26.0, M72).
var-const Jun 10, 2020
4ff70cc
Fix a future warning that complains handle not get released properly.
Jun 11, 2020
8049cd7
Call Dispose from the FirestoreInternal destructor.
wilhuff Jun 12, 2020
070ad59
Fix open source C++ Firestore building with -DFIREBASE_IOS_BUILD_TEST…
wilhuff Jun 12, 2020
5308159
Merging 6.15.0 release to dev. (#67)
DellaBitta Jun 23, 2020
4dbf335
Updated Google Test dependency from 1.7 to 1.10 (#68)
DellaBitta Jun 23, 2020
2bc82bf
Mac unit test flake removal, part 1 (#69)
DellaBitta Jun 25, 2020
3a16936
Add encrypted google services files.
cynthiajoan Jun 26, 2020
42e1608
Add decrypt script
cynthiajoan Jun 27, 2020
d3392d5
Add README
cynthiajoan Jun 29, 2020
211e084
Add sample framework and test framework, both used by integration tes…
jonsimantov Jul 8, 2020
b06182e
Add integration tests for all libraries, not yet building.
jonsimantov Jul 8, 2020
9fb27f6
Add updated path to C++ SDK if running inside the SDK integration_tes…
jonsimantov Jul 8, 2020
bb242f9
Change setup_integration_tests.sh into a Python script for compatibil…
jonsimantov Jul 8, 2020
75e18d9
Add integration test build for inside the C++ SDK, including running
jonsimantov Jul 8, 2020
838f55a
Add missing copyright header to CMake files for integration tests.
jonsimantov Jul 8, 2020
f9cc9d8
Remove usage of absl::string_view from integration test.
jonsimantov Jul 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
31 changes: 18 additions & 13 deletions Android/firebase_dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,23 @@ import org.gradle.util.ConfigureUtil;

// A map of library to the dependencies that need to be added for it.
def firebaseDependenciesMap = [
'app' : ['com.google.firebase:firebase-analytics:17.2.1'],
'admob' : ['com.google.firebase:firebase-ads:18.3.0',
'com.google.android.gms:play-services-measurement-sdk-api:17.2.1'],
'analytics' : ['com.google.firebase:firebase-analytics:17.2.1'],
'auth' : ['com.google.firebase:firebase-auth:19.2.0'],
'database' : ['com.google.firebase:firebase-database:19.2.0'],
'dynamic_links' : ['com.google.firebase:firebase-dynamic-links:19.0.0'],
'functions' : ['com.google.firebase:firebase-functions:19.0.1'],
'instance_id' : ['com.google.firebase:firebase-iid:20.0.2'],
'app' : ['com.google.firebase:firebase-analytics:17.4.1'],
'admob' : ['com.google.firebase:firebase-ads:19.1.0',
'com.google.android.gms:play-services-measurement-sdk-api:17.4.1'],
'analytics' : ['com.google.firebase:firebase-analytics:17.4.1'],
'auth' : ['com.google.firebase:firebase-auth:19.3.1'],
'database' : ['com.google.firebase:firebase-database:19.3.0'],
'dynamic_links' : ['com.google.firebase:firebase-dynamic-links:19.1.0'],
'firestore' : ['com.google.firebase:firebase-firestore:21.4.3'],
'functions' : ['com.google.firebase:firebase-functions:19.0.2'],
'instance_id' : ['com.google.firebase:firebase-iid:20.1.7'],
'invites' : ['com.google.firebase:firebase-invites:17.0.0'],
// Messaging has an additional local dependency to include.
'messaging' : ['com.google.firebase:firebase-messaging:20.1.0',
'messaging' : ['com.google.firebase:firebase-messaging:20.1.7',
'firebase_cpp_sdk.messaging:messaging_java'],
'performance' : ['com.google.firebase:firebase-perf:19.0.4'],
'remote_config' : ['com.google.firebase:firebase-config:19.1.0'],
'storage' : ['com.google.firebase:firebase-storage:19.1.0']
'performance' : ['com.google.firebase:firebase-perf:19.0.7'],
'remote_config' : ['com.google.firebase:firebase-config:19.1.4'],
'storage' : ['com.google.firebase:firebase-storage:19.1.1']
]

// A map of library to the gradle resources that they depend upon.
Expand All @@ -42,6 +43,7 @@ def firebaseResourceDependenciesMap = [
'admob' : [':admob:admob_resources'],
'auth' : [':auth:auth_resources'],
'database' : [':database:database_resources'],
'firestore' : [':firestore:firestore_resources'],
'storage' : [':storage:storage_resources']
]

Expand Down Expand Up @@ -74,6 +76,9 @@ class Dependencies {
def getDynamicLinks() {
libSet.add('dynamic_links')
}
def getFirestore() {
libSet.add('firestore')
}
def getFunctions() {
libSet.add('functions')
}
Expand Down
212 changes: 171 additions & 41 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -20,32 +20,52 @@ set (CMAKE_CXX_STANDARD 11)
# Turn on virtual folders for visual studio
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# Top level option that determines the default behavior of the include options
# below. Useful for turning off all at once, and then turning on a specific one.
option(FIREBASE_INCLUDE_LIBRARY_DEFAULT
"Should each library be included by default." ON)
# Different options to enable/disable each library being included during
# configuration.
option(FIREBASE_INCLUDE_ADMOB "Include the AdMob library." ON)
option(FIREBASE_INCLUDE_ADMOB "Include the AdMob library."
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
option(FIREBASE_INCLUDE_ANALYTICS
"Include the Google Analytics for Firebase library." ON)
option(FIREBASE_INCLUDE_AUTH "Include the Firebase Authentication library." ON)
"Include the Google Analytics for Firebase library."
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
option(FIREBASE_INCLUDE_AUTH "Include the Firebase Authentication library."
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
option(FIREBASE_INCLUDE_DATABASE
"Include the Firebase Realtime Database library." ON)
"Include the Firebase Realtime Database library."
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
option(FIREBASE_INCLUDE_DYNAMIC_LINKS
"Include the Firebase Dynamic Links library." ON)
"Include the Firebase Dynamic Links library."
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
option(FIREBASE_INCLUDE_FIRESTORE
"Include the Cloud Firestore library."
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
option(FIREBASE_INCLUDE_FUNCTIONS
"Include the Cloud Functions for Firebase library." ON)
"Include the Cloud Functions for Firebase library."
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
option(FIREBASE_INCLUDE_INSTANCE_ID
"Include the Firebase Instance ID library." ON)
"Include the Firebase Instance ID library."
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
option(FIREBASE_INCLUDE_MESSAGING
"Include the Firebase Cloud Messaging library." ON)
"Include the Firebase Cloud Messaging library."
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
option(FIREBASE_INCLUDE_REMOTE_CONFIG
"Include the Firebase Remote Config library." ON)
"Include the Firebase Remote Config library."
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
option(FIREBASE_INCLUDE_STORAGE
"Include the Cloud Storage for Firebase library." ON)
"Include the Cloud Storage for Firebase library."
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})

option(FIREBASE_CPP_BUILD_TESTS
"Enable the Firebase C++ Build Tests." OFF)
option(FIREBASE_FORCE_FAKE_SECURE_STORAGE
"Disable use of platform secret store and use fake impl." OFF)
option(FIREBASE_CPP_BUILD_PACKAGE
"Bundle the Firebase C++ libraries into a zip file." OFF)
option(FIREBASE_CPP_USE_PRIOR_GRADLE_BUILD
"When building with Gradle, use the previously built libraries." OFF)

# Define this directory to be the root of the C++ SDK, which the libraries can
# then refer to.
Expand All @@ -70,7 +90,13 @@ endif()
# Occasionally ANDROID is not being set correctly when invoked by gradle, so
# set it manually if ANDROID_NDK has been defined.
if(DEFINED ANDROID_NDK)
set(ANDROID 1)
set(ANDROID ON)
endif()

if(NOT ANDROID AND NOT IOS)
set(DESKTOP ON)
else()
set(DESKTOP OFF)
endif()

# Set directories needed by the Firebase subprojects
Expand All @@ -80,7 +106,7 @@ set(FIREBASE_GEN_FILE_DIR ${CMAKE_BINARY_DIR}/generated)
set(FIREBASE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_DIR})

if (FIREBASE_CPP_BUILD_TESTS AND MSVC)
# Googletest requires MSVC to compile with the static version of the runtime
# GoogleTest requires MSVC to compile with the static version of the runtime
# library, so define the appropriate runtime flag, before adding libraries.
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
Expand All @@ -94,32 +120,95 @@ set(FIREBASE_BINARY_DIR ${PROJECT_BINARY_DIR})
set(FIREBASE_INSTALL_DIR ${PROJECT_BINARY_DIR}/opt)
set(FIREBASE_DOWNLOAD_DIR ${PROJECT_BINARY_DIR}/downloads)

# Run the CMake build logic that will download all the external dependencies.
message(STATUS "Downloading external project dependencies...")
download_external_sources()
message(STATUS "Download complete.")
# Firestore is split into a public C++ component and the Firestore core, a
# non-public C++ API used for building other language bindings. Desktop
# platforms get the Firestore core from the CMake build in firebase-ios-sdk.
#
# Mobile platforms do not:
#
# * Android uses the Android SDK via JNI and does not use the Firestore
# core.
# * iOS gets the Firestore core from the FirebaseFirestore CocoaPod and
# does not build the core via CMake.
if(FIREBASE_INCLUDE_FIRESTORE AND DESKTOP)
set(FIRESTORE_USE_EXTERNAL_CMAKE_BUILD ON)
endif()

if(FIREBASE_CPP_USE_PRIOR_GRADLE_BUILD)
# Figure out where app's binary_dir was.
string(REGEX REPLACE
"${CMAKE_CURRENT_LIST_DIR}/[^/]+/(.*)"
"${CMAKE_CURRENT_LIST_DIR}/app/\\1"
APP_BINARY_DIR "${FIREBASE_BINARY_DIR}")

set(FIRESTORE_SOURCE_DIR ${APP_BINARY_DIR}/external/src/firestore)
else()
# Run the CMake build logic that will download all the external dependencies.
message(STATUS "Downloading external project dependencies...")
download_external_sources()
message(STATUS "Download complete.")

set(FIRESTORE_SOURCE_DIR ${FIREBASE_BINARY_DIR}/external/src/firestore)
endif()

# Include Firestore's external build early to resolve conflicts on packages.
if(FIRESTORE_USE_EXTERNAL_CMAKE_BUILD)
set(FIRESTORE_BINARY_DIR ${FIRESTORE_SOURCE_DIR}-build)

set(
FIREBASE_IOS_BUILD_TESTS
${FIREBASE_CPP_BUILD_TESTS}
CACHE BOOL "Force Firestore build tests to match"
)

add_subdirectory(${FIRESTORE_SOURCE_DIR} ${FIRESTORE_BINARY_DIR})

copy_subdirectory_definition(${FIRESTORE_SOURCE_DIR} NANOPB_SOURCE_DIR)
endif()

# Disable the Flatbuffer build tests, install and flathash
set(FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "")
set(FLATBUFFERS_INSTALL OFF CACHE BOOL "")
set(FLATBUFFERS_FLATHASH OFF CACHE BOOL "")

# Disable buliding flatc if cross compiling
# Disable building flatc if cross compiling
if(IOS OR ANDROID)
set(FLATBUFFERS_BUILD_FLATC OFF CACHE BOOL "")
endif()

# Add flatbuffers as a subdirectory, and set the directory variables for it,
# so that the sub Firebase projects can depend upon it if necessary.
add_external_library(flatbuffers)
if(FIREBASE_CPP_USE_PRIOR_GRADLE_BUILD)
message(STATUS "flatbuffers is added with APP_BINARY_DIR ${APP_BINARY_DIR}")
add_external_library(flatbuffers BINARY_DIR "${APP_BINARY_DIR}")
else()
message(STATUS "flatbuffers is added normally")
add_external_library(flatbuffers)
endif()

if(FIREBASE_CPP_BUILD_TESTS)
if(FIREBASE_CPP_BUILD_TESTS AND NOT FIRESTORE_USE_EXTERNAL_CMAKE_BUILD)
# Firestore's external build pulls in GoogleTest
add_external_library(googletest)
add_external_library(absl)
endif()

if((FIREBASE_INCLUDE_DATABASE AND DESKTOP) AND NOT FIREBASE_INCLUDE_FIRESTORE)
# LevelDB is needed for Desktop and Firestore, but if firestore is being built
# LevelDB will already be included.
add_external_library(leveldb)
endif()

# Some of the external libraries are not used for mobile.
if (NOT ANDROID AND NOT IOS)
if(DESKTOP)
# Use the static versions of the OpenSSL libraries.
set(OPENSSL_USE_STATIC_LIBS TRUE)
if (MSVC)
# Get the correct version of the OpenSSL libraries based on building for MT.
if ("${CMAKE_CXX_FLAGS_DEBUG}" MATCHES "/MT" OR
"${CMAKE_CXX_FLAGS_RELEASE}" MATCHES "/MT")
set(OPENSSL_MSVC_STATIC_RT TRUE)
else()
set(OPENSSL_MSVC_STATIC_RT FALSE)
endif()
endif()

# Build curl as a static library
set(CURL_STATICLIB ON CACHE BOOL "")
if (WIN32)
Expand Down Expand Up @@ -185,24 +274,44 @@ if (NOT ANDROID AND NOT IOS)
)
target_link_libraries(libuWS
PRIVATE
${OPENSSL_SSL_LIBRARY}
${OPENSSL_LIBRARIES}
uv_a
zlibstatic
)
endif()
endif()

if(DESKTOP)
if(FIRESTORE_USE_EXTERNAL_CMAKE_BUILD)
# The Firestore build includes protobuf and nanopb already
list(APPEND CMAKE_MODULE_PATH ${NANOPB_SOURCE_DIR}/extra)
find_package(Nanopb REQUIRED)

find_package(Protobuf)
if (PROTOBUF_FOUND)
# NanoPB requires Protobuf to be present, so only add it if it was found.
add_external_library(nanopb)
# NanoPB has a FindNanopb which defines the function to generate files, so
# add it to the module path, and use that.
list(INSERT CMAKE_MODULE_PATH 0 ${NANOPB_SOURCE_DIR}/extra)
find_package(Nanopb)
set(PROTOBUF_FOUND ON)
else()
find_package(Protobuf)
if (PROTOBUF_FOUND)
# NanoPB requires Protobuf to be present, so only add it if it was found.
add_external_library(nanopb)

# NanoPB has a FindNanopb which defines the function to generate files,
# so add it to the module path, and use that.
list(APPEND CMAKE_MODULE_PATH ${NANOPB_SOURCE_DIR}/extra)
find_package(Nanopb)

target_compile_definitions(
protobuf-nanopb-static
PUBLIC -DPB_FIELD_32BIT -DPB_ENABLE_MALLOC
)
endif()
endif()
endif()

if(ANDROID OR IOS)
if(DESKTOP)
# Desktop platforms do not need to declare this dependency, as they will build
# flatc correctly when needed.
set(FIREBASE_FLATBUFFERS_DEPENDENCIES "")
else()
# Mobile platforms build flatc externally so that it works on the platform
# performing the build.
set(firebase_external_flatc_build_dir "${FLATBUFFERS_BINARY_DIR}-flatc")
Expand All @@ -225,7 +334,7 @@ if(ANDROID OR IOS)
set(FLATBUFFERS_FLATC_EXECUTABLE ${firebase_external_flatc} CACHE STRING "")

# Setup the flatc custom build target.
# These commands are executed from within the currect context, which has set
# These commands are executed from within the current context, which has set
# variables for the target platform. We use "env -i" to clear these
# variables, and manually keep the PATH to regular bash path.
# If we didn't do this, we'd end up building flatc for the target platform
Expand Down Expand Up @@ -261,15 +370,17 @@ if(ANDROID OR IOS)
# Set a variable that the dependencies can use, to trigger the build before
# using flatbuffers.
set(FIREBASE_FLATBUFFERS_DEPENDENCIES "firebase_flatc_prebuild")
else()
# Other platforms do not need to declare this dependency, as they will build
# flatc correctly when needed.
set(FIREBASE_FLATBUFFERS_DEPENDENCIES "")
endif()

include(binary_to_array)
include(firebase_cpp_gradle)

# Ensure min/max macros don't get declared on Windows
# (so we can use std::min/max), before including the Firebase subdirectories.
if(MSVC)
add_definitions(-DNOMINMAX)
endif()

add_subdirectory(ios_pod)

# If we're building tests, we need to include the 'testing' folder before any
Expand All @@ -278,8 +389,24 @@ if(FIREBASE_CPP_BUILD_TESTS)
add_subdirectory(testing)
endif()

# App needs to come first, since other libraries will depend upon it.
add_subdirectory(app)
if(NOT FIREBASE_CPP_USE_PRIOR_GRADLE_BUILD)
add_subdirectory(app)
else()
# Add firebase_app as a target on the previously built app.
add_library(firebase_app STATIC IMPORTED GLOBAL)
file(MAKE_DIRECTORY "${APP_BINARY_DIR}/generated")
file(MAKE_DIRECTORY "${FIREBASE_BINARY_DIR}/generated")
set(app_include_dirs
"${CMAKE_CURRENT_LIST_DIR}/app/src/include"
"${APP_BINARY_DIR}/generated"
"${FIREBASE_BINARY_DIR}/generated"
)
set_target_properties(firebase_app PROPERTIES
IMPORTED_LOCATION "${APP_BINARY_DIR}/libfirebase_app.a"
INTERFACE_INCLUDE_DIRECTORIES "${app_include_dirs}"
)
endif()

if (FIREBASE_INCLUDE_ADMOB)
add_subdirectory(admob)
endif()
Expand All @@ -295,6 +422,9 @@ endif()
if (FIREBASE_INCLUDE_DYNAMIC_LINKS)
add_subdirectory(dynamic_links)
endif()
if (FIREBASE_INCLUDE_FIRESTORE)
add_subdirectory(firestore)
endif()
if (FIREBASE_INCLUDE_FUNCTIONS)
add_subdirectory(functions)
endif()
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@ Currently, the third party libraries that can be provided this way are:

#### Building with CMake for iOS
The Firebase C++ SDK comes with a CMake config file to build the library for
iOS platforms, [cmake/ios.cmake](/cmake/ios.cmake). In order to build with it,
when running the CMake configuration pass it in with the CMAKE_TOOLCHAIN_FILE
definition. For example, to build the Analytics library for iOS, you could run
the following commands:
iOS platforms, [cmake/toolchains/ios.cmake](/cmake/toolchains/ios.cmake). In
order to build with it, when running the CMake configuration pass it in with
the CMAKE_TOOLCHAIN_FILE definition. For example, to build the Analytics
library for iOS, you could run the following commands:

``` bash
mkdir ios_build && cd ios_build
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/ios.cmake ..
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/ios.cmake ..
cmake --build . --target firebase_analytics
```

Expand Down
Loading