From 3128b2dfd1e77382dcad812e198540303cf68069 Mon Sep 17 00:00:00 2001 From: "Yaxun (Sam) Liu" Date: Tue, 14 Apr 2020 09:47:59 -0400 Subject: [PATCH] Fix build failure of rocPRIM Two issues are fixed: libamdhip64_static.a is not included in package. cmake generated target files uses installation path of libraries which are created when the libraries are built and installed. The CI uses customized installation directory which is not the package installation directory, thefore the library location in cmake generated target files differs from the library location installed from package. This causes rocPRIM build failure since rocPRIM uses pkg-config which checks library location. The fix is to fix the library location before adding cmake generated target files to package. Change-Id: I4aa2c6138f58df6d4a86301a5c0436edcb19ab70 --- packaging/hip-vdi.txt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packaging/hip-vdi.txt b/packaging/hip-vdi.txt index 20aa356383..2bbe4331d0 100644 --- a/packaging/hip-vdi.txt +++ b/packaging/hip-vdi.txt @@ -2,19 +2,29 @@ cmake_minimum_required(VERSION 2.8.3) project(hip_vdi) install(FILES @PROJECT_BINARY_DIR@/lib/libamdhip64.so DESTINATION lib) +install(FILES @PROJECT_BINARY_DIR@/lib/libamdhip64_static.a DESTINATION lib) install(FILES @PROJECT_BINARY_DIR@/lib/libhip_hcc.so DESTINATION lib) install(FILES @PROJECT_BINARY_DIR@/lib/libhiprtc.so DESTINATION lib) install(FILES @PROJECT_BINARY_DIR@/.hipInfo DESTINATION lib) install(FILES @PROJECT_BINARY_DIR@/hip-config.cmake @PROJECT_BINARY_DIR@/hip-config-version.cmake DESTINATION lib/cmake/hip) -file(GLOB target_files @CONFIG_PACKAGE_INSTALL_DIR@/hip-targets-*.cmake) -install(FILES @CONFIG_PACKAGE_INSTALL_DIR@/hip-targets.cmake ${target_files} DESTINATION lib/cmake/hip) ############################# # Packaging steps ############################# set(CPACK_SET_DESTDIR TRUE) set(CPACK_INSTALL_PREFIX "/opt/rocm/hip") + +## cmake generated target files contains IMPORTED_LOCATION_RELEASE etc. which +## is installation path when building the project, which may be different from +## the intallation path for packaging. These paths have to be replaced by +## the package installation path, otherwise apps using pkg-config will fail. +file(GLOB _target_files @CONFIG_PACKAGE_INSTALL_DIR@/hip-targets*.cmake) +foreach(_target_file ${_target_files}) + execute_process(COMMAND sed -i s:@CMAKE_INSTALL_PREFIX@:${CPACK_INSTALL_PREFIX}:g ${_target_file}) +endforeach() +install(FILES ${_target_files} DESTINATION lib/cmake/hip) + set(CPACK_PACKAGE_NAME "hip-vdi") set(HCC_PACKAGE_NAME "vdi") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "HIP: Heterogenous-computing Interface for Portability [VDI]")