forked from BehaviorTree/Groot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
217 lines (171 loc) · 6.46 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
cmake_minimum_required(VERSION 3.2)
# Update the policy setting to avoid an error when loading the ament_cmake package
# at the current cmake version level
if(POLICY CMP0057)
cmake_policy(SET CMP0057 NEW)
endif()
project(groot)
set(CMAKE_CXX_STANDARD 14)
find_package(Qt5 COMPONENTS Core Widgets Gui OpenGL Xml Svg)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake")
#############################################################
find_package(ament_cmake QUIET)
if(ament_cmake_FOUND)
find_package(behaviortree_cpp_v3 REQUIRED)
set(dependencies
behaviortree_cpp_v3
)
message(STATUS "------------------------------------------------")
message(STATUS "BehaviourTreeEditor is being built using AMENT.")
message(STATUS "------------------------------------------------")
elseif( CATKIN_DEVEL_PREFIX OR CATKIN_BUILD_BINARY_PACKAGE)
# http://answers.ros.org/question/230877/optionally-build-a-package-with-catkin/
set(catkin_FOUND 1)
add_definitions( -DUSING_ROS )
endif()
if(catkin_FOUND)
find_package(catkin REQUIRED COMPONENTS behavior_tree_core rosbag rosbag_storage roscpp)
find_package(behavior_tree_core 3.2.0 REQUIRED)
find_package(cmake_modules REQUIRED)
find_package(TinyXML2 REQUIRED)
message(STATUS "------------------------------------------------")
message(STATUS "BehaviourTreeEditor is being built using CATKIN.")
message(STATUS "------------------------------------------------")
catkin_package(
INCLUDE_DIRS
LIBRARIES qt_node_editor
CATKIN_DEPENDS behavior_tree_core
DEPENDS TinyXML2
)
endif()
#############################################################
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
add_definitions(${Qt5Widgets_DEFINITIONS} -DNODE_EDITOR_STATIC )
set(CMAKE_CXX_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
#set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
#set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_STATIC_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
if(ament_cmake_FOUND)
INCLUDE_DIRECTORIES(include ./QtNodeEditor/include ./)
else()
INCLUDE_DIRECTORIES( ${catkin_INCLUDE_DIRS} ${TinyXML2_INCLUDE_DIRS} ./QtNodeEditor/include ./ )
endif()
add_subdirectory( QtNodeEditor )
##########################################
# FIX ME in the future....
set(BUILD_EXAMPLES OFF CACHE BOOL "")
set(BUILD_UNIT_TESTS OFF CACHE BOOL "")
set(BUILD_TOOLS OFF CACHE BOOL "")
set(BUILD_TESTING OFF CACHE BOOL "")
set(CATKIN_ENABLE_TESTING OFF CACHE BOOL "")
if(NOT catkin_FOUND AND NOT ament_cmake_FOUND)
# look for BehaviorTree.CPP on the system
find_package(BehaviorTreeV3)
if (NOT BehaviorTree_FOUND)
# use git submodule only if you are not compiling with catkin
add_subdirectory( depend/BehaviorTree.CPP )
include_directories( depend/BehaviorTree.CPP/include )
endif()
endif()
##########################################
set(APP_CPPS
./bt_editor/models/BehaviorTreeNodeModel.cpp
./bt_editor/models/SubtreeNodeModel.cpp
./bt_editor/mainwindow.cpp
./bt_editor/editor_flowscene.cpp
./bt_editor/utils.cpp
./bt_editor/bt_editor_base.cpp
./bt_editor/graphic_container.cpp
./bt_editor/startup_dialog.cpp
./bt_editor/sidepanel_editor.cpp
./bt_editor/sidepanel_replay.cpp
./bt_editor/custom_node_dialog.cpp
./bt_editor/XML_utilities.cpp
)
set(RESOURCE_FILES
./bt_editor/resources/icons.qrc
./bt_editor/resources/style.qrc
./test_data/test_files.qrc
)
set(FORMS_UI
./bt_editor/about_dialog.ui
./bt_editor/mainwindow.ui
./bt_editor/action_form.ui
./bt_editor/sidepanel_editor.ui
./bt_editor/sidepanel_replay.ui
./bt_editor/startup_dialog.ui
./bt_editor/custom_node_dialog.ui
)
if(catkin_FOUND)
list(APPEND FORMS_UI ./bt_editor/ros_dialog.ui)
list(APPEND APP_CPPS ./bt_editor/ros_dialog.cpp
./bt_editor/ros_utils.cpp
)
endif()
find_package(ZMQ)
if( ZMQ_FOUND )
message(STATUS "ZeroMQ found.")
add_definitions( -DZMQ_FOUND )
set(APP_CPPS ${APP_CPPS} ./bt_editor/sidepanel_monitor.cpp )
set(FORMS_UI ${FORMS_UI} ./bt_editor/sidepanel_monitor.ui )
else()
message(WARNING "ZeroMQ NOT found. Real-time monitoring disabled.")
endif()
QT5_WRAP_UI(FORMS_HEADERS ${FORMS_UI})
add_library(behavior_tree_editor SHARED
${APP_CPPS}
${FORMS_HEADERS}
)
list(APPEND GROOT_TARGETS behavior_tree_editor)
SET(GROOT_DEPENDENCIES QtNodeEditor )
if(ament_cmake_FOUND)
ament_target_dependencies(behavior_tree_editor ${dependencies})
elseif( catkin_FOUND )
SET(GROOT_DEPENDENCIES ${GROOT_DEPENDENCIES} ${catkin_LIBRARIES} ${TinyXML2_LIBRARIES})
else()
SET(GROOT_DEPENDENCIES ${GROOT_DEPENDENCIES} behavior_tree_core )
endif()
if( ZMQ_FOUND )
SET(GROOT_DEPENDENCIES ${GROOT_DEPENDENCIES} zmq)
endif()
target_link_libraries(behavior_tree_editor PUBLIC ${GROOT_DEPENDENCIES} )
add_executable(Groot ./bt_editor/main.cpp ${RESOURCE_FILES})
target_link_libraries(Groot PUBLIC behavior_tree_editor)
list(APPEND GROOT_TARGETS Groot)
# tests
add_subdirectory(test)
######################################################
# INSTALL
if(ament_cmake_FOUND)
set( GROOT_LIB_DESTINATION lib )
set( GROOT_INC_DESTINATION include )
set( GROOT_BIN_DESTINATION lib/${PROJECT_NAME} )
elseif(catkin_FOUND)
set( GROOT_LIB_DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} )
set( GROOT_INC_DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} )
set( GROOT_BIN_DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} )
set( GROOT_SHARE_DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} )
else()
set( GROOT_LIB_DESTINATION lib )
set( GROOT_INC_DESTINATION include )
set( GROOT_BIN_DESTINATION bin )
set( GROOT_SHARE_DESTINATION share )
endif()
INSTALL(TARGETS ${GROOT_TARGETS}
ARCHIVE DESTINATION ${GROOT_LIB_DESTINATION}
LIBRARY DESTINATION ${GROOT_LIB_DESTINATION}
RUNTIME DESTINATION ${GROOT_BIN_DESTINATION}
)
INSTALL( FILES ${CMAKE_CURRENT_SOURCE_DIR}/groot_icon.png
DESTINATION ${GROOT_SHARE_DESTINATION}/icons/hicolor/256x256)
INSTALL( FILES ${CMAKE_CURRENT_SOURCE_DIR}/Groot.desktop
DESTINATION ${GROOT_SHARE_DESTINATION}/applications)
if(ament_cmake_FOUND)
ament_export_include_directories(include)
ament_export_dependencies(${GROOT_DEPENDENCIES} ${dependencies})
ament_export_libraries(behavior_tree_editor)
ament_package()
endif()