5. Porting Connext TSS
To build Connext TSS for a new platform or architecture,
you must create or update files in the CMake resource directory
(<RTITSSHOME>/resource/cmake).
The CMake resource directory contains the Toolchains/ and Modules/
directories. Toolchains/ contains CMake toolchain
files. Modules/ contains RTI-specific CMake scripts, including
additional platform- and toolchain-specific files.
5.1. New CMake Platforms
To port Connext TSS to a new CMake platform, a corresponding platform file may
be required in the Toolchains/ directory
(<RTITSSHOME>/resource/cmake/Toolchains/Platform). While
a host platform likely will not need one, a cross-compiled
platform likely will. Follow the CMake toolchain
documentation to create a new platform file. Alternately,
contact RTI Support and ask about the availability
of new CMake platforms or toolchains.
To set RTI-specific compiler options, each platform must have a CMake
platform file in the Modules directory
(<RTITSSHOME>/resource/cmake/Modules/ProjectOptions/Platform/). These
compiler options depend on the platform defined by the CMAKE_SYSTEM_NAME
variable in a corresponding toolchain
file (or guessed by CMake). RTI includes these platform and toolchain files
in the <RTITSSHOME> top-level CMakeList file, based on the RTI TSS
architecture name. These files may enable or
disable Connext TSS features and products, depending on the CMake variables defined
by you or the toolchain file.
5.1.1. Cross-compiling
A cross-compiled CMake platform must have another
platform file in
<RTITSSHOME>/resource/cmake/Modules/Platform/ to set
the target platform. You must create a file
named <CMAKE_SYSTEM_NAME>.cmake for this purpose; other
configuration files are optional.
The following rules apply for the cross-compiled platform file:
The file must start with the name of the platform to support, as defined by the
CMAKE_SYSTEM_NAMEvariable.These files must not contain any RTI-specific options; those options need to be defined in the
ProjectOptions/folder (<RTITSSHOME>/resource/cmake/Modules/ProjectOptions/).Hard-coded paths are not allowed; use relative paths to CMake variables or environment variables.
5.2. New CMake Architectures
While the Platform/ directories contain CMake files with shared settings
between the toolchains of a platform family, the Architecture/ directory
(<RTITSSHOME>/resource/cmake/Toolchains/Architecture/) contains the
toolchain file for a specific architecture. To port Connext TSS
to a new CMake architecture, create a new toolchain file in this directory.
A basic toolchain file, for example, could include just the following:
# Toolchain file for Linux x64 with GCC 4.8.2
include("${CMAKE_CURRENT_LIST_DIR}/../Common.cmake")
platform_setup()
set(PLATFORM_C_COMPILER_EXPECTED_VERSION 4.8.2)
set(PLATFORM_CXX_COMPILER_EXPECTED_VERSION 4.8.2)
set(CMAKE_C_FLAGS "-m64 ${COMPILER_WARNING_FLAGS_C}")
set(CMAKE_CXX_FLAGS "${COMPILER_WARNING_FLAGS_CXX}")
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc ${CMAKE_EXE_LINKER_FLAGS}")
set(SYSLIBS_ARCH "-ldl -lnsl -lm -lpthread -lrt")
5.2.1. Variable definitions
5.2.1.1. General
The following variables can be used with any CMake architecture:
CMAKE_<LANG>_COMPILER: Full path for the compiler.CMAKE_AR: Full path for the archiving tool for static libraries.CMAKE_RANLIB: Full path for the randomizing tool for static libraries.CMAKE_LINKER: Full path for the linker. Note that for most platforms, CMake uses the compiler for linking. This can be changed in the platform files, overriding the linking rules.CMAKE_<LANG>_FLAGS_INIT: Flags for the compiler.CMAKE_SHARED_LINKER_FLAGS_INIT: Flags for the linker.COMPILER_WARNING_FLAGS_C: Flags to enable warnings in the C compiler.COMPILER_WARNING_FLAGS_CXX: Flags to enable warnings in the C++ compiler.WARNING_AS_ERROR_FLAG: Flags to enable treat warnings as errors.
Typically, it’s enough to specify the compilers in your toolchain file. CMake internally searches for the tools ar and ranlib, as well as the linker, from the directory containing the compiler.
5.2.1.2. Cross-compiling
The following CMake variables can be used when cross-compiling:
CMAKE_SYSTEM_NAME: Target platform name, usually output fromuname -s. Used by CMake to load the platform configuration files under Platform/$<CMAKE_SYSTEM_NAME>. Setting this variable means cross-compiling and CMake sets theCMAKE_CROSSCOMPILINGvariable.CMAKE_SYSTEM_VERSION: Target platform version, usually output fromuname -r. Not used by CMake.CMAKE_SYSTEM_PROCESSOR: Target CPU name, usually output fromuname -p. Used to load options for the compiler.CMAKE_SYSROOT: Path to pass to the compiler in the--sysrootflag.