diff --git a/BuildDltViewer.pro b/BuildDltViewer.pro index 8c25fad4..fb038814 100644 --- a/BuildDltViewer.pro +++ b/BuildDltViewer.pro @@ -2,7 +2,7 @@ TEMPLATE = subdirs CONFIG += ordered SUBDIRS += qdlt src plugin commander -CONFIG += c++11 +CONFIG += c++1z ICON = Project.icns QMAKE_INFO_PLIST = Info.plist diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c917dfc..f285aa2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") set(LINUX TRUE) endif() -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -136,7 +136,6 @@ add_subdirectory(qdlt) add_subdirectory(src) add_subdirectory(plugin) add_subdirectory(commander) -add_subdirectory(tools) message(STATUS "\n\t** DLT Viewer Build Summary **") message(STATUS "\tCMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") diff --git a/qdlt/CMakeLists.txt b/qdlt/CMakeLists.txt index 288b673b..4ee1e017 100644 --- a/qdlt/CMakeLists.txt +++ b/qdlt/CMakeLists.txt @@ -39,7 +39,9 @@ add_library(qdlt SHARED qdltsettingsmanager.cpp qdltexporter.cpp qdltimporter.cpp - fieldnames.cpp) + fieldnames.cpp + dltmessagematcher.cpp + dltmessagematcher.h) target_compile_definitions(qdlt PRIVATE BYTE_ORDER=LITTLE_ENDIAN @@ -116,3 +118,11 @@ foreach(SDK_EXAMPLE IN ITEMS ${SDK_EXAMPLES}) DESTINATION "${DLT_ADDITIONAL_FILES_INSTALLATION_PATH}/src" COMPONENT qdlt_sdk) endforeach() + + +find_package(GTest) +# configure unit tests only if gtest found on the system +if (GTest_FOUND) + enable_testing() + add_subdirectory(tests) +endif() diff --git a/tools/dltmessagematcher.cpp b/qdlt/dltmessagematcher.cpp similarity index 100% rename from tools/dltmessagematcher.cpp rename to qdlt/dltmessagematcher.cpp diff --git a/tools/dltmessagematcher.h b/qdlt/dltmessagematcher.h similarity index 93% rename from tools/dltmessagematcher.h rename to qdlt/dltmessagematcher.h index 8eded005..88cf41b8 100644 --- a/tools/dltmessagematcher.h +++ b/qdlt/dltmessagematcher.h @@ -1,12 +1,17 @@ #ifndef DLTMESSAGEMATCHER_H #define DLTMESSAGEMATCHER_H +#include "export_rules.h" + #include #include +#include +#include + class QDltMsg; -class DltMessageMatcher +class QDLT_EXPORT DltMessageMatcher { public: using Pattern = std::variant; diff --git a/qdlt/qdlt.pro b/qdlt/qdlt.pro index b1980c34..e51f5f40 100644 --- a/qdlt/qdlt.pro +++ b/qdlt/qdlt.pro @@ -2,7 +2,7 @@ PROJECT = qdlt TEMPLATE = lib -CONFIG += c++11 +CONFIG += c++1z DEFINES += QDLT_LIBRARY *-gcc* { QMAKE_CFLAGS += -std=gnu99 @@ -11,7 +11,7 @@ DEFINES += QDLT_LIBRARY } *-g++* { - QMAKE_CXXFLAGS += -std=gnu++0x + QMAKE_CXXFLAGS += -std=c++17 QMAKE_CXXFLAGS += -Wall QMAKE_CXXFLAGS += -Wextra QMAKE_CXXFLAGS += -DPLUGIN_INSTALLATION_PATH=\\\"$$PREFIX/usr/share/dlt-viewer/plugins\\\" @@ -65,6 +65,7 @@ SOURCES += \ qdltexporter.cpp \ fieldnames.cpp \ qdltimporter.cpp \ + dltmessagematcher.cpp \ HEADERS += qdlt.h \ export_rules.h \ @@ -96,6 +97,7 @@ HEADERS += qdlt.h \ qdltexporter.h \ fieldnames.h \ qdltimporter.h \ + dltmessagematcher.h \ unix:VERSION = 1.0.0 diff --git a/tools/tests/CMakeLists.txt b/qdlt/tests/CMakeLists.txt similarity index 69% rename from tools/tests/CMakeLists.txt rename to qdlt/tests/CMakeLists.txt index a90a478f..13b400a4 100644 --- a/tools/tests/CMakeLists.txt +++ b/qdlt/tests/CMakeLists.txt @@ -1,7 +1,3 @@ -find_package(GTest REQUIRED) - -enable_testing() - add_executable(test_tools test_dltmessagematcher.cpp ) @@ -9,6 +5,6 @@ target_link_libraries( test_tools PRIVATE GTest::gtest_main - tools + qdlt ) diff --git a/tools/tests/test_dltmessagematcher.cpp b/qdlt/tests/test_dltmessagematcher.cpp similarity index 100% rename from tools/tests/test_dltmessagematcher.cpp rename to qdlt/tests/test_dltmessagematcher.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5148056f..6877e1cc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -53,7 +53,6 @@ add_executable(dlt-viewer target_link_libraries(dlt-viewer qdlt - tools ${QT_PREFIX}::Core ${QT_PREFIX}::Network ${QT_PREFIX}::Widgets diff --git a/src/src.pro b/src/src.pro index ea113ce1..e79c94df 100644 --- a/src/src.pro +++ b/src/src.pro @@ -4,6 +4,7 @@ QT_VERSION = $$split(QT_VERSION, ".") QT_VER_MAJ = $$member(QT_VERSION, 0) QT_VER_MIN = $$member(QT_VERSION, 1) +CONFIG += c++1z *-gcc* { QMAKE_CFLAGS += -std=gnu99 QMAKE_CFLAGS += -Wall @@ -12,7 +13,7 @@ QT_VER_MIN = $$member(QT_VERSION, 1) } *-g++* { - QMAKE_CXXFLAGS += -std=gnu++0x + QMAKE_CXXFLAGS += -std=c++17 QMAKE_CXXFLAGS += -Wall QMAKE_CXXFLAGS += -Wextra #QMAKE_CXXFLAGS += -pedantic diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt deleted file mode 100644 index 7bd955b7..00000000 --- a/tools/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -add_library(tools - dltmessagematcher.cpp - dltmessagematcher.h -) - -target_link_libraries(tools PUBLIC qdlt) -target_include_directories(tools PUBLIC .) - -add_subdirectory(tests)