File 0003-Introduce-XRT_INSTALL_LIB_DIR-variable-in-CMakeLists.patch of Package libxrt

From 549e92b1f4a3f59a5f25bb581d5bc1d062d0d678 Mon Sep 17 00:00:00 2001
From: "Matwey V. Kornilov" <matwey.kornilov@gmail.com>
Date: Thu, 2 Apr 2020 07:33:25 +0000
Subject: [PATCH 3/3] Introduce XRT_INSTALL_LIB_DIR variable in CMakeLists.txt

Some Linux distros prefer lib64 over lib on 64-bit architectures.
To allow command-line configuration for lib installation path use
${XRT_INSTALL_LIB_DIR} instead of "${XRT_INSTALL_DIR}/lib"

(cherry picked from commit 9e5005c9546bf68d9d70a7e0bad2bea52db25555)
---
 src/CMake/config/xilinx.icd.in                         |  2 +-
 src/CMake/embedded_system.cmake                        |  3 ++-
 src/CMake/nativeLnx.cmake                              |  1 +
 src/CMake/nativeWin.cmake                              |  1 +
 src/runtime_src/core/common/CMakeLists.txt             |  2 +-
 src/runtime_src/core/edge/common_em/CMakeLists.txt     |  2 +-
 src/runtime_src/core/edge/hw_em/CMakeLists.txt         |  2 +-
 src/runtime_src/core/edge/sw_em/CMakeLists.txt         |  2 +-
 src/runtime_src/core/edge/user/CMakeLists.txt          |  2 +-
 .../core/pcie/emulation/common_em/CMakeLists.txt       |  2 +-
 .../core/pcie/emulation/cpu_em/CMakeLists.txt          |  2 +-
 .../core/pcie/emulation/hw_em/CMakeLists.txt           |  2 +-
 src/runtime_src/core/pcie/linux/CMakeLists.txt         |  2 +-
 .../core/pcie/tools/cloud-daemon/aws/CMakeLists.txt    |  2 +-
 .../core/pcie/tools/cloud-daemon/azure/CMakeLists.txt  |  2 +-
 .../pcie/tools/cloud-daemon/container/CMakeLists.txt   |  2 +-
 src/runtime_src/core/pcie/user_aws/CMakeLists.txt      |  2 +-
 src/runtime_src/core/pcie/windows/CMakeLists.txt       |  4 ++--
 src/runtime_src/ert/scheduler/CMakeLists.txt           |  2 +-
 src/runtime_src/xdp/CMakeLists.txt                     | 18 +++++++++---------
 src/runtime_src/xocl/CMakeLists.txt                    |  4 ++--
 src/runtime_src/xrt/CMakeLists.txt                     |  4 ++--
 22 files changed, 34 insertions(+), 31 deletions(-)

diff --git a/src/CMake/config/xilinx.icd.in b/src/CMake/config/xilinx.icd.in
index 5b40785f..803835ff 100644
--- a/src/CMake/config/xilinx.icd.in
+++ b/src/CMake/config/xilinx.icd.in
@@ -1 +1 @@
-@XRT_INSTALL_DIR@/lib/libxilinxopencl.so
+@XRT_INSTALL_LIB_DIR@/libxilinxopencl.so
diff --git a/src/CMake/embedded_system.cmake b/src/CMake/embedded_system.cmake
index 8fa0e4b1..dde48886 100644
--- a/src/CMake/embedded_system.cmake
+++ b/src/CMake/embedded_system.cmake
@@ -41,8 +41,9 @@ find_package(Boost REQUIRED COMPONENTS system filesystem )
 INCLUDE (FindCurses)
 find_package(Curses REQUIRED)
 
-set (XRT_INSTALL_DIR "/usr")
+set (XRT_INSTALL_DIR         "/usr")
 set (XRT_INSTALL_INCLUDE_DIR "${XRT_INSTALL_DIR}/include/xrt")
