[libclc] Fix installation w/ ENABLE_RUNTIME_SUBNORMAL (#109926)

The `ARCHIVE` artifact kind is not valid for `install(FILES ...)`.

Additionally, install wasn't resolving the target's `TARGET_FILE`
properly and was trying to find it in the top-level build directory, rather than
in the libclc binary directory. This is because our `TARGET_FILE`
properties were being set to relative paths. The cmake behaviour they
are trying to mimic - `$<TARGET_FILE:$tgt>` - provides an absolute path.

As such this patch updates instances where we set the `TARGET_FILE`
property to return an absolute path.
This commit is contained in:
Fraser Cormack 2024-09-30 10:48:30 +01:00 committed by GitHub
parent 81ba95cefe
commit 9f3728d157
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View File

@ -221,8 +221,10 @@ if( ENABLE_RUNTIME_SUBNORMAL )
TARGET ${file}
INPUTS ${CMAKE_CURRENT_SOURCE_DIR}/generic/lib/${file}.ll
)
install( FILES $<TARGET_PROPERTY:${file},TARGET_FILE> ARCHIVE
DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" )
install(
FILES $<TARGET_PROPERTY:${file},TARGET_FILE>
DESTINATION "${CMAKE_INSTALL_DATADIR}/clc"
)
endforeach()
endif()
@ -426,9 +428,9 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
add_custom_target( ${builtins_opt_lib_tgt}
ALL DEPENDS ${builtins_opt_lib_tgt}.bc
)
set_target_properties( ${builtins_opt_lib_tgt}
PROPERTIES TARGET_FILE ${builtins_opt_lib_tgt}.bc
FOLDER "libclc/Device IR/Opt"
set_target_properties( ${builtins_opt_lib_tgt} PROPERTIES
TARGET_FILE ${CMAKE_CURRENT_BINARY_DIR}/${builtins_opt_lib_tgt}.bc
FOLDER "libclc/Device IR/Opt"
)
set( builtins_opt_lib $<TARGET_PROPERTY:${builtins_opt_lib_tgt},TARGET_FILE> )

View File

@ -113,7 +113,7 @@ function(link_bc)
add_custom_target( ${ARG_TARGET} ALL DEPENDS ${ARG_TARGET}.bc )
set_target_properties( ${ARG_TARGET} PROPERTIES
TARGET_FILE ${ARG_TARGET}.bc
TARGET_FILE ${CMAKE_CURRENT_BINARY_DIR}/${ARG_TARGET}.bc
FOLDER "libclc/Device IR/Linking"
)
endfunction()