summaryrefslogtreecommitdiff
path: root/docs/nncc/getting_started.md
blob: 8f01bd2a43ece7c9e0333ccb04b7fc69f7f53093 (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
#### Prerequisites

The following toolchains are needed to build _nncc_ project:
 - CMake (>= 3.1)
 - g++ (>= 4.8)

#### How to build _nncc_ with docker

_nncc_ provides ``Dockerfile`` in order to make it easy to setup development environment.

One may build ``nncc`` docker image with the following command:
```
nncc$ cat infra/docker/Dockerfile | docker build -t nncc -
...
```

By default, this ``Dockerfile`` uses "archive.ubuntu.com" which may be quite slow. One may use mirror site via ``UBUNTU_MIRROR`` variable.
For example, one may enable the use of ``kr.archive.ubuntu.com`` via the following command
```
nncc$ cat infra/docker/Dockerfile | docker build --build-arg UBUNTU_MIRROR="kr.archive.ubuntu.com" -t nncc -
...
```

One who works behind proxy should provide proxy configuration via the following command:
```
nncc$ cat infra/docker/Dockerfile | docker build --build-arg HTTP_PROXY=<HTTP proxy address> --build-arg HTTPS_PROXY=<HTTPS proxy address> -t nncc -
...
```
One may use simplified command if ``HTTP_PROXY`` and ``HTTPS_PROXY`` environment variables are already set:
```
nncc$ export
...
declare -x HTTP_PROXY=...
declare -x HTTPS_PROXY=...
...
nncc$ cat infra/docker/Dockerfile | docker build --build-arg HTTP_PROXY --build-arg HTTPS_PROXY -t nncc -
...
```

Note that these configurations are orthogonal to each other. One may freely combine these options as follows:
```
nncc$ cat infra/docker/Dockerfile | docker build --build-arg HTTP_PROXY --build-arg HTTPS_PROXY --build-arg UBUNTU_MIRROR="kr.archive.ubuntu.com" -t nncc -
```

One may easily build _nncc_ with the following command once ``nncc`` docker image is built.
```
nncc$ ./nncc docker-nncc configure
...
nncc$ ./nncc docker-nncc build
...
```

#### How to build _nncc_ with ninja

You may build _nncc_ with ninja (instead of make) if ninja is available. Please try the following commands:
```
nncc$ rm -rf build
nncc$ ./nncc configure -G Ninja
nncc$ ./nncc build
```

#### How to build and run _nncc_ unittests

_nncc_ includes various unittests to check its correctness. One may build and run these unittests via the following command:
```
nncc$ rm -rf build
nncc$ ./nncc configure -DENABLE_TEST=1
nncc$ ./nncc build
nncc$ ./nncc test
```

**NOTE** As _nncc_ unittests are implemented on top of google test framework (_gtest_), _nncc_ build script will automatically download _gtest_ 1.8 from public GitHub.
If you are not able to access public GitHub from your machine, please override download URL via ``GTEST_URL`` environment variable.