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 library install directories #2148

Merged
merged 4 commits into from Feb 2, 2023
Merged

Fix library install directories #2148

merged 4 commits into from Feb 2, 2023

Conversation

StefanBruens
Copy link
Contributor

No description provided.

@pmoulon
Copy link
Member

pmoulon commented Jan 23, 2023

Thx you for your contribution.

  • Can you tell what is the behavior of GNUInstallDirs for windows?
    • Why stlplus should always be build in static?

@StefanBruens
Copy link
Contributor Author

For Windows, CMAKE_INSTALL_LIBDIR is lib, i.e. this should be unchanged.

@pmoulon
Copy link
Member

pmoulon commented Jan 23, 2023

Thx you for confirming!

@StefanBruens
Copy link
Contributor Author

Otherwise, the unversioned and more or less openMVG specific stlplus library must be installed into a system directory (or one has to fiddle with RUNPATH etc).
It also mimics how the other vendored libraries are build.

IMHO longterm this stlplus should be replace with std::filesystem (C++17).

install(EXPORT openMVG-targets
FILE OpenMVGTargets.cmake
NAMESPACE OpenMVG::
DESTINATION share/openMVG/cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/openMVG/cmake
Copy link
Member

Choose a reason for hiding this comment

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

I would still keep the share here (see cmake doc https://cmake.org/cmake/help/book/mastering-cmake/chapter/Install.html)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That does not mention specifics for install(EXPORT).

On the other hand, https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure lists both lib* and share as searched paths (with various, identical pre- and postfixes).

/usr/share/ is reserved for architecture independent files, but the .cmake files contain architecture dependent paths.

Copy link
Member

Choose a reason for hiding this comment

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

So lib/share would be an appropriate path from your knowledge. We can check the behavior on a local folder install and see if consistent with the doc https://github.com/openMVG/openMVG/blob/develop/BUILD.md#using-openmvg-as-a-third-party-library-dependency-with-cmake

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you meant lib or share, then yes, but not lib/share (unless lib/ is actually part of the INSTALL_PREFIX).

(| in the link above is part of a regex and means "or").

But share is only allowed for architecture independent packages (e.g. header only libraries).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Convinced this is correct and does not cause any breakage?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the documentation, <userprefix>/share/cmake should become <userprefix>/lib/cmake.

(In case CMAKE_INSTALL_PREFIX is not one of the standard system prefixes, e.g. /usr/ or /usr/local/, CMake defaults to just lib.)

src/CMakeLists.txt Show resolved Hide resolved
src/openMVG/cameras/CMakeLists.txt Show resolved Hide resolved
src/openMVG/system/CMakeLists.txt Outdated Show resolved Hide resolved
stlplus is a fairly small helper library, and the used subset is even
smaller, so it makes sense to link it statically to the openMVG
libraries.
The OpenMVGTargets-<buildtype>.cmake contains paths based on
CMAKE_INSTALL_LIBDIR, and thus should go to the same, architecture
dependent directory.

Remove the duplicate installation of the target files as
`openMVG-targets*.cmake`.
@pmoulon pmoulon self-assigned this Feb 2, 2023
@pmoulon pmoulon added this to the 2.1 milestone Feb 2, 2023
@pmoulon pmoulon merged commit 8f9639c into openMVG:develop Feb 2, 2023
pmoulon added a commit that referenced this pull request Feb 2, 2023
@pmoulon
Copy link
Member

pmoulon commented Feb 2, 2023

@StefanBruens Thx you for your contribution. Merged!

@pmoulon pmoulon mentioned this pull request Feb 2, 2023
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.

None yet

2 participants