[clang] [llvm] Call setup_host_tools for more tools. (PR #118635)

Harald van Dijk via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 4 05:42:29 PST 2024


https://github.com/hvdijk created https://github.com/llvm/llvm-project/pull/118635

This change allows external projects to call for host versions of clang-offload-bundler, clang-offload-packager, and llvm-ar.

This has no effect in LLVM itself, which does not make use of this, but is going to be used in DPC++'s libsycl. That is meant to be upstreamed at some point, so it probably makes sense to get this into LLVM already and avoid future conflicts.

>From a378734bf0600b06338c9d294a1da6d1315be7ac Mon Sep 17 00:00:00 2001
From: Harald van Dijk <harald.vandijk at codeplay.com>
Date: Wed, 4 Dec 2024 13:40:58 +0000
Subject: [PATCH] Call setup_host_tools for more tools.

This change allows external projects to call for host versions of
clang-offload-bundler, clang-offload-packager, and llvm-ar.

This has no effect in LLVM itself, which does not make use of this, but
is going to be used in DPC++'s libsycl. That is meant to be upstreamed
at some point, so it probably makes sense to get this into LLVM already
and avoid future conflicts.
---
 clang/tools/clang-offload-bundler/CMakeLists.txt  | 3 +++
 clang/tools/clang-offload-packager/CMakeLists.txt | 3 +++
 llvm/tools/llvm-ar/CMakeLists.txt                 | 2 ++
 3 files changed, 8 insertions(+)

diff --git a/clang/tools/clang-offload-bundler/CMakeLists.txt b/clang/tools/clang-offload-bundler/CMakeLists.txt
index dec2881589a538..5b26951b96f5db 100644
--- a/clang/tools/clang-offload-bundler/CMakeLists.txt
+++ b/clang/tools/clang-offload-bundler/CMakeLists.txt
@@ -12,6 +12,9 @@ add_clang_tool(clang-offload-bundler
   intrinsics_gen
   )
 
+setup_host_tool(clang-offload-bundler CLANG_OFFLOAD_BUNDLER
+  clang-offload-bundler_exe clang-offload-bundler_target)
+
 set(CLANG_OFFLOAD_BUNDLER_LIB_DEPS
   clangBasic
   clangDriver
diff --git a/clang/tools/clang-offload-packager/CMakeLists.txt b/clang/tools/clang-offload-packager/CMakeLists.txt
index 1c29e376452c12..ba446e18bd326b 100644
--- a/clang/tools/clang-offload-packager/CMakeLists.txt
+++ b/clang/tools/clang-offload-packager/CMakeLists.txt
@@ -11,6 +11,9 @@ add_clang_tool(clang-offload-packager
   ${tablegen_deps}
   )
 
+setup_host_tool(clang-offload-packager CLANG_OFFLOAD_PACKAGER_EXE
+  clang-offload-packager_exe clang-offload-packager_target)
+
 clang_target_link_libraries(clang-offload-packager
   PRIVATE
   clangBasic
diff --git a/llvm/tools/llvm-ar/CMakeLists.txt b/llvm/tools/llvm-ar/CMakeLists.txt
index 4d0718f8cefe62..30e2507c6e6f25 100644
--- a/llvm/tools/llvm-ar/CMakeLists.txt
+++ b/llvm/tools/llvm-ar/CMakeLists.txt
@@ -19,6 +19,8 @@ add_llvm_tool(llvm-ar
   GENERATE_DRIVER
   )
 
+setup_host_tool(llvm-ar LLVM_AR llvm_ar_exe llvm_ar_target)
+
 add_llvm_tool_symlink(llvm-ranlib llvm-ar)
 add_llvm_tool_symlink(llvm-lib llvm-ar)
 add_llvm_tool_symlink(llvm-dlltool llvm-ar)



More information about the cfe-commits mailing list