ADTF  3.18.2
ADTF CMake Environment

What is CMake?

CMake is a meta build system that lets you generate native build environments for multiple platforms and compilers with a single configuration. For example, it enables you generate Visual Studio solutions on Windows and Unix Makefile projects on Linux using gcc. This page is intended for introductionary use only. For a complete CMake documentation please visit http://www.cmake.org.

Basic Concepts

Each CMake project has a CMakeLists.txt file at the root of its directory hierarchy. This file defines the project and contains the necessary instructions to build it. CMake supports both so called out-of-source builds and in-source builds. We discourage the use of the latter since it will clutter your source directory with multiple files. So building a CMake project typically involves three directories:

  1. The source directory: this is the directory where the CMakeLists.txt and all other source files (i.e. .cpp and .h files) reside.
  2. The build directory: this is where the native build system and intermediate build artifacts will be put.
  3. The installation directory: this is the directory where everything that makes up the final product will be placed.

Building a CMake project requires the following steps to be carried out:

  1. Creating a native build system using CMake (most likely with cmake-gui)
  2. Building with the native build system, i.e Visual Studio or Make.

ADTF CMake Packages

The ADTF SDK is split up into libraries and will be delivered by packages. See Software Development Kit for an overview.

Other than in previous versions of ADTF SDK we will not deliver many CMake macros anymore.

Within ADTF 3.3 the cmake-handling has changed to the Modern CMake approach. This means that all the provided libraries contain their relevant information. Therefore you do not have to specify the include directories, compiler flags, preprocessor variables or library dependencies manually. Due to this big change, the usage of find_package in combination with ADTF changes significantly.

The new CMake macro ADTFConfig.cmake will not set any variables.

If you use the ADTF package to build a binary do the following:

#....
find_package(ADTF REQUIRED COMPONENTS systemsdk)
add_library(mytarget STATIC mysource.h mysource.cpp)
target_link_library(mytarget PRIVATE adtf::systemsdk)
#....

With this approach the find_package(ADTF REQUIRED COMPONENTS systemsdk) automatically enriches the CMake scope with a new target adtf::systemsdk

Note
All provided packages are summarized in the cmake namespace adtf::

Provided Packages

  • adtf2support
  • base
  • ddl
  • filtersdk
  • mediadescription
  • plugindescription
  • remotesdk
  • rpc
  • streaming3
  • systemsdk
  • ucom3
  • ui
  • a_utils
  • easy_profiler

We recommend using the find_package(ADTF COMPONENTS pkg-name) approach. The warranty of finding the packages will be higher.

Create ADTF Filter Plugins

We provide a CMake macro to create own filters. It will link the filter target to the adtf::filtersdk.

cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
project(adtf_filter_example)
find_package(ADTF REQUIRED COMPONENTS filtersdk)
adtf_add_filter(demo_filter
stdafx.h
stdafx.cpp
demo_filter.h
demo_filter.cpp
)
adtf_install_plugin(demo_filter bin)

Create ADTF System Service Plugins

Since ADTF Filter Development Package is strictly separated from the ADTF System SDK you need to use and import an additional adtfsystemsdk package if you do ADTF system development.

We provide a CMake macro to create own services. It will automatically link your target against adtf::systemsdk.

cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
project(adtf_service_example)
find_package(ADTF REQUIRED COMPONENTS systemsdk)
adtf_add_system_service(demo_service
stdafx.h
stdafx.cpp
demo_service.h
demo_service.cpp
)
adtf_install_plugin(demo_service bin)

Supplied Build Configurations

ADTF is delivered in both RelWithDebInfo and Debug versions. To enable the build of other CMake configurations (i.e. Release or MinSizeRel) the ADTF CMake config manipulates the CMAKE_MAP_IMPORTED_CONFIG_<Configuration> variables to map the RelWithDebInfo packages to Release and MinSizeRel.

If you do not want this to happen, specify ONLY_RELWITHDEBINFO in the COMPONENTS section of your find_package call:

find_package(ADTF REQUIRED COMPONENTS systemsdk ONLY_RELWITHDEBINFO)