+set (XRT_INSTALL_LIB_DIR     "${XRT_INSTALL_DIR}/lib${LIB_SUFFIX}")
 
 # Release OpenCL extension headers
 set(XRT_CL_EXT_SRC
diff --git a/src/CMake/nativeLnx.cmake b/src/CMake/nativeLnx.cmake
index df16fdb4..44c7ee7d 100644
--- a/src/CMake/nativeLnx.cmake
+++ b/src/CMake/nativeLnx.cmake
@@ -83,6 +83,7 @@ find_package(Curses REQUIRED)
 # --- XRT Variables ---
 set (XRT_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/xrt")
 set (XRT_INSTALL_INCLUDE_DIR "${XRT_INSTALL_DIR}/include")
+set (XRT_INSTALL_LIB_DIR       "${XRT_INSTALL_DIR}/lib${LIB_SUFFIX}")
 
 # --- Release: OpenCL extension headers ---
 set(XRT_CL_EXT_SRC
diff --git a/src/CMake/nativeWin.cmake b/src/CMake/nativeWin.cmake
index 9960304c..76aadd7e 100644
--- a/src/CMake/nativeWin.cmake
+++ b/src/CMake/nativeWin.cmake
@@ -26,6 +26,7 @@ INCLUDE (FindGTest)
 # --- XRT Variables ---
 set (XRT_INSTALL_DIR "xrt")
 set (XRT_INSTALL_INCLUDE_DIR "${XRT_INSTALL_DIR}/include")
+set (XRT_INSTALL_LIB_DIR       "${XRT_INSTALL_DIR}/lib")
 
 # --- Release: OpenCL extension headers ---
 set(XRT_CL_EXT_SRC
diff --git a/src/runtime_src/core/common/CMakeLists.txt b/src/runtime_src/core/common/CMakeLists.txt
index 656ac576..dc7b1028 100644
--- a/src/runtime_src/core/common/CMakeLists.txt
+++ b/src/runtime_src/core/common/CMakeLists.txt
@@ -44,7 +44,7 @@ if (NOT WIN32)
 set_target_properties(xrt_coreutil PROPERTIES INTERFACE_LINK_LIBRARIES dl)
 target_link_libraries(xrt_coreutil uuid pthread)
 install(TARGETS xrt_coreutil
-  LIBRARY DESTINATION ${XRT_INSTALL_DIR}/lib)
+  LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR})
 else()
 # No external linking with coreutil so release only runtime
 install(TARGETS xrt_coreutil
diff --git a/src/runtime_src/core/edge/common_em/CMakeLists.txt b/src/runtime_src/core/edge/common_em/CMakeLists.txt
index b0346176..0e977f39 100755
--- a/src/runtime_src/core/edge/common_em/CMakeLists.txt
+++ b/src/runtime_src/core/edge/common_em/CMakeLists.txt
@@ -48,4 +48,4 @@ target_link_libraries(common_em
   rt
   )
 
-install (TARGETS common_em LIBRARY DESTINATION ${XRT_INSTALL_DIR}/lib)
+install (TARGETS common_em LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR})
diff --git a/src/runtime_src/core/edge/hw_em/CMakeLists.txt b/src/runtime_src/core/edge/hw_em/CMakeLists.txt
index 557125e7..2b345c8f 100644
--- a/src/runtime_src/core/edge/hw_em/CMakeLists.txt
+++ b/src/runtime_src/core/edge/hw_em/CMakeLists.txt
@@ -44,4 +44,4 @@ target_link_libraries(xrt_hwemu
   rt
   )
 
-install (TARGETS xrt_hwemu LIBRARY DESTINATION ${XRT_INSTALL_DIR}/lib)
+install (TARGETS xrt_hwemu LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR})
diff --git a/src/runtime_src/core/edge/sw_em/CMakeLists.txt b/src/runtime_src/core/edge/sw_em/CMakeLists.txt
index 95edee0e..effad93a 100755
--- a/src/runtime_src/core/edge/sw_em/CMakeLists.txt
+++ b/src/runtime_src/core/edge/sw_em/CMakeLists.txt
@@ -37,4 +37,4 @@ target_link_libraries(xrt_swemu
   uuid
   )
 
-install (TARGETS xrt_swemu LIBRARY DESTINATION ${XRT_INSTALL_DIR}/lib)
+install (TARGETS xrt_swemu LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR})
diff --git a/src/runtime_src/core/edge/user/CMakeLists.txt b/src/runtime_src/core/edge/user/CMakeLists.txt
index 5959fa8f..96ac2f3f 100644
--- a/src/runtime_src/core/edge/user/CMakeLists.txt
+++ b/src/runtime_src/core/edge/user/CMakeLists.txt
@@ -58,4 +58,4 @@ target_link_libraries(xrt_core
   boost_system
   )
 
