SWDEV-361840 - Add hiprtc cmake packaging

Change-Id: Ib2c2aa5e1890a1a11af2832d7b5e7e1d202808ed


[ROCm/clr commit: a6e336a58c]
This commit is contained in:
Satyanvesh Dittakavi
2022-10-17 09:31:40 +00:00
parent 300d7d98f9
commit 41e8d80800
4 changed files with 49 additions and 5 deletions
+20 -2
View File
@@ -167,7 +167,7 @@ endfunction()
function(create_cmake_symlink)
file(MAKE_DIRECTORY ${HIP_WRAPPER_CMAKE_DIR}/hip)
#create symlink to all config files
#create symlink to all hip config files
file(GLOB config_files ${HIP_BUILD_DIR}/hip-config*)
foreach(config_name ${config_files})
get_filename_component(file_name ${config_name} NAME)
@@ -176,7 +176,7 @@ function(create_cmake_symlink)
COMMAND ${CMAKE_COMMAND} -E create_symlink
../../../../${CMAKE_INSTALL_LIBDIR}/cmake/hip/${file_name} ${HIP_WRAPPER_CMAKE_DIR}/hip/${file_name})
endforeach()
#create symlink to hip-lang
#create symlink to hip-lang
unset(config_files)
file(MAKE_DIRECTORY ${HIP_WRAPPER_CMAKE_DIR}/hip-lang)
file(GLOB config_files ${HIP_BUILD_DIR}/src/hip-lang-config*)
@@ -188,6 +188,24 @@ function(create_cmake_symlink)
../../../../${CMAKE_INSTALL_LIBDIR}/cmake/hip-lang/${file_name} ${HIP_WRAPPER_CMAKE_DIR}/hip-lang/${file_name})
endforeach()
unset(config_files)
#create symlink to hiprtc config files
file(MAKE_DIRECTORY ${HIP_WRAPPER_CMAKE_DIR}/hiprtc)
file(GLOB config_files ${HIP_BUILD_DIR}/hiprtc-config*)
foreach(config_name ${config_files})
get_filename_component(file_name ${config_name} NAME)
add_custom_target(link_${file_name} ALL
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E create_symlink
../../../../${CMAKE_INSTALL_LIBDIR}/cmake/hiprtc/${file_name} ${HIP_WRAPPER_CMAKE_DIR}/hiprtc/${file_name})
endforeach()
add_custom_target(link_target ALL
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E create_symlink
../../../../${CMAKE_INSTALL_LIBDIR}/cmake/hiprtc/hiprtc-config.cmake ${HIP_WRAPPER_CMAKE_DIR}/hiprtc/hiprtc-config.cmake)
unset(config_files)
file(MAKE_DIRECTORY ${HIP_WRAPPER_FINDHIP_DIR}/FindHIP)
file(GLOB config_files ${HIP_BUILD_DIR}/cmake/FindHIP/*.cmake)
+4 -1
View File
@@ -53,13 +53,16 @@ if(HIP_PLATFORM STREQUAL "amd" )
#TODO:This do not belong in BINARY package.
#Keeping it as is for now
install(FILES ${CMAKE_BINARY_DIR}/.hipInfo DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT binary)
install(FILES ${CMAKE_BINARY_DIR}/hip-config.cmake ${CMAKE_BINARY_DIR}/hip-config-version.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hip COMPONENT binary)
install ( EXPORT hip-targets FILE hip-targets.cmake NAMESPACE hip:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hip COMPONENT binary)
install(FILES ${CMAKE_BINARY_DIR}/src/hip-lang-config.cmake ${CMAKE_BINARY_DIR}/src/hip-lang-config-version.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hip-lang COMPONENT binary)
install ( EXPORT hip-lang-targets FILE hip-lang-targets.cmake NAMESPACE hip-lang:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hip-lang COMPONENT binary)
install(FILES ${PROJECT_SOURCE_DIR}/src/hiprtc/cmake/hiprtc-config.cmake ${CMAKE_BINARY_DIR}/hiprtc-config-version.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hiprtc COMPONENT binary)
install ( EXPORT hiprtc-targets FILE hiprtc-targets.cmake NAMESPACE hiprtc:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hiprtc COMPONENT binary)
endif()#End HIP_PLATFORM = "amd"
#End bianry files install
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2020 - 2021 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2020 - 2022 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -26,6 +26,7 @@ CURRENTDIR=`pwd`
mkdir -p $HIPCMAKEDIR/hip
mkdir -p $HIPCMAKEDIR/hip-lang
mkdir -p $HIPCMAKEDIR/hiprtc
HIPTARGETFILES=$(ls -A $ROCMCMAKEDIR/hip | grep "^hip-targets")
cd $HIPCMAKEDIR/hip
@@ -42,3 +43,11 @@ do
ln -s -r -f $ROCMCMAKEDIR/hip-lang/$f $(basename $f)
done
cd $CURRENTDIR
HIPRTCTARGETFILES=$(ls -A $ROCMCMAKEDIR/hiprtc | grep "^hiprtc-targets")
cd $HIPCMAKEDIR/hiprtc
for f in $HIPRTCTARGETFILES
do
ln -s -r -f $ROCMCMAKEDIR/hiprtc/$f $(basename $f)
done
cd $CURRENTDIR
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2016 - 2021 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2016 - 2022 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -23,6 +23,7 @@ ROCMDIR=@ROCM_PATH@
HIPDIR=$ROCMDIR/hip
HIPCMAKEDIR=$ROCMDIR/hip/lib/cmake/hip
HIPLANGCMAKEDIR=$ROCMDIR/hip/lib/cmake/hip-lang
HIPRTCCMAKEDIR=$ROCMDIR/hip/lib/cmake/hiprtc
CURRENTDIR=`pwd`
([ ! -d $ROCMDIR ] || [ ! -d $HIPDIR ]) && exit 0
@@ -48,5 +49,18 @@ done
cd $CURRENTDIR
([ ! -d $HIPRTCCMAKEDIR ] ) && exit 0
# Remove soft-links to hiprtc-target
HIPRTCTARGETFILES=$(ls -A $HIPRTCCMAKEDIR | grep "^hiprtc-targets")
cd $HIPRTCCMAKEDIR
for f in $HIPRTCTARGETFILES; do
[ -e $f ] || continue
rm $(basename $f)
done
cd $CURRENTDIR
rmdir --ignore-fail-on-non-empty $HIPCMAKEDIR
rmdir --ignore-fail-on-non-empty $HIPLANGCMAKEDIR
rmdir --ignore-fail-on-non-empty $HIPRTCCMAKEDIR