https://github.com/mgorny created 
https://github.com/llvm/llvm-project/pull/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.

From 58840769501a152c1f02aa9ceda541a543ef5642 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgo...@gentoo.org>
Date: Sat, 15 Feb 2025 12:59:00 +0100
Subject: [PATCH] [libclc] [cmake] Fix per-target *_convert.cl dependencies

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.
---
 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 b520626c6ffd1..a3b311f12a1e3 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()

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to