[Beignet] [PATCH rebased] cmake: use libdir macros

Igor Gnatenko i.gnatenko.brain at gmail.com
Wed Jan 15 23:19:53 PST 2014


Don't hardcode ${prefix}/lib. More better give choice to maintainer where install libs.
We will use ${LIB_INSTALL_DIR}, which by default will point to
${CMAKE_INSTALL_PREFIX}/lib. But maintainer will can redefine it with
-DLIB_INSTALL_DIR=/usr/lib64 or the same.
Let's use libdir macroses.

Signed-off-by: Igor Gnatenko <i.gnatenko.brain at gmail.com>
---
 CMakeLists.txt             | 3 +++
 backend/src/CMakeLists.txt | 8 ++++----
 intel-beignet.icd.in       | 2 +-
 src/CMakeLists.txt         | 2 +-
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c2dac5e..30d0735 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,6 +23,9 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
 
 SET(CMAKE_VERBOSE_MAKEFILE "false")
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake/")
+if (NOT LIB_INSTALL_DIR)
+  set (LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib")
+endif (NOT LIB_INSTALL_DIR)
 SET(EMULATE_IVB false CACHE BOOL "To emulate IVB")
 SET(EMULATE_SNB false CACHE BOOL "To emulate SNB")
 SET(EMULATE_HSW false CACHE BOOL "To emulate HSW")
diff --git a/backend/src/CMakeLists.txt b/backend/src/CMakeLists.txt
index d15e7b7..b71c623 100644
--- a/backend/src/CMakeLists.txt
+++ b/backend/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-set (beignet_install_path ${CMAKE_INSTALL_PREFIX}/lib/beignet/)
+set (beignet_install_path ${LIB_INSTALL_DIR}/beignet/)
 
 
 set (ocl_vector_spec_file ${GBE_SOURCE_DIR}/src/builtin_vector_proto.def)
@@ -192,9 +192,9 @@ TARGET_LINK_LIBRARIES(gbe_bin_generater gbe)
 
 #install (TARGETS gbe LIBRARY DESTINATION lib)
 #install (FILES backend/program.h DESTINATION include/gen)
-install (FILES ${ocl_blob_file} DESTINATION lib/beignet)
-install (FILES ${pch_object} DESTINATION lib/beignet)
-install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${pcm_lib} DESTINATION lib/beignet)
+install (FILES ${ocl_blob_file} DESTINATION ${LIB_INSTALL_DIR}/beignet)
+install (FILES ${pch_object} DESTINATION ${LIB_INSTALL_DIR}/beignet)
+install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${pcm_lib} DESTINATION ${LIB_INSTALL_DIR}/beignet)
 # When build beignet itself, we need to export the local precompiled header file and precompiled module
 # file to libcl and utests.
 set (LOCAL_PCH_OBJECT_DIR "${local_pch_object}:${beignet_install_path}/ocl_stdlib.h.pch" PARENT_SCOPE)
diff --git a/intel-beignet.icd.in b/intel-beignet.icd.in
index caf3b42..9b2e349 100644
--- a/intel-beignet.icd.in
+++ b/intel-beignet.icd.in
@@ -1 +1 @@
- at CMAKE_INSTALL_PREFIX@/lib/beignet/libcl.so
+ at LIB_INSTALL_DIR@/beignet/libcl.so
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7d4d93d..95ff56f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -78,4 +78,4 @@ target_link_libraries(
                       ${DRM_LIBRARY}
                       ${OPENGL_LIBRARIES}
                       ${OPTIONAL_EGL_LIBRARY})
-install (TARGETS cl LIBRARY DESTINATION lib/beignet)
+install (TARGETS cl LIBRARY DESTINATION ${LIB_INSTALL_DIR}/beignet)
-- 
1.8.4.2



More information about the Beignet mailing list