Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ visibility support (take II) #233

Merged
merged 21 commits into from
Nov 17, 2017
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
43d6a4e
Implement C++ visibility
j-rivero Oct 4, 2017
17a6c33
Added an option to hide all symbols
j-rivero Oct 4, 2017
3fb1525
Use compiler instead of gcc for variable names
j-rivero Oct 11, 2017
59e3f2d
Revert wrong changes introduced in headers documentation
j-rivero Oct 11, 2017
c8c6d50
Add missing FCL_VISIBLE macros
j-rivero Oct 11, 2017
9fa581d
More FCL_VISIBLE additions
j-rivero Oct 12, 2017
d090a99
Merge branch 'master' into visibility2
jslee02 Oct 12, 2017
268af4c
Missing symbols
j-rivero Oct 12, 2017
3751298
Last two missing FCL_VISIBLE symbols
j-rivero Oct 12, 2017
22a8fb6
Merge branch 'visibility2' of github.com:j-rivero/fcl into visibility2
j-rivero Oct 13, 2017
4c9e019
Implement the use of GenerateExportHeader to control visibility
j-rivero Oct 13, 2017
23afecf
Added missing macros to make clang happy
j-rivero Oct 14, 2017
956d3a9
Fix the definition after using GenerateExportHeader
j-rivero Nov 8, 2017
3a24d6f
Merge branch 'master' into visibility2
jslee02 Nov 9, 2017
b511676
Merge branch 'master' into visibility2
jslee02 Nov 11, 2017
f98dd43
Change export header from fcl_export.h to fcl/export.h
j-rivero Nov 14, 2017
a232b08
Revert unintended modifications
j-rivero Nov 14, 2017
fd81e43
Merge branch 'visibility2' of github.com:j-rivero/fcl into visibility2
j-rivero Nov 14, 2017
c367a8b
Merge branch 'master' into visibility2
jslee02 Nov 16, 2017
831a13e
Fix install directory of the export.h file
j-rivero Nov 16, 2017
2b2478d
Merge branch 'visibility2' of github.com:j-rivero/fcl into visibility2
j-rivero Nov 16, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion 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)
Copy link
Member

@jslee02 jslee02 Nov 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just learned this very useful CMake utility! 😮


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,6 +233,11 @@ else()
message(STATUS "FCL does not use OctoMap (as requested)")
endif()

# Need to include directory to find export file
include_directories(${PROJECT_BINARY_DIR})

install(FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}_export.h
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we change the export header to simply export.h? I don't see any ambiguity or confliction in including this file if we install this file under ${CMAKE_INSTALL_INCLUDEDIR}/fcl. In this way, we could include this file as:

#include "fcl/export.h" // in FCL code base

#include <fcl/export.h> // in FCL dependent projects.

DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe FCL installs all the headers under ${CMAKE_INSTALL_INCLUDEDIR}/fcl. Could we apply this to this export header as well?


# FCL's own include dir should be at the front of the include path
include_directories(BEFORE "include")
Expand Down Expand Up @@ -261,11 +270,13 @@ 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()

generate_export_header(${PROJECT_NAME})

#===============================================================================
# API documentation using Doxygen
# References:
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