nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 89 lines 4.2 kB view raw
1diff --git a/rocm_smi-backward-compat.cmake b/rocm_smi-backward-compat.cmake 2index aa8fd9c..59afce5 100644 3--- a/rocm_smi-backward-compat.cmake 4+++ b/rocm_smi-backward-compat.cmake 5@@ -72,7 +72,12 @@ function(generate_wrapper_header) 6 set(include_guard "${include_guard}COMGR_WRAPPER_INCLUDE_${INC_GAURD_NAME}_H") 7 #set #include statement 8 get_filename_component(file_name ${header_file} NAME) 9- set(include_statements "${include_statements}#include \"../../../${CMAKE_INSTALL_INCLUDEDIR}/${ROCM_SMI}/${file_name}\"\n") 10+ if(IS_ABSOLUTE ${CMAKE_INSTALL_INCLUDEDIR}) 11+ set(include_dir "${CMAKE_INSTALL_INCLUDEDIR}") 12+ else() 13+ set(include_dir "../../../${CMAKE_INSTALL_INCLUDEDIR}") 14+ endif() 15+ set(include_statements "${include_statements}#include \"${include_dir}/${ROCM_SMI}/${file_name}\"\n") 16 configure_file(${RSMI_WRAPPER_DIR}/header.hpp.in ${RSMI_WRAPPER_INC_DIR}/${file_name}) 17 unset(include_guard) 18 unset(include_statements) 19@@ -90,7 +95,12 @@ function(generate_wrapper_header) 20 set(include_guard "${include_guard}COMGR_WRAPPER_INCLUDE_${INC_GAURD_NAME}_H") 21 #set #include statement 22 get_filename_component(file_name ${header_file} NAME) 23- set(include_statements "${include_statements}#include \"../../../${CMAKE_INSTALL_INCLUDEDIR}/${OAM_TARGET_NAME}/${file_name}\"\n") 24+ if(IS_ABSOLUTE ${CMAKE_INSTALL_INCLUDEDIR}) 25+ set(include_dir "${CMAKE_INSTALL_INCLUDEDIR}") 26+ else() 27+ set(include_dir "../../../${CMAKE_INSTALL_INCLUDEDIR}") 28+ endif() 29+ set(include_statements "${include_statements}#include \"${include_dir}/${OAM_TARGET_NAME}/${file_name}\"\n") 30 configure_file(${RSMI_WRAPPER_DIR}/header.hpp.in ${OAM_WRAPPER_INC_DIR}/${file_name}) 31 unset(include_guard) 32 unset(include_statements) 33@@ -123,11 +133,16 @@ function(create_library_symlink) 34 set(library_files "${LIB_RSMI}") 35 endif() 36 37+ if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR}) 38+ set(install_libdir "${CMAKE_INSTALL_LIBDIR}") 39+ else() 40+ set(install_libdir "../../${CMAKE_INSTALL_LIBDIR}") 41+ endif() 42 foreach(file_name ${library_files}) 43 add_custom_target(link_${file_name} ALL 44 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 45 COMMAND ${CMAKE_COMMAND} -E create_symlink 46- ../../${CMAKE_INSTALL_LIBDIR}/${file_name} ${RSMI_WRAPPER_LIB_DIR}/${file_name}) 47+ ${install_libdir}/${file_name} ${RSMI_WRAPPER_LIB_DIR}/${file_name}) 48 endforeach() 49 50 file(MAKE_DIRECTORY ${OAM_WRAPPER_LIB_DIR}) 51@@ -151,11 +166,16 @@ function(create_library_symlink) 52 set(library_files "${LIB_OAM}") 53 endif() 54 55+ if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR}) 56+ set(install_libdir "${CMAKE_INSTALL_LIBDIR}") 57+ else() 58+ set(install_libdir "../../${CMAKE_INSTALL_LIBDIR}") 59+ endif() 60 foreach(file_name ${library_files}) 61 add_custom_target(link_${file_name} ALL 62 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 63 COMMAND ${CMAKE_COMMAND} -E create_symlink 64- ../../${CMAKE_INSTALL_LIBDIR}/${file_name} ${OAM_WRAPPER_LIB_DIR}/${file_name}) 65+ ${install_libdir}/${file_name} ${OAM_WRAPPER_LIB_DIR}/${file_name}) 66 endforeach() 67 68 endfunction() 69diff --git a/rocm_smi/CMakeLists.txt b/rocm_smi/CMakeLists.txt 70index c594eeb..d3ed39d 100755 71--- a/rocm_smi/CMakeLists.txt 72+++ b/rocm_smi/CMakeLists.txt 73@@ -105,10 +105,15 @@ endif () 74 #file reorganization changes 75 #rocm_smi.py moved to libexec/rocm_smi. so creating rocm-smi symlink 76 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) 77+if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBEXECDIR}) 78+ set(install_libexecdir "${CMAKE_INSTALL_LIBEXECDIR}") 79+else() 80+ set(install_libexecdir "../${CMAKE_INSTALL_LIBEXECDIR}") 81+endif() 82 add_custom_target(link-rocm-smi ALL 83 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 84 COMMAND ${CMAKE_COMMAND} -E create_symlink 85- ../${CMAKE_INSTALL_LIBEXECDIR}/${ROCM_SMI}/rocm_smi.py ${CMAKE_CURRENT_BINARY_DIR}/bin/rocm-smi) 86+ ${install_libexecdir}/${ROCM_SMI}/rocm_smi.py ${CMAKE_CURRENT_BINARY_DIR}/bin/rocm-smi) 87 88 ## Add the install directives for the runtime library. 89 install(TARGETS ${ROCM_SMI_TARGET}