Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit d1c6bf3

Browse files
committed
Merge pull request #290 from dawagner/improve-build-experience
Improve build experience Add some doc, make it easy to list available configuration options and clean appveyor.yml up a bit.
2 parents 0f40fd4 + e0a71cf commit d1c6bf3

File tree

9 files changed

+94
-19
lines changed

9 files changed

+94
-19
lines changed

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,16 @@ endif(COMMAND cmake_policy)
3636

3737
project(parameter-framework)
3838

39+
include(CMakeDependentOption)
40+
3941
option(COVERAGE "Build with coverage support" OFF)
40-
option(BASH_COMPLETION "Install bash completion configuration" ON)
42+
cmake_dependent_option(BASH_COMPLETION "Install bash completion configuration"
43+
ON
44+
UNIX # Only allow installing bash completion on Unix environments
45+
OFF)
4146
option(DOXYGEN "Enable doxygen generation (you still have to run 'make doc')" OFF)
4247
option(REQUIREMENTS "Generate the html version of the 'requirements' documentation" OFF)
43-
option(PYTHON_BINDINGS "Python library to use the Parameter Framrwork from python" ON)
48+
option(PYTHON_BINDINGS "Python library to use the Parameter Framework from python" ON)
4449
option(C_BINDINGS "Library to use the Parameter Framework using a C API" ON)
4550

