Skip to content

Commit 11d8a8b

Browse files
committed
modernize cmake syntax
1 parent 4477917 commit 11d8a8b

File tree

7 files changed

+44
-78
lines changed

7 files changed

+44
-78
lines changed

CMakeLists.txt

Lines changed: 41 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.12)
22
project(omplapp VERSION 1.6.0 LANGUAGES CXX)
33
set(OMPL_ABI_VERSION 17)
44

@@ -15,8 +15,7 @@ endif()
1515

1616
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
1717

18-
set(CMAKE_MODULE_PATH
19-
"${CMAKE_MODULE_PATH}"
18+
list(APPEND CMAKE_MODULE_PATH
2019
"${CMAKE_ROOT_DIR}/cmake/Modules"
2120
"${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules"
2221
"${CMAKE_CURRENT_SOURCE_DIR}/ompl/CMakeModules")
@@ -49,8 +48,7 @@ set_package_properties(Boost PROPERTIES
4948
URL "http://boost.org"
5049
PURPOSE "Used throughout OMPL for data serialization, graphs, etc.")
5150
set(Boost_USE_MULTITHREADED ON)
52-
set(Boost_NO_BOOST_CMAKE ON)
53-
find_package(Boost 1.58 QUIET REQUIRED COMPONENTS serialization filesystem system program_options)
51+
find_package(Boost 1.58 REQUIRED COMPONENTS serialization filesystem system program_options)
5452

5553
# on macOS we need to check whether to use libc++ or libstdc++ with clang++
5654
if(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
@@ -113,31 +111,39 @@ set_package_properties(Triangle PROPERTIES
113111
URL "http://www.cs.cmu.edu/~quake/triangle.html"
114112
PURPOSE "Used to create triangular decompositions of polygonal 2D environments.")
115113
find_package(Triangle QUIET)
114+
set(OMPL_EXTENSION_TRIANGLE ${TRIANGLE_FOUND})
115+
116116
set_package_properties(flann PROPERTIES
117117
URL "https://github.com/mariusmuja/flann"
118118
PURPOSE "If detetected, FLANN can be used for nearest neighbor queries by OMPL.")
119119
find_package(flann CONFIG 1.9.2 QUIET)
120+
if (flann_FOUND)
121+
set(OMPL_HAVE_FLANN 1)
122+
endif()
123+
120124
set_package_properties(spot PROPERTIES
121125
URL "http://spot.lrde.epita.fr"
122126
PURPOSE "Used for constructing finite automata from LTL formulae.")
123127
find_package(spot)
128+
if (spot_FOUND)
129+
set(OMPL_HAVE_SPOT 1)
130+
endif()
131+
124132
set_package_properties(assimp PROPERTIES
125133
URL "http://assimp.org"
126134
PURPOSE "Used in ompl_app for reading meshes representing robots and environments.")
127135
find_package(assimp REQUIRED)
128-
set_package_properties(ccd PROPERTIES
129-
URL "https://github.com/danfis/libccd"
130-
PURPOSE "Collision detection library used by fcl.")
131-
find_package(ccd REQUIRED)
136+
132137
set_package_properties(fcl PROPERTIES
133138
URL "https://github.com/flexible-collision-library/fcl"
134139
PURPOSE "The default collision checking library.")
135-
find_package(octomap QUIET)
136140
find_package(fcl REQUIRED)
141+
137142
set_package_properties(Threads PROPERTIES
138143
URL "https://en.wikipedia.org/wiki/POSIX_Threads"
139144
PURPOSE "Pthreads is sometimes needed, depending on OS / compiler.")
140145
find_package(Threads QUIET)
146+
141147
set_package_properties(Doxygen PROPERTIES
142148
URL "http://doxygen.org"
143149
PURPOSE "Used to create the OMPL documentation (i.e., http://ompl.kavrakilab.org).")
@@ -161,49 +167,23 @@ if(Boost_VERSION_STRING VERSION_LESS "1.63.0")
161167
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/ompl/src/external")
162168
endif()
163169

164-
include_directories(SYSTEM "${Boost_INCLUDE_DIR}")
165170
include_directories(
166171
"${OMPLAPP_INCLUDE_DIRS}"
167-
"${OMPL_INCLUDE_DIRS}"
168-
"${EIGEN3_INCLUDE_DIR}"
169-
"${FCL_INCLUDE_DIRS}"
170-
"${ASSIMP_INCLUDE_DIRS}")
171-
172-
# ROS installs fcl in /usr. In /usr/include/fcl/config.h it says octomap was
173-
# enabled. Octomap is installed in /opt/ros/${ROS_DISTRO}/include (most
174-
# likely), but fcl.pc doesn't have that information, so we just add it to the
175-
# include path.
176-
if(DEFINED ENV{ROS_DISTRO})
177-
include_directories("/opt/ros/$ENV{ROS_DISTRO}/include")
178-
endif()
172+
"${OMPL_INCLUDE_DIRS}")
179173

180174
set(OMPLAPP_MODULE_LIBRARIES
181175
${OPENGL_LIBRARIES}
182-
${ASSIMP_LIBRARY}
183-
${FCL_LIBRARIES})
176+
assimp::assimp
177+
fcl::fcl)
184178
set(OMPLAPP_LIBRARIES
185179
${OPENGL_LIBRARIES}
186-
${ASSIMP_LIBRARIES}
187-
${FCL_LIBRARIES})
188-
link_directories(${ASSIMP_LIBRARY_DIRS} ${CCD_LIBRARY_DIRS} ${OCTOMAP_LIBRARY_DIRS} ${FCL_LIBRARY_DIRS})
180+
assimp::assimp
181+
fcl)
189182

