loader: use CMAKE_INSTALL_FULL_<dir> to improve Linux filesystem compatibility

In order to improve the loader's compatibility with different filesystem hierarchies
under Linux, use CMake's CMAKE_INSTALL_FULL_<dir> instead of CMAKE_INSTALL_<dir> to
correctly resolve the absolute paths of SYSCONFDIR and DATADIR in compliance with
the GNU Coding Standard [1] and Linux Foundation's Filesystem Hierarchy Standard [2],
as explained in CMake's documentation [3].

Note to packagers: When using CMAKE_INSTALL_PREFIX, this commit obviates the
definition of other CMAKE_INSTALL_ defines to properly detect ICD and layer
manifests in GNU/Linux-compliant filesystems.

This commit fixes GH-1083. (see the issue for more details)

[1] https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
[2] https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html
[3] https://cmake.org/cmake/help/v3.4/module/GNUInstallDirs.html

Change-Id: If743a3c8f5f7381e00c0d23b95b9e13c0dead144
Signed-off-by: Dor Askayo <dor.askayo@gmail.com>
This commit is contained in:
Dor Askayo 2016-10-22 20:42:44 +03:00 committed by Karl Schultz
parent 33eea83055
commit f61d06c185
2 changed files with 14 additions and 14 deletions

View File

@ -273,8 +273,8 @@ set (PYTHON_CMD ${PYTHON_EXECUTABLE})
if(NOT WIN32)
include(GNUInstallDirs)
add_definitions(-DSYSCONFDIR="${CMAKE_INSTALL_SYSCONFDIR}")
add_definitions(-DDATADIR="${CMAKE_INSTALL_DATADIR}")
add_definitions(-DSYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
add_definitions(-DDATADIR="${CMAKE_INSTALL_FULL_DATADIR}")
if (CMAKE_INSTALL_PREFIX STREQUAL "/usr/local")
elseif (CMAKE_INSTALL_PREFIX STREQUAL "")
else()

View File

@ -59,14 +59,14 @@
#if defined(LOCALPREFIX)
#define LOCAL_DRIVERS_INFO \
LOCALPREFIX "/" SYSCONFDIR VULKAN_DIR VULKAN_ICDCONF_DIR ":" \
LOCALPREFIX "/" DATADIR VULKAN_DIR VULKAN_ICDCONF_DIR ":"
SYSCONFDIR VULKAN_DIR VULKAN_ICDCONF_DIR ":" \
DATADIR VULKAN_DIR VULKAN_ICDCONF_DIR ":"
#define LOCAL_ELAYERS_INFO \
LOCALPREFIX "/" SYSCONFDIR VULKAN_DIR VULKAN_ELAYERCONF_DIR ":" \
LOCALPREFIX "/" DATADIR VULKAN_DIR VULKAN_ELAYERCONF_DIR ":"
SYSCONFDIR VULKAN_DIR VULKAN_ELAYERCONF_DIR ":" \
DATADIR VULKAN_DIR VULKAN_ELAYERCONF_DIR ":"
#define LOCAL_ILAYERS_INFO \
LOCALPREFIX "/" SYSCONFDIR VULKAN_DIR VULKAN_ILAYERCONF_DIR ":" \
LOCALPREFIX "/" DATADIR VULKAN_DIR VULKAN_ILAYERCONF_DIR ":"
SYSCONFDIR VULKAN_DIR VULKAN_ILAYERCONF_DIR ":" \
DATADIR VULKAN_DIR VULKAN_ILAYERCONF_DIR ":"
#else
#define LOCAL_DRIVERS_INFO
#define LOCAL_ELAYERS_INFO
@ -75,17 +75,17 @@
#define DEFAULT_VK_DRIVERS_INFO \
LOCAL_DRIVERS_INFO \
"/" SYSCONFDIR VULKAN_DIR VULKAN_ICDCONF_DIR ":" \
"/usr/" DATADIR VULKAN_DIR VULKAN_ICDCONF_DIR
SYSCONFDIR VULKAN_DIR VULKAN_ICDCONF_DIR ":" \
DATADIR VULKAN_DIR VULKAN_ICDCONF_DIR
#define DEFAULT_VK_DRIVERS_PATH ""
#define DEFAULT_VK_ELAYERS_INFO \
LOCAL_ELAYERS_INFO \
"/" SYSCONFDIR VULKAN_DIR VULKAN_ELAYERCONF_DIR ":" \
"/usr/" DATADIR VULKAN_DIR VULKAN_ELAYERCONF_DIR
SYSCONFDIR VULKAN_DIR VULKAN_ELAYERCONF_DIR ":" \
DATADIR VULKAN_DIR VULKAN_ELAYERCONF_DIR
#define DEFAULT_VK_ILAYERS_INFO \
LOCAL_ILAYERS_INFO \
"/" SYSCONFDIR VULKAN_DIR VULKAN_ILAYERCONF_DIR ":" \
"/usr/" DATADIR VULKAN_DIR VULKAN_ILAYERCONF_DIR
SYSCONFDIR VULKAN_DIR VULKAN_ILAYERCONF_DIR ":" \
DATADIR VULKAN_DIR VULKAN_ILAYERCONF_DIR
#define DEFAULT_VK_LAYERS_PATH ""
#if !defined(LAYERS_SOURCE_PATH)
#define LAYERS_SOURCE_PATH NULL