f8f59bf3a8c691153199df57b5e93300ea90c7ff
[contrib/mraa.git] / docs / building.md
1 Building libmraa                         {#building}
2 ===============
3
4 libmraa uses cmake in order to make compilation relatively painless. Cmake runs
5 build out of tree so the recommended way is to clone from git and make a build/ directory.
6
7 You'll need swig version 3.0.1+, currently I'm using
8 8d226e39dc7a958013ff9ffd15e231ef206ba265 from the swig master branch. This is
9 only required for javascript support and can be disabled with a cmake define
10 (see below).
11
12 ~~~~~~~~~~~~~{.sh}
13 mkdir build
14 cd build
15 cmake ..
16 make
17 ~~~~~~~~~~~~~
18
19 Our cmake configure has a number of options, cmake-gui or ccmake can show you
20 all the options. The interesting ones are detailed below:
21
22 Few recommended options:
23 Changing install path from /usr/local to /usr
24  -DCMAKE_INSTALL_PREFIX:PATH=/usr
25
26 Building debug build:
27  -DCMAKE_BUILD_TYPE=DEBUG
28
29 Using clang instead of gcc:
30  -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang
31
32 Building with an older version of swig (swig 2.0+) requires the disabling of javascript:
33  -DBUILDSWIGNODE=OFF
34
35 Disabling python module building
36  -DBUILDSWIGPYTHON=OFF
37
38 Building doc, this will require sphinx & doxygen
39  -BUILDDOC=ON
40
41 Using coverity
42 --------------
43
44 Static analysis is routinely performed using coverity on libmraa's codebase.
45 This is the procedure to submit a build to coverity. You'll need to install
46 coverity-submit for your OS.
47
48 ~~~~~~~~~~~~~{.sh}
49 mkdir covbuild/ && cd covbuild
50 cmake -DBUILDDOC=OFF -DBUILDSWIG=OFF ..
51 cmake -DBUILDDOC=OFF -DBUILDSWIG=OFF ..
52 cov-build --dir cov-int make
53 tar caf mraa.tar..bz2 cov-int
54 ~~~~~~~~~~~~~