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 #231

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 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 Down Expand Up @@ -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
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_VISIBLE 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_VISIBLE 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_VISIBLE 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_VISIBLE 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_VISIBLE 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_VISIBLE isUnregistered;

/// @brief Functor to help remove collision pairs no longer valid (i.e., should be culled away)
class isNotValidPair;
class FCL_VISIBLE 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_VISIBLE 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_VISIBLE 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_VISIBLE 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_VISIBLE 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_VISIBLE 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_VISIBLE 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_VISIBLE 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_VISIBLE BroadPhaseContinuousCollisionManager
{
public:
BroadPhaseContinuousCollisionManager();
Expand Down
2 changes: 1 addition & 1 deletion include/fcl/broadphase/broadphase_dynamic_AABB_tree-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace fcl {

//==============================================================================
extern template
class DynamicAABBTreeCollisionManager<double>;
class FCL_VISIBLE DynamicAABBTreeCollisionManager<double>;

namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion include/fcl/broadphase/broadphase_dynamic_AABB_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace fcl
{

template <typename S>
class DynamicAABBTreeCollisionManager : public BroadPhaseCollisionManager<S>
class FCL_VISIBLE DynamicAABBTreeCollisionManager : public BroadPhaseCollisionManager<S>
{
public:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace fcl

//==============================================================================
extern template
class DynamicAABBTreeCollisionManager_Array<double>;
class FCL_VISIBLE DynamicAABBTreeCollisionManager_Array<double>;

namespace detail
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace fcl
{

template <typename S>
class DynamicAABBTreeCollisionManager_Array : public BroadPhaseCollisionManager<S>
class FCL_VISIBLE DynamicAABBTreeCollisionManager_Array : public BroadPhaseCollisionManager<S>
{
public:

Expand Down
2 changes: 1 addition & 1 deletion include/fcl/broadphase/broadphase_interval_tree-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace fcl

//==============================================================================
extern template
class IntervalTreeCollisionManager<double>;
class FCL_VISIBLE IntervalTreeCollisionManager<double>;

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

/// @brief Collision manager based on interval tree
template <typename S>
class IntervalTreeCollisionManager : public BroadPhaseCollisionManager<S>
class FCL_VISIBLE IntervalTreeCollisionManager : public BroadPhaseCollisionManager<S>
{
public:
IntervalTreeCollisionManager();
Expand Down
2 changes: 1 addition & 1 deletion include/fcl/broadphase/broadphase_spatialhash-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace fcl

//==============================================================================
extern template
class SpatialHashingCollisionManager<
class FCL_VISIBLE SpatialHashingCollisionManager<
double,
detail::SimpleHashTable<
AABB<double>, CollisionObject<double>*, detail::SpatialHash<double>>>;
Expand Down
2 changes: 1 addition & 1 deletion include/fcl/broadphase/broadphase_spatialhash.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace fcl
template<typename S,
typename HashTable
= detail::SimpleHashTable<AABB<S>, CollisionObject<S>*, detail::SpatialHash<S>> >
class SpatialHashingCollisionManager : public BroadPhaseCollisionManager<S>
class FCL_VISIBLE SpatialHashingCollisionManager : public BroadPhaseCollisionManager<S>
{
public:
SpatialHashingCollisionManager(
Expand Down
2 changes: 1 addition & 1 deletion include/fcl/broadphase/detail/hierarchy_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace detail

/// @brief Class for hierarchy tree structure
template<typename BV>
class HierarchyTree
class FCL_VISIBLE HierarchyTree
{
public:

Expand Down
2 changes: 1 addition & 1 deletion include/fcl/broadphase/detail/hierarchy_tree_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace implementation_array

/// @brief Class for hierarchy tree structure
template<typename BV>
class HierarchyTree
class FCL_VISIBLE HierarchyTree
{
using S = typename BV::S;
typedef NodeBase<BV> NodeType;
Expand Down
2 changes: 1 addition & 1 deletion include/fcl/broadphase/detail/interval_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct it_recursion_node<double>;

/// @brief Interval tree
template <typename S>
class IntervalTree
class FCL_VISIBLE IntervalTree
{
public:

Expand Down
2 changes: 1 addition & 1 deletion include/fcl/broadphase/detail/interval_tree_node-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace detail {

//==============================================================================
extern template
class IntervalTreeNode<double>;
class FCL_VISIBLE IntervalTreeNode<double>;

//==============================================================================
template <typename S>
Expand Down
3 changes: 2 additions & 1 deletion include/fcl/broadphase/detail/interval_tree_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#define FCL_BROADPHASE_DETAIL_INTERVALTREENODE_H

#include "fcl/broadphase/detail/simple_interval.h"
#include "fcl/common/visibility.h"

namespace fcl
{
Expand All @@ -51,7 +52,7 @@ class IntervalTree;

/// @brief The node for interval tree
template <typename S>
class IntervalTreeNode
class FCL_VISIBLE IntervalTreeNode
{
public:

Expand Down
6 changes: 3 additions & 3 deletions include/fcl/broadphase/detail/morton.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct morton_functor {};

/// @brief Functor to compute 30 bit morton code for a given AABB<S>
template<typename S>
struct morton_functor<S, uint32>
struct FCL_VISIBLE morton_functor<S, uint32>
{
morton_functor(const AABB<S>& bbox);

Expand All @@ -86,7 +86,7 @@ using morton_functoru32d = morton_functor<double, uint32>;

/// @brief Functor to compute 60 bit morton code for a given AABB<S>
template<typename S>
struct morton_functor<S, uint64>
struct FCL_VISIBLE morton_functor<S, uint64>
{
morton_functor(const AABB<S>& bbox);

Expand All @@ -104,7 +104,7 @@ using morton_functoru64d = morton_functor<double, uint64>;
/// @brief Functor to compute N bit morton code for a given AABB<S>
/// N must be a multiple of 3.
template<typename S, size_t N>
struct morton_functor<S, std::bitset<N>>
struct FCL_VISIBLE morton_functor<S, std::bitset<N>>
{
static_assert(N%3==0, "Number of bits must be a multiple of 3");

Expand Down
2 changes: 1 addition & 1 deletion include/fcl/broadphase/detail/simple_hash_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace detail
/// @brief A simple hash table implemented as multiple buckets. HashFnc is any
/// extended hash function: HashFnc(key) = {index1, index2, ..., }
template<typename Key, typename Data, typename HashFnc>
class SimpleHashTable
class FCL_VISIBLE SimpleHashTable
{
protected:
typedef std::list<Data> Bin;
Expand Down
2 changes: 2 additions & 0 deletions include/fcl/broadphase/detail/simple_interval.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
#ifndef FCL_BROADPHASE_DETAIL_SIMPLEINTERVAL_H
#define FCL_BROADPHASE_DETAIL_SIMPLEINTERVAL_H

#include "fcl/common/visibility.h"

namespace fcl
{

Expand Down
4 changes: 2 additions & 2 deletions include/fcl/broadphase/detail/sparse_hash_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ namespace detail
{

template<typename U, typename V>
class unordered_map_hash_table : public std::unordered_map<U, V> {};
class FCL_VISIBLE unordered_map_hash_table : public std::unordered_map<U, V> {};

/// @brief A hash table implemented using unordered_map
template <typename Key, typename Data, typename HashFnc,
template<typename, typename> class TableT = unordered_map_hash_table>
class SparseHashTable
class FCL_VISIBLE SparseHashTable
{
protected:
HashFnc h_;
Expand Down
2 changes: 1 addition & 1 deletion include/fcl/broadphase/detail/spatial_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace detail

/// @brief Spatial hash function: hash an AABB to a set of integer values
template <typename S_>
struct SpatialHash
struct FCL_VISIBLE SpatialHash
{
using S = S_;

Expand Down
2 changes: 1 addition & 1 deletion include/fcl/common/deprecated.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
// FCL_DEPRECATED void foo ();
//
// Tagging a type as deprecated:
// FCL_DEPRECATED class Foo {};
// FCL_DEPRECATED class FCL_VISIBLE Foo {};
//
// Tagging a variable as deprecated:
// FCL_DEPRECATED int a = 0;
Expand Down
Loading