diff --git a/CMakeLists.txt b/CMakeLists.txt index edca49a..0dd0f51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,9 @@ endif() message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") -set(_ompl_cmake_modules_path "${CMAKE_CURRENT_SOURCE_DIR}/ompl/CMakeModules") +find_package(ompl CONFIG REQUIRED) + +set(_ompl_cmake_modules_path "${ompl_DIR}/CMakeModules") if(NOT EXISTS "${_ompl_cmake_modules_path}") message(FATAL_ERROR "Missing ${_ompl_cmake_modules_path}. Did you check out the submodules (\"git submodule update --init --recursive\"?") endif() @@ -49,7 +51,6 @@ set(OMPL_CMAKE_UTIL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ompl/CMakeModules" if(MSVC) add_definitions(-DBOOST_ALL_NO_LIB) - add_definitions(-DBOOST_PROGRAM_OPTIONS_DYN_LINK) endif(MSVC) # Ensure dynamic linking with boost unit_test_framework add_definitions(-DBOOST_TEST_DYN_LINK) @@ -157,12 +158,7 @@ find_package(Doxygen) enable_testing() include_directories(SYSTEM "${Boost_INCLUDE_DIR}") -include_directories( - "${OMPLAPP_INCLUDE_DIRS}" - "${OMPL_INCLUDE_DIRS}" - "${EIGEN3_INCLUDE_DIR}" - "${FCL_INCLUDE_DIRS}" - "${ASSIMP_INCLUDE_DIRS}") +include_directories("${OMPLAPP_INCLUDE_DIRS}") # ROS installs fcl in /usr. In /usr/include/fcl/config.h it says octomap was # enabled. Octomap is installed in /opt/ros/${ROS_DISTRO}/include (most @@ -174,13 +170,19 @@ endif() set(OMPLAPP_MODULE_LIBRARIES ${OPENGL_LIBRARIES} - ${ASSIMP_LIBRARY} - ${FCL_LIBRARIES}) + ccd + ompl::ompl + Eigen3::Eigen + assimp::assimp + fcl) set(OMPLAPP_LIBRARIES ${OPENGL_LIBRARIES} - ${ASSIMP_LIBRARIES} - ${FCL_LIBRARIES}) -link_directories(${ASSIMP_LIBRARY_DIRS} ${CCD_LIBRARY_DIRS} ${OCTOMAP_LIBRARY_DIRS} ${FCL_LIBRARY_DIRS}) + ccd + ompl::ompl + Eigen3::Eigen + assimp::assimp + fcl) +link_directories(${OCTOMAP_LIBRARY_DIRS}) if (OPENGL_INCLUDE_DIR) include_directories("${OPENGL_INCLUDE_DIR}") @@ -221,18 +223,15 @@ if(PQP_FOUND) set(OMPLAPP_LIBRARIES ${OMPLAPP_LIBRARIES} ${PQP_LIBRARY}) endif() -add_subdirectory(ompl/doc) -add_subdirectory(ompl/src) -add_subdirectory(ompl/py-bindings) -add_subdirectory(ompl/tests) -add_subdirectory(ompl/demos) -add_subdirectory(ompl/scripts) add_subdirectory(gui) add_subdirectory(doc) add_subdirectory(src) add_subdirectory(demos) add_subdirectory(benchmark) -add_subdirectory(py-bindings) + +if(OMPL_BUILD_PYBINDINGS) + add_subdirectory(py-bindings) +endif() install(DIRECTORY resources DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ompl" @@ -259,6 +258,8 @@ if(OMPL_BUILD_PYBINDINGS) endif() endif() +return() + if(OPENGL_FOUND AND NOT MSVC) target_link_flags(ompl ompl_app_base ompl_app) set(PKG_NAME "ompl") diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index 7da2b7f..d7397c4 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -1,6 +1,6 @@ add_executable(ompl_benchmark CFGBenchmark.cpp BenchmarkOptions.cpp BenchmarkTypes.cpp benchmark.cpp) -target_link_libraries(ompl_benchmark ${OMPLAPP_LIBRARIES} ompl ompl_app_base ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries(ompl_benchmark ${OMPLAPP_LIBRARIES} ompl_app_base ${Boost_PROGRAM_OPTIONS_LIBRARY}) install(TARGETS ompl_benchmark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT omplapp diff --git a/demos/CMakeLists.txt b/demos/CMakeLists.txt index 9c50d41..750aaee 100644 --- a/demos/CMakeLists.txt +++ b/demos/CMakeLists.txt @@ -1,5 +1,5 @@ if (OMPL_BUILD_DEMOS) - set(OMPLAPP_DEMO_LIBRARIES ${OMPLAPP_LIBRARIES} ompl ompl_app_base) + set(OMPLAPP_DEMO_LIBRARIES ${OMPLAPP_LIBRARIES} ompl_app_base) macro(add_omplapp_demo demo_name) add_executable(${ARGV}) diff --git a/src/omplapp/CMakeLists.txt b/src/omplapp/CMakeLists.txt index 2d0c8e5..d95567f 100644 --- a/src/omplapp/CMakeLists.txt +++ b/src/omplapp/CMakeLists.txt @@ -23,7 +23,7 @@ foreach(_target ${OMPLAPP_TARGETS}) add_library(${_target} SHARED ${${_target}_SRC}) endif(MSVC) - target_link_libraries(${_target} ompl ${OMPLAPP_LIBRARIES}) + target_link_libraries(${_target} ${OMPLAPP_LIBRARIES}) if(_target STREQUAL ompl_app) target_compile_definitions(ompl_app PRIVATE -DGL_SILENCE_DEPRECATION) target_link_libraries(ompl_app ompl_app_base) @@ -39,6 +39,7 @@ foreach(_target ${OMPLAPP_TARGETS}) endif(WIN32) install(TARGETS ${_target} + EXPORT omplapp DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT omplapp) if(NOT MSVC) @@ -54,3 +55,8 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" install(FILES "${CMAKE_CURRENT_BINARY_DIR}/config.h" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/omplapp" COMPONENT omplapp) + +install(EXPORT omplapp + FILE omplapp-targets.cmake + DESTINATION "share/ompl" +)