summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
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:10:04 +0800
commit6733862e78a3183674195b23f03e3a74142d2f40 (patch)
tree7b08facc540794e21dc2067d2be6afe35e5dc5f8 /CMakeLists.txt
parenta7edf493aabf865fb1ca25f53c96c55aefbf82f8 (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>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt21
1 files changed, 18 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9c398e95..4366d8c1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,13 +38,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)
@@ -172,9 +187,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)