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

Add option to enable GNU Install Dirs #19

Merged
merged 6 commits into from
Dec 16, 2015

Conversation

richmattes
Copy link
Contributor

The way issue 15 was solved made it very difficult to install console_bridge system-wide on a distribution that does not use /usr/lib as the library installation path. This patch is a better way to solve the issue 15: rather than just nuking the GNUInstallDirs logic from orbit, it adds a configuration switch to optionally enable the functionality, leaving it disabled by default so ROS doesn't break.

This commit adds an option to enable the GNUInstallDirs.cmake script and
use it to define console_bridge's installation directories. When
enabled, libraries, headers, and data are installed to paths defined by
the GNUInstallDirs.cmake script. Otherwise, the hard-coded "lib",
"share", and "include" strings are used, resulting in no change in
functionality after this commit is applied.

The option is diabled by default.

Signed-off-by: Rich Mattes <richmattes@gmail.com>
@scpeters
Copy link
Contributor

I think this was resolved by #23

@dirk-thomas
Copy link
Member

The same change has been reverted a while ago since it did not work on the ROS build farm: b863035

I am not sure if something is different now though.

@richmattes
Copy link
Contributor Author

As I said in the original description, this is a better way to solve #15 (the buildfarm breakage) by adding an off-by-default option to enable paths from GNUInstallDirs.

The motivation behind this PR is the fact that when libraries are installed system-wide, distros don't always put all of their libraries in ${prefix}/lib/. GNUInstallDirs provides a set of heuristics to choose the correct library installation directory for a given environment. On the other hand, packages installing to non-standard prefixes like /opt/ros don't necessarily want or need to follow the distro library directory conventions. The patch is supposed to preserve the hard-coded ${prefix}/lib/ destination by default, and provide an option to allow distro maintainers to use paths derived from GNUInstallDirs instead.

#22 and #23 don't fix this issue, as they don't address the fact that the library installation directory is hard-coded to ${prefix}/lib/

@scpeters
Copy link
Contributor

Can you resolve conflicts on this branch?

@richmattes
Copy link
Contributor Author

Should be resolved now.

@j-rivero
Copy link
Contributor

AFAIK, the support for GNUInstallsDirs was reverted some time ago to keep compatibility with catkin before we merged the support for it.

So two things:

  • I would say that this can be now merged and work within ROS
  • I don't see any reason to implement it via optional variable.

@@ -8,7 +8,7 @@ set(@PKG_NAME@_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include")
foreach(lib @PKG_LIBRARIES@)
Copy link
Contributor

Choose a reason for hiding this comment

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

in the line 6 of this file, we can change:

-set(@PKG_NAME@_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include")
+set(@PKG_NAME@_INCLUDE_DIRS @CMAKE_INSTALL_FULL_INCLUDEDIR@)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, I will fix this.

Remove option to use GNUInstallDirs, so it is always enabled.

Change console-bridge-config.cmake.in to use CMAKE_INSTALL_FULL* cmake
path variables
@@ -82,7 +82,7 @@ if (NOT MSVC)
set(pkg_conf_file "console_bridge.pc")
configure_file("${pkg_conf_file}.in" "${CMAKE_BINARY_DIR}/${pkg_conf_file}" @ONLY)
install(FILES "${CMAKE_BINARY_DIR}/${pkg_conf_file}"
DESTINATION lib/pkgconfig/ COMPONENT pkgconfig)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ COMPONENT pkgconfig)
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably need to use CMAKE_INSTALL_LIBDIR with the cmake module, line 72

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I would agree with that. Pushing now.

The console_bridge configs contain paths to find the libraries which are
architecture-dependent.  Those architecture-dependent scripts should be
installed to an arch-dependent path, mimicing the pkg-config installation.
@j-rivero
Copy link
Contributor

Thanks Rich for all the fixes. It is fine for me to merge. +1

DESTINATION include
FILES_MATCHING PATTERN "*.h")
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h")
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you remove the extra whitespace at the end of these lines?

@scpeters
Copy link
Contributor

+1, merging, thanks @jpgr87 !

scpeters added a commit that referenced this pull request Dec 16, 2015
Add option to enable GNU Install Dirs
@scpeters scpeters merged commit 964a9a7 into ros:master Dec 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants