-
Notifications
You must be signed in to change notification settings - Fork 429
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
C++ visibility support (take II) #233
Conversation
I think that all the compilers/options on Linux and Windows are now happy. Mac is failing due to a problem finding ccd (I think it is unrelated to this PR). |
@jslee02 I've been trying to compile this branch with Dart (master and tag 6.3.1) but there are compilation failures due to a change in headers location. Do you know if there is any branch ready in Dart ready to work with fcl current master? |
@j-rivero dartsim/dart#873 should work with this PR. I tested it against FCL 0.5 as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not an expert on exporting symbols, but this looks a great change according to the description!
I've made some comments:
- I guess you replaced "class " with "class FCL_EXPOSE ". It seems this made unintended changes in descriptions of some classes.
- About the name and installation location of
fcl_expose.h
.
Besides on that, it looks good to me.
include/fcl/geometry/bvh/BV_node.h
Outdated
@@ -47,9 +47,9 @@ | |||
namespace fcl | |||
{ | |||
|
|||
/// @brief A class describing a bounding volume node. It includes the tree structure providing in BVNodeBase and also the geometry data provided in BV template parameter. | |||
/// @brief A class FCL_EXPORT describing a bounding volume node. It includes the tree structure providing in BVNodeBase and also the geometry data provided in BV template parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe an oversight?
@@ -60,9 +60,9 @@ enum SplitMethodType | |||
SPLIT_METHOD_BV_CENTER | |||
}; | |||
|
|||
/// @brief A class describing the split rule that splits each BV node | |||
/// @brief A class FCL_EXPORT describing the split rule that splits each BV node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe an oversight?
include/fcl/geometry/shape/utility.h
Outdated
@@ -38,7 +38,7 @@ | |||
#ifndef FCL_GEOMETRY_SHAPE_UTILITY_H | |||
#define FCL_GEOMETRY_SHAPE_UTILITY_H | |||
|
|||
// This header shouldn't be included by any bounding volumen classes (e.g., | |||
// This header shouldn't be included by any bounding volumen class FCL_EXPORTes (e.g., |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe an oversight?
include/fcl/math/bv/AABB.h
Outdated
@@ -43,10 +43,10 @@ | |||
namespace fcl | |||
{ | |||
|
|||
/// @brief A class describing the AABB collision structure, which is a box in 3D | |||
/// @brief A class FCL_EXPORT describing the AABB collision structure, which is a box in 3D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe an oversight?
include/fcl/math/bv/OBB.h
Outdated
@@ -46,9 +46,9 @@ | |||
namespace fcl | |||
{ | |||
|
|||
/// @brief Oriented bounding box class | |||
/// @brief Oriented bounding box class FCL_EXPORT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe an oversight?
CMakeLists.txt
Outdated
# Need to include directory to find export file | ||
include_directories(${PROJECT_BINARY_DIR}) | ||
|
||
install(FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}_export.h |
There was a problem hiding this comment.
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.
@@ -42,6 +45,7 @@ include(FCLMacros) | |||
include(CompilerSettings) | |||
include(FCLVersion) | |||
include(GNUInstallDirs) | |||
include(GenerateExportHeader) |
There was a problem hiding this comment.
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! 😮
{ | ||
using S = S_; | ||
|
||
/// @brief intersection checking between two shapes | ||
/// @deprecated use shapeIntersect(const Shape1&, const Transform3<S>&, const Shape2&, const Transform3<S>&, std::vector<ContactPoint<S>>*) const | ||
template<typename Shape1, typename Shape2> | ||
FCL_DEPRECATED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an oversight or removed intentionally? fcl_export.h
still has the definition of FCL_DEPRECATED
. This deprecation was introduced in #52 for backward compatibility. If we want to remove this deprecation, I would like to remove this function entirely not to cause confusion of which shapeIntersect
should be used.
{ | ||
using S = S_; | ||
|
||
/// @brief intersection checking between two shapes | ||
/// @deprecated use shapeIntersect(const Shape1&, const Transform3<S>&, const Shape2&, const Transform3<S>&, std::vector<ContactPoint<S>>*) const | ||
template<typename Shape1, typename Shape2> | ||
FCL_DEPRECATED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto:
Is this an oversight or removed intentionally? fcl_export.h still has the definition of FCL_DEPRECATED. This deprecation was introduced in #52 for backward compatibility. If we want to remove this deprecation, I would like to remove this function entirely not to cause confusion of which shapeIntersect should be used.
@@ -212,7 +216,7 @@ bool initialize( | |||
DistanceResult<S>& result); | |||
|
|||
template <typename BV> | |||
FCL_DEPRECATED | |||
FCL_EXPORT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this should be FCL_DEPRECATED_EXPORT
.
Thanks JS for the review.
You were right. I think I've reverted all the changes you detected. Thanks for carefully looking into them.
I agree, we can use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
While testing DART compilation against this branch I found a little problem with export.h location and fixed it in 831a13e. In my opinion, we are ready to merge. |
Good catch! Let's merge this unless we have more feedback by tomorrow. |
Continues discussion and work done in #231. Reproducing the summary:
This PR implements the control of binary symbols visibility in FCL.
It adds a new
FCL_VISIBLE
preprocessor define to any class, struct or function that needs to be exposed publicly to third party software. Since the number of files in this library is not small, I've patched all what I found needed to compile the whole test suite. It would be good to use another third party software using FCL extensively to test that I did not forget about any of them.The PR also adds the
FCL_HIDE_ALL_SYMBOLS
option (OFF by the default). This option covers a use case we found in Drake where a software uses FCL (linked statically) but does not expose it in the public API (headers). In this scenario the best option to avoid any possible conflict with other versions of fcl is to hide all the symbols from the public ABI.Numbers before and after:
Summary: 13% symbols less and 6% size less .
The PR will alter the ABI so a new bump in the FCL version prior to release it would be ideal.