Skip to content

Commit 9f3728d

Browse files
authored
[libclc] Fix installation w/ ENABLE_RUNTIME_SUBNORMAL (llvm#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.
1 parent 81ba95c commit 9f3728d

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

libclc/CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,10 @@ if( ENABLE_RUNTIME_SUBNORMAL )
221221
TARGET ${file}
222222
INPUTS ${CMAKE_CURRENT_SOURCE_DIR}/generic/lib/${file}.ll
223223
)
224-
install( FILES $<TARGET_PROPERTY:${file},TARGET_FILE> ARCHIVE
225-
DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" )
224+
install(
225+
FILES $<TARGET_PROPERTY:${file},TARGET_FILE>
226+
DESTINATION "${CMAKE_INSTALL_DATADIR}/clc"
227+
)
226228
endforeach()
227229
endif()
228230

@@ -426,9 +428,9 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
426428
add_custom_target( ${builtins_opt_lib_tgt}
427429
ALL DEPENDS ${builtins_opt_lib_tgt}.bc
428430
)
429-
set_target_properties( ${builtins_opt_lib_tgt}
430-
PROPERTIES TARGET_FILE ${builtins_opt_lib_tgt}.bc
431-
FOLDER "libclc/Device IR/Opt"
431+
set_target_properties( ${builtins_opt_lib_tgt} PROPERTIES
432+
TARGET_FILE ${CMAKE_CURRENT_BINARY_DIR}/${builtins_opt_lib_tgt}.bc
433+
FOLDER "libclc/Device IR/Opt"
432434
)
433435

434436
set( builtins_opt_lib $<TARGET_PROPERTY:${builtins_opt_lib_tgt},TARGET_FILE> )

libclc/cmake/modules/AddLibclc.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function(link_bc)
113113

114114
add_custom_target( ${ARG_TARGET} ALL DEPENDS ${ARG_TARGET}.bc )
115115
set_target_properties( ${ARG_TARGET} PROPERTIES
116-
TARGET_FILE ${ARG_TARGET}.bc
116+
TARGET_FILE ${CMAKE_CURRENT_BINARY_DIR}/${ARG_TARGET}.bc
117117
FOLDER "libclc/Device IR/Linking"
118118
)
119119
endfunction()

0 commit comments

Comments
 (0)