-install (TARGETS xrt_core LIBRARY DESTINATION ${XRT_INSTALL_DIR}/lib)
+install (TARGETS xrt_core LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR})
diff --git a/src/runtime_src/core/pcie/emulation/common_em/CMakeLists.txt b/src/runtime_src/core/pcie/emulation/common_em/CMakeLists.txt
index b0346176..0e977f39 100644
--- a/src/runtime_src/core/pcie/emulation/common_em/CMakeLists.txt
+++ b/src/runtime_src/core/pcie/emulation/common_em/CMakeLists.txt
@@ -48,4 +48,4 @@ target_link_libraries(common_em
   rt
   )
 
-install (TARGETS common_em LIBRARY DESTINATION ${XRT_INSTALL_DIR}/lib)
+install (TARGETS common_em LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR})
diff --git a/src/runtime_src/core/pcie/emulation/cpu_em/CMakeLists.txt b/src/runtime_src/core/pcie/emulation/cpu_em/CMakeLists.txt
index 95edee0e..effad93a 100644
--- a/src/runtime_src/core/pcie/emulation/cpu_em/CMakeLists.txt
+++ b/src/runtime_src/core/pcie/emulation/cpu_em/CMakeLists.txt
@@ -37,4 +37,4 @@ target_link_libraries(xrt_swemu
   uuid
   )
 
-install (TARGETS xrt_swemu LIBRARY DESTINATION ${XRT_INSTALL_DIR}/lib)
+install (TARGETS xrt_swemu LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR})
diff --git a/src/runtime_src/core/pcie/emulation/hw_em/CMakeLists.txt b/src/runtime_src/core/pcie/emulation/hw_em/CMakeLists.txt
index cde7cd4f..852f9e5e 100644
--- a/src/runtime_src/core/pcie/emulation/hw_em/CMakeLists.txt
+++ b/src/runtime_src/core/pcie/emulation/hw_em/CMakeLists.txt
@@ -38,4 +38,4 @@ target_link_libraries(xrt_hwemu
   uuid
   )
 
-install (TARGETS xrt_hwemu LIBRARY DESTINATION ${XRT_INSTALL_DIR}/lib)
+install (TARGETS xrt_hwemu LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR})
diff --git a/src/runtime_src/core/pcie/linux/CMakeLists.txt b/src/runtime_src/core/pcie/linux/CMakeLists.txt
index 576f80e1..b1a97e5f 100644
--- a/src/runtime_src/core/pcie/linux/CMakeLists.txt
+++ b/src/runtime_src/core/pcie/linux/CMakeLists.txt
@@ -53,4 +53,4 @@ target_link_libraries(xrt_core
 
 install(TARGETS xrt_core
   LIBRARY
-  DESTINATION ${XRT_INSTALL_DIR}/lib)
+  DESTINATION ${XRT_INSTALL_LIB_DIR})
diff --git a/src/runtime_src/core/pcie/tools/cloud-daemon/aws/CMakeLists.txt b/src/runtime_src/core/pcie/tools/cloud-daemon/aws/CMakeLists.txt
index e2ccd4f0..910ec942 100644
--- a/src/runtime_src/core/pcie/tools/cloud-daemon/aws/CMakeLists.txt
+++ b/src/runtime_src/core/pcie/tools/cloud-daemon/aws/CMakeLists.txt
@@ -61,7 +61,7 @@ endif()
 
 install(TARGETS aws_mpd_plugin
   LIBRARY
-  DESTINATION ${XRT_INSTALL_DIR}/lib
+  DESTINATION ${XRT_INSTALL_LIB_DIR}
   COMPONENT aws
   )
 
