3. Compilation

3.1. Linux, MacOS, QNX, VxWorks, Lynx, Android

For these systems, RTI Perftest makes use of a script in the top-level directory named build.sh.

The purpose of build.sh is to, first, invoke RTI DDS Generator (rtiddsgen) in order to generate the type-code files and makefiles needed to compile a target architecture; then, second, execute the makefile with the right arguments to generate the executables.

This script supports the code generation and compilation for Traditional C++, Modern C++, C#, and Java.

Potentially, build.sh can generate and compile code for every architecture supported by rtiddsgen where a makefile is generated as output when the -example command-line is specified.

3.1.1. Prerequisites

  • RTI Connext DDS Professional or RTI Connext DDS Micro should be installed in the system where the build.sh script is going to run. The Target libraries for the platform to be generated should also be installed.

  • If you are building for the C# API implementation, the RTI Connext DDS dotnet package should be installed.

  • The $NDDSHOME environment variable should be set correctly. Alternatively, $NDDSHOME can be passed directly to the build.sh script by using the --nddshome <PATH> command-line option.

    When compiling for RTI Connext DDS Micro, the $RTIMEHOME environment variable should be set correctly. Alternatively, $RTIMEHOME can be passed directly to the build.sh script by using the --rtimehome <PATH> command-line option.

  • The build.sh script is written in bash. It is going to try to execute it from /bin/bash.

  • GNU make is required to be accessible from the $PATH environment variable in order to execute the makefiles generated by rtiddsgen. Alternatively the GNU make executable can be passed directly to the build.sh script by using the --make <PATH> command-line option.

  • When compiling for RTI Connext DDS Micro, Cmake is required to be accessible from the $PATH environment variable in order to execute the makefiles generated by rtiddsgen. Alternatively the cmake executable can be passed directly to the build.sh script by using the --cmake <PATH> command-line option.

  • The C++ Compiler/Linker parent folders should be in the $PATH variable, or they should be specified as full path names (see parameters below). If unspecified, the names of the compiler and linker are going to be determined by the makefile generated by rtiddsgen. The C++ Compiler and Linker are not required if the script is set to avoid the C++ compilation by adding the --skip-cpp-build and --skip-cpp11-build command-line options.

  • Java JDK should be available in the system and accessible from the $PATH environment. This is not required if the script is set to avoid the Java ByteCode generation by adding the --skip-java-build command-line option.

  • If you intend to compile and test using RTI Security Plugins, you will need to link against the OpenSSL libraries for your architecture.

3.1.2. Parameters

The build.sh script accepts the following list of parameters:

Parameter

Required

Description

--platform

Required

Architecture/Platform for which build.sh is going to compile RTI Perftest.

--micro

Optional

Compile RTI Perftest against RTI Connext DDS Micro

--nddshome

Optional

Path to the RTI Connext DDS Professional installation. If this parameter is not present, the $NDDSHOME variable should be.

--rtimehome

Optional

Path to the RTI Connext DDS Micro installation. If this is not present, the $RTIMEHOME variable should be set.

--skip-java-build

Optional

Avoid Java ByteCode generation and .jar creation. Not available when compiling for RTI Connext DDS Micro.

--skip-cpp-build

Optional

Avoid C++ code generation and compilation.

--skip-cpp11-build

Optional

Avoid C++ New PSM code generation and compilation. Not available when compiling for RTI Connext DDS Micro.

--java-build

Optional

Only Java ByteCode generation and .jar creation. Not available when compiling for RTI Connext DDS Micro.

--cpp-build

Optional

Only C++ code generation and compilation.

--cpp11-build

Optional

Only C++ New PSM code generation and compilation. Not available when compiling for RTI Connext DDS Micro.

--cs-build

Optional

Only C# code generation and compilation. Not available when compiling for RTI Connext DDS Micro.

--dynamic

Optional

Compile using the RTI Connext DDS dynamic libraries. Default: Static Libraries. Not available when compiling for RTI Connext DDS Micro.

