[libc-commits] [libc] [llvm] [libc] Support multilib with runtimes build (PR #115357)
Petr Hosek via libc-commits
libc-commits at lists.llvm.org
Thu Nov 7 10:30:33 PST 2024
https://github.com/petrhosek created https://github.com/llvm/llvm-project/pull/115357
This adds minimal support for multilibs akin to libc++.
>From 43adb0909063ccab9b1ffed89ec476ab3b6ff16c Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek at google.com>
Date: Thu, 7 Nov 2024 10:28:24 -0800
Subject: [PATCH] [libc] Support multilib with runtimes build
This adds minimal support for multilibs akin to libc++.
---
libc/CMakeLists.txt | 12 +++++++++---
llvm/runtimes/CMakeLists.txt | 1 +
2 files changed, 10 insertions(+), 3 deletions(-)
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