-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
162 lines (122 loc) · 6.34 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
##############################################################################
# CMake
##############################################################################
cmake_minimum_required(VERSION 2.8.3)
set(PROJECT_NAME behavior_tree_interpreter)
project(${PROJECT_NAME} C CXX)
add_definitions(-std=c++11)
##############################################################################
# Catkin
##############################################################################
set(BEHAVIORTREEINTERPRETER_CONTROLLER_SOURCE_DIR
src/controller/source_updated)
set(BEHAVIORTREEINTERPRETER_CONTROLLER_INCLUDE_DIR
src/controller/include_updated)
set(BEHAVIORTREEINTERPRETER_CONTROLLER_TEST_DIR
src/controller/test
)
set(BEHAVIORTREEINTERPRETER_HEADER_FILES
${BEHAVIORTREEINTERPRETER_CONTROLLER_INCLUDE_DIR}/*.h
)
set(BEHAVIORTREEINTERPRETER_SOURCE_FILES
${BEHAVIORTREEINTERPRETER_CONTROLLER_SOURCE_DIR}/*.cpp
)
#set(BEHAVIORTREEINTERPRETER_HEADER_FILES
# ${BEHAVIORTREEINTERPRETER_VIEW_INCLUDE_DIR}/*.h
#)
set(CMAKE_AUTOMOC ON)
find_package(catkin REQUIRED COMPONENTS droneMsgsROS rviz roscpp image_transport aerostack_msgs behavior_execution_manager_msgs behavior_coordinator_msgs cv_bridge std_msgs geometry_msgs angles pugixml)
catkin_package(INCLUDE_DIRS ${BEHAVIORTREEINTERPRETER_INCLUDE_DIR} ${BEHAVIORTREEINTERPRETER_INCLUDE_DIR} CATKIN_DEPENDS angles pugixml DEPENDS yaml-cpp)
include_directories(${BEHAVIORTREEINTERPRETER_INCLUDE_DIR})
include_directories(${BEHAVIORTREEINTERPRETER_CONTROLLER_INCLUDE_DIR})
include_directories(${catkin_INCLUDE_DIRS})
link_directories(${catkin_LIBRARY_DIRS})
# check required dependencies
find_package(Boost REQUIRED)
find_package(ZLIB REQUIRED)
find_package(Threads REQUIRED)
find_package(OpenGL REQUIRED)
find_package(BehaviorTreeV3)
##############################################################################
# ZeroMQ
##############################################################################
## load in pkg-config support
find_package(PkgConfig)
## use pkg-config to get hints for 0mq locations
pkg_check_modules(PC_ZeroMQ QUIET zmq)
## use the hint from above to find where 'zmq.hpp' is located
find_path(ZeroMQ_INCLUDE_DIR
NAMES zmq.hpp
PATHS ${PC_ZeroMQ_INCLUDE_DIRS}
)
## use the hint from about to find the location of libzmq
find_library(ZeroMQ_LIBRARY
NAMES zmq
PATHS ${PC_ZeroMQ_LIBRARY_DIRS}
)
##############################################################################
# Qwt library
##############################################################################
FIND_PATH(QWT_INCLUDE_DIR NAMES qwt.h PATHS
/usr/include_updated
PATH_SUFFIXES qwt
)
MESSAGE(STATUS "qwt header: ${QWT_INCLUDE_DIR}")
find_library(QWT_LIB NAMES qwt-qt5)
MESSAGE(STATUS "Found Qwt: ${QWT_LIB}")
set(QWT_LIBRARY "/usr/lib/libqwt-qt5.so.6.1.2")
include_directories(${QWT_INCLUDE_DIR})
link_directories(${QWT_LIBRARY})
##############################################################################
# Qt Environment
##############################################################################
# included via the dependency call in package.xml
find_package(Qt5 COMPONENTS Core Gui Svg OpenGL Widgets PrintSupport REQUIRED)
#include(${QT_USE_FILE})
## to avoid conflict with boost signals it is needed to define QT_NO_KEYWORDS.
add_definitions(-DQT_NO_KEYWORDS)
ADD_DEFINITIONS(${QT_DEFINITIONS})
##############################################################################
# Sections
##############################################################################
file(GLOB_RECURSE QT_FORMS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/view/ui/*.ui)
file(GLOB QT_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/view/resources/*.qrc)
file(GLOB_RECURSE QT_MOC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS src/controller/include_updated/*.h)
QT5_ADD_RESOURCES(QT_RESOURCES_CPP ${QT_RESOURCES})
QT5_WRAP_UI(QT_FORMS_HPP ${QT_FORMS})
QT5_WRAP_CPP(QT_MOC_HPP ${QT_MOC})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
##############################################################################
# Sources
##############################################################################
file(GLOB_RECURSE QT_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS src/controller/source_updated/*.cpp)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fPIC")
##############################################################################
# Binaries
##############################################################################
#MESSAGE(STATUS "Found Qt: ${QT_LIBRARIES} ")
#add_executable(behavior_tree_interpreter ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_MOC_HPP} ${QT_FORMS_HPP})
#add_dependencies(behavior_tree_interpreter ${catkin_EXPORTED_TARGETS})
#target_link_libraries(behavior_tree_interpreter ${QWT_LIBRARY} ${QT_LIBRARIES} ${catkin_LIBRARIES} )
#install(TARGETS behavior_tree_interpreter RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
add_library(behavior_tree_interpreter_lib ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_MOC_HPP} ${QT_FORMS_HPP})
add_dependencies(behavior_tree_interpreter_lib ${catkin_EXPORTED_TARGETS})
target_link_libraries(behavior_tree_interpreter_lib ${QWT_LIB} ${catkin_LIBRARIES})
target_link_libraries(behavior_tree_interpreter_lib yaml-cpp)
qt5_use_modules(behavior_tree_interpreter_lib Core Gui Svg OpenGL Widgets PrintSupport Concurrent)
add_executable(behavior_tree_interpreter ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_MOC_HPP} ${QT_FORMS_HPP})
add_dependencies(behavior_tree_interpreter ${catkin_EXPORTED_TARGETS})
target_link_libraries(behavior_tree_interpreter behavior_tree_interpreter_lib)
target_link_libraries(behavior_tree_interpreter ${QWT_LIB} ${catkin_LIBRARIES})
## add the include directory to our compile directives
target_include_directories(behavior_tree_interpreter PUBLIC ${ZeroMQ_INCLUDE_DIR})
## at the 0mq library to our link directive
target_link_libraries(behavior_tree_interpreter PUBLIC ${ZeroMQ_LIBRARY})
#############
## Testing ##
#############
if (CATKIN_ENABLE_TESTING)
catkin_add_gtest(behavior_tree_interpreter_test ${BEHAVIORTREEINTERPRETER_CONTROLLER_TEST_DIR}/behavior_tree_interpreter_test.cpp)
target_link_libraries(behavior_tree_interpreter_test behavior_tree_interpreter_lib)
target_link_libraries(behavior_tree_interpreter_test ${catkin_LIBRARIES})
endif()##############################################################################