4651

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,48 @@ See [the wiki on github](https://github.com/01org/parameter-framework/wiki).
6464

6565
## Compiling
6666

67+
### Dependencies
68+
69+
In order to compile you'll need, at the very least:
70+
71+
- CMake (v2.8.12 or later);
72+
- A C/C++ compiler supporting C++11;
73+
- libxml2 headers and libraries (Provided by the `libxml2-dev` on debian-based
74+
distributions);
75+
- Standalone ASIO (1.10.6 or later) (Provided by `libasio-dev` on debian-based
76+
distributions) ASIO is C++ header-only ASynchronous-IO library.
77+
78+
If you want to compile the *Python bindings*, you'll also need:
79+
80+
- SWIG 2.0 (A binding generator);
81+
- Python2.7 development environment (Provided by `python2.7-dev` on debian-based
82+
distributions)
83+
84+
If you want to *compile and run the tests*, you'll also need:
85+
86+
- Catch (Provided by `catch` on debian-based distributions). Catch is a
87+
single-header test framework - as such you may also download it directly
88+
[here](https://raw.githubusercontent.com/philsquared/Catch/master/single_include/catch.hpp);
89+
- Python2.7 (Provided by `python2.7` on debian-based distribution - it is
90+
preinstalled on most distributions).
91+
92+
If you want to *build the code documentation*, you'll need `doxygen` and
93+
`graphviz`. This doc is already available to you - see the wiki.
94+
95+
**To list all available configuration options, try** `cmake -L` (you may also
96+
filter-out lines starting with `CMAKE_`).
97+
98+
### How-To
99+
100+
If you are already familiar with CMake, you know what to do.
101+
67102
Run `cmake .` then `make`. You may then install libraries, headers and
68103
binaries with `make install`. By default, they are installed under
69104
`/usr/local` on unix OSes; if you want to install them under a custom
70105
directory, you may do so by passing it to the `cmake .` command; e.g.
71106

107+
# Always use absolute paths in CMake "-D" options: you don't know where
108+
# relative paths will be evaluated from.
72109
cmake -DCMAKE_INSTALL_PREFIX=/path/to/custom/install .
73110

74111
If you want to provide your own dependencies (e.g. your own version of
@@ -92,3 +129,20 @@ After a build you may want to run the parameter-framework tests with
92129

93130
You may take a look at `.travis.yml` and `appveyor.yml` for examples on how we
94131
build the Parameter Framework in the CI.
132+
133+
### Compiling on Windows
134+
135+
If you don't already have libxml2 headers/libraries and don't want to build them
136+
by yourself, we have a precompiled version for x86-64.
137+
138+
Compiled with Visual Studio 12 2013:
139+
- [in debug configuration](https://01.org/sites/default/files/libxml2-x86_64-debug-3eaedba1b64180668fdab7ad2eba549586017bf3.zip)
140+
- [in release configuration](https://01.org/sites/default/files/libxml2-x86_64-3eaedba1b64180668fdab7ad2eba549586017bf3.zip)
141+
142+
We have mirrored ASIO 1.10.6 [here](https://01.org/sites/default/files/asio-1.10.6.tar.gz).
143+
144+
Once you have downloaded and uncompressed these two dependencies, add the
145+
following two entries to `CMAKE_PREFIX_PATH`:
146+
147+
/path/to/libxml2-x86_64/
148+
/path/to/asio-1.10.6/

appveyor.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ install:
4343
7z x -i"!asio*/include" asio-1.10.6.tar)
4444
- if not exist catch (
4545
wget --no-check-certificate https://raw.github.com/philsquared/Catch/master/single_include/catch.hpp --directory-prefix catch )
46+
- set DEBUG_LIBXML2_PATH=%APPVEYOR_BUILD_FOLDER%\libxml2-x86_64-debug
47+
- set RELEASE_LIBXML2_PATH=%APPVEYOR_BUILD_FOLDER%\libxml2-x86_64
4648

4749
# Setup Visual studio build environement
4850
- '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86_amd64'
@@ -59,33 +61,33 @@ build_script:
5961
- mkdir build && cd build
6062

6163
- mkdir 64bits-debug && cd 64bits-debug
62-
# Add debug libxml2.dll in the path so that cmake & tests can find it
63-
- set OLD_PATH=%PATH% && set PATH=%APPVEYOR_BUILD_FOLDER%\libxml2-x86_64-debug\bin;%PATH%
64-
- cmake -G "NMake Makefiles" -DPYTHON_BINDINGS=OFF -DBASH_COMPLETION=OFF -DCMAKE_PREFIX_PATH="%PREFIX_PATH%" ..\..
64+
# Add debug libxml2.dll in the path so that tests can find it
65+
- set TEST_PATH=%DEBUG_LIBXML2_PATH%\bin
66+
- cmake -G "NMake Makefiles" -DPYTHON_BINDINGS=OFF -DCMAKE_PREFIX_PATH="%PREFIX_PATH%;%DEBUG_LIBXML2_PATH%" ..\..
6567
- cmake --build . --config debug
6668
- ctest --build-config debug %CTEST_PARAMS%
67-
- set PATH=%OLD_PATH% && cd ..
69+
- cd ..
6870

6971
- mkdir 64bits-release & cd 64bits-release
70-
# Add release libxml2.dll in the path so that cmake & tests can find it
71-
- set OLD_PATH=%PATH% && set PATH=%APPVEYOR_BUILD_FOLDER%\libxml2-x86_64\bin;%PATH%
72-
- cmake -G "Visual Studio 12 2013 Win64" -DCMAKE_BUILD_TYPE=Release -DPYTHON_BINDINGS=OFF -DBASH_COMPLETION=OFF -DCMAKE_PREFIX_PATH="%PREFIX_PATH%" -DCMAKE_INSTALL_PREFIX=%INSTALL% ..\..
72+
# Add debug libxml2.dll in the path so that tests can find it
73+
- set TEST_PATH=%RELEASE_LIBXML2_PATH%\bin
74+
- cmake -G "Visual Studio 12 2013 Win64" -DPYTHON_BINDINGS=OFF -DCMAKE_PREFIX_PATH="%PREFIX_PATH%;%RELEASE_LIBXML2_PATH%" -DCMAKE_INSTALL_PREFIX=%INSTALL% ..\..
7375
# Build, test and install
7476
- cmake --build . --config release
7577
- ctest --build-config release %CTEST_PARAMS%
7678
- cmake --build . --config release --target install
77-
- set PATH=%OLD_PATH% && cd ..
79+
- cd ..
7880

7981
# build and test the skeleton plugin against the previously-installed build; this serves as a smoke test of the whole stack
8082
- mkdir skeleton && cd skeleton
8183
# %INSTALL%\lib is where the skeleton plugin is installed (see comment below)
8284
# %INSTALL%\bin is where parameter.dll is installed
83-
- set OLD_PATH=%PATH% && set PATH=%APPVEYOR_BUILD_FOLDER%\libxml2-x86_64\bin;%INSTALL%\lib;%INSTALL%\bin;%PATH%
84-
- cmake -G "Visual Studio 12 2013 Win64" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%INSTALL% -DCMAKE_PREFIX_PATH=%INSTALL% %APPVEYOR_BUILD_FOLDER%\skeleton-subsystem
85+
# Also add the path where the release libxml2.dll has been extracted
86+
- set TEST_PATH=%RELEASE_LIBXML2_PATH%\bin;%INSTALL%\lib;%INSTALL%\bin
87+
- cmake -G "Visual Studio 12 2013 Win64" -DCMAKE_INSTALL_PREFIX=%INSTALL% -DCMAKE_PREFIX_PATH=%INSTALL% %APPVEYOR_BUILD_FOLDER%\skeleton-subsystem
8588
# Unfortunately, the skeleton test currently doesn't work on
8689
# multi-configuration build systems (Visual Studio is one of those) without
8790
# installing the plugin
8891
- cmake --build . --config release --target install
8992
- ctest --build-config release %CTEST_PARAMS%
90-
- set PATH=%OLD_PATH% && cd ..
9193
- cd ..

bindings/python/CMakeLists.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,20 @@
2626
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2727
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828

29-
find_package(SWIG REQUIRED)
29+
find_package(SWIG)
30+
# Hide these variables from CMake GUIs and `cmake -L`
31+
set_property(CACHE
32+
SWIG_DIR SWIG_EXECUTABLE SWIG_VERSION
33+
PROPERTY ADVANCED TRUE)
34+
if (NOT SWIG_FOUND)
35+
message(FATAL_ERROR
36+
"Swig is needed to compile the Python bindings but was not found."
37+
"Please either install swig2.0 or disable Python bindings by setting"
38+
"PYTHON_BINDINGS to OFF (e.g. '-DPYTHON_BINDINGS=OFF' in the"
39+
"invocation of CMake.). See the 'Compilation' section of README.md"
40+
"for more details.")
41+
endif()
42+
3043
include(${SWIG_USE_FILE})
3144

3245
# Force usage of Python 2.7.x ...

ctest/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function(set_test_env TestName)
6060
#
6161
# Thus all `;` in environment variables must be escaped
6262
# before inserting them in the ENVIRONMENT PROPERTY.
63-
string(REPLACE ";" "\\;" TEST_PATH "$ENV{PATH}")
63+
string(REPLACE ";" "\\;" TEST_PATH "$ENV{PATH};$ENV{TEST_PATH}")
6464
string(REPLACE ";" "\\;" TEST_LD_LIBRARY_PATH "$ENV{LD_LIBRARY_PATH}")
6565
string(REPLACE ";" "\\;" TEST_PYTHONPATH "$ENV{PYTHONPATH}")
6666

doc/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2727
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828

29-
include(CMakeDependentOption)
3029
# Only present DOXYGEN_GRAPHS if DOXYGEN is ON and if so, default to ON.
3130
# Else, set to OFF.
3231
cmake_dependent_option(DOXYGEN_GRAPHS

remote-processor/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ find_package(Threads REQUIRED)
4444
# If asio isn't installed in a standard directory, add the correct directory to
4545
# CMAKE_PREFIX_PATH (see the main README for more information).
4646
find_path(ASIO_DIR NAMES asio.hpp)
47+
# Hide this variable from CMake GUIs and `cmake -L`
48+
set_property(CACHE ASIO_DIR PROPERTY ADVANCED TRUE)
4749
# FIXME: asio header should not leak to remote-processor users
4850
target_include_directories(remote-processor SYSTEM PUBLIC "${ASIO_DIR}")
4951

test/catch/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ if(BUILD_TESTING)
3131
# Unfortunately gtest is very hard to setup as not binary distributed
3232
# catch is only one header so it is very easy
3333
find_path(CATCH_HEADER catch.hpp)
34+
set_property(CACHE CATCH_HEADER PROPERTY ADVANCED TRUE)
3435
if (NOT CATCH_HEADER)
3536
message(SEND_ERROR
3637
" Catch header `catch.hpp' could not be found.
@@ -40,7 +41,6 @@ if(BUILD_TESTING)
4041
https://raw.github.com/philsquared/Catch/master/single_include/catch.hpp
4142
Then either:
4243
- append the download folder to the `CMAKE_INCLUDE_PATH' or `CMAKE_PREFIX_PATH' variable
43-
- set cmake variable `CATCH_HEADER' to the header directory
4444
- copy it in a standard location (/usr/include on most linux distribution).
4545
To remove test dependancies all together, set `BUILD_TESTING' to false.
4646
It will disable test targets, thus the framework they depend on.")

test/test-fixed-point-parameter/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828

2929
if (BUILD_TESTING AND PYTHON_BINDINGS)
30-
find_program(python2 python2)
30+
find_package(PythonInterp 2.7 REQUIRED)
3131

3232
add_test(NAME fix_point_parameter
3333
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
34-
COMMAND ${python2} Main.py)
34+
COMMAND ${PYTHON_EXECUTABLE} Main.py)
3535

3636
# Custom function defined in the top-level CMakeLists
3737
set_test_env(fix_point_parameter)

0 commit comments

Comments
 (0)