diff --git a/src/runtime_src/core/pcie/tools/cloud-daemon/azure/CMakeLists.txt b/src/runtime_src/core/pcie/tools/cloud-daemon/azure/CMakeLists.txt
index 118c7045..beabc79e 100644
--- a/src/runtime_src/core/pcie/tools/cloud-daemon/azure/CMakeLists.txt
+++ b/src/runtime_src/core/pcie/tools/cloud-daemon/azure/CMakeLists.txt
@@ -38,7 +38,7 @@ target_link_libraries(azure_mpd_plugin
 
 install(TARGETS azure_mpd_plugin
   LIBRARY
-  DESTINATION ${XRT_INSTALL_DIR}/lib
+  DESTINATION ${XRT_INSTALL_LIB_DIR}
   COMPONENT azure
   )
 
diff --git a/src/runtime_src/core/pcie/tools/cloud-daemon/container/CMakeLists.txt b/src/runtime_src/core/pcie/tools/cloud-daemon/container/CMakeLists.txt
index 790f143c..a92e8ab6 100644
--- a/src/runtime_src/core/pcie/tools/cloud-daemon/container/CMakeLists.txt
+++ b/src/runtime_src/core/pcie/tools/cloud-daemon/container/CMakeLists.txt
@@ -30,7 +30,7 @@ target_link_libraries(container_mpd_plugin
 
 install(TARGETS container_mpd_plugin
   LIBRARY
-  DESTINATION ${XRT_INSTALL_DIR}/lib
+  DESTINATION ${XRT_INSTALL_LIB_DIR}
   COMPONENT container
   )
 endif (NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
diff --git a/src/runtime_src/core/pcie/user_aws/CMakeLists.txt b/src/runtime_src/core/pcie/user_aws/CMakeLists.txt
index c4801645..6a113220 100644
--- a/src/runtime_src/core/pcie/user_aws/CMakeLists.txt
+++ b/src/runtime_src/core/pcie/user_aws/CMakeLists.txt
@@ -65,7 +65,7 @@ endif ()
 
 install(TARGETS xrt_aws
         LIBRARY
-        DESTINATION ${XRT_INSTALL_DIR}/lib
+        DESTINATION ${XRT_INSTALL_LIB_DIR}
         COMPONENT aws)
 
 endif (NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
diff --git a/src/runtime_src/core/pcie/windows/CMakeLists.txt b/src/runtime_src/core/pcie/windows/CMakeLists.txt
index 887b80a0..b9aedd4f 100644
--- a/src/runtime_src/core/pcie/windows/CMakeLists.txt
+++ b/src/runtime_src/core/pcie/windows/CMakeLists.txt
@@ -46,6 +46,6 @@ target_link_libraries(xrt_core
 # ARCHIVE target. All Windows-based systems including Cygwin are DLL
 # platforms.
 install(TARGETS xrt_core
-  ARCHIVE DESTINATION ${XRT_INSTALL_DIR}/lib
-  LIBRARY DESTINATION ${XRT_INSTALL_DIR}/lib
+  ARCHIVE DESTINATION ${XRT_INSTALL_LIB_DIR}
+  LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR}
   RUNTIME DESTINATION ${XRT_INSTALL_DIR}/bin)
diff --git a/src/runtime_src/ert/scheduler/CMakeLists.txt b/src/runtime_src/ert/scheduler/CMakeLists.txt
index c75121b7..06923452 100644
--- a/src/runtime_src/ert/scheduler/CMakeLists.txt
+++ b/src/runtime_src/ert/scheduler/CMakeLists.txt
@@ -107,4 +107,4 @@ add_library(sched_em SHARED ${CURR_SOURCE}
 set_target_properties(sched_em PROPERTIES VERSION ${XRT_VERSION_STRING}
   SOVERSION ${XRT_SOVERSION})
 
-install (TARGETS sched_em LIBRARY DESTINATION ${XRT_INSTALL_DIR}/lib)
+install (TARGETS sched_em LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR})
diff --git a/src/runtime_src/xdp/CMakeLists.txt b/src/runtime_src/xdp/CMakeLists.txt
index dd547ed2..b6b66dc8 100644
--- a/src/runtime_src/xdp/CMakeLists.txt
+++ b/src/runtime_src/xdp/CMakeLists.txt
@@ -137,7 +137,7 @@ set_target_properties(xdp_hal_api_interface_plugin PROPERTIES VERSION ${XRT_VERS
 set_target_properties(xdp_debug_plugin PROPERTIES VERSION ${XRT_VERSION_STRING} SOVERSION ${XRT_SOVERSION})
 set_target_properties(xdp_appdebug_plugin PROPERTIES VERSION ${XRT_VERSION_STRING} SOVERSION ${XRT_SOVERSION})
 
-install (TARGETS xdp oclxdp xdp_hal_plugin xdp_hal_api_interface_plugin xdp_debug_plugin xdp_appdebug_plugin LIBRARY DESTINATION ${XRT_INSTALL_DIR}/lib)
+install (TARGETS xdp oclxdp xdp_hal_plugin xdp_hal_api_interface_plugin xdp_debug_plugin xdp_appdebug_plugin LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR})
 
 install (FILES "${XRT_XDP_PROFILE_XMA_PLUGIN_DIR}/xma_profile.h" DESTINATION ${XRT_INSTALL_INCLUDE_DIR})
 
@@ -164,8 +164,8 @@ add_dependencies(xdp xrt_core xilinxopencl)
 target_link_libraries (xdp xrt_core xilinxopencl)
 
 install(TARGETS xdp
-  ARCHIVE DESTINATION ${XRT_INSTALL_DIR}/lib
-  LIBRARY DESTINATION ${XRT_INSTALL_DIR}/lib
+  ARCHIVE DESTINATION ${XRT_INSTALL_LIB_DIR}
+  LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR}
   RUNTIME DESTINATION ${XRT_INSTALL_DIR}/bin)
 
 # oclxdp
@@ -177,8 +177,8 @@ add_dependencies(oclxdp xdp xilinxopencl)
 target_link_libraries (oclxdp xdp xilinxopencl)
 
 install(TARGETS oclxdp
-  ARCHIVE DESTINATION ${XRT_INSTALL_DIR}/lib
-  LIBRARY DESTINATION ${XRT_INSTALL_DIR}/lib
+  ARCHIVE DESTINATION ${XRT_INSTALL_LIB_DIR}
+  LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR}
   RUNTIME DESTINATION ${XRT_INSTALL_DIR}/bin)
 
 # xdp_hal_plugin
@@ -197,8 +197,8 @@ target_link_libraries(xdp_hal_plugin xdp xrt_core)
 #  SOVERSION ${XRT_SOVERSION})
 
 install(TARGETS xdp_hal_plugin
-  ARCHIVE DESTINATION ${XRT_INSTALL_DIR}/lib
-  LIBRARY DESTINATION ${XRT_INSTALL_DIR}/lib
+  ARCHIVE DESTINATION ${XRT_INSTALL_LIB_DIR}
+  LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR}
   RUNTIME DESTINATION ${XRT_INSTALL_DIR}/bin)
 
 # xdp_hal_api_interface_plugin
@@ -217,8 +217,8 @@ target_link_libraries(xdp_hal_api_interface_plugin xdp)
 #  SOVERSION ${XRT_SOVERSION})
 
 install(TARGETS xdp_hal_api_interface_plugin
-  ARCHIVE DESTINATION ${XRT_INSTALL_DIR}/lib
-  LIBRARY DESTINATION ${XRT_INSTALL_DIR}/lib
+  ARCHIVE DESTINATION ${XRT_INSTALL_LIB_DIR}
+  LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR}
   RUNTIME DESTINATION ${XRT_INSTALL_DIR}/bin)
 
 # install (FILES "${XRT_XDP_PROFILE_XMA_PLUGIN_DIR}/xma_profile.h" DESTINATION ${XRT_INSTALL_INCLUDE_DIR})
diff --git a/src/runtime_src/xocl/CMakeLists.txt b/src/runtime_src/xocl/CMakeLists.txt
index 91f8c044..0cd73763 100644
--- a/src/runtime_src/xocl/CMakeLists.txt
+++ b/src/runtime_src/xocl/CMakeLists.txt
@@ -95,7 +95,7 @@ target_link_libraries(xilinxopencl
 endif ()
 
 install(TARGETS xilinxopencl
-  ARCHIVE DESTINATION ${XRT_INSTALL_DIR}/lib
-  LIBRARY DESTINATION ${XRT_INSTALL_DIR}/lib
+  ARCHIVE DESTINATION ${XRT_INSTALL_LIB_DIR}
+  LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR}
   RUNTIME DESTINATION ${XRT_INSTALL_DIR}/bin)
 
diff --git a/src/runtime_src/xrt/CMakeLists.txt b/src/runtime_src/xrt/CMakeLists.txt
index 940f1764..7eae99bb 100644
--- a/src/runtime_src/xrt/CMakeLists.txt
+++ b/src/runtime_src/xrt/CMakeLists.txt
@@ -61,6 +61,6 @@ set_target_properties(xrt++ PROPERTIES VERSION ${XRT_VERSION_STRING}
   SOVERSION ${XRT_SOVERSION})
 
 install(TARGETS xrt++
-  ARCHIVE DESTINATION ${XRT_INSTALL_DIR}/lib
-  LIBRARY DESTINATION ${XRT_INSTALL_DIR}/lib
+  ARCHIVE DESTINATION ${XRT_INSTALL_LIB_DIR}
+  LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR}
   RUNTIME DESTINATION ${XRT_INSTALL_DIR}/bin)
-- 
2.16.4

openSUSE Build Service is sponsored by