- All commands use Bash syntax
${directory_with_project}
is assumed to be existing directory with project on Docker host${directory_with_results_of_build}
is assumed to be existing directory where the results of build (CMake generated project) will be placed${image_name}
is assumed to be the name of Docker image
Image name | Description |
---|---|
abrarov/asio-samples-builder-alpine | Builder on Alpine Linux |
abrarov/asio-samples-builder-ubuntu | Builder on Ubuntu |
abrarov/asio-samples-builder-centos | Builder on CentOS |
Variable name | Meaning of variable | Possible values | Default value | Comments |
---|---|---|---|---|
BUILD_TYPE | Type of project CMake generates. Is passed to CMake "as is". Is passed to CMake as CMAKE_BUILD_TYPE parameter. | One of: Debug , Release , RelWithDebInfo , MinSizeRel . Refer to CMake documentation for details. |
Release |
Use Debug if calculating code coverage. |
STATIC_RUNTIME | Enforces static linkage with C/C++ runtime. | One of: ON , OFF . |
OFF |
|
BOOST_USE_STATIC_LIBS | Enforces static linkage with Boost C++ Libraries. Is passed to CMake command line during generation of project "as is" under Boost_USE_STATIC_LIBS parameter. |
One of: ON (static linkage), OFF (linkage type depends on platform). |
ON |
Refer to documentation of FindBoost CMake module for details about Boost_USE_STATIC_LIBS . |
MA_QT | Enables or disables usage of Qt and so enables / disables parts of the project which depend on Qt. | One of: ON , OFF . |
ON |
|
MA_QT_MAJOR_VERSION | Enforces usage of Qt 4.x or Qt 5.x. | One of: 4 (for usage of Qt 4.x), 5 (for usage of Qt 5.x). |
5 |
Is ignored if MA_QT == OFF . |
MA_COVERAGE | Turns on calculation of code coverage and generation of coverage report (HTML) under coverage subdirectory of directory with results of build. |
One of: ON (with code coverage), OFF (without code coverage). |
OFF |
It's recommended to calculate code coverage with debug build, i.e. with BUILD_TYPE == Debug . |
Path in Docker image | Meaning of path | Comments |
---|---|---|
/project | Source code to build | Should be mapped to ${directory_with_project} , read only permissions are sufficient |
/build | Location of project generated by CMake, includes results of build | Usually is mapped to ${directory_with_results_of_build} to extract result of build from Docker container. Write permissions are required |
Docker container command - like parameters specified after image name in
Docker run
command - is passed to CMake during generation of project as is,
i.e. this command:
docker run ... "${image_name}" -D MY_PARAM=my_value
leads to passing -D MY_PARAM=my_value
to CMake command line during
project generation.
Build release version with Qt 5.x:
docker run --rm \
-e MA_QT_MAJOR_VERSION=5 \
-v "${directory_with_project}":/project:ro \
-v "${directory_with_results_of_build}":/build \
"${image_name}"
Build release version with Qt 4.x:
docker run --rm \
-e MA_QT_MAJOR_VERSION=4 \
-v "${directory_with_project}":/project:ro \
-v "${directory_with_results_of_build}":/build \
"${image_name}"
Build with Qt 5.x and calculate code coverage:
docker run --rm \
-e MA_QT_MAJOR_VERSION=5 \
-e BUILD_TYPE=Debug \
-e MA_COVERAGE=ON \
-v "${directory_with_project}":/project:ro \
-v "${directory_with_results_of_build}":/build \
"${image_name}"
Build with Qt 4.x and calculate code coverage:
docker run --rm \
-e MA_QT_MAJOR_VERSION=4 \
-e BUILD_TYPE=Debug \
-e MA_COVERAGE=ON \
-v "${directory_with_project}":/project:ro \
-v "${directory_with_results_of_build}":/build \
"${image_name}"
- Get prebuilt (Alpine, CentOS) or build Boost C++ Libraries with static C/C++ runtime
- Get prebuilt or build Qt with static C/C++ runtime (as well as all dependencies of Qt like ICU) or use
MA_QT
environment variable to skip usage of Qt and to not build parts which require Qt
- Boost C++ Libraries built with static C/C++ runtime are installed
into
${boost_install_root}
directory on Docker host
Build with static C/C++ runtime and without building sub-projects which require Qt:
docker run --rm \
-e STATIC_RUNTIME=ON \
-e MA_QT=OFF \
-v "${directory_with_project}":/project:ro \
-v "${directory_with_results_of_build}":/build \
-v "${boost_install_root}":/boost:ro \
"${image_name}" \
-D Boost_NO_SYSTEM_PATHS=ON \
-D BOOST_INCLUDEDIR=/boost/include \
-D BOOST_LIBRARYDIR=/boost/lib