diff --git a/.github/workflows/macos-linux-conda.yml b/.github/workflows/macos-linux-conda.yml index 9a83ac9..e414541 100644 --- a/.github/workflows/macos-linux-conda.yml +++ b/.github/workflows/macos-linux-conda.yml @@ -49,7 +49,7 @@ jobs: mkdir build cd build - cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$(which python3) -DGENERATE_PYTHON_STUBS=ON -DHPP_FCL_HAS_QHULL=ON + cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$(which python3) -DGENERATE_PYTHON_STUBS=ON -DHPP_FCL_HAS_QHULL=ON -DBUILD_DOCUMENTATION=ON -DINSTALL_DOCUMENTATION=ON make -j2 make build_tests export CTEST_OUTPUT_ON_FAILURE=1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 881a2ef..c90e326 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,14 +2,14 @@ ci: autoupdate_branch: devel repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.6 + rev: v0.1.14 hooks: - id: ruff args: - --fix - --exit-non-zero-on-fix - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v17.0.5 + rev: v17.0.6 hooks: - id: clang-format args: @@ -19,6 +19,6 @@ repos: hooks: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 23.11.0 + rev: 23.12.1 hooks: - id: black diff --git a/CHANGELOG.md b/CHANGELOG.md index b563fd5..4f2da58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +## [2.4.4] - 2024-03-06 + +## [2.4.3] - 2024-03-06 + +### Fixed +- updated cmake module to fix documentation generation +- test documentation in conda ci + +## [2.4.2] - 2024-03-06 + +### Fixed +- Fix CMAKE_INSTALL_{} path for installation ([#543](https://github.com/humanoid-path-planner/hpp-fcl/pull/543)) + +## [2.4.1] - 2024-01-23 + +### Fixed +- CachedMeshLoader checks file last modification time. +- Fix call to clear methods for {Collision,Distance}Data inside init function ([#509](https://github.com/humanoid-path-planner/hpp-fcl/pull/509)) +- CMake: fix submodule use in bindings in ([#512](https://github.com/humanoid-path-planner/hpp-fcl/pull/512)) +- Fix bug in DynamicAABBTreeCollisionManager (see [#514](https://github.com/humanoid-path-planner/hpp-fcl/issues/514)) in ([#515](https://github.com/humanoid-path-planner/hpp-fcl/pull/515)) + ## [2.4.0] - 2023-11-27 ### Added @@ -18,217 +39,217 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [2.3.7] - 2023-11-15 ### What's Changed -- Add Python 3.12 support by @jorisv in https://github.com/humanoid-path-planner/hpp-fcl/pull/471 -- Enable ruff linting by @nim65s https://github.com/humanoid-path-planner/hpp-fcl/pull/464 +- Add Python 3.12 support by [@jorisv](https://github.com/jorisv) ([#471](https://github.com/humanoid-path-planner/hpp-fcl/pull/471)) +- Enable ruff linting by [@nim65s](https://github.com/nim65s) ([#464](https://github.com/humanoid-path-planner/hpp-fcl/pull/464)) ## [2.3.6] - 2023-09-30 ### What's Changed -- Update ROS_DISTRO by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/442 -- Add citations by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/449 -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/444 -- [WIP] Debug by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/455 -- CMake: require >= 3.10 by @nim65s in https://github.com/humanoid-path-planner/hpp-fcl/pull/453 -- core: fix SaPCollisionManager::empty() by @rujialiu in https://github.com/humanoid-path-planner/hpp-fcl/pull/454 -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/452 +- Update ROS_DISTRO by [@jcarpent](https://github.com/jcarpent) ([#442](https://github.com/humanoid-path-planner/hpp-fcl/pull/442)) +- Add citations by [@jcarpent](https://github.com/jcarpent) ([#449](https://github.com/humanoid-path-planner/hpp-fcl/pull/449)) +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#444](https://github.com/humanoid-path-planner/hpp-fcl/pull/444)) +- [WIP] Debug by [@jcarpent](https://github.com/jcarpent) ([#455](https://github.com/humanoid-path-planner/hpp-fcl/pull/455)) +- CMake: require >= 3.10 by [@nim65s](https://github.com/nim65s) ([#453](https://github.com/humanoid-path-planner/hpp-fcl/pull/453)) +- core: fix SaPCollisionManager::empty() by [@rujialiu](https://github.com/rujialiu) ([#454](https://github.com/humanoid-path-planner/hpp-fcl/pull/454)) +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#452](https://github.com/humanoid-path-planner/hpp-fcl/pull/452)) ### New Contributors -- @rujialiu made their first contribution in https://github.com/humanoid-path-planner/hpp-fcl/pull/454 +- [@rujialiu](https://github.com/rujialiu) made their first contribution ([#454](https://github.com/humanoid-path-planner/hpp-fcl/pull/454)) ## [2.3.5] - 2023-07-11 ### What's Changed -- Fix compilation warning by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/434 -- Fix parsing of doxygen doc by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/439 -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/438 +- Fix compilation warning by [@jcarpent](https://github.com/jcarpent) ([#434](https://github.com/humanoid-path-planner/hpp-fcl/pull/434)) +- Fix parsing of doxygen doc by [@jcarpent](https://github.com/jcarpent) ([#439](https://github.com/humanoid-path-planner/hpp-fcl/pull/439)) +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#438](https://github.com/humanoid-path-planner/hpp-fcl/pull/438)) ## [2.3.4] - 2023-06-01 ### What's Changed -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/414 -- Fix conversion warning by @wxmerkt in https://github.com/humanoid-path-planner/hpp-fcl/pull/417 -- Add missing boost include by @nim65s in https://github.com/humanoid-path-planner/hpp-fcl/pull/418 -- ci: update macos-linux-pip by @nim65s in https://github.com/humanoid-path-planner/hpp-fcl/pull/419 -- Modernize Cmake use by @nim65s in https://github.com/humanoid-path-planner/hpp-fcl/pull/420 -- tests: use boost::filesystem by @nim65s in https://github.com/humanoid-path-planner/hpp-fcl/pull/424 -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/425 -- Update minimal Python version by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/427 -- Sync submodule cmake by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/430 -- Sync submodule CMake by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/431 +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#414](https://github.com/humanoid-path-planner/hpp-fcl/pull/414)) +- Fix conversion warning by [@wxmerkt](https://github.com/wxmerkt) ([#417](https://github.com/humanoid-path-planner/hpp-fcl/pull/417)) +- Add missing boost include by [@nim65s](https://github.com/nim65s) ([#418](https://github.com/humanoid-path-planner/hpp-fcl/pull/418)) +- ci: update macos-linux-pip by [@nim65s](https://github.com/nim65s) ([#419](https://github.com/humanoid-path-planner/hpp-fcl/pull/419)) +- Modernize Cmake use by [@nim65s](https://github.com/nim65s) ([#420](https://github.com/humanoid-path-planner/hpp-fcl/pull/420)) +- tests: use boost::filesystem by [@nim65s](https://github.com/nim65s) ([#424](https://github.com/humanoid-path-planner/hpp-fcl/pull/424)) +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#425](https://github.com/humanoid-path-planner/hpp-fcl/pull/425)) +- Update minimal Python version by [@jcarpent](https://github.com/jcarpent) ([#427](https://github.com/humanoid-path-planner/hpp-fcl/pull/427)) +- Sync submodule cmake by [@jcarpent](https://github.com/jcarpent) ([#430](https://github.com/humanoid-path-planner/hpp-fcl/pull/430)) +- Sync submodule CMake by [@jcarpent](https://github.com/jcarpent) ([#431](https://github.com/humanoid-path-planner/hpp-fcl/pull/431)) ## [2.3.3] - 2023-05-09 ### What's Changed -- update default C++ to 14 by @nim65s in https://github.com/humanoid-path-planner/hpp-fcl/pull/410 -- Sync submodule cmake by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/413 +- update default C++ to 14 by [@nim65s](https://github.com/nim65s) ([#410](https://github.com/humanoid-path-planner/hpp-fcl/pull/410)) +- Sync submodule cmake by [@jcarpent](https://github.com/jcarpent) ([#413](https://github.com/humanoid-path-planner/hpp-fcl/pull/413)) ## [2.3.2] - 2023-04-27 ### What's Changed -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/391 -- Sync submodule cmake by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/393 -- Topic/rpath by @nim65s in https://github.com/humanoid-path-planner/hpp-fcl/pull/394 -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/396 -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/399 -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/402 -- Sync submodule cmake by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/406 +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#391](https://github.com/humanoid-path-planner/hpp-fcl/pull/391)) +- Sync submodule cmake by [@jcarpent](https://github.com/jcarpent) ([#393](https://github.com/humanoid-path-planner/hpp-fcl/pull/393)) +- Topic/rpath by [@nim65s](https://github.com/nim65s) ([#394](https://github.com/humanoid-path-planner/hpp-fcl/pull/394)) +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#396](https://github.com/humanoid-path-planner/hpp-fcl/pull/396)) +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#399](https://github.com/humanoid-path-planner/hpp-fcl/pull/399)) +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#402](https://github.com/humanoid-path-planner/hpp-fcl/pull/402)) +- Sync submodule cmake by [@jcarpent](https://github.com/jcarpent) ([#406](https://github.com/humanoid-path-planner/hpp-fcl/pull/406)) ## [2.3.1] - 2023-03-25 ### What's Changed -- Remove useless call to /proc/cpuinfo by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/385 -- Add pip CI by @nim65s in https://github.com/humanoid-path-planner/hpp-fcl/pull/386 -- [GJKSolver] Fix missing switch case in result status of GJK by @lmontaut in https://github.com/humanoid-path-planner/hpp-fcl/pull/387 -- Sync submodule cmake by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/388 +- Remove useless call to /proc/cpuinfo by [@jcarpent](https://github.com/jcarpent) ([#385](https://github.com/humanoid-path-planner/hpp-fcl/pull/385)) +- Add pip CI by [@nim65s](https://github.com/nim65s) ([#386](https://github.com/humanoid-path-planner/hpp-fcl/pull/386)) +- [GJKSolver] Fix missing switch case in result status of GJK by [@lmontaut](https://github.com/lmontaut) ([#387](https://github.com/humanoid-path-planner/hpp-fcl/pull/387)) +- Sync submodule cmake by [@jcarpent](https://github.com/jcarpent) ([#388](https://github.com/humanoid-path-planner/hpp-fcl/pull/388)) ## [2.3.0] - 2023-03-17 ### What's Changed -- [CI] Remove EOL Galactic by @wxmerkt in https://github.com/humanoid-path-planner/hpp-fcl/pull/366 -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/367 -- Sync submodule cmake by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/368 -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/369 -- Adding EarlyStopped flag in GJK by @lmontaut in https://github.com/humanoid-path-planner/hpp-fcl/pull/371 -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/373 -- Update CI by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/374 -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/375 -- Skip test if BUILD_TESTING is OFF by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/378 +- [CI] Remove EOL Galactic by [@wxmerkt](https://github.com/wxmerkt) ([#366](https://github.com/humanoid-path-planner/hpp-fcl/pull/366)) +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#367](https://github.com/humanoid-path-planner/hpp-fcl/pull/367)) +- Sync submodule cmake by [@jcarpent](https://github.com/jcarpent) ([#368](https://github.com/humanoid-path-planner/hpp-fcl/pull/368)) +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#369](https://github.com/humanoid-path-planner/hpp-fcl/pull/369)) +- Adding EarlyStopped flag in GJK by [@lmontaut](https://github.com/lmontaut) ([#371](https://github.com/humanoid-path-planner/hpp-fcl/pull/371)) +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#373](https://github.com/humanoid-path-planner/hpp-fcl/pull/373)) +- Update CI by [@jcarpent](https://github.com/jcarpent) ([#374](https://github.com/humanoid-path-planner/hpp-fcl/pull/374)) +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#375](https://github.com/humanoid-path-planner/hpp-fcl/pull/375)) +- Skip test if BUILD_TESTING is OFF by [@jcarpent](https://github.com/jcarpent) ([#378](https://github.com/humanoid-path-planner/hpp-fcl/pull/378)) ## [2.2.0] - 2022-12-12 ### What's Changed -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/358 -- Extract checks if AABB overlap by @jmirabel in https://github.com/humanoid-path-planner/hpp-fcl/pull/360 -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/361 -- Sync submodule CMake by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/362 -- Add support of Pickling by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/363 +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#358](https://github.com/humanoid-path-planner/hpp-fcl/pull/358)) +- Extract checks if AABB overlap by [@jmirabel](https://github.com/jmirabel) ([#360](https://github.com/humanoid-path-planner/hpp-fcl/pull/360)) +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#361](https://github.com/humanoid-path-planner/hpp-fcl/pull/361)) +- Sync submodule CMake by [@jcarpent](https://github.com/jcarpent) ([#362](https://github.com/humanoid-path-planner/hpp-fcl/pull/362)) +- Add support of Pickling by [@jcarpent](https://github.com/jcarpent) ([#363](https://github.com/humanoid-path-planner/hpp-fcl/pull/363)) ## [2.1.4] - 2022-10-24 ### What's Changed -- Sync submodule CMake by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/352 -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/353 +- Sync submodule CMake by [@jcarpent](https://github.com/jcarpent) ([#352](https://github.com/humanoid-path-planner/hpp-fcl/pull/352)) +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#353](https://github.com/humanoid-path-planner/hpp-fcl/pull/353)) ## [2.1.3] - 2022-09-13 ### What's Changed -- Minor boost cleanup by @pantor in https://github.com/humanoid-path-planner/hpp-fcl/pull/331 -- [CI] Activate ROS2 configurations by @wxmerkt in https://github.com/humanoid-path-planner/hpp-fcl/pull/332 -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/337 -- Sync submodule cmake by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/341 -- Fix shapeIntersect when for EPA FallBack by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/342 -- Fix findAssimp on Windows by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/345 -- Sync submodule cmake by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/347 +- Minor boost cleanup by [@pantor](https://github.com/pantor) ([#331](https://github.com/humanoid-path-planner/hpp-fcl/pull/331)) +- [CI] Activate ROS2 configurations by [@wxmerkt](https://github.com/wxmerkt) ([#332](https://github.com/humanoid-path-planner/hpp-fcl/pull/332)) +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#337](https://github.com/humanoid-path-planner/hpp-fcl/pull/337)) +- Sync submodule cmake by [@jcarpent](https://github.com/jcarpent) ([#341](https://github.com/humanoid-path-planner/hpp-fcl/pull/341)) +- Fix shapeIntersect when for EPA FallBack by [@jcarpent](https://github.com/jcarpent) ([#342](https://github.com/humanoid-path-planner/hpp-fcl/pull/342)) +- Fix findAssimp on Windows by [@jcarpent](https://github.com/jcarpent) ([#345](https://github.com/humanoid-path-planner/hpp-fcl/pull/345)) +- Sync submodule cmake by [@jcarpent](https://github.com/jcarpent) ([#347](https://github.com/humanoid-path-planner/hpp-fcl/pull/347)) ### New Contributors -- @pantor made their first contribution in https://github.com/humanoid-path-planner/hpp-fcl/pull/331 +- [@pantor](https://github.com/pantor) made their first contribution ([#331](https://github.com/humanoid-path-planner/hpp-fcl/pull/331)) ## [2.1.2] - 2022-08-01 ### What's Changed -- core: add EPA::FallBack condition to shapeDistance computation by @lmontaut in https://github.com/humanoid-path-planner/hpp-fcl/pull/325 -- CMake: update to eigenpy 2.7.10 by @nim65s in https://github.com/humanoid-path-planner/hpp-fcl/pull/327 +- core: add EPA::FallBack condition to shapeDistance computation by [@lmontaut](https://github.com/lmontaut) ([#325](https://github.com/humanoid-path-planner/hpp-fcl/pull/325)) +- CMake: update to eigenpy 2.7.10 by [@nim65s](https://github.com/nim65s) ([#327](https://github.com/humanoid-path-planner/hpp-fcl/pull/327)) ## [2.1.1] - 2022-07-25 ### What's Changed -- cmake: relocatable package for recent CMake versions by @nim65s in https://github.com/humanoid-path-planner/hpp-fcl/pull/319 -- ROS2/Colcon integration by @wxmerkt in https://github.com/humanoid-path-planner/hpp-fcl/pull/321 +- cmake: relocatable package for recent CMake versions by [@nim65s](https://github.com/nim65s) ([#319](https://github.com/humanoid-path-planner/hpp-fcl/pull/319)) +- ROS2/Colcon integration by [@wxmerkt](https://github.com/wxmerkt) ([#321](https://github.com/humanoid-path-planner/hpp-fcl/pull/321)) ## [2.1.0] - 2022-07-13 ### What's Changed -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/288 -- Add enum helpers by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/290 -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/294 -- Ellipsoids in collision & distance matrices by @lmontaut in https://github.com/humanoid-path-planner/hpp-fcl/pull/295 -- doc: simplex projection in GJK class. by @lmontaut in https://github.com/humanoid-path-planner/hpp-fcl/pull/296 -- Feature: Nesterov acceleration for GJK by @lmontaut in https://github.com/humanoid-path-planner/hpp-fcl/pull/289 -- Add more testing to broadphase by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/298 -- Feature: adding convergence criterions for GJK algorithm by @lmontaut in https://github.com/humanoid-path-planner/hpp-fcl/pull/299 -- Sync submodule cmake by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/300 -- Reorder triangles when computing convex hulls by @lmontaut in https://github.com/humanoid-path-planner/hpp-fcl/pull/301 -- Exposing gjk utils by @lmontaut in https://github.com/humanoid-path-planner/hpp-fcl/pull/302 -- Fix assert precision in GJK by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/304 -- Simplify GJKSolver settings by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/305 -- Add CollisionResult::nearest_points by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/303 -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/306 -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/309 -- Fix minimal value for GJK::distance_upper_bound by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/310 -- Fix incoherent overlap by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/311 -- Expose shared_ptr by @Jiayuan-Gu in https://github.com/humanoid-path-planner/hpp-fcl/pull/314 -- test/gjk_convergence_criterion: Add check on GJK::Status by @wxmerkt in https://github.com/humanoid-path-planner/hpp-fcl/pull/315 -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/316 -- Handle negative security margin by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/312 +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#288](https://github.com/humanoid-path-planner/hpp-fcl/pull/288)) +- Add enum helpers by [@jcarpent](https://github.com/jcarpent) ([#290](https://github.com/humanoid-path-planner/hpp-fcl/pull/290)) +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#294](https://github.com/humanoid-path-planner/hpp-fcl/pull/294)) +- Ellipsoids in collision & distance matrices by [@lmontaut](https://github.com/lmontaut) ([#295](https://github.com/humanoid-path-planner/hpp-fcl/pull/295)) +- doc: simplex projection in GJK class. by [@lmontaut](https://github.com/lmontaut) ([#296](https://github.com/humanoid-path-planner/hpp-fcl/pull/296)) +- Feature: Nesterov acceleration for GJK by [@lmontaut](https://github.com/lmontaut) ([#289](https://github.com/humanoid-path-planner/hpp-fcl/pull/289)) +- Add more testing to broadphase by [@jcarpent](https://github.com/jcarpent) ([#298](https://github.com/humanoid-path-planner/hpp-fcl/pull/298)) +- Feature: adding convergence criterions for GJK algorithm by [@lmontaut](https://github.com/lmontaut) ([#299](https://github.com/humanoid-path-planner/hpp-fcl/pull/299)) +- Sync submodule cmake by [@jcarpent](https://github.com/jcarpent) ([#300](https://github.com/humanoid-path-planner/hpp-fcl/pull/300)) +- Reorder triangles when computing convex hulls by [@lmontaut](https://github.com/lmontaut) ([#301](https://github.com/humanoid-path-planner/hpp-fcl/pull/301)) +- Exposing gjk utils by [@lmontaut](https://github.com/lmontaut) ([#302](https://github.com/humanoid-path-planner/hpp-fcl/pull/302)) +- Fix assert precision in GJK by [@jcarpent](https://github.com/jcarpent) ([#304](https://github.com/humanoid-path-planner/hpp-fcl/pull/304)) +- Simplify GJKSolver settings by [@jcarpent](https://github.com/jcarpent) ([#305](https://github.com/humanoid-path-planner/hpp-fcl/pull/305)) +- Add CollisionResult::nearest_points by [@jcarpent](https://github.com/jcarpent) ([#303](https://github.com/humanoid-path-planner/hpp-fcl/pull/303)) +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#306](https://github.com/humanoid-path-planner/hpp-fcl/pull/306)) +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#309](https://github.com/humanoid-path-planner/hpp-fcl/pull/309)) +- Fix minimal value for GJK::distance_upper_bound by [@jcarpent](https://github.com/jcarpent) ([#310](https://github.com/humanoid-path-planner/hpp-fcl/pull/310)) +- Fix incoherent overlap by [@jcarpent](https://github.com/jcarpent) ([#311](https://github.com/humanoid-path-planner/hpp-fcl/pull/311)) +- Expose shared_ptr by [@Jiayuan-Gu](https://github.com/Jiayuan-Gu) ([#314](https://github.com/humanoid-path-planner/hpp-fcl/pull/314)) +- test/gjk_convergence_criterion: Add check on GJK::Status by [@wxmerkt](https://github.com/wxmerkt) ([#315](https://github.com/humanoid-path-planner/hpp-fcl/pull/315)) +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#316](https://github.com/humanoid-path-planner/hpp-fcl/pull/316)) +- Handle negative security margin by [@jcarpent](https://github.com/jcarpent) ([#312](https://github.com/humanoid-path-planner/hpp-fcl/pull/312)) ### New Contributors -- @Jiayuan-Gu made their first contribution in https://github.com/humanoid-path-planner/hpp-fcl/pull/314 +- [@Jiayuan-Gu](https://github.com/Jiayuan-Gu) made their first contribution ([#314](https://github.com/humanoid-path-planner/hpp-fcl/pull/314)) ## [2.0.1] - 2022-04-15 This PR mainly fixes packaging issues and removes compilation warnings. ### What's Changed -- Zero warnings by @wxmerkt in https://github.com/humanoid-path-planner/hpp-fcl/pull/282 -- Sync submodule cmake by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/283 -- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/humanoid-path-planner/hpp-fcl/pull/284 -- Activate python3-pylatexenc dependency by @wxmerkt in https://github.com/humanoid-path-planner/hpp-fcl/pull/286 -- Comment pylatexenc again since it's not available on the buildfarm by @wxmerkt in https://github.com/humanoid-path-planner/hpp-fcl/pull/287 +- Zero warnings by [@wxmerkt](https://github.com/wxmerkt) ([#282](https://github.com/humanoid-path-planner/hpp-fcl/pull/282)) +- Sync submodule cmake by [@jcarpent](https://github.com/jcarpent) ([#283](https://github.com/humanoid-path-planner/hpp-fcl/pull/283)) +- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci](https://github.com/pre-commit-ci) ([#284](https://github.com/humanoid-path-planner/hpp-fcl/pull/284)) +- Activate python3-pylatexenc dependency by [@wxmerkt](https://github.com/wxmerkt) ([#286](https://github.com/humanoid-path-planner/hpp-fcl/pull/286)) +- Comment pylatexenc again since it's not available on the buildfarm by [@wxmerkt](https://github.com/wxmerkt) ([#287](https://github.com/humanoid-path-planner/hpp-fcl/pull/287)) ### New Contributors -- @pre-commit-ci made their first contribution in https://github.com/humanoid-path-planner/hpp-fcl/pull/284 +- [@pre-commit-ci](https://github.com/pre-commit-ci) made their first contribution ([#284](https://github.com/humanoid-path-planner/hpp-fcl/pull/284)) ## [2.0.0] - 2022-04-06 This new release reintroduces the full support of Broad phase within hpp-fcl while also enforcing C++11 as minimal standard. ### What's Changed -- Add Ellipsoid by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/259 -- Removing comment about inflation. by @lmontaut in https://github.com/humanoid-path-planner/hpp-fcl/pull/261 -- Reintroduce broadphase by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/260 -- Simplify CollisionObject by removing cgeom_const by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/263 -- Address some warnings by @wxmerkt in https://github.com/humanoid-path-planner/hpp-fcl/pull/262 -- Fix missing copy of aabb_local in CollisionGeometry by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/264 -- use std::shared_ptr, fix #218 by @nim65s in https://github.com/humanoid-path-planner/hpp-fcl/pull/266 -- Fix broadphase warnings for clang (some conversion remain for g++) by @wxmerkt in https://github.com/humanoid-path-planner/hpp-fcl/pull/268 -- [ComputeCollision] Return no collision if security_margin is set to -inf by @florent-lamiraux in https://github.com/humanoid-path-planner/hpp-fcl/pull/271 -- tests: remove link to boost unit test framework by @nim65s in https://github.com/humanoid-path-planner/hpp-fcl/pull/270 -- Fix computation of aabb_center by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/273 -- Add operator== and operator!= to CollisionGeometry by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/274 -- Merge pull request #276 from humanoid-path-planner/patch-release-1.8.1 by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/277 -- Fix some missing features in base classes by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/275 -- Add operator{==,!=} to CollisionObject by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/278 -- Configure and apply pre-commit by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/280 -- Fix DistanceCallBackBaseWrapper by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/281 +- Add Ellipsoid by [@jcarpent](https://github.com/jcarpent) ([#259](https://github.com/humanoid-path-planner/hpp-fcl/pull/259)) +- Removing comment about inflation. by [@lmontaut](https://github.com/lmontaut) ([#261](https://github.com/humanoid-path-planner/hpp-fcl/pull/261)) +- Reintroduce broadphase by [@jcarpent](https://github.com/jcarpent) ([#260](https://github.com/humanoid-path-planner/hpp-fcl/pull/260)) +- Simplify CollisionObject by removing cgeom_const by [@jcarpent](https://github.com/jcarpent) ([#263](https://github.com/humanoid-path-planner/hpp-fcl/pull/263)) +- Address some warnings by [@wxmerkt](https://github.com/wxmerkt) ([#262](https://github.com/humanoid-path-planner/hpp-fcl/pull/262)) +- Fix missing copy of aabb_local in CollisionGeometry by [@jcarpent](https://github.com/jcarpent) ([#264](https://github.com/humanoid-path-planner/hpp-fcl/pull/264)) +- use std::shared_ptr, fix #218 by [@nim65s](https://github.com/nim65s) ([#266](https://github.com/humanoid-path-planner/hpp-fcl/pull/266)) +- Fix broadphase warnings for clang (some conversion remain for g++) by [@wxmerkt](https://github.com/wxmerkt) ([#268](https://github.com/humanoid-path-planner/hpp-fcl/pull/268)) +- [ComputeCollision] Return no collision if security_margin is set to -inf by [@florent-lamiraux](https://github.com/florent-lamiraux) ([#271](https://github.com/humanoid-path-planner/hpp-fcl/pull/271)) +- tests: remove link to boost unit test framework by [@nim65s](https://github.com/nim65s) ([#270](https://github.com/humanoid-path-planner/hpp-fcl/pull/270)) +- Fix computation of aabb_center by [@jcarpent](https://github.com/jcarpent) ([#273](https://github.com/humanoid-path-planner/hpp-fcl/pull/273)) +- Add operator== and operator!= to CollisionGeometry by [@jcarpent](https://github.com/jcarpent) ([#274](https://github.com/humanoid-path-planner/hpp-fcl/pull/274)) +- Merge pull request #276 from humanoid-path-planner/patch-release-1.8.1 by [@jcarpent](https://github.com/jcarpent) ([#277](https://github.com/humanoid-path-planner/hpp-fcl/pull/277)) +- Fix some missing features in base classes by [@jcarpent](https://github.com/jcarpent) ([#275](https://github.com/humanoid-path-planner/hpp-fcl/pull/275)) +- Add operator{==,!=} to CollisionObject by [@jcarpent](https://github.com/jcarpent) ([#278](https://github.com/humanoid-path-planner/hpp-fcl/pull/278)) +- Configure and apply pre-commit by [@jcarpent](https://github.com/jcarpent) ([#280](https://github.com/humanoid-path-planner/hpp-fcl/pull/280)) +- Fix DistanceCallBackBaseWrapper by [@jcarpent](https://github.com/jcarpent) ([#281](https://github.com/humanoid-path-planner/hpp-fcl/pull/281)) ### New Contributors -- @lmontaut made their first contribution in https://github.com/humanoid-path-planner/hpp-fcl/pull/261 +- [@lmontaut](https://github.com/lmontaut) made their first contribution ([#261](https://github.com/humanoid-path-planner/hpp-fcl/pull/261)) ## [1.8.1] - 2022-03-20 ### What's Changed -- Preparing for ROS1 and ROS2 release by @wxmerkt in https://github.com/humanoid-path-planner/hpp-fcl/pull/255 -- Patch release 1.8.1 by @wxmerkt in https://github.com/humanoid-path-planner/hpp-fcl/pull/276 +- Preparing for ROS1 and ROS2 release by [@wxmerkt](https://github.com/wxmerkt) ([#255](https://github.com/humanoid-path-planner/hpp-fcl/pull/255)) +- Patch release 1.8.1 by [@wxmerkt](https://github.com/wxmerkt) ([#276](https://github.com/humanoid-path-planner/hpp-fcl/pull/276)) ## [1.8.0] - 2022-02-08 ### What's Changed -- [CMake] Qhull is a private dependency by @nim65s in https://github.com/humanoid-path-planner/hpp-fcl/pull/247 -- Remove useless warnings by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/248 -- fix submodule url by @nim65s in https://github.com/humanoid-path-planner/hpp-fcl/pull/246 -- Remove warnings and add missing noalias by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/249 -- Function makeOctree returns a shared pointer by @florent-lamiraux in https://github.com/humanoid-path-planner/hpp-fcl/pull/254 -- Add support of HeightField by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/251 -- [OcTree] Add method to save octree in obj file. by @florent-lamiraux in https://github.com/humanoid-path-planner/hpp-fcl/pull/256 -- Fix C++98 compatibility by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/258 +- [CMake] Qhull is a private dependency by [@nim65s](https://github.com/nim65s) ([#247](https://github.com/humanoid-path-planner/hpp-fcl/pull/247)) +- Remove useless warnings by [@jcarpent](https://github.com/jcarpent) ([#248](https://github.com/humanoid-path-planner/hpp-fcl/pull/248)) +- fix submodule url by [@nim65s](https://github.com/nim65s) ([#246](https://github.com/humanoid-path-planner/hpp-fcl/pull/246)) +- Remove warnings and add missing noalias by [@jcarpent](https://github.com/jcarpent) ([#249](https://github.com/humanoid-path-planner/hpp-fcl/pull/249)) +- Function makeOctree returns a shared pointer by [@florent-lamiraux](https://github.com/florent-lamiraux) ([#254](https://github.com/humanoid-path-planner/hpp-fcl/pull/254)) +- Add support of HeightField by [@jcarpent](https://github.com/jcarpent) ([#251](https://github.com/humanoid-path-planner/hpp-fcl/pull/251)) +- [OcTree] Add method to save octree in obj file. by [@florent-lamiraux](https://github.com/florent-lamiraux) ([#256](https://github.com/humanoid-path-planner/hpp-fcl/pull/256)) +- Fix C++98 compatibility by [@jcarpent](https://github.com/jcarpent) ([#258](https://github.com/humanoid-path-planner/hpp-fcl/pull/258)) ## [1.7.8] - 2021-10-30 ### What's Changed -- Fix conversion by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/242 -- Fix exposition of vertices by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/243 -- Enhance Convex exposition by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/244 -- Sync submodule cmake by @jcarpent in https://github.com/humanoid-path-planner/hpp-fcl/pull/245 +- Fix conversion by [@jcarpent](https://github.com/jcarpent) ([#242](https://github.com/humanoid-path-planner/hpp-fcl/pull/242)) +- Fix exposition of vertices by [@jcarpent](https://github.com/jcarpent) ([#243](https://github.com/humanoid-path-planner/hpp-fcl/pull/243)) +- Enhance Convex exposition by [@jcarpent](https://github.com/jcarpent) ([#244](https://github.com/humanoid-path-planner/hpp-fcl/pull/244)) +- Sync submodule cmake by [@jcarpent](https://github.com/jcarpent) ([#245](https://github.com/humanoid-path-planner/hpp-fcl/pull/245)) ## [1.7.7] - 2021-09-13 @@ -366,7 +387,7 @@ This new release comes with: This new Release improves the Python bindings and fixes an important bug when checking the collision between two Capsules. -Thanks to @rstrudel for this fix. +Thanks to [@rstrudel](https://github.com/rstrudel) for this fix. ## [1.2.1] - 2019-12-09 @@ -433,7 +454,11 @@ Now Eigen is at the heart of linear algebra computations. First release -[Unreleased]: https://github.com/humanoid-path-planner/hpp-fcl/compare/v2.4.0...HEAD +[Unreleased]: https://github.com/humanoid-path-planner/hpp-fcl/compare/v2.4.4...HEAD +[2.4.4]: https://github.com/humanoid-path-planner/hpp-fcl/compare/v2.4.3...v2.4.4 +[2.4.3]: https://github.com/humanoid-path-planner/hpp-fcl/compare/v2.4.2...v2.4.3 +[2.4.2]: https://github.com/humanoid-path-planner/hpp-fcl/compare/v2.4.1...v2.4.2 +[2.4.1]: https://github.com/humanoid-path-planner/hpp-fcl/compare/v2.4.0...v2.4.1 [2.4.0]: https://github.com/humanoid-path-planner/hpp-fcl/compare/v2.3.7...v2.4.0 [2.3.7]: https://github.com/humanoid-path-planner/hpp-fcl/compare/2.3.6...v2.3.7 [2.3.6]: https://github.com/humanoid-path-planner/hpp-fcl/compare/v2.3.5...v2.3.6 diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a1c88c..1576892 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,9 +114,9 @@ endif() SET_BOOST_DEFAULT_OPTIONS() EXPORT_BOOST_DEFAULT_OPTIONS() IF(WIN32) - ADD_PROJECT_DEPENDENCY(Boost REQUIRED COMPONENTS chrono thread date_time serialization) + ADD_PROJECT_DEPENDENCY(Boost REQUIRED COMPONENTS chrono thread date_time serialization filesystem) ELSE(WIN32) - ADD_PROJECT_DEPENDENCY(Boost REQUIRED chrono serialization) + ADD_PROJECT_DEPENDENCY(Boost REQUIRED chrono serialization filesystem) ENDIF(WIN32) if(BUILD_PYTHON_INTERFACE) find_package(Boost REQUIRED COMPONENTS system) diff --git a/cmake/.github/workflows/cmake.yml b/cmake/.github/workflows/cmake.yml index 96eb728..4eb5118 100644 --- a/cmake/.github/workflows/cmake.yml +++ b/cmake/.github/workflows/cmake.yml @@ -8,7 +8,7 @@ jobs: runs-on: [ubuntu-22.04] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: Run project tests run: | diff --git a/cmake/.pre-commit-config.yaml b/cmake/.pre-commit-config.yaml index 3db8053..f6f0ca2 100644 --- a/cmake/.pre-commit-config.yaml +++ b/cmake/.pre-commit-config.yaml @@ -5,7 +5,7 @@ repos: - id: check-useless-excludes - id: check-hooks-apply - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v17.0.5 + rev: v17.0.6 hooks: - id: clang-format args: [--style=Google] @@ -25,7 +25,7 @@ repos: - id: mixed-line-ending - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 23.11.0 + rev: 24.2.0 hooks: - id: black exclude: | @@ -33,7 +33,7 @@ repos: .cmake-format.py )$ - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 7.0.0 hooks: - id: flake8 exclude: | diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt new file mode 100644 index 0000000..27f4a69 --- /dev/null +++ b/cmake/CMakeLists.txt @@ -0,0 +1,125 @@ +cmake_minimum_required(VERSION 3.10) + +set(PROJECT_NAME "jrl-cmakemodules") +set(PROJECT_DESCRIPTION "CMake utility toolbox") +set(PROJECT_URL "http://github.com/jrl-umi3218/${PROJECT_NAME}") + +project( + ${PROJECT_NAME} + DESCRIPTION ${PROJECT_DESCRIPTION} + LANGUAGES CXX + VERSION 0.0.0) + +# Generate CMake exports +include(GNUInstallDirs) +include(package-config.cmake) +set(PROJECT_JRL_CMAKE_MODULE_DIR ${CMAKE_CURRENT_LIST_DIR}) +setup_project_package_finalize() + +# Add a dummy library with a useful INTERFACE_INCLUDE_DIRECTORIES +add_library(${PROJECT_NAME} INTERFACE) +set(INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}") +target_include_directories(${PROJECT_NAME} + INTERFACE $) + +# find . -maxdepth 1 -type d ! -path './.*' | sort +install( + DIRECTORY ./boost + ./cython + ./doxygen + ./dynamic_graph + ./find-external + ./github + ./gtest + ./hpp + ./image + ./sphinx + ./stubgen + ./_unittests + DESTINATION ${INSTALL_DIR}) + +# find . -maxdepth 1 -type f ! -path './.*' | sort +install( + FILES ./announce-gen + ./apple.cmake + ./base.cmake + ./boost.cmake + ./catkin.cmake + ./CMakeLists.txt + ./cmake_reinstall.cmake.in + ./cmake_uninstall.cmake.in + ./compiler.cmake + ./componentConfig.cmake.in + ./Config.cmake.in + ./config.h.cmake + ./config.hh.cmake + ./coverage.cmake + ./cpack.cmake + ./createshexe.cmake + ./cxx11.cmake + ./cxx-standard.cmake + ./debian.cmake + ./deprecated.hh.cmake + ./distcheck.cmake + ./dist.cmake + ./doxygen.cmake + ./eigen.cmake + ./filefilter.txt + ./fix-license.sh + ./geometric-tools.cmake + ./git-archive-all.py + ./git-archive-all.sh + ./gitlog-to-changelog + ./GNUInstallDirs.cmake + ./gtest.cmake + ./header.cmake + ./hpp.cmake + ./ide.cmake + ./idl.cmake + ./idlrtc.cmake + ./install-data.cmake + ./julia.cmake + ./kineo.cmake + ./lapack.cmake + ./LICENSE + ./logging.cmake + ./man.cmake + ./memorycheck_unit_test.cmake.in + ./metapodfromurdf.cmake + ./modernize-links.cmake + ./msvc-specific.cmake + ./msvc.vcxproj.user.in + ./openhrp.cmake + ./openhrpcontroller.cmake + ./openrtm.cmake + ./oscheck.cmake + ./package-config.cmake + ./pkg-config.cmake + ./pkg-config.pc.cmake + ./portability.cmake + ./post-project.cmake + ./pthread.cmake + ./pyproject.py + ./python.cmake + ./python-helpers.cmake + ./qhull.cmake + ./README.md + ./release.cmake + ./relpath.cmake + ./ros.cmake + ./sdformat.cmake + ./setup.cfg + ./shared-library.cmake + ./sphinx.cmake + ./stubs.cmake + ./swig.cmake + ./test.cmake + ./uninstall.cmake + ./version.cmake + ./version-script.cmake + ./version-script-test.lds + ./warning.hh.cmake + ./xacro.cmake + DESTINATION ${INSTALL_DIR}) + +install(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME}) diff --git a/cmake/_unittests/catkin/CMakeLists.txt b/cmake/_unittests/catkin/CMakeLists.txt new file mode 100644 index 0000000..5edb11c --- /dev/null +++ b/cmake/_unittests/catkin/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.10) + +set(PROJECT_NAME jrl-cmakemodules-catkin) +set(PROJECT_VERSION 0.0.0) +set(PROJECT_DESCRIPTION "JRL CMake module - catkin") +set(PROJECT_URL http://jrl-cmakemodules.readthedocs.io) + +include(../../base.cmake) + +project(${PROJECT_NAME} LANGUAGES CXX) + +# This project test the correct behavior of #622 +# +# * If .catkin is already here when the project is configured it is not removed +# * Otherwise it is assumed it is created by the project and removed with the +# uninstall target + +option(FORCE_DOT_CATKIN_CREATION + "Force creation of .catkin file in install destination" OFF) + +if(FORCE_DOT_CATKIN_CREATION) + install( + CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_INSTALL_PREFIX}/.catkin)" + ) +endif() diff --git a/cmake/_unittests/cpp/CMakeLists.txt b/cmake/_unittests/cpp/CMakeLists.txt index 12a540a..40cd1e4 100644 --- a/cmake/_unittests/cpp/CMakeLists.txt +++ b/cmake/_unittests/cpp/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2) +cmake_minimum_required(VERSION 3.10) set(PROJECT_NAME jrl-cmakemodules-cpp) set(PROJECT_VERSION 0.0.0) diff --git a/cmake/_unittests/dependency/CMakeLists.txt b/cmake/_unittests/dependency/CMakeLists.txt index 9c0e0e6..35f7f79 100644 --- a/cmake/_unittests/dependency/CMakeLists.txt +++ b/cmake/_unittests/dependency/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2) +cmake_minimum_required(VERSION 3.10) set(PROJECT_NAME jrl-cmakemodules-dependency) set(PROJECT_VERSION 0.0.0) diff --git a/cmake/_unittests/python/CMakeLists.txt b/cmake/_unittests/python/CMakeLists.txt index 1d04e1d..97631c3 100644 --- a/cmake/_unittests/python/CMakeLists.txt +++ b/cmake/_unittests/python/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.10) # These variables have to be defined before running SETUP_PROJECT set(PROJECT_NAME jrl-cmakemodules-python) diff --git a/cmake/_unittests/run_unit_tests.sh b/cmake/_unittests/run_unit_tests.sh index a66cb48..a062b1b 100755 --- a/cmake/_unittests/run_unit_tests.sh +++ b/cmake/_unittests/run_unit_tests.sh @@ -1,6 +1,9 @@ #!/bin/bash -unittests="python cpp dependency" +set -e +set -x + +unittests="python cpp dependency catkin" # Code for running a specific unit test # For unit test foo, function `run_foo` is executed if defined. @@ -23,6 +26,33 @@ function run_cpp() run_default $here/cpp } +function run_catkin() +{ + $CMAKE_BIN ${cmake_options} -DFORCE_DOT_CATKIN_CREATION=ON "${here}/catkin" + make install + if [[ ! -f ${here}/install/.catkin ]]; then + echo ".catkin file should have been created" + exit 1 + fi + make uninstall + if [[ -f ${here}/install/.catkin ]]; then + echo ".catkin file should have been removed" + exit 1 + fi + cd ${here}/build/ + rm -rf ${here}/build/catkin/ + mkdir -p ${here}/build/catkin/ + cd catkin + touch ${here}/install/.catkin + $CMAKE_BIN ${cmake_options} -DFORCE_DOT_CATKIN_CREATION=OFF "${here}/catkin" + make install + make uninstall + if [[ ! -f ${here}/install/.catkin ]]; then + echo ".catkin file should NOT have been removed" + exit 1 + fi +} + # The code below run all the unit tests here="`pwd`" rm -rf build install diff --git a/cmake/cmake_reinstall.cmake.in b/cmake/cmake_reinstall.cmake.in index 3b98bef..3ebdedb 100644 --- a/cmake/cmake_reinstall.cmake.in +++ b/cmake/cmake_reinstall.cmake.in @@ -13,6 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . if(EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") - execute_process(COMMAND "@CMAKE_COMMAND@" --build "@PROJECT_BINARY_DIR@" --target uninstall --config $) + execute_process(COMMAND ${CMAKE_COMMAND} --build "@PROJECT_BINARY_DIR@" --target uninstall --config $) endif() -execute_process(COMMAND "@CMAKE_COMMAND@" --build "@PROJECT_BINARY_DIR@" --target install --config $) +execute_process(COMMAND ${CMAKE_COMMAND} --build "@PROJECT_BINARY_DIR@" --target install --config $) diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in index 1dd0999..48f6be2 100644 --- a/cmake/cmake_uninstall.cmake.in +++ b/cmake/cmake_uninstall.cmake.in @@ -19,15 +19,15 @@ IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") MESSAGE(STATUS "catkin path: @CMAKE_INSTALL_PREFIX@/.catkin") -IF(EXISTS "@CMAKE_INSTALL_PREFIX@/.catkin") +IF(EXISTS "@CMAKE_INSTALL_PREFIX@/.catkin" AND PACKAGE_CREATES_DOT_CATKIN) MESSAGE(STATUS "Try to remove @CMAKE_INSTALL_PREFIX@/.catkin") EXECUTE_PROCESS( - COMMAND @CMAKE_COMMAND@ -E remove "@CMAKE_INSTALL_PREFIX@/.catkin" + COMMAND ${CMAKE_COMMAND} -E remove "@CMAKE_INSTALL_PREFIX@/.catkin" RESULT_VARIABLE rm_resval OUTPUT_VARIABLE rm_out ERROR_VARIABLE rm_err ) -ENDIF(EXISTS "@CMAKE_INSTALL_PREFIX@/.catkin") +ENDIF() IF(EXISTS "@CMAKE_CURRRENT_BINARY_DIR@/install_manifest.txt") return() @@ -40,7 +40,7 @@ FOREACH(file ${files}) MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") IF(EXISTS "$ENV{DESTDIR}${file}") EXECUTE_PROCESS( - COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}" + COMMAND ${CMAKE_COMMAND} -E remove "$ENV{DESTDIR}${file}" RESULT_VARIABLE rm_resval OUTPUT_VARIABLE rm_out ) @@ -54,7 +54,7 @@ FOREACH(file ${files}) IF(EXISTS "$ENV{DESTDIR}${pycfile}") MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${pycfile}\"") EXECUTE_PROCESS( - COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${pycfile}" + COMMAND ${CMAKE_COMMAND} -E remove "$ENV{DESTDIR}${pycfile}" RESULT_VARIABLE rm_resval OUTPUT_VARIABLE rm_out ) @@ -70,7 +70,7 @@ FOREACH(file ${files}) # If file is a broken symbolic link, EXISTS returns false. # Workaround this bug by attempting to remove the file anyway. EXECUTE_PROCESS( - COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}" + COMMAND ${CMAKE_COMMAND} -E remove "$ENV{DESTDIR}${file}" RESULT_VARIABLE rm_resval OUTPUT_VARIABLE rm_out ERROR_QUIET @@ -78,7 +78,7 @@ FOREACH(file ${files}) ENDIF(EXISTS "$ENV{DESTDIR}${file}") ENDFOREACH(file) EXECUTE_PROCESS( - COMMAND "@CMAKE_COMMAND@" -E remove "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" + COMMAND ${CMAKE_COMMAND} -E remove "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" RESULT_VARIABLE rm_resval OUTPUT_VARIABLE rm_out ERROR_QUIET diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index fcd428e..48c349f 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -19,51 +19,140 @@ macro(_SETUP_PROJECT_WARNINGS) # -Wmissing-declarations is disabled for now as older GCC version does not # support it but CMake doest not check for the flag acceptance correctly. - if(UNIX) - set(FLAGS - -pedantic - -Wno-long-long - -Wall - -Wextra - -Wcast-align - -Wcast-qual - -Wformat - -Wwrite-strings - -Wconversion) - foreach(FLAG ${FLAGS}) - check_cxx_compiler_flag(${FLAG} R${FLAG}) - if(${R${FLAG}}) - set(WARNING_CXX_FLAGS "${WARNING_CXX_FLAGS} ${FLAG}") - endif(${R${FLAG}}) - endforeach(FLAG ${FLAGS}) - - if(NOT DEFINED CXX_DISABLE_WERROR) - set(WARNING_CXX_FLAGS "-Werror ${WARNING_CXX_FLAGS}") - endif(NOT DEFINED CXX_DISABLE_WERROR) - endif(UNIX) + set(GNU_FLAGS + -pedantic + -Wno-long-long + -Wall + -Wextra + -Wcast-align + -Wcast-qual + -Wformat + -Wwrite-strings + -Wconversion) + if(NOT DEFINED CXX_DISABLE_WERROR) + list(APPEND GNU_FLAGS -Werror) + endif(NOT DEFINED CXX_DISABLE_WERROR) # For win32 systems, it is impossible to use Wall, especially with boost, # which is way too verbose The default levels (W3/W4) are enough The next # macro remove warnings on deprecations due to stl. - if(MSVC) - set(WARNING_CXX_FLAGS "-D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS") - set(WARNING_CXX_FLAGS "${WARNING_CXX_FLAGS} -D_CRT_SECURE_NO_DEPRECATE") - # -- The following warnings are removed to highlight the output C4101 The - # local variable is never used removed since happens frequently in headers. - set(WARNING_CXX_FLAGS "${WARNING_CXX_FLAGS} /wd4101") - # C4250 'class1' : inherits 'class2::member' via dominance - set(WARNING_CXX_FLAGS "${WARNING_CXX_FLAGS} /wd4250") - # C4251 class 'type' needs to have dll-interface to be used by clients of - # class 'type2' ~ in practice, raised by the classes that have non-dll - # attribute (such as std::vector) - set(WARNING_CXX_FLAGS "${WARNING_CXX_FLAGS} /wd4251") - # C4275 non - DLL-interface used as base for DLL-interface - set(WARNING_CXX_FLAGS "${WARNING_CXX_FLAGS} /wd4275") - # C4355 "this" used in base member initializer list - set(WARNING_CXX_FLAGS "${WARNING_CXX_FLAGS} /wd4355") - endif() + set(MSVC_FLAGS + -D_SCL_SECURE_NO_WARNINGS + -D_CRT_SECURE_NO_WARNINGS + -D_CRT_SECURE_NO_DEPRECATE + # -- The following warnings are removed to highlight the output C4101 The + # local variable is never used removed since happens frequently in + # headers. + /wd4101 + # C4250 'class1' : inherits 'class2::member' via dominance + /wd4250 + # C4251 class 'type' needs to have dll-interface to be used by clients of + # class 'type2' ~ in practice, raised by the classes that have non-dll + # attribute (such as std::vector) + /wd4251 + # C4275 non - DLL-interface used as base for DLL-interface + /wd4275 + # C4355 "this" used in base member initializer list + /wd4355) + + cxx_flags_by_compiler_frontend( + GNU + ${GNU_FLAGS} + MSVC + ${MSVC_FLAGS} + OUTPUT + WARNING_CXX_FLAGS_LIST + FILTER) + string(REPLACE ";" " " WARNING_CXX_FLAGS "${WARNING_CXX_FLAGS_LIST}") set(CMAKE_CXX_FLAGS "${WARNING_CXX_FLAGS} ${CMAKE_CXX_FLAGS}") list(APPEND LOGGING_WATCHED_VARIABLES WARNING_CXX_FLAGS) endmacro(_SETUP_PROJECT_WARNINGS) + +#[=======================================================================[.rst: +.. command:: CXX_FLAGS_BY_COMPILER_FRONTEND(...]> + ...]> + OUTPUT flags + ) + +Detect the compiler frontend (the command line interface) and output the +corresponding ``CXX_FLAGS``. + +The following arguments allow to specify ``CXX_FLAGS`` for a compiler +frontend: + +:param GNU: List of flags for GNU compiler frontend (Gcc, G++) +:param MSVC: List of flags for MSVC compiler frontend (MSVC, ClangCl) + +Detected compiler frontend flags are then outputed in the ``OUTPUT`` +parameter. + +Optional ``FILTER`` parameter filter outputed flags with check_cxx_compiler_flag. + +.. warning:: When ``FILTER`` option is activated, definition should by passed with +-D prefix to be valid compiler parameter. + +Example +^^^^^^^ + +.. code-block:: cmake + CXX_FLAGS_BY_COMPILER_FRONTEND( + GNU -Wno-conversion -Wno-comment -Wno-self-assign-overloaded + MSVC "/bigobj" + OUTPUT COMPLIE_OPTIONS + FILTER) +#]=======================================================================] + +function(CXX_FLAGS_BY_COMPILER_FRONTEND) + set(options FILTER) + set(oneValueArgs OUTPUT) + set(multiValueArgs GNU MSVC) + cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" + ${ARGN}) + + # Before CMake 3.14, the CMAKE_CXX_COMPILER_FRONTEND_VARIANT doesn't exists. + # Before CMake 3.26, when CMAKE_CXX_COMPILER_ID is set to GNU, MSVC or + # AppleClang, CMAKE_CXX_COMPILER_FRONTEND_VARIANT doesn't exists either + if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT) + if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU") + set(FLAGS ${ARGS_GNU}) + elseif(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC") + set(FLAGS ${ARGS_MSVC}) + else() + message( + WARNING "Unknown compiler frontend for '${CMAKE_CXX_COMPILER_ID}' " + "with frontend '${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}'\n" + "No flags outputed") + endif() + else() + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_SIMULATE_ID MATCHES + "MSVC") + set(FLAGS ${ARGS_MSVC}) + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set(FLAGS ${ARGS_MSVC}) + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") + set(FLAGS ${ARGS_GNU}) + else() + message( + WARNING "Unknown compiler frontend for '${CMAKE_CXX_COMPILER_ID}' " + "with simulated ID '${CMAKE_CXX_SIMULATED_ID}'\n" + "No flags outputed") + endif() + endif() + + if(ARGS_FILTER) + foreach(FLAG ${FLAGS}) + check_cxx_compiler_flag(${FLAG} res_${FLAG}) + if(${res_${FLAG}}) + list(APPEND FILTERED_FLAGS ${FLAG}) + endif() + endforeach() + else() + set(FILTERED_FLAGS ${FLAGS}) + endif() + + set(${ARGS_OUTPUT} + ${FILTERED_FLAGS} + PARENT_SCOPE) +endfunction() diff --git a/cmake/config.hh.cmake b/cmake/config.hh.cmake index 0af547f..d3b4a36 100644 --- a/cmake/config.hh.cmake +++ b/cmake/config.hh.cmake @@ -31,37 +31,63 @@ // // On Linux, set the visibility accordingly. If C++ symbol visibility // is handled by the compiler, see: http://gcc.gnu.org/wiki/Visibility +// +// Explicit template instantiation on Windows need to add +// dllexport on the definition and dllimport on the declaration. +// The XXX_EXPLICIT_INSTANTIATION_DECLARATION_DLLAPI macro +// should be set on the declaration while +// the XXX_EXPLICIT_INSTANTIATION_DEFINITION_DLLAPI macro +// should be set on the definition. # if defined _WIN32 || defined __CYGWIN__ // On Microsoft Windows, use dllimport and dllexport to tag symbols. # define @LIBRARY_NAME@_DLLIMPORT __declspec(dllimport) # define @LIBRARY_NAME@_DLLEXPORT __declspec(dllexport) # define @LIBRARY_NAME@_DLLLOCAL +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DECLARATION_DLLIMPORT __declspec(dllimport) +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DECLARATION_DLLEXPORT +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DEFINITION_DLLIMPORT __declspec(dllimport) +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DEFINITION_DLLEXPORT __declspec(dllexport) # else // On Linux, for GCC >= 4, tag symbols using GCC extension. # if __GNUC__ >= 4 # define @LIBRARY_NAME@_DLLIMPORT __attribute__ ((visibility("default"))) # define @LIBRARY_NAME@_DLLEXPORT __attribute__ ((visibility("default"))) # define @LIBRARY_NAME@_DLLLOCAL __attribute__ ((visibility("hidden"))) +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DECLARATION_DLLIMPORT __attribute__ ((visibility("default"))) +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DECLARATION_DLLEXPORT __attribute__ ((visibility("default"))) +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DEFINITION_DLLIMPORT +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DEFINITION_DLLEXPORT # else // Otherwise (GCC < 4 or another compiler is used), export everything. # define @LIBRARY_NAME@_DLLIMPORT # define @LIBRARY_NAME@_DLLEXPORT # define @LIBRARY_NAME@_DLLLOCAL +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DECLARATION_DLLIMPORT +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DECLARATION_DLLEXPORT +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DEFINITION_DLLIMPORT +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DEFINITION_DLLEXPORT # endif // __GNUC__ >= 4 # endif // defined _WIN32 || defined __CYGWIN__ # ifdef @LIBRARY_NAME@_STATIC // If one is using the library statically, get rid of -// extra information. +// extra information and use standard explicit template +// instantiation keyword. # define @LIBRARY_NAME@_DLLAPI # define @LIBRARY_NAME@_LOCAL +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DECLARATION extern template # else // Depending on whether one is building or using the -// library define DLLAPI to import or export. +// library define DLLAPI to import or export and +// define the right explicit template instantiation keyword. # ifdef @EXPORT_SYMBOL@ # define @LIBRARY_NAME@_DLLAPI @LIBRARY_NAME@_DLLEXPORT +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DECLARATION_DLLAPI @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DECLARATION_DLLEXPORT +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DEFINITION_DLLAPI @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DEFINITION_DLLEXPORT # else # define @LIBRARY_NAME@_DLLAPI @LIBRARY_NAME@_DLLIMPORT +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DECLARATION_DLLAPI @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DECLARATION_DLLIMPORT +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DEFINITION_DLLAPI @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DEFINITION_DLLIMPORT # endif // @LIBRARY_NAME@_EXPORTS # define @LIBRARY_NAME@_LOCAL @LIBRARY_NAME@_DLLLOCAL # endif // @LIBRARY_NAME@_STATIC diff --git a/cmake/doxygen.cmake b/cmake/doxygen.cmake index caaccd0..7c7e1cf 100644 --- a/cmake/doxygen.cmake +++ b/cmake/doxygen.cmake @@ -614,6 +614,21 @@ macro(_SETUP_PROJECT_DOCUMENTATION) endif(NOT DOXYGEN_FOUND) endmacro(_SETUP_PROJECT_DOCUMENTATION) +# REMOVE_DUPLICATES +# ----------------- +# +# Remove duplicate values from a space separated list +function(REMOVE_DUPLICATES ARG_STR OUTPUT) + set(ARG_LIST ${ARG_STR}) + separate_arguments(ARG_LIST) + list(REMOVE_DUPLICATES ARG_LIST) + string(REGEX REPLACE "([^\\]|^);" "\\1 " _TMP_STR "${ARG_LIST}") + string(REGEX REPLACE "[\\](.)" "\\1" _TMP_STR "${_TMP_STR}") # fixes escaping + set(${OUTPUT} + "${_TMP_STR}" + PARENT_SCOPE) +endfunction() + # _DOXYTAG_ENTRIES_FROM_CMAKE_DEPENDENCIES # ---------------------------------------- # @@ -687,14 +702,17 @@ macro(_SETUP_PROJECT_DOCUMENTATION_FINALIZE) file(RELATIVE_PATH DEP_DOCDIR ${INSTALL_DOCDIR} ${${PREFIX}_DOXYGENDOCDIR}) - set(DOXYGEN_TAGFILES_FROM_DEPENDENCIES - "${DOXYGEN_TAGFILES_FROM_DEPENDENCIES} \"${${PREFIX}_DOXYGENDOCDIR}/${LIBRARY_NAME}.doxytag\"=\"${DEP_DOCDIR}\"" + set(_TAGFILES_FROM_DEPENDENCIES + "${_TAGFILES_FROM_DEPENDENCIES} \"${${PREFIX}_DOXYGENDOCDIR}/${LIBRARY_NAME}.doxytag = ${DEP_DOCDIR}\"" ) endif() endforeach() _doxytag_entries_from_cmake_dependencies( - "${_PACKAGE_CONFIG_DEPENDENCIES_PROJECTS}" - DOXYGEN_TAGFILES_FROM_DEPENDENCIES) + "${_PACKAGE_CONFIG_DEPENDENCIES_PROJECTS}" _TAGFILES_FROM_DEPENDENCIES) + if(_TAGFILES_FROM_DEPENDENCIES) + remove_duplicates(${_TAGFILES_FROM_DEPENDENCIES} + DOXYGEN_TAGFILES_FROM_DEPENDENCIES) + endif() endif() _set_if_undefined(DOXYGEN_TAGFILES "${DOXYGEN_TAGFILES_FROM_DEPENDENCIES}") diff --git a/cmake/find-external/Accelerate/FindAccelerate.cmake b/cmake/find-external/Accelerate/FindAccelerate.cmake new file mode 100644 index 0000000..341ce83 --- /dev/null +++ b/cmake/find-external/Accelerate/FindAccelerate.cmake @@ -0,0 +1,35 @@ +if(Accelerate_INCLUDES AND Accelerate_LIBRARIES) + set(Accelerate_FIND_QUIETLY TRUE) +endif() + +find_path( + Accelerate_INCLUDES + NAMES Accelerate.h + PATHS $ENV{ACCELERATEDIR}) + +find_library(Accelerate_LIBRARIES Accelerate PATHS $ENV{ACCELERATEDIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Accelerate DEFAULT_MSG Accelerate_INCLUDES + Accelerate_LIBRARIES) + +if(Accelerate_FOUND) + get_filename_component(Accelerate_PARENTDIR ${Accelerate_INCLUDES} DIRECTORY) + + file(GLOB_RECURSE SparseHeader ${Accelerate_PARENTDIR}/Sparse.h) + + if("${SparseHeader}" STREQUAL "") + message(STATUS "Accelerate sparse matrix support was not found.") + set(Accelerate_FOUND FALSE) + endif() +endif() + +if(Accelerate_FOUND) + add_library(Accelerate SHARED IMPORTED) + set_target_properties( + Accelerate + PROPERTIES IMPORTED_LOCATION "${Accelerate_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${Accelerate_INCLUDES}") +endif(Accelerate_FOUND) + +mark_as_advanced(Accelerate_INCLUDES Accelerate_LIBRARIES) diff --git a/cmake/find-external/CDD/FindCDD.cmake b/cmake/find-external/CDD/FindCDD.cmake index 157f1e2..688720f 100644 --- a/cmake/find-external/CDD/FindCDD.cmake +++ b/cmake/find-external/CDD/FindCDD.cmake @@ -38,3 +38,16 @@ set(CDD_INCLUDE_DIRS ${CDD_INCLUDE_DIR}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(CDD DEFAULT_MSG CDD_LIBRARY CDD_INCLUDE_DIR) mark_as_advanced(CDD_INCLUDE_DIR CDD_LIBRARY) + +if(CDD_FOUND AND NOT TARGET CDD::CDD) + add_library(CDD::CDD SHARED IMPORTED) + set_target_properties(CDD::CDD PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${CDD_INCLUDE_DIR}") + set_target_properties(CDD::CDD PROPERTIES IMPORTED_LOCATION_RELEASE + "${CDD_LIBRARY}") + set_property( + TARGET CDD::CDD + APPEND + PROPERTY IMPORTED_CONFIGURATIONS "RELEASE") + message(STATUS "CDD found (include: ${CDD_INCLUDE_DIR}, lib: ${CDD_LIBRARY})") +endif() diff --git a/cmake/find-external/CHOLMOD/findCHOLMOD.cmake b/cmake/find-external/CHOLMOD/findCHOLMOD.cmake new file mode 100644 index 0000000..3b2140e --- /dev/null +++ b/cmake/find-external/CHOLMOD/findCHOLMOD.cmake @@ -0,0 +1,114 @@ +# This file has been imported from Eigen. See +# https://gitlab.com/libeigen/eigen/-/blob/master/cmake/FindCHOLMOD.cmake It has +# been then adapted by Justin Carpentier to comply +# with the API of the JRL CMake module. + +# CHOLMOD lib usually requires linking to a blas and lapack library. It is up to +# the user of this module to find a BLAS and link to it. + +if(CHOLMOD_INCLUDES AND CHOLMOD_LIBRARIES) + set(CHOLMOD_FIND_QUIETLY TRUE) +endif() + +find_path( + CHOLMOD_INCLUDES + NAMES cholmod.h + PATHS $ENV{CHOLMODDIR} ${INCLUDE_INSTALL_DIR} + PATH_SUFFIXES suitesparse ufsparse) + +find_library(CHOLMOD_LIBRARIES cholmod PATHS $ENV{CHOLMODDIR} + ${LIB_INSTALL_DIR}) + +if(CHOLMOD_LIBRARIES) + + get_filename_component(CHOLMOD_LIBDIR ${CHOLMOD_LIBRARIES} PATH) + + find_library(AMD_LIBRARY amd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} + ${LIB_INSTALL_DIR}) + if(AMD_LIBRARY) + list(APPEND CHOLMOD_DEPENDENCIES ${AMD_LIBRARY}) + else() + set(CHOLMOD_LIBRARIES FALSE) + endif() + +endif() + +if(CHOLMOD_LIBRARIES) + + find_library(COLAMD_LIBRARY colamd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} + ${LIB_INSTALL_DIR}) + if(COLAMD_LIBRARY) + list(APPEND CHOLMOD_DEPENDENCIES ${COLAMD_LIBRARY}) + else() + set(CHOLMOD_LIBRARIES FALSE) + endif() + +endif() + +if(CHOLMOD_LIBRARIES) + + find_library(CAMD_LIBRARY camd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} + ${LIB_INSTALL_DIR}) + if(CAMD_LIBRARY) + list(APPEND CHOLMOD_DEPENDENCIES ${CAMD_LIBRARY}) + else() + set(CHOLMOD_LIBRARIES FALSE) + endif() + +endif() + +if(CHOLMOD_LIBRARIES) + + find_library(CCOLAMD_LIBRARY ccolamd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} + ${LIB_INSTALL_DIR}) + if(CCOLAMD_LIBRARY) + list(APPEND CHOLMOD_DEPENDENCIES ${CCOLAMD_LIBRARY}) + else() + set(CHOLMOD_LIBRARIES FALSE) + endif() + +endif() + +if(CHOLMOD_LIBRARIES) + + find_library(CHOLMOD_METIS_LIBRARY metis + PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR}) + if(CHOLMOD_METIS_LIBRARY) + list(APPEND CHOLMOD_DEPENDENCIES ${CHOLMOD_METIS_LIBRARY}) + endif() + +endif() + +if(CHOLMOD_LIBRARIES) + + find_library(SUITESPARSE_LIBRARY SuiteSparse + PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR}) + if(SUITESPARSE_LIBRARY) + list(APPEND CHOLMOD_DEPENDENCIES ${SUITESPARSE_LIBRARY}) + endif() + +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(CHOLMOD DEFAULT_MSG CHOLMOD_INCLUDES + CHOLMOD_LIBRARIES CHOLMOD_DEPENDENCIES) + +if(CHOLMOD_LIBRARIES) + add_library(CHOLMOD::CHOLMOD SHARED IMPORTED) + set_target_properties( + CHOLMOD::CHOLMOD + PROPERTIES IMPORTED_LOCATION "${CHOLMOD_LIBRARIES}" + INTERFACE_LINK_LIBRARIES "${CHOLMOD_DEPENDENCIES}" + INTERFACE_INCLUDE_DIRECTORIES "${CHOLMOD_INCLUDES}") +endif(CHOLMOD_LIBRARIES) + +mark_as_advanced( + CHOLMOD_INCLUDES + CHOLMOD_LIBRARIES + CHOLMOD_DEPENDENCIES + AMD_LIBRARY + COLAMD_LIBRARY + SUITESPARSE_LIBRARY + CAMD_LIBRARY + CCOLAMD_LIBRARY + CHOLMOD_METIS_LIBRARY) diff --git a/cmake/find-external/CLP/FindCLP.cmake b/cmake/find-external/CLP/FindCLP.cmake index 6c37a6f..02d5f1a 100644 --- a/cmake/find-external/CLP/FindCLP.cmake +++ b/cmake/find-external/CLP/FindCLP.cmake @@ -37,3 +37,16 @@ set(CLP_INCLUDE_DIRS ${CLP_INCLUDE_DIR}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(CLP DEFAULT_MSG CLP_LIBRARY CLP_INCLUDE_DIR) mark_as_advanced(CLP_INCLUDE_DIR CLP_LIBRARY) + +if(CLP_FOUND AND NOT TARGET CLP::CLP) + add_library(CLP::CLP SHARED IMPORTED) + set_target_properties(CLP::CLP PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${CLP_INCLUDE_DIR}") + set_target_properties(CLP::CLP PROPERTIES IMPORTED_LOCATION_RELEASE + "${CLP_LIBRARY}") + set_property( + TARGET CLP::CLP + APPEND + PROPERTY IMPORTED_CONFIGURATIONS "RELEASE") + message(STATUS "CLP found (include: ${CLP_INCLUDE_DIR}, lib: ${CLP_LIBRARY})") +endif() diff --git a/cmake/find-external/CoinUtils/FindCoinUtils.cmake b/cmake/find-external/CoinUtils/FindCoinUtils.cmake new file mode 100644 index 0000000..37fdf0a --- /dev/null +++ b/cmake/find-external/CoinUtils/FindCoinUtils.cmake @@ -0,0 +1,59 @@ +# +# Copyright 2023 CNRS +# +# Author: Guilhem Saurel +# +# This program is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public License along +# with this program. If not, see . +# + +# Try to find CoinUtils in standard prefixes and in ${CoinUtils_PREFIX} Once +# done this will define CoinUtils_FOUND - System has CoinUtils +# CoinUtils_INCLUDE_DIRS - The CoinUtils include directories CoinUtils_LIBRARIES +# - The libraries needed to use CoinUtils CoinUtils::CoinUtils - A target to use +# for relocatable packages + +find_path( + CoinUtils_INCLUDE_DIR + NAMES coin/CoinBuild.hpp + PATHS ${CoinUtils_PREFIX}) +find_library( + CoinUtils_LIBRARY + NAMES libCoinUtils.so + PATHS ${CoinUtils_PREFIX}) + +set(CoinUtils_LIBRARIES ${CoinUtils_LIBRARY}) +set(CoinUtils_INCLUDE_DIRS ${CoinUtils_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(CoinUtils DEFAULT_MSG CoinUtils_LIBRARY + CoinUtils_INCLUDE_DIR) +mark_as_advanced(CoinUtils_INCLUDE_DIR CoinUtils_LIBRARY) + +if(CoinUtils_FOUND AND NOT TARGET CoinUtils::CoinUtils) + add_library(CoinUtils::CoinUtils SHARED IMPORTED) + set_target_properties( + CoinUtils::CoinUtils PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${CoinUtils_INCLUDE_DIR}") + set_target_properties( + CoinUtils::CoinUtils PROPERTIES IMPORTED_LOCATION_RELEASE + "${CoinUtils_LIBRARY}") + set_property( + TARGET CoinUtils::CoinUtils + APPEND + PROPERTY IMPORTED_CONFIGURATIONS "RELEASE") + message( + STATUS + "CoinUtils found (include: ${CoinUtils_INCLUDE_DIR}, lib: ${CoinUtils_LIBRARY})" + ) +endif() diff --git a/cmake/find-external/TinyXML/FindTinyXML2.cmake b/cmake/find-external/TinyXML/FindTinyXML2.cmake new file mode 100644 index 0000000..341b118 --- /dev/null +++ b/cmake/find-external/TinyXML/FindTinyXML2.cmake @@ -0,0 +1,94 @@ +# Imported from +# https://github.com/ros/urdfdom/blob/master/cmake/FindTinyXML2.cmake, +# BSD-3-Clause + +# TinyXML2_FOUND TinyXML2_INCLUDE_DIRS TinyXML2_LIBRARIES + +# try to find the CMake config file for TinyXML2 first +if(NOT TinyXML2_FOUND) + find_package(TinyXML2 CONFIG QUIET) +endif() +if(TinyXML2_FOUND) + message(STATUS "Found TinyXML2 via Config file: ${TinyXML2_DIR}") + if(NOT TINYXML2_LIBRARY) + # in this case, we're probably using TinyXML2 version 5.0.0 or greater in + # which case tinyxml2 is an exported target and we should use that + if(TARGET tinyxml2) + set(TINYXML2_LIBRARY tinyxml2) + elseif(TARGET tinyxml2::tinyxml2) + set(TINYXML2_LIBRARY tinyxml2::tinyxml2) + elseif(TinyXML2_FIND_REQUIRED) + message(FATAL_ERROR "Unable to determine target for TinyXML2") + endif() + list(APPEND TinyXML2_TARGETS ${TINYXML2_LIBRARY}) + else() + # Only perform that logic once + if(NOT TARGET tinyxml2::tinyxml2) + # TINYXML2_LIBRARY is composed of + # debug;;optimized; we have to + # extract the appropriate component based on the current configuration. + list(LENGTH TINYXML2_LIBRARY TINYXML_LIBRARY_LIST_LENGTH) + if(NOT ${TINYXML_LIBRARY_LIST_LENGTH} EQUAL 4) + message( + FATAL_ERROR + "Unable to extract the library file path from ${TINYXML2_LIBRARY}") + endif() + if(CMAKE_BUILD_TYPE MATCHES DEBUG) + list(GET TINYXML2_LIBRARY 0 ASSERT_DEBUG) + if(NOT ${ASSERT_DEBUG} STREQUAL "debug") + message( + FATAL_ERROR + "could not parse debug library path from ${TINYXML2_LIBRARY}") + endif() + list(GET TINYXML2_LIBRARY 1 TINYXML2_LIBRARY_PATH) + else() + list(GET TINYXML2_LIBRARY 2 ASSERT_OPTIMIZED) + if(NOT ${ASSERT_OPTIMIZED} STREQUAL "optimized") + message( + FATAL_ERROR "could not parse library path from ${TINYXML2_LIBRARY}") + endif() + list(GET TINYXML2_LIBRARY 3 TINYXML2_LIBRARY_PATH) + endif() + if(NOT EXISTS ${TINYXML2_LIBRARY_PATH}) + message( + FATAL_ERROR + "library file path ${TINYXML2_LIBRARY_PATH} does not exist") + endif() + + add_library(tinyxml2::tinyxml2 UNKNOWN IMPORTED) + set_property(TARGET tinyxml2::tinyxml2 PROPERTY IMPORTED_LOCATION + ${TINYXML2_LIBRARY_PATH}) + set_property( + TARGET tinyxml2::tinyxml2 PROPERTY INTERFACE_INCLUDE_DIRECTORIES + ${TINYXML2_INCLUDE_DIR}) + list(APPEND TinyXML2_TARGETS tinyxml2::tinyxml2) + endif() + endif() +else() + find_path(TINYXML2_INCLUDE_DIR NAMES tinyxml2.h) + + find_library(TINYXML2_LIBRARY tinyxml2) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(TinyXML2 DEFAULT_MSG TINYXML2_LIBRARY + TINYXML2_INCLUDE_DIR) + + mark_as_advanced(TINYXML2_INCLUDE_DIR TINYXML2_LIBRARY) + + if(NOT TARGET tinyxml2::tinyxml2) + add_library(tinyxml2::tinyxml2 UNKNOWN IMPORTED) + set_property(TARGET tinyxml2::tinyxml2 PROPERTY IMPORTED_LOCATION + ${TINYXML2_LIBRARY}) + set_property(TARGET tinyxml2::tinyxml2 + PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${TINYXML2_INCLUDE_DIR}) + list(APPEND TinyXML2_TARGETS tinyxml2::tinyxml2) + endif() +endif() + +# Set mixed case INCLUDE_DIRS and LIBRARY variables from upper case ones. +if(NOT TinyXML2_INCLUDE_DIRS) + set(TinyXML2_INCLUDE_DIRS ${TINYXML2_INCLUDE_DIR}) +endif() +if(NOT TinyXML2_LIBRARIES) + set(TinyXML2_LIBRARIES ${TINYXML2_LIBRARY}) +endif() diff --git a/cmake/find-external/assimp/Findassimp.cmake b/cmake/find-external/assimp/Findassimp.cmake index 7cef6ad..99b834c 100644 --- a/cmake/find-external/assimp/Findassimp.cmake +++ b/cmake/find-external/assimp/Findassimp.cmake @@ -1,99 +1,125 @@ -if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(ASSIMP_ARCHITECTURE "64") -elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) - set(ASSIMP_ARCHITECTURE "32") -endif(CMAKE_SIZEOF_VOID_P EQUAL 8) - -if(WIN32) - set(ASSIMP_ROOT_DIR CACHE PATH "ASSIMP root directory") - - # Find path of each library - find_path( - ASSIMP_INCLUDE_DIR - NAMES assimp/anim.h - HINTS ${ASSIMP_ROOT_DIR}/include) - set(assimp_INCLUDE_DIRS ${ASSIMP_INCLUDE_DIR}) - - if(MSVC12) - set(ASSIMP_MSVC_VERSIONS "vc120") - elseif(MSVC14) - set(ASSIMP_MSVC_VERSIONS "vc140;vc141") - endif(MSVC12) - - if(MSVC12 OR MSVC14) - - foreach(ASSIMP_MSVC_VERSION ${ASSIMP_MSVC_VERSIONS}) - find_path( - ASSIMP_LIBRARY_DIR - NAMES assimp-${ASSIMP_MSVC_VERSION}-mt.lib - assimp-${ASSIMP_MSVC_VERSION}-mtd.lib - HINTS ${ASSIMP_ROOT_DIR}/lib${ASSIMP_ARCHITECTURE}) - - find_library(ASSIMP_LIBRARY_RELEASE assimp-${ASSIMP_MSVC_VERSION}-mt.lib - PATHS ${ASSIMP_LIBRARY_DIR}) - find_library(ASSIMP_LIBRARY_DEBUG assimp-${ASSIMP_MSVC_VERSION}-mtd.lib - PATHS ${ASSIMP_LIBRARY_DIR}) - - if(NOT ASSIMP_LIBRARY_RELEASE AND NOT ASSIMP_LIBRARY_DEBUG) - continue() - endif() - - if(ASSIMP_LIBRARY_DEBUG) - set(ASSIMP_LIBRARY optimized ${ASSIMP_LIBRARY_RELEASE} debug - ${ASSIMP_LIBRARY_DEBUG}) - else() - set(ASSIMP_LIBRARY optimized ${ASSIMP_LIBRARY_RELEASE}) - endif() - - set(ASSIMP_LIBRARIES ${ASSIMP_LIBRARY_RELEASE} ${ASSIMP_LIBRARY_DEBUG}) - - function(ASSIMP_COPY_BINARIES TargetDirectory) - add_custom_target( - AssimpCopyBinaries - COMMAND - ${CMAKE_COMMAND} -E copy - ${ASSIMP_ROOT_DIR}/bin${ASSIMP_ARCHITECTURE}/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll - ${TargetDirectory}/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll - COMMAND - ${CMAKE_COMMAND} -E copy - ${ASSIMP_ROOT_DIR}/bin${ASSIMP_ARCHITECTURE}/assimp-${ASSIMP_MSVC_VERSION}-mt.dll - ${TargetDirectory}/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.dll - COMMENT "Copying Assimp binaries to '${TargetDirectory}'" - VERBATIM) - endfunction(ASSIMP_COPY_BINARIES) - - set(assimp_LIBRARIES ${ASSIMP_LIBRARY}) - endforeach() +# Try to use AssimConfig if it exists +find_package(assimp NO_MODULE QUIET) + +if(assimp_FOUND) + # On Ubuntu 20.04, the Assimp finder is broken - INTERFACE_LINK_LIBRARIES is + # not defined - INTERFACE_INCLUDE_DIRECTORIES is set to a wrong path + # ASSIMP_INCLUDE_DIRS and IMPORTED_LOCATION_RELEASE are well computed, so we + # can redefine some target properties with them + get_target_property(_ASSIMP_INC_DIR assimp::assimp + INTERFACE_INCLUDE_DIRECTORIES) + set(_ASSIMP_TARGET_OK TRUE) + foreach(v ${_ASSIMP_INC_DIR}) + if(NOT EXISTS ${v}) + set(_ASSIMP_TARGET_OK FALSE) + endif() + endforeach() + if(NOT _ASSIMP_TARGET_OK) + get_target_property(_ASSIMP_IMP_LOC_RELEASE assimp::assimp + IMPORTED_LOCATION_RELEASE) + set_target_properties( + assimp::assimp + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${ASSIMP_INCLUDE_DIRS}" + IMPORTED_LOCATION "${_ASSIMP_IMP_LOC_RELEASE}") endif() - -else(WIN32) - - find_path( - assimp_INCLUDE_DIRS - NAMES assimp/postprocess.h assimp/scene.h assimp/version.h assimp/config.h - assimp/cimport.h - PATHS /usr/local/include - PATHS /usr/include/) - - find_library( - assimp_LIBRARIES - NAMES assimp - PATHS /usr/local/lib/ - PATHS /usr/lib64/ - PATHS /usr/lib/) - - if(assimp_INCLUDE_DIRS AND assimp_LIBRARIES) - set(assimp_FOUND TRUE) - endif(assimp_INCLUDE_DIRS AND assimp_LIBRARIES) - - if(assimp_FOUND) - if(NOT assimp_FIND_QUIETLY) - message(STATUS "Found asset importer library: ${assimp_LIBRARIES}") - endif(NOT assimp_FIND_QUIETLY) - else(assimp_FOUND) - if(assimp_FIND_REQUIRED) - message(FATAL_ERROR "Could not find asset importer library") - endif(assimp_FIND_REQUIRED) - endif(assimp_FOUND) - -endif(WIN32) +else() + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(ASSIMP_ARCHITECTURE "64") + elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(ASSIMP_ARCHITECTURE "32") + endif(CMAKE_SIZEOF_VOID_P EQUAL 8) + + if(WIN32) + set(ASSIMP_ROOT_DIR CACHE PATH "ASSIMP root directory") + + # Find path of each library + find_path( + ASSIMP_INCLUDE_DIR + NAMES assimp/anim.h + HINTS ${ASSIMP_ROOT_DIR}/include) + set(assimp_INCLUDE_DIRS ${ASSIMP_INCLUDE_DIR}) + + if(MSVC12) + set(ASSIMP_MSVC_VERSIONS "vc120") + elseif(MSVC14) + set(ASSIMP_MSVC_VERSIONS "vc140;vc141") + endif(MSVC12) + + if(MSVC12 OR MSVC14) + + foreach(ASSIMP_MSVC_VERSION ${ASSIMP_MSVC_VERSIONS}) + find_path( + ASSIMP_LIBRARY_DIR + NAMES assimp-${ASSIMP_MSVC_VERSION}-mt.lib + assimp-${ASSIMP_MSVC_VERSION}-mtd.lib + HINTS ${ASSIMP_ROOT_DIR}/lib${ASSIMP_ARCHITECTURE}) + + find_library(ASSIMP_LIBRARY_RELEASE assimp-${ASSIMP_MSVC_VERSION}-mt.lib + PATHS ${ASSIMP_LIBRARY_DIR}) + find_library(ASSIMP_LIBRARY_DEBUG assimp-${ASSIMP_MSVC_VERSION}-mtd.lib + PATHS ${ASSIMP_LIBRARY_DIR}) + + if(NOT ASSIMP_LIBRARY_RELEASE AND NOT ASSIMP_LIBRARY_DEBUG) + continue() + endif() + + if(ASSIMP_LIBRARY_DEBUG) + set(ASSIMP_LIBRARY optimized ${ASSIMP_LIBRARY_RELEASE} debug + ${ASSIMP_LIBRARY_DEBUG}) + else() + set(ASSIMP_LIBRARY optimized ${ASSIMP_LIBRARY_RELEASE}) + endif() + + set(ASSIMP_LIBRARIES ${ASSIMP_LIBRARY_RELEASE} ${ASSIMP_LIBRARY_DEBUG}) + + function(ASSIMP_COPY_BINARIES TargetDirectory) + add_custom_target( + AssimpCopyBinaries + COMMAND + ${CMAKE_COMMAND} -E copy + ${ASSIMP_ROOT_DIR}/bin${ASSIMP_ARCHITECTURE}/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll + ${TargetDirectory}/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll + COMMAND + ${CMAKE_COMMAND} -E copy + ${ASSIMP_ROOT_DIR}/bin${ASSIMP_ARCHITECTURE}/assimp-${ASSIMP_MSVC_VERSION}-mt.dll + ${TargetDirectory}/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.dll + COMMENT "Copying Assimp binaries to '${TargetDirectory}'" + VERBATIM) + endfunction(ASSIMP_COPY_BINARIES) + + set(assimp_LIBRARIES ${ASSIMP_LIBRARY}) + endforeach() + endif() + + else(WIN32) + + find_path( + assimp_INCLUDE_DIRS + NAMES assimp/postprocess.h assimp/scene.h assimp/version.h assimp/config.h + assimp/cimport.h + PATHS /usr/local/include + PATHS /usr/include/) + + find_library( + assimp_LIBRARIES + NAMES assimp + PATHS /usr/local/lib/ + PATHS /usr/lib64/ + PATHS /usr/lib/) + + if(assimp_INCLUDE_DIRS AND assimp_LIBRARIES) + set(assimp_FOUND TRUE) + endif(assimp_INCLUDE_DIRS AND assimp_LIBRARIES) + + if(assimp_FOUND) + if(NOT assimp_FIND_QUIETLY) + message(STATUS "Found asset importer library: ${assimp_LIBRARIES}") + endif(NOT assimp_FIND_QUIETLY) + else(assimp_FOUND) + if(assimp_FIND_REQUIRED) + message(FATAL_ERROR "Could not find asset importer library") + endif(assimp_FIND_REQUIRED) + endif(assimp_FOUND) + + endif(WIN32) +endif() diff --git a/cmake/find-external/glpk/Findglpk.cmake b/cmake/find-external/glpk/Findglpk.cmake index d37202e..4a79342 100644 --- a/cmake/find-external/glpk/Findglpk.cmake +++ b/cmake/find-external/glpk/Findglpk.cmake @@ -39,3 +39,17 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args(glpk DEFAULT_MSG glpk_LIBRARY glpk_INCLUDE_DIR) mark_as_advanced(glpk_INCLUDE_DIR glpk_LIBRARY) + +if(glpk_FOUND AND NOT TARGET glpk::glpk) + add_library(glpk::glpk SHARED IMPORTED) + set_target_properties(glpk::glpk PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${glpk_INCLUDE_DIR}") + set_target_properties(glpk::glpk PROPERTIES IMPORTED_LOCATION_RELEASE + "${glpk_LIBRARY}") + set_property( + TARGET glpk::glpk + APPEND + PROPERTY IMPORTED_CONFIGURATIONS "RELEASE") + message( + STATUS "glpk found (include: ${glpk_INCLUDE_DIR}, lib: ${glpk_LIBRARY})") +endif() diff --git a/cmake/find-external/qpOASES/FindqpOASES.cmake b/cmake/find-external/qpOASES/FindqpOASES.cmake index e05edef..9afa615 100644 --- a/cmake/find-external/qpOASES/FindqpOASES.cmake +++ b/cmake/find-external/qpOASES/FindqpOASES.cmake @@ -38,3 +38,22 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args(qpOASES DEFAULT_MSG qpOASES_LIBRARY qpOASES_INCLUDE_DIR) mark_as_advanced(qpOASES_INCLUDE_DIR qpOASES_LIBRARY) + +if(qpOASES_FOUND AND NOT TARGET qpOASES::qpOASES) + add_library(qpOASES::qpOASES SHARED IMPORTED) + set_target_properties( + qpOASES::qpOASES PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${qpOASES_INCLUDE_DIR}") + set_target_properties(qpOASES::qpOASES PROPERTIES IMPORTED_LOCATION_RELEASE + "${qpOASES_LIBRARY}") + set_property( + TARGET qpOASES::qpOASES + APPEND + PROPERTY IMPORTED_CONFIGURATIONS "RELEASE") + set_target_properties(qpOASES::qpOASES + PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX") + message( + STATUS + "qpOASES found (include: ${qpOASES_INCLUDE_DIR}, lib: ${qpOASES_LIBRARY})" + ) +endif() diff --git a/cmake/git-archive-all.sh b/cmake/git-archive-all.sh index 5d50033..06d3f7a 100755 --- a/cmake/git-archive-all.sh +++ b/cmake/git-archive-all.sh @@ -187,12 +187,23 @@ superfile=`head -n 1 $TMPFILE` if [ $VERBOSE -eq 1 ]; then echo -n "looking for subprojects..." fi -# find all '.git' dirs, these show us the remaining to-be-archived dirs -# we only want directories that are below the current directory -find . -mindepth 2 -name '.git' -type d -print | sed -e 's/^\.\///' -e 's/\.git$//' >> $TOARCHIVE -# as of version 1.7.8, git places the submodule .git directories under the superprojects .git dir -# the submodules get a .git file that points to their .git dir. we need to find all of these too -find . -mindepth 2 -name '.git' -type f -print | xargs grep -l "gitdir" | sed -e 's/^\.\///' -e 's/\.git$//' >> $TOARCHIVE + +# Find all submodules +# git submodule status --recursive can have the following output: +# ``` +# sha1 module_path git_describe +# -sha1 module_path git_describe +# +sha1 module_path git_describe +# Usha1 module_path git_describe +# ``` +# We remove the first space to standardize the output and we +# remove uninitialized submodules (since git archive will not work on them) +git submodule status --recursive | \ + sed 's/^ //' | \ + sed '/^-/d' | \ + cut -d" " -f2 | \ + xargs -I{} echo {}/ >> $TOARCHIVE + if [ $VERBOSE -eq 1 ]; then echo "done" echo " found:" diff --git a/cmake/gtest/CMakeLists.txt.in b/cmake/gtest/CMakeLists.txt.in index 2d7e05c..f1eacc2 100644 --- a/cmake/gtest/CMakeLists.txt.in +++ b/cmake/gtest/CMakeLists.txt.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.10) project(gtest NONE) diff --git a/cmake/ide.cmake b/cmake/ide.cmake index 76e757e..e1f4dc1 100644 --- a/cmake/ide.cmake +++ b/cmake/ide.cmake @@ -45,9 +45,9 @@ function(ADD_GROUP GROUP_NAME FILENAMES) foreach(filename ${${FILENAMES}}) get_filename_component(filenamePath ${filename} PATH) get_filename_component(filenameName ${filename} NAME) - string(REGEX REPLACE "${PROJECT_BINARY_DIR}" "" filenamePath + string(REGEX REPLACE "${PROJECT_BINARY_DIR}/" "" filenamePath "${filenamePath}/") - string(REGEX REPLACE "${PROJECT_SOURCE_DIR}" "" filenamePath + string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/" "" filenamePath "${filenamePath}/") string(REGEX REPLACE "//" "/" filenamePath ${filenamePath}) list(APPEND REDUCED_FILENAMES ${filenamePath}) diff --git a/cmake/pkg-config.cmake b/cmake/pkg-config.cmake index 327288d..b039789 100644 --- a/cmake/pkg-config.cmake +++ b/cmake/pkg-config.cmake @@ -824,7 +824,6 @@ macro(PKG_CONFIG_APPEND_LIBS LIBS) if(TARGET ${LIB}) get_target_property(TARGET_TYPE ${LIB} TYPE) - message(STATUS "target_type: ${TARGET_TYPE}") # CMake 3.16 until 3.19 do not properly handle the properties for # INTERFACE. if(${TARGET_TYPE} STREQUAL "INTERFACE_LIBRARY") diff --git a/cmake/python.cmake b/cmake/python.cmake index baaabd4..99d8fff 100644 --- a/cmake/python.cmake +++ b/cmake/python.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2021 LAAS-CNRS, JRL AIST-CNRS, INRIA. +# Copyright (C) 2008-2024 LAAS-CNRS, JRL AIST-CNRS, INRIA. # # This program is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software @@ -529,4 +529,29 @@ macro(FIND_NUMPY) endif() endmacro() +# .rst: .. command:: FIND_SCIPY() +# +# Detect scipy module. +# +macro(FIND_SCIPY) + message(STATUS "Checking for SciPy") + execute_process( + COMMAND "${PYTHON_EXECUTABLE}" "-c" "import scipy; print (True)" + OUTPUT_VARIABLE IS_SCIPY + ERROR_QUIET) + + if(NOT IS_SCIPY) + message(FATAL_ERROR "Failed to detect scipy") + else() + # Retrive SCIPY_VERSION + execute_process( + COMMAND "${PYTHON_EXECUTABLE}" "-c" + "import scipy; print (scipy.__version__)" + OUTPUT_VARIABLE SCIPY_VERSION + ERROR_QUIET) + string(REGEX REPLACE "\n$" "" SCIPY_VERSION "${SCIPY_VERSION}") + message(STATUS " SCIPY_VERSION=${SCIPY_VERSION}") + endif() +endmacro() + include(${CMAKE_CURRENT_LIST_DIR}/python-helpers.cmake) diff --git a/cmake/stubgen/CMakeLists.txt.in b/cmake/stubgen/CMakeLists.txt.in index 93aee2e..aa963d4 100644 --- a/cmake/stubgen/CMakeLists.txt.in +++ b/cmake/stubgen/CMakeLists.txt.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.10) project(stubgen NONE) diff --git a/cmake/test.cmake b/cmake/test.cmake index 8a1055d..a4a9ae4 100644 --- a/cmake/test.cmake +++ b/cmake/test.cmake @@ -98,7 +98,7 @@ macro(ADD_UNIT_TEST NAME) add_dependencies(build_tests ${NAME}) - add_test(${NAME} ${RUNTIME_OUTPUT_DIRECTORY}/${NAME}) + add_test(NAME ${NAME} COMMAND ${NAME}) # Support definition of DYLD_LIBRARY_PATH for OSX systems if(APPLE) set_tests_properties( diff --git a/cmake/uninstall.cmake b/cmake/uninstall.cmake index 4bd9895..5a60ec0 100644 --- a/cmake/uninstall.cmake +++ b/cmake/uninstall.cmake @@ -19,18 +19,38 @@ # Add custom rule to uninstall the package. # macro(_SETUP_PROJECT_UNINSTALL) + # Detect if the .catkin was created previously + if(NOT DEFINED PACKAGE_CREATES_DOT_CATKIN + OR NOT "${PACKAGE_PREVIOUS_INSTALL_PREFIX}" STREQUAL + "${CMAKE_INSTALL_PREFIX}") + set(PACKAGE_PREVIOUS_INSTALL_PREFIX + "${CMAKE_INSTALL_PREFIX}" + CACHE INTERNAL "Cache install prefix given to the package") + if(EXISTS "${CMAKE_INSTALL_PREFIX}/.catkin") + set(PACKAGE_CREATES_DOT_CATKIN + FALSE + CACHE INTERNAL "") + else() + set(PACKAGE_CREATES_DOT_CATKIN + TRUE + CACHE INTERNAL "") + endif() + endif() # FIXME: it is utterly stupid to rely on the install manifest. Can't we just # remember what we install ?! configure_file( "${CMAKE_CURRENT_LIST_DIR}/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake" IMMEDIATE @ONLY) + "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake" @ONLY) add_custom_target( - uninstall "${CMAKE_COMMAND}" -P - "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake") + uninstall + "${CMAKE_COMMAND}" + -DPACKAGE_CREATES_DOT_CATKIN=${PACKAGE_CREATES_DOT_CATKIN} -P + "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake") - configure_file("${CMAKE_CURRENT_LIST_DIR}/cmake_reinstall.cmake.in" - "${PROJECT_BINARY_DIR}/cmake/cmake_reinstall.cmake.configured") + configure_file( + "${CMAKE_CURRENT_LIST_DIR}/cmake_reinstall.cmake.in" + "${PROJECT_BINARY_DIR}/cmake/cmake_reinstall.cmake.configured" @ONLY) if(DEFINED CMAKE_BUILD_TYPE) file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/cmake/${CMAKE_BUILD_TYPE}") else(DEFINED CMAKE_BUILD_TYPE) diff --git a/doc/images/hpp-fcl-vs-the-rest-of-the-world.pdf b/doc/images/hpp-fcl-vs-the-rest-of-the-world.pdf new file mode 100644 index 0000000..9830714 Binary files /dev/null and b/doc/images/hpp-fcl-vs-the-rest-of-the-world.pdf differ diff --git a/doc/mesh-mesh-collision-call.pdf b/doc/mesh-mesh-collision-call.pdf new file mode 100644 index 0000000..3c338d0 Binary files /dev/null and b/doc/mesh-mesh-collision-call.pdf differ diff --git a/doc/shape-mesh-collision-call.pdf b/doc/shape-mesh-collision-call.pdf new file mode 100644 index 0000000..39c820f Binary files /dev/null and b/doc/shape-mesh-collision-call.pdf differ diff --git a/doc/shape-shape-collision-call.pdf b/doc/shape-shape-collision-call.pdf new file mode 100644 index 0000000..9bfceda Binary files /dev/null and b/doc/shape-shape-collision-call.pdf differ diff --git a/include/hpp/fcl/broadphase/default_broadphase_callbacks.h b/include/hpp/fcl/broadphase/default_broadphase_callbacks.h index c34a871..bf240fd 100644 --- a/include/hpp/fcl/broadphase/default_broadphase_callbacks.h +++ b/include/hpp/fcl/broadphase/default_broadphase_callbacks.h @@ -64,6 +64,12 @@ struct CollisionData { /// @brief Whether the collision iteration can stop bool done; + + /// @brief Clears the CollisionData + void clear() { + result.clear(); + done = false; + } }; /// @brief Distance data stores the distance request and the result given by @@ -79,6 +85,12 @@ struct DistanceData { /// @brief Whether the distance iteration can stop bool done; + + /// @brief Clears the DistanceData + void clear() { + result.clear(); + done = false; + } }; /// @brief Provides a simple callback for the collision query in the @@ -183,6 +195,10 @@ bool defaultDistanceFunction(CollisionObject* o1, CollisionObject* o2, /// @brief Default collision callback to check collision between collision /// objects. struct HPP_FCL_DLLAPI CollisionCallBackDefault : CollisionCallBackBase { + /// @brief Initialize the callback. + /// Clears the collision result and sets the done boolean to false. + void init() { data.clear(); } + bool collide(CollisionObject* o1, CollisionObject* o2); CollisionData data; @@ -193,6 +209,10 @@ struct HPP_FCL_DLLAPI CollisionCallBackDefault : CollisionCallBackBase { /// @brief Default distance callback to check collision between collision /// objects. struct HPP_FCL_DLLAPI DistanceCallBackDefault : DistanceCallBackBase { + /// @brief Initialize the callback. + /// Clears the distance result and sets the done boolean to false. + void init() { data.clear(); } + bool distance(CollisionObject* o1, CollisionObject* o2, FCL_REAL& dist); DistanceData data; diff --git a/include/hpp/fcl/broadphase/detail/hierarchy_tree-inl.h b/include/hpp/fcl/broadphase/detail/hierarchy_tree-inl.h index 1ce6228..36d8df3 100644 --- a/include/hpp/fcl/broadphase/detail/hierarchy_tree-inl.h +++ b/include/hpp/fcl/broadphase/detail/hierarchy_tree-inl.h @@ -301,7 +301,8 @@ void HierarchyTree::bottomup(const NodeVecIterator lbeg, const NodeVecIterator lend) { NodeVecIterator lcur_end = lend; while (lbeg < lcur_end - 1) { - NodeVecIterator min_it1, min_it2; + NodeVecIterator min_it1 = lbeg; + NodeVecIterator min_it2 = lbeg + 1; FCL_REAL min_size = (std::numeric_limits::max)(); for (NodeVecIterator it1 = lbeg; it1 < lcur_end; ++it1) { for (NodeVecIterator it2 = it1 + 1; it2 < lcur_end; ++it2) { diff --git a/include/hpp/fcl/mesh_loader/loader.h b/include/hpp/fcl/mesh_loader/loader.h index d2443cc..2c3f362 100644 --- a/include/hpp/fcl/mesh_loader/loader.h +++ b/include/hpp/fcl/mesh_loader/loader.h @@ -44,6 +44,7 @@ #include #include +#include namespace hpp { namespace fcl { @@ -86,7 +87,11 @@ class HPP_FCL_DLLAPI CachedMeshLoader : public MeshLoader { bool operator<(const CachedMeshLoader::Key& b) const; }; - typedef std::map Cache_t; + struct HPP_FCL_DLLAPI Value { + BVHModelPtr_t model; + std::time_t mtime; + }; + typedef std::map Cache_t; const Cache_t& cache() const { return cache_; } diff --git a/package.xml b/package.xml index 7377667..5541880 100644 --- a/package.xml +++ b/package.xml @@ -1,7 +1,7 @@ hpp-fcl - 2.4.0 + 2.4.4 An extension of the Flexible Collision Library. diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 12f7e85..df7abe3 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -32,8 +32,8 @@ # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -include(${PROJECT_SOURCE_DIR}/cmake/python-helpers.cmake) -include(${PROJECT_SOURCE_DIR}/cmake/stubs.cmake) +include(${JRL_CMAKE_MODULES}/python-helpers.cmake) +include(${JRL_CMAKE_MODULES}/stubs.cmake) ADD_CUSTOM_TARGET(python) SET_TARGET_PROPERTIES(python PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD True) diff --git a/python/broadphase/broadphase.cc b/python/broadphase/broadphase.cc index 8f4dac9..49953bc 100644 --- a/python/broadphase/broadphase.cc +++ b/python/broadphase/broadphase.cc @@ -90,13 +90,15 @@ void exposeBroadPhase() { .def(dv::init()) .DEF_RW_CLASS_ATTRIB(CollisionData, request) .DEF_RW_CLASS_ATTRIB(CollisionData, result) - .DEF_RW_CLASS_ATTRIB(CollisionData, done); + .DEF_RW_CLASS_ATTRIB(CollisionData, done) + .DEF_CLASS_FUNC(CollisionData, clear); bp::class_("DistanceData", bp::no_init) .def(dv::init()) .DEF_RW_CLASS_ATTRIB(DistanceData, request) .DEF_RW_CLASS_ATTRIB(DistanceData, result) - .DEF_RW_CLASS_ATTRIB(DistanceData, done); + .DEF_RW_CLASS_ATTRIB(DistanceData, done) + .DEF_CLASS_FUNC(DistanceData, clear); BroadPhaseCollisionManagerWrapper::expose(); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e1fe526..a19a8d3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -174,7 +174,7 @@ add_library(${LIBRARY_NAME} ) if(UNIX) - get_relative_rpath(${CMAKE_INSTALL_FULL_LIBDIR} ${PROJECT_NAME}_INSTALL_RPATH) + get_relative_rpath(${CMAKE_INSTALL_LIBDIR} ${PROJECT_NAME}_INSTALL_RPATH) set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "${${PROJECT_NAME}_INSTALL_RPATH}") endif() @@ -191,6 +191,7 @@ TARGET_LINK_LIBRARIES(${LIBRARY_NAME} PUBLIC Boost::serialization Boost::chrono + Boost::filesystem ) IF(WIN32) @@ -236,8 +237,8 @@ ENDIF(octomap_FOUND) install(TARGETS ${LIBRARY_NAME} EXPORT ${TARGETS_EXPORT_NAME} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/src/mesh_loader/loader.cpp b/src/mesh_loader/loader.cpp index b874c54..3153f1a 100644 --- a/src/mesh_loader/loader.cpp +++ b/src/mesh_loader/loader.cpp @@ -37,6 +37,8 @@ #include #include +#include + #ifdef HPP_FCL_HAS_OCTOMAP #include #endif @@ -100,14 +102,26 @@ CollisionGeometryPtr_t MeshLoader::loadOctree(const std::string& filename) { BVHModelPtr_t CachedMeshLoader::load(const std::string& filename, const Vec3f& scale) { Key key(filename, scale); - Cache_t::const_iterator _cached = cache_.find(key); - if (_cached == cache_.end()) { - BVHModelPtr_t geom = MeshLoader::load(filename, scale); - cache_.insert(std::make_pair(key, geom)); - return geom; - } else { - return _cached->second; + + std::time_t mtime = 0; + try { + mtime = boost::filesystem::last_write_time(filename); + + Cache_t::const_iterator _cached = cache_.find(key); + if (_cached != cache_.end() && _cached->second.mtime == mtime) + // File found in cache and mtime is the same + return _cached->second.model; + } catch (boost::filesystem::filesystem_error&) { + // Could not stat. Make sure we will try to load the file so that + // there will be a file not found error. } + + BVHModelPtr_t geom = MeshLoader::load(filename, scale); + Value val; + val.model = geom; + val.mtime = mtime; + cache_[key] = val; + return geom; } } // namespace fcl