[libclc] [libclc] Change libclc install dir to ${clang_resource_dir}/lib/libclc in in-tree build (PR #163896)
Wenju He via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 16 17:47:12 PDT 2025
https://github.com/wenju-he updated https://github.com/llvm/llvm-project/pull/163896
>From c532c0b05c5416694719ae3716220e7b05dd0b49 Mon Sep 17 00:00:00 2001
From: Wenju He <wenju.he at intel.com>
Date: Fri, 17 Oct 2025 00:42:01 +0200
Subject: [PATCH 1/2] [libclc] Change libclc install dir to
${clang_resource_dir}/lib/libclc in in-tree build
Commit df7473673214b placed libclc libraries into clang resource dir
<resource-dir>/lib/libclc at build stage.
This PR does it at install stage as well.
Note that in standalone (not in-tree) build, libclc is still installed
to old ${CMAKE_INSTALL_DATADIR}/clc dir.
---
libclc/CMakeLists.txt | 7 +++++--
libclc/cmake/modules/AddLibclc.cmake | 2 +-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt
index 088edc06d23d3..07926469bbd33 100644
--- a/libclc/CMakeLists.txt
+++ b/libclc/CMakeLists.txt
@@ -77,6 +77,7 @@ if( LIBCLC_STANDALONE_BUILD OR CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DI
# Setup the paths where libclc runtimes should be stored.
set( LIBCLC_OUTPUT_LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR} )
+ set( LIBCLC_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/clc )
else()
# In-tree configuration
set( LIBCLC_STANDALONE_BUILD FALSE )
@@ -100,10 +101,12 @@ else()
# Setup the paths where libclc runtimes should be stored. By default, in an
# in-tree build we place the libraries in clang's resource driectory.
include(GetClangResourceDir)
- get_clang_resource_dir( LIBCLC_OUTPUT_DIR PREFIX ${LLVM_LIBRARY_OUTPUT_INTDIR}/.. )
+ get_clang_resource_dir( LIBCLC_INSTALL_DIR )
# Note we do not adhere to LLVM_ENABLE_PER_TARGET_RUNTIME_DIR.
- set( LIBCLC_OUTPUT_LIBRARY_DIR ${LIBCLC_OUTPUT_DIR}/lib/libclc )
+ cmake_path( APPEND LIBCLC_INSTALL_DIR "lib" "libclc" )
+ cmake_path( GET LLVM_LIBRARY_OUTPUT_INTDIR PARENT_PATH LIBCLC_OUTPUT_LIBRARY_DIR )
+ cmake_path( APPEND LIBCLC_OUTPUT_LIBRARY_DIR ${LIBCLC_INSTALL_DIR} )
file( MAKE_DIRECTORY ${LIBCLC_OUTPUT_LIBRARY_DIR} )
endif()
diff --git a/libclc/cmake/modules/AddLibclc.cmake b/libclc/cmake/modules/AddLibclc.cmake
index 614f9e3790a3c..d8c22191678d4 100644
--- a/libclc/cmake/modules/AddLibclc.cmake
+++ b/libclc/cmake/modules/AddLibclc.cmake
@@ -261,7 +261,7 @@ function(libclc_install)
install(
FILES ${files}
- DESTINATION "${CMAKE_INSTALL_DATADIR}/clc"
+ DESTINATION ${LIBCLC_INSTALL_DIR}
)
endfunction()
>From b9d0b8f4e01982d94a32b8be0c100d5cfecebefc Mon Sep 17 00:00:00 2001
From: Wenju He <wenju.he at intel.com>
Date: Fri, 17 Oct 2025 02:47:01 +0200
Subject: [PATCH 2/2] move LIBCLC_INSTALL_DIR after get_clang_resource_dir
---
libclc/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt
index 07926469bbd33..9a81f2658fe34 100644
--- a/libclc/CMakeLists.txt
+++ b/libclc/CMakeLists.txt
@@ -102,9 +102,9 @@ else()
# in-tree build we place the libraries in clang's resource driectory.
include(GetClangResourceDir)
get_clang_resource_dir( LIBCLC_INSTALL_DIR )
+ cmake_path( APPEND LIBCLC_INSTALL_DIR "lib" "libclc" )
# Note we do not adhere to LLVM_ENABLE_PER_TARGET_RUNTIME_DIR.
- cmake_path( APPEND LIBCLC_INSTALL_DIR "lib" "libclc" )
cmake_path( GET LLVM_LIBRARY_OUTPUT_INTDIR PARENT_PATH LIBCLC_OUTPUT_LIBRARY_DIR )
cmake_path( APPEND LIBCLC_OUTPUT_LIBRARY_DIR ${LIBCLC_INSTALL_DIR} )
file( MAKE_DIRECTORY ${LIBCLC_OUTPUT_LIBRARY_DIR} )
More information about the cfe-commits
mailing list