summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRebecca N. Palmer <rebecca_palmer@zoho.com>2015-02-26 18:12:27 +0000
committerZhigang Gong <zhigang.gong@intel.com>2015-02-27 16:07:06 +0800
commitae1980ab6a0817e3bd51a47685b727173f29bd4b (patch)
treed6f545418d97ba6bcb84b8d2ba321370eeb2f262
parent0b207a3765b49eb0e7a4c98b322c178e2e567275 (diff)
Enable multiarch (32/64-bit co-installation)
It is currently not possible to have 32- and 64-bit builds of beignet installed on the same system, as the path in intel-beignet.icd can only be one of the two installations. This fixes this by giving this file a different name when beignet is installed in a multiarch directory: intel-beignet-i386-linux-gnu.icd -> /usr/lib/i386-linux-gnu/beignet/libCL.so intel-beignet-x86_64-linux-gnu.icd -> /usr/lib/x86_64-linux-gnu/beignet/libCL.so Discussion and possible alternative approaches: http://lists.alioth.debian.org/pipermail/pkg-opencl-devel/Week-of-Mon-20150223/date.html While preparing this patch I noticed that intel-beignet.icd.in uses @LIB_INSTALL_DIR@/beignet/ rather than @BEIGNET_INSTALL_DIR@, which will obviously break if the latter is set directly. Is that a bug or is this intended to be an internal-only variable? Signed-off-by: Rebecca Palmer <rebecca_palmer@zoho.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
-rw-r--r--CMakeLists.txt21
1 files changed, 18 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b7319738..caad0570 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,13 +39,28 @@ INCLUDE (FindPkgConfig)
SET(CMAKE_VERBOSE_MAKEFILE "false")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake/")
+INCLUDE (GNUInstallDirs OPTIONAL)
+# support old CMake without GNUInstallDirs
+if (NOT CMAKE_INSTALL_FULL_LIBDIR)
+ set (CMAKE_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib")
+ set (CMAKE_LIBRARY_ARCHITECTURE "")
+endif (NOT CMAKE_INSTALL_FULL_LIBDIR)
+
if (NOT LIB_INSTALL_DIR)
- set (LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib")
+ set (LIB_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBDIR}")
endif (NOT LIB_INSTALL_DIR)
if (NOT BEIGNET_INSTALL_DIR)
set (BEIGNET_INSTALL_DIR "${LIB_INSTALL_DIR}/beignet/")
endif (NOT BEIGNET_INSTALL_DIR)
+# allow co-installation of 32- and 64-bit versions:
+# https://wiki.debian.org/Multiarch
+if (BEIGNET_INSTALL_DIR STREQUAL "${CMAKE_INSTALL_PREFIX}/lib/beignet/")
+ set (ICD_FILE_NAME "intel-beignet.icd")
+else (BEIGNET_INSTALL_DIR STREQUAL "${CMAKE_INSTALL_PREFIX}/lib/beignet/")
+ set (ICD_FILE_NAME "intel-beignet-${CMAKE_LIBRARY_ARCHITECTURE}.icd")
+endif (BEIGNET_INSTALL_DIR STREQUAL "${CMAKE_INSTALL_PREFIX}/lib/beignet/")
+
# Force Release with debug info
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE RelWithDebInfo)
@@ -173,9 +188,9 @@ IF(OCLIcd_FOUND)
MESSAGE(STATUS "Looking for OCL ICD header file - found")
configure_file (
"intel-beignet.icd.in"
- "intel-beignet.icd"
+ "${ICD_FILE_NAME}"
)
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/intel-beignet.icd DESTINATION /etc/OpenCL/vendors)
+ install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${ICD_FILE_NAME} DESTINATION /etc/OpenCL/vendors)
ELSE(OCLIcd_FOUND)
MESSAGE(STATUS "Looking for OCL ICD header file - not found")
ENDIF(OCLIcd_FOUND)