aboutsummaryrefslogtreecommitdiffhomepage
path: root/CMAKE.md
blob: 0ec1a949a12b9911639e845a18ff4425b2dda56b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Building with CMake

Some portions of this repository are portable beyond iOS and can be built using
CMake.

## Dependencies

You need:
  * A C++ compiler
  * `cmake`

### macOS

You need [Xcode](https://developer.apple.com/xcode/), which you can get from
the Mac App Store.

You can get other development tools via [homebrew](https://brew.sh). Adjust as
needed for other package managers.

```
brew install cmake
```

### Ubuntu

Ubuntu Trusty includes CMake 2.8.12 which should be sufficient. Newer versions
are fine too.

```
sudo apt-get install cmake
```

### Windows

An easy way to get development tools is via [Chocolatey](https://chocolatey.org/).

Unfortunately, the `cmake.install` package is semi-broken, so use the portable
version.

```
choco install cmake.portable
```

## Setup

CMake builds out-of source, so create a separate build directory for the target
you want to work on.

```
mkdir build
cd build
cmake ..
```

You only need to do this once.

## Initial Build

The first build will download, compile all dependencies of the project, and run
an initial battery of tests.

To perform the initial build, you can use CMake

```
cmake --build .
```

or use the underlying build system, e.g.

```
make -j all
```

## Working with a Project

Once the initial build has completed, you can work with a specific subproject
to make changes and test just that project in isolation.

For example, to work with just Firestore,

```
cd build/Firestore
make -j all test
```