Commit 7d3efca0 authored by Leopold Palomo's avatar Leopold Palomo

Imported Upstream version 0.13.0

parents
cmake_minimum_required(VERSION 2.8)
project(ompl CXX C)
# set the default build type
if (NOT CMAKE_BUILD_TYPE)
# By default, use Release mode
set(CMAKE_BUILD_TYPE Release)
# On 32bit architectures with gcc < 4.7, use RelWithDebInfo
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_SIZEOF_VOID_P EQUAL 4)
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
if (GCC_VERSION VERSION_LESS 4.7)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif()
endif()
endif()
message(STATUS "Building ${CMAKE_BUILD_TYPE}")
# This shouldn't be necessary, but there has been trouble
# with MSVC being set off, but MSVCXX ON.
if(MSVC OR MSVC90 OR MSVC10)
set(MSVC ON)
endif (MSVC OR MSVC90 OR MSVC10)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
include(CompilerSettings)
include(OMPLVersion)
include(OMPLUtils)
set(EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin")
set(LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/lib")
set(OMPL_CMAKE_UTIL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules"
CACHE FILEPATH "Path to directory with auxiliary CMake scripts for OMPL")
set(OMPL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(OMPL_DEMO_INSTALL_DIR "share/ompl${OMPL_INSTALL_SUFFIX}/demos"
CACHE STRING "Relative path to directory where demos will be installed")
set(OMPL_DOC_INSTALL_DIR "share/ompl${OMPL_INSTALL_SUFFIX}/doc"
CACHE STRING "Relative path to directory where documentation will be installed")
include_directories("${OMPL_INCLUDE_DIR}")
if(MSVC)
add_definitions(-DBOOST_ALL_NO_LIB)
add_definitions(-DBOOST_PROGRAM_OPTIONS_DYN_LINK)
endif(MSVC)
if(IS_ICPC)
set(Boost_USE_STATIC_LIBS ON CACHE STRING "Use statically linked Boost libraries")
else(IS_ICPC)
# Ensure dynamic linking with boost unit_test_framework
add_definitions(-DBOOST_TEST_DYN_LINK)
endif(IS_ICPC)
find_package(Boost COMPONENTS date_time thread serialization filesystem system program_options unit_test_framework REQUIRED)
include_directories(SYSTEM ${Boost_INCLUDE_DIR})
if (NOT ${Boost_VERSION} LESS 104400)
option(OMPL_ODESOLVER "Enable OMPL ODE solver classes" ON)
if(${Boost_VERSION} LESS 105300)
# Include bundled version of boost::odeint if it isn't installed natively
set(ODEINT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/external")
include_directories(SYSTEM "${ODEINT_INCLUDE_DIR}")
endif()
else()
option(OMPL_ODESOLVER "Enable OMPL ODE solver classes" OFF)
endif()
# pthread is sometimes needed, depending on OS / compiler
find_package(Threads QUIET)
enable_testing()
# ODE is only needed for Open Dynamics Engine bindings
find_package(OpenDE QUIET)
set(OMPL_EXTENSION_OPENDE ${OPENDE_FOUND})
if (OPENDE_FOUND)
add_definitions(${OPENDE_DEFINITIONS})
include_directories(SYSTEM ${OPENDE_INCLUDE_DIR})
endif()
find_package(Triangle QUIET)
set(OMPL_EXTENSION_TRIANGLE ${TRIANGLE_FOUND})
if (TRIANGLE_FOUND)
include_directories(SYSTEM ${TRIANGLE_INCLUDE_DIR})
endif()
# If FLANN is installed, a wrapper for its nearest neighbor data structures can be used
find_package(flann 1.8.3 QUIET)
if (FLANN_FOUND)
set(OMPL_HAVE_FLANN 1)
include_directories(SYSTEM "${FLANN_INCLUDE_DIRS}")
endif()
add_subdirectory(py-bindings)
add_subdirectory(src)
add_subdirectory(tests)
add_subdirectory(demos)
add_subdirectory(scripts)
add_subdirectory(doc)
if (NOT MSVC)
set(PKG_NAME "ompl")
set(PKG_DESC "The Open Motion Planning Library")
set(PKG_OMPL_LIBS "-lompl")
set(pkg_conf_file "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/ompl.pc")
configure_file("${pkg_conf_file}.in" "${pkg_conf_file}" @ONLY)
install(FILES "${pkg_conf_file}" DESTINATION lib/pkgconfig/
COMPONENT pkgconfig RENAME "ompl${OMPL_INSTALL_SUFFIX}.pc")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/doc/dox/FindOMPL.cmake"
DESTINATION "share/ompl${OMPL_INSTALL_SUFFIX}"
RENAME ompl-config.cmake)
if (NOT ${CMAKE_VERSION} VERSION_LESS 2.8.6)
include(WriteBasicConfigVersionFile)
write_basic_config_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/ompl-config-version.cmake"
VERSION ${OMPL_VERSION} COMPATIBILITY SameMajorVersion)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ompl-config-version.cmake"
DESTINATION "share/ompl${OMPL_INSTALL_SUFFIX}")
endif()
endif()
# uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
if (OMPL_VERSIONED_INSTALL)
# script to create sym links
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/create_symlinks.sh.in"
"${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/create_symlinks.sh" @ONLY)
execute_process(COMMAND
"${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/create_symlinks.sh"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.symlinks/" DESTINATION .)
# script to uninstall sym links
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/uninstall_symlinks.sh.in"
"${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/uninstall_symlinks.sh" @ONLY)
add_custom_target(uninstall_links COMMAND
"${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/uninstall_symlinks.sh")
add_dependencies(uninstall uninstall_links)
endif()
include(CPackSettings)
option(OMPL_REGISTRATION "Enable one-time registration of OMPL" ON)
if (OMPL_REGISTRATION)
find_file(OMPL_REGISTERED ".registered" PATHS "${CMAKE_CURRENT_SOURCE_DIR}" NO_DEFAULT_PATH)
if (NOT OMPL_REGISTERED)
file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/.registered" "")
find_package(Python QUIET)
if (PYTHON_FOUND)
execute_process(COMMAND "${PYTHON_EXEC}" "-m" "webbrowser" "http://ompl.kavrakilab.org/core/register.html"
OUTPUT_QUIET ERROR_QUIET)
endif()
endif()
endif()
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Open Motion Planning Library (OMPL)")
set(CPACK_PACKAGE_VENDOR "Rice University")
set(CPACK_PACKAGE_CONTACT "Mark Moll <mmoll@rice.edu>")
set(CPACK_RSRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
set(CPACK_PACKAGE_VERSION_MAJOR "${OMPL_MAJOR_VERSION}")
set(CPACK_PACKAGE_VERSION_MINOR "${OMPL_MINOR_VERSION}")
set(CPACK_PACKAGE_VERSION_PATCH "${OMPL_PATCH_VERSION}")
set(CPACK_SOURCE_IGNORE_FILES
"/.hg"
"/build/"
".pyc$"
".pyo$"
"__pycache__"
".so$"
".dylib$"
".orig$"
".DS_Store"
".tm_properties"
"mkwebdocs.sh"
"/html/"
"/bindings/"
"TODO"
"exposed_decl.pypp.txt"
"ompl.pc$"
"installPyPlusPlus.bat$"
"installPyPlusPlus.sh$"
"create_symlinks.sh$"
"uninstall_symlinks.sh$"
"config.h$"
".registered$"
"download.md$"
"mainpage.md$"
"binding_generator.py$")
set(CPACK_SOURCE_GENERATOR "TGZ;ZIP")
set(CPACK_GENERATOR "TGZ")
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(CPACK_GENERATOR "DEB;${CPACK_GENERATOR}")
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "i686")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386")
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
endif()
execute_process(COMMAND "/usr/bin/lsb_release" "-rs"
OUTPUT_VARIABLE UBUNTU_RELEASE
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CPACK_PACKAGE_FILE_NAME "omplapp_${OMPL_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}-Ubuntu${UBUNTU_RELEASE}")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "python${PYTHON_VERSION}, libboost-all-dev, libode-dev")
endif()
if(WIN32)
set(CPACK_GENERATOR "ZIP;${CPACK_GENERATOR}")
endif()
include(CPack)
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-W -Wall -Wextra #-Wconversion
-Wcast-qual -Wwrite-strings -Wunreachable-code -Wpointer-arith
-Winit-self -Wredundant-decls
-Wno-unused-parameter -Wno-unused-function)
endif(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_definitions(-W -Wall -Wextra -Wno-missing-field-initializers -Wno-unused -Wno-unused-parameter -Wno-delete-non-virtual-dtor -Wno-overloaded-virtual -Wno-unknown-pragmas -Qunused-arguments)
endif()
if(MSVC OR MSVC90 OR MSVC10)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /MP /W1 /D_ITERATOR_DEBUG_LEVEL=0")
endif(MSVC OR MSVC90 OR MSVC10)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(IS_ICPC 1)
else()
set(IS_ICPC 0)
endif()
if(IS_ICPC)
add_definitions(-wd191 -wd411 -wd654 -wd1125 -wd1292 -wd1565 -wd1628 -wd2196)
set(CMAKE_AR "xiar" CACHE STRING "Intel archiver" FORCE)
set(CMAKE_CXX_FLAGS "-pthread" CACHE STRING "Default compile flags" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG"
CACHE STRING "Flags used by the C++ compiler during release builds." FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g" CACHE STRING
"Flags used by the C++ compiler during debug builds." FORCE)
set(CMAKE_LINKER "xild" CACHE STRING "Intel linker" FORCE)
endif(IS_ICPC)
if(CMAKE_CXX_COMPILER_ID STREQUAL "XL")
set(IS_XLC 1)
else()
set(IS_XLC 0)
endif()
if(IS_XLC)
add_definitions(-qpic -q64 -qmaxmem=-1)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -q64")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -q64")
endif(IS_XLC)
if((CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC) AND NOT MINGW)
add_definitions(-fPIC)
endif((CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC) AND NOT MINGW)
# Set rpath http://www.paraview.org/Wiki/CMake_RPATH_handling
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# no prefix needed for python modules
set(CMAKE_SHARED_MODULE_PREFIX "")
# - Find OPENDE
# This module finds if Open Dynamics Engine (OPENDE) is
# installed and determines where the include files and libraries
# are. The OPENDE_PATH variable (or environment variable) can be set
# to specify where to look for OPENDE. In addition, OPENDE_LIB_PATH
# and OPENDE_INCLUDE_PATH can be set to specify locations for the ode
# library and include files as well.
#
# The following variables are set:
# OPENDE_LIBRARY = location of OPENDE library
# OPENDE_INCLUDE_DIR = include path for OPENDE
# OPENDE_DEFINITIONS = defines for OPENDE; such as -DdSINGLE
# OPENDE_VERSION = the version of OPENDE that was found; empty if ode-config was not found
include(FindPackageHandleStandardArgs)
# Uncomment the following line to enable debug output
#set(_OPENDE_DEBUG_OUTPUT true)
if (NOT OPENDE_PATH)
set(OPENDE_PATH $ENV{OPENDE_PATH})
endif()
if (NOT OPENDE_LIB_PATH)
set(OPENDE_LIB_PATH $ENV{OPENDE_LIB_PATH})
endif()
if (NOT OPENDE_INCLUDE_PATH)
set(OPENDE_INCLUDE_PATH $ENV{OPENDE_INCLUDE_PATH})
endif()
if (NOT OPENDE_LIB_PATH)
set(OPENDE_LIB_PATH ${OPENDE_PATH})
endif()
if (NOT OPENDE_INCLUDE_PATH)
set(OPENDE_INCLUDE_PATH ${OPENDE_PATH})
endif()
if (OPENDE_INCLUDE_PATH)
set(_OPENDE_INCLUDE_HINTS ${OPENDE_INCLUDE_PATH})
else()
set(_OPENDE_INCLUDE_HINTS "")
endif()
if (OPENDE_LIB_PATH)
set(_OPENDE_LIB_HINTS ${OPENDE_LIB_PATH})
else()
set(_OPENDE_LIB_HINTS "")
endif()
find_program(_OPENDE_CONFIG NAMES ode-config PATHS ${OPENDE_PATH} PATH_SUFFIXES bin)
if (_OPENDE_CONFIG)
execute_process(COMMAND ${_OPENDE_CONFIG} --version OUTPUT_VARIABLE OPENDE_VERSION)
# remove new line chars
if (OPENDE_VERSION)
string(REGEX REPLACE "[\r\n]+" "" OPENDE_VERSION ${OPENDE_VERSION})
endif()
execute_process(COMMAND ${_OPENDE_CONFIG} --cflags OUTPUT_VARIABLE OPENDE_CFLAGS)
if (OPENDE_CFLAGS)
# split the flags
string(REGEX MATCHALL "[^ ]+" OPENDE_CFLAGS_LIST ${OPENDE_CFLAGS})
# get the defines and include hints only
foreach(OPENDE_CFLAG ${OPENDE_CFLAGS_LIST})
string(REGEX MATCH "^(-D[a-zA-Z0-9]+)[ \n\r]*$" MATCHED_FLAG ${OPENDE_CFLAG})
if (MATCHED_FLAG)
if (OPENDE_DEFINITIONS)
set(OPENDE_DEFINITIONS ${OPENDE_DEFINITIONS} ${CMAKE_MATCH_1})
else()
set(OPENDE_DEFINITIONS ${CMAKE_MATCH_1})
endif()
else()
string(REGEX MATCH "^-I([^ \r\n]+)[ \n\r]*$" MATCHED_FLAG ${OPENDE_CFLAG})
if (MATCHED_FLAG)
set(_OPENDE_INCLUDE_HINTS ${_OPENDE_INCLUDE_HINTS} ${CMAKE_MATCH_1})
endif()
endif()
endforeach()
endif()
execute_process(COMMAND ${_OPENDE_CONFIG} --libs OUTPUT_VARIABLE OPENDE_LFLAGS)
if (OPENDE_LFLAGS)
string(REGEX MATCHALL "[^ ]+" OPENDE_LFLAGS_LIST ${OPENDE_LFLAGS})
foreach(OPENDE_LFLAG ${OPENDE_LFLAGS_LIST})
string(REGEX MATCH "^-L([^ \r\n]+)[ \n\r]*$" MATCHED_FLAG ${OPENDE_LFLAG})
if (MATCHED_FLAG)
set(_OPENDE_LIB_HINTS ${_OPENDE_LIB_HINTS} ${CMAKE_MATCH_1})
endif()
endforeach()
endif()
endif()
# find the include path
find_path(OPENDE_INCLUDE_DIR ode.h PATHS ${_OPENDE_INCLUDE_HINTS} PATH_SUFFIXES ode include/ode)
if (OPENDE_INCLUDE_DIR)
string(REGEX REPLACE "/ode$" "" OPENDE_INCLUDE_DIR ${OPENDE_INCLUDE_DIR})
endif()
# find the lib
find_library(OPENDE_LIBRARY ode PATHS ${_OPENDE_LIB_HINTS} PATH_SUFFIXES lib ode/src/.libs src/.libs)
if (_OPENDE_DEBUG_OUTPUT)
message(STATUS "------- FindOPENDE.cmake Debug -------")
message(STATUS "OPENDE_CONFIG = '${_OPENDE_CONFIG}'")
message(STATUS "OPENDE_DEFINITIONS = '${OPENDE_DEFINITIONS}'")
message(STATUS "_OPENDE_INCLUDE_HINTS = '${_OPENDE_INCLUDE_HINTS}'")
message(STATUS "OPENDE_INCLUDE_DIR = '${OPENDE_INCLUDE_DIR}'")
message(STATUS "_OPENDE_LIB_HINTS = '${_OPENDE_LIB_HINTS}'")
message(STATUS "OPENDE_LIBRARY = '${OPENDE_LIBRARY}'")
message(STATUS "OPENDE_VERSION = '${OPENDE_VERSION}'")
message(STATUS "-----------------------------------")
endif()
find_package_handle_standard_args(OpenDE DEFAULT_MSG OPENDE_LIBRARY OPENDE_INCLUDE_DIR)
mark_as_advanced(_OPENDE_CONFIG _OPENDE_INCLUDE_H)
mark_as_advanced(OPENDE_LIBRARY OPENDE_INCLUDE OPENDE_DEFINITIONS OPENDE_VERSION)
# This code sets the following variables:
# PYTHON_EXEC - path to python executable
# PYTHON_LIBRARIES - path to the python library
# PYTHON_INCLUDE_DIRS - path to where Python.h is found
# PTYHON_SITE_MODULES - path to site-packages
# PYTHON_ARCH - name of architecture to be used for platform-specific
# binary modules
# PYTHON_VERSION - version of python
#
# You can optionally include the version number when using this package
# like so:
# find_package(python 2.6)
#
# This code defines a helper function find_python_module(). It can be used
# like so:
# find_python_module(numpy)
# If numpy is found, the variable PY_NUMPY contains the location of the numpy
# module. If the module is required add the keyword "REQUIRED":
# find_python_module(numpy REQUIRED)
include(FindPackageHandleStandardArgs)
# allow specifying which Python installation to use
if (NOT PYTHON_EXEC)
set(PYTHON_EXEC $ENV{PYTHON_EXEC})
endif (NOT PYTHON_EXEC)
if (NOT PYTHON_EXEC)
find_program(PYTHON_EXEC "python${Python_FIND_VERSION}"
PATHS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\3.3\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\3.2\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\3.1\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\3.0\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.7\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]
DOC "Location of python executable to use")
endif(NOT PYTHON_EXEC)
# if Python is still not found, return
if (NOT PYTHON_EXEC)
# dummy function
function(find_python_module module)
return()
endfunction(find_python_module)
return()
endif()
# On OS X the python executable might be symlinked to the "real" location
# of the python executable. The header files and libraries are found relative
# to that path.
# For CMake 2.6 and below, the REALPATH option is included in the ABSOLUTE option
if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.6)
get_filename_component(PYTHON_EXEC_ "${PYTHON_EXEC}" REALPATH)
else()
get_filename_component(PYTHON_EXEC_ "${PYTHON_EXEC}" ABSOLUTE)
endif()
set(PYTHON_EXEC "${PYTHON_EXEC_}" CACHE FILEPATH "Path to Python interpreter")
string(REGEX REPLACE "/bin/python.*" "" PYTHON_PREFIX "${PYTHON_EXEC_}")
string(REGEX REPLACE "/bin/python.*" "" PYTHON_PREFIX2 "${PYTHON_EXEC}")
execute_process(COMMAND "${PYTHON_EXEC}" "-c"
"import sys; print('%d.%d' % (sys.version_info[0],sys.version_info[1]))"
OUTPUT_VARIABLE PYTHON_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "." "" PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
find_library(PYTHON_LIBRARIES
NAMES "python${PYTHON_VERSION_NO_DOTS}" "python${PYTHON_VERSION}" "python${PYTHON_VERSION}m"
PATHS
"${PYTHON_PREFIX}/lib"
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${PYTHON_VERSION}\\InstallPath]/libs
PATH_SUFFIXES "" "python${PYTHON_VERSION}/config" "x86_64-linux-gnu" "i386-linux-gnu"
DOC "Python libraries" NO_DEFAULT_PATH)
find_path(PYTHON_INCLUDE_DIRS "Python.h"