diff --git a/.gitmodules b/.gitmodules index 89ec7f2..eac35a8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,3 +6,6 @@ path = external/nng url = https://github.com/nanomsg/nng.git branch = main +[submodule "external/spdlog"] + path = external/spdlog + url = https://github.com/gabime/spdlog diff --git a/CMakeLists.txt b/CMakeLists.txt index dc09422..453ccd2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,9 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "ON") +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + find_package(Protobuf REQUIRED) #protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS proto/service.proto) add_library(mnode-proto proto/service.proto) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 979f26e..2082f9d 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -14,3 +14,10 @@ if (NOT mesytec-mvlc) message("-- Using mesytec-mvlc from external/mesytec-mvlc") add_subdirectory(mesytec-mvlc) endif() + +find_package(spdlog QUIET) + +if (NOT TARGET spdlog) + message("-- Using spdlog from external/spdlog") + add_subdirectory(spdlog) +endif() diff --git a/external/mesytec-mvlc b/external/mesytec-mvlc index 8e883f6..030347f 160000 --- a/external/mesytec-mvlc +++ b/external/mesytec-mvlc @@ -1 +1 @@ -Subproject commit 8e883f6747b864173d7821956ca4ef22ea2607d1 +Subproject commit 030347f75b99e34c855c9e4256b0a282e3f30eb7 diff --git a/external/spdlog b/external/spdlog new file mode 160000 index 0000000..8e56133 --- /dev/null +++ b/external/spdlog @@ -0,0 +1 @@ +Subproject commit 8e5613379f5140fefb0b60412fbf1f5406e7c7f8 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cf372cc..6eb2162 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,51 +22,68 @@ set(MVLC_NNG_NODE_WARN_FLAGS -Wall -Wextra -Wpedantic) add_library(mesytec-node-nng mesytec_node_nng.cc) target_include_directories(mesytec-node-nng PUBLIC $) -target_link_libraries(mesytec-node-nng PUBLIC mesytec-mvlc PUBLIC nng) +target_link_libraries(mesytec-node-nng PUBLIC nng PUBLIC spdlog) target_compile_features(mesytec-node-nng PUBLIC cxx_std_17) -add_executable(pair_producer pair_producer.cc) -target_compile_features(pair_producer PRIVATE cxx_std_17) -target_link_libraries(pair_producer PRIVATE mesytec-node-nng) -target_compile_options(pair_producer PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) +add_library(mesytec-node-dev INTERFACE) +target_link_libraries(mesytec-node-dev INTERFACE mesytec-node-nng mesytec-mvlc) -add_executable(pair_consumer pair_consumer.cc) -target_compile_features(pair_consumer PRIVATE cxx_std_17) -target_link_libraries(pair_consumer PRIVATE mesytec-node-nng) -target_compile_options(pair_consumer PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) +function(add_node_dev_executable name) + add_executable(${name} ${name}.cc) + target_link_libraries(${name} PRIVATE mesytec-node-dev) + target_compile_options(${name} PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) +endfunction() -add_executable(pair_inproc pair_inproc.cc) -target_compile_features(pair_inproc PRIVATE cxx_std_17) -target_link_libraries(pair_inproc PRIVATE mesytec-node-nng) -target_compile_options(pair_inproc PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) -add_executable(mvlc_nng_replay mvlc_nng_replay.cc) -target_compile_features(mvlc_nng_replay PRIVATE cxx_std_17) -target_link_libraries(mvlc_nng_replay PRIVATE mesytec-node-nng) -target_compile_options(mvlc_nng_replay PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) +add_node_dev_executable(pair_producer) +add_node_dev_executable(pair_consumer) +add_node_dev_executable(pair_inproc) +add_node_dev_executable(mvlc_nng_replay) +add_node_dev_executable(mesy_nng_pipeline_main) +add_node_dev_executable(mesy_nng_push_pull_main) +add_node_dev_executable(mesy_nng_pub_producer) +add_node_dev_executable(mesy_nng_sub_consumer) +add_node_dev_executable(mnode_proto_test1) +target_sources(mnode_proto_test1 PRIVATE thread_name.cc) +target_link_libraries(mnode_proto_test1 PRIVATE mnode-proto mesytec-mvlc) -add_executable(mesy_nng_pipeline_main mesy_nng_pipeline_main.cc) -target_compile_features(mesy_nng_pipeline_main PRIVATE cxx_std_17) -target_link_libraries(mesy_nng_pipeline_main PRIVATE mesytec-node-nng) -target_compile_options(mesy_nng_pipeline_main PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) - -add_executable(mesy_nng_push_pull_main mesy_nng_push_pull_main.cc) -target_compile_features(mesy_nng_push_pull_main PRIVATE cxx_std_17) -target_link_libraries(mesy_nng_push_pull_main PRIVATE mesytec-node-nng) -target_compile_options(mesy_nng_push_pull_main PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) - -add_executable(mesy_nng_pub_producer pub_producer.cc) -target_compile_features(mesy_nng_pub_producer PRIVATE cxx_std_17) -target_link_libraries(mesy_nng_pub_producer PRIVATE mesytec-node-nng) -target_compile_options(mesy_nng_pub_producer PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) - -add_executable(mesy_nng_sub_consumer sub_consumer.cc) -target_compile_features(mesy_nng_sub_consumer PRIVATE cxx_std_17) -target_link_libraries(mesy_nng_sub_consumer PRIVATE mesytec-node-nng) -target_compile_options(mesy_nng_sub_consumer PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) - -add_executable(mnode-proto-test1 mnode_proto_test1.cc thread_name.cc) -target_link_libraries(mnode-proto-test1 PRIVATE mnode-proto PRIVATE mesytec-node-nng PRIVATE mesytec-mvlc) +#add_node_dev_executable(pair_consumer pair_consumer.cc) +#target_compile_features(pair_consumer PRIVATE cxx_std_17) +#target_link_libraries(pair_consumer PRIVATE mesytec-node-nng) +#target_compile_options(pair_consumer PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) +# +#add_node_dev_executable(pair_inproc pair_inproc.cc) +#target_compile_features(pair_inproc PRIVATE cxx_std_17) +#target_link_libraries(pair_inproc PRIVATE mesytec-node-nng) +#target_compile_options(pair_inproc PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) +# +#add_node_dev_executable(mvlc_nng_replay mvlc_nng_replay.cc) +#target_compile_features(mvlc_nng_replay PRIVATE cxx_std_17) +#target_link_libraries(mvlc_nng_replay PRIVATE mesytec-node-nng PRIVATE mesytec-mvlc) +#target_compile_options(mvlc_nng_replay PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) +# +#add_node_dev_executable(mesy_nng_pipeline_main mesy_nng_pipeline_main.cc) +#target_compile_features(mesy_nng_pipeline_main PRIVATE cxx_std_17) +#target_link_libraries(mesy_nng_pipeline_main PRIVATE mesytec-node-nng) +#target_compile_options(mesy_nng_pipeline_main PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) +# +#add_node_dev_executable(mesy_nng_push_pull_main mesy_nng_push_pull_main.cc) +#target_compile_features(mesy_nng_push_pull_main PRIVATE cxx_std_17) +#target_link_libraries(mesy_nng_push_pull_main PRIVATE mesytec-node-nng) +#target_compile_options(mesy_nng_push_pull_main PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) +# +#add_node_dev_executable(mesy_nng_pub_producer pub_producer.cc) +#target_compile_features(mesy_nng_pub_producer PRIVATE cxx_std_17) +#target_link_libraries(mesy_nng_pub_producer PRIVATE mesytec-node-nng) +#target_compile_options(mesy_nng_pub_producer PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) +# +#add_node_dev_executable(mesy_nng_sub_consumer sub_consumer.cc) +#target_compile_features(mesy_nng_sub_consumer PRIVATE cxx_std_17) +#target_link_libraries(mesy_nng_sub_consumer PRIVATE mesytec-node-nng) +#target_compile_options(mesy_nng_sub_consumer PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) +# +#add_node_dev_executable(mnode-proto-test1 mnode_proto_test1.cc thread_name.cc) +#target_link_libraries(mnode-proto-test1 PRIVATE mnode-proto PRIVATE mesytec-node-nng PRIVATE mesytec-mvlc) #add_subdirectory(qt) diff --git a/src/pub_producer.cc b/src/mesy_nng_pub_producer.cc similarity index 100% rename from src/pub_producer.cc rename to src/mesy_nng_pub_producer.cc diff --git a/src/sub_consumer.cc b/src/mesy_nng_sub_consumer.cc similarity index 100% rename from src/sub_consumer.cc rename to src/mesy_nng_sub_consumer.cc