@@ -33,15 +33,23 @@ instructions for your specific platform.
33
33
* ** CMake** : Version 3.7 or newer.
34
34
* ** Python** : Version 3.7 or newer.
35
35
* ** Abseil-py** : Python package.
36
- * ** OpenSSL** : Required for Realtime Database and Cloud Firestore (especially
37
- for desktop builds).
36
+ * ** OpenSSL** : Required for desktop builds, unless you build with the
37
+ ` -DFIREBASE_USE_BORINGSSL=YES ` cmake flag.
38
+ * ** libsecret-1-dev** : (Linux Desktop) Required for secure credential storage.
39
+ Install using ` sudo apt-get install libsecret-1-dev ` .
38
40
* ** Android SDK & NDK** : Required for building Android libraries. ` sdkmanager `
39
41
can be used for installation. CMake for Android (version 3.10.2
40
42
recommended) is also needed.
41
43
* ** (Windows Only) Strings** : From Microsoft Sysinternals, required for
42
44
Android builds on Windows.
43
45
* ** Cocoapods** : Required for building iOS or tvOS libraries.
44
46
47
+ To build for Desktop, you can install prerequisites by running the following
48
+ script in the root of the repository: ` scripts/gha/install_prereqs_desktop.py `
49
+
50
+ To build for Android, you can install prerequisites by running the following
51
+ script in the root of the repository: ` build_scripts/android/install_prereqs.sh `
52
+
45
53
## Building the SDK
46
54
47
55
The SDK uses CMake for C++ compilation and Gradle for Android-specific parts.
@@ -50,15 +58,22 @@ The SDK uses CMake for C++ compilation and Gradle for Android-specific parts.
50
58
51
59
1 . Create a build directory (e.g., ` mkdir desktop_build && cd desktop_build ` ).
52
60
2 . Run CMake to configure: ` cmake .. `
53
- * For iOS:
54
- ` cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/ios.cmake .. `
55
- Note: iOS setup typically requires both including Firebase pods (via
56
- ` Podfile ` ) and linking the ` .framework ` files from the C++ SDK
57
- distribution.
58
- * For tvOS:
59
- ` cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/apple.toolchain.cmake -DPLATFORM=TVOS .. `
61
+ * For Desktop: Run as is. You can use BORINGSSL instead of OpenSSL (for fewer
62
+ system dependencies with the ` -DFIREBASE_USE_BORINGSSL=YES ` parameter.
63
+ * For iOS, include the ` -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/ios.cmake `
64
+ parameter. This requires running on a Mac build machine.
60
65
3 . Build specific targets: ` cmake --build . --target firebase_analytics `
61
66
(replace ` firebase_analytics ` with the desired library).
67
+ Or omit the entire ` --target ` parameter to build all targets.
68
+
69
+ For development, building specific targets
70
+ (e.g., ` cmake --build . --target firebase_app ` ) is generally faster and
71
+ recommended once CMake configuration is complete. The full build
72
+ (` cmake --build . ` ) can be very time-consuming (but can be sped up by adding
73
+ ` -j4 ` to the command-line).
74
+
75
+ You can also use the ` scripts/gha/build_desktop.py ` script to build the full
76
+ desktop SDK.
62
77
63
78
Refer to ` README.md ` for details on CMake generators and providing custom
64
79
third-party dependency locations.
@@ -76,17 +91,30 @@ This command should be run from the root of the repository. Proguard files are
76
91
generated in each library's build directory (e.g.,
77
92
` analytics/build/analytics.pro ` ).
78
93
79
- ### Desktop Platform Setup Details
94
+ You can build the entire SDK for Android by running ` ./gradlew build ` or
95
+ ` build_scripts/android/build.sh ` .
96
+
97
+ ### Xcode (iOS)
80
98
81
- When setting up for desktop, if you are using an iOS
82
- ` GoogleService-Info.plist ` file, convert it to the required
83
- ` google-services-desktop.json ` using the script:
84
- ` python generate_xml_from_google_services_json.py --plist -i GoogleService-Info.plist `
85
- (run this from the script's directory, ensuring the plist file is accessible).
99
+ Unfortunately, the iOS version of the SDK cannot be built on Linux, it can only
100
+ be built in a MacOS environment. You will have to rely on GitHub Actions to
101
+ build for iOS, and have the user inform you of any build issues that come up.
86
102
87
- The desktop SDK searches for configuration files in the current working
88
- directory, first for ` google-services-desktop.json ` , then for
89
- ` google-services.json ` .
103
+ ### Troubleshooting Desktop Builds
104
+
105
+ * Linux: ** Missing ` libsecret-1-dev ` ** :
106
+ CMake configuration may fail if ` libsecret-1-dev ` is not installed.
107
+ The ` scripts/gha/install_prereqs_desktop.py ` script should handle this.
108
+ If it doesn't, or if the package is removed, you might need to install it
109
+ manually: ` sudo apt-get update && sudo apt-get install -y libsecret-1-dev ` .
110
+
111
+ * Linux: ** LevelDB Patch Failure when building Firestore** :
112
+ If you are building the SDK with Firestore enabled
113
+ (` -DFIREBASE_INCLUDE_FIRESTORE=ON ` , which is the default for desktop) and
114
+ encounter a patch error related to ` leveldb-1.23_windows_paths.patch ` (e.g.,
115
+ ` util/env_windows.cc: patch does not apply ` ), you can ignore this issue if
116
+ it does not prevent the rest of the build from running. The patch is only
117
+ important on Windows.
90
118
91
119
Common system library dependencies for desktop:
92
120
* ** Windows** : Common dependencies include ` advapi32.lib ` , ` ws2_32.lib ` ,
@@ -97,6 +125,9 @@ Common system library dependencies for desktop:
97
125
* ** Linux** : Common dependencies include ` pthread ` (system library). When
98
126
using GCC 5+, define ` -D_GLIBCXX_USE_CXX11_ABI=0 ` .
99
127
128
+ On all desktop platforms, building with -DFIREBASE_USE_BORINGSSL=YES can help
129
+ bypass any OpenSSL dependency issues.
130
+
100
131
## Including the SDK in Projects
101
132
102
133
### CMake Projects
@@ -139,18 +170,10 @@ coverage within the integration tests.
139
170
(e.g., Firestore, Auth) are typically located in the ` integration_test/ `
140
171
directory within that product's module (e.g.,
141
172
` firestore/integration_test/ ` ).
142
- * ** Test Scripts** : The root of the repository contains scripts for running
143
- tests on various platforms, such as:
144
- * ` test_windows_x32.bat `
145
- * ` test_windows_x64.bat `
146
- * ` test_linux.sh `
147
- * ` test_mac_x64.sh `
148
- * ` test_mac_ios.sh `
149
- * ` test_mac_ios_simulator.sh `
150
-
151
- These scripts typically build the SDKs and then execute the relevant tests
152
- (primarily integration tests) via CTest or other platform-specific test
153
- runners.
173
+
174
+ Because building integration tests requires internal google-services files,
175
+ Jules cannot do it in its environment; instead, we rely on GitHub Actions's
176
+ Integration Test workflow to build and run the integration tests.
154
177
155
178
## Writing Tests
156
179
@@ -221,6 +244,19 @@ where `T` is the type of the expected result.
221
244
callback function (lambda or function pointer) that will be invoked when
222
245
the future completes. The callback receives the completed future as an
223
246
argument.
247
+ * k?????Fn_ * enums: A list of each SDK's asynchronous functions is usually
248
+ kept in an enum in that SDK. For example, all of Auth's asynchronous
249
+ functions are named kAuthFn_ * and kUserFn_ * . Only asynchronous operations
250
+ (which return a Future) need to be in those function enums; these are used
251
+ internally to hold a reference to the FutureHandle for the * LastResult()
252
+ methods. If you add a new asynchronous operation, it should be added to
253
+ that enum, and that ID should be used for all of the internal FutureApi
254
+ operations. Non-async functions never need to touch this.
255
+ * Asynchronous functions ONLY: Only asynchronous functions need to use
256
+ the Future pattern, e.g. anything with a callback. If you are simply
257
+ calling an underlying SDK function that finishes its work and returns
258
+ immediately, with no callback, there is no need to use a Future. See
259
+ ` STYLE_GUIDE.md ` for more details on asynchronous operations.
224
260
225
261
### Core Classes and Operations (Examples from Auth and Database)
226
262
@@ -306,6 +342,9 @@ API documentation.
306
342
307
343
## Coding Style
308
344
345
+ * ** Firebase C++ Style Guide** : For specific C++ API design and coding
346
+ conventions relevant to this SDK, refer to the
347
+ [ STYLE_GUIDE.md] ( STYLE_GUIDE.md ) .
309
348
* ** Google C++ Style Guide** : Adhere to the
310
349
[ Google C++ Style Guide] ( https://google.github.io/styleguide/cppguide.html )
311
350
as mentioned in ` CONTRIBUTING.md ` .
0 commit comments