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

fix shared on windows #461

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ configure_file(CTestCustom.cmake.in CTestCustom.cmake @ONLY)

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)
option(FCL_HIDE_ALL_SYMBOLS "Hide all binary symbols" ON)

# set the default build type
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
Expand All @@ -65,7 +63,11 @@ if(MSVC OR MSVC90 OR MSVC10)
set(MSVC ON)
endif (MSVC OR MSVC90 OR MSVC10)

set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
if(WIN32)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
else()
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
endif()
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
include(CMakePackageConfigHelpers)
include(GenerateExportHeader)
Expand Down Expand Up @@ -378,7 +380,8 @@ if(NOT FCL_BUILD_TESTS STREQUAL "DEFAULT")
unset(_BUILD_TESTING)
endif()

if(BUILD_TESTING AND NOT FCL_HIDE_ALL_SYMBOLS)
if(BUILD_TESTING)
enable_testing()
add_subdirectory(test)
endif()

Expand Down
5 changes: 4 additions & 1 deletion CMakeModules/CompilerSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ if(MSVC)
if(MSVC_VERSION VERSION_LESS 1900)
message(FATAL_ERROR "${PROJECT_NAME} requires Visual Studio 2015 or greater.")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /MP /W1 /bigobj")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /MP /bigobj")
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
STRING(REGEX REPLACE "/W[0-4]" "/W1" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endif()
if(FCL_TREAT_WARNINGS_AS_ERRORS)
add_definitions(/WX)
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 @@ -35,8 +35,18 @@ set(GENERATED_FILE_MARKER "GENERATED FILE DO NOT EDIT")

configure_file(config.h.in config.h @ONLY)

set(FCL_EXPORT_MACRO_NAME "FCL_EXPORT")
set(EXPORT_INSTANTIATION_TEMPLATE_MACROS "
#if defined(${PROJECT_NAME}_EXPORTS) && defined(_MSC_VER)
# define FCL_EXPORT_EXPL_INST_DECL
#else
# define FCL_EXPORT_EXPL_INST_DECL ${FCL_EXPORT_MACRO_NAME}
#endif
")
generate_export_header(${PROJECT_NAME}
EXPORT_MACRO_NAME ${FCL_EXPORT_MACRO_NAME}
EXPORT_FILE_NAME export.h
CUSTOM_CONTENT_FROM_VARIABLE EXPORT_INSTANTIATION_TEMPLATE_MACROS
)

get_filename_component(PARENT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}"
Expand Down
6 changes: 4 additions & 2 deletions include/fcl/broadphase/broadphase_SSaP-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ namespace fcl
{

//==============================================================================
#ifndef FCL_BROADPHASE_SSAP_BUILDING
extern template
class FCL_EXPORT SSaPCollisionManager<double>;
class FCL_EXPORT_EXPL_INST_DECL SSaPCollisionManager<double>;
#endif

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

/** @brief Dummy collision object with a point AABB<S> */
template <typename S>
class FCL_EXPORT DummyCollisionObject : public CollisionObject<S>
class 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 FCL_EXPORT SSaPCollisionManager : public BroadPhaseCollisionManager<S>
class SSaPCollisionManager : public BroadPhaseCollisionManager<S>
{
public:
SSaPCollisionManager();
Expand Down
4 changes: 3 additions & 1 deletion include/fcl/broadphase/broadphase_SaP-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ namespace fcl
{

//==============================================================================
#ifndef FCL_BROADPHASE_SAP_BUILDING
extern template
class FCL_EXPORT SaPCollisionManager<double>;
class FCL_EXPORT_EXPL_INST_DECL SaPCollisionManager<double>;
#endif

//==============================================================================
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 FCL_EXPORT SaPCollisionManager : public BroadPhaseCollisionManager<S>
class SaPCollisionManager : public BroadPhaseCollisionManager<S>
{
public:

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

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

/// @brief Functor to help remove collision pairs no longer valid (i.e., should be culled away)
class FCL_EXPORT isNotValidPair;
class 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 FCL_EXPORT SaPCollisionManager<S>::isUnregistered
class SaPCollisionManager<S>::isUnregistered
{
CollisionObject<S>* obj;

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

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

//==============================================================================
#ifndef FCL_BROADPHASE_BRUTEFORCE_BUILDING
extern template
class FCL_EXPORT NaiveCollisionManager<double>;
class FCL_EXPORT_EXPL_INST_DECL NaiveCollisionManager<double>;
#endif

//==============================================================================
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 FCL_EXPORT NaiveCollisionManager : public BroadPhaseCollisionManager<S>
class NaiveCollisionManager : public BroadPhaseCollisionManager<S>
{
public:
NaiveCollisionManager();
Expand Down
4 changes: 3 additions & 1 deletion include/fcl/broadphase/broadphase_collision_manager-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@
namespace fcl {

//==============================================================================
#ifndef FCL_BROADPHASE_COLLISION_MANAGER_BUILDING
extern template
class FCL_EXPORT BroadPhaseCollisionManager<double>;
class FCL_EXPORT_EXPL_INST_DECL BroadPhaseCollisionManager<double>;
#endif

//==============================================================================
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 FCL_EXPORT BroadPhaseCollisionManager
class BroadPhaseCollisionManager
{
public:
BroadPhaseCollisionManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@
namespace fcl {

//==============================================================================
#ifndef FCL_BROADPHASE_CONTINUOUS_COLLISION_MANAGER_BUILDING
extern template
class FCL_EXPORT BroadPhaseContinuousCollisionManager<double>;
class FCL_EXPORT_EXPL_INST_DECL BroadPhaseContinuousCollisionManager<double>;
#endif

//==============================================================================
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 FCL_EXPORT BroadPhaseContinuousCollisionManager
class BroadPhaseContinuousCollisionManager
{
public:
BroadPhaseContinuousCollisionManager();
Expand Down
Loading