refactor things, build mesytec-node-nng lib

This commit is contained in:
Florian Lüke 2024-11-23 03:05:05 +01:00
parent 567a999fdc
commit e25f76eebf
10 changed files with 29 additions and 19 deletions

View file

@ -1,6 +1,11 @@
cmake_minimum_required(VERSION 3.14) cmake_minimum_required(VERSION 3.15)
project(mvlc-nng-node) project(mesytec-node LANGUAGES CXX)
set(MESYTEC_NODE_MAIN_PROJECT OFF)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(MESYTEC_NODE_MAIN_PROJECT ON)
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
## Create binaries in the root of the build directory ## Create binaries in the root of the build directory

@ -1 +1 @@
Subproject commit 06b7bd33859d84ef77871c54500aeb325090ac64 Subproject commit 8e883f6747b864173d7821956ca4ef22ea2607d1

View file

@ -12,7 +12,6 @@
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
#include <optional> #include <optional>
#include "thread_name.h"
namespace mesytec::nng namespace mesytec::nng
{ {

View file

@ -20,50 +20,54 @@ set(MVLC_NNG_NODE_WARN_FLAGS -Wall -Wextra -Wpedantic)
#) #)
#target_include_directories(dp_common INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) #target_include_directories(dp_common INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
add_library(mesytec-node-nng mesytec_node_nng.cc)
target_include_directories(mesytec-node-nng PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>)
target_link_libraries(mesytec-node-nng PUBLIC mesytec-mvlc PUBLIC nng)
target_compile_features(mesytec-node-nng PUBLIC cxx_std_17)
add_executable(pair_producer pair_producer.cc) add_executable(pair_producer pair_producer.cc)
target_compile_features(pair_producer PRIVATE cxx_std_17) target_compile_features(pair_producer PRIVATE cxx_std_17)
target_link_libraries(pair_producer PRIVATE mesytec-mvlc PRIVATE nng) target_link_libraries(pair_producer PRIVATE mesytec-node-nng)
target_compile_options(pair_producer PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) target_compile_options(pair_producer PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS})
add_executable(pair_consumer pair_consumer.cc) add_executable(pair_consumer pair_consumer.cc)
target_compile_features(pair_consumer PRIVATE cxx_std_17) target_compile_features(pair_consumer PRIVATE cxx_std_17)
target_link_libraries(pair_consumer PRIVATE mesytec-mvlc PRIVATE nng) target_link_libraries(pair_consumer PRIVATE mesytec-node-nng)
target_compile_options(pair_consumer PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) target_compile_options(pair_consumer PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS})
add_executable(pair_inproc pair_inproc.cc) add_executable(pair_inproc pair_inproc.cc)
target_compile_features(pair_inproc PRIVATE cxx_std_17) target_compile_features(pair_inproc PRIVATE cxx_std_17)
target_link_libraries(pair_inproc PRIVATE mesytec-mvlc PRIVATE nng) target_link_libraries(pair_inproc PRIVATE mesytec-node-nng)
target_compile_options(pair_inproc PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) target_compile_options(pair_inproc PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS})
add_executable(mvlc_nng_replay mvlc_nng_replay.cc) add_executable(mvlc_nng_replay mvlc_nng_replay.cc)
target_compile_features(mvlc_nng_replay PRIVATE cxx_std_17) target_compile_features(mvlc_nng_replay PRIVATE cxx_std_17)
target_link_libraries(mvlc_nng_replay PRIVATE mesytec-mvlc PRIVATE nng) target_link_libraries(mvlc_nng_replay PRIVATE mesytec-node-nng)
target_compile_options(mvlc_nng_replay PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) target_compile_options(mvlc_nng_replay PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS})
add_executable(mesy_nng_pipeline_main mesy_nng_pipeline_main.cc) add_executable(mesy_nng_pipeline_main mesy_nng_pipeline_main.cc)
target_compile_features(mesy_nng_pipeline_main PRIVATE cxx_std_17) target_compile_features(mesy_nng_pipeline_main PRIVATE cxx_std_17)
target_link_libraries(mesy_nng_pipeline_main PRIVATE mesytec-mvlc PRIVATE nng) target_link_libraries(mesy_nng_pipeline_main PRIVATE mesytec-node-nng)
target_compile_options(mesy_nng_pipeline_main PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) 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) 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_compile_features(mesy_nng_push_pull_main PRIVATE cxx_std_17)
target_link_libraries(mesy_nng_push_pull_main PRIVATE mesytec-mvlc PRIVATE nng) 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}) target_compile_options(mesy_nng_push_pull_main PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS})
add_executable(mesy_nng_pub_producer pub_producer.cc) add_executable(mesy_nng_pub_producer pub_producer.cc)
target_compile_features(mesy_nng_pub_producer PRIVATE cxx_std_17) target_compile_features(mesy_nng_pub_producer PRIVATE cxx_std_17)
target_link_libraries(mesy_nng_pub_producer PRIVATE mesytec-mvlc PRIVATE nng) target_link_libraries(mesy_nng_pub_producer PRIVATE mesytec-node-nng)
target_compile_options(mesy_nng_pub_producer PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) target_compile_options(mesy_nng_pub_producer PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS})
add_executable(mesy_nng_sub_consumer sub_consumer.cc) add_executable(mesy_nng_sub_consumer sub_consumer.cc)
target_compile_features(mesy_nng_sub_consumer PRIVATE cxx_std_17) target_compile_features(mesy_nng_sub_consumer PRIVATE cxx_std_17)
target_link_libraries(mesy_nng_sub_consumer PRIVATE mesytec-mvlc PRIVATE nng) target_link_libraries(mesy_nng_sub_consumer PRIVATE mesytec-node-nng)
target_compile_options(mesy_nng_sub_consumer PRIVATE ${MVLC_NNG_NODE_WARN_FLAGS}) 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) add_executable(mnode-proto-test1 mnode_proto_test1.cc thread_name.cc)
target_link_libraries(mnode-proto-test1 PRIVATE mnode-proto PRIVATE mesytec-mvlc PRIVATE nng) target_link_libraries(mnode-proto-test1 PRIVATE mnode-proto PRIVATE mesytec-node-nng PRIVATE mesytec-mvlc)
#add_subdirectory(nng)
#add_subdirectory(qt) #add_subdirectory(qt)
#unset(CMAKE_C_CLANG_TIDY) #unset(CMAKE_C_CLANG_TIDY)

