Skip to content

Commit

Permalink
C++ visibility support (take II) (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
j-rivero authored and jslee02 committed Nov 17, 2017
1 parent 6177686 commit 4304833
Show file tree
Hide file tree
Showing 222 changed files with 789 additions and 400 deletions.
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ project(fcl CXX C)

option(FCL_ENABLE_PROFILING "Enable profiling" OFF)
option(FCL_TREAT_WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)
# Option for some bundle-like build system in order not to expose
# any FCL binary symbols in their public ABI
option(FCL_HIDE_ALL_SYMBOLS "Hide all binary symbols" OFF)

# set the default build type
if (NOT MSVC AND NOT CMAKE_BUILD_TYPE)
Expand All @@ -42,6 +45,7 @@ include(FCLMacros)
include(CompilerSettings)
include(FCLVersion)
include(GNUInstallDirs)
include(GenerateExportHeader)

if(MSVC OR IS_ICPC)
option(FCL_STATIC_LIBRARY "Whether the FCL library should be static rather than shared" ON)
Expand Down Expand Up @@ -229,13 +233,12 @@ else()
message(STATUS "FCL does not use OctoMap (as requested)")
endif()


# FCL's own include dir should be at the front of the include path
include_directories(BEFORE "include")
include_directories(BEFORE "${CMAKE_CURRENT_BINARY_DIR}/include")

add_subdirectory(include/fcl)
add_subdirectory(src)
add_subdirectory(include/fcl)

set(pkg_conf_file_in "${CMAKE_CURRENT_SOURCE_DIR}/fcl.pc.in")
set(pkg_conf_file_out "${CMAKE_CURRENT_BINARY_DIR}/fcl.pc")
Expand All @@ -261,7 +264,7 @@ add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/CMakeModules/cmake_uninstall.cmake")

option(FCL_BUILD_TESTS "Build FCL tests" ON)
if(FCL_BUILD_TESTS)
if(FCL_BUILD_TESTS AND NOT FCL_HIDE_ALL_SYMBOLS)
enable_testing()
add_subdirectory(test)
endif()
Expand Down
10 changes: 10 additions & 0 deletions include/fcl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
file(GLOB_RECURSE CONFIGURED_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/*.h)
set(FCL_HEADERS ${HEADERS} ${CONFIGURED_HEADERS} PARENT_SCOPE)

# Generate export header. There is no way of generating a file name
# called just export.h. Workaround using configure and remove
generate_export_header(${PROJECT_NAME})
configure_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_export.h
${CMAKE_CURRENT_BINARY_DIR}/export.h
COPYONLY)
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_export.h)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/export.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fcl)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fcl)

Expand Down
4 changes: 2 additions & 2 deletions include/fcl/broadphase/broadphase_SSaP-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace fcl

//==============================================================================
extern template
class SSaPCollisionManager<double>;
class FCL_EXPORT SSaPCollisionManager<double>;

/** @brief Functor sorting objects according to the AABB<S> lower x bound */
template <typename S>
Expand Down Expand Up @@ -85,7 +85,7 @@ struct SortByZLow

/** @brief Dummy collision object with a point AABB<S> */
template <typename S>
class DummyCollisionObject : public CollisionObject<S>
class FCL_EXPORT DummyCollisionObject : public CollisionObject<S>
{
public:
DummyCollisionObject(const AABB<S>& aabb_) : CollisionObject<S>(std::shared_ptr<CollisionGeometry<S>>())
Expand Down
2 changes: 1 addition & 1 deletion include/fcl/broadphase/broadphase_SSaP.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace fcl

/// @brief Simple SAP collision manager
template <typename S>
class SSaPCollisionManager : public BroadPhaseCollisionManager<S>
class FCL_EXPORT SSaPCollisionManager : public BroadPhaseCollisionManager<S>
{
public:
SSaPCollisionManager();
Expand Down
2 changes: 1 addition & 1 deletion include/fcl/broadphase/broadphase_SaP-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace fcl

//==============================================================================
extern template
class SaPCollisionManager<double>;
class FCL_EXPORT SaPCollisionManager<double>;

//==============================================================================
template <typename S>
Expand Down
10 changes: 5 additions & 5 deletions include/fcl/broadphase/broadphase_SaP.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace fcl

/// @brief Rigorous SAP collision manager
template <typename S>
class SaPCollisionManager : public BroadPhaseCollisionManager<S>
class FCL_EXPORT SaPCollisionManager : public BroadPhaseCollisionManager<S>
{
public:

Expand Down Expand Up @@ -119,10 +119,10 @@ class SaPCollisionManager : public BroadPhaseCollisionManager<S>
struct SaPPair;

/// @brief Functor to help unregister one object
class isUnregistered;
class FCL_EXPORT isUnregistered;

/// @brief Functor to help remove collision pairs no longer valid (i.e., should be culled away)
class isNotValidPair;
class FCL_EXPORT isNotValidPair;

void update_(SaPAABB* updated_aabb);

Expand Down Expand Up @@ -215,7 +215,7 @@ struct SaPCollisionManager<S>::SaPPair

/// @brief Functor to help unregister one object
template <typename S>
class SaPCollisionManager<S>::isUnregistered
class FCL_EXPORT SaPCollisionManager<S>::isUnregistered
{
CollisionObject<S>* obj;

Expand All @@ -227,7 +227,7 @@ class SaPCollisionManager<S>::isUnregistered

/// @brief Functor to help remove collision pairs no longer valid (i.e., should be culled away)
template <typename S>
class SaPCollisionManager<S>::isNotValidPair
class FCL_EXPORT SaPCollisionManager<S>::isNotValidPair
{
CollisionObject<S>* obj1;
CollisionObject<S>* obj2;
Expand Down
2 changes: 1 addition & 1 deletion include/fcl/broadphase/broadphase_bruteforce-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace fcl {

//==============================================================================
extern template
class NaiveCollisionManager<double>;
class FCL_EXPORT NaiveCollisionManager<double>;

//==============================================================================
template <typename S>
Expand Down
2 changes: 1 addition & 1 deletion include/fcl/broadphase/broadphase_bruteforce.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace fcl

/// @brief Brute force N-body collision manager
template <typename S>
class NaiveCollisionManager : public BroadPhaseCollisionManager<S>
class FCL_EXPORT NaiveCollisionManager : public BroadPhaseCollisionManager<S>
{
public:
NaiveCollisionManager();
Expand Down
2 changes: 1 addition & 1 deletion include/fcl/broadphase/broadphase_collision_manager-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace fcl {

//==============================================================================
extern template
class BroadPhaseCollisionManager<double>;
class FCL_EXPORT BroadPhaseCollisionManager<double>;

//==============================================================================
template <typename S>
Expand Down
2 changes: 1 addition & 1 deletion include/fcl/broadphase/broadphase_collision_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ using DistanceCallBack = bool (*)(
/// collision/distance between N objects. Also support self collision, self
/// distance and collision/distance with another M objects.
template <typename S>
class BroadPhaseCollisionManager
class FCL_EXPORT BroadPhaseCollisionManager
{
public:
BroadPhaseCollisionManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace fcl {

//==============================================================================
extern template
class BroadPhaseContinuousCollisionManager<double>;
class FCL_EXPORT BroadPhaseContinuousCollisionManager<double>;

//==============================================================================
template <typename S>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ using ContinuousDistanceCallBack = bool (*)(
/// accelerate the continuous collision/distance between N objects. Also support
/// self collision, self distance and collision/distance with another M objects.
template <typename S>
class BroadPhaseContinuousCollisionManager
class FCL_EXPORT BroadPhaseContinuousCollisionManager
{
public:
BroadPhaseContinuousCollisionManager();
Expand Down
Loading

0 comments on commit 4304833

Please sign in to comment.