-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
192 lines (170 loc) · 6.56 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
#*********************************************************************
#** **
#** File : CMakeLists.txt **
#** Authors: Viktor Richter **
#** **
#** **
#** GNU LESSER GENERAL PUBLIC LICENSE **
#** This file may be used under the terms of the GNU Lesser General **
#** Public License version 3.0 as published by the **
#** **
#** Free Software Foundation and appearing in the file LICENSE.LGPL **
#** included in the packaging of this file. Please review the **
#** following information to ensure the license requirements will **
#** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
#** **
#*********************************************************************
cmake_minimum_required(VERSION 3.5.1)
# this sets the projects name
project(pontoon VERSION 2.0.0 LANGUAGES CXX)
# some output
message(STATUS "")
message(STATUS "==============================================================")
message(STATUS "Configuring ${PROJECT_NAME} v${PROJECT_VERSION}:")
option(BUILD_WITH_ROS "Build with ros" OFF)
# adding cmake module path
#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
#include(FindDependency)
# Offer the user the choice of overriding the installation directories
set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
set(INSTALL_CMAKE_DIR "share/${PROJECT_NAME}/" CACHE PATH "Installation directory for CMake files")
set(INSTALL_DOCUMENTATION_DIR "share/${PROJECT_NAME}/doc" CACHE PATH "Installation directory for CMake files")
# Make relative paths absolute (needed later on)
set(INSTALL_CMAKE_DIR_REL "${INSTALL_CMAKE_DIR}")
foreach(p LIB BIN INCLUDE CMAKE)
set(var INSTALL_${p}_DIR)
if(NOT IS_ABSOLUTE "${${var}}")
set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
endforeach()
# rsb
find_package(RSB REQUIRED)
find_package(RST REQUIRED sandbox)
find_package(RST_EXPERIMENTAL REQUIRED)
find_package(rst-converters REQUIRED)
set(RSB_INCLUDE_DIRS
${RSB_INCLUDE_DIRS}
${RST_INCLUDE_DIRS}
${RST_CONVERTERS_INCLUDE_DIRS}
${RST_EXPERIMENTAL_INCLUDE_DIRS}
)
set(RSB_LIBRARY_DIRS
${RSB_RUNTIME_LIBRARY_DIRS}
${RST_RUNTIME_LIBRARY_DIRS}
${RST_EXPERIMENTAL_RUNTIME_LIBRARY_DIRS}
)
set(RSB_LIBRARIES
${RST_LIBRARIES}
${RSTSANDBOX_LIBRARIES}
${RST_EXPERIMENTAL_LIBRARIES}
${RSB_LIBRARIES}
${RST_CONVERTERS_LIBRARIES}
)
set(RSB_DEFINITIONS
${RST_CFLAGS}
${RSTSANDBOX_CFLAGS}
${RST_EXPERIMENTAL_CFLAGS}
)
# ros
if(BUILD_WITH_ROS)
find_package(sensor_msgs REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(roscpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(image_transport REQUIRED)
set(ROS_INCLUDE_DIRS
${sensor_msgs_INCLUDE_DIRS}
${cv_bridge_INCLUDE_DIRS}
${roscpp_INCLUDE_DIRS}
${std_msgs_INCLUDE_DIRS}
${image_transport_INCLUDE_DIRS}
)
set(ROS_LIBRARY_DIRS
${sensor_msgs_LIBRARY_DIRS}
${cv_bridge_LIBRARY_DIRS}
${roscpp_LIBRARY_DIRS}
${std_msgs_LIBRARY_DIRS}
${image_transport_LIBRARY_DIRS}
)
set(ROS_LIBRARIES
${sensor_msgs_LIBRARIES}
${cv_bridge_LIBRARIES}
${roscpp_LIBRARIES}
${std_msgs_LIBRARIES}
${image_transport_LIBRARIES}
)
endif(BUILD_WITH_ROS)
# boost
find_package(Boost 1.54 COMPONENTS date_time REQUIRED)
# zlib
find_package(ZLIB REQUIRED)
# opencv
find_package(OpenCV 3.0 REQUIRED COMPONENTS
core highgui
)
message(STATUS "opencv_found: ${OpenCV_core_FOUND}")
message(STATUS "opencv_libs: ${OpenCV_LIBS}")
if(NOT ${OpenCV_core_FOUND})
message(FATAL_ERROR "Could not find core component in OpenCV")
else()
if("${OpenCV_VERSION}" MATCHES "3.3.1")
if(${CMAKE_BUILD_TYPE} MATCHES "[Rr][Ee][Ll][Ww][Ii][Tt][Hh][Dd][Ee][Bb][Ii][Nn][Ff][Oo]")
if(${OpenCV_INSTALL_PATH} MATCHES ".*/ros/kinetic")
message(WARNING
"Building in ${CMAKE_BUILD_TYPE} mode against OpenCV ${OpenCV_VERSION} within a ros installation. "
"This combination may lead to OpenCV library not found errors. "
"Consider building in RELEASE or DEBUG mode."
)
endif()
endif()
endif()
endif()
message(STATUS "Looking for doxygen")
find_program(DOXYGEN_BIN NAMES doxygen)
if(NOT "${DOXYGEN_BIN}" STREQUAL "DOXYGEN_BIN-NOTFOUND")
message(STATUS "found Doxygen, a documentation can be built with 'make doc'")
add_custom_target(doc ALL
COMMAND ${DOXYGEN_BIN} ${PROJECT_BINARY_DIR}/Doxyfile
COMMENT "Creating html and tex documentation in doc/"
)
install(
DIRECTORY ${PROJECT_BINARY_DIR}/doc/html
DESTINATION "share/doc/${PROJECT_NAME}/"
DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE WORLD_READ WORLD_EXECUTE OWNER_EXECUTE GROUP_EXECUTE
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE
)
else()
message(STATUS " doxygen not found, documentation will not be available")
endif()
configure_file(
"${PROJECT_SOURCE_DIR}/Doxyfile.in"
"${PROJECT_BINARY_DIR}/Doxyfile"
)
add_subdirectory(src)
add_subdirectory(app)
##### setup cmake config #####
# Project name in caps
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER)
# Add all targets to the build-tree export set
export(TARGETS ${PROJECT_NAME} ${APPLICATIONS}
FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake")
# Create the Config.cmake and ConfigVersion files
file(RELATIVE_PATH REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}"
"${INSTALL_INCLUDE_DIR}")
# ... for the install tree
set(CONF_INCLUDE_DIRS "\${FFORMATION_CMAKE_DIR}/${REL_INCLUDE_DIR}")
configure_file(cmake/Config.cmake.in
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Config.cmake" @ONLY)
# ... for both
configure_file(cmake/ConfigVersion.cmake.in
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" @ONLY)
# Install the Config.cmake and ConfigVersion.cmake
install(FILES
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Config.cmake"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev)
# Install the export set for use with the install-tree
install(EXPORT ${PROJECT_NAME}Targets DESTINATION
"${INSTALL_CMAKE_DIR_REL}" COMPONENT dev)