~aacid/unity-api/setMoveFavorite

1 by Michi Henning
Initial check-in of build-environment skeleton.
1
#
2
# Copyright (C) 2013 Canonical Ltd
3
#
4
# This program is free software: you can redistribute it and/or modify
67.1.1 by Michi Henning
Changed "Lesser GNU General Public License" to "GNU Lesser General Public License" throughout.
5
# it under the terms of the GNU Lesser General Public License version 3 as
1 by Michi Henning
Initial check-in of build-environment skeleton.
6
# published by the Free Software Foundation.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
67.1.1 by Michi Henning
Changed "Lesser GNU General Public License" to "GNU Lesser General Public License" throughout.
11
# GNU Lesser General Public License for more details.
1 by Michi Henning
Initial check-in of build-environment skeleton.
12
#
67.1.1 by Michi Henning
Changed "Lesser GNU General Public License" to "GNU Lesser General Public License" throughout.
13
# You should have received a copy of the GNU Lesser General Public License
1 by Michi Henning
Initial check-in of build-environment skeleton.
14
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
#
16
# Authored by: Michi Henning <michi.henning@canonical.com>
17
#
18
19
-------------------------------------------------------------------------------------
20
NOTE: Before making changes to the code, please read the README file in its entirety!
21
-------------------------------------------------------------------------------------
22
23
24
Build dependencies
25
------------------
26
34.1.1 by Michi Henning
Minor updates to build instructions.
27
See debian/control for the list of packages required to build and test the code.
1 by Michi Henning
Initial check-in of build-environment skeleton.
28
29
30
Building the code
31
-----------------
32
33
The simplest case is:
34
35
    $ mkdir build
36
    $ cd build
37
    $ cmake ..
38
39
By default, the code is built in release mode. To build a debug version, use
40
7 by Michi Henning
Fixed cmake issues with Jussi's help.
41
    $ mkdir builddebug
42
    $ cd builddebug
43
    $ cmake -DCMAKE_BUILD_TYPE=debug ..
44
    $ make
45
17 by Michi Henning
More cleanup for cmake.
46
For a release version, use -DCMAKE_BUILD_TYPE=release
7 by Michi Henning
Fixed cmake issues with Jussi's help.
47
48
To build with the flags for coverage testing enabled:
49
50
    $ mkdir buildcoverage
34.1.1 by Michi Henning
Minor updates to build instructions.
51
    $ cd buildcoverage
7 by Michi Henning
Fixed cmake issues with Jussi's help.
52
    $ cmake -DCMAKE_BUILD_TYPE=coverage
53
    $ make
54
1 by Michi Henning
Initial check-in of build-environment skeleton.
55
56
Running the tests
57
-----------------
58
59
    $ make
60
    $ make test
61
62
Note that "make test" alone is dangerous because it does not rebuild
63
any tests if either the library or the test files themselves need
64
rebuilding. It's not possible to fix this with cmake because cmake cannot
65
add build dependencies to built-in targets. To make sure that everything
66
is up-to-date, run "make" before running "make test"!
67
68
To run the tests with valgrind:
69
70
    $ make valgrind
71
17 by Michi Henning
More cleanup for cmake.
72
To get coverage output:
1 by Michi Henning
Initial check-in of build-environment skeleton.
73
7 by Michi Henning
Fixed cmake issues with Jussi's help.
74
    $ make test
17 by Michi Henning
More cleanup for cmake.
75
    $ make coverage-html
76
34.1.1 by Michi Henning
Minor updates to build instructions.
77
This drops the coverage tests into the coveragereport directory. (The coverage-html target is available
78
only if the code was built with -DCMAKE_BUILD_TYPE=coverage.)
17 by Michi Henning
More cleanup for cmake.
79
80
Note that, with gcc 4.7.2 and cmake 2.8.10, you may get a bunch of
81
warnings. To fix this, you can build cmake 2.8.10 with the following patch:
1 by Michi Henning
Initial check-in of build-environment skeleton.
82
83
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=61ace1df2616e472d056b302e4269cbf112fb020#patch1
84
85
Unfortunately, it is not possibly to get 100% coverage for some files,
86
mainly due to gcc's generation of two destructors for dynamic and non-
87
dynamic instances. For abstract base classes and for classes that
88
prevent stack and static allocation, this causes one of the destructors
89
to be reported as uncovered.
90
91
There are also issues with some functions in header files that are
92
incorrectly reported as uncovered due to inlining, as well as
93
the impossibility of covering defensive assert(false) statements,
94
such as an assert in the default branch of a switch, where the
95
switch is meant to handle all possible cases explicitly.
96
97
If you run a binary and get lots of warnings about a "merge mismatch for summaries",
98
this is caused by having made changes to the source that add or remove code
99
that was previously run, so the new coverage output cannot sensibly be merged
100
into the old coverage output. You can get rid of this problem by running
101
102
    $ make clean-coverage
103
104
This deletes all the .gcda files, allowing the merge to succeed again.
105
34.1.1 by Michi Henning
Minor updates to build instructions.
106
If lcov complains about unrecognized lines involving '=====',
107
you can patch geninfo and gcovr as explained here:
1 by Michi Henning
Initial check-in of build-environment skeleton.
108
34.1.1 by Michi Henning
Minor updates to build instructions.
109
https://bugs.launchpad.net/gcovr/+bug/1086695/comments/2
1 by Michi Henning
Initial check-in of build-environment skeleton.
110
111
To run the static C++ checks:
112
113
    $ make cppcheck
114
115
116
Installation
117
------------
118
119
To get files that form part of an installation, run a "make install"
120
in the build directory. By default, this installs them in the "install"
121
subdirectory of the build directory. If you want to install into a
122
different directory, use
123
124
$ cmake -DCMAKE_INSTALL_PREFIX=/usr/local # Or wherever...
125
$ make release
126
$ make install