--debug

Optional

Compile using the RTI Connext DDS debug libraries. Default: Release Libraries.

--customType

Optional

Use the Custom type feature with your type. See details and examples of use in the documentation

--customTypeFlatData

Optional

Use the Custom type feature with your FlatData type. See details and examples of use in the documentation

--flatData-max-size <size>

Optional

Specify the maximum size in bytes of the sample to be sent when using FlatData language binding. Default: 10485760

--secure

Optional

Enable the compilation of the Perfest code specific for security and adds the RTI Connext DDS Security Libraries in the linking step (if compiling statically). Default: Not set.

--openssl-home

Optional

Path to the openSSL home directory. Needed when compiling using the --secure option and statically.

--make

Optional

Path to the GNU make executable. If this parameter is not present, the GNU make variable should be available from your $PATH variable.

--cmake

Optional

Path to the cmake executable. If this parameter is not present, the cmake variable should be available from your $PATH variable.

--add-cmake-args

Optional

Additional arguments that will be passed directly to the cmake executable.

--compiler

Optional

Path to (or name of) the compiler executable. If this parameter is not a full path, the named executable should be available from your $PATH variable. (NOTE: c++/c++11 builds only)

--linker

Optional

Path to (or name of) the linker executable. If this parameter is not a full path, the named executable should be available from your $PATH variable. (NOTE: c++/c++11 builds only)

--perl

Optional

Path to PERL executable. If this parameter is not present, not present, the path to PERL should be available from your $PATH variable.

--java-home

Optional

Path to the Java JDK home folder. If this parameter is not present, javac, jar and java executables should be available from your $PATH variable.

--ns-resolution

Optional

Try to use the system real-time clock to get nanosecond resolution. Availability depends on the OS. For the Traditional C++ Implementation only. Default: not enabled

--osx-shmem-shmmax

Optional

Specify the maximum segment size for shared memory in OSX. Default: 400MB

--clean

Optional

If this option is present, the build.sh script will clean all the generated code and binaries from previous executions.

--build-doc

Optional

Generate the HTML and PDF documentation. This parameter is only avaialble on build.sh.

--help -h

Optional

If this option is present, the build.sh script will display a help description and exit.

3.1.3. Examples Running build script

In order to build using build.sh you just need to invoke the script with the command-line parameters desired. The following are some typical examples:

  • Generation and compilation for a given architecture (x64Darwin15clang7.0) for C++ (traditional and modern) and Java .

    ./build.sh --platform x64Darwin15clang7.0
    
  • Generation and compilation for a given architecture (x64Darwin15clang7.0) just for C++ (traditional and modern).

    ./build.sh --platform x64Darwin15clang7.0 --skip-java-build
    
  • Generation and compilation for a single given architecture (x64Darwin15clang7.0) just for java.

    ./build.sh --platform x64Darwin15clang7.0 --java-build
    
  • Generation and compilation just for C# (no architecture required).

    ./build.sh --cs-build
    
  • Generation and compilation for a given architecture (x64Darwin15clang7.0) for all supported languages and linking against the Dynamic + Debug libraries.

    ./build.sh --platform x64Darwin15clang7.0 --dynamic --debug
    
  • Generation and compilation for a given architecture (x64Darwin15clang7.0) for all supported languages, enabling the security options and linking statically (default).

    ./build.sh --platform x64Darwin15clang7.0 --secure --openssl-home <PATH>
    
  • Generation and compilation for a given architecture (x64Darwin15clang7.0) for all supported languages, enabling the security options and linking dynamically. As you can see in this case, there is no need to specify the --openssl-home command-line argument.

    ./build.sh --platform x64Darwin15clang7.0 --secure --dynamic
    
  • Generation and compilation for a given architecture (x64Linux4gcc7.3.0) for all supported languages, modifiying the default maximum size of a Perftest type sample when using RTI FlatData language binding to 100MB (104857600B).

    ./build.sh --platform x64Linux4gcc7.3.0 --flatData-max-size 104857600
    
  • Generation and cross-compilation for a non-native architecture (armv8Linux4.4gcc5.4.0). Note how you can specify the Compiler/Linker used by rtiddsgen.

    ./build.sh --platform armv8Linux4.4gcc5.4.0 --compiler aarch64-linux-gnu-g++ --linker aarch64-linux-gnu-g++
    
  • Generation and compilation for a given architecture (x64Darwin14clang6.0) compiling against RTI Connext DDS Micro.

    ./build.sh --platform x64Darwin14clang6.0 --micro
    
  • RTI Perftest directory clean-up.

    ./build.sh --clean
    

