https://github.com/Meinersbur updated https://github.com/llvm/llvm-project/pull/177953
>From a0d722cd08c21515e8ad52f44824a26bec12d212 Mon Sep 17 00:00:00 2001 From: Michael Kruse <[email protected]> Date: Mon, 26 Jan 2026 13:09:30 +0100 Subject: [PATCH 1/7] Introduce RUNTIMES_*_PATH/DIR logic for all runtimes --- .../Modules}/GetToolchainDirs.cmake | 20 +++---- flang-rt/CMakeLists.txt | 53 ------------------- flang-rt/cmake/modules/AddFlangRT.cmake | 8 +-- runtimes/CMakeLists.txt | 33 +++++++++++- 4 files changed, 47 insertions(+), 67 deletions(-) rename {flang-rt/cmake/modules => cmake/Modules}/GetToolchainDirs.cmake (92%) diff --git a/flang-rt/cmake/modules/GetToolchainDirs.cmake b/cmake/Modules/GetToolchainDirs.cmake similarity index 92% rename from flang-rt/cmake/modules/GetToolchainDirs.cmake rename to cmake/Modules/GetToolchainDirs.cmake index 476d35790d559..21dffb40bf2ac 100644 --- a/flang-rt/cmake/modules/GetToolchainDirs.cmake +++ b/cmake/Modules/GetToolchainDirs.cmake @@ -1,12 +1,3 @@ -#===-- cmake/modules/GetToolchainDirs.cmake --------------------------------===# -# -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# -#===------------------------------------------------------------------------===# - - # Determine the subdirectory relative to Clang's resource dir/sysroot where to # install target-specific libraries, to be found by Clang/Flang driver. This was # adapted from Compiler-RT's mechanism to find the path for @@ -47,6 +38,17 @@ function (get_toolchain_library_subdir outvar) endfunction () +# Corresponds to Flang's ToolChain::getDefaultIntrinsicModuleDir(). +function (get_toolchain_module_subdir outvar) + set(outval "finclude/flang") + + get_toolchain_arch_dirname(arch_dirname) + set(outval "${outval}/${arch_dirname}") + + set(${outvar} "${outval}" PARENT_SCOPE) +endfunction () + + # Corresponds to Clang's ToolChain::getOSLibName(). Adapted from Compiler-RT. function (get_toolchain_os_dirname outvar) if (ANDROID) diff --git a/flang-rt/CMakeLists.txt b/flang-rt/CMakeLists.txt index 174974884fd41..7e964989d43e8 100644 --- a/flang-rt/CMakeLists.txt +++ b/flang-rt/CMakeLists.txt @@ -73,62 +73,9 @@ include(ExtendPath) # Build Mode Introspection # ############################ -# Determine whether we are in the runtimes/runtimes-bins directory of a -# bootstrap build. -set(LLVM_TREE_AVAILABLE OFF) -if (LLVM_LIBRARY_OUTPUT_INTDIR AND LLVM_RUNTIME_OUTPUT_INTDIR AND PACKAGE_VERSION) - set(LLVM_TREE_AVAILABLE ON) -endif() - # Path to LLVM development tools (FileCheck, llvm-lit, not, ...) set(LLVM_TOOLS_DIR "${LLVM_BINARY_DIR}/bin") -# Determine build and install paths. -# The build path is absolute, but the install dir is relative, CMake's install -# command has to apply CMAKE_INSTALL_PREFIX itself. -get_toolchain_library_subdir(toolchain_lib_subdir) -if (LLVM_TREE_AVAILABLE) - # In a bootstrap build emit the libraries into a default search path in the - # build directory of the just-built compiler. This allows using the - # just-built compiler without specifying paths to runtime libraries. - # - # Despite Clang in the name, get_clang_resource_dir does not depend on Clang - # being added to the build. Flang uses the same resource dir as clang. - include(GetClangResourceDir) - get_clang_resource_dir(FLANG_RT_OUTPUT_RESOURCE_DIR PREFIX "${LLVM_LIBRARY_OUTPUT_INTDIR}/..") - get_clang_resource_dir(FLANG_RT_INSTALL_RESOURCE_PATH_DEFAULT) - - extend_path(FLANG_RT_OUTPUT_RESOURCE_LIB_DIR "${FLANG_RT_OUTPUT_RESOURCE_DIR}" "${toolchain_lib_subdir}") -else () - # In a standalone runtimes build, do not write into LLVM_BINARY_DIR. It may be - # read-only and/or shared by multiple runtimes with different build - # configurations (e.g. Debug/Release). Use the runtime's own lib dir like any - # non-toolchain library. - # For the install prefix, still use the resource dir assuming that Flang will - # be installed there using the same prefix. This is to not have a difference - # between bootstrap and standalone runtimes builds. - set(FLANG_RT_OUTPUT_RESOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}") - set(FLANG_RT_INSTALL_RESOURCE_PATH_DEFAULT "lib${LLVM_LIBDIR_SUFFIX}/clang/${LLVM_VERSION_MAJOR}") - - extend_path(FLANG_RT_OUTPUT_RESOURCE_LIB_DIR "${FLANG_RT_OUTPUT_RESOURCE_DIR}" "lib${LLVM_LIBDIR_SUFFIX}") -endif () -set(FLANG_RT_INSTALL_RESOURCE_PATH "${FLANG_RT_INSTALL_RESOURCE_PATH_DEFAULT}" - CACHE PATH "Path to install runtime libraries to (default: clang resource dir)") -extend_path(FLANG_RT_INSTALL_RESOURCE_LIB_PATH "${FLANG_RT_INSTALL_RESOURCE_PATH}" "${toolchain_lib_subdir}") -cmake_path(NORMAL_PATH FLANG_RT_OUTPUT_RESOURCE_DIR) -cmake_path(NORMAL_PATH FLANG_RT_INSTALL_RESOURCE_PATH) -# FIXME: For the libflang_rt.so, the toolchain resource lib dir is not a good -# destination because it is not a ld.so default search path. -# The machine where the executable is eventually executed may not be the -# machine where the Flang compiler and its resource dir is installed, so -# setting RPath by the driver is not an solution. It should belong into -# /usr/lib/<triple>/libflang_rt.so, like e.g. libgcc_s.so. -# But the linker as invoked by the Flang driver also requires -# libflang_rt.so to be found when linking and the resource lib dir is -# the only reliable location. -cmake_path(NORMAL_PATH FLANG_RT_OUTPUT_RESOURCE_LIB_DIR) -cmake_path(NORMAL_PATH FLANG_RT_INSTALL_RESOURCE_LIB_PATH) - ################# # Build Options # diff --git a/flang-rt/cmake/modules/AddFlangRT.cmake b/flang-rt/cmake/modules/AddFlangRT.cmake index 923507764d691..e960e79473cbb 100644 --- a/flang-rt/cmake/modules/AddFlangRT.cmake +++ b/flang-rt/cmake/modules/AddFlangRT.cmake @@ -344,13 +344,13 @@ function (add_flangrt_library name) if (ARG_INSTALL_WITH_TOOLCHAIN) set_target_properties(${tgtname} PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY "${FLANG_RT_OUTPUT_RESOURCE_LIB_DIR}" - LIBRARY_OUTPUT_DIRECTORY "${FLANG_RT_OUTPUT_RESOURCE_LIB_DIR}" + ARCHIVE_OUTPUT_DIRECTORY "${RUNTIMES_OUTPUT_RESOURCE_LIB_DIR}" + LIBRARY_OUTPUT_DIRECTORY "${RUNTIMES_OUTPUT_RESOURCE_LIB_DIR}" ) install(TARGETS ${tgtname} - ARCHIVE DESTINATION "${FLANG_RT_INSTALL_RESOURCE_LIB_PATH}" - LIBRARY DESTINATION "${FLANG_RT_INSTALL_RESOURCE_LIB_PATH}" + ARCHIVE DESTINATION "${RUNTIMES_INSTALL_RESOURCE_LIB_PATH}" + LIBRARY DESTINATION "${RUNTIMES_INSTALL_RESOURCE_LIB_PATH}" ) endif () diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt index 5220b9353fed7..f76a3162c6eea 100644 --- a/runtimes/CMakeLists.txt +++ b/runtimes/CMakeLists.txt @@ -85,7 +85,8 @@ include(CheckLibraryExists) include(LLVMCheckCompilerLinkerFlag) include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) - +include(GetToolchainDirs) +include(ExtendPath) # Determine whether we are in the runtimes/runtimes-bins directory of a # bootstrap build. @@ -236,6 +237,36 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang") endif() endif() +# Determine output and install paths based on LLVM_TARGET_TRIPLE +if(LLVM_TREE_AVAILABLE) + # Despite Clang in the name, get_clang_resource_dir does not depend on Clang + # being added to the build. Flang uses the same resource dir as Clang. + include(GetClangResourceDir) + get_clang_resource_dir(RUNTIMES_OUTPUT_RESOURCE_DIR PREFIX "${LLVM_LIBRARY_OUTPUT_INTDIR}/..") + get_clang_resource_dir(RUNTIMES_INSTALL_RESOURCE_PATH_DEFAULT) +else() + # For the install prefix, still use the resource dir assuming the compilers + # looking for it (Clang, Flang) will be installed there using the same prefix. + # This is to not have a difference between bootstrapping and default/standalone runtimes + # builds. + set(RUNTIMES_OUTPUT_RESOURCE_DIR "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLVM_VERSION_MAJOR}") + set(RUNTIMES_INSTALL_RESOURCE_PATH_DEFAULT "lib${LLVM_LIBDIR_SUFFIX}/clang/${LLVM_VERSION_MAJOR}") +endif() + +# Determine build and install paths. The output paths are absolute, but the +# install dirs are relative to CMAKE_INSTALL_PREFIX to be resolved by CMake. +get_toolchain_library_subdir(toolchain_lib_subdir) +extend_path(RUNTIMES_OUTPUT_RESOURCE_LIB_DIR "${RUNTIMES_OUTPUT_RESOURCE_DIR}" "${toolchain_lib_subdir}") + +set(RUNTIMES_INSTALL_RESOURCE_PATH "${RUNTIMES_INSTALL_RESOURCE_PATH_DEFAULT}" CACHE PATH "Path to install headers, runtime libraries, and Fortran modules to (default: Clang resource dir)") +extend_path(RUNTIMES_INSTALL_RESOURCE_LIB_PATH "${RUNTIMES_INSTALL_RESOURCE_PATH}" "${toolchain_lib_subdir}") + +cmake_path(NORMAL_PATH RUNTIMES_OUTPUT_RESOURCE_DIR) +cmake_path(NORMAL_PATH RUNTIMES_INSTALL_RESOURCE_PATH) +cmake_path(NORMAL_PATH RUNTIMES_OUTPUT_RESOURCE_LIB_DIR) +cmake_path(NORMAL_PATH RUNTIMES_INSTALL_RESOURCE_LIB_PATH) + + option(LLVM_INCLUDE_TESTS "Generate build targets for the runtimes unit tests." ON) option(LLVM_INCLUDE_DOCS "Generate build targets for the runtimes documentation." ON) option(LLVM_ENABLE_SPHINX "Use Sphinx to generate the runtimes documentation." OFF) >From a3d2009626c9656721e6ad938dee0c25f9029281 Mon Sep 17 00:00:00 2001 From: Michael Kruse <[email protected]> Date: Mon, 26 Jan 2026 13:30:07 +0100 Subject: [PATCH 2/7] extract common code --- cmake/Modules/GetToolchainDirs.cmake | 42 ++++++++++------ .../cmake/Modules/CompilerRTUtils.cmake | 50 ++----------------- 2 files changed, 31 insertions(+), 61 deletions(-) diff --git a/cmake/Modules/GetToolchainDirs.cmake b/cmake/Modules/GetToolchainDirs.cmake index 21dffb40bf2ac..e7955e334cfe6 100644 --- a/cmake/Modules/GetToolchainDirs.cmake +++ b/cmake/Modules/GetToolchainDirs.cmake @@ -62,22 +62,17 @@ function (get_toolchain_os_dirname outvar) endfunction () -# Corresponds to Clang's ToolChain::getRuntimePath(). Adapted from Compiler-RT. -function (get_toolchain_arch_dirname outvar) - string(FIND ${LLVM_TARGET_TRIPLE} "-" dash_index) - string(SUBSTRING ${LLVM_TARGET_TRIPLE} ${dash_index} -1 triple_suffix) - string(SUBSTRING ${LLVM_TARGET_TRIPLE} 0 ${dash_index} triple_cpu) - set(arch "${triple_cpu}") - if("${arch}" MATCHES "^i.86$") - # Android uses i686, but that's remapped at a later stage. - set(arch "i386") - endif() - - if(ANDROID AND ${arch} STREQUAL "i386") +# Internal function extracted from compiler-rt. Use get_toolchain_arch_dirname +# instead for new code. +function(get_runtimes_target_libdir_common default_target_triple arch variable) + string(FIND "${default_target_triple}" "-" dash_index) + string(SUBSTRING "${default_target_triple}" ${dash_index} -1 triple_suffix) + string(SUBSTRING "${default_target_triple}" 0 ${dash_index} triple_cpu) + if(ANDROID AND "${arch}" STREQUAL "i386") set(target "i686${triple_suffix}") - elseif(${arch} STREQUAL "amd64") + elseif("${arch}" STREQUAL "amd64") set(target "x86_64${triple_suffix}") - elseif(${arch} STREQUAL "sparc64") + elseif("${arch}" STREQUAL "sparc64") set(target "sparcv9${triple_suffix}") elseif("${arch}" MATCHES "mips64|mips64el") string(REGEX REPLACE "-gnu.*" "-gnuabi64" triple_suffix_gnu "${triple_suffix}") @@ -91,7 +86,8 @@ function (get_toolchain_arch_dirname outvar) string(REGEX REPLACE "mips64" "mips" triple_cpu_mips "${triple_cpu_mips}") set(target "${triple_cpu_mips}${triple_suffix_gnu}") elseif("${arch}" MATCHES "^arm") - # FIXME: Handle arch other than arm, armhf, armv6m + # Arch is arm, armhf, armv6m (anything else would come from using + # COMPILER_RT_DEFAULT_TARGET_ONLY, which is checked above). if (${arch} STREQUAL "armhf") # If we are building for hard float but our ABI is soft float. if ("${triple_suffix}" MATCHES ".*eabi$") @@ -115,5 +111,19 @@ function (get_toolchain_arch_dirname outvar) else() set(target "${arch}${triple_suffix}") endif() - set(${outvar} "${target}" PARENT_SCOPE) + set("${variable}" "${target}" PARENT_SCOPE) +endfunction() + + +# Corresponds to Clang's ToolChain::getRuntimePath(). +function (get_toolchain_arch_dirname outvar) + string(FIND "${LLVM_TARGET_TRIPLE}" "-" dash_index) + string(SUBSTRING "${LLVM_TARGET_TRIPLE}" 0 ${dash_index} triple_cpu) + set(arch "${triple_cpu}") + if("${arch}" MATCHES "^i.86$") + # Android uses i686, but that's remapped at a later stage. + set(arch "i386") + endif() + get_runtimes_target_libdir("${LLVM_TARGET_TRIPLE}" "${arch}" target) + set("${outvar}" "${target}" PARENT_SCOPE) endfunction() diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake index cbd18d26c0b93..f97208430c855 100644 --- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake +++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake @@ -460,56 +460,16 @@ function(filter_builtin_sources inout_var name) endfunction() function(get_compiler_rt_target arch variable) - string(FIND ${COMPILER_RT_DEFAULT_TARGET_TRIPLE} "-" dash_index) - string(SUBSTRING ${COMPILER_RT_DEFAULT_TARGET_TRIPLE} ${dash_index} -1 triple_suffix) - string(SUBSTRING ${COMPILER_RT_DEFAULT_TARGET_TRIPLE} 0 ${dash_index} triple_cpu) if(COMPILER_RT_DEFAULT_TARGET_ONLY) # Use exact spelling when building only for the target specified to CMake. set(target "${COMPILER_RT_DEFAULT_TARGET_TRIPLE}") - elseif(ANDROID AND ${arch} STREQUAL "i386") - set(target "i686${triple_suffix}") - elseif(${arch} STREQUAL "amd64") - set(target "x86_64${triple_suffix}") - elseif(${arch} STREQUAL "sparc64") - set(target "sparcv9${triple_suffix}") - elseif("${arch}" MATCHES "mips64|mips64el") - string(REGEX REPLACE "-gnu.*" "-gnuabi64" triple_suffix_gnu "${triple_suffix}") - string(REGEX REPLACE "mipsisa32" "mipsisa64" triple_cpu_mips "${triple_cpu}") - string(REGEX REPLACE "^mips$" "mips64" triple_cpu_mips "${triple_cpu_mips}") - string(REGEX REPLACE "^mipsel$" "mips64el" triple_cpu_mips "${triple_cpu_mips}") - set(target "${triple_cpu_mips}${triple_suffix_gnu}") - elseif("${arch}" MATCHES "mips|mipsel") - string(REGEX REPLACE "-gnuabi.*" "-gnu" triple_suffix_gnu "${triple_suffix}") - string(REGEX REPLACE "mipsisa64" "mipsisa32" triple_cpu_mips "${triple_cpu}") - string(REGEX REPLACE "mips64" "mips" triple_cpu_mips "${triple_cpu_mips}") - set(target "${triple_cpu_mips}${triple_suffix_gnu}") - elseif("${arch}" MATCHES "^arm") - # Arch is arm, armhf, armv6m (anything else would come from using - # COMPILER_RT_DEFAULT_TARGET_ONLY, which is checked above). - if (${arch} STREQUAL "armhf") - # If we are building for hard float but our ABI is soft float. - if ("${triple_suffix}" MATCHES ".*eabi$") - # Change "eabi" -> "eabihf" - set(triple_suffix "${triple_suffix}hf") - endif() - # ABI is already set in the triple, don't repeat it in the architecture. - set(arch "arm") - else () - # If we are building for soft float, but the triple's ABI is hard float. - if ("${triple_suffix}" MATCHES ".*eabihf$") - # Change "eabihf" -> "eabi" - string(REGEX REPLACE "hf$" "" triple_suffix "${triple_suffix}") - endif() - endif() - set(target "${arch}${triple_suffix}") - elseif("${arch}" MATCHES "^amdgcn") - set(target "amdgcn-amd-amdhsa") - elseif("${arch}" MATCHES "^nvptx") - set(target "nvptx64-nvidia-cuda") else() - set(target "${arch}${triple_suffix}") + string(FIND ${default_target_triple} "-" dash_index) + string(SUBSTRING ${default_target_triple} ${dash_index} -1 triple_suffix) + string(SUBSTRING ${default_target_triple} 0 ${dash_index} triple_cpu) + get_runtimes_target_libdir_common("${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" "${arch}" result) endif() - set(${variable} ${target} PARENT_SCOPE) + set(${variable} "${result}" PARENT_SCOPE) endfunction() function(get_compiler_rt_install_dir arch install_dir) >From a675c9aa2f847877e7a430a59ec28ece56896189 Mon Sep 17 00:00:00 2001 From: Michael Kruse <[email protected]> Date: Mon, 26 Jan 2026 14:02:18 +0100 Subject: [PATCH 3/7] Add TODO comments --- compiler-rt/cmake/Modules/CompilerRTUtils.cmake | 2 ++ compiler-rt/cmake/base-config-ix.cmake | 2 ++ libc/CMakeLists.txt | 2 ++ libcxx/CMakeLists.txt | 1 + libcxxabi/CMakeLists.txt | 1 + libsycl/CMakeLists.txt | 1 + libunwind/CMakeLists.txt | 1 + llvm-libgcc/CMakeLists.txt | 1 + offload/CMakeLists.txt | 3 +++ openmp/CMakeLists.txt | 1 + orc-rt/lib/executor/CMakeLists.txt | 1 + third-party/benchmark/src/CMakeLists.txt | 1 + 12 files changed, 17 insertions(+) diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake index f97208430c855..80bd14597a642 100644 --- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake +++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake @@ -473,6 +473,7 @@ function(get_compiler_rt_target arch variable) endfunction() function(get_compiler_rt_install_dir arch install_dir) + # TODO: Use RUNTIMES_INSTALL_RESOURCE_LIB_PATH instead if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) get_compiler_rt_target(${arch} target) set(${install_dir} ${COMPILER_RT_INSTALL_LIBRARY_DIR}/${target} PARENT_SCOPE) @@ -482,6 +483,7 @@ function(get_compiler_rt_install_dir arch install_dir) endfunction() function(get_compiler_rt_output_dir arch output_dir) + # TODO: Use RUNTIMES_OUTPUT_RESOURCE_LIB_DIR instead if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) get_compiler_rt_target(${arch} target) set(${output_dir} ${COMPILER_RT_OUTPUT_LIBRARY_DIR}/${target} PARENT_SCOPE) diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake index 37dfa5534dfef..845f999192079 100644 --- a/compiler-rt/cmake/base-config-ix.cmake +++ b/compiler-rt/cmake/base-config-ix.cmake @@ -103,6 +103,8 @@ if(NOT DEFINED COMPILER_RT_OS_DIR) string(TOLOWER ${CMAKE_SYSTEM_NAME} COMPILER_RT_OS_DIR) endif() endif() + +# TODO: Use RUNTIMES_OUTPUT_RESOURCE_*_DIR/RUNTIMES_INSTALL_RESOURCE_*_PATH instead if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(COMPILER_RT_OUTPUT_LIBRARY_DIR ${COMPILER_RT_OUTPUT_DIR}/lib) diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt index 4e6b4195a9c5e..334717d68d4ec 100644 --- a/libc/CMakeLists.txt +++ b/libc/CMakeLists.txt @@ -234,6 +234,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR) cmake_path(NORMAL_PATH LIBC_TARGET_SUBDIR) endif() +# TODO: Use RUNTIMES_OUTPUT_RESOURCE_*_DIR/RUNTIMES_INSTALL_RESOURCE_*_PATH instead if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND (LIBC_ENABLE_USE_BY_CLANG OR LIBC_TARGET_OS_IS_GPU)) set(LIBC_INCLUDE_DIR ${LLVM_BINARY_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}) set(LIBC_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}) @@ -260,6 +261,7 @@ else() endif() endif() +# TODO: Use RUNTIMES_INSTALL_RESOURCE_LIB_PATH instead if(LIBC_TARGET_TRIPLE) set(LIBC_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LIBC_TARGET_TRIPLE}) elseif(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR) diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index 56b346415c1c6..98fdd3e35ddf0 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -421,6 +421,7 @@ set(LIBCXX_INSTALL_MODULES_DIR "share/libc++/v1" CACHE STRING set(LIBCXX_SHARED_OUTPUT_NAME "c++" CACHE STRING "Output name for the shared libc++ runtime library.") set(LIBCXX_STATIC_OUTPUT_NAME "c++" CACHE STRING "Output name for the static libc++ runtime library.") +# TODO: Use RUNTIMES_OUTPUT_RESOURCE_*_DIR/RUNTIMES_INSTALL_RESOURCE_*_PATH instead if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(LIBCXX_TARGET_SUBDIR ${LLVM_DEFAULT_TARGET_TRIPLE}) if(LIBCXX_LIBDIR_SUBDIR) diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt index 2b67c5972339e..246c2ad97eacf 100644 --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -185,6 +185,7 @@ set(CMAKE_MODULE_PATH set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING "Path where built libc++abi runtime libraries should be installed.") +# TODO: Use RUNTIMES_OUTPUT_RESOURCE_*_DIR/RUNTIMES_INSTALL_RESOURCE_*_PATH instead if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(LIBCXXABI_TARGET_SUBDIR ${LLVM_DEFAULT_TARGET_TRIPLE}) if(LIBCXXABI_LIBDIR_SUBDIR) diff --git a/libsycl/CMakeLists.txt b/libsycl/CMakeLists.txt index fe08a4249bada..c96095a39dc92 100644 --- a/libsycl/CMakeLists.txt +++ b/libsycl/CMakeLists.txt @@ -39,6 +39,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) set(LIBSYCL_SHARED_OUTPUT_NAME "sycl" CACHE STRING "Output name for the shared libsycl runtime library.") +# TODO: Use RUNTIMES_OUTPUT_RESOURCE_*_DIR/RUNTIMES_INSTALL_RESOURCE_*_PATH instead if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(LIBSYCL_TARGET_SUBDIR ${LLVM_DEFAULT_TARGET_TRIPLE}) if(LIBSYCL_LIBDIR_SUBDIR) diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt index fbef71f3f7446..cf7b43d7d8276 100644 --- a/libunwind/CMakeLists.txt +++ b/libunwind/CMakeLists.txt @@ -140,6 +140,7 @@ set(LIBUNWIND_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING set(LIBUNWIND_SHARED_OUTPUT_NAME "unwind" CACHE STRING "Output name for the shared libunwind runtime library.") set(LIBUNWIND_STATIC_OUTPUT_NAME "unwind" CACHE STRING "Output name for the static libunwind runtime library.") +# TODO: Use RUNTIMES_OUTPUT_RESOURCE_*_DIR/RUNTIMES_INSTALL_RESOURCE_*_PATH instead if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(LIBUNWIND_TARGET_SUBDIR ${LLVM_DEFAULT_TARGET_TRIPLE}) if(LIBUNWIND_LIBDIR_SUBDIR) diff --git a/llvm-libgcc/CMakeLists.txt b/llvm-libgcc/CMakeLists.txt index 47208fc198692..ef4b9060e6d74 100644 --- a/llvm-libgcc/CMakeLists.txt +++ b/llvm-libgcc/CMakeLists.txt @@ -61,6 +61,7 @@ endif() # Configure System #=============================================================================== +# TODO: Use RUNTIMES_OUTPUT_RESOURCE_*_DIR/RUNTIMES_INSTALL_RESOURCE_*_PATH instead if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(TARGET_SUBDIR ${LLVM_DEFAULT_TARGET_TRIPLE}) if(LLVM_LIBGCC_LIBDIR_SUBDIR) diff --git a/offload/CMakeLists.txt b/offload/CMakeLists.txt index 81e246d9f8892..a6e3234a22938 100644 --- a/offload/CMakeLists.txt +++ b/offload/CMakeLists.txt @@ -26,6 +26,7 @@ endif() set(OFFLOAD_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +# TODO: Use RUNTIMES_INSTALL_RESOURCE_LIB_PATH instead if(OPENMP_STANDALONE_BUILD) set(OFFLOAD_LIBDIR_SUFFIX "" CACHE STRING "Suffix of lib installation directory, e.g. 64 => lib64") @@ -87,6 +88,7 @@ if (OPENMP_STANDALONE_BUILD) else() set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR}) # If building in tree, we honor the same install suffix LLVM uses. + # TODO: Use RUNTIMES_INSTALL_RESOURCE_LIB_PATH instead set(OPENMP_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}") if (NOT MSVC) @@ -376,6 +378,7 @@ if(LIBOMP_OMP_TOOLS_INCLUDE_DIR) include_directories(${LIBOMP_OMP_TOOLS_INCLUDE_DIR}) endif() +# TODO: Use RUNTIMES_OUTPUT_RESOURCE_LIB_DIR instead set(LIBOMPTARGET_LLVM_LIBRARY_DIR "${LLVM_LIBRARY_DIR}" CACHE STRING "Path to folder containing llvm library libomptarget.so") set(LIBOMPTARGET_LLVM_LIBRARY_INTDIR "${LIBOMPTARGET_INTDIR}" CACHE STRING diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt index df568419824a6..8be4bb5d190f9 100644 --- a/openmp/CMakeLists.txt +++ b/openmp/CMakeLists.txt @@ -63,6 +63,7 @@ else() set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR}) # When building in tree we install the runtime according to the LLVM settings. + # TODO: Use RUNTIMES_INSTALL_RESOURCE_LIB_PATH instead if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(OPENMP_INSTALL_LIBDIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE STRING "Path where built openmp libraries should be installed.") diff --git a/orc-rt/lib/executor/CMakeLists.txt b/orc-rt/lib/executor/CMakeLists.txt index cca5246b4d127..ba070af21e0c4 100644 --- a/orc-rt/lib/executor/CMakeLists.txt +++ b/orc-rt/lib/executor/CMakeLists.txt @@ -16,6 +16,7 @@ target_link_libraries(orc-rt-executor ) # Apply RTTI and exceptions compile flags +# TODO: Use RUNTIMES_INSTALL_RESOURCE_LIB_PATH instead target_compile_options(orc-rt-executor PRIVATE ${ORC_RT_COMPILE_FLAGS}) install(TARGETS orc-rt-executor ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/third-party/benchmark/src/CMakeLists.txt b/third-party/benchmark/src/CMakeLists.txt index 0357dcce3f831..a291f1f904043 100644 --- a/third-party/benchmark/src/CMakeLists.txt +++ b/third-party/benchmark/src/CMakeLists.txt @@ -114,6 +114,7 @@ export ( if (BENCHMARK_ENABLE_INSTALL) # Install target (will install the library to specified CMAKE_INSTALL_PREFIX variable) + # TODO: Use RUNTIMES_INSTALL_RESOURCE_LIB_PATH instead install( TARGETS ${targets_to_export} EXPORT ${targets_export_name} >From fcdc6b40d0b55ba02de128f11185ec53d673ea22 Mon Sep 17 00:00:00 2001 From: Michael Kruse <[email protected]> Date: Mon, 26 Jan 2026 14:57:47 +0100 Subject: [PATCH 4/7] Add include for standalone build --- cmake/Modules/GetToolchainDirs.cmake | 4 +++- compiler-rt/cmake/Modules/CompilerRTUtils.cmake | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/Modules/GetToolchainDirs.cmake b/cmake/Modules/GetToolchainDirs.cmake index e7955e334cfe6..a16492fda0146 100644 --- a/cmake/Modules/GetToolchainDirs.cmake +++ b/cmake/Modules/GetToolchainDirs.cmake @@ -65,7 +65,9 @@ endfunction () # Internal function extracted from compiler-rt. Use get_toolchain_arch_dirname # instead for new code. function(get_runtimes_target_libdir_common default_target_triple arch variable) +message(" string(FIND "${default_target_triple}" "-" dash_index)") string(FIND "${default_target_triple}" "-" dash_index) +message("string(SUBSTRING "${default_target_triple}" ${dash_index} -1 triple_suffix)") string(SUBSTRING "${default_target_triple}" ${dash_index} -1 triple_suffix) string(SUBSTRING "${default_target_triple}" 0 ${dash_index} triple_cpu) if(ANDROID AND "${arch}" STREQUAL "i386") @@ -124,6 +126,6 @@ function (get_toolchain_arch_dirname outvar) # Android uses i686, but that's remapped at a later stage. set(arch "i386") endif() - get_runtimes_target_libdir("${LLVM_TARGET_TRIPLE}" "${arch}" target) + get_runtimes_target_libdir_common("${LLVM_TARGET_TRIPLE}" "${arch}" target) set("${outvar}" "${target}" PARENT_SCOPE) endfunction() diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake index 80bd14597a642..5d0ce55e44a6d 100644 --- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake +++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake @@ -1,5 +1,6 @@ include(CMakePushCheckState) include(CheckSymbolExists) +include(GetToolchainDirs) # Because compiler-rt spends a lot of time setting up custom compile flags, # define a handy helper function for it. The compile flags setting in CMake @@ -464,9 +465,6 @@ function(get_compiler_rt_target arch variable) # Use exact spelling when building only for the target specified to CMake. set(target "${COMPILER_RT_DEFAULT_TARGET_TRIPLE}") else() - string(FIND ${default_target_triple} "-" dash_index) - string(SUBSTRING ${default_target_triple} ${dash_index} -1 triple_suffix) - string(SUBSTRING ${default_target_triple} 0 ${dash_index} triple_cpu) get_runtimes_target_libdir_common("${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" "${arch}" result) endif() set(${variable} "${result}" PARENT_SCOPE) >From d51726e19752c1ac9436d85daf693a0de2c42cd8 Mon Sep 17 00:00:00 2001 From: Michael Kruse <[email protected]> Date: Mon, 26 Jan 2026 23:28:17 +0100 Subject: [PATCH 5/7] Try fix PR --- compiler-rt/cmake/Modules/CompilerRTUtils.cmake | 4 ++-- compiler-rt/cmake/base-config-ix.cmake | 2 +- libc/CMakeLists.txt | 4 ++-- libcxx/CMakeLists.txt | 2 +- libcxxabi/CMakeLists.txt | 2 +- libsycl/CMakeLists.txt | 2 +- libunwind/CMakeLists.txt | 2 +- llvm-libgcc/CMakeLists.txt | 2 +- offload/CMakeLists.txt | 4 ++-- openmp/CMakeLists.txt | 3 ++- orc-rt/lib/executor/CMakeLists.txt | 2 +- third-party/benchmark/src/CMakeLists.txt | 1 - 12 files changed, 15 insertions(+), 15 deletions(-) diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake index 5d0ce55e44a6d..8c27c4585f73b 100644 --- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake +++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake @@ -465,9 +465,9 @@ function(get_compiler_rt_target arch variable) # Use exact spelling when building only for the target specified to CMake. set(target "${COMPILER_RT_DEFAULT_TARGET_TRIPLE}") else() - get_runtimes_target_libdir_common("${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" "${arch}" result) + get_runtimes_target_libdir_common("${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" "${arch}" target) endif() - set(${variable} "${result}" PARENT_SCOPE) + set(${variable} "${target}" PARENT_SCOPE) endfunction() function(get_compiler_rt_install_dir arch install_dir) diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake index 845f999192079..d4abf80faa73a 100644 --- a/compiler-rt/cmake/base-config-ix.cmake +++ b/compiler-rt/cmake/base-config-ix.cmake @@ -104,7 +104,7 @@ if(NOT DEFINED COMPILER_RT_OS_DIR) endif() endif() -# TODO: Use RUNTIMES_OUTPUT_RESOURCE_*_DIR/RUNTIMES_INSTALL_RESOURCE_*_PATH instead +# TODO: Use common runtimes infrastructure for output and install paths if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(COMPILER_RT_OUTPUT_LIBRARY_DIR ${COMPILER_RT_OUTPUT_DIR}/lib) diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt index 334717d68d4ec..2988a42b5d3a3 100644 --- a/libc/CMakeLists.txt +++ b/libc/CMakeLists.txt @@ -234,7 +234,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR) cmake_path(NORMAL_PATH LIBC_TARGET_SUBDIR) endif() -# TODO: Use RUNTIMES_OUTPUT_RESOURCE_*_DIR/RUNTIMES_INSTALL_RESOURCE_*_PATH instead +# TODO: Use common runtimes infrastructure for output and install paths if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND (LIBC_ENABLE_USE_BY_CLANG OR LIBC_TARGET_OS_IS_GPU)) set(LIBC_INCLUDE_DIR ${LLVM_BINARY_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}) set(LIBC_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}) @@ -261,7 +261,7 @@ else() endif() endif() -# TODO: Use RUNTIMES_INSTALL_RESOURCE_LIB_PATH instead +# TODO: Use common runtimes infrastructure for output and install paths if(LIBC_TARGET_TRIPLE) set(LIBC_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LIBC_TARGET_TRIPLE}) elseif(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR) diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index 98fdd3e35ddf0..4d7e3a69e3ae9 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -421,7 +421,7 @@ set(LIBCXX_INSTALL_MODULES_DIR "share/libc++/v1" CACHE STRING set(LIBCXX_SHARED_OUTPUT_NAME "c++" CACHE STRING "Output name for the shared libc++ runtime library.") set(LIBCXX_STATIC_OUTPUT_NAME "c++" CACHE STRING "Output name for the static libc++ runtime library.") -# TODO: Use RUNTIMES_OUTPUT_RESOURCE_*_DIR/RUNTIMES_INSTALL_RESOURCE_*_PATH instead +# TODO: Use common runtimes infrastructure for output and install paths if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(LIBCXX_TARGET_SUBDIR ${LLVM_DEFAULT_TARGET_TRIPLE}) if(LIBCXX_LIBDIR_SUBDIR) diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt index 246c2ad97eacf..e1a1587fb6283 100644 --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -185,7 +185,7 @@ set(CMAKE_MODULE_PATH set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING "Path where built libc++abi runtime libraries should be installed.") -# TODO: Use RUNTIMES_OUTPUT_RESOURCE_*_DIR/RUNTIMES_INSTALL_RESOURCE_*_PATH instead +# TODO: Use common runtimes infrastructure for output and install paths if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(LIBCXXABI_TARGET_SUBDIR ${LLVM_DEFAULT_TARGET_TRIPLE}) if(LIBCXXABI_LIBDIR_SUBDIR) diff --git a/libsycl/CMakeLists.txt b/libsycl/CMakeLists.txt index c96095a39dc92..8611814baa3b1 100644 --- a/libsycl/CMakeLists.txt +++ b/libsycl/CMakeLists.txt @@ -39,7 +39,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) set(LIBSYCL_SHARED_OUTPUT_NAME "sycl" CACHE STRING "Output name for the shared libsycl runtime library.") -# TODO: Use RUNTIMES_OUTPUT_RESOURCE_*_DIR/RUNTIMES_INSTALL_RESOURCE_*_PATH instead +# TODO: Use common runtimes infrastructure for output and install paths if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(LIBSYCL_TARGET_SUBDIR ${LLVM_DEFAULT_TARGET_TRIPLE}) if(LIBSYCL_LIBDIR_SUBDIR) diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt index cf7b43d7d8276..1681b90b31cdb 100644 --- a/libunwind/CMakeLists.txt +++ b/libunwind/CMakeLists.txt @@ -140,7 +140,7 @@ set(LIBUNWIND_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING set(LIBUNWIND_SHARED_OUTPUT_NAME "unwind" CACHE STRING "Output name for the shared libunwind runtime library.") set(LIBUNWIND_STATIC_OUTPUT_NAME "unwind" CACHE STRING "Output name for the static libunwind runtime library.") -# TODO: Use RUNTIMES_OUTPUT_RESOURCE_*_DIR/RUNTIMES_INSTALL_RESOURCE_*_PATH instead +# TODO: Use common runtimes infrastructure for output and install paths if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(LIBUNWIND_TARGET_SUBDIR ${LLVM_DEFAULT_TARGET_TRIPLE}) if(LIBUNWIND_LIBDIR_SUBDIR) diff --git a/llvm-libgcc/CMakeLists.txt b/llvm-libgcc/CMakeLists.txt index ef4b9060e6d74..55c052165dbd1 100644 --- a/llvm-libgcc/CMakeLists.txt +++ b/llvm-libgcc/CMakeLists.txt @@ -61,7 +61,7 @@ endif() # Configure System #=============================================================================== -# TODO: Use RUNTIMES_OUTPUT_RESOURCE_*_DIR/RUNTIMES_INSTALL_RESOURCE_*_PATH instead +# TODO: Use common runtimes infrastructure for output and install paths if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(TARGET_SUBDIR ${LLVM_DEFAULT_TARGET_TRIPLE}) if(LLVM_LIBGCC_LIBDIR_SUBDIR) diff --git a/offload/CMakeLists.txt b/offload/CMakeLists.txt index a6e3234a22938..4012f356fa746 100644 --- a/offload/CMakeLists.txt +++ b/offload/CMakeLists.txt @@ -26,7 +26,7 @@ endif() set(OFFLOAD_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -# TODO: Use RUNTIMES_INSTALL_RESOURCE_LIB_PATH instead +# TODO: Use common runtimes infrastructure for output and install paths if(OPENMP_STANDALONE_BUILD) set(OFFLOAD_LIBDIR_SUFFIX "" CACHE STRING "Suffix of lib installation directory, e.g. 64 => lib64") @@ -88,7 +88,7 @@ if (OPENMP_STANDALONE_BUILD) else() set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR}) # If building in tree, we honor the same install suffix LLVM uses. - # TODO: Use RUNTIMES_INSTALL_RESOURCE_LIB_PATH instead + # TODO: Use common runtimes infrastructure for output and install paths set(OPENMP_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}") if (NOT MSVC) diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt index 8be4bb5d190f9..332d9c1d5ce03 100644 --- a/openmp/CMakeLists.txt +++ b/openmp/CMakeLists.txt @@ -35,6 +35,7 @@ if (OPENMP_STANDALONE_BUILD) set(OPENMP_LIBDIR_SUFFIX "" CACHE STRING "Suffix of lib installation directory, e.g. 64 => lib64") # Do not use OPENMP_LIBDIR_SUFFIX directly, use OPENMP_INSTALL_LIBDIR. + # TODO: Use common runtimes infrastructure for output and install paths set(OPENMP_INSTALL_LIBDIR "lib${OPENMP_LIBDIR_SUFFIX}" CACHE STRING "Path where built OpenMP libraries should be installed.") @@ -63,7 +64,7 @@ else() set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR}) # When building in tree we install the runtime according to the LLVM settings. - # TODO: Use RUNTIMES_INSTALL_RESOURCE_LIB_PATH instead + # TODO: Use common runtimes infrastructure for output and install paths if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(OPENMP_INSTALL_LIBDIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE STRING "Path where built openmp libraries should be installed.") diff --git a/orc-rt/lib/executor/CMakeLists.txt b/orc-rt/lib/executor/CMakeLists.txt index ba070af21e0c4..b7db13b3d2b47 100644 --- a/orc-rt/lib/executor/CMakeLists.txt +++ b/orc-rt/lib/executor/CMakeLists.txt @@ -16,7 +16,7 @@ target_link_libraries(orc-rt-executor ) # Apply RTTI and exceptions compile flags -# TODO: Use RUNTIMES_INSTALL_RESOURCE_LIB_PATH instead +# TODO: Use common runtimes infrastructure for output and install paths target_compile_options(orc-rt-executor PRIVATE ${ORC_RT_COMPILE_FLAGS}) install(TARGETS orc-rt-executor ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/third-party/benchmark/src/CMakeLists.txt b/third-party/benchmark/src/CMakeLists.txt index a291f1f904043..0357dcce3f831 100644 --- a/third-party/benchmark/src/CMakeLists.txt +++ b/third-party/benchmark/src/CMakeLists.txt @@ -114,7 +114,6 @@ export ( if (BENCHMARK_ENABLE_INSTALL) # Install target (will install the library to specified CMAKE_INSTALL_PREFIX variable) - # TODO: Use RUNTIMES_INSTALL_RESOURCE_LIB_PATH instead install( TARGETS ${targets_to_export} EXPORT ${targets_export_name} >From 443e4e8cd80e35ad13b34798eccc21485c8ef458 Mon Sep 17 00:00:00 2001 From: Michael Kruse <[email protected]> Date: Tue, 27 Jan 2026 10:42:51 +0100 Subject: [PATCH 6/7] Address review comments by @petrhosek --- cmake/Modules/GetToolchainDirs.cmake | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/cmake/Modules/GetToolchainDirs.cmake b/cmake/Modules/GetToolchainDirs.cmake index a16492fda0146..cdc00f6867dd8 100644 --- a/cmake/Modules/GetToolchainDirs.cmake +++ b/cmake/Modules/GetToolchainDirs.cmake @@ -39,7 +39,7 @@ endfunction () # Corresponds to Flang's ToolChain::getDefaultIntrinsicModuleDir(). -function (get_toolchain_module_subdir outvar) +function (get_toolchain_fortran_module_subdir outvar) set(outval "finclude/flang") get_toolchain_arch_dirname(arch_dirname) @@ -65,11 +65,9 @@ endfunction () # Internal function extracted from compiler-rt. Use get_toolchain_arch_dirname # instead for new code. function(get_runtimes_target_libdir_common default_target_triple arch variable) -message(" string(FIND "${default_target_triple}" "-" dash_index)") string(FIND "${default_target_triple}" "-" dash_index) -message("string(SUBSTRING "${default_target_triple}" ${dash_index} -1 triple_suffix)") - string(SUBSTRING "${default_target_triple}" ${dash_index} -1 triple_suffix) - string(SUBSTRING "${default_target_triple}" 0 ${dash_index} triple_cpu) + string(SUBSTRING "${default_target_triple}" "${dash_index}" -1 triple_suffix) + string(SUBSTRING "${default_target_triple}" 0 "${dash_index}" triple_cpu) if(ANDROID AND "${arch}" STREQUAL "i386") set(target "i686${triple_suffix}") elseif("${arch}" STREQUAL "amd64") @@ -120,10 +118,9 @@ endfunction() # Corresponds to Clang's ToolChain::getRuntimePath(). function (get_toolchain_arch_dirname outvar) string(FIND "${LLVM_TARGET_TRIPLE}" "-" dash_index) - string(SUBSTRING "${LLVM_TARGET_TRIPLE}" 0 ${dash_index} triple_cpu) + string(SUBSTRING "${LLVM_TARGET_TRIPLE}" 0 "${dash_index}" triple_cpu) set(arch "${triple_cpu}") if("${arch}" MATCHES "^i.86$") - # Android uses i686, but that's remapped at a later stage. set(arch "i386") endif() get_runtimes_target_libdir_common("${LLVM_TARGET_TRIPLE}" "${arch}" target) >From 4282e1654be2cc36a479d3da3dbecfe167f5b29b Mon Sep 17 00:00:00 2001 From: Michael Kruse <[email protected]> Date: Tue, 27 Jan 2026 12:47:42 +0100 Subject: [PATCH 7/7] Unbreak test --- flang-rt/test/lit.site.cfg.py.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flang-rt/test/lit.site.cfg.py.in b/flang-rt/test/lit.site.cfg.py.in index 662d076b1fe24..0e9dc08b59925 100644 --- a/flang-rt/test/lit.site.cfg.py.in +++ b/flang-rt/test/lit.site.cfg.py.in @@ -6,7 +6,7 @@ config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" config.flang_source_dir = "@FLANG_SOURCE_DIR@" config.flang_rt_source_dir = "@FLANG_RT_SOURCE_DIR@" config.flang_rt_binary_test_dir = os.path.dirname(__file__) -config.flang_rt_output_resource_lib_dir = "@FLANG_RT_OUTPUT_RESOURCE_LIB_DIR@" +config.flang_rt_output_resource_lib_dir = "@RUNTIMES_OUTPUT_RESOURCE_LIB_DIR@" config.flang_rt_experimental_offload_support = "@FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT@" config.cc = "@CMAKE_C_COMPILER@" config.flang = "@CMAKE_Fortran_COMPILER@" _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
