17ae8f27d9395fdc4f1e92f44ddba3712e886c4e
[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 -i` will ask you all sorts
20 of interesting questions, you can disable swig modules, build documentation
21 etc...
22
23 Few recommended options:
24 Changing install path from /usr/local to /usr
25 -DCMAKE_INSTALL_PREFIX:PATH=/usr
26
27 Building debug build:
28 -DCMAKE_BUILD_TYPE=DEBUG
29
30 Using clang instead of gcc:
31  -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang
32
33 Building with an older version of swig (swig 2.0+) requires the disabling of javascript:
34  -DBUILDSWIGNODE=OFF
35
36 Using coverity
37 --------------
38
39 Static analysis is routinely performed using coverity on libmraa's codebase.
40 This is the procedure to submit a build to coverity. You'll need to install
41 coverity-submit for your OS.
42
43 ~~~~~~~~~~~~~{.sh}
44 mkdir covbuild/ && cd covbuild
45 cmake -DBUILDDOC=OFF -DBUILDSWIG=OFF ..
46 cmake -DBUILDDOC=OFF -DBUILDSWIG=OFF ..
47 cov-build --dir cov-int make
48 tar caf mraa.tar..bz2 cov-int
49 ~~~~~~~~~~~~~