This guide covers how CMake and ADTF play together:
CMake is a cross-platform, free and open-source software for managing the
build process of software using a compiler-independent method. It supports
directory hierarchies and applications that depend on multiple libraries.
It is used in conjunction with native build environments such as make,
Apple's Xcode, and Microsoft Visual Studio. It has minimal dependencies,
requiring only a C++ compiler on its own build system. (Wikipedia)
CMakeLists.txt
files are used to declare which directories
should be included in the CMake process and what to do with the files
in the included directories.
Create a new file called CMakeLists.txt
in the directory of the source files
you want to include in the Visual Studio solution. Now open the file in an editor.
First of all we can store information in variables using following command:
set (EXAMPLE_VARIABLE_NAME example_variable_value)
We can then access the value using:
${EXAMPLE_VARIABLE_NAME}
If we need empty files (e.g header, source files) we can create them using this CMakeLists.txt. First we want to check whether the files we want to create already exist. If the files do not exist yet, we create them. Note that the path in the if condition has to be absolute. When creating files the path may be relative.
if(NOT EXISTS "PATH/TO/EXAMPLE/HEADER/FILE/example.h")
file(WRITE example.h)
endif()
if(NOT EXISTS "PATH/TO/EXAMPLE/SOURCE/FILE/example.cpp")
file(WRITE example.cpp})
endif()
*.adtfplugin
*.plugindescription
file for the given *.adtfplugin
including all components*.adtfplugin
based on information from related *.plugindescription
ADTFMacros.cmake
which you can find in the
ADTF installation directory. For more information have a look at the ADTF SDK
cmake-gui.exe
to open the graphical user interface
CMakeLists.txt
file)
build
folder (this is where all the build stuff goes)
Configure
button
Make sure you choose the 64 Bit CMake Generator. Maybe you have choose additonal options for that.
Ungrouped Entries
and you will see that the value for the variable ADTF_DIR
is not set.
To fix this click into the "Value" Column and fill in the path to your ADTF directory.
CMAKE
and search for the variable CMAKE_INSTALL_PREFIX
.
By default this variable points to an absolute path with administration privileges which can be a problem.
Set the variable also to your ADTF directory e.g. D:/ADTF/3.4.0
.
Configure
button
Generate
button
Open Project
button to open the generated project with Visual Studio
ADTF comes with several examples in place which are build with CMake. You can find these examples
in the folder src/examples/src
of the ADTF installation directory.
If we use this directory to create a new project folder and add our new CMakeLists.txt
file into it,
we can tell the existing ADTF example build process about our new project. This approach has the advantage that the
CE looks up plugins inside src/examples/bin
by default.
So you don't have to tell the ADTF Configuration Editor where to look for your newly created Filter, Streaming Source, Streaming Sink.
All we have to do is step one folder up in the file system hierarchy and add the add_subdirectory
macro to the existing CMakeLists.txt
file.
CMake will automatically look for a CMakeLists.txt
file inside the given folder and process
the instructions found in it:
add_subdirectory(PATH/TO/OUR/CMAKELISTS/FILE)
Congratulations! Now you know are ready to dive into the ADTF SDK.
Have a look at My first Filter to learn about the basic ADTF Filter mechanics.