[libc-commits] [libc] 5fa47d8 - [libc] Support multilib with runtimes build (#115357)
via libc-commits
libc-commits at lists.llvm.org
Tue Nov 12 19:16:32 PST 2024
Author: Petr Hosek
Date: 2024-11-12T19:16:27-08:00
New Revision: 5fa47d8c52fa7449cc9f68cf314681f755df34bc
URL: https://github.com/llvm/llvm-project/commit/5fa47d8c52fa7449cc9f68cf314681f755df34bc
DIFF: https://github.com/llvm/llvm-project/commit/5fa47d8c52fa7449cc9f68cf314681f755df34bc.diff
LOG: [libc] Support multilib with runtimes build (#115357)
This adds minimal support for multilibs akin to libc++.
Added:
Modified:
libc/CMakeLists.txt
llvm/runtimes/CMakeLists.txt
Removed:
################################################################################
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index c393d23a3b33d4..77b659b2ef2322 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -248,10 +248,17 @@ foreach(config_path IN LISTS LIBC_CONFIG_JSON_FILE_LIST)
load_libc_config(${config_path}/config.json ${cmd_line_conf})
endforeach()
+if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
+ set(LIBC_TARGET_SUBDIR ${LLVM_DEFAULT_TARGET_TRIPLE})
+ if(LIBC_LIBDIR_SUBDIR)
+ string(APPEND LIBC_TARGET_SUBDIR /${LIBC_LIBDIR_SUBDIR})
+ endif()
+endif()
+
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})
- set(LIBC_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
+ set(LIBC_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LIBC_TARGET_SUBDIR})
else()
if(NOT LIBC_ENABLE_USE_BY_CLANG)
set(LIBC_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include)
@@ -277,8 +284,7 @@ endif()
if(LIBC_TARGET_TRIPLE)
set(LIBC_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LIBC_TARGET_TRIPLE})
elseif(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
- set(LIBC_INSTALL_LIBRARY_DIR
- lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE})
+ set(LIBC_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LIBC_TARGET_SUBDIR})
else()
set(LIBC_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX})
endif()
diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 9da1f926817a8b..57a56c6a604153 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -635,6 +635,7 @@ if(build_runtimes)
CMAKE_ARGS -DLLVM_DEFAULT_TARGET_TRIPLE=${name}
-DLLVM_RUNTIMES_PREFIX=${name}/
-DLLVM_RUNTIMES_LIBDIR_SUBDIR=${multilib}
+ ${extra_cmake_args}
BASE_NAME ${name}
EXTRA_ARGS TARGET_TRIPLE ${name})
endforeach()
More information about the libc-commits
mailing list