~stolowski/unity-scopes-api/canned-query-data

« back to all changes in this revision

Viewing changes to INSTALL

  • Committer: Michi Henning
  • Date: 2013-05-29 04:57:50 UTC
  • Revision ID: michi.henning@canonical.com-20130529045750-gwultik6nxtd7yb9
Initial commit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Copyright (C) 2013 Canonical Ltd
 
3
#
 
4
# This program is free software: you can redistribute it and/or modify
 
5
# it under the terms of the GNU General Public License version 3 as
 
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
 
11
# GNU General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU General Public License
 
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
 
 
27
See debian/control for the list of packages required to build and test the code.
 
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
 
 
41
    $ mkdir builddebug
 
42
    $ cd builddebug
 
43
    $ cmake -DCMAKE_BUILD_TYPE=debug ..
 
44
    $ make
 
45
 
 
46
For a release version, use -DCMAKE_BUILD_TYPE=release
 
47
 
 
48
To build with the flags for coverage testing enabled:
 
49
 
 
50
    $ mkdir buildcoverage
 
51
    $ cd buildcoverage
 
52
    $ cmake -DCMAKE_BUILD_TYPE=coverage
 
53
    $ make
 
54
 
 
55
If you do not have libunity-api installed, build it from source and install it somewhere, then set
 
56
PKG_CONFIG_PATH to include the lib/<arch>/pkgconfig directory.
 
57
 
 
58
Running the tests
 
59
-----------------
 
60
 
 
61
    $ make
 
62
    $ make test
 
63
 
 
64
Note that "make test" alone is dangerous because it does not rebuild
 
65
any tests if either the library or the test files themselves need
 
66
rebuilding. It's not possible to fix this with cmake because cmake cannot
 
67
add build dependencies to built-in targets. To make sure that everything
 
68
is up-to-date, run "make" before running "make test"!
 
69
 
 
70
To run the tests with valgrind:
 
71
 
 
72
    $ make valgrind
 
73
 
 
74
To get coverage output:
 
75
 
 
76
    $ make test
 
77
    $ make coverage
 
78
 
 
79
This drops the coverage tests into the coveragereport directory. (The coverage target is available
 
80
only if the code was built with -DCMAKE_BUILD_TYPE=coverage.)
 
81
 
 
82
Note that, with gcc 4.7.2 and cmake 2.8.10, you may get a bunch of
 
83
warnings. To fix this, you can build cmake 2.8.10 with the following patch:
 
84
 
 
85
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=61ace1df2616e472d056b302e4269cbf112fb020#patch1
 
86
 
 
87
Unfortunately, it is not possibly to get 100% coverage for some files,
 
88
mainly due to gcc's generation of two destructors for dynamic and non-
 
89
dynamic instances. For abstract base classes and for classes that
 
90
prevent stack and static allocation, this causes one of the destructors
 
91
to be reported as uncovered.
 
92
 
 
93
There are also issues with some functions in header files that are
 
94
incorrectly reported as uncovered due to inlining, as well as
 
95
the impossibility of covering defensive assert(false) statements,
 
96
such as an assert in the default branch of a switch, where the
 
97
switch is meant to handle all possible cases explicitly.
 
98
 
 
99
If you run a binary and get lots of warnings about a "merge mismatch for summaries",
 
100
this is caused by having made changes to the source that add or remove code
 
101
that was previously run, so the new coverage output cannot sensibly be merged
 
102
into the old coverage output. You can get rid of this problem by running
 
103
 
 
104
    $ make clean-coverage
 
105
 
 
106
This deletes all the .gcda files, allowing the merge to succeed again.
 
107
 
 
108
If lcov complains about unrecognized lines involving '=====',
 
109
you can patch geninfo and gcovr as explained here:
 
110
 
 
111
https://bugs.launchpad.net/gcovr/+bug/1086695/comments/2
 
112
 
 
113
To run the static C++ checks:
 
114
 
 
115
    $ make cppcheck
 
116
 
 
117
 
 
118
Installation
 
119
------------
 
120
 
 
121
To get files that form part of an installation, run a "make install"
 
122
in the build directory. By default, this installs them in the "install"
 
123
subdirectory of the build directory. If you want to install into a
 
124
different directory, use
 
125
 
 
126
$ cmake -DCMAKE_INSTALL_PREFIX=/usr/local # Or wherever...
 
127
$ make release
 
128
$ make install