3.1.4. Note: Build script execution for VxWorks kernel mode

After building the RTI Perftest executables for VxWorks kernel mode, an extra step is needed: "Munching." Munching is automatically done in RTI Connext DDS Professional starting in 6.0.0. However, for previous versions and for RTI Connext DDS Micro, the process has to be done manually.

3.2. Windows systems

For Windows systems, RTI Perftest makes use of a script in the top level directory named build.bat. Its content is equivalent to the build.sh described before.

The purpose of build.bat is to invoke RTI DDS Generator (rtiddsgen) in order to generate the type-code files and Visual Studio solution needed to compile a target architecture. Then execute the Visual Studio solution with the right arguments to generate the executables.

This script supports the code generation and compilation for Traditional C++, Modern C++, C# and Java.

The build.bat script should be able to generate and compile code for every Windows architecture supported by rtiddsgen when the -example command-line is specified.

3.2.1. Prerequisites

  • RTI Connext DDS should be installed in the system where the build.bat script is going to run. The Target libraries for the platform to be generated should also be installed.

  • If you are building for the C# API implementation, the RTI Connext DDS dotnet package should be installed.

  • The %NDDSHOME% environment variable should be set correctly. Alternatively, %NDDSHOME% can be passed directly to the build.bat script by using the --nddshome <PATH> command-line option.

    When compiling for RTI Connext DDS Micro, the %RTIMEHOME% environment variable should be set correctly. Alternatively, %RTIMEHOME% can be passed directly to the build.bat script by using the --rtimehome <PATH> command-line option.

  • The Microsoft Visual Studio for the architecture intended to be built should be installed in your system. The msbuild.exe program should be available in the %PATH% variable. [See note-1]

  • When compiling for RTI Connext DDS Micro Cmake is required to be accessible from the %PATH% environment variable in order to execute the makefiles generated by rtiddsgen. Alternatively the cmake executable can be passed directly to the build.bat script by using the --cmake <PATH> command-line option.

  • Java JDK should be available in the system and accessible from the %PATH% environment. This is not required if the script is set to avoid the Java ByteCode generation by adding the --skip-java-build command-line option.

  • If you intend to compile and test using RTI Security Plugins, you will need to link against the OpenSSL libraries for your architecture.

[note-1]: The simplest way to run the build.bat script and ensure that all the Microsoft Visual Studio variables are correctly set is by running it from the Visual Studio Command Prompt provided by each of the Microsoft Visual Studio versions.

3.2.2. Parameters

The build.bat script accepts the following list of parameters:

Parameter

Required

Description

--platform

Required

Architecture/Platform for which build.bat is going to compile RTI Perftest.

--nddshome

Optional

Path to the RTI Connext DDS installation. If this parameter is not present, the %NDDSHOME% variable should be set.

--rtimehome

Optional

Path to the RTI Connext DDS Micro installation. If this is not present, the %RTIMEHOME% variable should be set.

--skip-java-build

Optional

Avoid Java ByteCode generation and .jar creation.

--skip-cpp-build

Optional

Avoid C++ code generation and compilation.

--skip-cpp11-build

Optional

Avoid C++ New PSM code generation and compilation.

--skip-cs-build

Optional

Avoid C# code generation and compilation.

--java-build

Optional

Only Java ByteCode generation and .jar creation.

--cpp-build

Optional

Only C++ code generation and compilation.

