5. Porting

Building RTI Connext TSS for a new platform or architecture requires creating or updating files in the CMake resource directory (${RTITSSHOME}/resource/cmake).

The CMake resource directory contains 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 platform

A platform may need a corresponding platform file 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 new platform files. Alternatively, contact RTI and ask about the availability of new CMake platforms or toolchains.

A platform must have a CMake platform file in the Modules directory (${RTITSSHOME}/resource/cmake/Modules/ProjectOptions/Platform) to set RTI-specific compiler options. These options depend on the platform defined by CMAKE_SYSTEM_NAME in a toolchain file (or guessed by CMake). We include these files from our top-level CMakeList file, based on the RTI TSS architecture name. These files may enable or disable features and products depending on CMake variables defined by the user or the toolchain file.

5.1.1. Cross-compilation

In addition, a cross-compiled platform must have another platform file in ${RTITSSHOME}/resource/cmake/Modules/Platform to set the target platform. You need to create at least a file with name ${CMAKE_SYSTEM_NAME}.cmake. Other files are optional. General rules for the cross-compiled platform file:

  • The file must start with the name of the platform to support (${CMAKE_SYSTEM_NAME}).
  • These files must not contain anything RTI-specific; that should go to the ProjectOptions folder (${RTITSSHOME}/resource/cmake/Modules/ProjectOptions).
  • Hard-coded paths are not allowed; you need to use relative paths to CMake variables or environment variables.

5.2. New CMake architecture

While the Platform directories contain CMake files with shared settings between the toolchains of a platform family, the toolchain file of a specific architecture is in the Architecture directory (${RTITSSHOME}/resource/cmake/Toolchains/Architecture).

A basic toolchain file, for example, could just be 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_INIT "-m64 ${COMPILER_WARNING_FLAGS}")
set(CMAKE_CXX_FLAGS_INIT "${CMAKE_C_FLAGS_INIT}")
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc ${CMAKE_EXE_LINKER_FLAGS}")

set(SYSLIBS_ARCH "-ldl -lnsl -lm -lpthread -lrt")

5.2.1. Variable definition

5.2.1.1. General

  • 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: Flags to enable warnings in the compiler.
  • WARNING_AS_ERROR_FLAG: Flags to enable treat warnings as errors.

Usually it’s enough to specify the compilers. CMake will internally search for the tools: ar, ranlib and the linker from the directory containing the compiler.

5.2.1.2. Cross-compiling

  • CMAKE_SYSTEM_NAME: Target platform name. Usually output from uname -s. Used by CMake to load the platform configuration files under Platform/${CMAKE_SYSTEM_NAME}. Setting this variable means cross-compiling and CMake sets CMAKE_CROSSCOMPILING.
  • CMAKE_SYSTEM_VERSION: Target platform version. Usually output from uname -r. Not used by CMake.
  • CMAKE_SYSTEM_PROCESSOR: Target CPU name. Usually output from uname -p. Used to load options for the compiler.
  • CMAKE_SYSROOT: Path to pass to the compiler in the –sysroot flag.

5.2.1.3. VxWorks

An experimental toolchain file for cross-compiling a VxWorks 7 architecture (pentium64Vx7.0gcc4.8.1_rtp) is provided with Connext TSS for your reference.

Some variables specific to building VxWorks:

  • VXWORKS_SYSTEM_MAJOR_VERSION and VXWORKS_SYSTEM_MINOR_VERSION: Version of the target VxWorks system. This is used to validate the toolchain loaded and as part of some flags.
  • VXWORKS_SYSTEM_PROCESSOR_TYPE: Type of the processor to be used as part of the toolchain paths and tools name. For instance: ppc for PPC32 and arm for ARMARCH7.
  • VXWORKS_RTP: If the target architecture is RTP or Kernel (default).
  • VXWORKS_VFP: If the target contains a VFP module like for armv7aVx6.9gcc4.3.3.
  • VXWORKS_MUNCH: Munch tool path or binary name. Default value is wtxtcl.ex.
  • VXWORKS_MUNCH_FLAGS: Munch tool flags. Default value set internally.
  • VXWORKS_EXE_LINKER_${lang}_FLAGS: Where ${lang} can be C or CXX. Since we need different linker flags for C and C++ in some VxWorks, we use this variable because CMake does not provide a CMAKE_${lang}_LINKER_FLAGS. This variable must be set through VXWORKS_EXE_LINKER_${lang}_FLAGS_INIT.
  • VSB_DIR: Path to the VxWorks Source Build directory. It is mandatory in VxWorks 7 and optional in prior versions.