4.6. CMake¶
CMake is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice. (From https://cmake.org/). CMake can be downloaded from https://cmake.org/download/.
4.6.1. Reference Commands¶
We recommend to use out of the source build of Cmake and run it from other directory.
A reference command to compiling for SE050_C from Windows PC is:
cd <ROOT_DIR>
mkdir ..\build_se050
cd ..\build_se050
cmake ..\<ROOT_DIR> -DApplet=SE050_C -DHost=PCWindows
A helper python script scripts\create_cmake_projects.py
is available
as a part of the project.
Sample usage on Windows is:
call <ROOT_DIR>\scripts\env_setup.bat
python scripts\create_cmake_projects.py
Sample usage on Linux/POSIX is:
. <ROOT_DIR>/scripts/env_setup.sh
python scripts/create_cmake_projects.py
This will create a <ROOT_DIR>_build
directory with some reference
CMake projects.
Warning
It is recommend to keep <ROOT_DIR>
to:
A small path as much as possible. i.e. Closer to top most directory of the drive, instead of a deep long path.
Is kept in a path that does not have spaces in it. This avoids issues faced with building some times.
Note
For sample paths of installation tools, please
see scripts\env_setup.bat
and scripts/env_setup.sh
4.6.2. CMake - Cross compiling¶
CMake can also be used for cross compiling for non native platforms. For that tool-chain files have to be used. As part of the Plug & Trust Middleware the following files are used.
- Android
$NDK_ROOT/build/cmake/android.toolchain.cmake
- iMX6
scripts/ToolchainFile_imx6.cmake
- FRDM K64F
scripts/armgcc_force_cpp.cmake
NDK_ROOT
is the environment variable set by Android Build system.