190183
if (OPENGL_INCLUDE_DIR)
191184
include_directories("${OPENGL_INCLUDE_DIR}")
192185
endif()
193186

194-
set(OMPL_EXTENSION_TRIANGLE ${TRIANGLE_FOUND})
195-
if (OMPL_EXTENSION_TRIANGLE)
196-
include_directories(${TRIANGLE_INCLUDE_DIR})
197-
endif()
198-
199-
if (flann_FOUND)
200-
set(OMPL_HAVE_FLANN 1)
201-
endif()
202-
203-
if (spot_FOUND)
204-
set(OMPL_HAVE_SPOT 1)
205-
endif()
206-
207187
# Numpy is used to convert Eigen matrices/vectors to numpy arrays
208188
if(PYTHON_FOUND AND NOT Boost_VERSION_STRING VERSION_LESS "1.63.0")
209189
find_python_module(numpy)
@@ -268,10 +248,7 @@ if(OPENGL_FOUND AND NOT MSVC)
268248
target_link_flags(ompl ompl_app_base ompl_app)
269249
set(PKG_NAME "ompl")
270250
set(PKG_DESC "The Open Motion Planning Library")
271-
set(PKG_EXTERNAL_DEPS "eigen3 ${ompl_PKG_DEPS}")
272-
if(OMPL_EXTENSION_ODE)
273-
set(PKG_EXTERNAL_DEPS "${PKG_EXTERNAL_DEPS}")
274-
endif()
251+
set(PKG_EXTERNAL_DEPS "${ompl_PKG_DEPS}")
275252
set(PKG_OMPL_LIBS "-lompl -lompl_app_base -lompl_app ${ompl_LINK_FLAGS}")
276253
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ompl/CMakeModules/ompl.pc.in"
277254
"${CMAKE_CURRENT_BINARY_DIR}/ompl.pc" @ONLY)
@@ -296,6 +273,25 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/omplConfig.cmake
296273
${CMAKE_CURRENT_BINARY_DIR}/omplConfigVersion.cmake
297274
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ompl/cmake
298275
COMPONENT ompl)
276+
install(TARGETS ompl
277+
EXPORT omplExport
278+
DESTINATION ${CMAKE_INSTALL_LIBDIR}
279+
COMPONENT ompl)
280+
install(TARGETS ompl_app_base
281+
EXPORT omplExport
282+
DESTINATION ${CMAKE_INSTALL_LIBDIR}
283+
COMPONENT omplapp)
284+
if(TARGET ompl_app)
285+
install(TARGETS ompl_app
286+
EXPORT omplExport
287+
DESTINATION ${CMAKE_INSTALL_LIBDIR}
288+
COMPONENT omplapp)
289+
endif()
290+
install(EXPORT omplExport
291+
NAMESPACE ompl::
292+
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ompl/cmake)
293+
export(EXPORT omplExport
294+
FILE "${CMAKE_CURRENT_BINARY_DIR}/omplExport.cmake")
299295

300296
# script to install ompl on Ubuntu
301297
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ompl/install-ompl-ubuntu.sh.in"

CMakeModules/Findccd.cmake

Lines changed: 0 additions & 9 deletions
This file was deleted.

CMakeModules/Findfcl.cmake

Lines changed: 0 additions & 18 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ detailed installation instructions.
1313
OMPL.app has the following required dependencies:
1414

1515
* [Boost](https://www.boost.org) (version 1.58 or higher)
16-
* [CMake](https://www.cmake.org) (version 3.5 or higher)
16+
* [CMake](https://www.cmake.org) (version 3.12 or higher)
1717
* [Eigen](http://eigen.tuxfamily.org) (version 3.3 or higher)
1818
* [Assimp](http://assimp.org) (version 3.0.1270 or higher)
1919
* [FCL](https://github.com/flexible-collision-library/fcl) (version 0.3.1 or higher)

benchmark/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
add_executable(ompl_benchmark
22
CFGBenchmark.cpp BenchmarkOptions.cpp BenchmarkTypes.cpp benchmark.cpp)
3-
target_link_libraries(ompl_benchmark ${OMPLAPP_LIBRARIES} ompl ompl_app_base ${Boost_PROGRAM_OPTIONS_LIBRARY})
3+
target_link_libraries(ompl_benchmark ${OMPLAPP_LIBRARIES} ompl ompl_app_base Boost::program_options)
44
install(TARGETS ompl_benchmark
55
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
66
COMPONENT omplapp

ompl

Submodule ompl updated 90 files

src/omplapp/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ foreach(_target ${OMPLAPP_TARGETS})
3838
set_target_properties(${_target} PROPERTIES VERSION "${PROJECT_VERSION}" SOVERSION "${OMPL_ABI_VERSION}")
3939
endif(WIN32)
4040

41-
install(TARGETS ${_target}
42-
DESTINATION ${CMAKE_INSTALL_LIBDIR}
43-
COMPONENT omplapp)
4441
if(NOT MSVC)
4542
add_custom_command(TARGET ${_target} POST_BUILD
4643
COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:${_target}>"

0 commit comments

Comments
 (0)