-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathCMakeLists.txt
104 lines (90 loc) · 2.78 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
cmake_minimum_required(VERSION 3.7)
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
# Standalone build, call project and look for PlotJuggler
project(plotjuggler_can_plugins)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(PlotJuggler REQUIRED)
else()
# Included from project (assuming from PlotJuggler)
# Set PlotJuggler_LIBRARY manually since find_package fails in this configuration.
set(PlotJuggler_LIBRARY plotjuggler_base)
endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
SET(CMAKE_AUTOUIC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(APPLE AND EXISTS /usr/local/opt/qt5)
# Homebrew installs Qt5 (up to at least 5.9.1) in
# /usr/local/qt5, ensure it can be found by CMake since
# it is not in the default /usr/local prefix.
# source: https://github.com/Homebrew/homebrew-core/issues/8392#issuecomment-325226494
list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt5")
set(CMAKE_MACOSX_RPATH 1)
endif()
find_package(Qt5 REQUIRED COMPONENTS
Core
Widgets
Concurrent
Xml
Svg
)
find_package(Qt5SerialBus OPTIONAL_COMPONENTS
SerialBus
)
include_directories(
${Qt5Core_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
${Qt5Concurrent_INCLUDE_DIRS}
${Qt5Xml_INCLUDE_DIRS}
${PlotJuggler_INCLUDE_DIRS}
${Qt5Svg_INCLUDE_DIRS}
3rdparty/dbcppp/include
)
set(PJ_LIBRARIES
Qt5::Core
Qt5::Widgets
Qt5::Xml
Qt5::Concurrent
Qt5::Svg
${PlotJuggler_LIBRARY}
)
add_definitions(${QT_DEFINITIONS})
add_definitions(-DQT_PLUGIN)
add_subdirectory(3rdparty/dbcppp)
add_library(CanFrameProcessor STATIC
PluginsCommonCAN/CanFrameProcessor.cpp
PluginsCommonCAN/N2kMsg/GenericFastPacket.c
PluginsCommonCAN/select_can_database.h
PluginsCommonCAN/select_can_database.cpp
)
target_link_libraries(CanFrameProcessor
${PJ_LIBRARIES}
libdbcppp
)
set_property(TARGET CanFrameProcessor PROPERTY POSITION_INDEPENDENT_CODE ON)
add_library(DataLoadCAN SHARED
DataLoadCAN/dataload_can.h
DataLoadCAN/dataload_can.cpp)
target_link_libraries(DataLoadCAN
${PJ_LIBRARIES}
CanFrameProcessor
)
install(TARGETS DataLoadCAN DESTINATION bin)
# Build&Install DataStreamCAN only if SerialBus found.
if(${Qt5SerialBus_FOUND})
message("-- Found Qt5::SerialBus, building DataStreamCAN.")
add_library(DataStreamCAN SHARED
DataStreamCAN/datastream_can.h
DataStreamCAN/datastream_can.cpp
DataStreamCAN/connectdialog.h
DataStreamCAN/connectdialog.cpp)
target_link_libraries(DataStreamCAN
${PJ_LIBRARIES}
CanFrameProcessor
Qt5::SerialBus
)
install(TARGETS DataStreamCAN DESTINATION bin)
else()
message("-- Since Qt5::SerialBus not found, cannot build DataStreamCAN.")
endif()