================ @@ -92,10 +95,14 @@ else() get_host_tool_path( llvm-link LLVM_LINK llvm-link_exe llvm-link_target ) get_host_tool_path( opt OPT opt_exe opt_target ) endif() -endif() -# Setup the paths where libclc runtimes should be stored. -set( LIBCLC_OUTPUT_LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR} ) + # 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. + get_clang_resource_dir( LIBCLC_OUTPUT_DIR PREFIX ${LLVM_LIBRARY_OUTPUT_INTDIR}/.. ) + + # Note we do not adhere to LLVM_ENABLE_PER_TARGET_RUNTIME_DIR. + set( LIBCLC_OUTPUT_LIBRARY_DIR ${LIBCLC_OUTPUT_DIR}/lib/libclc ) ---------------- wenju-he wrote:
When configuring on windows using cmake msvc generator ``` cmake -G "Visual Studio 17 2022" -A x64 -Thost=x64 -DLLVM_ENABLE_PROJECTS="llvm;clang;clang-tools-extra;libclc" -DLLVM_INCLUDE_TESTS=OFF -DLLVM_BUILD_TESTS=OFF -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_TARGETS_TO_BUILD="X86;AMDGPU" -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Release -DLIBCLC_TARGETS_TO_BUILD="amdgcn--amdhsa" ../llvm ``` install command in tools\libclc\cmake_install.cmake is not correctly configured as there is a unresolved `$(Configuration)`: ``` if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/share/clc" TYPE FILE FILES "D:/wenjuhe/llvm-project/build/$(Configuration)/lib/../lib/clang/22/lib/libclc/amdgcn--amdhsa.bc") endif() ``` It causes install error in our downstream project and the error is reproducible in llvm-project: ``` CMake Error at tools/libclc/cmake_install.cmake:45 (file): file INSTALL cannot find "D:/wenjuhe/llvm-project/build/$(Configuration)/lib/../lib/clang/22/lib/libclc/amdgcn--amdhsa.bc": File exists. ``` @frasercrmck do you have suggestion about why `$(Configuration)` is unresolved? cmake jinja generator doesn't seem to have the issue because I can build llvm-project and install with ninja. If I enable libclc in LLVM_ENABLE_RUNTIMES, there is another build error: ``` cmake -G "Visual Studio 17 2022" -A x64 -Thost=x64 -DLLVM_ENABLE_PROJECTS="llvm;clang;clang-tools-extra" -DLLVM_ENABLE_RUNTIMES=libclc -DLLVM_INCLUDE_TESTS=OFF -DLLVM_BUILD_TESTS=OFF -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_TARGETS_TO_BUILD="X86;AMDGPU" -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Release -DLIBCLC_TARGETS_TO_BUILD="amdgcn--amdhsa" ../llvm ``` ``` Unknown CMake command "get_clang_resource_dir". ``` https://github.com/llvm/llvm-project/pull/146503 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits