[libclc] Change libclc install dir to ${clang_resource_dir}/lib/libclc in in-tree build (#163896)

Commit df74736732 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.
This commit is contained in:
Wenju He
2025-10-20 09:47:00 +08:00
committed by GitHub
parent 3f9f522a7c
commit b9e2f7ac04
2 changed files with 6 additions and 3 deletions

View File

@@ -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 )
cmake_path( APPEND LIBCLC_INSTALL_DIR "lib" "libclc" )
# Note we do not adhere to LLVM_ENABLE_PER_TARGET_RUNTIME_DIR.
set( LIBCLC_OUTPUT_LIBRARY_DIR ${LIBCLC_OUTPUT_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()

View File

@@ -261,7 +261,7 @@ function(libclc_install)
install(
FILES ${files}
DESTINATION "${CMAKE_INSTALL_DATADIR}/clc"
DESTINATION ${LIBCLC_INSTALL_DIR}
)
endfunction()