From 6d98676efb08616128853bbd76afd01ae6787714 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Tue, 18 Nov 2025 23:23:53 +0100 Subject: [PATCH 01/49] Cleanup and update shared library remove dependency on mocks and signal generator add missing link to gtest lib fix variable names in cmake remove useless tests --- .../websocket_streaming/CMakeLists.txt | 4 +- .../websocket_streaming/src/CMakeLists.txt | 4 +- .../websocket_streaming/tests/CMakeLists.txt | 15 +- .../tests/streaming_test_helpers.h | 21 +-- .../tests/test_signal_generator.cpp | 174 ------------------ .../tests/test_websocket_client_device.cpp | 27 --- 6 files changed, 11 insertions(+), 234 deletions(-) delete mode 100644 shared/libraries/websocket_streaming/tests/test_signal_generator.cpp diff --git a/shared/libraries/websocket_streaming/CMakeLists.txt b/shared/libraries/websocket_streaming/CMakeLists.txt index a89b800..e2d9cbf 100644 --- a/shared/libraries/websocket_streaming/CMakeLists.txt +++ b/shared/libraries/websocket_streaming/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10) -set_cmake_folder_context(TARGET_FOLDER_NAME ${SDK_TARGET_NAMESPACE}_websocket_streaming) +set_cmake_folder_context(TARGET_FOLDER_NAME ${OPENDAQ_SDK_TARGET_NAMESPACE}_websocket_streaming) project(OpenDaqStreaming VERSION 4.0.0 LANGUAGES CXX @@ -7,6 +7,6 @@ project(OpenDaqStreaming add_subdirectory(src) -if (OPENDAQ_ENABLE_TESTS) +if (${REPO_OPTION_PREFIX}_ENABLE_TESTS) add_subdirectory(tests) endif() diff --git a/shared/libraries/websocket_streaming/src/CMakeLists.txt b/shared/libraries/websocket_streaming/src/CMakeLists.txt index 495ed9a..679f0c4 100644 --- a/shared/libraries/websocket_streaming/src/CMakeLists.txt +++ b/shared/libraries/websocket_streaming/src/CMakeLists.txt @@ -1,5 +1,5 @@ set(BASE_NAME websocket_streaming) -set(LIB_NAME ${SDK_TARGET_NAME}_${BASE_NAME}) +set(LIB_NAME ${OPENDAQ_SDK_TARGET_NAME}_${BASE_NAME}) set(SRC_Cpp signal_descriptor_converter.cpp streaming_client.cpp @@ -44,7 +44,7 @@ add_library(${LIB_NAME} STATIC ${SRC_Cpp} ${SRC_PrivateHeaders} ) -add_library(${SDK_TARGET_NAMESPACE}::${BASE_NAME} ALIAS ${LIB_NAME}) +add_library(${OPENDAQ_SDK_TARGET_NAMESPACE}::${BASE_NAME} ALIAS ${LIB_NAME}) if(BUILD_64Bit OR BUILD_ARM) set_target_properties(${LIB_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON) diff --git a/shared/libraries/websocket_streaming/tests/CMakeLists.txt b/shared/libraries/websocket_streaming/tests/CMakeLists.txt index 3f63dc5..e329aea 100644 --- a/shared/libraries/websocket_streaming/tests/CMakeLists.txt +++ b/shared/libraries/websocket_streaming/tests/CMakeLists.txt @@ -6,7 +6,6 @@ add_executable(${TEST_APP} test_signal_descriptor_converter.cpp test_streaming.cpp test_websocket_client_device.cpp - test_signal_generator.cpp test_app.cpp ) @@ -15,11 +14,11 @@ if (MSVC) endif() target_link_libraries(${TEST_APP} PRIVATE - ${SDK_TARGET_NAMESPACE}::${MODULE_NAME} - daq::opendaq - daq::opendaq_mocks - daq::streaming_protocol - ${SDK_TARGET_NAMESPACE}::test_utils + ${OPENDAQ_SDK_TARGET_NAMESPACE}::${MODULE_NAME} + ${OPENDAQ_SDK_TARGET_NAMESPACE}::opendaq + ${OPENDAQ_SDK_TARGET_NAMESPACE}::streaming_protocol + ${OPENDAQ_SDK_TARGET_NAMESPACE}::test_utils + gtest ) set_target_properties(${TEST_APP} PROPERTIES DEBUG_POSTFIX _debug) @@ -29,7 +28,3 @@ add_test(NAME ${TEST_APP} COMMAND $ WORKING_DIRECTORY $ ) - -if(OPENDAQ_ENABLE_COVERAGE) - setup_target_for_coverage(${MODULE_NAME}coverage ${TEST_APP} ${MODULE_NAME}coverage) -endif() diff --git a/shared/libraries/websocket_streaming/tests/streaming_test_helpers.h b/shared/libraries/websocket_streaming/tests/streaming_test_helpers.h index 484e3a4..c8b1e11 100644 --- a/shared/libraries/websocket_streaming/tests/streaming_test_helpers.h +++ b/shared/libraries/websocket_streaming/tests/streaming_test_helpers.h @@ -17,9 +17,6 @@ #pragma once #include -#include -#include -#include #include #include #include @@ -28,7 +25,7 @@ #include #include #include -#include +#include #include "streaming_protocol/Unit.hpp" // MAC CI issue @@ -44,21 +41,7 @@ namespace streaming_test_helpers { inline daq::InstancePtr createServerInstance() { - const auto moduleManager = daq::ModuleManager("[[none]]"); - const auto authenticationProvider = daq::AuthenticationProvider(); - auto context = Context(nullptr, daq::Logger(), daq::TypeManager(), moduleManager, authenticationProvider); - const daq::ModulePtr deviceModule(MockDeviceModule_Create(context)); - moduleManager.addModule(deviceModule); - - const daq::ModulePtr fbModule(MockFunctionBlockModule_Create(context)); - moduleManager.addModule(fbModule); - - auto instance = InstanceCustom(context, "localInstance"); - instance.addDevice("daqmock://client_device"); - instance.addDevice("daqmock://phys_device"); - instance.addFunctionBlock("mock_fb_uid"); - - return instance; + return daq::Instance(); } inline daq::SignalPtr createLinearTimeSignal(const daq::ContextPtr& ctx) diff --git a/shared/libraries/websocket_streaming/tests/test_signal_generator.cpp b/shared/libraries/websocket_streaming/tests/test_signal_generator.cpp deleted file mode 100644 index c0f6194..0000000 --- a/shared/libraries/websocket_streaming/tests/test_signal_generator.cpp +++ /dev/null @@ -1,174 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -using namespace daq; - -class SignalGeneratorTest : public testing::Test -{ -public: - ContextPtr context; - SignalConfigPtr signal; - SignalGenerator::GenerateSampleFunc stepFunction10; - SignalGenerator::GenerateSampleFunc stepFunction100; - - void SetUp() override - { - context = NullContext(); - signal = createSignal(); - initFunctions(); - } - - void initFunctions() - { - stepFunction10 = [](uint64_t tick, void* sampleOut) - { - int* intOut = (int*) sampleOut; - *intOut = tick % 10; - }; - - stepFunction100 = [](uint64_t tick, void* sampleOut) - { - int* intOut = (int*) sampleOut; - *intOut = tick % 100; - }; - } - - std::vector calculateExpectedSamples(uint64_t startTick, size_t sampleCount, const SignalGenerator::GenerateSampleFunc& function) - { - auto samples = std::vector(sampleCount); - - for (size_t i = 0; i < sampleCount; i++) - function(startTick + i, samples.data() + i); - - return samples; - } - - bool compareSamples(int* expected, void* packetData, size_t sampleCount) - { - return std::memcmp(expected, packetData, sampleCount * sizeof(int)) == 0; - } - -private: - SignalConfigPtr createTimeSignal() - { - const size_t nanosecondsInSecond = 1000000000; - auto delta = nanosecondsInSecond / 1000; - - auto descriptor = DataDescriptorBuilder() - .setSampleType(SampleType::UInt64) - .setRule(LinearDataRule(delta, 0)) - .setTickResolution(Ratio(1, nanosecondsInSecond)) - .setOrigin("1970-01-01T00:00:00") - .setName("Time") - .build(); - - return SignalWithDescriptor(context, descriptor, nullptr, "Time"); - } - - SignalConfigPtr createSignal() - { - auto descriptor = DataDescriptorBuilder().setSampleType(SampleType::Int32).setName("Step").build(); - - auto domainSignal = createTimeSignal(); - auto signal = SignalWithDescriptor(context, descriptor, nullptr, "ByteStep"); - signal.setDomainSignal(domainSignal); - return signal; - } -}; - - -TEST_F(SignalGeneratorTest, CreateSignal) -{ - auto reader = PacketReader(signal); - auto packets = reader.readAll(); - ASSERT_EQ(packets.getCount(), 1u); - ASSERT_EQ(packets[0].getType(), PacketType::Event); - - EventPacketPtr eventPacket = packets[0]; - ASSERT_EQ(eventPacket.getEventId(), event_packet_id::DATA_DESCRIPTOR_CHANGED); -} - -TEST_F(SignalGeneratorTest, StepSignal) -{ - const size_t packetSize = 100; - - auto expectedSamples1 = calculateExpectedSamples(0, packetSize, stepFunction10); - auto expectedSamples2 = calculateExpectedSamples(packetSize, packetSize, stepFunction10); - - auto reader = PacketReader(signal); - - auto generator = SignalGenerator(signal, std::chrono::system_clock::now()); - generator.setFunction(stepFunction10); - generator.generateSamplesTo(std::chrono::milliseconds(packetSize)); - generator.generateSamplesTo(std::chrono::milliseconds(packetSize * 2)); - - auto packets = reader.readAll(); - ASSERT_EQ(packets.getCount(), 3u); - - auto packet1 = packets[1].asPtr(); - ASSERT_EQ(packet1.getSampleCount(), packetSize); - ASSERT_TRUE(compareSamples(expectedSamples1.data(), packet1.getData(), packetSize)); - - auto packet2 = packets[2].asPtr(); - ASSERT_EQ(packet2.getSampleCount(), packetSize); - ASSERT_TRUE(compareSamples(expectedSamples2.data(), packet2.getData(), packetSize)); -} - -TEST_F(SignalGeneratorTest, ChangeFunction) -{ - const size_t packetSize = 100; - - auto expectedSamples1 = calculateExpectedSamples(0, packetSize, stepFunction10); - auto expectedSamples2 = calculateExpectedSamples(packetSize, packetSize, stepFunction100); - - auto reader = PacketReader(signal); - - auto updateFunction = [this](SignalGenerator& generator, uint64_t packetOffset) - { - if (packetOffset > 0) - generator.setFunction(stepFunction100); - }; - - auto generator = SignalGenerator(signal, std::chrono::system_clock::now()); - generator.setFunction(stepFunction10); - generator.setUpdateFunction(updateFunction); - generator.generateSamplesTo(std::chrono::milliseconds(packetSize)); - generator.generateSamplesTo(std::chrono::milliseconds(packetSize * 2)); - - auto packets = reader.readAll(); - ASSERT_EQ(packets.getCount(), 3u); - - auto packet1 = packets[1].asPtr(); - ASSERT_EQ(packet1.getSampleCount(), packetSize); - ASSERT_TRUE(compareSamples(expectedSamples1.data(), packet1.getData(), packetSize)); - - auto packet2 = packets[2].asPtr(); - ASSERT_EQ(packet2.getSampleCount(), packetSize); - ASSERT_TRUE(compareSamples(expectedSamples2.data(), packet2.getData(), packetSize)); -} - -TEST_F(SignalGeneratorTest, SignalGeneratorCountCheck) -{ - const size_t packetSize= 100; - auto expectedSamples1 = calculateExpectedSamples(0, packetSize, stepFunction10); - - auto reader = PacketReader(signal); - - auto generator = SignalGenerator(signal, std::chrono::system_clock::now()); - generator.setFunction(stepFunction10); - generator.generateSamplesTo(std::chrono::milliseconds(packetSize)); - generator.generateSamplesTo(std::chrono::milliseconds(packetSize * 2)); - generator.generateSamplesTo(std::chrono::milliseconds(packetSize * 3)); - - auto packets = reader.readAll(); - ASSERT_EQ(packets.getCount(), 4u); - auto packet1 = packets[1].asPtr(); - ASSERT_EQ(packet1.getSampleCount(), packetSize); - auto packet2 = packets[2].asPtr(); - ASSERT_EQ(packet2.getSampleCount(), packetSize); -} diff --git a/shared/libraries/websocket_streaming/tests/test_websocket_client_device.cpp b/shared/libraries/websocket_streaming/tests/test_websocket_client_device.cpp index 6d00ead..07e769b 100644 --- a/shared/libraries/websocket_streaming/tests/test_websocket_client_device.cpp +++ b/shared/libraries/websocket_streaming/tests/test_websocket_client_device.cpp @@ -732,30 +732,3 @@ TEST_P(UnsupportedSignalsTestP, MakeDomainSignalSupported) INSTANTIATE_TEST_SUITE_P(UnsupportedSignalsTest, UnsupportedSignalsTestP, testing::Values(nullptr, DataDescriptorBuilder().setSampleType(daq::SampleType::Invalid).build())); - -TEST_F(WebsocketClientDeviceTest, DeviceWithMultipleSignals) -{ - // Create server side device - auto serverInstance = streaming_test_helpers::createServerInstance(); - - // Setup and start streaming server - auto server = WebsocketStreamingServer(serverInstance); - server.setStreamingPort(STREAMING_PORT); - server.setControlPort(CONTROL_PORT); - server.start(); - - // Create the client device - auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST); - - // There should not be any difference if we get signals recursively or not, - // since client device doesn't know anything about hierarchy - size_t expectedSignalCount = 0; - for (const auto& signal : serverInstance.getSignals(search::Recursive(search::Visible()))) - expectedSignalCount += signal.getPublic(); - - ListPtr signals; - ASSERT_NO_THROW(signals = clientDevice.getSignals()); - ASSERT_EQ(signals.getCount(), expectedSignalCount); - ASSERT_NO_THROW(signals = clientDevice.getSignals(search::Recursive(search::Visible()))); - ASSERT_EQ(signals.getCount(), expectedSignalCount); -} From 13e2de596753f747822abe48baea2300f9836655 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Tue, 18 Nov 2025 23:28:05 +0100 Subject: [PATCH 02/49] Cleanup and update modules fix cmake vars names remove redundant dependencies on mocks and taskflow from tests add missing link to gtest --- .../CMakeLists.txt | 4 +-- .../src/CMakeLists.txt | 8 ++--- .../tests/CMakeLists.txt | 8 ++--- ...test_websocket_streaming_client_module.cpp | 1 - .../CMakeLists.txt | 4 +-- .../src/CMakeLists.txt | 9 +++-- .../tests/CMakeLists.txt | 14 ++------ ...test_websocket_streaming_server_module.cpp | 34 ++----------------- 8 files changed, 21 insertions(+), 61 deletions(-) diff --git a/modules/websocket_streaming_client_module/CMakeLists.txt b/modules/websocket_streaming_client_module/CMakeLists.txt index be07a8f..47c6d19 100644 --- a/modules/websocket_streaming_client_module/CMakeLists.txt +++ b/modules/websocket_streaming_client_module/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.10) set_cmake_folder_context(TARGET_FOLDER_NAME) -project(WebsocketStreamingClientModule VERSION ${OPENDAQ_PACKAGE_VERSION} LANGUAGES C CXX) +project(WebsocketStreamingClientModule VERSION ${REPO_VERSION} LANGUAGES C CXX) if (MSVC) # loss of data / precision, unsigned <--> signed @@ -16,6 +16,6 @@ endif() add_subdirectory(src) -if (OPENDAQ_ENABLE_TESTS) +if (${REPO_OPTION_PREFIX}_ENABLE_TESTS) add_subdirectory(tests) endif() diff --git a/modules/websocket_streaming_client_module/src/CMakeLists.txt b/modules/websocket_streaming_client_module/src/CMakeLists.txt index f6f495c..e87e78d 100644 --- a/modules/websocket_streaming_client_module/src/CMakeLists.txt +++ b/modules/websocket_streaming_client_module/src/CMakeLists.txt @@ -27,15 +27,15 @@ source_group("module" FILES ${MODULE_HEADERS_DIR}/websocket_streaming_client_mod add_library(${LIB_NAME} SHARED ${SRC_Include} ${SRC_Srcs} ) -add_library(${SDK_TARGET_NAMESPACE}::${LIB_NAME} ALIAS ${LIB_NAME}) +add_library(${OPENDAQ_SDK_TARGET_NAMESPACE}::${LIB_NAME} ALIAS ${LIB_NAME}) if (MSVC) target_compile_options(${LIB_NAME} PRIVATE /bigobj) endif() -target_link_libraries(${LIB_NAME} PUBLIC daq::opendaq - PRIVATE daq::discovery - daq::websocket_streaming +target_link_libraries(${LIB_NAME} PUBLIC ${OPENDAQ_SDK_TARGET_NAMESPACE}::opendaq + PRIVATE ${OPENDAQ_SDK_TARGET_NAMESPACE}::discovery + ${OPENDAQ_SDK_TARGET_NAMESPACE}::websocket_streaming ) target_include_directories(${LIB_NAME} PUBLIC $ diff --git a/modules/websocket_streaming_client_module/tests/CMakeLists.txt b/modules/websocket_streaming_client_module/tests/CMakeLists.txt index a251317..626f201 100644 --- a/modules/websocket_streaming_client_module/tests/CMakeLists.txt +++ b/modules/websocket_streaming_client_module/tests/CMakeLists.txt @@ -8,15 +8,11 @@ set(TEST_SOURCES test_websocket_streaming_client_module.cpp add_executable(${TEST_APP} ${TEST_SOURCES} ) -target_link_libraries(${TEST_APP} PRIVATE daq::test_utils - ${SDK_TARGET_NAMESPACE}::${MODULE_NAME} +target_link_libraries(${TEST_APP} PRIVATE ${OPENDAQ_SDK_TARGET_NAMESPACE}::test_utils gtest + ${OPENDAQ_SDK_TARGET_NAMESPACE}::${MODULE_NAME} ) add_test(NAME ${TEST_APP} COMMAND $ WORKING_DIRECTORY $ ) - -if (OPENDAQ_ENABLE_COVERAGE) - setup_target_for_coverage(${TEST_APP}coverage ${TEST_APP} ${TEST_APP}coverage) -endif() diff --git a/modules/websocket_streaming_client_module/tests/test_websocket_streaming_client_module.cpp b/modules/websocket_streaming_client_module/tests/test_websocket_streaming_client_module.cpp index 36782c2..73b1c0a 100644 --- a/modules/websocket_streaming_client_module/tests/test_websocket_streaming_client_module.cpp +++ b/modules/websocket_streaming_client_module/tests/test_websocket_streaming_client_module.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include diff --git a/modules/websocket_streaming_server_module/CMakeLists.txt b/modules/websocket_streaming_server_module/CMakeLists.txt index 0b5b926..68e1562 100644 --- a/modules/websocket_streaming_server_module/CMakeLists.txt +++ b/modules/websocket_streaming_server_module/CMakeLists.txt @@ -1,9 +1,9 @@ cmake_minimum_required(VERSION 3.10) set_cmake_folder_context(TARGET_FOLDER_NAME) -project(WebsocketStreamingServerModule VERSION ${OPENDAQ_PACKAGE_VERSION} LANGUAGES CXX) +project(WebsocketStreamingServerModule VERSION ${REPO_VERSION} LANGUAGES CXX) add_subdirectory(src) -if (OPENDAQ_ENABLE_TESTS) +if (${REPO_OPTION_PREFIX}_ENABLE_TESTS) add_subdirectory(tests) endif() diff --git a/modules/websocket_streaming_server_module/src/CMakeLists.txt b/modules/websocket_streaming_server_module/src/CMakeLists.txt index 2f25750..be313fd 100644 --- a/modules/websocket_streaming_server_module/src/CMakeLists.txt +++ b/modules/websocket_streaming_server_module/src/CMakeLists.txt @@ -32,12 +32,17 @@ add_library(${LIB_NAME} SHARED ${SRC_Include} ${SRC_Srcs} ) -add_library(${SDK_TARGET_NAMESPACE}::${LIB_NAME} ALIAS ${LIB_NAME}) +add_library(${OPENDAQ_SDK_TARGET_NAMESPACE}::${LIB_NAME} ALIAS ${LIB_NAME}) + +#target_link_libraries(${LIB_NAME} PUBLIC ${OPENDAQ_SDK_TARGET_NAMESPACE}::opendaq +# PRIVATE ${OPENDAQ_SDK_TARGET_NAMESPACE}::websocket_streaming +#) target_link_libraries(${LIB_NAME} PUBLIC daq::opendaq - PRIVATE daq::websocket_streaming + PRIVATE ${OPENDAQ_SDK_TARGET_NAMESPACE}::websocket_streaming ) + target_include_directories(${LIB_NAME} PUBLIC $ $ $ diff --git a/modules/websocket_streaming_server_module/tests/CMakeLists.txt b/modules/websocket_streaming_server_module/tests/CMakeLists.txt index 02df280..f2c41de 100644 --- a/modules/websocket_streaming_server_module/tests/CMakeLists.txt +++ b/modules/websocket_streaming_server_module/tests/CMakeLists.txt @@ -8,21 +8,11 @@ set(TEST_SOURCES test_websocket_streaming_server_module.cpp add_executable(${TEST_APP} ${TEST_SOURCES} ) -target_link_libraries(${TEST_APP} PRIVATE daq::test_utils - daq::opendaq_mocks - ${SDK_TARGET_NAMESPACE}::${MODULE_NAME} - Taskflow::Taskflow +target_link_libraries(${TEST_APP} PRIVATE ${OPENDAQ_SDK_TARGET_NAMESPACE}::test_utils gtest + ${OPENDAQ_SDK_TARGET_NAMESPACE}::${MODULE_NAME} ) add_test(NAME ${TEST_APP} COMMAND $ WORKING_DIRECTORY $ ) - -if (MSVC) # Ignoring warning for the Taskflow - target_compile_options(${TEST_APP} PRIVATE /wd4324) -endif() - -if (OPENDAQ_ENABLE_COVERAGE) - setup_target_for_coverage(${TEST_APP}coverage ${TEST_APP} ${TEST_APP}coverage) -endif() diff --git a/modules/websocket_streaming_server_module/tests/test_websocket_streaming_server_module.cpp b/modules/websocket_streaming_server_module/tests/test_websocket_streaming_server_module.cpp index 65307c0..5434b18 100644 --- a/modules/websocket_streaming_server_module/tests/test_websocket_streaming_server_module.cpp +++ b/modules/websocket_streaming_server_module/tests/test_websocket_streaming_server_module.cpp @@ -6,11 +6,7 @@ #include #include #include -#include #include -#include -#include -#include class WebsocketStreamingServerModuleTest : public testing::Test { @@ -29,32 +25,6 @@ static ModulePtr CreateModule(ContextPtr context = NullContext()) return module; } -static InstancePtr CreateTestInstance() -{ - const auto logger = Logger(); - const auto moduleManager = ModuleManager("[[none]]"); - const auto authenticationProvider = AuthenticationProvider(); - const auto context = Context(Scheduler(logger), logger, TypeManager(), moduleManager, authenticationProvider); - - const ModulePtr deviceModule(MockDeviceModule_Create(context)); - moduleManager.addModule(deviceModule); - - const ModulePtr fbModule(MockFunctionBlockModule_Create(context)); - moduleManager.addModule(fbModule); - - const ModulePtr daqWebsocketStreamingServerModule = CreateModule(context); - moduleManager.addModule(daqWebsocketStreamingServerModule); - - auto instance = InstanceCustom(context, "localInstance"); - for (const auto& deviceInfo : instance.getAvailableDevices()) - instance.addDevice(deviceInfo.getConnectionString()); - - for (const auto& [id, _] : instance.getAvailableFunctionBlockTypes()) - instance.addFunctionBlock(id); - - return instance; -} - static PropertyObjectPtr CreateServerConfig(const InstancePtr& instance) { auto config = instance.getAvailableServerTypes().get("OpenDAQLTStreaming").createDefaultConfig(); @@ -132,7 +102,7 @@ TEST_F(WebsocketStreamingServerModuleTest, ServerConfig) TEST_F(WebsocketStreamingServerModuleTest, CreateServer) { - auto device = CreateTestInstance(); + auto device = Instance(); auto module = CreateModule(device.getContext()); auto config = CreateServerConfig(device); @@ -141,7 +111,7 @@ TEST_F(WebsocketStreamingServerModuleTest, CreateServer) TEST_F(WebsocketStreamingServerModuleTest, CreateServerFromInstance) { - auto device = CreateTestInstance(); + auto device = Instance(); auto config = CreateServerConfig(device); ASSERT_NO_THROW(device.addServer("OpenDAQLTStreaming", config)); From fecc43f6afc1a738c316fe09de069922ca8fb334 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Tue, 18 Nov 2025 23:31:37 +0100 Subject: [PATCH 03/49] Align license file with SDK repo --- LICENSE | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/LICENSE b/LICENSE index 261eeb9..1c17a0a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ - Apache License + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -174,28 +174,3 @@ of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. From a5efe3cd76dc69483b1c2b8fab253b9f56063e77 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Tue, 18 Nov 2025 23:34:11 +0100 Subject: [PATCH 04/49] Add missing repository files --- .clang-format | 62 +++++++ .editorconfig | 15 ++ .gitattributes | 3 + .gitignore | 46 ++++++ CMakeLists.txt | 77 +++++++++ CMakePresets.json | 222 ++++++++++++++++++++++++++ cmake/CommonUtils.cmake | 159 ++++++++++++++++++ external/CMakeLists.txt | 41 +++++ external/gtest/CMakeLists.txt | 30 ++++ external/nlohmann_json/CMakeLists.txt | 9 ++ modules/CMakeLists.txt | 12 ++ opendaq_version | 1 + repo_version | 1 + shared/CMakeLists.txt | 17 ++ shared/libraries/CMakeLists.txt | 3 + 15 files changed, 698 insertions(+) create mode 100644 .clang-format create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 CMakePresets.json create mode 100644 cmake/CommonUtils.cmake create mode 100644 external/CMakeLists.txt create mode 100644 external/gtest/CMakeLists.txt create mode 100644 external/nlohmann_json/CMakeLists.txt create mode 100644 modules/CMakeLists.txt create mode 100644 opendaq_version create mode 100644 repo_version create mode 100644 shared/CMakeLists.txt create mode 100644 shared/libraries/CMakeLists.txt diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..4ddfb11 --- /dev/null +++ b/.clang-format @@ -0,0 +1,62 @@ +--- +BasedOnStyle: Chromium +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +#AllowAllArgumentsOnNextLine: 'false' +#AlignConsecutiveAssignments: None +#AlignConsecutiveDeclarations: None +AlignEscapedNewlines: Left +AlignOperands: true +AllowAllParametersOfDeclarationOnNextLine: true +#AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +#AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: false +BinPackParameters: false +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Allman +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: true +ColumnLimit: 140 +CommentPragmas: '^ IWYU pragma:' +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +IndentCaseLabels: true +IndentWidth: 4 +KeepEmptyLinesAtTheStartOfBlocks: false +Language: Cpp +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: All +ObjCBlockIndentWidth: 4 +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left +#SortIncludes: Never +SpaceAfterCStyleCast: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpacesBeforeTrailingComments: 2 +Standard: Auto +TabWidth: 4 +UseTab: Never +#NamespaceMacros: +# - DECLARE_TEMPLATED_OPENDAQ_INTERFACE_T +# - DECLARE_TEMPLATED_OPENDAQ_INTERFACE_T_U +# - DECLARE_OPENDAQ_INTERFACE_EX +# - DECLARE_OPENDAQ_INTERFACE +FixNamespaceComments: false +#MacroBlockBegin: "^BEGIN_NAMESPACE_OPENDAQ$" +#MacroBlockEnd: "^END_NAMESPACE_OPENDAQ" +#IndentPPDirectives: BeforeHash +#SeparateDefinitionBlocks: Always +... diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..72081c9 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +root = true + +[{*.{cpp,h},CMakeLists.txt,*.rtclass,*.cmake,*.json}] +indent_style = space +indent_size = 4 +tab_size = 4 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.yml] +ident_style = space +ident_size = 2 +tab_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8884b5b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +* text=auto +*.[tT][xX][tT] text +*.[sS][hH] text eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..295355a --- /dev/null +++ b/.gitignore @@ -0,0 +1,46 @@ +# file types +*.bin +*.bak +*.cache +*.check_cache +*.db +*.dcu +*.depend +*.exp +*.filters +*.idb +*.ilk +*.list +*.log +*.obj +*.orig +*.pdb +*.pyc +*.rule +*.rsm +*.stamp +*.stat +*.suo +*.tlog +*.user + +# IDE files +.idea/ +.idea_/ +.vs/ +.vscode/ +__history/ +__recovery/ +__pycache__/ + +# build and backup folders +/_build* +/build* +/build_win +/cmake-build* +/out* +bckp + +# cmake +CMakeUserPresets.json +CMakeSettings.json \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..7d6dc0b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,77 @@ +set(CMAKE_POLICY_VERSION_MINIMUM 3.5) +cmake_minimum_required(VERSION 3.25) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +# set project variables +set(REPO_NAME lt_streaming_modules) +set(REPO_OPTION_PREFIX LT_STREAMING_MODULES) + +file(READ "repo_version" repo_version) +string(STRIP ${repo_version} repo_version) +string(REGEX REPLACE "^([0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1" repo_version_major_minor_patch "${repo_version}") +set(REPO_VERSION "${repo_version_major_minor_patch}") + +project(${REPO_NAME} + LANGUAGES CXX + VERSION ${REPO_VERSION} +) + +# set SDK variables +set(OPENDAQ_SDK_NAME openDAQ) +set(OPENDAQ_SDK_TARGET_NAME opendaq) +set(OPENDAQ_SDK_TARGET_NAMESPACE daq) + +file(READ "opendaq_version" sdk_version) +string(STRIP ${sdk_version} sdk_version) +string(REGEX REPLACE "^([0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1" sdk_version_major_minor_patch "${sdk_version}") +set(OPENDAQ_SDK_VERSION "${sdk_version_major_minor_patch}") + +list(APPEND CMAKE_MESSAGE_CONTEXT ${REPO_NAME}) +set(CMAKE_MESSAGE_CONTEXT_SHOW ON CACHE BOOL "Show CMake message context") + +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + +get_filename_component(ROOT_DIR ${CMAKE_SOURCE_DIR} REALPATH) +set(FETCHCONTENT_EXTERNALS_DIR ${ROOT_DIR}/build/__external CACHE PATH "FetchContent folder prefix") + +#add_definitions(-DFMT_HEADER_ONLY) +#add_compile_definitions(SPDLOG_FMT_EXTERNAL=1) +find_package(Threads REQUIRED) + +# options +option(${REPO_OPTION_PREFIX}_EXAMPLE_ENABLE_APP "Enable building example application" OFF) +option(${REPO_OPTION_PREFIX}_ENABLE_TESTS "Enable tests" OFF) + +include(CommonUtils) +setup_repo(${REPO_OPTION_PREFIX}) + +add_subdirectory(external) +add_subdirectory(shared) +add_subdirectory(modules) +if (${REPO_OPTION_PREFIX}_ENABLE_TESTS) +# add_subdirectory(tests) +endif() +if (${REPO_OPTION_PREFIX}_EXAMPLE_ENABLE_APP) +# add_subdirectory(examples) +endif() +#add_subdirectory(docs) # FIXME no docs infrastructure to be handled by cmake + +# Set CPack variables +set(CPACK_COMPONENTS_ALL RUNTIME) +set(CPACK_PROJECT_NAME ${PROJECT_NAME}) +set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) +set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) +set(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_BINARY_DIR}/package") + +# Set the CPack generator based on the platform +if (WIN32) + set(CPACK_GENERATOR "ZIP") +elseif (UNIX AND NOT APPLE) + cmake_host_system_information(RESULT DISTRO_ID QUERY DISTRIB_ID) + cmake_host_system_information(RESULT DISTRO_VERSION_ID QUERY DISTRIB_VERSION_ID) + set(CPACK_SYSTEM_NAME "${DISTRO_ID}${DISTRO_VERSION_ID}") + set(CPACK_GENERATOR "TGZ") +endif() + +# Include CPack for packaging +include(CPack) diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..99c8a24 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,222 @@ +{ + "version": 4, + "configurePresets": [ + { + "name": "debug", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + }, + "binaryDir": "build/${presetName}" + }, + { + "name": "release", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + }, + "binaryDir": "build/${presetName}" + }, + { + "name": "gcc", + "hidden": true, + "cacheVariables": { + "CMAKE_C_COMPILER": "gcc", + "CMAKE_CXX_COMPILER": "g++" + } + }, + { + "name": "clang", + "hidden": true, + "cacheVariables": { + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_COMPILER": "clang++" + } + }, + { + "name": "intel-llvm", + "hidden": true, + "cacheVariables": { + "CMAKE_C_COMPILER": "icx", + "CMAKE_CXX_COMPILER": "icpx" + } + }, + { + "name": "ninja", + "hidden": true, + "generator": "Ninja" + }, + { + "name": "msvc-17", + "hidden": true, + "generator": "Visual Studio 15 2017", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ "Windows" ] + } + } + }, + { + "name": "msvc-22", + "hidden": true, + "generator": "Visual Studio 17 2022", + "inherits": [ + "msvc-17" + ] + }, + { + "name": "msvc-x86", + "hidden": true, + "architecture": "Win32", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ "Windows" ] + } + } + }, + { + "name": "msvc-x64", + "hidden": true, + "architecture": "x64", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ "Windows" ] + } + } + }, + { + "name": "full", + "hidden": true + }, + { + "name": "ci", + "hidden": false, + "inherits": [ + "full" + ] + }, + { + "name": "full/release", + "hidden": true, + "displayName": "Full - Release", + "inherits": [ + "release", + "full" + ] + }, + { + "name": "full/debug", + "hidden": true, + "displayName": "Full - Release", + "inherits": [ + "debug", + "full" + ] + }, + { + "name": "x86/msvc-17/full", + "displayName": "[MSVC 17] Full - x86", + "inherits": [ + "full/release", + "msvc-17", + "msvc-x86" + ] + }, + { + "name": "x64/msvc-17/full", + "displayName": "[MSVC 17] Full - x64", + "inherits": [ + "full/release", + "msvc-17", + "msvc-x64" + ] + }, + { + "name": "x86/msvc-22/full", + "displayName": "[MSVC 22] Full - x86", + "inherits": [ + "full/release", + "msvc-22", + "msvc-x86" + ] + }, + { + "name": "x64/msvc-22/full", + "displayName": "[MSVC 22] Full - x64", + "inherits": [ + "full/release", + "msvc-22", + "msvc-x64" + ] + }, + { + "name": "x64/gcc/full/debug", + "displayName": "[GCC] Full - Debug", + "inherits": [ + "full/debug", + "gcc", + "ninja" + ] + }, + { + "name": "x64/gcc/full/release", + "displayName": "[GCC] Full - Release", + "inherits": [ + "full/release", + "gcc", + "ninja" + ] + }, + { + "name": "x64/clang/full/debug", + "displayName": "[Clang] Full - Debug", + "inherits": [ + "full/debug", + "clang", + "ninja" + ] + }, + { + "name": "x64/clang/full/release", + "displayName": "[Clang] Full - Release", + "inherits": [ + "full/release", + "clang", + "ninja" + ] + }, + { + "name": "x64/intel-llvm/full/debug", + "displayName": "[IntelLLVM] Full - Debug", + "inherits": [ + "full/debug", + "intel-llvm", + "ninja" + ] + }, + { + "name": "x64/intel-llvm/full/release", + "displayName": "[IntelLLVM] Full - Release", + "inherits": [ + "full/release", + "intel-llvm", + "ninja" + ] + } + ] +} diff --git a/cmake/CommonUtils.cmake b/cmake/CommonUtils.cmake new file mode 100644 index 0000000..a4e82d6 --- /dev/null +++ b/cmake/CommonUtils.cmake @@ -0,0 +1,159 @@ +macro(setup_repo REPO_OPTION_PREFIX) + if (NOT DEFINED PROJECT_SOURCE_DIR) + message(FATAL_ERROR "Must be run inside a project()") + endif() + + # Additional build options + option(${REPO_OPTION_PREFIX}_DISABLE_DEBUG_POSTFIX "Disable debug ('-debug') postfix" OFF) + option(${REPO_OPTION_PREFIX}_DEBUG_WARNINGS_AS_ERRORS "Treat debug warnings as errors" OFF) + option(${REPO_OPTION_PREFIX}_ENABLE_TESTS "Enable unit-tests for ${REPO_OPTION_PREFIX}" ON) + + get_filename_component(ROOT_DIR ${CMAKE_SOURCE_DIR} REALPATH) + + if (NOT ${PROJECT_SOURCE_DIR} STREQUAL ${ROOT_DIR}) + set(BUILDING_AS_SUBMODULE ON PARENT_SCOPE) + message(STATUS "Building as submodule") + else() + message(STATUS "Building standalone") + set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER ".CMakePredefinedTargets") + set_property(GLOBAL PROPERTY USE_FOLDERS ON) + + get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + + message(STATUS "Platform: ${CMAKE_SYSTEM_PROCESSOR} | ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION}") + message(STATUS "Generator: ${CMAKE_GENERATOR} | ${CMAKE_GENERATOR_PLATFORM}") + + if (IS_MULTICONFIG) + message(STATUS "Configuration types:") + + block() + list(APPEND CMAKE_MESSAGE_INDENT "\t") + + foreach(CONFIG_TYPE ${CMAKE_CONFIGURATION_TYPES}) + message(STATUS ${CONFIG_TYPE}) + endforeach() + endblock() + else() + message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") + endif() + + string(TIMESTAMP CONFIGURE_DATE) + string(TIMESTAMP CURRENT_YEAR "%Y") + endif() + + set(CMAKE_CXX_STANDARD 17) + if (WIN32) + add_compile_definitions(NOMINMAX + _WIN32_WINNT=0x0601 # Windows 7 Compat + ) + + add_compile_definitions(UNICODE _UNICODE) + endif() + + if(NOT CMAKE_DEBUG_POSTFIX AND NOT ${REPO_OPTION_PREFIX}_DISABLE_DEBUG_POSTFIX) + set(CMAKE_DEBUG_POSTFIX -debug) + endif() + + if (MSVC) + # As above CMAKE_CXX_STANDARD but for VS + add_compile_options($<$:/std:c++17>) + + foreach (flag IN ITEMS + # Set source and execution character sets to UTF-8 + # https://learn.microsoft.com/en-us/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8 + /utf-8 + # Display level 1, level 2, and level 3 warnings, and all level 4 (informational) warnings that aren't off by default. + # https://learn.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level + /W4 + # data member 'member1' will be initialized after data member 'member2' + # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c5038 + #/w15038 + # Supress warnings + # https://learn.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level + # + # 'class1' : inherits 'class2::member' via dominance + # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4250 + #/wd4250 + # Your code uses a function, class member, variable, or typedef that's marked deprecated. + # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996 + /wd4996 + # declaration of 'identifier' hides class member + # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4458 + /wd4458 + # nonstandard extension used : nameless struct/union + # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4201 + #/wd4201 + # unreachable code + # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4702 + #/wd4702 + # declaration of 'identifier' hides global declaration + # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4459 + #/wd4459 + # 'function' : unreferenced local function has been removed + # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4505 + #/wd4505 + # conditional expression is constant + # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4127 + #/wd4127 + # assignment within conditional expression + # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4706 + #/wd4706 + # loss of data / precision, unsigned <--> signed + # + # 'argument' : conversion from 'type1' to 'type2', possible loss of data + # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4244 + /wd4244 + # 'var' : conversion from 'size_t' to 'type', possible loss of data + # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4267 + #/wd4267 + # 'identifier' : unreferenced formal parameter + # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4100 + /wd4100 + ) + add_compile_options($<$:${flag}>) + endforeach() + + if (NOT OPENDAQ_MSVC_SINGLE_PROCESS_BUILD) + # Build with multiple processes + # https://learn.microsoft.com/en-us/cpp/build/reference/mp-build-with-multiple-processes + add_compile_options($<$:/MP>) + endif() + + # Treat warnings as errors if not Debug or OPENDAQ_DEBUG_WARNINGS_AS_ERRORS is ON + add_compile_options($<$>,$>:/WX>) + + add_compile_definitions($<$:_DEBUG>) + + if (MSVC_VERSION GREATER_EQUAL 1910) + # /Zc:__cplusplus forces MSVC to use the correct value of __cplusplus macro (otherwise always C++98) + add_compile_options($<$:/Zc:__cplusplus>) + if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + # /Zf (Faster PDB generation) is not supported by ClangCL + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Zf") + endif() + + # Produce diagnostic messages with exact location + add_compile_options($<$:/diagnostics:caret>) + endif() + + # set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /ignore:4221") + # set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /ignore:4221") + # set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221") + endif() + + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + + if (${REPO_OPTION_PREFIX}_ENABLE_TESTS) + set(OPENDAQ_ENABLE_TEST_UTILS ON CACHE BOOL "Enable testing utils library") + endif() + + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + if ((CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX) AND NOT MSVC) + if (NOT WIN32) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") + endif() + endif() +endmacro() diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt new file mode 100644 index 0000000..18b6c8f --- /dev/null +++ b/external/CMakeLists.txt @@ -0,0 +1,41 @@ +set(CMAKE_FOLDER external) +list(APPEND CMAKE_MESSAGE_CONTEXT external) + +if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + message(FATAL_ERROR "In-source build is not supported!") +endif() + +if(NOT OPENDAQ_SDK_VERSION) + message(FATAL_ERROR "OPENDAQ_SDK_VERSION is not set") +endif() + +include(FetchContent) +find_package(openDAQ ${OPENDAQ_SDK_VERSION}) + +if (NOT openDAQ_FOUND) + set(OPENDAQ_ENABLE_TESTS OFF CACHE BOOL "" FORCE) + + FetchContent_Declare( + openDAQ + GIT_REPOSITORY https://github.com/openDAQ/openDAQ.git + GIT_TAG v${OPENDAQ_SDK_VERSION} + GIT_PROGRESS ON + SYSTEM + FIND_PACKAGE_ARGS ${OPENDAQ_SDK_VERSION} GLOBAL + ) + + FetchContent_MakeAvailable(openDAQ) + message(STATUS "Include opendaq_dependency macro from fetched ${FETCHCONTENT_SOURCE_DIR_OPENDAQ}/cmake/opendaq_dependency.cmake") + include(${FETCHCONTENT_SOURCE_DIR_OPENDAQ}/cmake/opendaq_dependency.cmake) +else() + message(STATUS "Found openDAQ in ${openDAQ_DIR}") + message(STATUS "Include opendaq_dependency macro from found ${openDAQ_DIR}/../../../share/cmake/opendaq_dependency.cmake") + include("${openDAQ_DIR}/../../../share/cmake/opendaq_dependency.cmake") +endif() + +add_subdirectory(nlohmann_json EXCLUDE_FROM_ALL) +add_subdirectory(streaming_protocol EXCLUDE_FROM_ALL) + +if (${REPO_OPTION_PREFIX}_ENABLE_TESTS) + add_subdirectory(gtest) +endif() diff --git a/external/gtest/CMakeLists.txt b/external/gtest/CMakeLists.txt new file mode 100644 index 0000000..273b1b7 --- /dev/null +++ b/external/gtest/CMakeLists.txt @@ -0,0 +1,30 @@ +set_cmake_folder_context(TARGET_FOLDER_NAME) + +if (NOT TARGET gtest) + set(GTest_REQUIREDVERSION "1.12.1") + + find_package(GTest GLOBAL ${GTest_REQUIREDVERSION}) + if(GTest_FOUND) + message(STATUS "Found GTest: ${GTest_VERSION} ${GTest_CONFIG}") + else() + message(STATUS "Fetching GTest version ${GTest_REQUIREDVERSION}") + + include(FetchContent) + get_custom_fetch_content_params(GTest FC_PARAMS) + + set(GTest_WITH_POST_BUILD_UNITTEST OFF) + set(GTest_WITH_TESTS OFF) + + set(BUILD_GMOCK OFF) + set(INSTALL_GTEST OFF) + set(gtest_force_shared_crt ON) + FetchContent_Declare( + GTest + URL https://github.com/google/googletest/archive/release-${GTest_REQUIREDVERSION}.zip + URL_HASH SHA256=24564e3b712d3eb30ac9a85d92f7d720f60cc0173730ac166f27dda7fed76cb2 + ${FC_PARAMS} + ) + + FetchContent_MakeAvailable(GTest) + endif() +endif() diff --git a/external/nlohmann_json/CMakeLists.txt b/external/nlohmann_json/CMakeLists.txt new file mode 100644 index 0000000..bde5330 --- /dev/null +++ b/external/nlohmann_json/CMakeLists.txt @@ -0,0 +1,9 @@ +set(JSON_Install ON) + +opendaq_dependency( + NAME nlohmann_json + REQUIRED_VERSION 3.11.3 + GIT_REPOSITORY https://github.com/nlohmann/json.git + GIT_REF v3.11.3 + EXPECT_TARGET nlohmann_json::nlohmann_json +) diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt new file mode 100644 index 0000000..02cebeb --- /dev/null +++ b/modules/CMakeLists.txt @@ -0,0 +1,12 @@ +set_cmake_folder_context(TARGET_FOLDER_NAME) + +if (MSVC) + add_compile_options(/wd4100) +endif() + +if (POLICY CMP0077) + cmake_policy(SET CMP0077 NEW) +endif() + +add_subdirectory(websocket_streaming_client_module) +add_subdirectory(websocket_streaming_server_module) diff --git a/opendaq_version b/opendaq_version new file mode 100644 index 0000000..fdb94d0 --- /dev/null +++ b/opendaq_version @@ -0,0 +1 @@ +3.31.0 \ No newline at end of file diff --git a/repo_version b/repo_version new file mode 100644 index 0000000..c06dab4 --- /dev/null +++ b/repo_version @@ -0,0 +1 @@ +3.31.0dev \ No newline at end of file diff --git a/shared/CMakeLists.txt b/shared/CMakeLists.txt new file mode 100644 index 0000000..94e7d07 --- /dev/null +++ b/shared/CMakeLists.txt @@ -0,0 +1,17 @@ +set_cmake_folder_context(TARGET_FOLDER_NAME) + +if (MSVC) + add_compile_options(/wd4100) + + # loss of data / precision, unsigned <--> signed + # + # 'argument' : conversion from 'type1' to 'type2', possible loss of data + # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4244 + add_compile_options(/wd4244) + + # 'var' : conversion from 'size_t' to 'type', possible loss of data + # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4267 + add_compile_options(/wd4267) +endif() + +add_subdirectory(libraries) diff --git a/shared/libraries/CMakeLists.txt b/shared/libraries/CMakeLists.txt new file mode 100644 index 0000000..a493c0f --- /dev/null +++ b/shared/libraries/CMakeLists.txt @@ -0,0 +1,3 @@ +set_cmake_context() + +add_subdirectory(websocket_streaming) From a5743538712c88fe3d13b10cfa2efaeef8482289 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Tue, 18 Nov 2025 23:42:52 +0100 Subject: [PATCH 05/49] Cleanup --- CMakeLists.txt | 4 +--- .../websocket_streaming_server_module/src/CMakeLists.txt | 6 +----- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d6dc0b..48c0452 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,9 +34,7 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) get_filename_component(ROOT_DIR ${CMAKE_SOURCE_DIR} REALPATH) set(FETCHCONTENT_EXTERNALS_DIR ${ROOT_DIR}/build/__external CACHE PATH "FetchContent folder prefix") -#add_definitions(-DFMT_HEADER_ONLY) -#add_compile_definitions(SPDLOG_FMT_EXTERNAL=1) -find_package(Threads REQUIRED) +add_definitions(-DFMT_HEADER_ONLY) # options option(${REPO_OPTION_PREFIX}_EXAMPLE_ENABLE_APP "Enable building example application" OFF) diff --git a/modules/websocket_streaming_server_module/src/CMakeLists.txt b/modules/websocket_streaming_server_module/src/CMakeLists.txt index be313fd..1a5b327 100644 --- a/modules/websocket_streaming_server_module/src/CMakeLists.txt +++ b/modules/websocket_streaming_server_module/src/CMakeLists.txt @@ -34,11 +34,7 @@ add_library(${LIB_NAME} SHARED ${SRC_Include} add_library(${OPENDAQ_SDK_TARGET_NAMESPACE}::${LIB_NAME} ALIAS ${LIB_NAME}) -#target_link_libraries(${LIB_NAME} PUBLIC ${OPENDAQ_SDK_TARGET_NAMESPACE}::opendaq -# PRIVATE ${OPENDAQ_SDK_TARGET_NAMESPACE}::websocket_streaming -#) - -target_link_libraries(${LIB_NAME} PUBLIC daq::opendaq +target_link_libraries(${LIB_NAME} PUBLIC ${OPENDAQ_SDK_TARGET_NAMESPACE}::opendaq PRIVATE ${OPENDAQ_SDK_TARGET_NAMESPACE}::websocket_streaming ) From 2c16c9e415c1b3e00bd8011257d2a42c92d3eb00 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Wed, 19 Nov 2025 02:47:44 +0100 Subject: [PATCH 06/49] Export found installed openDAQ globally --- external/CMakeLists.txt | 2 +- shared/libraries/websocket_streaming/src/CMakeLists.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 18b6c8f..596dff5 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -10,7 +10,7 @@ if(NOT OPENDAQ_SDK_VERSION) endif() include(FetchContent) -find_package(openDAQ ${OPENDAQ_SDK_VERSION}) +find_package(openDAQ ${OPENDAQ_SDK_VERSION} GLOBAL) if (NOT openDAQ_FOUND) set(OPENDAQ_ENABLE_TESTS OFF CACHE BOOL "" FORCE) diff --git a/shared/libraries/websocket_streaming/src/CMakeLists.txt b/shared/libraries/websocket_streaming/src/CMakeLists.txt index 679f0c4..424654e 100644 --- a/shared/libraries/websocket_streaming/src/CMakeLists.txt +++ b/shared/libraries/websocket_streaming/src/CMakeLists.txt @@ -58,8 +58,8 @@ target_include_directories(${LIB_NAME} PUBLIC $ ) -target_link_libraries(${LIB_NAME} PUBLIC daq::streaming_protocol - daq::opendaq +target_link_libraries(${LIB_NAME} PUBLIC ${OPENDAQ_SDK_TARGET_NAMESPACE}::streaming_protocol + ${OPENDAQ_SDK_TARGET_NAMESPACE}::opendaq ) # Fix daq::streaming_protocol` not properly propagating linking requirements on Windows From a3339a39bc91758ca3fe105f7d7475f9b8a96dfd Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Wed, 19 Nov 2025 03:14:25 +0100 Subject: [PATCH 07/49] Remove useless calls from test init --- .../websocket_streaming_client_module/tests/test_app.cpp | 4 ---- .../websocket_streaming_server_module/tests/test_app.cpp | 6 ------ 2 files changed, 10 deletions(-) diff --git a/modules/websocket_streaming_client_module/tests/test_app.cpp b/modules/websocket_streaming_client_module/tests/test_app.cpp index d92f41f..e2468aa 100644 --- a/modules/websocket_streaming_client_module/tests/test_app.cpp +++ b/modules/websocket_streaming_client_module/tests/test_app.cpp @@ -2,14 +2,10 @@ #include #include -#include #include int main(int argc, char** args) { - daq::daqInitializeCoreObjectsTesting(); - daqInitModuleManagerLibrary(); - testing::InitGoogleTest(&argc, args); testing::TestEventListeners& listeners = testing::UnitTest::GetInstance()->listeners(); diff --git a/modules/websocket_streaming_server_module/tests/test_app.cpp b/modules/websocket_streaming_server_module/tests/test_app.cpp index 64dd0cc..4f4e62c 100644 --- a/modules/websocket_streaming_server_module/tests/test_app.cpp +++ b/modules/websocket_streaming_server_module/tests/test_app.cpp @@ -1,5 +1,3 @@ -#include -#include #include #include #include @@ -7,10 +5,6 @@ int main(int argc, char** args) { - daq::daqInitializeCoreObjectsTesting(); - daqInitModuleManagerLibrary(); - daqInitOpenDaqLibrary(); - testing::InitGoogleTest(&argc, args); testing::TestEventListeners& listeners = testing::UnitTest::GetInstance()->listeners(); From 9642eed936c0abd5436892f69e0b2b4f25baa9f2 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Wed, 19 Nov 2025 03:15:17 +0100 Subject: [PATCH 08/49] Set PIC flag --- cmake/CommonUtils.cmake | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/cmake/CommonUtils.cmake b/cmake/CommonUtils.cmake index a4e82d6..7a9262f 100644 --- a/cmake/CommonUtils.cmake +++ b/cmake/CommonUtils.cmake @@ -41,6 +41,31 @@ macro(setup_repo REPO_OPTION_PREFIX) string(TIMESTAMP CURRENT_YEAR "%Y") endif() + if (UNIX AND CMAKE_SYSTEM_PROCESSOR MATCHES "^arm.*$") #e.g. armv7l + set(BUILD_ARM On CACHE INTERNAL "Build for ARM architecture") + endif() + + if (UNIX AND CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch.*$") #e.g. aarch64 + set(BUILD_ARM On CACHE INTERNAL "Build for ARM architecture") + endif() + + set(BUILD_64Bit Off) + + if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) + set(BUILD_64Bit On) + endif() + + if (UNIX AND CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64$") # arm architecture 64bit + set(BUILD_64Bit On) + endif() + + if(BUILD_64Bit OR BUILD_ARM) + message(STATUS "Position independent code flag is set") + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + else() + message(STATUS "Position independent code flag is not set") + endif() + set(CMAKE_CXX_STANDARD 17) if (WIN32) add_compile_definitions(NOMINMAX From b1daf4613a466a7aa3339b2de7821d15c807eb19 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Wed, 19 Nov 2025 06:14:25 +0100 Subject: [PATCH 09/49] Fix external dependencies fix opendaq src dir path fetch spdlog to avoid build conflicts find git in cmake to enable patching --- cmake/CommonUtils.cmake | 2 ++ external/CMakeLists.txt | 12 ++++++---- external/spdlog/CMakeLists.txt | 13 +++++++++++ .../001-periodic_worker_init_func.patch | 23 +++++++++++++++++++ 4 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 external/spdlog/CMakeLists.txt create mode 100644 external/spdlog/patches/001-periodic_worker_init_func.patch diff --git a/cmake/CommonUtils.cmake b/cmake/CommonUtils.cmake index 7a9262f..766b7ce 100644 --- a/cmake/CommonUtils.cmake +++ b/cmake/CommonUtils.cmake @@ -181,4 +181,6 @@ macro(setup_repo REPO_OPTION_PREFIX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") endif() endif() + + find_package(Git REQUIRED) endmacro() diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 596dff5..a53db30 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -18,21 +18,23 @@ if (NOT openDAQ_FOUND) FetchContent_Declare( openDAQ GIT_REPOSITORY https://github.com/openDAQ/openDAQ.git - GIT_TAG v${OPENDAQ_SDK_VERSION} + GIT_TAG other/module-extract-prep GIT_PROGRESS ON - SYSTEM - FIND_PACKAGE_ARGS ${OPENDAQ_SDK_VERSION} GLOBAL + SOURCE_DIR ${FETCHCONTENT_EXTERNALS_DIR}/src/openDAQ ) FetchContent_MakeAvailable(openDAQ) - message(STATUS "Include opendaq_dependency macro from fetched ${FETCHCONTENT_SOURCE_DIR_OPENDAQ}/cmake/opendaq_dependency.cmake") - include(${FETCHCONTENT_SOURCE_DIR_OPENDAQ}/cmake/opendaq_dependency.cmake) + + message(STATUS "openDAQ fetched source directory is detected as: ${openDAQ_SOURCE_DIR}") + # cmake incorrectly detects openDAQ_SOURCE_DIR at repo root/core/opendaq likely caused by similar targets: openDAQ (at root) vs opendaq (at root/core/opendaq), so modify path + include(${openDAQ_SOURCE_DIR}/../../cmake/opendaq_dependency.cmake) else() message(STATUS "Found openDAQ in ${openDAQ_DIR}") message(STATUS "Include opendaq_dependency macro from found ${openDAQ_DIR}/../../../share/cmake/opendaq_dependency.cmake") include("${openDAQ_DIR}/../../../share/cmake/opendaq_dependency.cmake") endif() +add_subdirectory(spdlog EXCLUDE_FROM_ALL) add_subdirectory(nlohmann_json EXCLUDE_FROM_ALL) add_subdirectory(streaming_protocol EXCLUDE_FROM_ALL) diff --git a/external/spdlog/CMakeLists.txt b/external/spdlog/CMakeLists.txt new file mode 100644 index 0000000..27c3c45 --- /dev/null +++ b/external/spdlog/CMakeLists.txt @@ -0,0 +1,13 @@ +set(SPDLOG_INSTALL ON CACHE BOOL "" FORCE) +set(SPDLOG_FMT_EXTERNAL ON CACHE BOOL "" FORCE) +set(SPDLOG_WCHAR_FILENAMES ON CACHE BOOL "" FORCE) + +opendaq_dependency( + NAME spdlog + REQUIRED_VERSION 1.13.0 + GIT_REPOSITORY https://github.com/gabime/spdlog.git + GIT_REF v1.13.0 + EXPECT_TARGET spdlog::spdlog + PATCH_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/patches/001-periodic_worker_init_func.patch +) diff --git a/external/spdlog/patches/001-periodic_worker_init_func.patch b/external/spdlog/patches/001-periodic_worker_init_func.patch new file mode 100644 index 0000000..d011083 --- /dev/null +++ b/external/spdlog/patches/001-periodic_worker_init_func.patch @@ -0,0 +1,23 @@ +diff --git a/include/spdlog/details/periodic_worker.h b/include/spdlog/details/periodic_worker.h +index d05245cb..3252e53a 100644 +--- a/include/spdlog/details/periodic_worker.h ++++ b/include/spdlog/details/periodic_worker.h +@@ -21,14 +21,16 @@ namespace details { + class SPDLOG_API periodic_worker { + public: + template +- periodic_worker(const std::function &callback_fun, ++ periodic_worker(const std::function &init_thread_fun, ++ const std::function &callback_fun, + std::chrono::duration interval) { + active_ = (interval > std::chrono::duration::zero()); + if (!active_) { + return; + } + +- worker_thread_ = std::thread([this, callback_fun, interval]() { ++ worker_thread_ = std::thread([this, init_thread_fun, callback_fun, interval]() { ++ init_thread_fun(); + for (;;) { + std::unique_lock lock(this->mutex_); + if (this->cv_.wait_for(lock, interval, [this] { return !this->active_; })) { From eff959687c7e7971fd2ca6e8a16945984fc757e9 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Wed, 19 Nov 2025 06:18:09 +0100 Subject: [PATCH 10/49] Add tmp test workflow --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e81652a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: Build and Test + +on: + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + +jobs: + build-and-test: + + strategy: + matrix: + include: + - os: ubuntu-latest + generator: Ninja + + - os: windows-latest + generator: "Visual Studio 17 2022" + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout simple device module repo + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.branch || github.event.client_payload.branch || github.ref }} + + - name: Configure project with CMake + run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DLT_STREAMING_MODULES_ENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Release + + - name: Build project with CMake + run: cmake --build build/output --config Release + + - name: Run project tests with CMake + run: ctest --test-dir build/output --output-on-failure -C Release -V From 32b2c171ce4359b44ece30c93433172b5a559b2f Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Wed, 19 Nov 2025 06:28:16 +0100 Subject: [PATCH 11/49] Install mono on ubuntu-runner --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e81652a..292db3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,7 @@ jobs: build-and-test: strategy: + fail-fast: false matrix: include: - os: ubuntu-latest @@ -19,6 +20,11 @@ jobs: runs-on: ${{ matrix.os }} steps: + - name: Install additional dependencies + if: matrix.os == 'ubuntu-latest' + run: | + apt-get install -y --no-install-recommends mono-runtime libmono-system-json-microsoft4.0-cil libmono-system-data4.0-cil + - name: Checkout simple device module repo uses: actions/checkout@v4 with: From dfda26565bab9ad10ec69a1f4521202623dd870a Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Wed, 19 Nov 2025 06:52:34 +0100 Subject: [PATCH 12/49] Ignore warnings in ext deps --- external/CMakeLists.txt | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index a53db30..6e839c0 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -34,6 +34,31 @@ else() include("${openDAQ_DIR}/../../../share/cmake/opendaq_dependency.cmake") endif() +if (MSVC AND NOT CMAKE_COMPILER_IS_CLANGXX) + # As above CMAKE_CXX_STANDARD but for VS + add_compile_options($<$:/std:c++17>) + + # suppress warnings + foreach (flag IN ITEMS + # loss of data / precision, unsigned <--> signed + # + # 'argument' : conversion from 'type1' to 'type2', possible loss of data + # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4244 + /wd4244 + # 'var' : conversion from 'size_t' to 'type', possible loss of data + # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4267 + /wd4267 + ) + add_compile_options($<$:${flag}>) + endforeach() +endif() + +if (MSVC AND NOT CMAKE_COMPILER_IS_CLANGXX) + add_compile_options($<$:/WX->) +else() + add_compile_options($<$:-Wno-error>) +endif() + add_subdirectory(spdlog EXCLUDE_FROM_ALL) add_subdirectory(nlohmann_json EXCLUDE_FROM_ALL) add_subdirectory(streaming_protocol EXCLUDE_FROM_ALL) From 888e5a44a8bb99522351df7dceacbd5d522ab6f6 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Wed, 19 Nov 2025 07:22:10 +0100 Subject: [PATCH 13/49] Try debug build in CI --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 292db3d..6e7883f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,13 +25,13 @@ jobs: run: | apt-get install -y --no-install-recommends mono-runtime libmono-system-json-microsoft4.0-cil libmono-system-data4.0-cil - - name: Checkout simple device module repo + - name: Checkout project repo uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.branch || github.event.client_payload.branch || github.ref }} - name: Configure project with CMake - run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DLT_STREAMING_MODULES_ENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Release + run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DLT_STREAMING_MODULES_ENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Debug - name: Build project with CMake run: cmake --build build/output --config Release From bcc1959089cb0c24b516388e20b81ae492a5408c Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 11 Dec 2025 09:16:41 +0100 Subject: [PATCH 14/49] Align with opendaq updates --- external/CMakeLists.txt | 1 + external/boost/CMakeLists.txt | 147 ++++++++++++++++++ .../src/CMakeLists.txt | 1 + .../tests/CMakeLists.txt | 2 +- .../tests/test_app.cpp | 2 +- .../tests/CMakeLists.txt | 2 +- .../tests/test_app.cpp | 2 +- .../websocket_streaming/tests/CMakeLists.txt | 2 +- 8 files changed, 154 insertions(+), 5 deletions(-) create mode 100644 external/boost/CMakeLists.txt diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 6e839c0..6786846 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -59,6 +59,7 @@ else() add_compile_options($<$:-Wno-error>) endif() +add_subdirectory(boost) add_subdirectory(spdlog EXCLUDE_FROM_ALL) add_subdirectory(nlohmann_json EXCLUDE_FROM_ALL) add_subdirectory(streaming_protocol EXCLUDE_FROM_ALL) diff --git a/external/boost/CMakeLists.txt b/external/boost/CMakeLists.txt new file mode 100644 index 0000000..41863fb --- /dev/null +++ b/external/boost/CMakeLists.txt @@ -0,0 +1,147 @@ +if (OPENDAQ_LINK_3RD_PARTY_LIBS_STATICALY) + set(BUILD_SHARED_LIBS OFF) + set(Boost_USE_STATIC_LIBS ON CACHE BOOL "") + message(STATUS "Linking Boost statically") +else() + set(BUILD_SHARED_LIBS ON) + set(Boost_USE_STATIC_LIBS OFF CACHE BOOL "") + message(STATUS "Linking Boost dynamically") +endif() + +set(Boost_USE_MULTITHREADED ON) +set(Boost_USE_STATIC_RUNTIME ${OPENDAQ_LINK_RUNTIME_STATICALLY}) +set(Boost_NO_WARN_NEW_VERSIONS ON) + +if (OPENDAQ_LINK_RUNTIME_STATICALLY) + set(BOOST_RUNTIME_LINK static) +else() + set(BOOST_RUNTIME_LINK shared) +endif() + +if (BUILD_ARM) + if (BUILD_64Bit) + set(CONTEXT_ARCHITECTURE arm64) + else() + set(CONTEXT_ARCHITECTURE arm) + endif() + + message(STATUS "CMAKE_COMPILER_IS_GNUCXX: ${CMAKE_COMPILER_IS_GNUCXX}") + + if (CMAKE_COMPILER_IS_GNUCXX) + # Need C++ compiler to pre-process ASM files + set(CMAKE_ASM_COMPILER ${CMAKE_CXX_COMPILER}) + set(CMAKE_ASM_FLAGS "-x assembler-with-cpp" CACHE STRING "") + endif() + + set(BOOST_CONTEXT_ABI aapcs CACHE STRING "Boost.Context binary format (elf, mach-o, pe, xcoff)") + set(BOOST_CONTEXT_ARCHITECTURE ${CONTEXT_ARCHITECTURE} CACHE STRING "Boost.Context architecture (arm, arm64, loongarch64, mips32, mips64, ppc32, ppc64, riscv64, s390x, i386, x86_64, combined)") +endif() + +if (NOT BOOST_INCLUDE_LIBRARIES) + set(NEEDED_LIBRARIES algorithm + asio + beast + dll + program_options + uuid + locale + align + + ) + + if(DAQMODULES_PARQUET_RECORDER_MODULE AND MSVC) + list(APPEND NEEDED_LIBRARIES + multiprecision + predef + scope_exit + typeof + ) + endif() + + set(BOOST_INCLUDE_LIBRARIES "${NEEDED_LIBRARIES}" + CACHE STRING + "List of libraries to build (default: all but excluded and incompatible)" + ) +endif() + +opendaq_dependency( + NAME Boost + REQUIRED_VERSION 1.71.0 + URL https://github.com/boostorg/boost/releases/download/boost-1.82.0/boost-1.82.0.tar.xz + URL_HASH SHA256=fd60da30be908eff945735ac7d4d9addc7f7725b1ff6fcdcaede5262d511d21e + EXPECT_TARGET Boost::headers + OVERRIDE_FIND_PACKAGE +) + +if (Boost_FETCHED) + message("Boost FETCHED") + + # dont treat warnings as errors + set(BOOST_TARGETS + boost_container + boost_thread + ) + foreach(BOOST_TARGET ${BOOST_TARGETS}) + if (TARGET ${BOOST_TARGET}) + if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + target_compile_options(${BOOST_TARGET} PRIVATE /WX-) + else() + target_compile_options(${BOOST_TARGET} PRIVATE -Wno-error) + endif() + endif() + endforeach() + + if(DAQMODULES_PARQUET_RECORDER_MODULE) + set(boost_libs + config + algorithm + assert + bind + concept_check + core + detail + function + iterator + locale + mpl + numeric_conversion + preprocessor + range + smart_ptr + static_assert + throw_exception + tokenizer + type_traits + utility + mp11 + ) + + if(MSVC) + list(APPEND boost_libs + multiprecision + predef + scope_exit + typeof + + ) + endif() + + add_library(daq::boost_headers INTERFACE IMPORTED GLOBAL) + + foreach(boost_lib ${boost_libs}) + if (TARGET Boost::${boost_lib}) + get_target_property(include_dirs Boost::${boost_lib} INTERFACE_INCLUDE_DIRECTORIES) + target_include_directories(daq::boost_headers INTERFACE "${include_dirs}") + endif() + endforeach() + endif() +endif() + +if (Boost_FOUND) + + foreach(BOOST_TARGET ${BOOST_INCLUDE_LIBRARIES}) + if (NOT TARGET Boost::${BOOST_TARGET} AND NOT TARGET boost_${BOOST_TARGET}) + add_library(Boost::${BOOST_TARGET} ALIAS Boost::headers) + endif() + endforeach() +endif() diff --git a/modules/websocket_streaming_client_module/src/CMakeLists.txt b/modules/websocket_streaming_client_module/src/CMakeLists.txt index e87e78d..ec49e20 100644 --- a/modules/websocket_streaming_client_module/src/CMakeLists.txt +++ b/modules/websocket_streaming_client_module/src/CMakeLists.txt @@ -35,6 +35,7 @@ endif() target_link_libraries(${LIB_NAME} PUBLIC ${OPENDAQ_SDK_TARGET_NAMESPACE}::opendaq PRIVATE ${OPENDAQ_SDK_TARGET_NAMESPACE}::discovery + $ # required for discovery ${OPENDAQ_SDK_TARGET_NAMESPACE}::websocket_streaming ) diff --git a/modules/websocket_streaming_client_module/tests/CMakeLists.txt b/modules/websocket_streaming_client_module/tests/CMakeLists.txt index 626f201..108b503 100644 --- a/modules/websocket_streaming_client_module/tests/CMakeLists.txt +++ b/modules/websocket_streaming_client_module/tests/CMakeLists.txt @@ -8,7 +8,7 @@ set(TEST_SOURCES test_websocket_streaming_client_module.cpp add_executable(${TEST_APP} ${TEST_SOURCES} ) -target_link_libraries(${TEST_APP} PRIVATE ${OPENDAQ_SDK_TARGET_NAMESPACE}::test_utils gtest +target_link_libraries(${TEST_APP} PRIVATE ${OPENDAQ_SDK_TARGET_NAMESPACE}::opendaq_test_utils gtest ${OPENDAQ_SDK_TARGET_NAMESPACE}::${MODULE_NAME} ) diff --git a/modules/websocket_streaming_client_module/tests/test_app.cpp b/modules/websocket_streaming_client_module/tests/test_app.cpp index e2468aa..0d93aa7 100644 --- a/modules/websocket_streaming_client_module/tests/test_app.cpp +++ b/modules/websocket_streaming_client_module/tests/test_app.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/modules/websocket_streaming_server_module/tests/CMakeLists.txt b/modules/websocket_streaming_server_module/tests/CMakeLists.txt index f2c41de..21de9c6 100644 --- a/modules/websocket_streaming_server_module/tests/CMakeLists.txt +++ b/modules/websocket_streaming_server_module/tests/CMakeLists.txt @@ -8,7 +8,7 @@ set(TEST_SOURCES test_websocket_streaming_server_module.cpp add_executable(${TEST_APP} ${TEST_SOURCES} ) -target_link_libraries(${TEST_APP} PRIVATE ${OPENDAQ_SDK_TARGET_NAMESPACE}::test_utils gtest +target_link_libraries(${TEST_APP} PRIVATE ${OPENDAQ_SDK_TARGET_NAMESPACE}::opendaq_test_utils gtest ${OPENDAQ_SDK_TARGET_NAMESPACE}::${MODULE_NAME} ) diff --git a/modules/websocket_streaming_server_module/tests/test_app.cpp b/modules/websocket_streaming_server_module/tests/test_app.cpp index 4f4e62c..8c1b547 100644 --- a/modules/websocket_streaming_server_module/tests/test_app.cpp +++ b/modules/websocket_streaming_server_module/tests/test_app.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include int main(int argc, char** args) diff --git a/shared/libraries/websocket_streaming/tests/CMakeLists.txt b/shared/libraries/websocket_streaming/tests/CMakeLists.txt index e329aea..afe3f76 100644 --- a/shared/libraries/websocket_streaming/tests/CMakeLists.txt +++ b/shared/libraries/websocket_streaming/tests/CMakeLists.txt @@ -17,7 +17,7 @@ target_link_libraries(${TEST_APP} PRIVATE ${OPENDAQ_SDK_TARGET_NAMESPACE}::${MODULE_NAME} ${OPENDAQ_SDK_TARGET_NAMESPACE}::opendaq ${OPENDAQ_SDK_TARGET_NAMESPACE}::streaming_protocol - ${OPENDAQ_SDK_TARGET_NAMESPACE}::test_utils + ${OPENDAQ_SDK_TARGET_NAMESPACE}::opendaq_test_utils gtest ) From db509a7a16ea73a62ceb38f867526b05712f408e Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 11 Dec 2025 11:42:14 +0100 Subject: [PATCH 15/49] Fix warning --- shared/libraries/websocket_streaming/src/input_signal.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/shared/libraries/websocket_streaming/src/input_signal.cpp b/shared/libraries/websocket_streaming/src/input_signal.cpp index 09a6352..2450fcd 100644 --- a/shared/libraries/websocket_streaming/src/input_signal.cpp +++ b/shared/libraries/websocket_streaming/src/input_signal.cpp @@ -459,7 +459,6 @@ DataType InputConstantDataSignal::convertToNumeric(const nlohmann::json& jsonNum throw std::out_of_range("Value out of range"); return static_cast(numeric); } - throw std::invalid_argument("Conversion failed - invalid sample type"); } template From 2621a3a040d7368c4368202718a95b29d0ae6cf9 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 11 Dec 2025 12:44:55 +0100 Subject: [PATCH 16/49] Fix priveledges --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e7883f..e261ec7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: - name: Install additional dependencies if: matrix.os == 'ubuntu-latest' run: | - apt-get install -y --no-install-recommends mono-runtime libmono-system-json-microsoft4.0-cil libmono-system-data4.0-cil + sudo apt-get install -y --no-install-recommends mono-runtime libmono-system-json-microsoft4.0-cil libmono-system-data4.0-cil - name: Checkout project repo uses: actions/checkout@v4 From 1da97d0d3d4f5ac1761ddd533f50a4005574f541 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 11 Dec 2025 13:07:14 +0100 Subject: [PATCH 17/49] Enable ctest and remove unused cpack --- CMakeLists.txt | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 48c0452..1afd571 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,6 +43,11 @@ option(${REPO_OPTION_PREFIX}_ENABLE_TESTS "Enable tests" OFF) include(CommonUtils) setup_repo(${REPO_OPTION_PREFIX}) +if (${REPO_OPTION_PREFIX}_ENABLE_TESTS) + message(STATUS "Unit tests are ENABLED") + enable_testing() +endif() + add_subdirectory(external) add_subdirectory(shared) add_subdirectory(modules) @@ -53,23 +58,3 @@ if (${REPO_OPTION_PREFIX}_EXAMPLE_ENABLE_APP) # add_subdirectory(examples) endif() #add_subdirectory(docs) # FIXME no docs infrastructure to be handled by cmake - -# Set CPack variables -set(CPACK_COMPONENTS_ALL RUNTIME) -set(CPACK_PROJECT_NAME ${PROJECT_NAME}) -set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) -set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) -set(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_BINARY_DIR}/package") - -# Set the CPack generator based on the platform -if (WIN32) - set(CPACK_GENERATOR "ZIP") -elseif (UNIX AND NOT APPLE) - cmake_host_system_information(RESULT DISTRO_ID QUERY DISTRIB_ID) - cmake_host_system_information(RESULT DISTRO_VERSION_ID QUERY DISTRIB_VERSION_ID) - set(CPACK_SYSTEM_NAME "${DISTRO_ID}${DISTRO_VERSION_ID}") - set(CPACK_GENERATOR "TGZ") -endif() - -# Include CPack for packaging -include(CPack) From 8826960d192f024acbe8a91af8cb44dbaec0c4aa Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 11 Dec 2025 13:10:04 +0100 Subject: [PATCH 18/49] Fix warning --- .../tests/test_signal_descriptor_converter.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/shared/libraries/websocket_streaming/tests/test_signal_descriptor_converter.cpp b/shared/libraries/websocket_streaming/tests/test_signal_descriptor_converter.cpp index cd303ce..d6b5e48 100644 --- a/shared/libraries/websocket_streaming/tests/test_signal_descriptor_converter.cpp +++ b/shared/libraries/websocket_streaming/tests/test_signal_descriptor_converter.cpp @@ -46,13 +46,6 @@ class DummayWriter : public bsp::iWriter return 0; } - virtual std::string id() const override - { - static unsigned int id = 0; - return std::to_string(id); - ++id; - } - std::vector> metaInformations; }; From 07d121b578774935e530d9f98481a86a75e2f7c6 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 11 Dec 2025 13:36:12 +0100 Subject: [PATCH 19/49] Revert "Fix warning" This reverts commit c74ec706b0ec1f4e9938eda035b058cb6daf420c. --- .../tests/test_signal_descriptor_converter.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/shared/libraries/websocket_streaming/tests/test_signal_descriptor_converter.cpp b/shared/libraries/websocket_streaming/tests/test_signal_descriptor_converter.cpp index d6b5e48..cd303ce 100644 --- a/shared/libraries/websocket_streaming/tests/test_signal_descriptor_converter.cpp +++ b/shared/libraries/websocket_streaming/tests/test_signal_descriptor_converter.cpp @@ -46,6 +46,13 @@ class DummayWriter : public bsp::iWriter return 0; } + virtual std::string id() const override + { + static unsigned int id = 0; + return std::to_string(id); + ++id; + } + std::vector> metaInformations; }; From 17203a705b530d36c55d5391ee0bdaeb3cea2a21 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 11 Dec 2025 13:37:56 +0100 Subject: [PATCH 20/49] Remove unreacheable code --- .../tests/test_signal_descriptor_converter.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/shared/libraries/websocket_streaming/tests/test_signal_descriptor_converter.cpp b/shared/libraries/websocket_streaming/tests/test_signal_descriptor_converter.cpp index cd303ce..4b2ec6a 100644 --- a/shared/libraries/websocket_streaming/tests/test_signal_descriptor_converter.cpp +++ b/shared/libraries/websocket_streaming/tests/test_signal_descriptor_converter.cpp @@ -48,9 +48,7 @@ class DummayWriter : public bsp::iWriter virtual std::string id() const override { - static unsigned int id = 0; - return std::to_string(id); - ++id; + return "0"; } std::vector> metaInformations; From 20ddd7f354935003916844f08dbe8a6ec07c5ec8 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 11 Dec 2025 14:10:42 +0100 Subject: [PATCH 21/49] Run CI with installed openDAQ SDK --- .github/workflows/ci.yml | 59 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e261ec7..c3ff926 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: types: [opened, reopened, synchronize, ready_for_review] jobs: - build-and-test: + fetch-build-and-test: strategy: fail-fast: false @@ -33,8 +33,63 @@ jobs: - name: Configure project with CMake run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DLT_STREAMING_MODULES_ENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Debug + - name: Build project with CMake + run: cmake --build build/output --config Debug + + - name: Run project tests with CMake + run: ctest --test-dir build/output --output-on-failure -C Debug + + install-build-and-test: + + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + generator: Ninja + + - os: windows-latest + generator: "Visual Studio 17 2022" + + runs-on: ${{ matrix.os }} + + steps: + - name: Install additional dependencies + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get install -y --no-install-recommends mono-runtime libmono-system-json-microsoft4.0-cil libmono-system-data4.0-cil + + - name: Setup working directories + run: | + mkdir opendaq + mkdir module + + - name: Checkout openDAQ + uses: actions/checkout@v4 + working-directory: ./opendaq + with: + repository: openDAQ/openDAQ + ref: other/module-extract-prep + + - name: Configure, build and install opendaq + working-directory: ./opendaq + run: | + cmake -B build/output -S . -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=Release + cmake --build build/output --config Release + cmake --build build/output --target install + + - name: Checkout project repo + uses: actions/checkout@v4 + working-directory: ./module + with: + ref: ${{ github.event.inputs.branch || github.event.client_payload.branch || github.ref }} + + - name: Configure project with CMake + working-directory: ./module + run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DLT_STREAMING_MODULES_ENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Release + - name: Build project with CMake run: cmake --build build/output --config Release - name: Run project tests with CMake - run: ctest --test-dir build/output --output-on-failure -C Release -V + run: ctest --test-dir build/output --output-on-failure -C Release From 80f48a00977e85672947c2f03ee5fca9ade04a01 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 11 Dec 2025 14:20:17 +0100 Subject: [PATCH 22/49] Remove commented code and trigger CI --- ...test_websocket_streaming_client_module.cpp | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/modules/websocket_streaming_client_module/tests/test_websocket_streaming_client_module.cpp b/modules/websocket_streaming_client_module/tests/test_websocket_streaming_client_module.cpp index 73b1c0a..88916be 100644 --- a/modules/websocket_streaming_client_module/tests/test_websocket_streaming_client_module.cpp +++ b/modules/websocket_streaming_client_module/tests/test_websocket_streaming_client_module.cpp @@ -96,33 +96,6 @@ TEST_F(WebsocketStreamingClientModuleTest, CreateDeviceConnectionFailed) ASSERT_THROW(module.createDevice("daq.lt://127.0.0.1", nullptr), NotFoundException); } -//TEST_F(WebsocketStreamingClientModuleTest, CreateConnectionString) -//{ -// auto context = NullContext(); -// ModulePtr module; -// createModule(&module, context); -// -// StringPtr connectionString; -// -// ServerCapabilityConfigPtr serverCapabilityIgnored = ServerCapability("test", "test", ProtocolType::Unknown); -// ASSERT_NO_THROW(connectionString = module.createConnectionString(serverCapabilityIgnored)); -// ASSERT_FALSE(connectionString.assigned()); -// -// ServerCapabilityConfigPtr serverCapability = ServerCapability("OpenDAQLTStreaming", "OpenDAQLTStreaming", ProtocolType::Streaming); -// ASSERT_THROW(module.createConnectionString(serverCapability), InvalidParameterException); -// -// serverCapability.addAddress("123.123.123.123"); -// ASSERT_EQ(module.createConnectionString(serverCapability), "daq.lt://123.123.123.123:7414"); -// -// serverCapability.setPort(1234); -// ASSERT_NO_THROW(connectionString = module.createConnectionString(serverCapability)); -// ASSERT_EQ(connectionString, "daq.lt://123.123.123.123:1234"); -// -// serverCapability.addProperty(StringProperty("Path", "/path")); -// ASSERT_NO_THROW(connectionString = module.createConnectionString(serverCapability)); -// ASSERT_EQ(connectionString, "daq.lt://123.123.123.123:1234/path"); -//} - TEST_F(WebsocketStreamingClientModuleTest, CreateStreamingWithNullArguments) { auto module = CreateModule(); From d770bee66652ca3e243c90093b46dc4a9e9641f4 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 11 Dec 2025 14:27:17 +0100 Subject: [PATCH 23/49] Fix steps in CI --- .github/workflows/ci.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3ff926..df8283d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,13 +66,13 @@ jobs: - name: Checkout openDAQ uses: actions/checkout@v4 - working-directory: ./opendaq with: repository: openDAQ/openDAQ ref: other/module-extract-prep + path: opendaq - name: Configure, build and install opendaq - working-directory: ./opendaq + working-directory: opendaq run: | cmake -B build/output -S . -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=Release cmake --build build/output --config Release @@ -80,16 +80,18 @@ jobs: - name: Checkout project repo uses: actions/checkout@v4 - working-directory: ./module with: ref: ${{ github.event.inputs.branch || github.event.client_payload.branch || github.ref }} + path: module - name: Configure project with CMake - working-directory: ./module + working-directory: module run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DLT_STREAMING_MODULES_ENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Release - name: Build project with CMake + working-directory: module run: cmake --build build/output --config Release - name: Run project tests with CMake + working-directory: module run: ctest --test-dir build/output --output-on-failure -C Release From f41cc1a260b27078e690358ee0baa470de09cc6b Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 11 Dec 2025 14:45:09 +0100 Subject: [PATCH 24/49] Rename --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df8283d..6326e7f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: types: [opened, reopened, synchronize, ready_for_review] jobs: - fetch-build-and-test: + build-and-test: strategy: fail-fast: false From e1e9190ecb38f6a7a554b213a3b495d2d17fbd45 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 11 Dec 2025 14:49:06 +0100 Subject: [PATCH 25/49] Remove redundant class --- .../tests/test_websocket_streaming_server_module.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/modules/websocket_streaming_server_module/tests/test_websocket_streaming_server_module.cpp b/modules/websocket_streaming_server_module/tests/test_websocket_streaming_server_module.cpp index 5434b18..971ff8d 100644 --- a/modules/websocket_streaming_server_module/tests/test_websocket_streaming_server_module.cpp +++ b/modules/websocket_streaming_server_module/tests/test_websocket_streaming_server_module.cpp @@ -8,14 +8,7 @@ #include #include -class WebsocketStreamingServerModuleTest : public testing::Test -{ -public: - void TearDown() override - { - } -}; - +using WebsocketStreamingServerModuleTest = testing::Test; using namespace daq; static ModulePtr CreateModule(ContextPtr context = NullContext()) From d788ad6fd2730f81e322716a799ee7767505be2c Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 11 Dec 2025 15:11:32 +0100 Subject: [PATCH 26/49] Add bigobj build flag --- modules/websocket_streaming_server_module/src/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/websocket_streaming_server_module/src/CMakeLists.txt b/modules/websocket_streaming_server_module/src/CMakeLists.txt index 1a5b327..ede66f9 100644 --- a/modules/websocket_streaming_server_module/src/CMakeLists.txt +++ b/modules/websocket_streaming_server_module/src/CMakeLists.txt @@ -34,6 +34,10 @@ add_library(${LIB_NAME} SHARED ${SRC_Include} add_library(${OPENDAQ_SDK_TARGET_NAMESPACE}::${LIB_NAME} ALIAS ${LIB_NAME}) +if (MSVC) + target_compile_options(${LIB_NAME} PRIVATE /bigobj) +endif() + target_link_libraries(${LIB_NAME} PUBLIC ${OPENDAQ_SDK_TARGET_NAMESPACE}::opendaq PRIVATE ${OPENDAQ_SDK_TARGET_NAMESPACE}::websocket_streaming ) From 8c2a30e8e9293f89baa0eadc28a2ed601ff1a9e7 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 11 Dec 2025 15:16:28 +0100 Subject: [PATCH 27/49] Use minimal preset to build opendaq --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6326e7f..f8978be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,7 +74,7 @@ jobs: - name: Configure, build and install opendaq working-directory: opendaq run: | - cmake -B build/output -S . -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=Release + cmake -B build/output -S . -G "${{ matrix.generator }}" -DOPENDAQ_ENABLE_TESTS=OFF -DCMAKE_BUILD_TYPE=Release cmake --build build/output --config Release cmake --build build/output --target install From e9e11b071a8be231d4ca8f81358bdd72c5e175d3 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 11 Dec 2025 16:06:47 +0100 Subject: [PATCH 28/49] Fix openDAQ install --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8978be..18f5161 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,7 +76,7 @@ jobs: run: | cmake -B build/output -S . -G "${{ matrix.generator }}" -DOPENDAQ_ENABLE_TESTS=OFF -DCMAKE_BUILD_TYPE=Release cmake --build build/output --config Release - cmake --build build/output --target install + sudo cmake --build build/output --target install - name: Checkout project repo uses: actions/checkout@v4 From ad5c447abca1737b9632ef5fb611b037f977e73b Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 11 Dec 2025 16:45:45 +0100 Subject: [PATCH 29/49] Fix --- .github/workflows/ci.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18f5161..0c1e101 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,12 +71,24 @@ jobs: ref: other/module-extract-prep path: opendaq - - name: Configure, build and install opendaq + - name: Configure and build working-directory: opendaq run: | cmake -B build/output -S . -G "${{ matrix.generator }}" -DOPENDAQ_ENABLE_TESTS=OFF -DCMAKE_BUILD_TYPE=Release cmake --build build/output --config Release + + + - name: Install opendaq + working-directory: opendaq + if: matrix.os == 'ubuntu-latest' + run: | sudo cmake --build build/output --target install + + - name: Install opendaq + working-directory: opendaq + if: matrix.os == 'windows-latest' + run: | + cmake --build build/output --target install - name: Checkout project repo uses: actions/checkout@v4 From 0d66de7bc6b5397a8f6d837d61c06009d0459788 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Fri, 12 Dec 2025 07:49:07 +0100 Subject: [PATCH 30/49] Fix build type --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c1e101..1bb3edc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,13 +82,13 @@ jobs: working-directory: opendaq if: matrix.os == 'ubuntu-latest' run: | - sudo cmake --build build/output --target install + sudo cmake --build build/output --target install --config Release - name: Install opendaq working-directory: opendaq if: matrix.os == 'windows-latest' run: | - cmake --build build/output --target install + cmake --build build/output --target install --config Release - name: Checkout project repo uses: actions/checkout@v4 From c565fbeba578e3ad4999671ca7def843ed121df3 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Fri, 12 Dec 2025 09:15:19 +0100 Subject: [PATCH 31/49] Change install path --- .github/workflows/ci.yml | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1bb3edc..a856191 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,8 @@ jobs: generator: "Visual Studio 17 2022" runs-on: ${{ matrix.os }} + env: + INSTALL_PREFIX: ${{ runner.temp }}/opendaq_install steps: - name: Install additional dependencies @@ -71,34 +73,21 @@ jobs: ref: other/module-extract-prep path: opendaq - - name: Configure and build + - name: Configure, build and install openDAQ working-directory: opendaq run: | cmake -B build/output -S . -G "${{ matrix.generator }}" -DOPENDAQ_ENABLE_TESTS=OFF -DCMAKE_BUILD_TYPE=Release cmake --build build/output --config Release + cmake --install build/output --config Release --prefix "${{ env.INSTALL_PREFIX }}" - - - name: Install opendaq - working-directory: opendaq - if: matrix.os == 'ubuntu-latest' - run: | - sudo cmake --build build/output --target install --config Release - - - name: Install opendaq - working-directory: opendaq + - name: Add DLL path (Windows only) if: matrix.os == 'windows-latest' run: | - cmake --build build/output --target install --config Release - - - name: Checkout project repo - uses: actions/checkout@v4 - with: - ref: ${{ github.event.inputs.branch || github.event.client_payload.branch || github.ref }} - path: module - + echo "${{ env.INSTALL_PREFIX }}\\bin" >> $env:GITHUB_PATH + - name: Configure project with CMake working-directory: module - run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DLT_STREAMING_MODULES_ENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Release + run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DLT_STREAMING_MODULES_ENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="${{ env.INSTALL_PREFIX }}" - name: Build project with CMake working-directory: module From ea1e87af158e41c5eb4c5d4d9a116e83839c1cef Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Tue, 16 Dec 2025 08:33:39 +0100 Subject: [PATCH 32/49] Clean-up boost external dependency --- CMakeLists.txt | 4 +++ external/boost/CMakeLists.txt | 62 ++--------------------------------- 2 files changed, 6 insertions(+), 60 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1afd571..25c2259 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,10 @@ add_definitions(-DFMT_HEADER_ONLY) option(${REPO_OPTION_PREFIX}_EXAMPLE_ENABLE_APP "Enable building example application" OFF) option(${REPO_OPTION_PREFIX}_ENABLE_TESTS "Enable tests" OFF) +# Runtime and default 3rd party library linking options +option(${REPO_OPTION_PREFIX}_LINK_RUNTIME_STATICALLY "Link the C++ runtime staticaly (embedd it)" OFF) +option(${REPO_OPTION_PREFIX}_LINK_3RD_PARTY_LIBS_STATICALY "Link the 3rd party libraries staticaly (embedd it)" ON) + include(CommonUtils) setup_repo(${REPO_OPTION_PREFIX}) diff --git a/external/boost/CMakeLists.txt b/external/boost/CMakeLists.txt index 41863fb..098f763 100644 --- a/external/boost/CMakeLists.txt +++ b/external/boost/CMakeLists.txt @@ -1,4 +1,4 @@ -if (OPENDAQ_LINK_3RD_PARTY_LIBS_STATICALY) +if (${REPO_OPTION_PREFIX}_LINK_3RD_PARTY_LIBS_STATICALY) set(BUILD_SHARED_LIBS OFF) set(Boost_USE_STATIC_LIBS ON CACHE BOOL "") message(STATUS "Linking Boost statically") @@ -12,7 +12,7 @@ set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME ${OPENDAQ_LINK_RUNTIME_STATICALLY}) set(Boost_NO_WARN_NEW_VERSIONS ON) -if (OPENDAQ_LINK_RUNTIME_STATICALLY) +if (${REPO_OPTION_PREFIX}_LINK_RUNTIME_STATICALLY) set(BOOST_RUNTIME_LINK static) else() set(BOOST_RUNTIME_LINK shared) @@ -41,23 +41,10 @@ if (NOT BOOST_INCLUDE_LIBRARIES) set(NEEDED_LIBRARIES algorithm asio beast - dll program_options uuid - locale - align - ) - if(DAQMODULES_PARQUET_RECORDER_MODULE AND MSVC) - list(APPEND NEEDED_LIBRARIES - multiprecision - predef - scope_exit - typeof - ) - endif() - set(BOOST_INCLUDE_LIBRARIES "${NEEDED_LIBRARIES}" CACHE STRING "List of libraries to build (default: all but excluded and incompatible)" @@ -90,51 +77,6 @@ if (Boost_FETCHED) endif() endif() endforeach() - - if(DAQMODULES_PARQUET_RECORDER_MODULE) - set(boost_libs - config - algorithm - assert - bind - concept_check - core - detail - function - iterator - locale - mpl - numeric_conversion - preprocessor - range - smart_ptr - static_assert - throw_exception - tokenizer - type_traits - utility - mp11 - ) - - if(MSVC) - list(APPEND boost_libs - multiprecision - predef - scope_exit - typeof - - ) - endif() - - add_library(daq::boost_headers INTERFACE IMPORTED GLOBAL) - - foreach(boost_lib ${boost_libs}) - if (TARGET Boost::${boost_lib}) - get_target_property(include_dirs Boost::${boost_lib} INTERFACE_INCLUDE_DIRECTORIES) - target_include_directories(daq::boost_headers INTERFACE "${include_dirs}") - endif() - endforeach() - endif() endif() if (Boost_FOUND) From bb6d9f469ada6d4f42bea10d16a4279b7818db3c Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Mon, 22 Dec 2025 13:26:23 +0100 Subject: [PATCH 33/49] Retarget to other openDAQ branch --- external/CMakeLists.txt | 2 +- modules/websocket_streaming_client_module/tests/test_app.cpp | 1 - modules/websocket_streaming_server_module/tests/test_app.cpp | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 6786846..77a033e 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -18,7 +18,7 @@ if (NOT openDAQ_FOUND) FetchContent_Declare( openDAQ GIT_REPOSITORY https://github.com/openDAQ/openDAQ.git - GIT_TAG other/module-extract-prep + GIT_TAG main GIT_PROGRESS ON SOURCE_DIR ${FETCHCONTENT_EXTERNALS_DIR}/src/openDAQ ) diff --git a/modules/websocket_streaming_client_module/tests/test_app.cpp b/modules/websocket_streaming_client_module/tests/test_app.cpp index 0d93aa7..2d76abc 100644 --- a/modules/websocket_streaming_client_module/tests/test_app.cpp +++ b/modules/websocket_streaming_client_module/tests/test_app.cpp @@ -1,7 +1,6 @@ #include #include -#include #include int main(int argc, char** args) diff --git a/modules/websocket_streaming_server_module/tests/test_app.cpp b/modules/websocket_streaming_server_module/tests/test_app.cpp index 8c1b547..29a34d8 100644 --- a/modules/websocket_streaming_server_module/tests/test_app.cpp +++ b/modules/websocket_streaming_server_module/tests/test_app.cpp @@ -1,4 +1,3 @@ -#include #include #include #include From 3b2c37eea74f98f0cbec67c63a6efb847e96fc49 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Mon, 22 Dec 2025 13:37:48 +0100 Subject: [PATCH 34/49] Fix env var --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a856191..0b9f92e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: runs-on: ${{ matrix.os }} env: - INSTALL_PREFIX: ${{ runner.temp }}/opendaq_install + INSTALL_PREFIX: ${{ github.workspace }}/opendaq_install steps: - name: Install additional dependencies From d75b74ce846e3f16bf68c3bee2203adc4785c4de Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Mon, 22 Dec 2025 13:40:50 +0100 Subject: [PATCH 35/49] Fix branch name --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b9f92e..6a52e44 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,7 +70,7 @@ jobs: uses: actions/checkout@v4 with: repository: openDAQ/openDAQ - ref: other/module-extract-prep + ref: main path: opendaq - name: Configure, build and install openDAQ From 4f1ec0cb4ff0def7e09eaafa6524e054f21c6717 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 8 Jan 2026 13:58:49 +0100 Subject: [PATCH 36/49] Align ext libs versions --- external/spdlog/CMakeLists.txt | 4 ++-- external/streaming_protocol/CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/external/spdlog/CMakeLists.txt b/external/spdlog/CMakeLists.txt index 27c3c45..5274432 100644 --- a/external/spdlog/CMakeLists.txt +++ b/external/spdlog/CMakeLists.txt @@ -4,9 +4,9 @@ set(SPDLOG_WCHAR_FILENAMES ON CACHE BOOL "" FORCE) opendaq_dependency( NAME spdlog - REQUIRED_VERSION 1.13.0 + REQUIRED_VERSION 1.16.0 GIT_REPOSITORY https://github.com/gabime/spdlog.git - GIT_REF v1.13.0 + GIT_REF v1.16.0 EXPECT_TARGET spdlog::spdlog PATCH_FILES ${CMAKE_CURRENT_SOURCE_DIR}/patches/001-periodic_worker_init_func.patch diff --git a/external/streaming_protocol/CMakeLists.txt b/external/streaming_protocol/CMakeLists.txt index be75a99..0c2ad00 100644 --- a/external/streaming_protocol/CMakeLists.txt +++ b/external/streaming_protocol/CMakeLists.txt @@ -6,8 +6,8 @@ endif() opendaq_dependency( NAME streaming_protocol - REQUIRED_VERSION 1.2.7 + REQUIRED_VERSION 1.2.8 GIT_REPOSITORY https://github.com/openDAQ/streaming-protocol-lt.git - GIT_REF v1.2.7 + GIT_REF v1.2.8-dev EXPECT_TARGET daq::streaming_protocol ) From 9af8e92ce6c98ea8b0ef892c669ba6834c279a25 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 8 Jan 2026 14:03:27 +0100 Subject: [PATCH 37/49] Add missing repo checkout to CI --- .github/workflows/ci.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a52e44..2dcb7e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,11 +61,6 @@ jobs: run: | sudo apt-get install -y --no-install-recommends mono-runtime libmono-system-json-microsoft4.0-cil libmono-system-data4.0-cil - - name: Setup working directories - run: | - mkdir opendaq - mkdir module - - name: Checkout openDAQ uses: actions/checkout@v4 with: @@ -84,7 +79,13 @@ jobs: if: matrix.os == 'windows-latest' run: | echo "${{ env.INSTALL_PREFIX }}\\bin" >> $env:GITHUB_PATH - + + - name: Checkout project repo + uses: actions/checkout@v4 + with: + path: module + ref: ${{ github.event.inputs.branch || github.event.client_payload.branch || github.ref }} + - name: Configure project with CMake working-directory: module run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DLT_STREAMING_MODULES_ENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="${{ env.INSTALL_PREFIX }}" From b1ceb7d6699d205a0bf70925e571c86cc1cc852a Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 15 Jan 2026 16:10:32 +0100 Subject: [PATCH 38/49] Update to latest module layout --- .github/workflows/ci.yml | 33 ++-- CMakeLists.txt | 76 +++---- cmake/CMakeLists.txt | 14 ++ cmake/CommonUtils.cmake | 186 ------------------ external/CMakeLists.txt | 78 ++------ external/boost/CMakeLists.txt | 87 +------- external/opendaq_ref | 1 + repo_version => module_version | 0 .../CMakeLists.txt | 6 +- .../CMakeLists.txt | 4 +- opendaq_version | 1 - 11 files changed, 88 insertions(+), 398 deletions(-) create mode 100644 cmake/CMakeLists.txt delete mode 100644 cmake/CommonUtils.cmake create mode 100644 external/opendaq_ref rename repo_version => module_version (100%) delete mode 100644 opendaq_version diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2dcb7e8..ae29e7d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,14 +6,12 @@ on: jobs: build-and-test: - strategy: fail-fast: false matrix: include: - os: ubuntu-latest generator: Ninja - - os: windows-latest generator: "Visual Studio 17 2022" @@ -40,14 +38,12 @@ jobs: run: ctest --test-dir build/output --output-on-failure -C Debug install-build-and-test: - strategy: fail-fast: false matrix: include: - os: ubuntu-latest generator: Ninja - - os: windows-latest generator: "Visual Studio 17 2022" @@ -61,34 +57,39 @@ jobs: run: | sudo apt-get install -y --no-install-recommends mono-runtime libmono-system-json-microsoft4.0-cil libmono-system-data4.0-cil + - name: Checkout module + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.branch || github.event.client_payload.branch || github.ref }} + path: module + + - name: Read openDAQ version + working-directory: module + run: | + opendaq_ref=$(cat external/opendaq_ref) + echo "OPENDAQ_REF=$opendaq_ref" >> $GITHUB_ENV + - name: Checkout openDAQ uses: actions/checkout@v4 with: repository: openDAQ/openDAQ - ref: main + ref: ${{ env.OPENDAQ_REF }} path: opendaq - name: Configure, build and install openDAQ working-directory: opendaq run: | - cmake -B build/output -S . -G "${{ matrix.generator }}" -DOPENDAQ_ENABLE_TESTS=OFF -DCMAKE_BUILD_TYPE=Release + cmake -B build/output -S . -G "${{ matrix.generator }}" -DOPENDAQ_ENABLE_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${{ env.INSTALL_PREFIX }}" cmake --build build/output --config Release - cmake --install build/output --config Release --prefix "${{ env.INSTALL_PREFIX }}" + cmake --install build/output --config Release - name: Add DLL path (Windows only) if: matrix.os == 'windows-latest' - run: | - echo "${{ env.INSTALL_PREFIX }}\\bin" >> $env:GITHUB_PATH - - - name: Checkout project repo - uses: actions/checkout@v4 - with: - path: module - ref: ${{ github.event.inputs.branch || github.event.client_payload.branch || github.ref }} + run: echo "${{ env.INSTALL_PREFIX }}/lib" >> $env:GITHUB_PATH - name: Configure project with CMake working-directory: module - run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DLT_STREAMING_MODULES_ENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="${{ env.INSTALL_PREFIX }}" + run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DLT_STREAMING_MODULES_ENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DopenDAQ_DIR="${{ env.INSTALL_PREFIX }}/lib/cmake/opendaq/" - name: Build project with CMake working-directory: module diff --git a/CMakeLists.txt b/CMakeLists.txt index 25c2259..d515d77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,64 +1,52 @@ set(CMAKE_POLICY_VERSION_MINIMUM 3.5) cmake_minimum_required(VERSION 3.25) -set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # set project variables -set(REPO_NAME lt_streaming_modules) -set(REPO_OPTION_PREFIX LT_STREAMING_MODULES) +set(REPO_NAME LtStreamingModulesModern) +set(REPO_OPTION_PREFIX DAQMODULES_LT_STREAMING) -file(READ "repo_version" repo_version) -string(STRIP ${repo_version} repo_version) -string(REGEX REPLACE "^([0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1" repo_version_major_minor_patch "${repo_version}") -set(REPO_VERSION "${repo_version_major_minor_patch}") +add_subdirectory(cmake) +setup_repo_version("${REPO_OPTION_PREFIX}" ${REPO_NAME} "module_version") -project(${REPO_NAME} - LANGUAGES CXX - VERSION ${REPO_VERSION} -) - -# set SDK variables -set(OPENDAQ_SDK_NAME openDAQ) -set(OPENDAQ_SDK_TARGET_NAME opendaq) -set(OPENDAQ_SDK_TARGET_NAMESPACE daq) - -file(READ "opendaq_version" sdk_version) -string(STRIP ${sdk_version} sdk_version) -string(REGEX REPLACE "^([0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1" sdk_version_major_minor_patch "${sdk_version}") -set(OPENDAQ_SDK_VERSION "${sdk_version_major_minor_patch}") - -list(APPEND CMAKE_MESSAGE_CONTEXT ${REPO_NAME}) -set(CMAKE_MESSAGE_CONTEXT_SHOW ON CACHE BOOL "Show CMake message context") - -list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) +if (NOT DEFINED ${REPO_OPTION_PREFIX}_VERSION AND DEFINED OPENDAQ_PACKAGE_VERSION) + set(${REPO_OPTION_PREFIX}_VERSION ${OPENDAQ_PACKAGE_VERSION}) +endif() -get_filename_component(ROOT_DIR ${CMAKE_SOURCE_DIR} REALPATH) -set(FETCHCONTENT_EXTERNALS_DIR ${ROOT_DIR}/build/__external CACHE PATH "FetchContent folder prefix") +project(${REPO_NAME} VERSION ${${REPO_OPTION_PREFIX}_VERSION} LANGUAGES CXX) -add_definitions(-DFMT_HEADER_ONLY) +setup_build_mode(${REPO_OPTION_PREFIX} ${REPO_NAME}) +if (NOT ${REPO_OPTION_PREFIX}_BUILDING_AS_SUBMODULE) + setup_repo(${REPO_OPTION_PREFIX}) +endif() -# options -option(${REPO_OPTION_PREFIX}_EXAMPLE_ENABLE_APP "Enable building example application" OFF) -option(${REPO_OPTION_PREFIX}_ENABLE_TESTS "Enable tests" OFF) +add_subdirectory(external) -# Runtime and default 3rd party library linking options -option(${REPO_OPTION_PREFIX}_LINK_RUNTIME_STATICALLY "Link the C++ runtime staticaly (embedd it)" OFF) -option(${REPO_OPTION_PREFIX}_LINK_3RD_PARTY_LIBS_STATICALY "Link the 3rd party libraries staticaly (embedd it)" ON) +if (NOT DEFINED OPENDAQ_SDK_NAME) + set(OPENDAQ_SDK_NAME openDAQ) +endif() -include(CommonUtils) -setup_repo(${REPO_OPTION_PREFIX}) +if (NOT DEFINED OPENDAQ_SDK_TARGET_NAME) + set(OPENDAQ_SDK_TARGET_NAME opendaq) +endif() -if (${REPO_OPTION_PREFIX}_ENABLE_TESTS) - message(STATUS "Unit tests are ENABLED") - enable_testing() +if (NOT DEFINED OPENDAQ_SDK_TARGET_NAMESPACE) + set(OPENDAQ_SDK_TARGET_NAMESPACE daq) endif() -add_subdirectory(external) add_subdirectory(shared) add_subdirectory(modules) -if (${REPO_OPTION_PREFIX}_ENABLE_TESTS) + +if (NOT ${REPO_OPTION_PREFIX}_BUILDING_AS_SUBMODULE) + # fetch boost at latest point when list of required boost libs and headers is completed + opendaq_setup_boost() +endif() + +if (${REPO_OPTION_PREFIX}_BUILDING_AS_SUBMODULE AND OPENDAQ_ENABLE_TESTS OR ${REPO_OPTION_PREFIX}_ENABLE_TESTS) # add_subdirectory(tests) endif() -if (${REPO_OPTION_PREFIX}_EXAMPLE_ENABLE_APP) + +if (${REPO_OPTION_PREFIX}_ENABLE_EXAMPLE_APP) # add_subdirectory(examples) endif() -#add_subdirectory(docs) # FIXME no docs infrastructure to be handled by cmake + +#add_subdirectory(docs) # FIXME no docs infrastructure to be handled by cmake diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt new file mode 100644 index 0000000..ed79840 --- /dev/null +++ b/cmake/CMakeLists.txt @@ -0,0 +1,14 @@ +set(CMAKE_FOLDER "cmake") + +list(APPEND CMAKE_MESSAGE_CONTEXT cmake) +set(CURR_MESSAGE_CONTEXT ${CMAKE_MESSAGE_CONTEXT}) + +message(STATUS "Import functions and macro from opendaq_cmake_utils repo") +include(FetchContent) +FetchContent_Declare( + opendaq_cmake_utils + GIT_REPOSITORY https://github.com/openDAQ/opendaq-cmake-utils.git + GIT_TAG main + GIT_PROGRESS ON +) +FetchContent_MakeAvailable(opendaq_cmake_utils) diff --git a/cmake/CommonUtils.cmake b/cmake/CommonUtils.cmake deleted file mode 100644 index 766b7ce..0000000 --- a/cmake/CommonUtils.cmake +++ /dev/null @@ -1,186 +0,0 @@ -macro(setup_repo REPO_OPTION_PREFIX) - if (NOT DEFINED PROJECT_SOURCE_DIR) - message(FATAL_ERROR "Must be run inside a project()") - endif() - - # Additional build options - option(${REPO_OPTION_PREFIX}_DISABLE_DEBUG_POSTFIX "Disable debug ('-debug') postfix" OFF) - option(${REPO_OPTION_PREFIX}_DEBUG_WARNINGS_AS_ERRORS "Treat debug warnings as errors" OFF) - option(${REPO_OPTION_PREFIX}_ENABLE_TESTS "Enable unit-tests for ${REPO_OPTION_PREFIX}" ON) - - get_filename_component(ROOT_DIR ${CMAKE_SOURCE_DIR} REALPATH) - - if (NOT ${PROJECT_SOURCE_DIR} STREQUAL ${ROOT_DIR}) - set(BUILDING_AS_SUBMODULE ON PARENT_SCOPE) - message(STATUS "Building as submodule") - else() - message(STATUS "Building standalone") - set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER ".CMakePredefinedTargets") - set_property(GLOBAL PROPERTY USE_FOLDERS ON) - - get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) - - message(STATUS "Platform: ${CMAKE_SYSTEM_PROCESSOR} | ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION}") - message(STATUS "Generator: ${CMAKE_GENERATOR} | ${CMAKE_GENERATOR_PLATFORM}") - - if (IS_MULTICONFIG) - message(STATUS "Configuration types:") - - block() - list(APPEND CMAKE_MESSAGE_INDENT "\t") - - foreach(CONFIG_TYPE ${CMAKE_CONFIGURATION_TYPES}) - message(STATUS ${CONFIG_TYPE}) - endforeach() - endblock() - else() - message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") - endif() - - string(TIMESTAMP CONFIGURE_DATE) - string(TIMESTAMP CURRENT_YEAR "%Y") - endif() - - if (UNIX AND CMAKE_SYSTEM_PROCESSOR MATCHES "^arm.*$") #e.g. armv7l - set(BUILD_ARM On CACHE INTERNAL "Build for ARM architecture") - endif() - - if (UNIX AND CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch.*$") #e.g. aarch64 - set(BUILD_ARM On CACHE INTERNAL "Build for ARM architecture") - endif() - - set(BUILD_64Bit Off) - - if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - set(BUILD_64Bit On) - endif() - - if (UNIX AND CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64$") # arm architecture 64bit - set(BUILD_64Bit On) - endif() - - if(BUILD_64Bit OR BUILD_ARM) - message(STATUS "Position independent code flag is set") - set(CMAKE_POSITION_INDEPENDENT_CODE ON) - else() - message(STATUS "Position independent code flag is not set") - endif() - - set(CMAKE_CXX_STANDARD 17) - if (WIN32) - add_compile_definitions(NOMINMAX - _WIN32_WINNT=0x0601 # Windows 7 Compat - ) - - add_compile_definitions(UNICODE _UNICODE) - endif() - - if(NOT CMAKE_DEBUG_POSTFIX AND NOT ${REPO_OPTION_PREFIX}_DISABLE_DEBUG_POSTFIX) - set(CMAKE_DEBUG_POSTFIX -debug) - endif() - - if (MSVC) - # As above CMAKE_CXX_STANDARD but for VS - add_compile_options($<$:/std:c++17>) - - foreach (flag IN ITEMS - # Set source and execution character sets to UTF-8 - # https://learn.microsoft.com/en-us/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8 - /utf-8 - # Display level 1, level 2, and level 3 warnings, and all level 4 (informational) warnings that aren't off by default. - # https://learn.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level - /W4 - # data member 'member1' will be initialized after data member 'member2' - # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c5038 - #/w15038 - # Supress warnings - # https://learn.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level - # - # 'class1' : inherits 'class2::member' via dominance - # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4250 - #/wd4250 - # Your code uses a function, class member, variable, or typedef that's marked deprecated. - # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996 - /wd4996 - # declaration of 'identifier' hides class member - # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4458 - /wd4458 - # nonstandard extension used : nameless struct/union - # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4201 - #/wd4201 - # unreachable code - # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4702 - #/wd4702 - # declaration of 'identifier' hides global declaration - # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4459 - #/wd4459 - # 'function' : unreferenced local function has been removed - # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4505 - #/wd4505 - # conditional expression is constant - # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4127 - #/wd4127 - # assignment within conditional expression - # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4706 - #/wd4706 - # loss of data / precision, unsigned <--> signed - # - # 'argument' : conversion from 'type1' to 'type2', possible loss of data - # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4244 - /wd4244 - # 'var' : conversion from 'size_t' to 'type', possible loss of data - # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4267 - #/wd4267 - # 'identifier' : unreferenced formal parameter - # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4100 - /wd4100 - ) - add_compile_options($<$:${flag}>) - endforeach() - - if (NOT OPENDAQ_MSVC_SINGLE_PROCESS_BUILD) - # Build with multiple processes - # https://learn.microsoft.com/en-us/cpp/build/reference/mp-build-with-multiple-processes - add_compile_options($<$:/MP>) - endif() - - # Treat warnings as errors if not Debug or OPENDAQ_DEBUG_WARNINGS_AS_ERRORS is ON - add_compile_options($<$>,$>:/WX>) - - add_compile_definitions($<$:_DEBUG>) - - if (MSVC_VERSION GREATER_EQUAL 1910) - # /Zc:__cplusplus forces MSVC to use the correct value of __cplusplus macro (otherwise always C++98) - add_compile_options($<$:/Zc:__cplusplus>) - if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - # /Zf (Faster PDB generation) is not supported by ClangCL - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Zf") - endif() - - # Produce diagnostic messages with exact location - add_compile_options($<$:/diagnostics:caret>) - endif() - - # set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /ignore:4221") - # set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /ignore:4221") - # set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221") - endif() - - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) - - if (${REPO_OPTION_PREFIX}_ENABLE_TESTS) - set(OPENDAQ_ENABLE_TEST_UTILS ON CACHE BOOL "Enable testing utils library") - endif() - - set(THREADS_PREFER_PTHREAD_FLAG ON) - find_package(Threads REQUIRED) - if ((CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX) AND NOT MSVC) - if (NOT WIN32) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") - endif() - endif() - - find_package(Git REQUIRED) -endmacro() diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 77a033e..8475e7b 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -1,69 +1,27 @@ set(CMAKE_FOLDER external) list(APPEND CMAKE_MESSAGE_CONTEXT external) -if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) - message(FATAL_ERROR "In-source build is not supported!") +if (NOT ${REPO_OPTION_PREFIX}_BUILDING_AS_SUBMODULE) + set(OPENDAQ_REF "main") + + set(OPENDAQ_REF_FILE "${CMAKE_CURRENT_LIST_DIR}/opendaq_ref") + if (EXISTS "${OPENDAQ_REF_FILE}") + file(READ "${OPENDAQ_REF_FILE}" FILE_CONTENT) + string(STRIP "${FILE_CONTENT}" FILE_CONTENT) + if (FILE_CONTENT) + set(OPENDAQ_REF "${FILE_CONTENT}") + endif() + endif() + + resolve_opendaq_dependency("${OPENDAQ_REF}") endif() -if(NOT OPENDAQ_SDK_VERSION) - message(FATAL_ERROR "OPENDAQ_SDK_VERSION is not set") -endif() - -include(FetchContent) -find_package(openDAQ ${OPENDAQ_SDK_VERSION} GLOBAL) - -if (NOT openDAQ_FOUND) - set(OPENDAQ_ENABLE_TESTS OFF CACHE BOOL "" FORCE) - - FetchContent_Declare( - openDAQ - GIT_REPOSITORY https://github.com/openDAQ/openDAQ.git - GIT_TAG main - GIT_PROGRESS ON - SOURCE_DIR ${FETCHCONTENT_EXTERNALS_DIR}/src/openDAQ - ) - - FetchContent_MakeAvailable(openDAQ) - - message(STATUS "openDAQ fetched source directory is detected as: ${openDAQ_SOURCE_DIR}") - # cmake incorrectly detects openDAQ_SOURCE_DIR at repo root/core/opendaq likely caused by similar targets: openDAQ (at root) vs opendaq (at root/core/opendaq), so modify path - include(${openDAQ_SOURCE_DIR}/../../cmake/opendaq_dependency.cmake) -else() - message(STATUS "Found openDAQ in ${openDAQ_DIR}") - message(STATUS "Include opendaq_dependency macro from found ${openDAQ_DIR}/../../../share/cmake/opendaq_dependency.cmake") - include("${openDAQ_DIR}/../../../share/cmake/opendaq_dependency.cmake") -endif() - -if (MSVC AND NOT CMAKE_COMPILER_IS_CLANGXX) - # As above CMAKE_CXX_STANDARD but for VS - add_compile_options($<$:/std:c++17>) - - # suppress warnings - foreach (flag IN ITEMS - # loss of data / precision, unsigned <--> signed - # - # 'argument' : conversion from 'type1' to 'type2', possible loss of data - # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4244 - /wd4244 - # 'var' : conversion from 'size_t' to 'type', possible loss of data - # https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4267 - /wd4267 - ) - add_compile_options($<$:${flag}>) - endforeach() -endif() - -if (MSVC AND NOT CMAKE_COMPILER_IS_CLANGXX) - add_compile_options($<$:/WX->) -else() - add_compile_options($<$:-Wno-error>) +suppress_ext_lib_warnings() +if (NOT ${REPO_OPTION_PREFIX}_BUILDING_AS_SUBMODULE AND ${REPO_OPTION_PREFIX}_ENABLE_TESTS) + add_subdirectory(gtest) endif() add_subdirectory(boost) add_subdirectory(spdlog EXCLUDE_FROM_ALL) -add_subdirectory(nlohmann_json EXCLUDE_FROM_ALL) -add_subdirectory(streaming_protocol EXCLUDE_FROM_ALL) - -if (${REPO_OPTION_PREFIX}_ENABLE_TESTS) - add_subdirectory(gtest) -endif() +add_subdirectory(nlohmann_json) +add_subdirectory(streaming_protocol) \ No newline at end of file diff --git a/external/boost/CMakeLists.txt b/external/boost/CMakeLists.txt index 098f763..ea43791 100644 --- a/external/boost/CMakeLists.txt +++ b/external/boost/CMakeLists.txt @@ -1,89 +1,4 @@ -if (${REPO_OPTION_PREFIX}_LINK_3RD_PARTY_LIBS_STATICALY) - set(BUILD_SHARED_LIBS OFF) - set(Boost_USE_STATIC_LIBS ON CACHE BOOL "") - message(STATUS "Linking Boost statically") -else() - set(BUILD_SHARED_LIBS ON) - set(Boost_USE_STATIC_LIBS OFF CACHE BOOL "") - message(STATUS "Linking Boost dynamically") -endif() - -set(Boost_USE_MULTITHREADED ON) -set(Boost_USE_STATIC_RUNTIME ${OPENDAQ_LINK_RUNTIME_STATICALLY}) -set(Boost_NO_WARN_NEW_VERSIONS ON) - -if (${REPO_OPTION_PREFIX}_LINK_RUNTIME_STATICALLY) - set(BOOST_RUNTIME_LINK static) -else() - set(BOOST_RUNTIME_LINK shared) -endif() - -if (BUILD_ARM) - if (BUILD_64Bit) - set(CONTEXT_ARCHITECTURE arm64) - else() - set(CONTEXT_ARCHITECTURE arm) - endif() - - message(STATUS "CMAKE_COMPILER_IS_GNUCXX: ${CMAKE_COMPILER_IS_GNUCXX}") - - if (CMAKE_COMPILER_IS_GNUCXX) - # Need C++ compiler to pre-process ASM files - set(CMAKE_ASM_COMPILER ${CMAKE_CXX_COMPILER}) - set(CMAKE_ASM_FLAGS "-x assembler-with-cpp" CACHE STRING "") - endif() - - set(BOOST_CONTEXT_ABI aapcs CACHE STRING "Boost.Context binary format (elf, mach-o, pe, xcoff)") - set(BOOST_CONTEXT_ARCHITECTURE ${CONTEXT_ARCHITECTURE} CACHE STRING "Boost.Context architecture (arm, arm64, loongarch64, mips32, mips64, ppc32, ppc64, riscv64, s390x, i386, x86_64, combined)") -endif() - -if (NOT BOOST_INCLUDE_LIBRARIES) - set(NEEDED_LIBRARIES algorithm + opendaq_add_required_boost_libs( asio beast - program_options - uuid ) - - set(BOOST_INCLUDE_LIBRARIES "${NEEDED_LIBRARIES}" - CACHE STRING - "List of libraries to build (default: all but excluded and incompatible)" - ) -endif() - -opendaq_dependency( - NAME Boost - REQUIRED_VERSION 1.71.0 - URL https://github.com/boostorg/boost/releases/download/boost-1.82.0/boost-1.82.0.tar.xz - URL_HASH SHA256=fd60da30be908eff945735ac7d4d9addc7f7725b1ff6fcdcaede5262d511d21e - EXPECT_TARGET Boost::headers - OVERRIDE_FIND_PACKAGE -) - -if (Boost_FETCHED) - message("Boost FETCHED") - - # dont treat warnings as errors - set(BOOST_TARGETS - boost_container - boost_thread - ) - foreach(BOOST_TARGET ${BOOST_TARGETS}) - if (TARGET ${BOOST_TARGET}) - if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - target_compile_options(${BOOST_TARGET} PRIVATE /WX-) - else() - target_compile_options(${BOOST_TARGET} PRIVATE -Wno-error) - endif() - endif() - endforeach() -endif() - -if (Boost_FOUND) - - foreach(BOOST_TARGET ${BOOST_INCLUDE_LIBRARIES}) - if (NOT TARGET Boost::${BOOST_TARGET} AND NOT TARGET boost_${BOOST_TARGET}) - add_library(Boost::${BOOST_TARGET} ALIAS Boost::headers) - endif() - endforeach() -endif() diff --git a/external/opendaq_ref b/external/opendaq_ref new file mode 100644 index 0000000..88d050b --- /dev/null +++ b/external/opendaq_ref @@ -0,0 +1 @@ +main \ No newline at end of file diff --git a/repo_version b/module_version similarity index 100% rename from repo_version rename to module_version diff --git a/modules/websocket_streaming_client_module/CMakeLists.txt b/modules/websocket_streaming_client_module/CMakeLists.txt index 47c6d19..1c531bd 100644 --- a/modules/websocket_streaming_client_module/CMakeLists.txt +++ b/modules/websocket_streaming_client_module/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.10) set_cmake_folder_context(TARGET_FOLDER_NAME) -project(WebsocketStreamingClientModule VERSION ${REPO_VERSION} LANGUAGES C CXX) +project(WebsocketStreamingClientModule VERSION ${${REPO_OPTION_PREFIX}_VERSION} LANGUAGES C CXX) if (MSVC) # loss of data / precision, unsigned <--> signed @@ -16,6 +16,6 @@ endif() add_subdirectory(src) -if (${REPO_OPTION_PREFIX}_ENABLE_TESTS) +if (${REPO_OPTION_PREFIX}_BUILDING_AS_SUBMODULE AND OPENDAQ_ENABLE_TESTS OR ${REPO_OPTION_PREFIX}_ENABLE_TESTS) add_subdirectory(tests) -endif() +endif() \ No newline at end of file diff --git a/modules/websocket_streaming_server_module/CMakeLists.txt b/modules/websocket_streaming_server_module/CMakeLists.txt index 68e1562..ffe8b52 100644 --- a/modules/websocket_streaming_server_module/CMakeLists.txt +++ b/modules/websocket_streaming_server_module/CMakeLists.txt @@ -1,9 +1,9 @@ cmake_minimum_required(VERSION 3.10) set_cmake_folder_context(TARGET_FOLDER_NAME) -project(WebsocketStreamingServerModule VERSION ${REPO_VERSION} LANGUAGES CXX) +project(WebsocketStreamingServerModule VERSION ${${REPO_OPTION_PREFIX}_VERSION} LANGUAGES CXX) add_subdirectory(src) -if (${REPO_OPTION_PREFIX}_ENABLE_TESTS) +if (${REPO_OPTION_PREFIX}_BUILDING_AS_SUBMODULE AND OPENDAQ_ENABLE_TESTS OR ${REPO_OPTION_PREFIX}_ENABLE_TESTS) add_subdirectory(tests) endif() diff --git a/opendaq_version b/opendaq_version deleted file mode 100644 index fdb94d0..0000000 --- a/opendaq_version +++ /dev/null @@ -1 +0,0 @@ -3.31.0 \ No newline at end of file From e68ab02270d2a43da9b022be19485e1ced9d9126 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 15 Jan 2026 19:26:27 +0100 Subject: [PATCH 39/49] Import siggen integration tests --- CMakeLists.txt | 5 ++++- external/streaming_protocol/CMakeLists.txt | 2 +- shared/libraries/CMakeLists.txt | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d515d77..e495028 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,10 @@ if (NOT ${REPO_OPTION_PREFIX}_BUILDING_AS_SUBMODULE) endif() if (${REPO_OPTION_PREFIX}_BUILDING_AS_SUBMODULE AND OPENDAQ_ENABLE_TESTS OR ${REPO_OPTION_PREFIX}_ENABLE_TESTS) -# add_subdirectory(tests) + if (NOT APPLE AND UNIX) + option(${REPO_OPTION_PREFIX}_ENABLE_SIGGEN_INTEGRATION_TESTS "Enable websocket streaming integration tests" ON) + endif() + add_subdirectory(tests) endif() if (${REPO_OPTION_PREFIX}_ENABLE_EXAMPLE_APP) diff --git a/external/streaming_protocol/CMakeLists.txt b/external/streaming_protocol/CMakeLists.txt index 0c2ad00..104be8b 100644 --- a/external/streaming_protocol/CMakeLists.txt +++ b/external/streaming_protocol/CMakeLists.txt @@ -1,6 +1,6 @@ set(STREAMING_PROTOCOL_ALWAYS_FETCH_DEPS ON CACHE BOOL "" FORCE) -if (OPENDAQ_ENABLE_WS_SIGGEN_INTEGRATION_TESTS) +if (${REPO_OPTION_PREFIX}_ENABLE_SIGGEN_INTEGRATION_TESTS) set(STREAMING_PROTOCOL_TOOLS ON CACHE BOOL "" FORCE) endif() diff --git a/shared/libraries/CMakeLists.txt b/shared/libraries/CMakeLists.txt index a493c0f..7f50d04 100644 --- a/shared/libraries/CMakeLists.txt +++ b/shared/libraries/CMakeLists.txt @@ -1,3 +1,3 @@ -set_cmake_context() +set_cmake_folder_context(TARGET_FOLDER_NAME) add_subdirectory(websocket_streaming) From 7470ae84d3131f65bd4fe3833b74042b0903b5e9 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 15 Jan 2026 19:57:14 +0100 Subject: [PATCH 40/49] Fix cmake utils target name --- cmake/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index ed79840..de859f0 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -3,12 +3,12 @@ set(CMAKE_FOLDER "cmake") list(APPEND CMAKE_MESSAGE_CONTEXT cmake) set(CURR_MESSAGE_CONTEXT ${CMAKE_MESSAGE_CONTEXT}) -message(STATUS "Import functions and macro from opendaq_cmake_utils repo") +message(STATUS "Import functions and macro from opendaq-cmake-utils repo") include(FetchContent) FetchContent_Declare( - opendaq_cmake_utils + opendaq-cmake-utils GIT_REPOSITORY https://github.com/openDAQ/opendaq-cmake-utils.git GIT_TAG main GIT_PROGRESS ON ) -FetchContent_MakeAvailable(opendaq_cmake_utils) +FetchContent_MakeAvailable(opendaq-cmake-utils) From 11b59c0fc22c5098320260e0a3e35f3cc2d63e48 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 15 Jan 2026 19:59:23 +0100 Subject: [PATCH 41/49] Add missing files --- tests/CMakeLists.txt | 14 ++ .../test_ws_siggen_integration/CMakeLists.txt | 41 +++++ .../siggen_config.json | 36 +++++ tests/test_ws_siggen_integration/test_app.cpp | 20 +++ .../test_websocket_siggen.cpp | 145 ++++++++++++++++++ 5 files changed, 256 insertions(+) create mode 100644 tests/CMakeLists.txt create mode 100644 tests/test_ws_siggen_integration/CMakeLists.txt create mode 100644 tests/test_ws_siggen_integration/siggen_config.json create mode 100644 tests/test_ws_siggen_integration/test_app.cpp create mode 100644 tests/test_ws_siggen_integration/test_websocket_siggen.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..12edb09 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,14 @@ +set_cmake_folder_context(TARGET_FOLDER_NAME) + +if (MSVC) + add_compile_options(/wd4100) +endif() + +if (POLICY CMP0077) + cmake_policy(SET CMP0077 NEW) +endif() + +if (${REPO_OPTION_PREFIX}_ENABLE_SIGGEN_INTEGRATION_TESTS) + message(STATUS "Websocket streaming signal generator tool integration test app") + add_subdirectory(test_ws_siggen_integration) +endif() diff --git a/tests/test_ws_siggen_integration/CMakeLists.txt b/tests/test_ws_siggen_integration/CMakeLists.txt new file mode 100644 index 0000000..6512ed9 --- /dev/null +++ b/tests/test_ws_siggen_integration/CMakeLists.txt @@ -0,0 +1,41 @@ +set(TEST_APP test_siggen_integration) + +set(TEST_SOURCES test_websocket_siggen.cpp + test_app.cpp +) + +add_executable(${TEST_APP} ${TEST_SOURCES} +) + +target_link_libraries(${TEST_APP} PRIVATE daq::opendaq_test_utils gtest + daq::opendaq +) + +add_dependencies(${TEST_APP} daq::ws_stream_cl_module + siggen2websocket + siggen2socket +) + +find_program(BASH_PROGRAM bash) +if(BASH_PROGRAM) + message(STATUS "Bash found - add siggen test") + set(TEST_SCRIPT "\ + $ 7413 ${CMAKE_CURRENT_SOURCE_DIR}/siggen_config.json 1>/tmp/siggen2websocket_output 2>/tmp/siggen2websocket_output 0 7411 ${CMAKE_CURRENT_SOURCE_DIR}/siggen_config.json 1>/tmp/siggen2socket_output 2>/tmp/siggen2socket_output 0; \ + EXIT_CODE=$?; \ + killall siggen2websocket; \ + killall siggen2socket; \ + echo \"\nsiggen2websocket output:\n\n$() diff --git a/tests/test_ws_siggen_integration/siggen_config.json b/tests/test_ws_siggen_integration/siggen_config.json new file mode 100644 index 0000000..efec808 --- /dev/null +++ b/tests/test_ws_siggen_integration/siggen_config.json @@ -0,0 +1,36 @@ +{ + "signals" : { + "Signal1_Sync" : { + "dataType" : "real64", + "function" : "impulse", + "amplitude" : 5, + "offset" : 0, + "frequency" : 2, + "samplePeriod" : "10ms", + "explicitTime": false, + "range" : { + "low" : -15, + "high" : 15 + } + }, + "Signal2_Sync_PostScaling" : { + "dataType" : "int32", + "function" : "impulse", + "amplitude" : 5, + "offset" : 0, + "frequency" : 2, + "samplePeriod" : "10ms", + "explicitTime": false, + "range" : { + "low" : -15, + "high" : 15 + }, + "postScaling" : { + "scale" : 2, + "offset" : 5 + } + } + }, + "executionTime": "100s", + "processPeriod": "100ms" +} diff --git a/tests/test_ws_siggen_integration/test_app.cpp b/tests/test_ws_siggen_integration/test_app.cpp new file mode 100644 index 0000000..292c06a --- /dev/null +++ b/tests/test_ws_siggen_integration/test_app.cpp @@ -0,0 +1,20 @@ +#include +#include +#include +#include + +int main(int argc, char** args) +{ + daq::daqInitializeCoreObjectsTesting(); + daqInitModuleManagerLibrary(); + daqInitOpenDaqLibrary(); + + testing::InitGoogleTest(&argc, args); + + testing::TestEventListeners& listeners = testing::UnitTest::GetInstance()->listeners(); + listeners.Append(new DaqMemCheckListener()); + + auto res = RUN_ALL_TESTS(); + + return res; +} diff --git a/tests/test_ws_siggen_integration/test_websocket_siggen.cpp b/tests/test_ws_siggen_integration/test_websocket_siggen.cpp new file mode 100644 index 0000000..49e56a0 --- /dev/null +++ b/tests/test_ws_siggen_integration/test_websocket_siggen.cpp @@ -0,0 +1,145 @@ +#include +#include +#include "testutils/memcheck_listener.h" +#include +#include + +using SiggenTest = testing::TestWithParam; + +using namespace daq; + +static InstancePtr CreateClientInstance(std::string connectionString) +{ + auto instance = Instance(); + auto refDevice = instance.addDevice(connectionString); + return instance; +} + +// signals configuration is set by "siggen_config.json" + +TEST_P(SiggenTest, ConnectAndDisconnect) +{ + auto client = CreateClientInstance(GetParam()); +} + +TEST_P(SiggenTest, GetRemoteDeviceObjects) +{ + auto client = CreateClientInstance(GetParam()); + + ASSERT_EQ(client.getDevices().getCount(), 1u); + auto signals = client.getSignalsRecursive(); + ASSERT_EQ(signals.getCount(), 4u); +} + +TEST_P(SiggenTest, SyncSignalDescriptors) +{ + auto client = CreateClientInstance(GetParam()); + + auto signal = client.getSignalsRecursive()[0]; + + EXPECT_EQ(signal.getLocalId(), "Signal1_Sync"); + + DataDescriptorPtr dataDescriptor = signal.getDescriptor(); + DataDescriptorPtr domainDescriptor = signal.getDomainSignal().getDescriptor(); + + EXPECT_EQ(signal.getName(), "value"); + + EXPECT_EQ(dataDescriptor.getSampleType(), SampleType::Float64); + EXPECT_EQ(dataDescriptor.getRule().getType(), DataRuleType::Explicit); + EXPECT_EQ(dataDescriptor.getValueRange(), Range(-15, 15)); + + EXPECT_FALSE(dataDescriptor.getPostScaling().assigned()); + + EXPECT_EQ(dataDescriptor.getDimensions().getCount(), 0u); + EXPECT_EQ(dataDescriptor.getMetadata().getCount(), 0u); + EXPECT_FALSE(dataDescriptor.getUnit().assigned()); + + EXPECT_EQ(domainDescriptor.getRule().getType(), DataRuleType::Linear); + EXPECT_EQ(domainDescriptor.getUnit().getSymbol(), "s"); + EXPECT_EQ(domainDescriptor.getUnit().getQuantity(), "time"); + EXPECT_NE(domainDescriptor.getOrigin(), ""); + EXPECT_NE(domainDescriptor.getTickResolution().getNumerator(), 0); + EXPECT_NE(domainDescriptor.getTickResolution().getDenominator(), 0); +} + +TEST_P(SiggenTest, SyncPostScalingSignalDescriptors) +{ + auto client = CreateClientInstance(GetParam()); + + auto signal = client.getSignalsRecursive()[1]; + + EXPECT_EQ(signal.getLocalId(), "Signal2_Sync_PostScaling"); + + DataDescriptorPtr dataDescriptor = signal.getDescriptor(); + DataDescriptorPtr domainDescriptor = signal.getDomainSignal().getDescriptor(); + + EXPECT_EQ(signal.getName(), "value"); + + EXPECT_EQ(dataDescriptor.getSampleType(), SampleType::Float64); + EXPECT_EQ(dataDescriptor.getRule().getType(), DataRuleType::Explicit); + EXPECT_EQ(dataDescriptor.getValueRange(), Range(-15, 15)); + + ASSERT_TRUE(dataDescriptor.getPostScaling().assigned()); + EXPECT_EQ(dataDescriptor.getPostScaling().getParameters().get("scale"), 2); + EXPECT_EQ(dataDescriptor.getPostScaling().getParameters().get("offset"), 5); + + EXPECT_EQ(dataDescriptor.getDimensions().getCount(), 0u); + EXPECT_EQ(dataDescriptor.getMetadata().getCount(), 0u); + EXPECT_FALSE(dataDescriptor.getUnit().assigned()); + + EXPECT_EQ(domainDescriptor.getRule().getType(), DataRuleType::Linear); + EXPECT_EQ(domainDescriptor.getUnit().getSymbol(), "s"); + EXPECT_EQ(domainDescriptor.getUnit().getQuantity(), "time"); + EXPECT_NE(domainDescriptor.getOrigin(), ""); + EXPECT_NE(domainDescriptor.getTickResolution().getNumerator(), 0); + EXPECT_NE(domainDescriptor.getTickResolution().getDenominator(), 0); +} + +TEST_P(SiggenTest, DISABLED_AsyncSignalDescriptors) +{ + auto client = CreateClientInstance(GetParam()); + + auto signal = client.getSignalsRecursive()[2]; + + EXPECT_EQ(signal.getLocalId(), "Signal2_Async"); + + DataDescriptorPtr dataDescriptor = signal.getDescriptor(); + DataDescriptorPtr domainDescriptor = signal.getDomainSignal().getDescriptor(); + + EXPECT_EQ(signal.getName(), "value"); + + EXPECT_EQ(dataDescriptor.getSampleType(), SampleType::Float64); + EXPECT_EQ(dataDescriptor.getRule().getType(), DataRuleType::Explicit); + EXPECT_EQ(dataDescriptor.getValueRange(), Range(-15, 15)); + + EXPECT_EQ(dataDescriptor.getDimensions().getCount(), 0u); + EXPECT_EQ(dataDescriptor.getMetadata().getCount(), 0u); + EXPECT_FALSE(dataDescriptor.getUnit().assigned()); + + EXPECT_EQ(domainDescriptor.getRule().getType(), DataRuleType::Explicit); + EXPECT_EQ(domainDescriptor.getUnit().getSymbol(), "s"); + EXPECT_EQ(domainDescriptor.getUnit().getQuantity(), "time"); + EXPECT_NE(domainDescriptor.getOrigin(), ""); + EXPECT_NE(domainDescriptor.getTickResolution().getNumerator(), 0); + EXPECT_NE(domainDescriptor.getTickResolution().getDenominator(), 0); +} + +TEST_P(SiggenTest, DISABLED_RenderSignals) +{ + auto client = CreateClientInstance(GetParam()); + + const auto rendererFb = client.addFunctionBlock("RefFBModuleRenderer"); + + rendererFb.getInputPorts()[0].connect(client.getSignalsRecursive()[0]); + rendererFb.getInputPorts()[1].connect(client.getSignalsRecursive()[1]); + + std::this_thread::sleep_for(std::chrono::milliseconds(5000)); +} + +INSTANTIATE_TEST_SUITE_P( + SiggenTestGroup, + SiggenTest, + testing::Values( + "daq.lt://127.0.0.1:7413/" + ) + ); From 5a2fbf9fa2ec061497a8e78738ebd5035549f59e Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Mon, 26 Jan 2026 08:23:24 +0100 Subject: [PATCH 42/49] Rework to use more opendaq cmake util calls --- CMakeLists.txt | 50 +++-------------------------------- external/Boost.cmake | 4 +++ external/CMakeLists.txt | 23 ++-------------- external/boost/CMakeLists.txt | 4 --- external/gtest/CMakeLists.txt | 30 --------------------- 5 files changed, 9 insertions(+), 102 deletions(-) create mode 100644 external/Boost.cmake delete mode 100644 external/boost/CMakeLists.txt delete mode 100644 external/gtest/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index e495028..35c0608 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,54 +2,10 @@ set(CMAKE_POLICY_VERSION_MINIMUM 3.5) cmake_minimum_required(VERSION 3.25) # set project variables -set(REPO_NAME LtStreamingModulesModern) +set(REPO_NAME LtStreamingModulesLegacy) set(REPO_OPTION_PREFIX DAQMODULES_LT_STREAMING) add_subdirectory(cmake) -setup_repo_version("${REPO_OPTION_PREFIX}" ${REPO_NAME} "module_version") -if (NOT DEFINED ${REPO_OPTION_PREFIX}_VERSION AND DEFINED OPENDAQ_PACKAGE_VERSION) - set(${REPO_OPTION_PREFIX}_VERSION ${OPENDAQ_PACKAGE_VERSION}) -endif() - -project(${REPO_NAME} VERSION ${${REPO_OPTION_PREFIX}_VERSION} LANGUAGES CXX) - -setup_build_mode(${REPO_OPTION_PREFIX} ${REPO_NAME}) -if (NOT ${REPO_OPTION_PREFIX}_BUILDING_AS_SUBMODULE) - setup_repo(${REPO_OPTION_PREFIX}) -endif() - -add_subdirectory(external) - -if (NOT DEFINED OPENDAQ_SDK_NAME) - set(OPENDAQ_SDK_NAME openDAQ) -endif() - -if (NOT DEFINED OPENDAQ_SDK_TARGET_NAME) - set(OPENDAQ_SDK_TARGET_NAME opendaq) -endif() - -if (NOT DEFINED OPENDAQ_SDK_TARGET_NAMESPACE) - set(OPENDAQ_SDK_TARGET_NAMESPACE daq) -endif() - -add_subdirectory(shared) -add_subdirectory(modules) - -if (NOT ${REPO_OPTION_PREFIX}_BUILDING_AS_SUBMODULE) - # fetch boost at latest point when list of required boost libs and headers is completed - opendaq_setup_boost() -endif() - -if (${REPO_OPTION_PREFIX}_BUILDING_AS_SUBMODULE AND OPENDAQ_ENABLE_TESTS OR ${REPO_OPTION_PREFIX}_ENABLE_TESTS) - if (NOT APPLE AND UNIX) - option(${REPO_OPTION_PREFIX}_ENABLE_SIGGEN_INTEGRATION_TESTS "Enable websocket streaming integration tests" ON) - endif() - add_subdirectory(tests) -endif() - -if (${REPO_OPTION_PREFIX}_ENABLE_EXAMPLE_APP) -# add_subdirectory(examples) -endif() - -#add_subdirectory(docs) # FIXME no docs infrastructure to be handled by cmake +setup_module_project(${REPO_OPTION_PREFIX} ${REPO_NAME}) +setup_module_subfolders(${REPO_OPTION_PREFIX} ${REPO_NAME}) diff --git a/external/Boost.cmake b/external/Boost.cmake new file mode 100644 index 0000000..2e86169 --- /dev/null +++ b/external/Boost.cmake @@ -0,0 +1,4 @@ +opendaq_add_required_boost_libs( + asio + beast +) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 8475e7b..9f7795e 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -1,27 +1,8 @@ set(CMAKE_FOLDER external) list(APPEND CMAKE_MESSAGE_CONTEXT external) -if (NOT ${REPO_OPTION_PREFIX}_BUILDING_AS_SUBMODULE) - set(OPENDAQ_REF "main") +setup_module_default_dependencies(${REPO_OPTION_PREFIX}) - set(OPENDAQ_REF_FILE "${CMAKE_CURRENT_LIST_DIR}/opendaq_ref") - if (EXISTS "${OPENDAQ_REF_FILE}") - file(READ "${OPENDAQ_REF_FILE}" FILE_CONTENT) - string(STRIP "${FILE_CONTENT}" FILE_CONTENT) - if (FILE_CONTENT) - set(OPENDAQ_REF "${FILE_CONTENT}") - endif() - endif() - - resolve_opendaq_dependency("${OPENDAQ_REF}") -endif() - -suppress_ext_lib_warnings() -if (NOT ${REPO_OPTION_PREFIX}_BUILDING_AS_SUBMODULE AND ${REPO_OPTION_PREFIX}_ENABLE_TESTS) - add_subdirectory(gtest) -endif() - -add_subdirectory(boost) add_subdirectory(spdlog EXCLUDE_FROM_ALL) add_subdirectory(nlohmann_json) -add_subdirectory(streaming_protocol) \ No newline at end of file +add_subdirectory(streaming_protocol) diff --git a/external/boost/CMakeLists.txt b/external/boost/CMakeLists.txt deleted file mode 100644 index ea43791..0000000 --- a/external/boost/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ - opendaq_add_required_boost_libs( - asio - beast - ) diff --git a/external/gtest/CMakeLists.txt b/external/gtest/CMakeLists.txt deleted file mode 100644 index 273b1b7..0000000 --- a/external/gtest/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -set_cmake_folder_context(TARGET_FOLDER_NAME) - -if (NOT TARGET gtest) - set(GTest_REQUIREDVERSION "1.12.1") - - find_package(GTest GLOBAL ${GTest_REQUIREDVERSION}) - if(GTest_FOUND) - message(STATUS "Found GTest: ${GTest_VERSION} ${GTest_CONFIG}") - else() - message(STATUS "Fetching GTest version ${GTest_REQUIREDVERSION}") - - include(FetchContent) - get_custom_fetch_content_params(GTest FC_PARAMS) - - set(GTest_WITH_POST_BUILD_UNITTEST OFF) - set(GTest_WITH_TESTS OFF) - - set(BUILD_GMOCK OFF) - set(INSTALL_GTEST OFF) - set(gtest_force_shared_crt ON) - FetchContent_Declare( - GTest - URL https://github.com/google/googletest/archive/release-${GTest_REQUIREDVERSION}.zip - URL_HASH SHA256=24564e3b712d3eb30ac9a85d92f7d720f60cc0173730ac166f27dda7fed76cb2 - ${FC_PARAMS} - ) - - FetchContent_MakeAvailable(GTest) - endif() -endif() From 95b77e27b6e0bd9ac2e360b15ed3e45f8b69ec39 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Mon, 26 Jan 2026 08:45:01 +0100 Subject: [PATCH 43/49] Add dependent options --- cmake/ModuleOptions.cmake | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 cmake/ModuleOptions.cmake diff --git a/cmake/ModuleOptions.cmake b/cmake/ModuleOptions.cmake new file mode 100644 index 0000000..44dfa06 --- /dev/null +++ b/cmake/ModuleOptions.cmake @@ -0,0 +1,6 @@ +if(DEFINED DAQMODULES_LT_STREAMING_CMAKE_OPTIONS_INCLUDED) + return() +endif() +set(DAQMODULES_LT_STREAMING_CMAKE_OPTIONS_INCLUDED TRUE) + +cmake_dependent_option(DAQMODULES_LT_STREAMING_ENABLE_SIGGEN_INTEGRATION_TESTS "Enable websocket streaming integration tests" ON "OPENDAQ_ENABLE_TESTS;OPENDAQ_ENABLE_WEBSOCKET_STREAMING" OFF) From e53e1b07636e91c02029fd46298a6e57586e456d Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Mon, 26 Jan 2026 09:22:26 +0100 Subject: [PATCH 44/49] Use prefixed cmake utils manes --- CMakeLists.txt | 4 ++-- external/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 35c0608..6e35776 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,5 +7,5 @@ set(REPO_OPTION_PREFIX DAQMODULES_LT_STREAMING) add_subdirectory(cmake) -setup_module_project(${REPO_OPTION_PREFIX} ${REPO_NAME}) -setup_module_subfolders(${REPO_OPTION_PREFIX} ${REPO_NAME}) +opendaq_setup_module_project(${REPO_OPTION_PREFIX} ${REPO_NAME}) +opendaq_setup_module_subfolders(${REPO_OPTION_PREFIX} ${REPO_NAME}) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 9f7795e..f53d83a 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -1,7 +1,7 @@ set(CMAKE_FOLDER external) list(APPEND CMAKE_MESSAGE_CONTEXT external) -setup_module_default_dependencies(${REPO_OPTION_PREFIX}) +opendaq_setup_module_default_dependencies(${REPO_OPTION_PREFIX}) add_subdirectory(spdlog EXCLUDE_FROM_ALL) add_subdirectory(nlohmann_json) From 518f4d2ca5a0b2d9e6337b8fd04ee0b29ea2b71f Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 29 Jan 2026 14:04:15 +0100 Subject: [PATCH 45/49] Fix dependent option --- cmake/ModuleOptions.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmake/ModuleOptions.cmake b/cmake/ModuleOptions.cmake index 44dfa06..664ffd9 100644 --- a/cmake/ModuleOptions.cmake +++ b/cmake/ModuleOptions.cmake @@ -1,6 +1,12 @@ if(DEFINED DAQMODULES_LT_STREAMING_CMAKE_OPTIONS_INCLUDED) - return() + return() endif() set(DAQMODULES_LT_STREAMING_CMAKE_OPTIONS_INCLUDED TRUE) -cmake_dependent_option(DAQMODULES_LT_STREAMING_ENABLE_SIGGEN_INTEGRATION_TESTS "Enable websocket streaming integration tests" ON "OPENDAQ_ENABLE_TESTS;OPENDAQ_ENABLE_WEBSOCKET_STREAMING" OFF) +cmake_dependent_option( + DAQMODULES_LT_STREAMING_ENABLE_SIGGEN_INTEGRATION_TESTS + "Enable websocket streaming integration tests" + ON + "OPENDAQ_ENABLE_TESTS AND DAQMODULES_LT_STREAMING_BUILDING_AS_SUBMODULE OR DAQMODULES_LT_STREAMING_ENABLE_TESTS AND NOT DAQMODULES_LT_STREAMING_BUILDING_AS_SUBMODULE" + OFF +) From 70222a9462fb3ce5605d758c2c404a9724a7ae6b Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 29 Jan 2026 14:14:48 +0100 Subject: [PATCH 46/49] Restore tests depending on mocks --- .../tests/streaming_test_helpers.h | 21 +++++++++++++-- .../test_signal_descriptor_converter.cpp | 4 ++- .../tests/test_websocket_client_device.cpp | 27 +++++++++++++++++++ 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/shared/libraries/websocket_streaming/tests/streaming_test_helpers.h b/shared/libraries/websocket_streaming/tests/streaming_test_helpers.h index c8b1e11..484e3a4 100644 --- a/shared/libraries/websocket_streaming/tests/streaming_test_helpers.h +++ b/shared/libraries/websocket_streaming/tests/streaming_test_helpers.h @@ -17,6 +17,9 @@ #pragma once #include +#include +#include +#include #include #include #include @@ -25,7 +28,7 @@ #include #include #include -#include +#include #include "streaming_protocol/Unit.hpp" // MAC CI issue @@ -41,7 +44,21 @@ namespace streaming_test_helpers { inline daq::InstancePtr createServerInstance() { - return daq::Instance(); + const auto moduleManager = daq::ModuleManager("[[none]]"); + const auto authenticationProvider = daq::AuthenticationProvider(); + auto context = Context(nullptr, daq::Logger(), daq::TypeManager(), moduleManager, authenticationProvider); + const daq::ModulePtr deviceModule(MockDeviceModule_Create(context)); + moduleManager.addModule(deviceModule); + + const daq::ModulePtr fbModule(MockFunctionBlockModule_Create(context)); + moduleManager.addModule(fbModule); + + auto instance = InstanceCustom(context, "localInstance"); + instance.addDevice("daqmock://client_device"); + instance.addDevice("daqmock://phys_device"); + instance.addFunctionBlock("mock_fb_uid"); + + return instance; } inline daq::SignalPtr createLinearTimeSignal(const daq::ContextPtr& ctx) diff --git a/shared/libraries/websocket_streaming/tests/test_signal_descriptor_converter.cpp b/shared/libraries/websocket_streaming/tests/test_signal_descriptor_converter.cpp index 4b2ec6a..cd303ce 100644 --- a/shared/libraries/websocket_streaming/tests/test_signal_descriptor_converter.cpp +++ b/shared/libraries/websocket_streaming/tests/test_signal_descriptor_converter.cpp @@ -48,7 +48,9 @@ class DummayWriter : public bsp::iWriter virtual std::string id() const override { - return "0"; + static unsigned int id = 0; + return std::to_string(id); + ++id; } std::vector> metaInformations; diff --git a/shared/libraries/websocket_streaming/tests/test_websocket_client_device.cpp b/shared/libraries/websocket_streaming/tests/test_websocket_client_device.cpp index 07e769b..6d00ead 100644 --- a/shared/libraries/websocket_streaming/tests/test_websocket_client_device.cpp +++ b/shared/libraries/websocket_streaming/tests/test_websocket_client_device.cpp @@ -732,3 +732,30 @@ TEST_P(UnsupportedSignalsTestP, MakeDomainSignalSupported) INSTANTIATE_TEST_SUITE_P(UnsupportedSignalsTest, UnsupportedSignalsTestP, testing::Values(nullptr, DataDescriptorBuilder().setSampleType(daq::SampleType::Invalid).build())); + +TEST_F(WebsocketClientDeviceTest, DeviceWithMultipleSignals) +{ + // Create server side device + auto serverInstance = streaming_test_helpers::createServerInstance(); + + // Setup and start streaming server + auto server = WebsocketStreamingServer(serverInstance); + server.setStreamingPort(STREAMING_PORT); + server.setControlPort(CONTROL_PORT); + server.start(); + + // Create the client device + auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST); + + // There should not be any difference if we get signals recursively or not, + // since client device doesn't know anything about hierarchy + size_t expectedSignalCount = 0; + for (const auto& signal : serverInstance.getSignals(search::Recursive(search::Visible()))) + expectedSignalCount += signal.getPublic(); + + ListPtr signals; + ASSERT_NO_THROW(signals = clientDevice.getSignals()); + ASSERT_EQ(signals.getCount(), expectedSignalCount); + ASSERT_NO_THROW(signals = clientDevice.getSignals(search::Recursive(search::Visible()))); + ASSERT_EQ(signals.getCount(), expectedSignalCount); +} From 4d2f1f1009fd63deeffda4a9b9cacd56024e9baa Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 29 Jan 2026 14:16:10 +0100 Subject: [PATCH 47/49] Migrate changes made in openDAQ/openDAQ#1037 --- ...websocket_streaming_client_module_impl.cpp | 4 ++- .../websocket_client_device_factory.h | 5 +-- .../websocket_client_device_impl.h | 4 ++- .../src/websocket_client_device_impl.cpp | 8 +++-- .../tests/streaming_test_helpers.h | 2 +- .../tests/test_websocket_client_device.cpp | 33 +++++++++++-------- 6 files changed, 36 insertions(+), 20 deletions(-) diff --git a/modules/websocket_streaming_client_module/src/websocket_streaming_client_module_impl.cpp b/modules/websocket_streaming_client_module/src/websocket_streaming_client_module_impl.cpp index 26d2bbb..0a9617d 100644 --- a/modules/websocket_streaming_client_module/src/websocket_streaming_client_module_impl.cpp +++ b/modules/websocket_streaming_client_module/src/websocket_streaming_client_module_impl.cpp @@ -90,7 +90,9 @@ DevicePtr WebsocketStreamingClientModule::onCreateDevice(const StringPtr& connec std::scoped_lock lock(sync); std::string localId = fmt::format("websocket_pseudo_device{}", deviceIndex++); - auto device = WebsocketClientDevice(context, parent, localId, strPtr); + auto deviceType = createWebsocketDeviceType(false); + checkErrorInfo(deviceType.asPtr()->setModuleInfo(moduleInfo)); + auto device = WebsocketClientDevice(context, parent, localId, strPtr, deviceType); // Set the connection info for the device auto host = String(""); diff --git a/shared/libraries/websocket_streaming/include/websocket_streaming/websocket_client_device_factory.h b/shared/libraries/websocket_streaming/include/websocket_streaming/websocket_client_device_factory.h index 183082c..4b7fa34 100644 --- a/shared/libraries/websocket_streaming/include/websocket_streaming/websocket_client_device_factory.h +++ b/shared/libraries/websocket_streaming/include/websocket_streaming/websocket_client_device_factory.h @@ -23,9 +23,10 @@ BEGIN_NAMESPACE_OPENDAQ_WEBSOCKET_STREAMING inline DevicePtr WebsocketClientDevice(const ContextPtr& context, const ComponentPtr& parent, const StringPtr& localId, - const StringPtr& connectionString) + const StringPtr& connectionString, + const DeviceTypePtr& type) { - DevicePtr obj(createWithImplementation(context, parent, localId, connectionString)); + DevicePtr obj(createWithImplementation(context, parent, localId, connectionString, type)); return obj; } diff --git a/shared/libraries/websocket_streaming/include/websocket_streaming/websocket_client_device_impl.h b/shared/libraries/websocket_streaming/include/websocket_streaming/websocket_client_device_impl.h index f0fa615..92dcd3b 100644 --- a/shared/libraries/websocket_streaming/include/websocket_streaming/websocket_client_device_impl.h +++ b/shared/libraries/websocket_streaming/include/websocket_streaming/websocket_client_device_impl.h @@ -28,7 +28,8 @@ class WebsocketClientDeviceImpl : public Device explicit WebsocketClientDeviceImpl(const ContextPtr& ctx, const ComponentPtr& parent, const StringPtr& localId, - const StringPtr& connectionString); + const StringPtr& connectionString, + const DeviceTypePtr& type); protected: void removed() override; @@ -49,6 +50,7 @@ class WebsocketClientDeviceImpl : public Device std::unordered_map deviceSignals; std::vector orderedSignalIds; StringPtr connectionString; + DeviceTypePtr deviceType; StreamingPtr websocketStreaming; }; diff --git a/shared/libraries/websocket_streaming/src/websocket_client_device_impl.cpp b/shared/libraries/websocket_streaming/src/websocket_client_device_impl.cpp index fb09862..287c971 100644 --- a/shared/libraries/websocket_streaming/src/websocket_client_device_impl.cpp +++ b/shared/libraries/websocket_streaming/src/websocket_client_device_impl.cpp @@ -12,9 +12,11 @@ BEGIN_NAMESPACE_OPENDAQ_WEBSOCKET_STREAMING WebsocketClientDeviceImpl::WebsocketClientDeviceImpl(const ContextPtr& ctx, const ComponentPtr& parent, const StringPtr& localId, - const StringPtr& connectionString) + const StringPtr& connectionString, + const DeviceTypePtr& type) : Device(ctx, parent, localId) , connectionString(connectionString) + , deviceType(type) { if (!this->connectionString.assigned()) DAQ_THROW_EXCEPTION(ArgumentNullException, "connectionString cannot be null"); @@ -31,7 +33,9 @@ void WebsocketClientDeviceImpl::removed() DeviceInfoPtr WebsocketClientDeviceImpl::onGetInfo() { - return DeviceInfo(connectionString, "WebsocketClientPseudoDevice"); + auto info = DeviceInfo(connectionString, "WebsocketClientPseudoDevice"); + info.setDeviceType(deviceType); + return info; } void WebsocketClientDeviceImpl::activateStreaming() diff --git a/shared/libraries/websocket_streaming/tests/streaming_test_helpers.h b/shared/libraries/websocket_streaming/tests/streaming_test_helpers.h index 484e3a4..63a9014 100644 --- a/shared/libraries/websocket_streaming/tests/streaming_test_helpers.h +++ b/shared/libraries/websocket_streaming/tests/streaming_test_helpers.h @@ -54,7 +54,7 @@ namespace streaming_test_helpers moduleManager.addModule(fbModule); auto instance = InstanceCustom(context, "localInstance"); - instance.addDevice("daqmock://client_device"); + instance.addDevice("daq.root://default_client"); instance.addDevice("daqmock://phys_device"); instance.addFunctionBlock("mock_fb_uid"); diff --git a/shared/libraries/websocket_streaming/tests/test_websocket_client_device.cpp b/shared/libraries/websocket_streaming/tests/test_websocket_client_device.cpp index 6d00ead..7c23803 100644 --- a/shared/libraries/websocket_streaming/tests/test_websocket_client_device.cpp +++ b/shared/libraries/websocket_streaming/tests/test_websocket_client_device.cpp @@ -20,10 +20,17 @@ class WebsocketClientDeviceTest : public testing::Test const uint16_t CONTROL_PORT = daq::streaming_protocol::HTTP_CONTROL_PORT; const std::string HOST = "127.0.0.1"; ContextPtr context; + DeviceTypePtr deviceType; void SetUp() override { context = NullContext(); + deviceType = DeviceTypeBuilder() + .setId("OpenDAQLTStreaming") + .setName("Streaming LT enabled pseudo-device") + .setDescription("Pseudo device, provides only signals of the remote device as flat list") + .setConnectionStringPrefix("daq.lt") + .build(); } void TearDown() override @@ -33,7 +40,7 @@ class WebsocketClientDeviceTest : public testing::Test TEST_F(WebsocketClientDeviceTest, CreateWithInvalidParameters) { - ASSERT_THROW(WebsocketClientDevice(context, nullptr, "device", nullptr), ArgumentNullException); + ASSERT_THROW(WebsocketClientDevice(context, nullptr, "device", nullptr, deviceType), ArgumentNullException); } TEST_F(WebsocketClientDeviceTest, CreateSuccess) @@ -48,7 +55,7 @@ TEST_F(WebsocketClientDeviceTest, CreateSuccess) server.start(); DevicePtr clientDevice; - ASSERT_NO_THROW(clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST)); + ASSERT_NO_THROW(clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST, deviceType)); } TEST_F(WebsocketClientDeviceTest, DeviceInfo) @@ -63,7 +70,7 @@ TEST_F(WebsocketClientDeviceTest, DeviceInfo) server.start(); // Create the client device - auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST); + auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST, deviceType); // get DeviceInfo and check fields DeviceInfoPtr clientDeviceInfo; @@ -158,7 +165,7 @@ TEST_P(WebsocketClientDeviceTestP, SignalWithDomain) server->start(STREAMING_PORT, CONTROL_PORT); // Create the client device - auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST); + auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST, deviceType); clientDevice.asPtr().enableCoreEventTrigger(); if (signalsAddedAfterConnect) @@ -244,7 +251,7 @@ TEST_P(WebsocketClientDeviceTestP, SingleDomainSignal) server->start(STREAMING_PORT, CONTROL_PORT); // Create the client device - auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST); + auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST, deviceType); clientDevice.asPtr().enableCoreEventTrigger(); if (signalsAddedAfterConnect) @@ -280,7 +287,7 @@ TEST_P(WebsocketClientDeviceTestP, SingleUnsupportedSignal) server->start(STREAMING_PORT, CONTROL_PORT); // Create the client device - auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST); + auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST, deviceType); clientDevice.asPtr().enableCoreEventTrigger(); if (signalsAddedAfterConnect) @@ -317,7 +324,7 @@ TEST_P(WebsocketClientDeviceTestP, SignalsWithSharedDomain) server->start(STREAMING_PORT, CONTROL_PORT); // Create the client device - auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST); + auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST, deviceType); clientDevice.asPtr().enableCoreEventTrigger(); if (signalsAddedAfterConnect) @@ -378,7 +385,7 @@ TEST_F(WebsocketClientDeviceTest, ChangeValueDescriptorToSupported) server->start(STREAMING_PORT, CONTROL_PORT); // Create the client device - auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST); + auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST, deviceType); clientDevice.asPtr().enableCoreEventTrigger(); auto valueSignal = clientDevice.getSignals()[0].asPtr(); @@ -472,7 +479,7 @@ TEST_P(UnsupportedSignalsTestP, MakeValueSignalUnsupported) server->start(STREAMING_PORT, CONTROL_PORT); // Create the client device - auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST); + auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST, deviceType); clientDevice.asPtr().enableCoreEventTrigger(); auto valueSignal = clientDevice.getSignals()[0].asPtr(); @@ -540,7 +547,7 @@ TEST_P(UnsupportedSignalsTestP, MakeDomainSignalUnsupported) server->start(STREAMING_PORT, CONTROL_PORT); // Create the client device - auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST); + auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST, deviceType); clientDevice.asPtr().enableCoreEventTrigger(); auto valueSignal = clientDevice.getSignals()[0].asPtr(); auto domainSignal = clientDevice.getSignals()[1].asPtr(); @@ -613,7 +620,7 @@ TEST_P(UnsupportedSignalsTestP, MakeValueSignalSupported) server->start(STREAMING_PORT, CONTROL_PORT); // Create the client device - auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST); + auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST, deviceType); clientDevice.asPtr().enableCoreEventTrigger(); ASSERT_EQ(clientDevice.getSignals().getCount(), 2u); @@ -680,7 +687,7 @@ TEST_P(UnsupportedSignalsTestP, MakeDomainSignalSupported) server->start(STREAMING_PORT, CONTROL_PORT); // Create the client device - auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST); + auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST, deviceType); clientDevice.asPtr().enableCoreEventTrigger(); ASSERT_EQ(clientDevice.getSignals().getCount(), 2u); @@ -745,7 +752,7 @@ TEST_F(WebsocketClientDeviceTest, DeviceWithMultipleSignals) server.start(); // Create the client device - auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST); + auto clientDevice = WebsocketClientDevice(NullContext(), nullptr, "device", HOST, deviceType); // There should not be any difference if we get signals recursively or not, // since client device doesn't know anything about hierarchy From dac41566dc9ea51ff2c82a55f1a5780b837f2461 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Fri, 30 Jan 2026 11:48:18 +0100 Subject: [PATCH 48/49] Rename prepend cmake utils --- modules/CMakeLists.txt | 2 +- modules/websocket_streaming_client_module/CMakeLists.txt | 2 +- modules/websocket_streaming_client_module/src/CMakeLists.txt | 4 ++-- modules/websocket_streaming_server_module/CMakeLists.txt | 2 +- modules/websocket_streaming_server_module/src/CMakeLists.txt | 4 ++-- shared/CMakeLists.txt | 2 +- shared/libraries/CMakeLists.txt | 2 +- shared/libraries/websocket_streaming/CMakeLists.txt | 2 +- shared/libraries/websocket_streaming/src/CMakeLists.txt | 2 +- tests/CMakeLists.txt | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 02cebeb..214be03 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -1,4 +1,4 @@ -set_cmake_folder_context(TARGET_FOLDER_NAME) +opendaq_set_cmake_folder_context(TARGET_FOLDER_NAME) if (MSVC) add_compile_options(/wd4100) diff --git a/modules/websocket_streaming_client_module/CMakeLists.txt b/modules/websocket_streaming_client_module/CMakeLists.txt index 1c531bd..1d79140 100644 --- a/modules/websocket_streaming_client_module/CMakeLists.txt +++ b/modules/websocket_streaming_client_module/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10) -set_cmake_folder_context(TARGET_FOLDER_NAME) +opendaq_set_cmake_folder_context(TARGET_FOLDER_NAME) project(WebsocketStreamingClientModule VERSION ${${REPO_OPTION_PREFIX}_VERSION} LANGUAGES C CXX) if (MSVC) diff --git a/modules/websocket_streaming_client_module/src/CMakeLists.txt b/modules/websocket_streaming_client_module/src/CMakeLists.txt index ec49e20..8d08b72 100644 --- a/modules/websocket_streaming_client_module/src/CMakeLists.txt +++ b/modules/websocket_streaming_client_module/src/CMakeLists.txt @@ -15,7 +15,7 @@ set(SRC_Srcs module_dll.cpp websocket_streaming_client_module_impl.cpp ) -prepend_include(${TARGET_FOLDER_NAME} SRC_Include) +opendaq_prepend_include(${TARGET_FOLDER_NAME} SRC_Include) source_group("module" FILES ${MODULE_HEADERS_DIR}/websocket_streaming_client_module_impl.h ${MODULE_HEADERS_DIR}/module_dll.h @@ -45,4 +45,4 @@ target_include_directories(${LIB_NAME} PUBLIC $ Date: Fri, 30 Jan 2026 16:09:52 +0100 Subject: [PATCH 49/49] Fix missing dependencies --- shared/libraries/websocket_streaming/tests/CMakeLists.txt | 1 + tests/test_ws_siggen_integration/test_app.cpp | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/shared/libraries/websocket_streaming/tests/CMakeLists.txt b/shared/libraries/websocket_streaming/tests/CMakeLists.txt index afe3f76..254d147 100644 --- a/shared/libraries/websocket_streaming/tests/CMakeLists.txt +++ b/shared/libraries/websocket_streaming/tests/CMakeLists.txt @@ -18,6 +18,7 @@ target_link_libraries(${TEST_APP} PRIVATE ${OPENDAQ_SDK_TARGET_NAMESPACE}::opendaq ${OPENDAQ_SDK_TARGET_NAMESPACE}::streaming_protocol ${OPENDAQ_SDK_TARGET_NAMESPACE}::opendaq_test_utils + ${OPENDAQ_SDK_TARGET_NAMESPACE}::opendaq_mocks gtest ) diff --git a/tests/test_ws_siggen_integration/test_app.cpp b/tests/test_ws_siggen_integration/test_app.cpp index 292c06a..8cf7850 100644 --- a/tests/test_ws_siggen_integration/test_app.cpp +++ b/tests/test_ws_siggen_integration/test_app.cpp @@ -1,14 +1,8 @@ -#include -#include #include #include int main(int argc, char** args) { - daq::daqInitializeCoreObjectsTesting(); - daqInitModuleManagerLibrary(); - daqInitOpenDaqLibrary(); - testing::InitGoogleTest(&argc, args); testing::TestEventListeners& listeners = testing::UnitTest::GetInstance()->listeners();