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

Fraser Cormack via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 26 02:06:47 PDT 2024


https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/109926

>From 567ea02fda22989a5af89746dbc5ed6eac0a43d9 Mon Sep 17 00:00:00 2001
From: Fraser Cormack <fraser at codeplay.com>
Date: Wed, 25 Sep 2024 09:18:10 +0100
Subject: [PATCH] [libclc] Fix installation w/ ENABLE_RUNTIME_SUBNORMAL

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.
---
 libclc/CMakeLists.txt                | 12 +++++++-----
 libclc/cmake/modules/AddLibclc.cmake |  2 +-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt
index 1bf7eb2ca7ed7e..260e4d433a1d49 100644
--- a/libclc/CMakeLists.txt
+++ b/libclc/CMakeLists.txt
@@ -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> )
diff --git a/libclc/cmake/modules/AddLibclc.cmake b/libclc/cmake/modules/AddLibclc.cmake
index 839815d8cc6fff..f2032660ba99b0 100644
--- a/libclc/cmake/modules/AddLibclc.cmake
+++ b/libclc/cmake/modules/AddLibclc.cmake
@@ -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()



More information about the cfe-commits mailing list