Commit 4936202a by Tobias Schuele

Revised description of CMake options

parent 686ff69c
...@@ -36,7 +36,7 @@ Contact: ...@@ -36,7 +36,7 @@ Contact:
See the file [COPYING.md](https://github.com/siemens/embb/blob/master/COPYING.md) in the project's root directory. See the file [COPYING.md](https://github.com/siemens/embb/blob/master/COPYING.md) in the project's root directory.
### Contributions: ### Contributions
See the file [CONTRIBUTING.md](https://github.com/siemens/embb/blob/master/CONTRIBUTING.md) in the project's root directory. See the file [CONTRIBUTING.md](https://github.com/siemens/embb/blob/master/CONTRIBUTING.md) in the project's root directory.
...@@ -57,7 +57,7 @@ The project is based on the standards C99 (for C code) and C++03 (for C++ code) ...@@ -57,7 +57,7 @@ The project is based on the standards C99 (for C code) and C++03 (for C++ code)
### Quick Installation on Linux ### Quick Installation on Linux
To generate and invoke the platform-specific build files, open a shell and change to the project's root directory. Create a subdirectory, where you want to build the library, e.g., "build", and change to that subdirectory. It is assumed that the project's root directory is now the parent directory. Now you can generate the build files using CMake: To generate and invoke the platform-specific build files, open a shell and change to the project's root directory. Create a subdirectory, where you want to build the library, e.g., "build", and change to that subdirectory. In the following, it is assumed that the project's root directory is the parent directory. Now you can generate the build files using CMake:
cmake .. cmake ..
...@@ -75,7 +75,7 @@ Finally, install EMB² (the default path is `/usr/local`): ...@@ -75,7 +75,7 @@ Finally, install EMB² (the default path is `/usr/local`):
### Quick Installation on Windows ### Quick Installation on Windows
To generate and invoke the platform-specific build files, open the Visual Studio developer shell and change to the project's root directory. Create a subdirectory, where you want to build the library, e.g., "build", and change to that subdirectory. It is assumed that the project's root directory is now the parent directory. Now you can generate the build files using CMake (Make sure that you specify the correct version of Visual Studio. A list of supported CMake generators can be displayed by typing `cmake --help`): To generate and invoke the platform-specific build files, open a Visual Studio developer shell and change to the project's root directory. Create a subdirectory, where you want to build the library, e.g., "build", and change to that subdirectory. In the following, it is assumed that the project's root directory is the parent directory. Now you can generate the build files using CMake (a list of supported CMake generators can be displayed by typing `cmake --help`). For example:
cmake -G "Visual Studio 14 2015" .. cmake -G "Visual Studio 14 2015" ..
...@@ -87,77 +87,48 @@ After compilation has finished, execute the tests: ...@@ -87,77 +87,48 @@ After compilation has finished, execute the tests:
binaries\run_tests.bat binaries\run_tests.bat
Finally, install EMB² with administrator privileges: Finally, install EMB² with *administrator privileges*:
cmake --build . --target install --config Release cmake --build . --target install --config Release
### Detailed Installation Instructions
### 1. Generation of native build files EMB² provides several options which allow you to configure it to your needs. This section explains these options and describes the build process in more detail.
Choose an appropriate build file generator for your system. #### Generation of Native Build Files
- For Linux, GCC/Clang, x86/x86_64/ARM: "Unix Makefiles" As mentioned above, it is recommended to build EMB² in a subdirectory, e.g., "build". The actual build files are generated by the following command (a list of available generators can be displayed by typing `cmake --help`):
- For Windows, MSVC of VS 2013, x86: "Visual Studio 12"
- For Windows, MSVC of VS 2013, x86_64: "Visual Studio 12 Win64"
- For Windows, MSVC of VS 2012, x86: "Visual Studio 11"
- For Windows, MSVC of VS 2012, x86_64: "Visual Studio 11 Win64"
A list of all available generators can be displayed by typing "cmake" without
any options. The build files can be generated using the following command:
cmake -G <generator> .. [OPTIONS] cmake -G <generator> .. [OPTIONS]
Note that on Linux, the architecture (32/64 bit) cannot be selected by the Note that on Linux, the architecture (32/64 bit) cannot be selected by the generator. The default is "Unix Makefiles" for which reason option `-G <generator>` can be omitted.
generator. However, the build mode (Release/Debug) can be specified using the
option -DCMAKE_BUILD_TYPE=[Release|Debug]. If no build mode is given on Linux,
the default (Release) is used. The Visual Studio generators create build files
for both modes (the selection is done at build time).
You may choose a custom compiler instead the default one by defining
CMAKE_CXX_COMPILER and/or CMAKE_C_COMPILER. For example, to use Clang on Linux
use:
cmake .. -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
In the same way you may cross compile to another platform. For example, to cross
compile to ARM Linux using GCC, you need to specify the cross compiler itself and
the target architecture as an argument to the compiler:
cmake .. -DCMAKE_CXX_COMPILER=arm-linux-gnueabi-gcc++ #### Options
-DCMAKE_CXX_FLAGS=-march=armv7-a
-DCMAKE_C_COMPILER=arm-linux-gnueabi-gcc
-DCMAKE_C_FLAGS=-march=armv7-a
EMB² can be built with and without C++ exception handling, which has to be EMB² can be built in Release or Debug mode. The latter contains additional checks during runtime and is only recommended for development purposes. On Linux, the build mode can be specified using the option `-DCMAKE_BUILD_TYPE=[Release|Debug]`, for example:
specified on build file generation. When exceptions are turned off, an error
message is emitted and the program aborts in case of an exception within EMB².
To disable exceptions, add the option -DUSE_EXCEPTIONS=OFF.
Similarly, automatic initialization of the task scheduler by the MTAPI C++ cmake .. -DCMAKE_BUILD_TYPE=Debug
interface can be disabled with -DUSE_AUTOMATIC_INITIALIZATION=OFF. This way,
unexpected delays after startup can be avoided, e.g. for timing measurements.
The tutorial of EMB² comes with example source files in doc/examples/. These If no build mode is given, the default (Release) is used. The Visual Studio generators create build files for both modes (the selection is done at build time).
can be built with the other source files using CMake option -DBUILD_EXAMPLES=ON
in the generation step. Note, however, that the examples use C++11 features and
require a corresponding compiler.
Now you can generate the build files as shown by the following examples. You may choose a custom compiler instead the default one by defining `CMAKE_CXX_COMPILER` and/or `CMAKE_C_COMPILER`. For example, to use Clang on Linux, type:
For a Linux Debug build with exception handling, type cmake .. -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
cmake -G "Unix Makefiles" .. -DCMAKE_BUILD_TYPE=Debug In the same way, you may cross compile to another platform. For example, to cross compile to ARM v7 using GCC, you need to specify the cross compiler itself and the target architecture as an argument to the compiler:
For a default Linux build without automatic MTAPI C++ initialization, type cmake .. -DCMAKE_CXX_COMPILER=arm-linux-gnueabi-gcc++ \
-DCMAKE_CXX_FLAGS=-march=armv7-a \
-DCMAKE_C_COMPILER=arm-linux-gnueabi-gcc \
-DCMAKE_C_FLAGS=-march=armv7-a
cmake .. -DUSE_AUTOMATIC_INITIALIZATION=OFF EMB² can be built with (default) and without C++ exception handling. When exceptions are turned off, a message is emitted in case of an error and the program aborts. To disable exceptions, add the option `-DUSE_EXCEPTIONS=OFF`.
For a Windows build (VS 2013, x86) without exception handling, type Similarly, automatic initialization of the task scheduler by the MTAPI C++ interface can be disabled with `-DUSE_AUTOMATIC_INITIALIZATION=OFF`. This way, unexpected delays after startup can be avoided, e.g. for timing measurements.
cmake -G "Visual Studio 12" .. -DUSE_EXCEPTIONS=OFF The tutorial of EMB² comes with a number of examples in `doc/examples/`. These can be built with the other source files using the option `-DBUILD_EXAMPLES=ON`. Note, however, that the examples use C++11 features and require a corresponding compiler.
Note that "Visual Studio 12" refers to the version number of Visual Studio and By default, the included unit tests are built as part of the installation process. To override the default behavior, add the option `-DBUILD_TESTS=OFF`.
not to the year in which it was released (2013).
### 2. Compiling and linking ### 2. Compiling and linking
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment