Skip to content
Snippets Groups Projects
Commit d6e151bc authored by isucan's avatar isucan
Browse files

fixes for build system; add version, linking to boost, looking for octomap using pkg config

git-svn-id: https://kforge.ros.org/fcl/fcl_ros@172 253336fb-580f-4252-a368-f3cef5a2a82b
parent 7d7ff70b
No related branches found
No related tags found
No related merge requests found
cmake_minimum_required(VERSION 2.4.6) cmake_minimum_required(VERSION 2.8)
project(fcl CXX C) project(fcl CXX C)
# Set the build type. Options are: # Set the build type. Options are:
...@@ -9,9 +9,10 @@ project(fcl CXX C) ...@@ -9,9 +9,10 @@ project(fcl CXX C)
# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries # MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries
set(CMAKE_BUILD_TYPE Release) set(CMAKE_BUILD_TYPE Release)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
include(FCLVersion)
# Check for SSE flags # Check for SSE flags
set(FCL_HAVE_SSE 0) set(FCL_HAVE_SSE 0)
...@@ -26,22 +27,28 @@ else() ...@@ -26,22 +27,28 @@ else()
message(STATUS "FCL does not use SSE") message(STATUS "FCL does not use SSE")
endif() endif()
# Check for Octomap flags # Find Octomap (optional)
find_package(PkgConfig REQUIRED)
set(FCL_HAVE_OCTOMAP 0) set(FCL_HAVE_OCTOMAP 0)
include(FCLCheckOctomap) pkg_check_modules(OCTOMAP QUIET octomap)
fcl_check_for_octomap() if (OCTOMAP_INCLUDE_DIRS)
if (OCTOMAP_FLAGS) include_directories(${OCTOMAP_INCLUDE_DIRS})
message(STATUS "FCL uses octomap") link_directories(${OCTOMAP_LIBRARY_DIRS})
add_definitions(${OCTOMAP_FLAGS})
set(FCL_HAVE_OCTOMAP 1) set(FCL_HAVE_OCTOMAP 1)
message(STATUS "FCL uses Octomap")
else() else()
message(STATUS "FCL does not use octomap") message(STATUS "FCL does not use Octomap")
endif()
if(MSVC OR MSVC90 OR MSVC10)
add_definitions(-DBOOST_ALL_NO_LIB)
endif() endif()
find_package(Boost COMPONENTS thread REQUIRED)
include_directories(${Boost_INCLUDE_DIR})
# make sure we know what flag we used for SSE # make sure we know what flag we used for SSE
include_directories("include") include_directories("include")
find_package(PkgConfig)
pkg_check_modules(CCD REQUIRED ccd) pkg_check_modules(CCD REQUIRED ccd)
include_directories(${CCD_INCLUDE_DIRS}) include_directories(${CCD_INCLUDE_DIRS})
link_directories(${CCD_LIBRARY_DIRS}) link_directories(${CCD_LIBRARY_DIRS})
...@@ -52,7 +59,6 @@ if(OCTOMAP_FOUND) ...@@ -52,7 +59,6 @@ if(OCTOMAP_FOUND)
link_directories(${OCTOMAP_LIBRARY_DIRS}) link_directories(${OCTOMAP_LIBRARY_DIRS})
endif() endif()
add_subdirectory(include/fcl) add_subdirectory(include/fcl)
add_subdirectory(src) add_subdirectory(src)
......
macro(fcl_check_for_octomap)
#check for Octomap
include(CheckCXXSourceRuns)
set(OCTOMAP_FLAGS)
check_cxx_source_runs("
#include <octomap/octomap.h>
int main()
{
octomap::OcTree* tree = new octomap::OcTree(0.1);
for(int x = -20; x < 20; ++x)
{
for(int y = -20; y < 20; ++y)
{
for(int z = -20; z < 20; ++z)
{
tree->updateNode(octomap::point3d(x * 0.05, y * 0.05, z * 0.05), true);
}
}
}
for(int x = -30; x < 30; ++x)
{
for(int y = -30; y < 30; ++y)
{
for(int z = -30; z < 30; ++z)
{
tree->updateNode(octomap::point3d(x * 0.02 - 1.0, y * 0.02 - 1.0, z * 0.02 - 1.0), false);
}
}
}
return 1;
}"
HAS_OCTOMAP)
set(CMAKE_REQUIRED_FLAGS)
if(HAS_OCTOMAP)
set(OCTOMAP_FLAGS "-loctomap")
message(STATUS " Found octomap, using flags: ${OCTOMAP_FLAGS}")
endif()
endmacro(fcl_check_for_octomap)
\ No newline at end of file
# set the version in a way CMake can use
set(FCL_MAJOR_VERSION 0)
set(FCL_MINOR_VERSION 2)
set(FCL_PATCH_VERSION 0)
set(FCL_VERSION "${FCL_MAJOR_VERSION}.${FCL_MINOR_VERSION}.${FCL_PATCH_VERSION}")
# increment this when we have ABI changes
set(FCL_ABI_VERSION 1)
...@@ -36,6 +36,10 @@ ...@@ -36,6 +36,10 @@
#define FCL_CONFIG_ #define FCL_CONFIG_
#define FCL_VERSION "@FCL_VERSION@" #define FCL_VERSION "@FCL_VERSION@"
#define FCL_MAJOR_VERSION @FCL_MAJOR_VERSION@
#define FCL_MINOR_VERSION @FCL_MINOR_VERSION@
#define FCL_PATCH_VERSION @FCL_PATCH_VERSION@
#cmakedefine01 FCL_HAVE_SSE #cmakedefine01 FCL_HAVE_SSE
#cmakedefine01 FCL_HAVE_OCTOMAP #cmakedefine01 FCL_HAVE_OCTOMAP
......
...@@ -45,6 +45,6 @@ add_library(${PROJECT_NAME} SHARED ...@@ -45,6 +45,6 @@ add_library(${PROJECT_NAME} SHARED
profile.cpp profile.cpp
collision_data.cpp) collision_data.cpp)
target_link_libraries(${PROJECT_NAME} ${CCD_LIBRARIES} ${OCTOMAP_LIBRARIES}) target_link_libraries(${PROJECT_NAME} ${CCD_LIBRARIES} ${OCTOMAP_LIBRARIES} ${Boost_LIBRARIES})
install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib/ LIBRARY DESTINATION lib/) install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib/ LIBRARY DESTINATION lib/)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment