Skip to content

Commit 4304833

Browse files
j-riverojslee02
authored andcommitted
C++ visibility support (take II) (#233)
1 parent 6177686 commit 4304833

File tree

222 files changed

+789
-400
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+789
-400
lines changed

CMakeLists.txt

+6-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ project(fcl CXX C)
2424

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

2831
# set the default build type
2932
if (NOT MSVC AND NOT CMAKE_BUILD_TYPE)
@@ -42,6 +45,7 @@ include(FCLMacros)
4245
include(CompilerSettings)
4346
include(FCLVersion)
4447
include(GNUInstallDirs)
48+
include(GenerateExportHeader)
4549

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

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

237-
add_subdirectory(include/fcl)
238240
add_subdirectory(src)
241+
add_subdirectory(include/fcl)
239242

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

263266
option(FCL_BUILD_TESTS "Build FCL tests" ON)
264-
if(FCL_BUILD_TESTS)
267+
if(FCL_BUILD_TESTS AND NOT FCL_HIDE_ALL_SYMBOLS)
265268
enable_testing()
266269
add_subdirectory(test)
267270
endif()

include/fcl/CMakeLists.txt

+10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@ file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
22
file(GLOB_RECURSE CONFIGURED_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/*.h)
33
set(FCL_HEADERS ${HEADERS} ${CONFIGURED_HEADERS} PARENT_SCOPE)
44

5+
# Generate export header. There is no way of generating a file name
6+
# called just export.h. Workaround using configure and remove
7+
generate_export_header(${PROJECT_NAME})
8+
configure_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_export.h
9+
${CMAKE_CURRENT_BINARY_DIR}/export.h
10+
COPYONLY)
11+
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_export.h)
12+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/export.h
13+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fcl)
14+
515
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
616
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fcl)
717

include/fcl/broadphase/broadphase_SSaP-inl.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace fcl
4545

4646
//==============================================================================
4747
extern template
48-
class SSaPCollisionManager<double>;
48+
class FCL_EXPORT SSaPCollisionManager<double>;
4949

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

8686
/** @brief Dummy collision object with a point AABB<S> */
8787
template <typename S>
88-
class DummyCollisionObject : public CollisionObject<S>
88+
class FCL_EXPORT DummyCollisionObject : public CollisionObject<S>
8989
{
9090
public:
9191
DummyCollisionObject(const AABB<S>& aabb_) : CollisionObject<S>(std::shared_ptr<CollisionGeometry<S>>())

include/fcl/broadphase/broadphase_SSaP.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace fcl
4646

4747
/// @brief Simple SAP collision manager
4848
template <typename S>
49-
class SSaPCollisionManager : public BroadPhaseCollisionManager<S>
49+
class FCL_EXPORT SSaPCollisionManager : public BroadPhaseCollisionManager<S>
5050
{
5151
public:
5252
SSaPCollisionManager();

include/fcl/broadphase/broadphase_SaP-inl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace fcl
4545

4646
//==============================================================================
4747
extern template
48-
class SaPCollisionManager<double>;
48+
class FCL_EXPORT SaPCollisionManager<double>;
4949

5050
//==============================================================================
5151
template <typename S>

include/fcl/broadphase/broadphase_SaP.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace fcl
4848

4949
/// @brief Rigorous SAP collision manager
5050
template <typename S>
51-
class SaPCollisionManager : public BroadPhaseCollisionManager<S>
51+
class FCL_EXPORT SaPCollisionManager : public BroadPhaseCollisionManager<S>
5252
{
5353
public:
5454

@@ -119,10 +119,10 @@ class SaPCollisionManager : public BroadPhaseCollisionManager<S>
119119
struct SaPPair;
120120

121121
/// @brief Functor to help unregister one object
122-
class isUnregistered;
122+
class FCL_EXPORT isUnregistered;
123123

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

127127
void update_(SaPAABB* updated_aabb);
128128

@@ -215,7 +215,7 @@ struct SaPCollisionManager<S>::SaPPair
215215

216216
/// @brief Functor to help unregister one object
217217
template <typename S>
218-
class SaPCollisionManager<S>::isUnregistered
218+
class FCL_EXPORT SaPCollisionManager<S>::isUnregistered
219219
{
220220
CollisionObject<S>* obj;
221221

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

228228
/// @brief Functor to help remove collision pairs no longer valid (i.e., should be culled away)
229229
template <typename S>
230-
class SaPCollisionManager<S>::isNotValidPair
230+
class FCL_EXPORT SaPCollisionManager<S>::isNotValidPair
231231
{
232232
CollisionObject<S>* obj1;
233233
CollisionObject<S>* obj2;

include/fcl/broadphase/broadphase_bruteforce-inl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace fcl {
4646

4747
//==============================================================================
4848
extern template
49-
class NaiveCollisionManager<double>;
49+
class FCL_EXPORT NaiveCollisionManager<double>;
5050

5151
//==============================================================================
5252
template <typename S>

include/fcl/broadphase/broadphase_bruteforce.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace fcl
4646

4747
/// @brief Brute force N-body collision manager
4848
template <typename S>
49-
class NaiveCollisionManager : public BroadPhaseCollisionManager<S>
49+
class FCL_EXPORT NaiveCollisionManager : public BroadPhaseCollisionManager<S>
5050
{
5151
public:
5252
NaiveCollisionManager();

include/fcl/broadphase/broadphase_collision_manager-inl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace fcl {
4646

4747
//==============================================================================
4848
extern template
49-
class BroadPhaseCollisionManager<double>;
49+
class FCL_EXPORT BroadPhaseCollisionManager<double>;
5050

5151
//==============================================================================
5252
template <typename S>

include/fcl/broadphase/broadphase_collision_manager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ using DistanceCallBack = bool (*)(
6363
/// collision/distance between N objects. Also support self collision, self
6464
/// distance and collision/distance with another M objects.
6565
template <typename S>
66-
class BroadPhaseCollisionManager
66+
class FCL_EXPORT BroadPhaseCollisionManager
6767
{
6868
public:
6969
BroadPhaseCollisionManager();

include/fcl/broadphase/broadphase_continuous_collision_manager-inl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace fcl {
4646

4747
//==============================================================================
4848
extern template
49-
class BroadPhaseContinuousCollisionManager<double>;
49+
class FCL_EXPORT BroadPhaseContinuousCollisionManager<double>;
5050

5151
//==============================================================================
5252
template <typename S>

include/fcl/broadphase/broadphase_continuous_collision_manager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ using ContinuousDistanceCallBack = bool (*)(
6363
/// accelerate the continuous collision/distance between N objects. Also support
6464
/// self collision, self distance and collision/distance with another M objects.
6565
template <typename S>
66-
class BroadPhaseContinuousCollisionManager
66+
class FCL_EXPORT BroadPhaseContinuousCollisionManager
6767
{
6868
public:
6969
BroadPhaseContinuousCollisionManager();

0 commit comments

Comments
 (0)