docs: update libmraa intro text
[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 a yocto/oe toolchain
42 --------------------------
43
44 In order to compile with a yocto/oe toolchain use the following toolchain file.
45 This works well on the edison 1.6 SDK. First source the environment file, then
46 use our cmake toolchain file.
47
48 ~~~~~~~~~~~~~{.sh}
49 source /opt/poky-edison/1.6/environment-setup-core2-32-poky-linux
50 mkdir build
51 cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchains/oe-sdk_cross.cmake ..
52 make
53 ~~~~~~~~~~~~~
54
55 Using coverity
56 --------------
57
58 Static analysis is routinely performed using coverity on libmraa's codebase.
59 This is the procedure to submit a build to coverity. You'll need to install
60 coverity-submit for your OS.
61
62 ~~~~~~~~~~~~~{.sh}
63 mkdir covbuild/ && cd covbuild
64 cmake -DBUILDDOC=OFF -DBUILDSWIG=OFF ..
65 cmake -DBUILDDOC=OFF -DBUILDSWIG=OFF ..
66 cov-build --dir cov-int make
67 tar caf mraa.tar..bz2 cov-int
68 ~~~~~~~~~~~~~