Skip to content

Commit 11bd902

Browse files
committed
Fix installation of precompiled kernels and bitcode files for multi-config generators
1 parent 8602b8c commit 11bd902

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

CMakeLists.txt

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,8 +628,27 @@ install(FILES ${HIPRT_ORO_HEADERS}
628628

629629
# add hipfb files
630630
if(PRECOMPILE AND NOT BAKE_COMPILED_KERNEL)
631-
install(FILES ${KERNEL_HIPRT_COMP} ${KERNEL_OROCHI_COMP}
632-
DESTINATION bin)
631+
# compile.py also exports the HIPRT bitcode as: hiprt<ver>_<hip>_amd_lib_<os>.bc
632+
get_filename_component(KERNEL_HIPRT_COMP_NAME "${KERNEL_HIPRT_COMP}" NAME)
633+
string(REPLACE "_amd.hipfb" "_amd_lib_${KERNEL_OS_POSTFIX}.bc" KERNEL_HIPRT_BC_NAME "${KERNEL_HIPRT_COMP_NAME}")
634+
635+
if(CMAKE_CONFIGURATION_TYPES)
636+
# Multi-config generators (e.g. Visual Studio): install from the selected config output folder.
637+
get_filename_component(KERNEL_OROCHI_COMP_NAME "${KERNEL_OROCHI_COMP}" NAME)
638+
639+
install(FILES "${BASE_OUTPUT_DIR}/Debug/${KERNEL_HIPRT_COMP_NAME}" "${BASE_OUTPUT_DIR}/Debug/${KERNEL_OROCHI_COMP_NAME}" "${BASE_OUTPUT_DIR}/Debug/${KERNEL_HIPRT_BC_NAME}"
640+
DESTINATION bin
641+
CONFIGURATIONS Debug)
642+
install(FILES "${BASE_OUTPUT_DIR}/Release/${KERNEL_HIPRT_COMP_NAME}" "${BASE_OUTPUT_DIR}/Release/${KERNEL_OROCHI_COMP_NAME}" "${BASE_OUTPUT_DIR}/Release/${KERNEL_HIPRT_BC_NAME}"
643+
DESTINATION bin
644+
CONFIGURATIONS Release RelWithDebInfo MinSizeRel)
645+
else()
646+
get_filename_component(KERNEL_HIPRT_COMP_DIR "${KERNEL_HIPRT_COMP}" DIRECTORY)
647+
set(KERNEL_HIPRT_BC "${KERNEL_HIPRT_COMP_DIR}/${KERNEL_HIPRT_BC_NAME}")
648+
649+
install(FILES ${KERNEL_HIPRT_COMP} ${KERNEL_OROCHI_COMP} ${KERNEL_HIPRT_BC}
650+
DESTINATION bin)
651+
endif()
633652
endif()
634653

635654

0 commit comments

Comments
 (0)