View file

@ -1,5 +1,5 @@
#include <future> #include <future>
#include "mesy_nng.h" #include <mesytec-node/mesytec_node_nng.h>
using namespace mesytec::nng; using namespace mesytec::nng;

View file

@ -1,9 +1,10 @@
#include "mesy_nng.h" #include <mesytec-node/mesytec_node_nng.h>
#include <nng/protocol/pipeline0/push.h> #include <nng/protocol/pipeline0/push.h>
#include <nng/protocol/pipeline0/pull.h> #include <nng/protocol/pipeline0/pull.h>
#include <thread> #include <thread>
#include "test_producer_consumer.h" #include "test_producer_consumer.h"
#include <mesytec-node/mesytec_node_nng.h>
using namespace mesytec::nng; using namespace mesytec::nng;

1
src/mesytec_node_nng.cc Normal file
View file

@ -0,0 +1 @@
#include "mesytec-node/mesytec_node_nng.h"

View file

@ -1,6 +1,6 @@
#include <mesytec-mvlc/mesytec-mvlc.h> #include <mesytec-mvlc/mesytec-mvlc.h>
#include "proto/service.pb.h" #include "proto/service.pb.h"
#include "mesy_nng.h" #include <mesytec-node/mesytec_node_nng.h>
using namespace mesytec; using namespace mesytec;
using namespace std::literals; using namespace std::literals;

View file

@ -3,7 +3,7 @@
#include <mesytec-mvlc/mesytec-mvlc.h> #include <mesytec-mvlc/mesytec-mvlc.h>
#include <nng/nng.h> #include <nng/nng.h>
#include <sys/prctl.h> #include <sys/prctl.h>
#include "mesy_nng.h" #include <mesytec-node/mesytec_node_nng.h>
using namespace mesytec; using namespace mesytec;
using namespace mesytec::mvlc; using namespace mesytec::mvlc;

View file

@ -1,7 +1,7 @@
#ifndef E6EFFE63_EB2C_4573_B723_61840850BBF6 #ifndef E6EFFE63_EB2C_4573_B723_61840850BBF6
#define E6EFFE63_EB2C_4573_B723_61840850BBF6 #define E6EFFE63_EB2C_4573_B723_61840850BBF6
#include "mesy_nng.h" #include <mesytec-node/mesytec_node_nng.h>
using namespace mesytec::nng; // to make the old code compile. for test code only. using namespace mesytec::nng; // to make the old code compile. for test code only.