diff --git a/recipes/fcl/all/conanfile.py b/recipes/fcl/all/conanfile.py index 7e41afda3be3f..2fd6a5fe45165 100644 --- a/recipes/fcl/all/conanfile.py +++ b/recipes/fcl/all/conanfile.py @@ -47,10 +47,13 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("eigen/3.4.0") - self.requires("libccd/2.1") + # Used in fcl/common/types.h public header + self.requires("eigen/3.4.0", transitive_headers=True) + # Used in fcl/narrowphase/detail/convexity_based_algorithm/support.h + self.requires("libccd/2.1", transitive_headers=True) if self.options.with_octomap: - self.requires("octomap/1.9.7") + # Used in fcl/geometry/octree/octree.h + self.requires("octomap/1.9.7", transitive_headers=True) def validate(self): if self.settings.compiler.get_safe("cppstd"): @@ -63,25 +66,25 @@ def source(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["FCL_ENABLE_PROFILING"] = False - tc.variables["FCL_TREAT_WARNINGS_AS_ERRORS"] = False - tc.variables["FCL_HIDE_ALL_SYMBOLS"] = False - tc.variables["FCL_STATIC_LIBRARY"] = not self.options.shared - tc.variables["FCL_USE_X64_SSE"] = False # Let consumer decide to add relevant compile options, fcl doesn't have simd intrinsics - tc.variables["FCL_USE_HOST_NATIVE_ARCH"] = False - tc.variables["FCL_USE_SSE"] = False - tc.variables["FCL_COVERALLS"] = False - tc.variables["FCL_COVERALLS_UPLOAD"] = False - tc.variables["FCL_WITH_OCTOMAP"] = self.options.with_octomap + tc.cache_variables["FCL_ENABLE_PROFILING"] = False + tc.cache_variables["FCL_TREAT_WARNINGS_AS_ERRORS"] = False + tc.cache_variables["FCL_HIDE_ALL_SYMBOLS"] = False + tc.cache_variables["FCL_STATIC_LIBRARY"] = not self.options.shared + tc.cache_variables["FCL_USE_X64_SSE"] = False # Let consumer decide to add relevant compile options, fcl doesn't have simd intrinsics + tc.cache_variables["FCL_USE_HOST_NATIVE_ARCH"] = False + tc.cache_variables["FCL_USE_SSE"] = False + tc.cache_variables["FCL_COVERALLS"] = False + tc.cache_variables["FCL_COVERALLS_UPLOAD"] = False + tc.cache_variables["FCL_WITH_OCTOMAP"] = self.options.with_octomap if self.options.with_octomap: - octomap_version_str = self.dependencies["octomap"].ref.version - tc.variables["OCTOMAP_VERSION"] = octomap_version_str + octomap_version_str = str(self.dependencies["octomap"].ref.version) + tc.cache_variables["OCTOMAP_VERSION"] = octomap_version_str octomap_version = Version(octomap_version_str) - tc.variables["OCTOMAP_MAJOR_VERSION"] = octomap_version.major - tc.variables["OCTOMAP_MINOR_VERSION"] = octomap_version.minor - tc.variables["OCTOMAP_PATCH_VERSION"] = octomap_version.patch - tc.variables["BUILD_TESTING"] = False - tc.variables["FCL_NO_DEFAULT_RPATH"] = False + tc.cache_variables["OCTOMAP_MAJOR_VERSION"] = str(octomap_version.major) + tc.cache_variables["OCTOMAP_MINOR_VERSION"] = str(octomap_version.minor) + tc.cache_variables["OCTOMAP_PATCH_VERSION"] = str(octomap_version.patch) + tc.cache_variables["BUILD_TESTING"] = False + tc.cache_variables["FCL_NO_DEFAULT_RPATH"] = False tc.generate() cd = CMakeDeps(self) diff --git a/recipes/fcl/all/test_package/test_package.cpp b/recipes/fcl/all/test_package/test_package.cpp index 0f0651d6aa60c..7142e516a4b32 100644 --- a/recipes/fcl/all/test_package/test_package.cpp +++ b/recipes/fcl/all/test_package/test_package.cpp @@ -1,78 +1,15 @@ -/* -From test_broadphase_dynamic_AABB_tree.cpp test in FCL test directory -*/ - -#include "fcl/common/types.h" -#include "fcl/geometry/shape/sphere.h" -#include "fcl/broadphase/broadphase_dynamic_AABB_tree.h" +#include #include -#include +#include int main() { - auto sphere0 = std::make_shared(0.1); - auto sphere1 = std::make_shared(0.2); - fcl::CollisionObjectd object0(sphere0); - fcl::CollisionObjectd object1(sphere1); - const fcl::Vector3d position0(0.1, 0.2, 0.3); - const fcl::Vector3d position1(0.11, 0.21, 0.31); - - // We will use `objects` to check the order of the two collision objects in - // our callback function. - // - // We use std::vector that contains *pointers* to CollisionObjectd, - // instead of std::vector that contains CollisionObjectd's. - // Previously we used std::vector, and it failed the - // Eigen alignment assertion on Win32. We also tried, without success, the - // custom allocator: - // std::vector>, - // but some platforms failed to build. - std::vector objects = {&object0, &object1}; - std::vector positions = {&position0, &position1}; - - fcl::DynamicAABBTreeCollisionManager dynamic_tree; - for (int i = 0; i < static_cast(objects.size()); ++i) { - objects[i]->setTranslation(*positions[i]); - objects[i]->computeAABB(); - dynamic_tree.registerObject(objects[i]); - } - - // Pack the data for callback function. - struct CallBackData { - bool expect_object0_then_object1; - std::vector* objects; - } data; - data.expect_object0_then_object1 = false; - data.objects = &objects; - - // This callback function tests the order of the two collision objects from - // the dynamic tree against the `data`. We assume that the first two - // parameters are always objects[0] and objects[1] in two possible orders, - // so we can safely ignore the second parameter. We do not use the last - // double& parameter, which specifies the distance beyond which the - // pair of objects will be skipped. - auto distance_callback = [](fcl::CollisionObjectd* a, fcl::CollisionObjectd*, - void* callback_data, double&) -> bool { - // Unpack the data. - auto data = static_cast(callback_data); - const std::vector& objects = *(data->objects); - const bool object0_first = a == objects[0]; - // EXPECT_EQ(data->expect_object0_then_object1, object0_first); - // TODO(DamrongGuoy): Remove the statement below when we solve the - // repeatability problem as mentioned in: - // https://github.com/flexible-collision-library/fcl/issues/368 - // Expect to switch the order next time. - data->expect_object0_then_object1 = !data->expect_object0_then_object1; - // Return true to stop the tree traversal. - return true; - }; - // We repeat update() and distance() many times. Each time, in the - // callback function, we check the order of the two objects. - for (int count = 0; count < 8; ++count) { - dynamic_tree.update(); - dynamic_tree.distance(&data, distance_callback); - } - - return 0; + using namespace fcl; + std::shared_ptr> box_geometry_1(new Box()); + std::shared_ptr> box_geometry_2(new Box()); + CollisionObject box_object_1(box_geometry_1); + CollisionObject box_object_2(box_geometry_2); + DistanceRequest request; + DistanceResult result; + std::cout << "Distance: " << distance(&box_object_1, &box_object_2, request, result) << std::endl; }