diff --git a/CMakeLists.txt b/CMakeLists.txt index 987eb98..5cde2f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,50 +1,92 @@ +set(CMAKE_POLICY_VERSION_MINIMUM 3.5) cmake_minimum_required(VERSION 3.25) + set(REPO_NAME asam_cmp_modules) set(REPO_OPTION_PREFIX ASAM_CMP) -if (MSVC) - add_compile_options(/bigobj) -endif() +list(APPEND CMAKE_MESSAGE_CONTEXT ${REPO_NAME}) +add_subdirectory(cmake) -project(${REPO_NAME} VERSION 1.0.0) +opendaq_read_file_contents("${CMAKE_CURRENT_LIST_DIR}/module_version" module_version) +opendaq_get_version_major_minor_patch("${module_version}" ${REPO_OPTION_PREFIX}_VERSION) -if (POLICY CMP0135) - cmake_policy(SET CMP0135 NEW) -endif() +project(${REPO_NAME} VERSION ${${REPO_OPTION_PREFIX}_VERSION} LANGUAGES CXX) + +opendaq_common_early_setup() -if (POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) +if (PROJECT_IS_TOP_LEVEL) + message(STATUS "Building ${REPO_NAME} version ${${REPO_OPTION_PREFIX}_VERSION} standalone") +else() + message(STATUS "Building ${REPO_NAME} version ${${REPO_OPTION_PREFIX}_VERSION} as submodule") endif() +opendaq_setup_common_build_options() +opendaq_setup_project_specific_build_options(${REPO_OPTION_PREFIX}) + option(${REPO_OPTION_PREFIX}_BUILD_CAPTURE_MODULE "Enable ASAM CMP Capture Module" ON) option(${REPO_OPTION_PREFIX}_BUILD_DATA_SINK "Enable ASAM CMP Data Sink" ON) -option(${REPO_OPTION_PREFIX}_ENABLE_EXAMPLE "Enable Example" ON) +option(${REPO_OPTION_PREFIX}_ENABLE_EXAMPLE "Enable Example" ${PROJECT_IS_TOP_LEVEL}) +option(${REPO_OPTION_PREFIX}_ENABLE_TESTS "Enable ${REPO_NAME} testing" ${PROJECT_IS_TOP_LEVEL}) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -list(APPEND CMAKE_MESSAGE_CONTEXT ${REPO_NAME}) -set(CMAKE_MESSAGE_CONTEXT_SHOW ON CACHE BOOL "Show CMake message context") - -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -add_definitions(-DFMT_HEADER_ONLY) - -include(AsamCommonUtils) -setup_repo(${REPO_OPTION_PREFIX}) +opendaq_common_compile_targets_settings() +opendaq_setup_compiler_flags(${REPO_OPTION_PREFIX}) if (${REPO_OPTION_PREFIX}_ENABLE_TESTS) + message(STATUS "Unit tests in ${REPO_NAME} are ENABLED") + set(OPENDAQ_ENABLE_TEST_UTILS ON CACHE BOOL "Enable testing utils library") enable_testing() +else() + message(STATUS "Unit tests in ${REPO_NAME} are DISABLED") +endif() + +if (MSVC) + add_compile_options($<$:/bigobj>) + add_compile_options($<$:/wd4244>) + add_compile_options($<$:/wd4100>) endif() +add_definitions(-DFMT_HEADER_ONLY) + if (${REPO_OPTION_PREFIX}_ENABLE_EXAMPLE) set(DAQMODULES_REF_DEVICE_MODULE ON) set(DAQMODULES_REF_FB_MODULE ON) - - add_subdirectory(examples) endif() +# TODO: move add_subdirectory(external) after openDAQ SDK fetch once TBBAS-3072 is resolved add_subdirectory(external) + +if (NOT TARGET "${OPENDAQ_SDK_TARGET_NAMESPACE}::${OPENDAQ_SDK_TARGET_NAME}") + if (PROJECT_IS_TOP_LEVEL) + find_package(${OPENDAQ_SDK_NAME} GLOBAL) + endif() + if (NOT ${OPENDAQ_SDK_NAME}_FOUND) + include(FetchContent) + set(OPENDAQ_ENABLE_TESTS OFF CACHE BOOL "") + + opendaq_read_file_contents("${CMAKE_CURRENT_LIST_DIR}/opendaq_ref" OPENDAQ_REF) + opendaq_get_custom_fetch_content_params(${OPENDAQ_SDK_NAME} FC_PARAMS) + + FetchContent_Declare( + ${OPENDAQ_SDK_NAME} + GIT_REPOSITORY https://github.com/openDAQ/openDAQ.git + GIT_TAG ${OPENDAQ_REF} + GIT_PROGRESS ON + ${FC_PARAMS} + ) + FetchContent_MakeAvailable(${OPENDAQ_SDK_NAME}) + else() + message(STATUS "Found installed ${OPENDAQ_SDK_NAME} version: ${${OPENDAQ_SDK_NAME}_VERSION}") + set(OPENDAQ_PACKAGE_VERSION "${${OPENDAQ_SDK_NAME}_VERSION}" CACHE INTERNAL "${OPENDAQ_SDK_NAME} SDK version") + endif() +endif() + add_subdirectory(shared) add_subdirectory(modules) +if (${REPO_OPTION_PREFIX}_ENABLE_EXAMPLE) + add_subdirectory(examples) +endif() # Set CPack variables set(CPACK_COMPONENTS_ALL RUNTIME) @@ -64,4 +106,4 @@ elseif (UNIX AND NOT APPLE) endif() # Include CPack for packaging -include(CPack) \ No newline at end of file +include(CPack) diff --git a/cmake/AsamCommonUtils.cmake b/cmake/AsamCommonUtils.cmake deleted file mode 100644 index eb9562d..0000000 --- a/cmake/AsamCommonUtils.cmake +++ /dev/null @@ -1,167 +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() - - find_package(GitInfo) - if (COMMAND GIT_WC_INFO) - GIT_WC_INFO("${CMAKE_CURRENT_SOURCE_DIR}" ${REPO_OPTION_PREFIX}) - if (DEFINED CI_GIT_BRANCH AND NOT ${CI_GIT_BRANCH} STREQUAL "") - string(REPLACE "refs/heads/" "" ${REPO_OPTION_PREFIX}_WC_BRANCH_NAME ${CI_GIT_BRANCH}) - endif() - - message(STATUS "Git branch: ${${REPO_OPTION_PREFIX}_WC_BRANCH_NAME} | ${${REPO_OPTION_PREFIX}_WC_REVISION_HASH}") - if (NOT ${${REPO_OPTION_PREFIX}_WC_BRANCH_NAME} MATCHES "^release\/[0-9]+\.[0-9]+(\.[0-9])?(\.[0-9])?(-[a-z|A-Z|0-9]*)?$") - set (${REPO_OPTION_PREFIX}_PACKAGE_VERSION_WITH_SHA "${PROJECT_VERSION}_${${REPO_OPTION_PREFIX}_WC_REVISION_HASH}") - endif() - else() - message(WARNING "Git: Could not determine repository version info") - set(${REPO_OPTION_PREFIX}_WC_REVISION "NA") - 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() -endmacro() diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt new file mode 100644 index 0000000..3daa1f7 --- /dev/null +++ b/cmake/CMakeLists.txt @@ -0,0 +1,12 @@ +set(CMAKE_FOLDER "cmake") +list(APPEND CMAKE_MESSAGE_CONTEXT cmake) + +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 v1.0.0 + GIT_PROGRESS ON +) +FetchContent_MakeAvailable(opendaq-cmake-utils) diff --git a/cmake/FindGitInfo.cmake b/cmake/FindGitInfo.cmake deleted file mode 100644 index 2c8cd75..0000000 --- a/cmake/FindGitInfo.cmake +++ /dev/null @@ -1,143 +0,0 @@ -# If the command line client executable is found the macro -# GIT_WC_INFO( ) -# is defined to extract information of a git working copy at -# a given location. -# -# The macro defines the following variables: -# _WC_REVISION_HASH - Current SHA1 hash -# _WC_REVISION - Current SHA1 hash -# _WC_REVISION_NAME - Name associated with _WC_REVISION_HASH -# _WC_URL - output of command `git config --get remote.origin.url' -# _WC_ROOT - Same value as working copy URL -# _WC_GITSVN - Set to false -# -# ... and also the following ones if it's a git-svn repository: -# _WC_GITSVN - Set to True if it is a -# _WC_INFO - output of command `git svn info' -# _WC_URL - url of the associated SVN repository -# _WC_ROOT - root url of the associated SVN repository -# _WC_REVISION - current SVN revision number -# _WC_LAST_CHANGED_AUTHOR - author of last commit -# _WC_LAST_CHANGED_DATE - date of last commit -# _WC_LAST_CHANGED_REV - revision of last commit -# _WC_LAST_CHANGED_LOG - last log of base revision -# -# Example usage: -# find_package(Git) -# if(GIT_FOUND) -# GIT_WC_INFO(${PROJECT_SOURCE_DIR} Project) -# message("Current revision is ${Project_WC_REVISION_HASH}") -# message("git found: ${GIT_EXECUTABLE}") -# endif() -# - -find_package(Git) - -if (GIT_EXECUTABLE) - macro(GIT_WC_INFO dir prefix) - execute_process( - COMMAND ${GIT_EXECUTABLE} rev-parse --short --verify -q HEAD - WORKING_DIRECTORY ${dir} - ERROR_VARIABLE GIT_error - OUTPUT_VARIABLE ${prefix}_WC_REVISION_HASH - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - set(${prefix}_WC_REVISION ${${prefix}_WC_REVISION_HASH}) - - if (NOT ${GIT_error} EQUAL 0) - message("Command \"${GIT_EXECUTBALE} rev-parse --verify -q HEAD\" in directory ${dir} failed with output:\n${GIT_error}") - else (NOT ${GIT_error} EQUAL 0) - execute_process( - COMMAND ${GIT_EXECUTABLE} rev-parse --verify -q --short HEAD - WORKING_DIRECTORY ${dir} - ERROR_VARIABLE GIT_error - OUTPUT_VARIABLE ${prefix}_WC_REVISION_HASH_SHORT - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - execute_process( - COMMAND ${GIT_EXECUTABLE} name-rev ${${prefix}_WC_REVISION_HASH} - WORKING_DIRECTORY ${dir} - OUTPUT_VARIABLE ${prefix}_WC_REVISION_NAME - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - execute_process( - COMMAND ${GIT_EXECUTABLE} log -1 --format=%cI - WORKING_DIRECTORY ${dir} - OUTPUT_VARIABLE ${prefix}_LAST_COMMIT_DATE - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - execute_process( - COMMAND ${GIT_EXECUTABLE} rev-parse -q --abbrev-ref HEAD - WORKING_DIRECTORY ${dir} - OUTPUT_VARIABLE ${prefix}_WC_BRANCH_NAME - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - endif (NOT ${GIT_error} EQUAL 0) - - execute_process( - COMMAND ${GIT_EXECUTABLE} config --get remote.origin.url - WORKING_DIRECTORY ${dir} - OUTPUT_VARIABLE ${prefix}_WC_URL - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - set(${prefix}_WC_GITSVN False) - - # Check if this git is likely to be a git-svn repository - execute_process( - COMMAND ${GIT_EXECUTABLE} config --get-regexp "^svn-remote" - WORKING_DIRECTORY ${dir} - OUTPUT_VARIABLE git_config_output - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - if (NOT "${git_config_output}" STREQUAL "") - # In case git-svn is used, attempt to extract svn info - execute_process( - COMMAND ${GIT_EXECUTABLE} svn info - WORKING_DIRECTORY ${dir} - TIMEOUT 3 - ERROR_VARIABLE git_svn_info_error - OUTPUT_VARIABLE ${prefix}_WC_INFO - RESULT_VARIABLE git_svn_info_result - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - if (${git_svn_info_result} EQUAL 0) - set(${prefix}_WC_GITSVN True) - string(REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*" - "\\2" ${prefix}_WC_URL "${${prefix}_WC_INFO}") - string(REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*" - "\\2" ${prefix}_WC_REVISION "${${prefix}_WC_INFO}") - string(REGEX REPLACE "^(.*\n)?Repository Root: ([^\n]+).*" - "\\2" ${prefix}_WC_ROOT "${${prefix}_WC_INFO}") - string(REGEX REPLACE "^(.*\n)?Last Changed Author: ([^\n]+).*" - "\\2" ${prefix}_WC_LAST_CHANGED_AUTHOR "${${prefix}_WC_INFO}") - string(REGEX REPLACE "^(.*\n)?Last Changed Rev: ([^\n]+).*" - "\\2" ${prefix}_WC_LAST_CHANGED_REV "${${prefix}_WC_INFO}") - string(REGEX REPLACE "^(.*\n)?Last Changed Date: ([^\n]+).*" - "\\2" ${prefix}_WC_LAST_CHANGED_DATE "${${prefix}_WC_INFO}") - endif (${git_svn_info_result} EQUAL 0) - endif (NOT "${git_config_output}" STREQUAL "") - - # If there is no 'remote.origin', default to "NA" value and print a warning message. - if (NOT ${prefix}_WC_URL) - message(WARNING "No remote origin set for git repository: ${dir}") - set(${prefix}_WC_URL "NA") - else () - set(${prefix}_WC_ROOT ${${prefix}_WC_URL}) - endif () - - endmacro(GIT_WC_INFO) -endif (GIT_EXECUTABLE) - -# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if -# all listed variables are TRUE - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(GitInfo DEFAULT_MSG GIT_EXECUTABLE) - - diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 511460a..84779fd 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -1,12 +1,5 @@ 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! Please choose a separate build directory e.g.: /build/x64/msvc") -endif() - -include(FetchContent) - add_subdirectory(PcapPlusPlus) -add_subdirectory(openDAQ) add_subdirectory(AsamCmpLib) diff --git a/external/openDAQ/CMakeLists.txt b/external/openDAQ/CMakeLists.txt deleted file mode 100644 index 567c099..0000000 --- a/external/openDAQ/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -set(OPENDAQ_ENABLE_TESTS false) - -FetchContent_Declare( - openDAQ - GIT_REPOSITORY https://github.com/openDAQ/openDAQ.git - GIT_TAG v3.20.2 - GIT_PROGRESS ON - SYSTEM - FIND_PACKAGE_ARGS 3.20.2 GLOBAL -) - -FetchContent_MakeAvailable(openDAQ) diff --git a/module_version b/module_version new file mode 100644 index 0000000..afaf360 --- /dev/null +++ b/module_version @@ -0,0 +1 @@ +1.0.0 \ No newline at end of file diff --git a/modules/asam_cmp_capture_module/tests/CMakeLists.txt b/modules/asam_cmp_capture_module/tests/CMakeLists.txt index 025ddf6..c60fa2d 100644 --- a/modules/asam_cmp_capture_module/tests/CMakeLists.txt +++ b/modules/asam_cmp_capture_module/tests/CMakeLists.txt @@ -33,8 +33,7 @@ target_link_libraries(${TEST_APP} PRIVATE daq::opendaq ) add_test(NAME ${TEST_APP} - COMMAND $ - WORKING_DIRECTORY bin + COMMAND $ ) set_target_properties(${TEST_APP} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY $) diff --git a/modules/asam_cmp_capture_module/tests/ref_channel_impl.cpp b/modules/asam_cmp_capture_module/tests/ref_channel_impl.cpp index 0c8648e..7c7d1bf 100644 --- a/modules/asam_cmp_capture_module/tests/ref_channel_impl.cpp +++ b/modules/asam_cmp_capture_module/tests/ref_channel_impl.cpp @@ -26,16 +26,16 @@ namespace daq const StringPtr& localId, const InputChannelStubInit& init) : ChannelImpl(FunctionBlockType("ref_channel", fmt::format("AI{}", init.index + 1), ""), context, parent, localId) - , index(init.index) , sampleRate(init.sampleRate) + , index(init.index) , startTime(init.startTime) , microSecondsFromEpochToStartTime(init.microSecondsFromEpochToStartTime) , lastCollectTime(0) , samplesGenerated(0) + , sampleType(SampleType::Int16) + , isDescriptorsInitialized(false) , needsSignalTypeChanged(false) , generateFunc(init.generateFunc) - , isDescriptorsInitialized(false) - , sampleType(SampleType::Int16) { initProperties(); signalTypeChangedInternal(); diff --git a/modules/asam_cmp_capture_module/tests/test_analog_messages.cpp b/modules/asam_cmp_capture_module/tests/test_analog_messages.cpp index e9f0468..01029a6 100644 --- a/modules/asam_cmp_capture_module/tests/test_analog_messages.cpp +++ b/modules/asam_cmp_capture_module/tests/test_analog_messages.cpp @@ -32,8 +32,6 @@ class AnalogMessagesTest : public testing::Test auto startStub = []() {}; auto stopStub = []() {}; - auto sendPacketStub = [](StringPtr deviceName, const std::vector& data) {}; - ON_CALL(*ethernetWrapper, startCapture(_)).WillByDefault(startStub); ON_CALL(*ethernetWrapper, stopCapture()).WillByDefault(stopStub); ON_CALL(*ethernetWrapper, getEthernetDevicesNamesList()).WillByDefault(Return(names)); diff --git a/modules/asam_cmp_capture_module/tests/test_app.cpp b/modules/asam_cmp_capture_module/tests/test_app.cpp index 21e7f1b..4f40a88 100644 --- a/modules/asam_cmp_capture_module/tests/test_app.cpp +++ b/modules/asam_cmp_capture_module/tests/test_app.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include diff --git a/modules/asam_cmp_capture_module/tests/test_capture_fb.cpp b/modules/asam_cmp_capture_module/tests/test_capture_fb.cpp index dfcadf8..4666117 100644 --- a/modules/asam_cmp_capture_module/tests/test_capture_fb.cpp +++ b/modules/asam_cmp_capture_module/tests/test_capture_fb.cpp @@ -20,11 +20,6 @@ class CaptureFbTest : public testing::Test auto startStub = []() {}; auto stopStub = []() {}; - auto sendPacketStub = [](StringPtr deviceName, const std::vector& data) - { - std::cout << "default PacketReceivedCallback is triggered\n"; - }; - ON_CALL(*ethernetWrapper, startCapture(_)).WillByDefault(startStub); ON_CALL(*ethernetWrapper, stopCapture()).WillByDefault(stopStub); ON_CALL(*ethernetWrapper, getEthernetDevicesNamesList()).WillByDefault(Return(names)); diff --git a/modules/asam_cmp_capture_module/tests/test_interface.cpp b/modules/asam_cmp_capture_module/tests/test_interface.cpp index 8deb9f4..383e23d 100644 --- a/modules/asam_cmp_capture_module/tests/test_interface.cpp +++ b/modules/asam_cmp_capture_module/tests/test_interface.cpp @@ -21,8 +21,6 @@ class InterfaceFbTest: public testing::Test auto startStub = []() {}; auto stopStub = []() {}; - auto sendPacketStub = [](StringPtr deviceName, const std::vector& data) {}; - ON_CALL(*ethernetWrapper, startCapture(_)).WillByDefault(startStub); ON_CALL(*ethernetWrapper, stopCapture()).WillByDefault(stopStub); ON_CALL(*ethernetWrapper, getEthernetDevicesNamesList()).WillByDefault(Return(names)); diff --git a/modules/asam_cmp_capture_module/tests/test_stream.cpp b/modules/asam_cmp_capture_module/tests/test_stream.cpp index 55489f7..0be5fef 100644 --- a/modules/asam_cmp_capture_module/tests/test_stream.cpp +++ b/modules/asam_cmp_capture_module/tests/test_stream.cpp @@ -27,8 +27,6 @@ class StreamFbTest : public testing::Test auto startStub = []() {}; auto stopStub = []() {}; - auto sendPacketStub = [](StringPtr deviceName, const std::vector& data) {}; - ON_CALL(*ethernetWrapper, startCapture(_)).WillByDefault(startStub); ON_CALL(*ethernetWrapper, stopCapture()).WillByDefault(stopStub); ON_CALL(*ethernetWrapper, getEthernetDevicesNamesList()).WillByDefault(Return(names)); diff --git a/modules/asam_cmp_data_sink/tests/CMakeLists.txt b/modules/asam_cmp_data_sink/tests/CMakeLists.txt index 06dd74e..2c1f980 100644 --- a/modules/asam_cmp_data_sink/tests/CMakeLists.txt +++ b/modules/asam_cmp_data_sink/tests/CMakeLists.txt @@ -23,8 +23,7 @@ target_link_libraries(${TEST_APP} PRIVATE daq::test_utils ) add_test(NAME ${TEST_APP} - COMMAND $ - WORKING_DIRECTORY bin + COMMAND $ ) set_target_properties(${TEST_APP} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY $) diff --git a/modules/asam_cmp_data_sink/tests/test_app.cpp b/modules/asam_cmp_data_sink/tests/test_app.cpp index 85e8037..87f8b95 100644 --- a/modules/asam_cmp_data_sink/tests/test_app.cpp +++ b/modules/asam_cmp_data_sink/tests/test_app.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include diff --git a/modules/asam_cmp_data_sink/tests/test_data_sink_module_fb.cpp b/modules/asam_cmp_data_sink/tests/test_data_sink_module_fb.cpp index 1cb9af6..1d8a2be 100644 --- a/modules/asam_cmp_data_sink/tests/test_data_sink_module_fb.cpp +++ b/modules/asam_cmp_data_sink/tests/test_data_sink_module_fb.cpp @@ -200,8 +200,8 @@ TEST_F(DataSinkModuleFbTest, ProcessAggregatedMessage) pcpp::EthLayer newEthernetLayer(pcpp::MacAddress("00:50:43:11:22:33"), pcpp::MacAddress("FF:FF:FF:FF:FF:FF"), asamCmpEtherType); pcpp::PayloadLayer payloadLayer(ethData.data(), ethData.size()); pcpp::Packet newPacket; - bool res = newPacket.addLayer(&newEthernetLayer); - res = newPacket.addLayer(&payloadLayer); + newPacket.addLayer(&newEthernetLayer); + newPacket.addLayer(&payloadLayer); newPacket.computeCalculateFields(); packetReceivedCallback(newPacket.getRawPacket(), nullptr, nullptr); diff --git a/opendaq_ref b/opendaq_ref new file mode 100644 index 0000000..88d050b --- /dev/null +++ b/opendaq_ref @@ -0,0 +1 @@ +main \ No newline at end of file diff --git a/shared/libraries/asam_cmp_common_lib/tests/CMakeLists.txt b/shared/libraries/asam_cmp_common_lib/tests/CMakeLists.txt index ebb5a57..02a0f48 100644 --- a/shared/libraries/asam_cmp_common_lib/tests/CMakeLists.txt +++ b/shared/libraries/asam_cmp_common_lib/tests/CMakeLists.txt @@ -12,8 +12,7 @@ target_link_libraries(${TEST_APP} PRIVATE daq::test_utils ) add_test(NAME ${TEST_APP} - COMMAND $ - WORKING_DIRECTORY bin + COMMAND $ ) set_target_properties(${TEST_APP} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY $) diff --git a/shared/libraries/asam_cmp_common_lib/tests/test_app.cpp b/shared/libraries/asam_cmp_common_lib/tests/test_app.cpp index 2887024..063e0b3 100644 --- a/shared/libraries/asam_cmp_common_lib/tests/test_app.cpp +++ b/shared/libraries/asam_cmp_common_lib/tests/test_app.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include