Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
move matcher to qdlt lib

enable c++17 in qmake config

The new code uses variant and optional
added in c++17 standard while qmake config was
setup restricted to c++11

enable tests only if gtest package found

Set c++17 standard in cmake

export class for windows linker
  • Loading branch information
vifactor committed Jul 23, 2024
1 parent 74378a6 commit a3de08f
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 23 deletions.
2 changes: 1 addition & 1 deletion BuildDltViewer.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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}")
Expand Down
12 changes: 11 additions & 1 deletion qdlt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
File renamed without changes.
7 changes: 6 additions & 1 deletion tools/dltmessagematcher.h → qdlt/dltmessagematcher.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#ifndef DLTMESSAGEMATCHER_H
#define DLTMESSAGEMATCHER_H

#include "export_rules.h"

#include <QString>
#include <QRegularExpression>

#include <optional>
#include <variant>

class QDltMsg;

class DltMessageMatcher
class QDLT_EXPORT DltMessageMatcher
{
public:
using Pattern = std::variant<QString, QRegularExpression>;
Expand Down
6 changes: 4 additions & 2 deletions qdlt/qdlt.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
PROJECT = qdlt
TEMPLATE = lib

CONFIG += c++11
CONFIG += c++1z
DEFINES += QDLT_LIBRARY
*-gcc* {
QMAKE_CFLAGS += -std=gnu99
Expand All @@ -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\\\"
Expand Down Expand Up @@ -65,6 +65,7 @@ SOURCES += \
qdltexporter.cpp \
fieldnames.cpp \
qdltimporter.cpp \
dltmessagematcher.cpp \

HEADERS += qdlt.h \
export_rules.h \
Expand Down Expand Up @@ -96,6 +97,7 @@ HEADERS += qdlt.h \
qdltexporter.h \
fieldnames.h \
qdltimporter.h \
dltmessagematcher.h \

unix:VERSION = 1.0.0

Expand Down
6 changes: 1 addition & 5 deletions tools/tests/CMakeLists.txt → qdlt/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
find_package(GTest REQUIRED)

enable_testing()

add_executable(test_tools
test_dltmessagematcher.cpp
)
target_link_libraries(
test_tools
PRIVATE
GTest::gtest_main
tools
qdlt
)

File renamed without changes.
1 change: 0 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ add_executable(dlt-viewer

target_link_libraries(dlt-viewer
qdlt
tools
${QT_PREFIX}::Core
${QT_PREFIX}::Network
${QT_PREFIX}::Widgets
Expand Down
3 changes: 2 additions & 1 deletion src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
9 changes: 0 additions & 9 deletions tools/CMakeLists.txt

This file was deleted.

0 comments on commit a3de08f

Please sign in to comment.