With apologies for the CMake abuse, this adds support for statically linking the Cyclone
core library and the security and Iceoryx plugins. It does not support statically linking
IDLC because that would at best only support the C binding, but not other language
bindings. The recommendation for a static linked Cyclone is to build it as if it were a
cross build to the native platform, that way the IDLC complications are avoided.
Almost all the changes are in the build system, only the "dlopen" functions in ddsrt are
modified to consult a table of compiled-in plugins first and some security tests need a
small change in the specification of the security plugin wrapper libraries.
The build system defines a global CMake property "plugin_list" containing a list of all
the plugins to include, each plugin P defines a global "P_symbols" property that lists all
the symbols to be exported from the library. The modified "dlopen" functionality consults
the table of plugins, the modified "dlsym" functionality consults the list of exported
symbols.
These properties are translated to macros on compiler command-line into comma-separated
lists of plugin names (PLUGINS) and symbol names (PLUG_SUMBOLS_P for plugin P). The
macros are then expanded into static tables of names and addresses by the C preprocessor.
For a static build, the plugins are defined as OBJECT libraries, "installed" because
that's the only way I have found so far to keep CMake happy with the references, and
pulled into the Cyclone library using the aforementioned properties. For example:
if(BUILD_SHARED_LIBS)
add_library(dds_security_ac SHARED ${sources} ${private_headers})
else()
add_library(dds_security_ac OBJECT ${sources} ${private_headers})
set_property(GLOBAL APPEND PROPERTY cdds_plugin_list dds_security_ac)
set_property(GLOBAL PROPERTY dds_security_ac_symbols init_access_control finalize_access_control)
endif()
The other changes are then to only link the plugin against "ddsc" if building as a shared
library and, sometimes, adding a bunch of include paths because it won't work otherwise.
In a static build, the tests for PSMX that rely on the Cyclone-based plugin are disabled
because of the complications that introduces. Those tests do run if Iceoryx is available.
Signed-off-by: Erik Boasson <eb@ilities.com>