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

Use GNUInstallDirs to set installation locations #5497

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

waebbl
Copy link

@waebbl waebbl commented Oct 28, 2022

The use of GNUInstallDirs ensures, the files are installed in common locations on all platforms.

Closes: #5496
Signed-off-by: Bernd Waibel waebbl-gentoo@posteo.net

The use of GNUInstallDirs ensures, the files are installed
in common locations on all platforms.

Closes: PointCloudLibrary#5496
Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net>
@larshg
Copy link
Contributor

larshg commented Nov 1, 2022

I'm not that known to linux directory structure, but it seems to be the default to use GNUInstallDirs. So looks good to me.

@larshg larshg added module: cmake changelog: enhancement Meta-information for changelog generation labels Nov 1, 2022
@mikepurvis
Copy link

This change would be nice to get merged, as using GNUInstallDirs simplifies the split output story for packaging in Nix. One additional piece could be to eliminate the use of the PCL_ROOT variable altogether, particularly in blocks like this one:

pcl/PCLConfig.cmake.in

Lines 408 to 426 in aa7c679

# check whether PCLConfig.cmake is found into a PCL installation or in a build tree
if(EXISTS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}/pcl/pcl_config.h")
# Found a PCL installation
# pcl_message("Found a PCL installation")
set(PCL_CONF_INCLUDE_DIR "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}")
set(PCL_LIBRARY_DIRS "${PCL_ROOT}/@LIB_INSTALL_DIR@")
elseif(EXISTS "${PCL_ROOT}/include/pcl/pcl_config.h")
# Found a non-standard (likely ANDROID) PCL installation
# pcl_message("Found a PCL installation")
set(PCL_CONF_INCLUDE_DIR "${PCL_ROOT}/include")
set(PCL_LIBRARY_DIRS "${PCL_ROOT}/lib")
elseif(EXISTS "${PCL_DIR}/include/pcl/pcl_config.h")
# Found PCLConfig.cmake in a build tree of PCL
# pcl_message("PCL found into a build tree.")
set(PCL_CONF_INCLUDE_DIR "${PCL_DIR}/include") # for pcl_config.h
set(PCL_LIBRARY_DIRS "${PCL_DIR}/@LIB_INSTALL_DIR@")
else()
pcl_report_not_found("PCL can not be found on this machine")
endif()

Rather than assuming the built libraries are relative to some common root in the installed case, as this line does:

set(PCL_LIBRARY_DIRS "${PCL_ROOT}/@LIB_INSTALL_DIR@")

I believe it would be preferred to use the CMAKE_INSTALL_LIBDIR variable here, which CMake provides via its GNUInstallDirs implementation.

See: https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html

@larshg
Copy link
Contributor

larshg commented Feb 12, 2024

@jspricke and @UnaNancyOwen Can you chime in on this change how it would work on debian and windows?

@UnaNancyOwen
Copy link
Member

@larshg I checked this changes. It almost works fine on Windows and All-in-one Installer! 👍

For one thing from me, the installation directory path of the documentations seems to be just a little different from the path required by the generate script for all-in-one installer. Therefore, the link set by installer is broken. Perhaps, it should be corrected on these lines.

set(CPACK_NSIS_MENU_LINKS
"share/doc/pcl-@PCL_VERSION_MAJOR@.@PCL_VERSION_MINOR@/tutorials/html/index.html" "Tutorials"
"share/doc/pcl-@PCL_VERSION_MAJOR@.@PCL_VERSION_MINOR@/tutorials/html/sources" "Tutorials sources"
"share/doc/pcl-@PCL_VERSION_MAJOR@.@PCL_VERSION_MINOR@/html/pcl-@PCL_VERSION_MAJOR@.@PCL_VERSION_MINOR@.chm" "Documentation"
"http://www.pointclouds.org" "PCL Website")

pcl-@PCL_VERSION_MAJOR@.@PCL_VERSION_MINOR@ -> PCL

  set(CPACK_NSIS_MENU_LINKS
-             "share/doc/pcl-@PCL_VERSION_MAJOR@.@PCL_VERSION_MINOR@/tutorials/html/index.html" "Tutorials"
-             "share/doc/pcl-@PCL_VERSION_MAJOR@.@PCL_VERSION_MINOR@/tutorials/html/sources" "Tutorials sources"
-             "share/doc/pcl-@PCL_VERSION_MAJOR@.@PCL_VERSION_MINOR@/html/pcl-@PCL_VERSION_MAJOR@.@PCL_VERSION_MINOR@.chm" "Documentation"
+             "share/doc/PCL/tutorials/html/index.html" "Tutorials"
+             "share/doc/PCL/tutorials/html/sources" "Tutorials sources"
+             "share/doc/PCL/html/pcl-@PCL_VERSION_MAJOR@.@PCL_VERSION_MINOR@.chm" "Documentation"
              "http://www.pointclouds.org" "PCL Website")

@jspricke
Copy link
Member

fine with me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: enhancement Meta-information for changelog generation module: cmake
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[configuration and compilation] Using GNUInstallDirs to determine installation locations?
5 participants