.. _section-compilation: Compilation =========== Unix systems ------------ For Unix systems, *RTI Perftest* makes use of a script in the top level directory named ``build.sh``. The purpose of ``build.sh`` is to, in the first place, invoke *RTI DDS Generator* (*Rtiddsgen*) in order to generate the type-code files and makefiles needed to compile a target architecture. Then, in second place, execute the makefile with the right arguments to generate the executables. This script supports the code generation and compilation for *Traditional C++*, *Modern 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. Prerequisites ~~~~~~~~~~~~~ - *RTI Connext DDS* 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. - The ``$NDDSHOME`` environment variable should be set correctly. Alternatively, ``$NDDSHOME`` can be passed directly to the ``build.sh`` script by using the ``--nddshome `` 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 `` command line option. - The C++ Compiler/Linker parent folders should be in the ``$PATH`` variable. 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-cpp03-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 the *RTI Secure Plugin* you will need to link against the OpenSSL libraries for your architecture. 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*. | +----------------------+-----------+-----------------------------------+ | --nddshome | Optional | Path to the *RTI Connext DDS | | | | installation*. If this parameter | | | | is not present, the ``$NDDSHOME`` | | | | variable should be. | +----------------------+-----------+-----------------------------------+ | --skip-java-build | Optional | Avoid ``Java ByteCode`` | | | | generation and ``.jar`` creation. | +----------------------+-----------+-----------------------------------+ | --skip-cpp-build | Optional | Avoid C++ code generation and | | | | compilation. | +----------------------+-----------+-----------------------------------+ | --skip-cpp03-build | Optional | Avoid C++ New PSM 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. | +----------------------+-----------+-----------------------------------+ | --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, ``GNU make`` | | | | 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.sh`` script will clean | | | | all the generated code and | | | | binaries from previous | | | | executions. | +----------------------+-----------+-----------------------------------+ | --help -h | Optional | If this option is present, the | | | | ``build.sh`` script will display | | | | a help description and exit. | +----------------------+-----------+-----------------------------------+ 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++ (Classic and new) and Java . :: ./build.sh --platform x64Darwin15clang7.0 - Generation and compilation for a given architecture (``x64Darwin15clang7.0``) just for C++ (Classic and new). :: ./build.sh --platform x64Darwin15clang7.0 --skip-java-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 - 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 - *RTI Perftest* directory clean-up. :: ./build.sh --clean 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. 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. - The ``%NDDSHOME%`` environment variable should be set correctly. Alternatively, ``%NDDSHOME%`` can be passed directly to the ``build.bat`` script by using the ``--nddshome `` 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]* - 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 the *RTI Secure Plugin* 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. 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. | +----------------------+-----------+-----------------------------------+ | --skip-java-build | Optional | Avoid ``Java ByteCode`` | | | | generation and ``.jar`` creation. | +----------------------+-----------+-----------------------------------+ | --skip-cpp-build | Optional | Avoid C++ code generation and | | | | compilation. | +----------------------+-----------+-----------------------------------+ | --skip-cpp03-build | Optional | Avoid C++ New PSM code generation | | | | and compilation. | +----------------------+-----------+-----------------------------------+ | --skip-cs-build | Optional | Avoid 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. | +----------------------+-----------+-----------------------------------+ | --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. | +----------------------+-----------+-----------------------------------+ | --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. | +----------------------+-----------+-----------------------------------+ 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++ (Classic and new) C# and Java. :: build.bat --platform x64Win64VS2012 - Simple generation and compilation for a given architecture (``x64Win64VS2012``) just for C#. :: build.bat --platform x64Win64VS2012 --skip-java-build --skip-cpp-build --skip-cpp03-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 - 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 - *RTI Perftest* directory clean-up. :: build.bat --clean