From dbc98cfa46d52ede06e8be7fc5e855d807ba0fac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Sun, 16 Feb 2025 08:48:52 +0100 Subject: [PATCH] [libclc] [cmake] Fix per-target *_convert.cl dependencies (#127315) Fix `add_libclc_builtin_set` to add an appropriate dependency to either `clspv-generate_convert.cl` or `generate_convert.cl` based on the `ARCH` argument, rather than to both unconditionally. This fixes build failures due to missing dependencies when `clspv*` targets are not enabled. The added check mirrors the one from `libclc/CMakeLists.txt`. Fixes: #127378 --- libclc/cmake/modules/AddLibclc.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libclc/cmake/modules/AddLibclc.cmake b/libclc/cmake/modules/AddLibclc.cmake index b520626c6ffd..a3b311f12a1e 100644 --- a/libclc/cmake/modules/AddLibclc.cmake +++ b/libclc/cmake/modules/AddLibclc.cmake @@ -249,13 +249,19 @@ function(add_libclc_builtin_set) get_filename_component( file_dir ${file} DIRECTORY ) + if( ARG_ARCH STREQUAL spirv OR ARG_ARCH STREQUAL spirv64 ) + set(CONVERT_DEP clspv-generate_convert.cl) + else() + set(CONVERT_DEP generate_convert.cl) + endif() + compile_to_bc( TRIPLE ${ARG_TRIPLE} INPUT ${input_file} OUTPUT ${output_file} EXTRA_OPTS -fno-builtin -nostdlib "${ARG_COMPILE_FLAGS}" -I${CMAKE_CURRENT_SOURCE_DIR}/${file_dir} - DEPENDENCIES generate_convert.cl clspv-generate_convert.cl + DEPENDENCIES ${CONVERT_DEP} ) list( APPEND bytecode_files ${output_file} ) endforeach()