From 9a5972c7420e616be5a597df47370884c9180d5c Mon Sep 17 00:00:00 2001 From: Paolo Bosetti Date: Thu, 27 Jun 2024 10:34:26 +0200 Subject: [PATCH] feat: Add plugin targets to CMakeLists.txt --- CMakeLists.txt | 20 ++++++++------------ src/plugin/CMakeLists.txt | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 12 deletions(-) create mode 100644 src/plugin/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index cac7650..60f9d66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,22 +119,18 @@ include_directories(${gcem_SOURCE_DIR}/include) include_directories(${stats_SOURCE_DIR}/include) include_directories(${eigen_SOURCE_DIR}) -# TARGETS ###################################################################### -add_plugin(echoj) -add_plugin(clock) -add_plugin(to_console) -add_plugin(random) -add_plugin(running_avg) -if(NOT WIN32 AND NOT MADS_NO_DEPS_ONLY) - # Serial port plugin is not supported on Windows - add_plugin(serial_reader SRCS ${SRC_DIR}/serialport.cpp) - add_plugin(mqtt LIBS mosquittopp) -endif() - add_loader(load_filter) add_loader(load_source) add_loader(load_sink) +# These plugins are always build and use for testing +add_plugin(echoj) +add_plugin(clock) + +# DO NOT ADD PLUGINS HERE; USE add_plugin() MACRO IN THE +# src/plugin/CMakeLists.txt FILE INSTEAD +include_directories(${SRC_DIR}/plugin) + # INSTALL ###################################################################### if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) diff --git a/src/plugin/CMakeLists.txt b/src/plugin/CMakeLists.txt new file mode 100644 index 0000000..cbcf8fb --- /dev/null +++ b/src/plugin/CMakeLists.txt @@ -0,0 +1,35 @@ +# ____ _ _ _ _ +# | _ \| |_ _ __ _(_)_ __ | |_ __ _ _ __ __ _ ___| |_ ___ +# | |_) | | | | |/ _` | | '_ \ | __/ _` | '__/ _` |/ _ \ __/ __| +# | __/| | |_| | (_| | | | | | | || (_| | | | (_| | __/ |_\__ \ +# |_| |_|\__,_|\__, |_|_| |_| \__\__,_|_| \__, |\___|\__|___/ +# |___/ |___/ + +# Add plugin targets here +# Use the syntax: +# add_plugin( [SRCS ] [LIBS ]) +# If the plugin has only one source file, that is the plugin_name.cpp file, +# you can omit the SRCS argument: +# add_plugin(plugin_name) +# Use the SRCS argument to specify additional source files. +# Use the LIBS argument to specify additional libraries that the plugin +# depends on. + +# PLUGINS ###################################################################### +# These plugins are built unconditionally. + +add_plugin(to_console) +add_plugin(random) +add_plugin(running_avg) + + +# CONDITIONAL PLUGINS ########################################################## +# These plugins are only built if the required dependencies are available. + +if(NOT MADS_NO_DEPS_ONLY) + if(NOT WIN32) + # Serial port plugin is not supported on Windows + add_plugin(serial_reader SRCS ${SRC_DIR}/serialport.cpp) + endif() + add_plugin(mqtt LIBS mosquittopp) +endif() \ No newline at end of file