Skip to content

Commit

Permalink
Merge pull request #172 from jcarpent/devel
Browse files Browse the repository at this point in the history
Fix packaging of the project
  • Loading branch information
jcarpent authored May 29, 2020
2 parents bfb5b93 + ab8df77 commit 749492c
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 37 deletions.
16 changes: 10 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ include(cmake/hpp.cmake)
include(cmake/apple.cmake)
include(cmake/ide.cmake)

SET(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/cmake-modules/
${CMAKE_MODULE_PATH})

# If needed, fix CMake policy for APPLE systems
APPLY_DEFAULT_APPLE_CONFIGURATION()

Expand All @@ -68,8 +72,8 @@ PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES "eigen3 >= 3.0.0")

if(BUILD_PYTHON_INTERFACE)
ADD_PROJECT_DEPENDENCY(eigenpy 2.2 REQUIRED)
endif ()
FIND_PACKAGE(eigenpy 2.2 REQUIRED)
endif()

# Required dependencies
set(BOOST_COMPONENTS thread date_time system)
Expand All @@ -81,10 +85,10 @@ endif ()

search_for_boost()
# Optional dependencies
add_optional_dependency("octomap >= 1.6")
if (OCTOMAP_FOUND)
ADD_PROJECT_DEPENDENCY(octomap PKG_CONFIG_REQUIRES "octomap >= 1.6")
if(octomap_FOUND)
SET(HPP_FCL_HAVE_OCTOMAP TRUE)
string(REPLACE "." ";" VERSION_LIST ${OCTOMAP_VERSION})
string(REPLACE "." ";" VERSION_LIST ${octomap_VERSION})
list(GET VERSION_LIST 0 OCTOMAP_MAJOR_VERSION)
list(GET VERSION_LIST 1 OCTOMAP_MINOR_VERSION)
list(GET VERSION_LIST 2 OCTOMAP_PATCH_VERSION)
Expand Down Expand Up @@ -115,7 +119,7 @@ if(HPP_FCL_HAS_QHULL)
)
endif()

ADD_REQUIRED_DEPENDENCY("assimp >= 2.0")
FIND_PACKAGE(assimp REQUIRED)

SET(${PROJECT_NAME}_HEADERS
include/hpp/fcl/collision_data.h
Expand Down
2 changes: 1 addition & 1 deletion cmake
25 changes: 25 additions & 0 deletions cmake-modules/Findassimp.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# Copyright 2020 CNRS INRIA
#
# Author: Guilhem Saurel
#

# Try to find assimp in standard prefixes and in ${assimp_PREFIX}
# Once done this will define
# assimp_FOUND - System has assimp
# assimp_INCLUDE_DIR - The assimp include directories
# assimp_LIBRARY - The libraries needed to use assimp

FIND_PATH(assimp_INCLUDE_DIR
NAMES assimp/defs.h
PATHS ${assimp_PREFIX} ${assimp_PREFIX}/include
)

FIND_LIBRARY(assimp_LIBRARY
NAMES assimp
PATHS ${assimp_PREFIX} ${assimp_PREFIX}/lib
)

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(assimp DEFAULT_MSG assimp_LIBRARY assimp_INCLUDE_DIR)
mark_as_advanced(assimp_INCLUDE_DIR assimp_LIBRARY)
34 changes: 21 additions & 13 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,18 @@ ADD_HEADER_GROUP(PROJECT_HEADERS_FULL_PATH)

TARGET_LINK_LIBRARIES(${LIBRARY_NAME}
PUBLIC
Boost::thread
Boost::date_time
Boost::system
${Boost_THREAD_LIBRARY}
${Boost_DATE_TIME_LIBRARY}
${Boost_SYSTEM_LIBRARY}
# Boost::thread
# Boost::date_time
# Boost::system
)

TARGET_LINK_LIBRARIES(${LIBRARY_NAME}
PRIVATE
${assimp_LIBRARY}
# assimp::assimp # Not working
)

if(HPP_FCL_HAS_QHULL)
Expand All @@ -173,28 +182,27 @@ endif()
target_include_directories(${LIBRARY_NAME}
SYSTEM PUBLIC
${EIGEN3_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
)
target_include_directories(${LIBRARY_NAME}
SYSTEM PRIVATE
${assimp_INCLUDE_DIR}
)

target_include_directories(${LIBRARY_NAME}
PUBLIC
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} assimp)
if (NOT ${ASSIMP_VERSION} VERSION_LESS "2.0.1150")
target_compile_definitions(${LIBRARY_NAME} PRIVATE -DHPP_FCL_USE_ASSIMP_UNIFIED_HEADER_NAMES)
message(STATUS "Assimp version has unified headers")
else()
message(STATUS "Assimp version does not have unified headers")
endif()
IF(OCTOMAP_FOUND)
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} octomap)
IF(octomap_FOUND)
target_include_directories(${LIBRARY_NAME} SYSTEM PUBLIC ${OCTOMAP_INCLUDE_DIRS})
target_link_libraries(${LIBRARY_NAME} PUBLIC ${OCTOMAP_LIBRARIES})
target_compile_definitions (${LIBRARY_NAME} PUBLIC
-DHPP_FCL_HAVE_OCTOMAP
-DOCTOMAP_MAJOR_VERSION=${OCTOMAP_MAJOR_VERSION}
-DOCTOMAP_MINOR_VERSION=${OCTOMAP_MINOR_VERSION}
-DOCTOMAP_PATCH_VERSION=${OCTOMAP_PATCH_VERSION})
ENDIF(OCTOMAP_FOUND)
ENDIF(octomap_FOUND)

install(TARGETS ${LIBRARY_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
Expand Down
21 changes: 6 additions & 15 deletions src/mesh_loader/assimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,12 @@
#define AI_NO_EXCEPT
#endif

#ifdef HPP_FCL_USE_ASSIMP_UNIFIED_HEADER_NAMES
#include <assimp/DefaultLogger.hpp>
#include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/Importer.hpp>
#include <assimp/postprocess.h>
#include <assimp/scene.h>
#else
#include <assimp/DefaultLogger.h>
#include <assimp/assimp.hpp>
#include <assimp/IOStream.h>
#include <assimp/IOSystem.h>
#include <assimp/aiPostProcess.h>
#include <assimp/aiScene.h>
#endif
#include <assimp/DefaultLogger.hpp>
#include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/Importer.hpp>
#include <assimp/postprocess.h>
#include <assimp/scene.h>

namespace hpp
{
Expand Down
2 changes: 0 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ macro(add_fcl_test test_name source)
Boost::unit_test_framework
utility
)
PKG_CONFIG_USE_DEPENDENCY(${test_name} assimp)
target_compile_options(${test_name} PRIVATE "-Wno-c99-extensions")
if(HPP_FCL_HAS_QHULL)
target_compile_options(${test_name} PRIVATE -DHPP_FCL_HAS_QHULL)
Expand Down Expand Up @@ -49,7 +48,6 @@ add_fcl_test(convex convex.cpp)
add_fcl_test(bvh_models bvh_models.cpp)

add_fcl_test(profiling profiling.cpp)
PKG_CONFIG_USE_DEPENDENCY(profiling assimp)

add_fcl_test(gjk gjk.cpp)
if(HPP_FCL_HAVE_OCTOMAP)
Expand Down

0 comments on commit 749492c

Please sign in to comment.