@@ -21,19 +21,52 @@ list(APPEND CMAKE_MODULE_PATH
2121 "${CMAKE_CURRENT_SOURCE_DIR} /ompl/CMakeModules" )
2222include (GNUInstallDirs)
2323include (FeatureSummary)
24- include (CompilerSettings)
25- include (OMPLUtils)
24+ # include(CompilerSettings)
25+ # include(OMPLUtils)
26+
27+ option (USE_BUNDLED_OMPL "Use OMPL from subdirectory instead of system install" OFF )
28+ if (NOT USE_BUNDLED_OMPL)
29+ find_package (ompl CONFIG QUIET )
30+ if (ompl_FOUND)
31+ message (STATUS "Using installed OMPL" )
32+ else ()
33+ message (WARNING "OMPL not found. Falling back to bundled OMPL" )
34+ set (USE_BUNDLED_OMPL ON CACHE BOOL "Use bundled OMPL" FORCE)
35+ endif ()
36+ endif ()
37+
38+ # Only include custom modules if OMPL is being built as subdirectory
39+ if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR} /ompl/CMakeModules/CompilerSettings.cmake" )
40+ list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /ompl/CMakeModules" )
41+ include (CompilerSettings)
42+ include (OMPLUtils)
43+ endif ()
2644
2745set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR} /bin" )
2846set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR} /lib" )
2947
3048set (OMPLAPP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR} /src;${CMAKE_CURRENT_BINARY_DIR} /src" )
3149set (OMPLAPP_RESOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /resources" )
32- set (OMPL_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR} /ompl/src;${CMAKE_CURRENT_BINARY_DIR} /ompl/src" )
50+
51+ if (NOT USE_BUNDLED_OMPL)
52+ # OMPL is installed, we use its targets
53+ message (STATUS "Using installed OMPL" )
54+ else ()
55+ # OMPL is bundled, we include manually
56+ # include_directories("${CMAKE_CURRENT_SOURCE_DIR}/ompl/src")
57+ set (OMPL_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR} /ompl/src;${CMAKE_CURRENT_BINARY_DIR} /ompl/src" )
58+ set (OMPL_CMAKE_UTIL_DIR "${CMAKE_CURRENT_SOURCE_DIR} /ompl/CMakeModules"
59+ CACHE FILEPATH "Path to directory with auxiliary CMake scripts for OMPL" )
60+ endif ()
61+
3362set (OMPL_DEMO_INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR} /ompl/demos"
34- CACHE STRING "Relative path to directory where demos will be installed" )
35- set (OMPL_CMAKE_UTIL_DIR "${CMAKE_CURRENT_SOURCE_DIR} /ompl/CMakeModules"
36- CACHE FILEPATH "Path to directory with auxiliary CMake scripts for OMPL" )
63+ CACHE STRING "Relative path to directory where demos will be installed" )
64+
65+ # set(OMPL_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/ompl/src;${CMAKE_CURRENT_BINARY_DIR}/ompl/src")
66+ # set(OMPL_DEMO_INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/ompl/demos"
67+ # CACHE STRING "Relative path to directory where demos will be installed")
68+ # set(OMPL_CMAKE_UTIL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ompl/CMakeModules"
69+ # CACHE FILEPATH "Path to directory with auxiliary CMake scripts for OMPL")
3770
3871if (MSVC )
3972 add_definitions (-DBOOST_ALL_NO_LIB)
@@ -78,31 +111,61 @@ set_package_properties(Python PROPERTIES
78111# This includes our own FindPython.cmake in ompl/CMakeModules. It defines,
79112# among other things, the find_python_module() function used below.
80113find_package (Python)
81- find_boost_python()
114+ # find_boost_python()
115+
116+ if (USE_BUNDLED_OMPL AND NOT TARGET docker)
117+ include (OMPLUtils)
118+ find_boost_python()
119+ find_python_module(PyQt5 QUIET )
120+ else ()
121+ message (STATUS "Skipping internal OMPL Python utilities when using external OMPL install" )
122+ endif ()
82123
83124if (PYTHON_FOUND)
84125 set_package_properties(pypy PROPERTIES
85126 URL "http://pypy.org"
86127 PURPOSE "Used to speed up the generation of python bindings." )
87128 find_package (pypy QUIET )
88129endif ()
89- find_python_module(PyQt5 QUIET )
90- if (NOT PY_PYQT5)
91- find_python_module(PySide2 QUIET )
92- if (NOT PY_PYSIDE2)
93- find_python_module(PyQt4 QUIET )
94- if (NOT PY_PYQT4)
95- find_python_module(PySide QUIET )
96- if (NOT PY_PYSIDE)
97- message (WARNING "Either PyQt5, PySide2, PyQt4 or PySide needs to be installed to use the GUI." )
130+
131+ if (USE_BUNDLED_OMPL)
132+ find_python_module(PyQt5 QUIET )
133+ if (NOT PY_PYQT5)
134+ find_python_module(PySide2 QUIET )
135+ if (NOT PY_PYSIDE2)
136+ find_python_module(PyQt4 QUIET )
137+ if (NOT PY_PYQT4)
138+ find_python_module(PySide QUIET )
139+ if (NOT PY_PYSIDE)
140+ message (WARNING "Either PyQt5, PySide2, PyQt4 or PySide needs to be installed to use the GUI." )
141+ endif ()
98142 endif ()
99143 endif ()
100144 endif ()
145+
146+ find_python_module(OpenGL)
147+ if (NOT OPENGL_FOUND OR NOT PY_OPENGL)
148+ message (WARNING "Both OpenGL and the Python OpenGL module need to be installed to use the GUI" )
149+ endif ()
101150endif ()
102- find_python_module(OpenGL)
103- if (NOT OPENGL_FOUND OR NOT PY_OPENGL)
104- message (WARNING "Both OpenGL and the Python OpenGL module need to be installed to use the GUI" )
105- endif ()
151+
152+ # find_python_module(PyQt5 QUIET)
153+ # if(NOT PY_PYQT5)
154+ # find_python_module(PySide2 QUIET)
155+ # if(NOT PY_PYSIDE2)
156+ # find_python_module(PyQt4 QUIET)
157+ # if(NOT PY_PYQT4)
158+ # find_python_module(PySide QUIET)
159+ # if (NOT PY_PYSIDE)
160+ # message(WARNING "Either PyQt5, PySide2, PyQt4 or PySide needs to be installed to use the GUI.")
161+ # endif()
162+ # endif()
163+ # endif()
164+ # endif()
165+ # find_python_module(OpenGL)
166+ # if (NOT OPENGL_FOUND OR NOT PY_OPENGL)
167+ # message(WARNING "Both OpenGL and the Python OpenGL module need to be installed to use the GUI")
168+ # endif()
106169set_package_properties(Eigen3 PROPERTIES
107170 URL "http://eigen.tuxfamily.org"
108171 PURPOSE "A linear algebra library used throughout OMPL." )
@@ -167,9 +230,17 @@ if(Boost_VERSION_STRING VERSION_LESS "1.63.0")
167230 include_directories ("${CMAKE_CURRENT_SOURCE_DIR} /ompl/src/external" )
168231endif ()
169232
170- include_directories (
171- "${OMPLAPP_INCLUDE_DIRS} "
172- "${OMPL_INCLUDE_DIRS} " )
233+ # include_directories(
234+ # "${OMPLAPP_INCLUDE_DIRS}"
235+ # "${OMPL_INCLUDE_DIRS}")
236+
237+ if (OMPL_INCLUDE_DIRS)
238+ include_directories ("${OMPL_INCLUDE_DIRS} " )
239+ endif ()
240+
241+ include_directories ("${OMPLAPP_INCLUDE_DIRS} " )
242+
243+
173244
174245set (OMPLAPP_MODULE_LIBRARIES
175246 ${OPENGL_LIBRARIES}
@@ -185,7 +256,18 @@ if (OPENGL_INCLUDE_DIR)
185256endif ()
186257
187258# Numpy is used to convert Eigen matrices/vectors to numpy arrays
188- if (PYTHON_FOUND AND NOT Boost_VERSION_STRING VERSION_LESS "1.63.0" )
259+ # if(PYTHON_FOUND AND NOT Boost_VERSION_STRING VERSION_LESS "1.63.0")
260+ # find_python_module(numpy)
261+ # if (PY_NUMPY)
262+ # find_boost_numpy()
263+ # if(Boost_NUMPY_LIBRARY)
264+ # set(OMPL_HAVE_NUMPY 1)
265+ # include_directories("${PY_NUMPY}/core/include")
266+ # endif()
267+ # endif()
268+ # endif()
269+
270+ if (USE_BUNDLED_OMPL AND PYTHON_FOUND AND NOT Boost_VERSION_STRING VERSION_LESS "1.63.0" )
189271 find_python_module(numpy)
190272 if (PY_NUMPY)
191273 find_boost_numpy()
@@ -196,6 +278,7 @@ if(PYTHON_FOUND AND NOT Boost_VERSION_STRING VERSION_LESS "1.63.0")
196278 endif ()
197279endif ()
198280
281+
199282set_package_properties(PQP PROPERTIES
200283 URL "http://gamma.cs.unc.edu/SSV/"
201284 PURPOSE "Used as an alternative, additional collision checking library (the default is FCL)." )
@@ -206,18 +289,53 @@ if(PQP_FOUND)
206289 set (OMPLAPP_LIBRARIES ${OMPLAPP_LIBRARIES} ${PQP_LIBRARY} )
207290endif ()
208291
209- add_subdirectory (ompl/doc )
210- add_subdirectory (ompl/src)
211- add_subdirectory (ompl/py-bindings)
212- add_subdirectory (ompl/tests)
213- add_subdirectory (ompl/demos)
214- add_subdirectory (ompl/scripts)
292+ # find_package(ompl CONFIG QUIET)
293+
294+ if (NOT ompl_FOUND)
295+ message (WARNING "Installed OMPL not found. Falling back to building bundled OMPL." )
296+
297+ set (OMPL_BUILD_PYBINDINGS OFF CACHE BOOL "Disable Python bindings in OMPL" )
298+ add_subdirectory (ompl/doc )
299+ add_subdirectory (ompl/src)
300+ add_subdirectory (ompl/py-bindings)
301+ add_subdirectory (ompl/tests)
302+ add_subdirectory (ompl/demos)
303+ add_subdirectory (ompl/scripts)
304+ set (USE_BUNDLED_OMPL TRUE )
305+ else ()
306+ set (USE_BUNDLED_OMPL FALSE )
307+ endif ()
308+
309+ if (NOT USE_BUNDLED_OMPL)
310+ function (install_python)
311+ # No-op macro when using installed OMPL
312+ endfunction ()
313+ endif ()
314+
315+ if (NOT USE_BUNDLED_OMPL)
316+ function (target_link_flags)
317+ # noop fallback for external OMPL installs
318+ endfunction ()
319+ endif ()
320+
321+
322+ # add_subdirectory(ompl/doc)
323+ # add_subdirectory(ompl/src)
324+ # add_subdirectory(ompl/py-bindings)
325+ # add_subdirectory(ompl/tests)
326+ # add_subdirectory(ompl/demos)
327+ # add_subdirectory(ompl/scripts)
215328add_subdirectory (gui)
216329add_subdirectory (doc )
217330add_subdirectory (src)
218331add_subdirectory (demos)
219332add_subdirectory (benchmark)
220- add_subdirectory (py-bindings)
333+ # add_subdirectory(py-bindings)
334+
335+ if (USE_BUNDLED_OMPL)
336+ add_subdirectory (py-bindings)
337+ endif ()
338+
221339
222340install (DIRECTORY resources
223341 DESTINATION "${CMAKE_INSTALL_DATAROOTDIR} /ompl"
@@ -244,7 +362,8 @@ if(OMPL_BUILD_PYBINDINGS)
244362 endif ()
245363endif ()
246364
247- if (OPENGL_FOUND AND NOT MSVC )
365+ # if(OPENGL_FOUND AND NOT MSVC)
366+ if (OPENGL_FOUND AND NOT MSVC AND USE_BUNDLED_OMPL)
248367 target_link_flags(ompl ompl_app_base ompl_app)
249368 set (PKG_NAME "ompl" )
250369 set (PKG_DESC "The Open Motion Planning Library" )
@@ -257,26 +376,27 @@ if(OPENGL_FOUND AND NOT MSVC)
257376 COMPONENT ompl)
258377endif ()
259378
260- include (CMakePackageConfigHelpers)
379+ # include(CMakePackageConfigHelpers)
261380set (INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} )
262381set (LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} )
263- configure_package_config_file(ompl/omplConfig.cmake.in
264- ${CMAKE_CURRENT_BINARY_DIR} /omplConfig.cmake
265- INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} /ompl/cmake
266- PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR
267- NO_CHECK_REQUIRED_COMPONENTS_MACRO)
268- write_basic_package_version_file(
269- ${CMAKE_CURRENT_BINARY_DIR} /omplConfigVersion.cmake
270- VERSION ${PROJECT_VERSION}
271- COMPATIBILITY SameMajorVersion)
272- install (FILES ${CMAKE_CURRENT_BINARY_DIR} /omplConfig.cmake
273- ${CMAKE_CURRENT_BINARY_DIR} /omplConfigVersion.cmake
274- DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} /ompl/cmake
275- COMPONENT ompl)
276- install (TARGETS ompl
277- EXPORT omplExport
278- DESTINATION ${CMAKE_INSTALL_LIBDIR}
279- COMPONENT ompl)
382+ # configure_package_config_file(ompl/omplConfig.cmake.in
383+ # ${CMAKE_CURRENT_BINARY_DIR}/omplConfig.cmake
384+ # INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ompl/cmake
385+ # PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR
386+ # NO_CHECK_REQUIRED_COMPONENTS_MACRO)
387+ # write_basic_package_version_file(
388+ # ${CMAKE_CURRENT_BINARY_DIR}/omplConfigVersion.cmake
389+ # VERSION ${PROJECT_VERSION}
390+ # COMPATIBILITY SameMajorVersion)
391+ # install(FILES ${CMAKE_CURRENT_BINARY_DIR}/omplConfig.cmake
392+ # ${CMAKE_CURRENT_BINARY_DIR}/omplConfigVersion.cmake
393+ # DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ompl/cmake
394+ # COMPONENT ompl)
395+ # install(TARGETS ompl
396+ # EXPORT omplExport
397+ # DESTINATION ${CMAKE_INSTALL_LIBDIR}
398+ # COMPONENT ompl)
399+
280400install (TARGETS ompl_app_base
281401 EXPORT omplExport
282402 DESTINATION ${CMAKE_INSTALL_LIBDIR}
@@ -287,23 +407,23 @@ if(TARGET ompl_app)
287407 DESTINATION ${CMAKE_INSTALL_LIBDIR}
288408 COMPONENT omplapp)
289409endif ()
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" )
410+ # install(EXPORT omplExport
411+ # NAMESPACE ompl::
412+ # DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ompl/cmake)
413+ # export(EXPORT omplExport
414+ # FILE "${CMAKE_CURRENT_BINARY_DIR}/omplExport.cmake")
295415
296416# script to install ompl on Ubuntu
297- configure_file ("${CMAKE_CURRENT_SOURCE_DIR} /ompl/install-ompl-ubuntu.sh.in"
298- "${CMAKE_CURRENT_BINARY_DIR} /install-ompl-ubuntu.sh" @ONLY)
417+ # configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ompl/install-ompl-ubuntu.sh.in"
418+ # "${CMAKE_CURRENT_BINARY_DIR}/install-ompl-ubuntu.sh" @ONLY)
299419
300420# uninstall target
301- configure_file (
302- "${CMAKE_CURRENT_SOURCE_DIR} /ompl/CMakeModules/cmake_uninstall.cmake.in"
303- "${CMAKE_CURRENT_BINARY_DIR} /cmake_uninstall.cmake"
304- IMMEDIATE @ONLY)
305- add_custom_target (uninstall
306- COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR} /cmake_uninstall.cmake" )
421+ # configure_file(
422+ # "${CMAKE_CURRENT_SOURCE_DIR}/ompl/CMakeModules/cmake_uninstall.cmake.in"
423+ # "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
424+ # IMMEDIATE @ONLY)
425+ # add_custom_target(uninstall
426+ # COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
307427
308428include (CPackSettings)
309429
@@ -343,6 +463,58 @@ endif()
343463
344464# Create targets for building docker images
345465# See ompl/CMakeModules/OMPLUtils.cmake and ompl/scripts/docker for details
346- add_docker_target(ompl ompl)
347- add_docker_target(plannerarena ompl/scripts)
348- add_docker_target(omplapp)
466+ # add_docker_target(ompl ompl)
467+ # add_docker_target(plannerarena ompl/scripts)
468+ # add_docker_target(omplapp)
469+ if (USE_BUNDLED_OMPL)
470+ # Install script for Ubuntu
471+ configure_file ("${CMAKE_CURRENT_SOURCE_DIR} /ompl/install-ompl-ubuntu.sh.in"
472+ "${CMAKE_CURRENT_BINARY_DIR} /install-ompl-ubuntu.sh" @ONLY)
473+
474+ # Uninstall target
475+ configure_file (
476+ "${CMAKE_CURRENT_SOURCE_DIR} /ompl/CMakeModules/cmake_uninstall.cmake.in"
477+ "${CMAKE_CURRENT_BINARY_DIR} /cmake_uninstall.cmake"
478+ IMMEDIATE @ONLY)
479+ add_custom_target (uninstall
480+ COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR} /cmake_uninstall.cmake" )
481+
482+ # .pc file for pkg-config
483+ configure_file ("${CMAKE_CURRENT_SOURCE_DIR} /ompl/CMakeModules/ompl.pc.in"
484+ "${CMAKE_CURRENT_BINARY_DIR} /ompl.pc" @ONLY)
485+ install (FILES "${CMAKE_CURRENT_BINARY_DIR} /ompl.pc"
486+ DESTINATION "${CMAKE_INSTALL_LIBDIR} /pkgconfig"
487+ COMPONENT ompl)
488+
489+ # CMake config files
490+ include (CMakePackageConfigHelpers)
491+ configure_package_config_file(
492+ ompl/omplConfig.cmake.in
493+ ${CMAKE_CURRENT_BINARY_DIR} /omplConfig.cmake
494+ INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} /ompl/cmake
495+ PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR
496+ NO_CHECK_REQUIRED_COMPONENTS_MACRO)
497+
498+ write_basic_package_version_file(
499+ ${CMAKE_CURRENT_BINARY_DIR} /omplConfigVersion.cmake
500+ VERSION ${PROJECT_VERSION}
501+ COMPATIBILITY SameMajorVersion)
502+
503+ install (FILES
504+ ${CMAKE_CURRENT_BINARY_DIR} /omplConfig.cmake
505+ ${CMAKE_CURRENT_BINARY_DIR} /omplConfigVersion.cmake
506+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} /ompl/cmake
507+ COMPONENT ompl)
508+
509+ install (TARGETS ompl EXPORT omplExport DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ompl)
510+ install (EXPORT omplExport
511+ NAMESPACE ompl::
512+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} /ompl/cmake)
513+ export (EXPORT omplExport
514+ FILE "${CMAKE_CURRENT_BINARY_DIR} /omplExport.cmake" )
515+
516+ # Docker targets
517+ add_docker_target(ompl ompl)
518+ add_docker_target(plannerarena ompl/scripts)
519+ add_docker_target(omplapp)
520+ endif ()
0 commit comments