From 6bf8842ced0f0361eee124eb1ded2baac50e31c7 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Mon, 22 Dec 2025 13:20:28 +0100 Subject: [PATCH 01/18] Add missing project files * remove dependency on mocks and signal generator * add missing link to gtest lib * fix variable names in cmake * remove useless tests --- .clang-format | 62 +++++ .editorconfig | 15 ++ .gitattributes | 3 + .github/workflows/ci.yml | 98 ++++++++ .gitignore | 46 ++++ CMakeLists.txt | 64 +++++ CMakePresets.json | 222 ++++++++++++++++++ LICENSE | 27 +-- cmake/CommonUtils.cmake | 186 +++++++++++++++ external/CMakeLists.txt | 69 ++++++ external/boost/CMakeLists.txt | 92 ++++++++ external/gtest/CMakeLists.txt | 30 +++ modules/CMakeLists.txt | 12 + .../CMakeLists.txt | 10 +- .../src/CMakeLists.txt | 2 +- .../tests/CMakeLists.txt | 4 +- .../tests/test_app.cpp | 7 +- ...test_websocket_streaming_client_module.cpp | 28 --- .../CMakeLists.txt | 10 +- .../src/CMakeLists.txt | 2 +- .../tests/CMakeLists.txt | 14 +- .../tests/test_app.cpp | 9 +- ...test_websocket_streaming_server_module.cpp | 4 - opendaq_version | 1 + repo_version | 1 + shared/CMakeLists.txt | 17 ++ shared/libraries/CMakeLists.txt | 3 + .../websocket_streaming/CMakeLists.txt | 6 +- .../websocket_streaming/src/CMakeLists.txt | 4 +- .../websocket_streaming/tests/CMakeLists.txt | 30 --- .../websocket_streaming/tests/test_app.cpp | 12 - .../tests/test_signal_generator.cpp | 174 -------------- 32 files changed, 939 insertions(+), 325 deletions(-) create mode 100644 .clang-format create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .github/workflows/ci.yml 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/boost/CMakeLists.txt create mode 100644 external/gtest/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 delete mode 100644 shared/libraries/websocket_streaming/tests/CMakeLists.txt delete mode 100644 shared/libraries/websocket_streaming/tests/test_app.cpp delete mode 100644 shared/libraries/websocket_streaming/tests/test_signal_generator.cpp 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/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a856191 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,98 @@ +name: Build and Test + +on: + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + +jobs: + 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: 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=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 }} + env: + INSTALL_PREFIX: ${{ runner.temp }}/opendaq_install + + 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 + with: + repository: openDAQ/openDAQ + ref: other/module-extract-prep + 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 --build build/output --config Release + cmake --install build/output --config Release --prefix "${{ env.INSTALL_PREFIX }}" + + - name: Add DLL path (Windows only) + if: matrix.os == 'windows-latest' + run: | + 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 -DCMAKE_PREFIX_PATH="${{ env.INSTALL_PREFIX }}" + + - 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 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..25c2259 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,64 @@ +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) + +# options +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}) + +if (${REPO_OPTION_PREFIX}_ENABLE_TESTS) + message(STATUS "Unit tests are ENABLED") + enable_testing() +endif() + +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 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/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. diff --git a/cmake/CommonUtils.cmake b/cmake/CommonUtils.cmake new file mode 100644 index 0000000..766b7ce --- /dev/null +++ b/cmake/CommonUtils.cmake @@ -0,0 +1,186 @@ +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 new file mode 100644 index 0000000..c06e00d --- /dev/null +++ b/external/CMakeLists.txt @@ -0,0 +1,69 @@ +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} 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>) +endif() + +add_subdirectory(boost) +#add_subdirectory(spdlog EXCLUDE_FROM_ALL) +#add_subdirectory(nlohmann_json EXCLUDE_FROM_ALL) +add_subdirectory(ws-streaming EXCLUDE_FROM_ALL) + +if (${REPO_OPTION_PREFIX}_ENABLE_TESTS) + add_subdirectory(gtest) +endif() diff --git a/external/boost/CMakeLists.txt b/external/boost/CMakeLists.txt new file mode 100644 index 0000000..71dd317 --- /dev/null +++ b/external/boost/CMakeLists.txt @@ -0,0 +1,92 @@ +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 + asio + beast + program_options + uuid + signals2 + serialization + multiprecision + ) + + 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/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/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/modules/websocket_streaming_client_module/CMakeLists.txt b/modules/websocket_streaming_client_module/CMakeLists.txt index dd07a83..47c6d19 100644 --- a/modules/websocket_streaming_client_module/CMakeLists.txt +++ b/modules/websocket_streaming_client_module/CMakeLists.txt @@ -1,10 +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 @@ -20,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 de1417d..1e5b0f2 100644 --- a/modules/websocket_streaming_client_module/src/CMakeLists.txt +++ b/modules/websocket_streaming_client_module/src/CMakeLists.txt @@ -24,7 +24,7 @@ source_group(module FILES ) 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) diff --git a/modules/websocket_streaming_client_module/tests/CMakeLists.txt b/modules/websocket_streaming_client_module/tests/CMakeLists.txt index a251317..4588d2b 100644 --- a/modules/websocket_streaming_client_module/tests/CMakeLists.txt +++ b/modules/websocket_streaming_client_module/tests/CMakeLists.txt @@ -8,8 +8,8 @@ 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 daq::opendaq_test_utils gtest + ${OPENDAQ_SDK_TARGET_NAMESPACE}::${MODULE_NAME} ) add_test(NAME ${TEST_APP} diff --git a/modules/websocket_streaming_client_module/tests/test_app.cpp b/modules/websocket_streaming_client_module/tests/test_app.cpp index d92f41f..2d76abc 100644 --- a/modules/websocket_streaming_client_module/tests/test_app.cpp +++ b/modules/websocket_streaming_client_module/tests/test_app.cpp @@ -1,15 +1,10 @@ #include -#include +#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_client_module/tests/test_websocket_streaming_client_module.cpp b/modules/websocket_streaming_client_module/tests/test_websocket_streaming_client_module.cpp index aff83f6..673815e 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 @@ -90,33 +89,6 @@ TEST_F(WebsocketStreamingClientModuleTest, CreateDeviceConnectionStringInvalidId ASSERT_THROW(module.createDevice("daq.opcua://devicett3axxr1", nullptr), InvalidParameterException); } -//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(); diff --git a/modules/websocket_streaming_server_module/CMakeLists.txt b/modules/websocket_streaming_server_module/CMakeLists.txt index 6225a37..68e1562 100644 --- a/modules/websocket_streaming_server_module/CMakeLists.txt +++ b/modules/websocket_streaming_server_module/CMakeLists.txt @@ -1,13 +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 d2a8121..763b0d1 100644 --- a/modules/websocket_streaming_server_module/src/CMakeLists.txt +++ b/modules/websocket_streaming_server_module/src/CMakeLists.txt @@ -25,7 +25,7 @@ source_group(module FILES ) 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) diff --git a/modules/websocket_streaming_server_module/tests/CMakeLists.txt b/modules/websocket_streaming_server_module/tests/CMakeLists.txt index 02df280..50edcd5 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 daq::opendaq_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_app.cpp b/modules/websocket_streaming_server_module/tests/test_app.cpp index 64dd0cc..29a34d8 100644 --- a/modules/websocket_streaming_server_module/tests/test_app.cpp +++ b/modules/websocket_streaming_server_module/tests/test_app.cpp @@ -1,16 +1,9 @@ -#include -#include -#include #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(); 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 16c0038..ce3cbd4 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 @@ -7,11 +7,7 @@ #include #include #include -#include #include -#include -#include -#include class WsStreamingServerModuleTest : public testing::Test { diff --git a/opendaq_version b/opendaq_version new file mode 100644 index 0000000..c06dab4 --- /dev/null +++ b/opendaq_version @@ -0,0 +1 @@ +3.31.0dev \ 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) diff --git a/shared/libraries/websocket_streaming/CMakeLists.txt b/shared/libraries/websocket_streaming/CMakeLists.txt index a89b800..d416caa 100644 --- a/shared/libraries/websocket_streaming/CMakeLists.txt +++ b/shared/libraries/websocket_streaming/CMakeLists.txt @@ -1,12 +1,8 @@ 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 ) add_subdirectory(src) - -if (OPENDAQ_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 a1491a9..89d9959 100644 --- a/shared/libraries/websocket_streaming/src/CMakeLists.txt +++ b/shared/libraries/websocket_streaming/src/CMakeLists.txt @@ -1,6 +1,6 @@ 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 descriptor_to_metadata.cpp @@ -30,7 +30,7 @@ set(INCLUDE_DIR ../include/websocket_streaming) prepend_include(${INCLUDE_DIR} SRC_PublicHeaders) add_library(${LIB_NAME} STATIC ${SRC_Cpp} ${SRC_PublicHeaders}) -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 deleted file mode 100644 index e0c18fa..0000000 --- a/shared/libraries/websocket_streaming/tests/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -set(MODULE_NAME websocket_streaming) -set(TEST_APP test_${MODULE_NAME}) - -add_executable(${TEST_APP} - test_signal_generator.cpp - test_app.cpp -) - -if (MSVC) - target_compile_options(${TEST_APP} PRIVATE /bigobj) -endif() - -target_link_libraries(${TEST_APP} PRIVATE - ${SDK_TARGET_NAMESPACE}::${MODULE_NAME} - daq::opendaq - daq::opendaq_mocks - ${SDK_TARGET_NAMESPACE}::test_utils -) - -set_target_properties(${TEST_APP} PROPERTIES DEBUG_POSTFIX _debug) -target_include_directories(${TEST_APP} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include") - -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/test_app.cpp b/shared/libraries/websocket_streaming/tests/test_app.cpp deleted file mode 100644 index 608cd21..0000000 --- a/shared/libraries/websocket_streaming/tests/test_app.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -int main(int argc, char** args) -{ - testing::InitGoogleTest(&argc, args); - - testing::TestEventListeners& listeners = testing::UnitTest::GetInstance()->listeners(); - listeners.Append(new BaseTestListener()); - - return RUN_ALL_TESTS(); -} 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); -} From 4b024436db1e648d159259f351e4c570202b6b97 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Mon, 22 Dec 2025 13:38:42 +0100 Subject: [PATCH 02/18] Fix env var and branch name --- .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 a856191..6a52e44 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 @@ -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 588b3c622d10c21c4102aa09654f2dfe8a8f0fe8 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Mon, 22 Dec 2025 14:15:14 +0100 Subject: [PATCH 03/18] CI --- .github/workflows/ci.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a52e44..c5d56c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,18 +76,24 @@ jobs: - 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 - + echo "${{ env.INSTALL_PREFIX }}/lib" >> $env:GITHUB_PATH + + - name: Checkout module + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.branch || github.event.client_payload.branch || github.ref }} + path: module + - 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 From 2efdc97fa54c01b5dbb0d5da7d32b42ee4dcdaad Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 15 Jan 2026 08:54:26 +0100 Subject: [PATCH 04/18] Use cmake utils from ext repo --- CMakeLists.txt | 76 +++---- cmake/CMakeLists.txt | 14 ++ cmake/CommonUtils.cmake | 186 ------------------ external/CMakeLists.txt | 67 +------ external/boost/CMakeLists.txt | 86 +------- opendaq_version => module_version | 0 .../CMakeLists.txt | 6 +- .../CMakeLists.txt | 4 +- repo_version | 1 - 9 files changed, 59 insertions(+), 381 deletions(-) create mode 100644 cmake/CMakeLists.txt delete mode 100644 cmake/CommonUtils.cmake rename opendaq_version => module_version (100%) delete mode 100644 repo_version 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 c06e00d..f4149ec 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -1,69 +1,14 @@ 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) + resolve_opendaq_dependency(main) 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(ws-streaming EXCLUDE_FROM_ALL) - -if (${REPO_OPTION_PREFIX}_ENABLE_TESTS) - add_subdirectory(gtest) -endif() +add_subdirectory(ws-streaming) diff --git a/external/boost/CMakeLists.txt b/external/boost/CMakeLists.txt index 71dd317..8824256 100644 --- a/external/boost/CMakeLists.txt +++ b/external/boost/CMakeLists.txt @@ -1,44 +1,5 @@ -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( + algorithm asio beast program_options @@ -47,46 +8,3 @@ if (NOT BOOST_INCLUDE_LIBRARIES) serialization multiprecision ) - - 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/opendaq_version b/module_version similarity index 100% rename from opendaq_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/repo_version b/repo_version deleted file mode 100644 index c06dab4..0000000 --- a/repo_version +++ /dev/null @@ -1 +0,0 @@ -3.31.0dev \ No newline at end of file From 8e8b238c487252161f9a3a3f28f815e8b425d193 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 15 Jan 2026 15:56:33 +0100 Subject: [PATCH 05/18] Read opendaq ref string from file --- .github/workflows/ci.yml | 28 ++++++++++++---------------- external/CMakeLists.txt | 13 ++++++++++++- external/opendaq_ref | 1 + 3 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 external/opendaq_ref diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5d56c0..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,16 +57,23 @@ 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 + - 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: | - mkdir opendaq - mkdir module + 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 @@ -82,14 +85,7 @@ jobs: - name: Add DLL path (Windows only) if: matrix.os == 'windows-latest' - run: | - echo "${{ env.INSTALL_PREFIX }}/lib" >> $env:GITHUB_PATH - - - name: Checkout module - uses: actions/checkout@v4 - with: - ref: ${{ github.event.inputs.branch || github.event.client_payload.branch || github.ref }} - path: module + run: echo "${{ env.INSTALL_PREFIX }}/lib" >> $env:GITHUB_PATH - name: Configure project with CMake working-directory: module diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index f4149ec..88a3545 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -2,7 +2,18 @@ set(CMAKE_FOLDER external) list(APPEND CMAKE_MESSAGE_CONTEXT external) if (NOT ${REPO_OPTION_PREFIX}_BUILDING_AS_SUBMODULE) - resolve_opendaq_dependency(main) + 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() suppress_ext_lib_warnings() 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 From d09641771446089a749b6ff61affc2c7dbaf9622 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 15 Jan 2026 19:58:04 +0100 Subject: [PATCH 06/18] 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 7f32eb5e6aecf3464fa71449e4b810f551006f5b Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Thu, 15 Jan 2026 19:58:30 +0100 Subject: [PATCH 07/18] Fix cmake call --- shared/libraries/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 06be5d7e4a6ebd7960ee65515a4cca5f99b15281 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Wed, 21 Jan 2026 14:59:51 +0100 Subject: [PATCH 08/18] Update --- CMakeLists.txt | 46 ++--------------------------------- cmake/CMakeLists.txt | 3 ++- external/Boost.cmake | 10 ++++++++ external/CMakeLists.txt | 22 +---------------- external/boost/CMakeLists.txt | 10 -------- external/gtest/CMakeLists.txt | 30 ----------------------- 6 files changed, 15 insertions(+), 106 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 d515d77..82901d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,52 +1,10 @@ set(CMAKE_POLICY_VERSION_MINIMUM 3.5) cmake_minimum_required(VERSION 3.25) -# set project variables set(REPO_NAME LtStreamingModulesModern) 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) -# 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/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index de859f0..b2d1e13 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -7,7 +7,8 @@ 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_REPOSITORY https://github.com/openDAQ/opendaq-cmake-utils.git + GIT_REPOSITORY file:///home/nick/dewesoft/blueberry_sdk/opendaq_cmake_utils.git GIT_TAG main GIT_PROGRESS ON ) diff --git a/external/Boost.cmake b/external/Boost.cmake new file mode 100644 index 0000000..64c262b --- /dev/null +++ b/external/Boost.cmake @@ -0,0 +1,10 @@ +opendaq_add_required_boost_libs( + algorithm + asio + beast + program_options + uuid + signals2 + serialization + multiprecision +) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 88a3545..42e9907 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -1,25 +1,5 @@ set(CMAKE_FOLDER external) list(APPEND CMAKE_MESSAGE_CONTEXT external) -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() - -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) +setup_module_default_dependencies(${REPO_OPTION_PREFIX}) add_subdirectory(ws-streaming) diff --git a/external/boost/CMakeLists.txt b/external/boost/CMakeLists.txt deleted file mode 100644 index 8824256..0000000 --- a/external/boost/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ - opendaq_add_required_boost_libs( - algorithm - asio - beast - program_options - uuid - signals2 - serialization - multiprecision - ) 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 9e31bbf3068c1a16d3b05b0b9e4d7e37c2246334 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Mon, 26 Jan 2026 09:21:59 +0100 Subject: [PATCH 09/18] 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 82901d7..9aef5a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,5 +6,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 42e9907..834f167 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -1,5 +1,5 @@ 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(ws-streaming) From e2704407badea5ac3204d2cdc1b45f7068038f2a Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Fri, 30 Jan 2026 10:42:12 +0100 Subject: [PATCH 10/18] Import changes made in openDAQ/openDAQ#1037 --- .../src/websocket_streaming_client_module_impl.cpp | 4 +++- .../include/websocket_streaming/ws_streaming_device.h | 4 +++- .../websocket_streaming/src/ws_streaming_device.cpp | 8 ++++++-- 3 files changed, 12 insertions(+), 4 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 5d5eb53..db65658 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 @@ -110,7 +110,9 @@ DevicePtr WebsocketStreamingClientModule::onCreateDevice(const StringPtr& connec std::scoped_lock lock(sync); std::string localId = fmt::format("websocket_pseudo_device{}", deviceIndex++); - auto device = createWithImplementation(context, parent, localId, strPtr); + auto deviceType = WsStreamingDevice::createNewType(); + checkErrorInfo(deviceType.asPtr()->setModuleInfo(moduleInfo)); + auto device = createWithImplementation(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/ws_streaming_device.h b/shared/libraries/websocket_streaming/include/websocket_streaming/ws_streaming_device.h index dda1e0d..05db676 100644 --- a/shared/libraries/websocket_streaming/include/websocket_streaming/ws_streaming_device.h +++ b/shared/libraries/websocket_streaming/include/websocket_streaming/ws_streaming_device.h @@ -77,7 +77,8 @@ class WsStreamingDevice : public Device const ContextPtr& context, const ComponentPtr& parent, const StringPtr& localId, - const StringPtr& connectionString); + const StringPtr& connectionString, + const DeviceTypePtr& type); protected: @@ -96,6 +97,7 @@ class WsStreamingDevice : public Device wss::remote_signal_ptr signal); StringPtr connectionString; + DeviceTypePtr deviceType; StreamingPtr streaming; std::list streamingEvents; diff --git a/shared/libraries/websocket_streaming/src/ws_streaming_device.cpp b/shared/libraries/websocket_streaming/src/ws_streaming_device.cpp index 6d6a6a8..ef5060c 100644 --- a/shared/libraries/websocket_streaming/src/ws_streaming_device.cpp +++ b/shared/libraries/websocket_streaming/src/ws_streaming_device.cpp @@ -54,9 +54,11 @@ WsStreamingDevice::WsStreamingDevice( const ContextPtr& context, const ComponentPtr& parent, const StringPtr& localId, - const StringPtr& connectionString) + const StringPtr& connectionString, + const DeviceTypePtr& type) : Device(context, parent, localId) , connectionString(connectionString) + , deviceType(type) { if (!connectionString.assigned()) DAQ_THROW_EXCEPTION(ArgumentNullException, "connectionString cannot be null"); @@ -89,7 +91,9 @@ void WsStreamingDevice::removed() DeviceInfoPtr WsStreamingDevice::onGetInfo() { - return DeviceInfo(connectionString, "WebsocketClientPseudoDevice"); + auto info = DeviceInfo(connectionString, "WebsocketClientPseudoDevice"); + info.setDeviceType(deviceType); + return info; } void WsStreamingDevice::onSignalAvailable( From 42f38168f64b468b0c1bb0c38bb3668518f959d3 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Fri, 30 Jan 2026 11:36:04 +0100 Subject: [PATCH 11/18] Rename prepend cmake utils --- modules/CMakeLists.txt | 2 +- modules/websocket_streaming_client_module/CMakeLists.txt | 2 +- modules/websocket_streaming_client_module/src/CMakeLists.txt | 2 +- modules/websocket_streaming_server_module/CMakeLists.txt | 2 +- modules/websocket_streaming_server_module/src/CMakeLists.txt | 2 +- shared/CMakeLists.txt | 2 +- shared/libraries/CMakeLists.txt | 2 +- shared/libraries/websocket_streaming/CMakeLists.txt | 2 +- 8 files changed, 8 insertions(+), 8 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 1e5b0f2..6b85781 100644 --- a/modules/websocket_streaming_client_module/src/CMakeLists.txt +++ b/modules/websocket_streaming_client_module/src/CMakeLists.txt @@ -47,4 +47,4 @@ target_include_directories(${LIB_NAME} opendaq_set_module_properties(${LIB_NAME} ${PROJECT_VERSION_MAJOR}) -create_version_header(${LIB_NAME}) +opendaq_create_version_header(${LIB_NAME}) diff --git a/modules/websocket_streaming_server_module/CMakeLists.txt b/modules/websocket_streaming_server_module/CMakeLists.txt index ffe8b52..12e32a4 100644 --- a/modules/websocket_streaming_server_module/CMakeLists.txt +++ b/modules/websocket_streaming_server_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(WebsocketStreamingServerModule VERSION ${${REPO_OPTION_PREFIX}_VERSION} LANGUAGES CXX) add_subdirectory(src) diff --git a/modules/websocket_streaming_server_module/src/CMakeLists.txt b/modules/websocket_streaming_server_module/src/CMakeLists.txt index 763b0d1..2eef23a 100644 --- a/modules/websocket_streaming_server_module/src/CMakeLists.txt +++ b/modules/websocket_streaming_server_module/src/CMakeLists.txt @@ -48,4 +48,4 @@ target_include_directories(${LIB_NAME} opendaq_set_module_properties(${LIB_NAME} ${PROJECT_VERSION_MAJOR}) -create_version_header(${LIB_NAME}) +opendaq_create_version_header(${LIB_NAME}) diff --git a/shared/CMakeLists.txt b/shared/CMakeLists.txt index 94e7d07..704326b 100644 --- a/shared/CMakeLists.txt +++ b/shared/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/shared/libraries/CMakeLists.txt b/shared/libraries/CMakeLists.txt index 7f50d04..1492fab 100644 --- a/shared/libraries/CMakeLists.txt +++ b/shared/libraries/CMakeLists.txt @@ -1,3 +1,3 @@ -set_cmake_folder_context(TARGET_FOLDER_NAME) +opendaq_set_cmake_folder_context(TARGET_FOLDER_NAME) add_subdirectory(websocket_streaming) diff --git a/shared/libraries/websocket_streaming/CMakeLists.txt b/shared/libraries/websocket_streaming/CMakeLists.txt index d416caa..4296bad 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 ${OPENDAQ_SDK_TARGET_NAMESPACE}_websocket_streaming) +opendaq_set_cmake_folder_context(TARGET_FOLDER_NAME ${OPENDAQ_SDK_TARGET_NAMESPACE}_websocket_streaming) project(OpenDaqStreaming VERSION 4.0.0 LANGUAGES CXX From 4d51362ba747b9eaf28dc0826e3bfdddd093eaa3 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Mon, 2 Feb 2026 07:20:50 +0100 Subject: [PATCH 12/18] Fix cmake func name --- modules/websocket_streaming_client_module/src/CMakeLists.txt | 2 +- modules/websocket_streaming_server_module/src/CMakeLists.txt | 2 +- shared/libraries/websocket_streaming/src/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/websocket_streaming_client_module/src/CMakeLists.txt b/modules/websocket_streaming_client_module/src/CMakeLists.txt index 6b85781..8e549e4 100644 --- a/modules/websocket_streaming_client_module/src/CMakeLists.txt +++ b/modules/websocket_streaming_client_module/src/CMakeLists.txt @@ -11,7 +11,7 @@ set(SRC_Srcs 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 ../include/${TARGET_FOLDER_NAME}/websocket_streaming_client_module_impl.h diff --git a/modules/websocket_streaming_server_module/src/CMakeLists.txt b/modules/websocket_streaming_server_module/src/CMakeLists.txt index 2eef23a..476fae7 100644 --- a/modules/websocket_streaming_server_module/src/CMakeLists.txt +++ b/modules/websocket_streaming_server_module/src/CMakeLists.txt @@ -15,7 +15,7 @@ set(SRC_Srcs ws_streaming_server_outlet_fb.cpp ) -prepend_include(${TARGET_FOLDER_NAME} SRC_Include) +opendaq_prepend_include(${TARGET_FOLDER_NAME} SRC_Include) source_group(module FILES ../include/${TARGET_FOLDER_NAME}/ws_streaming_server_module.h diff --git a/shared/libraries/websocket_streaming/src/CMakeLists.txt b/shared/libraries/websocket_streaming/src/CMakeLists.txt index 89d9959..5440df0 100644 --- a/shared/libraries/websocket_streaming/src/CMakeLists.txt +++ b/shared/libraries/websocket_streaming/src/CMakeLists.txt @@ -27,7 +27,7 @@ set(SRC_PublicHeaders ) set(INCLUDE_DIR ../include/websocket_streaming) -prepend_include(${INCLUDE_DIR} SRC_PublicHeaders) +opendaq_prepend_include(${INCLUDE_DIR} SRC_PublicHeaders) add_library(${LIB_NAME} STATIC ${SRC_Cpp} ${SRC_PublicHeaders}) add_library(${OPENDAQ_SDK_TARGET_NAMESPACE}::${BASE_NAME} ALIAS ${LIB_NAME}) From 9431cf11ccf550bc078e8e48bc94f0b920828da2 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Mon, 2 Feb 2026 07:22:03 +0100 Subject: [PATCH 13/18] Set remote repo for cmake utils --- cmake/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index b2d1e13..de859f0 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -7,8 +7,7 @@ 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_REPOSITORY file:///home/nick/dewesoft/blueberry_sdk/opendaq_cmake_utils.git + GIT_REPOSITORY https://github.com/openDAQ/opendaq-cmake-utils.git GIT_TAG main GIT_PROGRESS ON ) From dd26b56075c5c24f8c2b1705d71a6e70ec4bd2e8 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Tue, 3 Feb 2026 13:38:45 +0100 Subject: [PATCH 14/18] Fix mingw build --- 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 476fae7..b6fb7ae 100644 --- a/modules/websocket_streaming_server_module/src/CMakeLists.txt +++ b/modules/websocket_streaming_server_module/src/CMakeLists.txt @@ -31,6 +31,10 @@ if (MSVC) target_compile_options(${LIB_NAME} PRIVATE /bigobj) endif() +if (MINGW) + target_link_libraries(${LIB_NAME} PRIVATE ws2_32 wsock32) +endif() + target_link_libraries(${LIB_NAME} PUBLIC daq::opendaq From ae30a41e5419968cbcd2b6b54d67aff7ab5d2e45 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Tue, 3 Feb 2026 13:43:57 +0100 Subject: [PATCH 15/18] Set correct opendaq ref --- external/opendaq_ref | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/opendaq_ref b/external/opendaq_ref index 88d050b..e5aef74 100644 --- a/external/opendaq_ref +++ b/external/opendaq_ref @@ -1 +1 @@ -main \ No newline at end of file +other/module-deps-refactoring \ No newline at end of file From 1e2f33c172ef2691547ba3e4de04ba3028d6e083 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Tue, 3 Feb 2026 14:10:58 +0100 Subject: [PATCH 16/18] Fix version read --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae29e7d..057585c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,6 +64,7 @@ jobs: path: module - name: Read openDAQ version + shell: bash working-directory: module run: | opendaq_ref=$(cat external/opendaq_ref) From f27dc0b8621e1e79494f163c2a26a7eed437f712 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Wed, 4 Feb 2026 10:13:11 +0100 Subject: [PATCH 17/18] Use correct test enable option 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 057585c..67a4fdd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: 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=Debug + run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DDAQMODULES_LT_STREAMING_ENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Debug - name: Build project with CMake run: cmake --build build/output --config Debug @@ -90,7 +90,7 @@ jobs: - 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 -DopenDAQ_DIR="${{ env.INSTALL_PREFIX }}/lib/cmake/opendaq/" + run: cmake -B build/output -S . -G "${{ matrix.generator }}" -DDAQMODULES_LT_STREAMING_ENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DopenDAQ_DIR="${{ env.INSTALL_PREFIX }}/lib/cmake/opendaq/" - name: Build project with CMake working-directory: module From 0d92a21a97c524421db3d5254f3b36b56f128b76 Mon Sep 17 00:00:00 2001 From: "nikolai.shipilov" Date: Wed, 4 Feb 2026 10:13:46 +0100 Subject: [PATCH 18/18] Set module project and subfolders directly --- CMakeLists.txt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9aef5a4..415f006 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,5 +6,18 @@ set(REPO_OPTION_PREFIX DAQMODULES_LT_STREAMING) add_subdirectory(cmake) -opendaq_setup_module_project(${REPO_OPTION_PREFIX} ${REPO_NAME}) -opendaq_setup_module_subfolders(${REPO_OPTION_PREFIX} ${REPO_NAME}) +opendaq_setup_repo_version("${REPO_OPTION_PREFIX}" ${REPO_NAME} "module_version") + +if(NOT DEFINED ${REPO_OPTION_PREFIX}_VERSION) + message(FATAL_ERROR "Module project version is not specified - specify module version using -D${${REPO_OPTION_PREFIX}_VERSION} or via module_version file in module project root dir") +endif() + +project(${REPO_NAME} VERSION ${${REPO_OPTION_PREFIX}_VERSION} LANGUAGES CXX) + +opendaq_module_common_setup(${REPO_OPTION_PREFIX} ${REPO_NAME}) + +add_subdirectory(external) + +add_subdirectory(shared) +add_subdirectory(modules) +