robotology / ycm-cmake-modules

YCM (YCM CMake modules) is a collection of various useful CMake modules.
http://robotology.github.io/ycm-cmake-modules
Other
52 stars 23 forks source link

Fix FindAssimp on Windows #371

Closed traversaro closed 3 years ago

traversaro commented 3 years ago

The logic of FindAssimp is broken on Windows, as on VS2019 it looks only for assimp libraries compiled under VS2019 (i.e. with the -vc150 suffix) but VS2019 is perfectly compatible with assimp libraries compiled with VS2015 or VS2017. This was causing the problem reported in https://github.com/robotology/idyntree/pull/832#issuecomment-779671792 .

The fix is to first look for an assimp CMake config file in the system, and only do the manual search if this is not found.

traversaro commented 3 years ago

Actually, looking a bit at the history of this file, it seems that it was added by @claudiofantacci in https://github.com/robotology/ycm/pull/229 with the explicit goal of not using the CMake config file of assimp, as that was frequently broken.

Indeed, unfortunately the assimp cmake config is still broken in Ubuntu 20.04, see https://bugs.launchpad.net/ubuntu/+source/assimp/+bug/1882427 . In iDynTree I have a workaround for that in https://github.com/robotology/idyntree/blob/v3.0.0/cmake/iDynTreeDependencies.cmake#L93 . Furthermore, in the long term all this issue should be solved by https://github.com/assimp/assimp/pull/3455 .

However, I am not sure how we should proceed with this PR. I opened it to avoid forgetting about it, but I don't know the best way to proceed. Possible options:

Launchpad
Bug #1882427 “Assimp's CMake config files are malformed” : Bugs : assimp package : Ubuntu
The CMake config files shipped with the libassimp-dev package in Ubuntu 20.04 are malformed, and export the wrong include directories. I prepare a minimal reproducible example in https://gist.github.com/traversaro/1046013d018ff998fac1cea6987be7e0 . To reproduce it, just compile it as: git clone https://gist.github.com/traversaro/1046013d018ff998fac1cea6987be7e0 cd 1046013d018ff998fac1cea6987be7e0 chmod +x build.sh ./build.sh This will fail with the message: ~~~ -- Detecting CXX compile fea...
GitHub
robotology/idyntree
Multibody Dynamics Library designed for Free Floating Robots - robotology/idyntree
traversaro commented 3 years ago

fyi @xEnVrE

traversaro commented 3 years ago

In iDynTree to avoid the problem I just added a NO_CONFIG option to the call find_package(assimp), so Findassimp.cmake of YCM is always ignored, so I am not in an hurry for this. However, I opened the PR as this problem could affect other repos such as:

GitHub
robotology/superimpose-mesh-lib
A modern C++ augmented-reality library to superimpose 3D objects on images. - robotology/superimpose-mesh-lib
GitHub
robotology/visual-tactile-localization
In-hand object tracking for the iCub humanoid robot. - robotology/visual-tactile-localization
drdanz commented 3 years ago

/rebase