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:
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()
*.plugindescriptionfile for the given executable (Filter, Streaming Source, Streaming Sink)
ADTFMacros.cmakewhich you can find in the ADTF installation directory. For more information have a look at the ADTF SDK
cmake-gui.exeto open the graphical user interface
buildfolder (this is where all the build stuff goes)
Make sure you choose the 64 Bit CMake Generator. Maybe you have choose additonal options for that.
Ungrouped Entriesand you will see that the value for the variable
ADTF_DIRis not set. To fix this click into the "Value" Column and fill in the path to your ADTF directory.
CMAKEand 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.
Open Projectbutton 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
macro to the existing
CMake will automatically look for a
CMakeLists.txt file inside the given folder and process
the instructions found in it:
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.