Building a Plug-in

This page shows how to generate the Makefiles for communication plug-ins. If you have not implemented a plug-in yet, you may use the provided example plug-ins for an initial test or refer to the page Getting Started with Plug-in Development to get information about the implementation of a plug-in.

How to Build a Plug-in

With CMake, the build system artifacts, for example, Makefiles, are generated automatically according to the respective platform, toolchain, and generator.

To build the release version of the plug-in, you can use the following commands:

cmake -B <BUILD DIR> -S <PLUG-IN SOURCE DIR> -DCMAKE_PREFIX_PATH=<MERLIC INSTALL DIR> -DCMAKE_BUILD_TYPE=Release
cmake --build <BUILD DIR> --config Release
Example for Windows

The following code shows how to build the example plug-in "event-logger" on a Windows system.

cmake -B "%USERPROFILE%/communicator_plugin_builds/event-logger" -S "<MERLIC EXAMPLE DIR>/communication_plugins/event-logger" -DCMAKE_PREFIX_PATH="<MERLIC INSTALL DIR>" -DCMAKE_BUILD_TYPE=Release
cmake --build "%USERPROFILE%/communicator_plugin_builds/event-logger" --config Release

The placeholder for <MERLIC EXAMPLE DIR> and <MERLIC INSTALL DIR> must be replaced with the path to the respective location of the MERLIC examples and the MERLIC installation.

Example for aarch64

The following code shows how to build the example plug-in "event-logger" for an aarch64 Linux target on a x64 Linux host:

cmake -B $HOME/communicator_plugin_builds/event-logger \
-S <MERLIC EXAMPLE DIR>/communication_plugins/event-logger \
-DCMAKE_PREFIX_PATH=<MERLIC INSTALL DIR> \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SYSTEM_NAME=Linux \
-DCMAKE_SYSTEM_PROCESSOR=aarch64 \
-DCMAKE_CXX_COMPILER=<AARCH64 CROSS COMPILER NAME>
cmake --build $HOME/communicator_plugin_builds/event-logger --config Release

The placeholder for <MERLIC EXAMPLE DIR> and <MERLIC INSTALL DIR> must be replaced with the path to the respective location of the MERLIC examples and the MERLIC installation.

In addition, you have to specify the compiler executable name for the placeholder <AARCH64 CROSS COMPILER NAME>, for example, aarch64-linux-gnu-g++.

How to Build a Plug-in with Boost Dependencies

If you want to build a plug-in that requires the Boost libraries, you have to take the following into account:

  • Ensure that Boost is already installed on your system.
  • When building the plug-in, you have to specify the installation directory of Boost using the argument "DBoost_ROOT".

For more information on the Boost libraries and the installation, see the Getting Started Guide of Boost.

Example for Windows

The provided example plug-in "action-sender" uses the Boost ASIO library for portable networking and requires Boost 1.73 or newer. Therefore, it must be built with the additional "DBoost_ROOT" argument. The following code shows the commands for Windows systems:

cmake -B "%USERPROFILE%/communicator_plugin_builds/action-sender" -S "<MERLIC EXAMPLE DIR>/communication_plugins/action-sender" -DCMAKE_PREFIX_PATH="<MERLIC INSTALL DIR>" -DBoost_ROOT="<BOOST INSTALL DIR>" -DCMAKE_BUILD_TYPE=Release
cmake --build "%USERPROFILE%/communicator_plugin_builds/action-sender" --config Release

The placeholder for <MERLIC EXAMPLE DIR>, <MERLIC INSTALL DIR>, and <BOOST INSTALL DIR> must be replaced with the path to the respective location of the MERLIC examples, the MERLIC installation, and the Boost installation.

To get more detailed information about CMake, see the respective documentation at cmake.org/documentation.