--cpp11-build

Optional

Only C++ New PSM code generation and compilation.

--cs-build

Optional

Only C# code generation and compilation.

--dynamic

Optional

Compile using the RTI Connext DDS dynamic libraries. Default: Static Libraries.

--debug

Optional

Compile using the RTI Connext DDS debug libraries. Default: Release Libraries.

--customType

Optional

Use the Custom type feature with your type. See details and examples of use in the documentation

--customTypeFlatData

Optional

Use the Custom type feature with your FlatData type. See details and examples of use in the documentation

--flatData-max-size <size>

Optional

Specify the maximum size in bytes of the sample to be sent when using FlatData language binding. Default: 10485760

--secure

Optional

Enable the compilation of the Perfest code specific for security and adds the RTI Connext DDS Security Libraries in the linking step (if compiling statically). Default: Not set.

--openssl-home

Optional

Path to the openSSL home directory. Needed when compiling using the --secure option and statically. Note: For RTI Connext DDS Micro, provide this path with '/' instead of ''. This is required by cmake.

--cmake

Optional

Path to the cmake executable. If this parameter is not present, the cmake variable should be available from your $PATH variable.

--add-cmake-args

Optional

Additional arguments that will be passed directly to the cmake executable.

--cmake-generator

Optional

cmake generator to be used By default, NMake makefiles will be generated.

--msbuild

Optional

Path to the msbuild.exe executable. If this parameter is not present, msbuild variable should be available from your %PATH% variable.

--java-home

Optional

Path to the Java JDK home folder. If this parameter is not present, javac, jar and java executables should be available from your %PATH% variable.

--clean

Optional

If this option is present, the build.bat script will clean all the generated code and binaries from previous executions.

--help -h

Optional

If this option is present, the build.bat script will display a help description and exit.

3.2.3. Examples running build script

In order to build using build.bat you just need to invoke the script with the command-line parameters desired. The following are some typical examples:

  • Simple generation and compilation for a given architecture (x64Win64VS2012) for C++ (traditional and modern) C# and Java.

    build.bat --platform x64Win64VS2012
    
  • Simple generation and compilation for a given architecture (x64Win64VS2012) just for C#.

    build.bat --platform x64Win64VS2012 --cs-build
    

    Alternatively this can be achieved by using:

    build.bat --platform x64Win64VS2012 --skip-java-build --skip-cpp-build --skip-cpp11-build
    
  • Generation and compilation for a given architecture (x64Win64VS2012) for all supported languages and linking against the Dynamic + Debug libraries.

    ./build.bat --platform x64Win64VS2012 --dynamic --debug
    
  • Generation and compilation for a given architecture (x64Win64VS2012) for all supported languages, enabling the security options and linking statically (default).

    ./build.bat --platform x64Win64VS2012 --secure --openssl-home <PATH>
    
  • Generation and compilation for a given architecture (x64Win64VS2012) for all supported languages, enabling the security options and linking dynamically. As you can see in this case, there is no need to specify the --openssl-home command-line argument.

    ./build.bat --platform x64Win64VS2012 --secure --dynamic
    
  • Generation and compilation for a given architecture (x64Win64VS2012) for all supported languages, modifiying the default maximum size of a Perftest type sample when using RTI FlatData language binding to 100MB (104857600B).

    ./build.bat -platform x64Win64VS2012 --flatData-max-size 104857600
    
  • Generation and compilation for a given architecture (x64Win64VS2012) for Connext DDS Micro, specifying the RTIMEHOME.

    ./build.bat --platform x64Win64VS2012 --micro --rtimehome <PATH>
    
  • Generation and compilation for a given architecture (x64Win64VS2012) for Connext DDS Micro with security, using debug mode and specifying the RTIMEHOME.

    ./build.bat --platform x64Win64VS2012 --micro --rtimehome <PATH> --secure --openssl-home <PATH/WITH/FORWARD/SLASHES>
    
  • RTI Perftest directory clean-up.

    build.bat --clean