diff --git a/CMakeLists.txt b/CMakeLists.txt index c01d4022..651fdc44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,3 @@ ENABLE_TESTING() # enable CTest environment of subprojects ADD_SUBDIRECTORY( octomap ) ADD_SUBDIRECTORY( octovis ) ADD_SUBDIRECTORY( dynamicEDT3D ) - - - diff --git a/dynamicEDT3D/CMakeLists.txt b/dynamicEDT3D/CMakeLists.txt index ac24b80d..42f00bd0 100644 --- a/dynamicEDT3D/CMakeLists.txt +++ b/dynamicEDT3D/CMakeLists.txt @@ -66,35 +66,40 @@ install(FILES ${dynamicEDT3D_HDRS} DESTINATION include/dynamicEDT3D) # Export the package for use from the build-tree # (this registers the build-tree with a global CMake-registry) export(PACKAGE dynamicEDT3D) - -# Create a dynamicEDT3DConfig.cmake file for the use from the build tree + +# Create a dynamicEDT3D-config.cmake file for the use from the build tree set(DYNAMICEDT3D_INCLUDE_DIRS "${INCLUDE_DIRS}") set(DYNAMICEDT3D_LIB_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") # not used right now (export depends?) #set(DYNEDT3D_CMAKE_DIR "${PROJECT_BINARY_DIR}") -configure_file(dynamicEDT3DConfig.cmake.in - "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/dynamicEDT3D/dynamicEDT3DConfig.cmake" @ONLY) -configure_file(dynamicEDT3DConfig-version.cmake.in - "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/dynamicEDT3D/dynamicEDT3DConfig-version.cmake" @ONLY) +configure_file(dynamicEDT3D-config.cmake.in + "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/dynamicEDT3D/dynamicEDT3D-config.cmake" @ONLY) +configure_file(dynamicEDT3D-config-version.cmake.in + "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/dynamicEDT3D/dynamicEDT3D-config-version.cmake" @ONLY) # Install the export set for use with the install-tree #install(EXPORT FooBarLibraryDepends DESTINATION # "${INSTALL_DATA_DIR}/FooBar/CMake" # COMPONENT dev) - -# Create a dynamicEDT3DConfig.cmake file for the use from the install tree + +# Create a dynamicEDT3D-config.cmake file for the use from the install tree # and install it set(DYNAMICEDT3D_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include") set(DYNAMICEDT3D_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") #set(DYNAMICEDT3D_CMAKE_DIR "${INSTALL_DATA_DIR}/FooBar/CMake") -configure_file(dynamicEDT3DConfig.cmake.in - "${PROJECT_BINARY_DIR}/InstallFiles/dynamicEDT3DConfig.cmake" @ONLY) -configure_file(dynamicEDT3DConfig-version.cmake.in - "${PROJECT_BINARY_DIR}/InstallFiles/dynamicEDT3DConfig-version.cmake" @ONLY) +configure_file(dynamicEDT3D-config.cmake.in + "${PROJECT_BINARY_DIR}/InstallFiles/dynamicEDT3D-config.cmake" @ONLY) +configure_file(dynamicEDT3D-config-version.cmake.in + "${PROJECT_BINARY_DIR}/InstallFiles/dynamicEDT3D-config-version.cmake" @ONLY) +IF(DEFINED NO_ABSOLUTE_PATH_IN_MODULE AND NO_ABSOLUTE_PATH_IN_MODULE) + set(DYNAMICEDT3D_MODULE_FILE "dynamicEDT3D-config.cmake") +ELSE() + set(DYNAMICEDT3D_MODULE_FILE "${PROJECT_BINARY_DIR}/InstallFiles/dynamicEDT3D-config.cmake" ) +ENDIF() install(FILES - "${PROJECT_BINARY_DIR}/InstallFiles/dynamicEDT3DConfig.cmake" - "${PROJECT_BINARY_DIR}/InstallFiles/dynamicEDT3DConfig-version.cmake" - DESTINATION lib/cmake/dynamicEDT3D/) + "${PROJECT_BINARY_DIR}/InstallFiles/dynamicEDT3D-config-version.cmake" + "${DYNAMICEDT3D_MODULE_FILE}" + DESTINATION share/dynamicEDT3D/) # Write pkgconfig-file: include(InstallPkgConfigFile) @@ -105,7 +110,7 @@ install_pkg_config_file(dynamicEDT3D VERSION ${DYNAMICEDT3D_MAJOR_VERSION}.${DYNAMICEDT3D_MINOR_VERSION}.${DYNAMICEDT3D_PATCH_VERSION}) -# Documentation +# Documentation FIND_PACKAGE(Doxygen) IF(DOXYGEN_FOUND) ADD_CUSTOM_TARGET(docs_dynamicEDT3D ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/dynamicEDT3D.dox diff --git a/dynamicEDT3D/dynamicEDT3DConfig-version.cmake.in b/dynamicEDT3D/dynamicEDT3D-config-version.cmake.in similarity index 100% rename from dynamicEDT3D/dynamicEDT3DConfig-version.cmake.in rename to dynamicEDT3D/dynamicEDT3D-config-version.cmake.in diff --git a/dynamicEDT3D/dynamicEDT3D-config.cmake b/dynamicEDT3D/dynamicEDT3D-config.cmake new file mode 100644 index 00000000..c21a9aea --- /dev/null +++ b/dynamicEDT3D/dynamicEDT3D-config.cmake @@ -0,0 +1,19 @@ +# - Config file for the OctoMap package +# (example from http://www.vtk.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file) +# It defines the following variables +# OCTOMAP_INCLUDE_DIRS - include directories for OctoMap +# OCTOMAP_LIBRARIES - libraries to link against + +set(DYNAMICEDT3D_INCLUDE_DIRS) +set(DYNAMICEDT3D_INCLUDE DYNAMICEDT3D_INCLUDE-NOTFOUND) +find_path(DYNAMICEDT3D_INCLUDE dynamicEDT3D/dynamicEDT3D.h) +if(DYNAMICEDT3D_INCLUDE) + list(APPEND DYNAMICEDT3D_INCLUDE_DIRS ${DYNAMICEDT3D_INCLUDE}) +endif() + +set(DYNAMICEDT3D_LIBRARIES) +set(DYNAMICEDT3D_LIB DYNAMICEDT3D_LIB-NOTFOUND) +find_library(DYNAMICEDT3D_LIB dynamicedt3d) +if(DYNAMICEDT3D_LIB) + list(APPEND DYNAMICEDT3D_LIBRARIES ${DYNAMICEDT3D_LIB}) +endif() diff --git a/dynamicEDT3D/dynamicEDT3DConfig.cmake.in b/dynamicEDT3D/dynamicEDT3D-config.cmake.in similarity index 100% rename from dynamicEDT3D/dynamicEDT3DConfig.cmake.in rename to dynamicEDT3D/dynamicEDT3D-config.cmake.in diff --git a/octomap/CMakeLists.txt b/octomap/CMakeLists.txt index 9c9f674b..e73c302c 100644 --- a/octomap/CMakeLists.txt +++ b/octomap/CMakeLists.txt @@ -73,7 +73,7 @@ add_custom_target(uninstall # Export the package for use from the build-tree # (this registers the build-tree with a global CMake-registry) export(PACKAGE octomap) - + # Create a octomap-config.cmake file for the use from the build tree set(OCTOMAP_INCLUDE_DIRS "${INCLUDE_DIRS}") set(OCTOMAP_LIB_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") @@ -88,7 +88,7 @@ configure_file(octomap-config-version.cmake.in #install(EXPORT FooBarLibraryDepends DESTINATION # "${INSTALL_DATA_DIR}/FooBar/CMake" # COMPONENT dev) - + # Create a octomap-config.cmake file for the use from the install tree # and install it set(OCTOMAP_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include") @@ -98,9 +98,14 @@ configure_file(octomap-config.cmake.in "${PROJECT_BINARY_DIR}/InstallFiles/octomap-config.cmake" @ONLY) configure_file(octomap-config-version.cmake.in "${PROJECT_BINARY_DIR}/InstallFiles/octomap-config-version.cmake" @ONLY) +IF(DEFINED NO_ABSOLUTE_PATH_IN_MODULE AND NO_ABSOLUTE_PATH_IN_MODULE) + set(OCTOMAP_MODULE_FILE "octomap-config.cmake") +ELSE() + set(OCTOMAP_MODULE_FILE "${PROJECT_BINARY_DIR}/InstallFiles/octomap-config.cmake" ) +ENDIF() install(FILES - "${PROJECT_BINARY_DIR}/InstallFiles/octomap-config.cmake" - "${PROJECT_BINARY_DIR}/InstallFiles/octomap-config-version.cmake" + "${PROJECT_BINARY_DIR}/InstallFiles/octomap-config-version.cmake" + "${OCTOMAP_MODULE_FILE}" DESTINATION share/octomap/) # Write pkgconfig-file: @@ -111,7 +116,7 @@ install_pkg_config_file(octomap REQUIRES VERSION ${OCTOMAP_VERSION}) -# Documentation +# Documentation FIND_PACKAGE(Doxygen) IF(DOXYGEN_FOUND) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/octomap.dox.in ${CMAKE_CURRENT_BINARY_DIR}/octomap.dox @ONLY) diff --git a/octomap/octomap-config.cmake b/octomap/octomap-config.cmake new file mode 100644 index 00000000..5572b898 --- /dev/null +++ b/octomap/octomap-config.cmake @@ -0,0 +1,41 @@ +# =================================================================================== +# The OctoMap CMake configuration file +# +# ** File generated automatically, do not modify ** +# +# Usage from an external project: +# In your CMakeLists.txt, add these lines: +# +# FIND_PACKAGE(octomap REQUIRED ) +# TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${OCTOMAP_LIBRARIES}) +# +# This file will define the following variables: +# - OCTOMAP_LIBRARIES : The list of libraries to links against. +# - OCTOMAP_LIBRARY_DIRS : The directory where lib files are. Calling +# LINK_DIRECTORIES with this path is NOT needed. +# - OCTOMAP_INCLUDE_DIRS : The OpenCV include directories. +# +# Based on the example CMake Tutorial +# http://www.vtk.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file +# and OpenCVConfig.cmake.in from OpenCV +# =================================================================================== + +set(OCTOMAP_INCLUDE_DIRS) +set(OCTOMAP_INCLUDE OCTOMAP_INCLUDE-NOTFOUND) +find_path(OCTOMAP_INCLUDE octomap/octomap.h) +if(OCTOMAP_INCLUDE) + list(APPEND OCTOMAP_INCLUDE_DIRS ${OCTOMAP_INCLUDE}) +endif() + +set(OCTOMAP_LIBRARIES) +set(OCTOMAP_LIB OCTOMAP_LIB-NOTFOUND) +find_library(OCTOMAP_LIB octomap) +if(OCTOMAP_LIB) + list(APPEND OCTOMAP_LIBRARIES ${OCTOMAP_LIB}) +endif() + +set(OCTOMATH_LIB OCTOMATH_LIB-NOTFOUND) +find_library(OCTOMATH_LIB octomath) +if(OCTOMATH_LIB) + list(APPEND OCTOMAP_LIBRARIES ${OCTOMATH_LIB}) +endif() diff --git a/octovis/CMakeLists.txt b/octovis/CMakeLists.txt index edfca27e..7d0195f5 100644 --- a/octovis/CMakeLists.txt +++ b/octovis/CMakeLists.txt @@ -47,15 +47,15 @@ set(INSTALL_TARGETS_DEFAULT_ARGS ARCHIVE DESTINATION lib ) -# Builds the "octovis" viewer based on OpenGL and +# Builds the "octovis" viewer based on OpenGL and # libQGLViewer, if dependencies available SET( BUILD_VIEWER 0) # Look for required libraries: FIND_PACKAGE(OpenGL) FIND_PACKAGE(Qt4) -IF (OpenGL-NOTFOUND OR Qt4-NOTFOUND) - MESSAGE ( "OpenGL and QT4 are required for octovis but could not be found.") +IF (OpenGL-NOTFOUND OR Qt4-NOTFOUND) + MESSAGE ( "OpenGL and QT4 are required for octovis but could not be found.") ELSE() FIND_PACKAGE(QGLViewer) IF(QGLViewer_FOUND) @@ -70,12 +70,12 @@ ENDIF() IF(BUILD_VIEWER) MESSAGE(STATUS "\n") MESSAGE(STATUS "viewer octovis will be built") - + set(INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include") INCLUDE_DIRECTORIES(${INCLUDE_DIRS}) - + INCLUDE( CMakeLists_src.txt ) - + # Create an octovis-config.cmake file for the use from the build tree set(OCTOVIS_INCLUDE_DIR "${INCLUDE_DIRS}") set(OCTOVIS_LIB_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") @@ -84,8 +84,8 @@ IF(BUILD_VIEWER) configure_file(octovis-config.cmake.in "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octovis/octovis-config.cmake" @ONLY) configure_file(octovis-config-version.cmake.in - "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octovis/octovis-config-version.cmake" @ONLY) - + "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octovis/octovis-config-version.cmake" @ONLY) + # Create a octovis-config.cmake file for the use from the install tree # and install it set(OCTOVIS_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include") @@ -95,12 +95,17 @@ IF(BUILD_VIEWER) "${PROJECT_BINARY_DIR}/InstallFiles/octovis-config.cmake" @ONLY) configure_file(octovis-config-version.cmake.in "${PROJECT_BINARY_DIR}/InstallFiles/octovis-config-version.cmake" @ONLY) + IF(DEFINED NO_ABSOLUTE_PATH_IN_MODULE AND NO_ABSOLUTE_PATH_IN_MODULE) + set(OCTOVIS_MODULE_FILE "octovis-config.cmake") + ELSE() + set(OCTOVIS_MODULE_FILE "${PROJECT_BINARY_DIR}/InstallFiles/octovis-config.cmake" ) + ENDIF() install(FILES - "${PROJECT_BINARY_DIR}/InstallFiles/octovis-config.cmake" - "${PROJECT_BINARY_DIR}/InstallFiles/octovis-config-version.cmake" + "${PROJECT_BINARY_DIR}/InstallFiles/octovis-config-version.cmake" + "${OCTOVIS_MODULE_FILE}" DESTINATION share/octovis/) - - + + # #installation: # # store all header files to install: file(GLOB octovis_HDRS *.h *.hxx *.hpp) @@ -108,7 +113,7 @@ IF(BUILD_VIEWER) # Install catkin package.xml install(FILES package.xml DESTINATION share/octovis) - + ELSE() MESSAGE ( "Unfortunately, the viewer (octovis) can not be built because some requirements are missing.") MESSAGE ( "This will not affect the compilation of the stand-alone library and tools (octomap)") diff --git a/octovis/octovis-config.cmake b/octovis/octovis-config.cmake new file mode 100644 index 00000000..99d9798f --- /dev/null +++ b/octovis/octovis-config.cmake @@ -0,0 +1,24 @@ +# - Config file for the OctoMap package +# (example from http://www.vtk.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file) +# It defines the following variables +# OCTOVIS_INCLUDE_DIRS - include directories for OctoMap viewer +# OCTOVIS_LIBRARIES - libraries to link against + +find_package(OCTOMAP) + +set(QGLViewer_LIB QGLViewer_LIB-NOTFOUND) +find_library(QGLViewer_LIB QGLViewer) +if(NOT QGLViewer_LIB) + message(FATAL "Could not find QGLViewer") +endif() + +find_package(Qt4 COMPONENTS QTCORE QTGUI QTOPENGL) + +set(OCTOVIS_INCLUDE_DIRS) +set(OCTOVIS_LIBRARIES) + +list(APPEND OCTOVIS_INCLUDE_DIRS ${OCTOMAP_INCLUDE} + ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTOPENGL_INCLUDE_DIR}) + +list(APPEND OCTOVIS_LIBRARIES ${OCTOMAP_LIB} ${QGLViewer_LIB} + ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY})