Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FindAssimp on Windows #371

Merged
merged 2 commits into from
Feb 23, 2021
Merged

Fix FindAssimp on Windows #371

merged 2 commits into from
Feb 23, 2021

Conversation

traversaro
Copy link
Member

@traversaro traversaro commented Feb 17, 2021

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 robotology/idyntree#832 (comment) .

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
Copy link
Member Author

traversaro commented Feb 17, 2021

Actually, looking a bit at the history of this file, it seems that it was added by @claudiofantacci in #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 assimp/assimp#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:

  • Only call find_package(assimp NO_CONFIG) on Windows
  • Add the iDynTree workaround for the imported target also here, but I am not sure if that will work on Ubuntu 18.04
  • Don't do anything, and fix everything in downstream projects.
Launchpad
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...</div></blockquote>
<blockquote><img src="https://avatars.githubusercontent.com/u/1587191?s=400&v=4" width="48" align="right"><div><img src="https://assets.fantasygmm.top/favicons/favicon.svg" height="14"> GitHub</div><div><strong><a href="https://github.com/robotology/idyntree">robotology/idyntree</a></strong></div><div>Multibody Dynamics Library designed for Free Floating Robots  - robotology/idyntree</div></blockquote>

@traversaro
Copy link
Member Author

fyi @xEnVrE

@traversaro
Copy link
Member Author

traversaro commented Feb 17, 2021

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
A modern C++ augmented-reality library to superimpose 3D objects on images. - robotology/superimpose-mesh-lib
GitHub
In-hand object tracking for the iCub humanoid robot. - robotology/visual-tactile-localization

Copy link
Member

@drdanz drdanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@drdanz

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants