Skip to content

Commit a51ad55

Browse files
cynthiajoanCynthia Jiang
andauthored
update readme (#442)
* update readme * update with comments * tiny update Co-authored-by: Cynthia Jiang <[email protected]>
1 parent 8b87311 commit a51ad55

File tree

1 file changed

+107
-66
lines changed

1 file changed

+107
-66
lines changed

README.md

Lines changed: 107 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,142 @@
1-
2-
# Firebase Unity #
3-
4-
---
5-
1+
# Firebase Unity Open Source Development
2+
3+
The repository contains the Firebase Unity SDK source, with support for Android,
4+
iOS, and desktop platforms. It includes the following Firebase libraries:
5+
6+
- [Google Analytics for Firebase](https://firebase.google.com/docs/analytics/)
7+
- [Firebase Authentication](https://firebase.google.com/docs/auth/)
8+
- [Firebase Crashlytics](https://firebase.google.com/docs/crashlytics)
9+
- [Firebase Realtime Database](https://firebase.google.com/docs/database/)
10+
- [Firebase Dynamic Links](https://firebase.google.com/docs/dynamic-links/)
11+
- [Cloud Firestore](https://firebase.google.com/docs/firestore/)
12+
- [Cloud Functions for Firebase](https://firebase.google.com/docs/functions/)
13+
- [Firebase Invites](https://firebase.google.com/docs/invites/)
14+
- [Firebase Cloud Messaging](https://firebase.google.com/docs/cloud-messaging/)
15+
- [Firebase Remote Config](https://firebase.google.com/docs/remote-config/)
16+
- [Cloud Storage for Firebase](https://firebase.google.com/docs/storage/)
17+
18+
Firebase is an app development platform with tools to help you build, grow and
19+
monetize your app. More information about Firebase can be found at
20+
<https://firebase.google.com>.
21+
22+
More information about the Firebase Unity SDK can be found at <https://firebase.google.com/docs/unity/setup>. Samples on how to use the
23+
Firebase Unity SDK can be found at <https://github.com/firebase/quickstart-unity>.
24+
25+
## Table of Contents
26+
27+
- [Firebase Unity Open Source Development](#firebase-unity-open-source-development)
28+
- [Table of Contents](#table-of-contents)
29+
- [Getting Started](#getting-started)
30+
- [Prerequisites](#prerequisites)
31+
- [Install Unity](#install-unity)
32+
- [Building](#building)
33+
- [Building for certain library](#building-for-certain-library)
34+
- [Packaging](#packaging)
35+
- [Packaging unitypackage](#packaging-unitypackage)
36+
- [Packaging tgz](#packaging-tgz)
37+
- [Packing for certain library](#packing-for-certain-library)
38+
- [Including in Project](#including-in-project)
39+
- [Contributing](#contributing)
40+
- [License](#license)
641

742
## Getting Started
43+
844
You can clone the repo with the following command:
945

1046
``` bash
1147
git clone https://github.com/firebase/firebase-unity-sdk.git
1248
```
1349

1450
## Prerequisites
15-
The prerequisites for firebase cpp are required. Please install the following
16-
packages outlined in [README.md for firebase cpp](https://github.com/firebase/firebase-cpp-sdk/blob/master/README.md#prerequisites).
17-
18-
The following prerequisites are required for all platforms. Be sure to add any
19-
directories to your PATH as needed.
2051

21-
- [CMake](https://cmake.org/) version 3.13.3, or newer.
22-
- [Mono](https://www.mono-project.com/) version 5 or newer.
23-
- [Unity](https://unity.com/) version 2019 or newer.
24-
- [Swig](http://www.swig.org/) version 4 or newer.
52+
Please follow [Firebase C++ SDK Prerequisites](https://github.com/firebase/firebase-cpp-sdk/blob/main/README.md#prerequisites) first.
2553

26-
### Prerequisites for Windows
27-
On windows, to work around path length issues with google unity resolver enable
28-
long path support in git:
54+
- [Swig](https://www.swig.org/), version 4 or newer
2955

30-
> **git config --system core.longpaths true**
56+
### Install Unity
3157

32-
### Prerequisites for Mac
33-
Home brew can be used to install required dependencies:
58+
- [Unity](https://unity.com/download), version 2019 or newer
3459

35-
```bash
36-
# https://github.com/protocolbuffers/protobuf/blob/master/kokoro/macos/prepare_build_macos_rc#L20
37-
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
38-
source $HOME/.rvm/scripts/rvm
39-
brew install cmake protobuf python mono swig
40-
sudo chown -R $(whoami) /usr/local
41-
```
60+
While installing through UnityHub, when you decide which version to install, it will pop up a dialog to select necessary support modules. Please check the boxes based on your dev machine OS and dev platform. For most common case while dev on macOS, we should select Android + Android SDK & NDK Tool, iOS Build Support and Mac Build Support (IL2CPP)
4261

4362
## Building
44-
The build uses CMake to generate the necessary build files, and supports out of
45-
source builds.
4663

47-
The following CMake options are avaliable:
64+
Under the repo root folder, call
4865

49-
* **FIREBASE_INCLUDE_UNITY**: Build for unity only (no mono support)
50-
* **FIREBASE_INCLUDE_MONO**: Build for mono only (no unity support)
51-
* **FIREBASE_UNI_LIBRARY**: Build all native modules as one dynamic lib
52-
* **FIREBASE_CPP_SDK_DIR**: Local path to firebase cpp
53-
* **FIREBASE_UNITY_SDK_VERSION**: Set version string of firebase unity package
54-
* **UNITY_ROOT_DIR**: Local path to Unity's installation directory
55-
(path should end with version number)
56-
* **MONO_DIR**: Local path to mono's xbuild executable directory
57-
* **OPENSSL_ROOT_DIR**: Open ssl root directory
58-
* **PROTOBUF_SRC_ROOT_FOLDER**: Protobuf root directory
66+
``` bash
67+
python scripts/build_scripts/build_zips.py –platform=<target platform>
68+
```
69+
70+
> **Note:** Supported target platform names: linux,macos,windows,ios,android
5971
60-
> Note:<br/>
61-
> &nbsp;&nbsp;&nbsp;**UNITY_ROOT_DIR** is a recommended setting for building
62-
> unity, else CMake will make an effort to auto find unity.
72+
Expected output artifact is
73+
[Repo Root]/<*platform_unity, eg macos_unity*>/firebase_unity-< *version* >-< *platform* >.zip
6374

64-
> Note:<br/>
65-
> &nbsp;&nbsp;&nbsp;On windows, **MONO_DIR** is a required setting.
75+
> **Note:**
76+
>
77+
> - Linux zip requires linux machine to build.
78+
> - Windows zip requires windows machine to build
79+
> - macOS, iOS and android zips can be built by mac.(Although android zip could be built on both linux and windows machine as well, but we recommend to run it with mac, to get align with our CI)
6680
67-
Example build command for linux:
81+
### Building for certain library
6882

6983
``` bash
70-
mkdir build && cd build
71-
cmake .. -DFIREBASE_INCLUDE_MONO=ON -DFIREBASE_CPP_SDK_DIR=../../firebase-cpp-sdk
72-
make -j 8
84+
python scripts/build_scripts/build_zips.py —-platform=<target platform> --targets=<lib1> -–targets=<lib2>
7385
```
7486

75-
> Note:<br/>
76-
> &nbsp;&nbsp;&nbsp;There are build helper scripts in the root folder that will
77-
> build the most common variants and can be used as examples on how to build
78-
> firebase unity.
87+
> **Note:** Supported library names: analytics, auth, crashlytics, database, dynamic_links, firestore, functions, installations, messaging, remote_config, storage
7988
80-
### Building for iOS
81-
CMake needs an extra argument specifing the tool chain to use:
89+
## Packaging
8290

83-
> -DCMAKE_TOOLCHAIN_FILE=../cmake/unity_ios.cmake -G Xcode
91+
We can package the built artifacts to better imported by Unity Editor.
8492

85-
### Building for Android
86-
Run script ./build_android.sh on linux machine.
93+
### Packaging unitypackage
8794

95+
Copy the zip file for each platforms to one folder, referred to as assets_zip_dir below, for example usually looks like this
96+
97+
- firebase_unity-< *version* >-Android.zip
98+
- firebase_unity-< *version* >-Darwin.zip
99+
- firebase_unity-< *version* >-Linux.zip
100+
- firebase_unity-< *version* >-iOS.zip
101+
- firebase_unity-< *version* >-win64.zip
102+
103+
And then run:
104+
105+
``` bash
106+
python scripts/build_scripts/build_package.py --zip_dir=<assets_zip_dir> –output=<output dir>
107+
```
88108

89-
## Unity Package Command ##
109+
### Packaging tgz
90110

91-
CPack is used to generate platform zip files with the same folder structure of
92-
the Unity plugin. Once each platform zip file is built, run
93-
*unity packaging tool* to generate a `.unitypackage` file.
111+
With the same assets_zip_dir, we can run:
94112

113+
``` bash
114+
python scripts/build_scripts/build_package.py --zip_dir=<assets_zip_dir> –output=<output dir> --output_upm=True
95115
```
96-
cd build
97-
cpack .
98-
cd ../unity_packer
99-
python export_unity_package.py --config_file=exports.json --guids_file=guids.json --assets_dir=.. --assets_zip=../build/*.zip --output_dir=../build/
116+
117+
### Packing for certain library
118+
119+
If we build only certain subset of the libraries like in [Building for certain library](#building-for-certain-library), we can copy the built artifacts into assets_zip_dir, and then run:
120+
121+
``` bash
122+
python scripts/build_scripts/build_package.py --zip_dir=<assets_zip_dir> -–output=<output dir> --apis=<lib1,lib2>
100123
```
101124

125+
## Including in Project
126+
127+
We can refer to [Firebase Unity Installation Options](https://firebase.google.com/docs/unity/setup-alternative) to learn how to import the unitypacakge or tgz files that packaged.
128+
129+
## Contributing
130+
131+
We love contributions, but note that we are still working on setting up our
132+
test infrastructure, so we may choose not to accept pull requests until we have
133+
a way to validate those changes on GitHub. Please read our
134+
[contribution guidelines](/CONTRIBUTING.md) to get started.
135+
136+
## License
137+
138+
The contents of this repository is licensed under the
139+
[Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
140+
141+
Your use of Firebase is governed by the
142+
[Terms of Service for Firebase Services](https://firebase.google.com/terms/).

0 commit comments

Comments
 (0)