From 3781495d29c96f9539649b300d5475dae7603dc6 Mon Sep 17 00:00:00 2001 From: Dennis Klein Date: Mon, 6 Mar 2023 14:01:53 +0100 Subject: [PATCH] build(examples): Deduplicate code into `add_example` helper --- examples/1-1/CMakeLists.txt | 46 +------ examples/1-n-1/CMakeLists.txt | 59 +-------- examples/CMakeLists.txt | 117 +++++++++++++++++- examples/builtin-devices/CMakeLists.txt | 49 ++------ .../test-ex-builtin-devices.sh.in | 9 +- examples/copypush/CMakeLists.txt | 47 +------ examples/custom-controller/CMakeLists.txt | 21 ++-- examples/multipart/CMakeLists.txt | 60 ++------- examples/multiple-channels/CMakeLists.txt | 62 ++-------- examples/multiple-transports/CMakeLists.txt | 61 ++------- examples/readout/CMakeLists.txt | 70 ++--------- examples/region/CMakeLists.txt | 63 ++-------- examples/req-rep/CMakeLists.txt | 61 ++------- 13 files changed, 211 insertions(+), 514 deletions(-) diff --git a/examples/1-1/CMakeLists.txt b/examples/1-1/CMakeLists.txt index 9e2ac2f65..9924a4f51 100644 --- a/examples/1-1/CMakeLists.txt +++ b/examples/1-1/CMakeLists.txt @@ -1,51 +1,9 @@ ################################################################################ -# Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # # This software is distributed under the terms of the # # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ -add_executable(fairmq-ex-1-1-sampler sampler.cxx) -target_link_libraries(fairmq-ex-1-1-sampler PRIVATE FairMQ) - -add_executable(fairmq-ex-1-1-sink sink.cxx) -target_link_libraries(fairmq-ex-1-1-sink PRIVATE FairMQ) - -add_custom_target(Example11 DEPENDS fairmq-ex-1-1-sampler fairmq-ex-1-1-sink) - -set(EX_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_BINARY_DIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-1-1.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-1-1.sh) - -# test - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test-ex-1-1.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test-ex-1-1.sh) - -add_test(NAME Example.1-1.zeromq COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test-ex-1-1.sh zeromq) -set_tests_properties(Example.1-1.zeromq PROPERTIES TIMEOUT "30") - -add_test(NAME Example.1-1.shmem COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test-ex-1-1.sh shmem) -set_tests_properties(Example.1-1.shmem PROPERTIES TIMEOUT "30") - -# install - -install( - TARGETS - fairmq-ex-1-1-sampler - fairmq-ex-1-1-sink - - LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR} - RUNTIME DESTINATION ${PROJECT_INSTALL_BINDIR} -) - -# configure run script with different executable paths for build and for install directories -set(EX_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-1-1.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-1-1.sh_install) - -install( - PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-1-1.sh_install - DESTINATION ${PROJECT_INSTALL_BINDIR} - RENAME fairmq-start-ex-1-1.sh -) +add_example(NAME 1-1 DEVICE sampler sink) diff --git a/examples/1-n-1/CMakeLists.txt b/examples/1-n-1/CMakeLists.txt index e1693d3bf..117dda116 100644 --- a/examples/1-n-1/CMakeLists.txt +++ b/examples/1-n-1/CMakeLists.txt @@ -1,64 +1,9 @@ ################################################################################ -# Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # # This software is distributed under the terms of the # # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ -add_executable(fairmq-ex-1-n-1-sampler sampler.cxx) -target_link_libraries(fairmq-ex-1-n-1-sampler PRIVATE FairMQ) - -add_executable(fairmq-ex-1-n-1-processor processor.cxx) -target_link_libraries(fairmq-ex-1-n-1-processor PRIVATE FairMQ) - -add_executable(fairmq-ex-1-n-1-sink sink.cxx) -target_link_libraries(fairmq-ex-1-n-1-sink PRIVATE FairMQ) - -add_custom_target(Example1N1 DEPENDS fairmq-ex-1-n-1-sampler fairmq-ex-1-n-1-processor fairmq-ex-1-n-1-sink) - -set(EX_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}) -set(EX_CONF_DIR ${CMAKE_CURRENT_BINARY_DIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_BINARY_DIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-1-n-1.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-1-n-1.sh) - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ex-1-n-1.json ${CMAKE_CURRENT_BINARY_DIR}/ex-1-n-1.json) - -# test - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test-ex-1-n-1.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test-ex-1-n-1.sh) - -add_test(NAME Example.1-n-1.zeromq COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test-ex-1-n-1.sh zeromq) -set_tests_properties(Example.1-n-1.zeromq PROPERTIES TIMEOUT "30") - -add_test(NAME Example.1-n-1.shmem COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test-ex-1-n-1.sh shmem) -set_tests_properties(Example.1-n-1.shmem PROPERTIES TIMEOUT "30") - -# install - -install( - TARGETS - fairmq-ex-1-n-1-sampler - fairmq-ex-1-n-1-processor - fairmq-ex-1-n-1-sink - - LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR} - RUNTIME DESTINATION ${PROJECT_INSTALL_BINDIR} -) - -# configure run script with different executable paths for build and for install directories -set(EX_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}) -set(EX_CONF_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_DATADIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-1-n-1.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-1-n-1.sh_install) - -install( - PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-1-n-1.sh_install - DESTINATION ${PROJECT_INSTALL_BINDIR} - RENAME fairmq-start-ex-1-n-1.sh -) - -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/ex-1-n-1.json - DESTINATION ${PROJECT_INSTALL_DATADIR} -) +add_example(NAME 1-n-1 DEVICE sampler processor sink CONFIG) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index c6a52fa43..11b7de359 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,11 +1,126 @@ ################################################################################ -# Copyright (C) 2018-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# Copyright (C) 2018-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # # This software is distributed under the terms of the # # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ +set(exe_prefix "fairmq-ex") +set(script_prefix "fairmq-start-ex") +set(test_script_prefix "test-ex") +set(testsuite "Example") +set(transports "zeromq" "shmem") + +function(add_example) + cmake_parse_arguments(PARSE_ARGV 0 ARG + "CONFIG;NO_TRANSPORT;NO_TEST" + "NAME" + "DEVICE;VARIANT;TRANSPORT;SCRIPT" + ) + + if(ARG_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unexpected unparsed arguments: ${A_UNPARSED_ARGUMENTS}") + endif() + + if(ARG_NAME) + set(name ${ARG_NAME}) + else() + message(FATAL_ERROR "NAME arg is required") + endif() + + if(ARG_DEVICES) + set(exe_targets) + foreach(device IN LISTS ARG_DEVICES) + set(exe "${exe_prefix}-${name}-${device}") + list(APPEND exe_targets ${exe}) + add_executable(${exe} "${device}.cxx") + target_link_libraries(${exe} PRIVATE FairMQ) + endforeach() + endif() + + if(ARG_TRANSPORT) + set(transports ${ARG_TRANSPORT}) + endif() + + if(ARG_SCRIPT) + set(scripts ${ARG_SCRIPT}) + else() + set(scripts ${ARG_NAME}) + endif() + + set(EX_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}) + if(ARG_CONFIG) + set(EX_CONF_DIR ${CMAKE_CURRENT_BINARY_DIR}) + endif() + set(FAIRMQ_BIN_DIR ${CMAKE_BINARY_DIR}/fairmq) + foreach(script IN LISTS scripts) + set(script_file "${script_prefix}-${script}.sh") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${script_file}.in" "${CMAKE_CURRENT_BINARY_DIR}/${script_file}") + endforeach() + + if(ARG_CONFIG) + set(config "ex-${name}.json") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${config}" "${CMAKE_CURRENT_BINARY_DIR}/${config}") + endif() + + # test + if(NOT ARG_NO_TEST) + set(test_script "${test_script_prefix}-${name}.sh") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${test_script}.in" "${CMAKE_CURRENT_BINARY_DIR}/${test_script}") + + if(ARG_NO_TRANSPORT) + set(test "${testsuite}.${name}.${transport}") + add_test(NAME ${test} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${test_script} ${transport}) + set_tests_properties(${test} PROPERTIES TIMEOUT "30") + else() + foreach(transport IN LISTS transports) + if(ARG_VARIANT) + foreach(variant IN LISTS ARG_VARIANT) + set(test "${testsuite}.${name}.${variant}.${transport}") + add_test(NAME ${test} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${test_script} ${transport} ${variant}) + set_tests_properties(${test} PROPERTIES TIMEOUT "30") + endforeach() + else() + set(test "${testsuite}.${name}.${transport}") + add_test(NAME ${test} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${test_script} ${transport}) + set_tests_properties(${test} PROPERTIES TIMEOUT "30") + endif() + endforeach() + endif() + endif() + + # install + install( + TARGETS ${exe_targets} + LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR} + RUNTIME DESTINATION ${PROJECT_INSTALL_BINDIR} + ) + + # configure run script with different executable paths for build and for install directories + set(EX_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}) + if(ARG_CONFIG) + set(EX_CONF_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_DATADIR}) + endif() + set(FAIRMQ_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}/fairmq) + foreach(script IN LISTS scripts) + set(script_file "${script_prefix}-${script}.sh") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${script_file}.in" "${CMAKE_CURRENT_BINARY_DIR}/${script_file}_install") + install( + PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${script_file}_install" + DESTINATION ${PROJECT_INSTALL_BINDIR} + RENAME ${script_file} + ) + endforeach() + + if(ARG_CONFIG) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${config} + DESTINATION ${PROJECT_INSTALL_DATADIR} + ) + endif() +endfunction() + add_subdirectory(1-1) add_subdirectory(1-n-1) add_subdirectory(builtin-devices) diff --git a/examples/builtin-devices/CMakeLists.txt b/examples/builtin-devices/CMakeLists.txt index b62c3ea2a..f1b687770 100644 --- a/examples/builtin-devices/CMakeLists.txt +++ b/examples/builtin-devices/CMakeLists.txt @@ -1,40 +1,11 @@ - ################################################################################ - # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # - # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # - # copied verbatim in the file "LICENSE" # - ################################################################################ - -set(EX_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_BINARY_DIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-builtin-devices.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-builtin-devices.sh) - -# test - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test-ex-builtin-devices.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test-ex-builtin-devices.sh) - -add_test(NAME Example.BuiltinDevices.zeromq COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test-ex-builtin-devices.sh zeromq) -set_tests_properties(Example.BuiltinDevices.zeromq PROPERTIES TIMEOUT "30") - -add_test(NAME Example.BuiltinDevices.shmem COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test-ex-builtin-devices.sh shmem) -set_tests_properties(Example.BuiltinDevices.shmem PROPERTIES TIMEOUT "30") - -add_test(NAME Example.BuiltinDevices.multipart.zeromq COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test-ex-builtin-devices.sh zeromq true 2) -set_tests_properties(Example.BuiltinDevices.multipart.zeromq PROPERTIES TIMEOUT "30") - -add_test(NAME Example.BuiltinDevices.multipart.shmem COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test-ex-builtin-devices.sh shmem true 2) -set_tests_properties(Example.BuiltinDevices.multipart.shmem PROPERTIES TIMEOUT "30") - -# install - -# configure run script with different executable paths for build and for install directories -set(EX_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-builtin-devices.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-builtin-devices.sh_install) - -install( - PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-builtin-devices.sh_install - DESTINATION ${PROJECT_INSTALL_BINDIR} - RENAME fairmq-start-ex-builtin-devices.sh +################################################################################ +# Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# # +# This software is distributed under the terms of the # +# GNU Lesser General Public Licence (LGPL) version 3, # +# copied verbatim in the file "LICENSE" # +################################################################################ + +add_example(NAME builtin-devices + VARIANT single_msg multipart ) diff --git a/examples/builtin-devices/test-ex-builtin-devices.sh.in b/examples/builtin-devices/test-ex-builtin-devices.sh.in index 6ce4c797d..a6178d941 100755 --- a/examples/builtin-devices/test-ex-builtin-devices.sh.in +++ b/examples/builtin-devices/test-ex-builtin-devices.sh.in @@ -12,12 +12,9 @@ if [[ $1 =~ ^[a-z]+$ ]]; then transport=$1 fi -if [[ $2 =~ ^[a-z]+$ ]]; then - multipart=$2 -fi - -if [[ $3 =~ ^[0-9]+$ ]]; then - numParts=$3 +if [[ $2 =~ ^multipart$ ]]; then + multipart="true" + numParts=2 fi session="$(@CMAKE_BINARY_DIR@/fairmq/fairmq-uuid-gen -h)" diff --git a/examples/copypush/CMakeLists.txt b/examples/copypush/CMakeLists.txt index d7623c2c0..7e92d422e 100644 --- a/examples/copypush/CMakeLists.txt +++ b/examples/copypush/CMakeLists.txt @@ -1,52 +1,11 @@ ################################################################################ -# Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # # This software is distributed under the terms of the # # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ - -add_executable(fairmq-ex-copypush-sampler sampler.cxx) -target_link_libraries(fairmq-ex-copypush-sampler PRIVATE FairMQ) - -add_executable(fairmq-ex-copypush-sink sink.cxx) -target_link_libraries(fairmq-ex-copypush-sink PRIVATE FairMQ) - -add_custom_target(ExampleCopyPush DEPENDS fairmq-ex-copypush-sampler fairmq-ex-copypush-sink) - -set(EX_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_BINARY_DIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-copypush.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-copypush.sh) - -# test - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test-ex-copypush.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test-ex-copypush.sh) - -add_test(NAME Example.CopyPush.zeromq COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test-ex-copypush.sh zeromq) -set_tests_properties(Example.CopyPush.zeromq PROPERTIES TIMEOUT "30") - -add_test(NAME Example.CopyPush.shmem COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test-ex-copypush.sh shmem) -set_tests_properties(Example.CopyPush.shmem PROPERTIES TIMEOUT "30") - -# install - -install( - TARGETS - fairmq-ex-copypush-sampler - fairmq-ex-copypush-sink - - LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR} - RUNTIME DESTINATION ${PROJECT_INSTALL_BINDIR} -) - -# configure run script with different executable paths for build and for install directories -set(EX_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-copypush.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-copypush.sh_install) - -install( - PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-copypush.sh_install - DESTINATION ${PROJECT_INSTALL_BINDIR} - RENAME fairmq-start-ex-copypush.sh +add_example(NAME copypush + DEVICE sampler sink ) diff --git a/examples/custom-controller/CMakeLists.txt b/examples/custom-controller/CMakeLists.txt index 94fc93b02..6d3ce681d 100644 --- a/examples/custom-controller/CMakeLists.txt +++ b/examples/custom-controller/CMakeLists.txt @@ -1,19 +1,20 @@ ################################################################################ -# Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# Copyright (C) 2022-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # # This software is distributed under the terms of the # # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ -set(target fairmq-ex-custom-controller) -add_executable(${target} main.cxx) -target_link_libraries(${target} PRIVATE FairMQ) -set_target_properties(${target} PROPERTIES - ENABLE_EXPORTS ON -) +set(name "custom-controller") +set(exe "${exe_prefix}-${name}") +add_executable(${exe} main.cxx) +target_link_libraries(${exe} PRIVATE FairMQ) +set_target_properties(${exe} PROPERTIES ENABLE_EXPORTS ON) -set(test Example.custom-controller) -add_test(NAME ${test} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${target}) +set(test "${testsuite}.${name}") +add_test(NAME ${test} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${exe}) set_tests_properties(${test} PROPERTIES TIMEOUT 30) - +if(lsan_options) + set_tests_properties(${test} PROPERTIES ENVIRONMENT_MODIFICATION ${lsan_options}) +endif() diff --git a/examples/multipart/CMakeLists.txt b/examples/multipart/CMakeLists.txt index 8ad94f5e9..2368949ca 100644 --- a/examples/multipart/CMakeLists.txt +++ b/examples/multipart/CMakeLists.txt @@ -1,51 +1,11 @@ - ################################################################################ - # Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # - # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # - # copied verbatim in the file "LICENSE" # - ################################################################################ - -add_executable(fairmq-ex-multipart-sampler sampler.cxx) -target_link_libraries(fairmq-ex-multipart-sampler PRIVATE FairMQ) - -add_executable(fairmq-ex-multipart-sink sink.cxx) -target_link_libraries(fairmq-ex-multipart-sink PRIVATE FairMQ) - -add_custom_target(ExampleMultipart DEPENDS fairmq-ex-multipart-sampler fairmq-ex-multipart-sink) - -set(EX_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_BINARY_DIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-multipart.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-multipart.sh) - -# test - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test-ex-multipart.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test-ex-multipart.sh) - -add_test(NAME Example.Multipart.zeromq COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test-ex-multipart.sh zeromq) -set_tests_properties(Example.Multipart.zeromq PROPERTIES TIMEOUT "30") - -add_test(NAME Example.Multipart.shmem COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test-ex-multipart.sh shmem) -set_tests_properties(Example.Multipart.shmem PROPERTIES TIMEOUT "30") - -# install - -install( - TARGETS - fairmq-ex-multipart-sampler - fairmq-ex-multipart-sink - - LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR} - RUNTIME DESTINATION ${PROJECT_INSTALL_BINDIR} -) - -# configure run script with different executable paths for build and for install directories -set(EX_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-multipart.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-multipart.sh_install) - -install( - PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-multipart.sh_install - DESTINATION ${PROJECT_INSTALL_BINDIR} - RENAME fairmq-start-ex-multipart.sh +################################################################################ +# Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# # +# This software is distributed under the terms of the # +# GNU Lesser General Public Licence (LGPL) version 3, # +# copied verbatim in the file "LICENSE" # +################################################################################ + +add_example(NAME multipart + DEVICE sampler sink ) diff --git a/examples/multiple-channels/CMakeLists.txt b/examples/multiple-channels/CMakeLists.txt index 9879b7111..de1d096bb 100644 --- a/examples/multiple-channels/CMakeLists.txt +++ b/examples/multiple-channels/CMakeLists.txt @@ -1,52 +1,12 @@ - ################################################################################ - # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # - # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # - # copied verbatim in the file "LICENSE" # - ################################################################################ - -add_executable(fairmq-ex-multiple-channels-sampler sampler.cxx) -target_link_libraries(fairmq-ex-multiple-channels-sampler PRIVATE FairMQ) - -add_executable(fairmq-ex-multiple-channels-broadcaster broadcaster.cxx) -target_link_libraries(fairmq-ex-multiple-channels-broadcaster PRIVATE FairMQ) - -add_executable(fairmq-ex-multiple-channels-sink sink.cxx) -target_link_libraries(fairmq-ex-multiple-channels-sink PRIVATE FairMQ) - -add_custom_target(ExampleMultipleChannels DEPENDS fairmq-ex-multiple-channels-sampler fairmq-ex-multiple-channels-broadcaster fairmq-ex-multiple-channels-sink) - -set(EX_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_BINARY_DIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-multiple-channels.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-multiple-channels.sh) - -# test - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test-ex-multiple-channels.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test-ex-multiple-channels.sh) - -add_test(NAME Example.MultipleChannels.zeromq COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test-ex-multiple-channels.sh zeromq) -set_tests_properties(Example.MultipleChannels.zeromq PROPERTIES TIMEOUT "30") - -# install - -install( - TARGETS - fairmq-ex-multiple-channels-sampler - fairmq-ex-multiple-channels-broadcaster - fairmq-ex-multiple-channels-sink - - LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR} - RUNTIME DESTINATION ${PROJECT_INSTALL_BINDIR} -) - -# configure run script with different executable paths for build and for install directories -set(EX_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-multiple-channels.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-multiple-channels.sh_install) - -install( - PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-multiple-channels.sh_install - DESTINATION ${PROJECT_INSTALL_BINDIR} - RENAME fairmq-start-ex-multiple-channels.sh +################################################################################ +# Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# # +# This software is distributed under the terms of the # +# GNU Lesser General Public Licence (LGPL) version 3, # +# copied verbatim in the file "LICENSE" # +################################################################################ + +add_example(NAME multiple-channels + DEVICE sampler broadcaster sink + TRANSPORT zeromq ) diff --git a/examples/multiple-transports/CMakeLists.txt b/examples/multiple-transports/CMakeLists.txt index 821af0e04..298bf14e6 100644 --- a/examples/multiple-transports/CMakeLists.txt +++ b/examples/multiple-transports/CMakeLists.txt @@ -1,51 +1,12 @@ - ################################################################################ - # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # - # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # - # copied verbatim in the file "LICENSE" # - ################################################################################ - -add_executable(fairmq-ex-multiple-transports-sampler1 sampler1.cxx) -target_link_libraries(fairmq-ex-multiple-transports-sampler1 PRIVATE FairMQ) - -add_executable(fairmq-ex-multiple-transports-sampler2 sampler2.cxx) -target_link_libraries(fairmq-ex-multiple-transports-sampler2 PRIVATE FairMQ) - -add_executable(fairmq-ex-multiple-transports-sink sink.cxx) -target_link_libraries(fairmq-ex-multiple-transports-sink PRIVATE FairMQ) - -add_custom_target(ExampleMultipleTransports DEPENDS fairmq-ex-multiple-transports-sampler1 fairmq-ex-multiple-transports-sampler2 fairmq-ex-multiple-transports-sink) - -set(EX_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_BINARY_DIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-multiple-transports.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-multiple-transports.sh) - -# test - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test-ex-multiple-transports.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test-ex-multiple-transports.sh) -add_test(NAME Example.MultipleTransports COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test-ex-multiple-transports.sh) -set_tests_properties(Example.MultipleTransports PROPERTIES TIMEOUT "30") - -# install - -install( - TARGETS - fairmq-ex-multiple-transports-sampler1 - fairmq-ex-multiple-transports-sampler2 - fairmq-ex-multiple-transports-sink - - LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR} - RUNTIME DESTINATION ${PROJECT_INSTALL_BINDIR} -) - -# configure run script with different executable paths for install directories -set(EX_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-multiple-transports.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-multiple-transports.sh_install) - -install( - PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-multiple-transports.sh_install - DESTINATION ${PROJECT_INSTALL_BINDIR} - RENAME fairmq-start-ex-multiple-transports.sh +################################################################################ +# Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# # +# This software is distributed under the terms of the # +# GNU Lesser General Public Licence (LGPL) version 3, # +# copied verbatim in the file "LICENSE" # +################################################################################ + +add_example(NAME multiple-transports + DEVICE sampler1 sampler2 sink + NO_TRANSPORT ) diff --git a/examples/readout/CMakeLists.txt b/examples/readout/CMakeLists.txt index 288af33a0..b6e22a999 100644 --- a/examples/readout/CMakeLists.txt +++ b/examples/readout/CMakeLists.txt @@ -1,59 +1,13 @@ - ################################################################################ - # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # - # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # - # copied verbatim in the file "LICENSE" # - ################################################################################ - -add_executable(fairmq-ex-readout-readout readout.cxx) -target_link_libraries(fairmq-ex-readout-readout PRIVATE FairMQ) - -add_executable(fairmq-ex-readout-builder builder.cxx) -target_link_libraries(fairmq-ex-readout-builder PRIVATE FairMQ) - -add_executable(fairmq-ex-readout-processor processor.cxx) -target_link_libraries(fairmq-ex-readout-processor PRIVATE FairMQ) - -add_executable(fairmq-ex-readout-sender sender.cxx) -target_link_libraries(fairmq-ex-readout-sender PRIVATE FairMQ) - -add_executable(fairmq-ex-readout-receiver receiver.cxx) -target_link_libraries(fairmq-ex-readout-receiver PRIVATE FairMQ) - -set(EX_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_BINARY_DIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-readout.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-readout.sh) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-readout-processing.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-readout-processing.sh) - -# install - -install( - TARGETS - fairmq-ex-readout-readout - fairmq-ex-readout-builder - fairmq-ex-readout-processor - fairmq-ex-readout-sender - fairmq-ex-readout-receiver - - LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR} - RUNTIME DESTINATION ${PROJECT_INSTALL_BINDIR} -) - -# configure run script with different executable paths for build and for install directories -set(EX_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-readout.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-readout.sh_install) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-readout-processing.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-readout-processing.sh_install) - -install( - PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-readout.sh_install - DESTINATION ${PROJECT_INSTALL_BINDIR} - RENAME fairmq-start-ex-readout.sh -) - -install( - PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-readout-processing.sh_install - DESTINATION ${PROJECT_INSTALL_BINDIR} - RENAME fairmq-start-ex-readout-processing.sh +################################################################################ +# Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# # +# This software is distributed under the terms of the # +# GNU Lesser General Public Licence (LGPL) version 3, # +# copied verbatim in the file "LICENSE" # +################################################################################ + +add_example(NAME readout + DEVICE readout builder processor sender receiver + SCRIPT readout readout-processing + NO_TEST ) diff --git a/examples/region/CMakeLists.txt b/examples/region/CMakeLists.txt index e175bf412..729d953d6 100644 --- a/examples/region/CMakeLists.txt +++ b/examples/region/CMakeLists.txt @@ -1,54 +1,11 @@ - ################################################################################ - # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # - # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # - # copied verbatim in the file "LICENSE" # - ################################################################################ - -add_executable(fairmq-ex-region-sampler sampler.cxx) -target_link_libraries(fairmq-ex-region-sampler PRIVATE FairMQ) - -add_executable(fairmq-ex-region-sink sink.cxx) -target_link_libraries(fairmq-ex-region-sink PRIVATE FairMQ) - -add_executable(fairmq-ex-region-keep-alive keep-alive.cxx) -target_link_libraries(fairmq-ex-region-keep-alive PRIVATE FairMQ) - -add_custom_target(ExampleRegion DEPENDS fairmq-ex-region-sampler fairmq-ex-region-sink fairmq-ex-region-keep-alive) - -set(EX_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_BINARY_DIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-region.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-region.sh) - -# test - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test-ex-region.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test-ex-region.sh) - -add_test(NAME Example.Region.zeromq COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test-ex-region.sh zeromq) -set_tests_properties(Example.Region.zeromq PROPERTIES TIMEOUT "30") - -add_test(NAME Example.Region.shmem COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test-ex-region.sh shmem) -set_tests_properties(Example.Region.shmem PROPERTIES TIMEOUT "30") - -# install - -install( - TARGETS - fairmq-ex-region-sampler - fairmq-ex-region-sink - - LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR} - RUNTIME DESTINATION ${PROJECT_INSTALL_BINDIR} -) - -# configure run script with different executable paths for build and for install directories -set(EX_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-region.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-region.sh_install) - -install( - PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-region.sh_install - DESTINATION ${PROJECT_INSTALL_BINDIR} - RENAME fairmq-start-ex-region.sh +################################################################################ +# Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# # +# This software is distributed under the terms of the # +# GNU Lesser General Public Licence (LGPL) version 3, # +# copied verbatim in the file "LICENSE" # +################################################################################ + +add_example(NAME region + DEVICE sampler sink keep-alive ) diff --git a/examples/req-rep/CMakeLists.txt b/examples/req-rep/CMakeLists.txt index 7ba051c9c..abae86db4 100644 --- a/examples/req-rep/CMakeLists.txt +++ b/examples/req-rep/CMakeLists.txt @@ -1,52 +1,11 @@ - ################################################################################ - # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # - # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # - # copied verbatim in the file "LICENSE" # - ################################################################################ - -add_executable(fairmq-ex-req-rep-client client.cxx) -target_link_libraries(fairmq-ex-req-rep-client PRIVATE FairMQ) - - -add_executable(fairmq-ex-req-rep-server server.cxx) -target_link_libraries(fairmq-ex-req-rep-server PRIVATE FairMQ) - -add_custom_target(ExampleReqRep DEPENDS fairmq-ex-req-rep-client fairmq-ex-req-rep-server) - -set(EX_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_BINARY_DIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-req-rep.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-req-rep.sh) - -# test - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test-ex-req-rep.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test-ex-req-rep.sh) - -add_test(NAME Example.ReqRep.zeromq COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test-ex-req-rep.sh zeromq) -set_tests_properties(Example.ReqRep.zeromq PROPERTIES TIMEOUT "30") - -add_test(NAME Example.ReqRep.shmem COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test-ex-req-rep.sh shmem) -set_tests_properties(Example.ReqRep.shmem PROPERTIES TIMEOUT "30") - -# install - -install( - TARGETS - fairmq-ex-req-rep-client - fairmq-ex-req-rep-server - - LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR} - RUNTIME DESTINATION ${PROJECT_INSTALL_BINDIR} -) - -# configure run script with different executable paths for build and for install directories -set(EX_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}) -set(FAIRMQ_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}/fairmq) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-req-rep.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-req-rep.sh_install) - -install( - PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-req-rep.sh_install - DESTINATION ${PROJECT_INSTALL_BINDIR} - RENAME fairmq-start-ex-req-rep.sh +################################################################################ +# Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# # +# This software is distributed under the terms of the # +# GNU Lesser General Public Licence (LGPL) version 3, # +# copied verbatim in the file "LICENSE" # +################################################################################ + +add_example(NAME req-rep + DEVICE client server )