-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
executable file
·103 lines (81 loc) · 2.79 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
cmake_minimum_required(VERSION 3.7)
project(plotjuggler_apbin_plugins)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#------- Include Qt dependencies -------
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
SET(CMAKE_AUTOUIC ON)
find_package(Qt5 REQUIRED COMPONENTS
Core
Concurrent
Widgets
Xml
Svg)
include_directories(
${Qt5Core_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
${Qt5Xml_INCLUDE_DIRS}
${Qt5Svg_INCLUDE_DIRS} )
set(QT_LIBRARIES
Qt5::Core
Qt5::Concurrent
Qt5::Widgets
Qt5::Xml
Qt5::Svg )
add_definitions( ${QT_DEFINITIONS} -DQT_PLUGIN )
set( PJ_LIBRARIES ${QT_LIBRARIES} )
#-------------- Switch units support ----------------
OPTION(ADD_UNITS "Add units support" OFF)
IF(ADD_UNITS)
add_compile_definitions("LABEL_WITH_UNIT")
message(STATUS "Enabling field units define.")
ENDIF(ADD_UNITS)
#--------------------------------------------------------
#-------------- Build with CATKIN (ROS1) ----------------
if( CATKIN_DEVEL_PREFIX OR catkin_FOUND OR CATKIN_BUILD_BINARY_PACKAGE)
set(COMPILING_WITH_CATKIN 1)
message(STATUS "COMPILING_WITH_CATKIN")
add_definitions(-DCOMPILED_WITH_CATKIN)
find_package(catkin REQUIRED COMPONENTS plotjuggler )
catkin_package(
CATKIN_DEPENDS plotjuggler
)
include_directories(${catkin_INCLUDE_DIRS})
list(APPEND ${PJ_LIBRARIES} ${catkin_LIBRARIES} )
set(PJ_PLUGIN_INSTALL_DIRECTORY ${CATKIN_PACKAGE_BIN_DESTINATION} )
#--------------------------------------------------------
#-------------- Build with AMENT (ROS2) -----------------
elseif( DEFINED ENV{AMENT_PREFIX_PATH})
set(COMPILING_WITH_AMENT 1)
message(STATUS "COMPILING_WITH_AMENT")
add_definitions(-DCOMPILED_WITH_AMENT)
find_package(ament_cmake REQUIRED)
find_package(plotjuggler REQUIRED)
set(PJ_PLUGIN_INSTALL_DIRECTORY lib/${PROJECT_NAME} )
#--------------------------------------------------------
#------------- Build without any ROS support ------------
else()
find_package(plotjuggler REQUIRED)
message(STATUS "PlotJuggler FOUND")
message(STATUS "plotjuggler_INCLUDE_DIR: ${plotjuggler_INCLUDE_DIR}")
message(STATUS "plotjuggler_LIBRARIES: ${plotjuggler_LIBRARIES}")
include_directories(${plotjuggler_INCLUDE_DIR})
list(APPEND PJ_LIBRARIES ${plotjuggler_LIBRARIES} )
set(PJ_PLUGIN_INSTALL_DIRECTORY bin )
endif()
#------- Create the libraries -------
add_library(DataAPBin SHARED
DataLoadAPBin/dataload_apbin.h
DataLoadAPBin/dataload_apbin.cpp )
target_link_libraries(DataAPBin
${PJ_LIBRARIES})
if (COMPILING_WITH_AMENT)
ament_target_dependencies(DataAPBin plotjuggler)
endif()
#------- Install the libraries -------
install(
TARGETS
DataAPBin
DESTINATION
${PJ_PLUGIN_INSTALL_DIRECTORY} )