diff options
author | Siva Chandra Reddy <sivachandra@google.com> | 2022-12-17 00:04:23 +0000 |
---|---|---|
committer | Siva Chandra Reddy <sivachandra@google.com> | 2022-12-20 00:33:35 +0000 |
commit | 4f9c10eb48a3725ecfd844d44ccf3068fbadbb85 (patch) | |
tree | 390b3d16b65324839ee10a57a32174c6d8acb33a /libc/CMakeLists.txt | |
parent | ee3d9ee49c2ea08ea40b95d2e6159a027740c1aa (diff) | |
download | llvm-4f9c10eb48a3725ecfd844d44ccf3068fbadbb85.tar.gz |
[libc] Add support for standalone cross compilation of libc.
One should be able to do a cross build of the libc now. For example, using
clang on a x86_64 linux host, one can build for an aarch64 linux target by
specifying -DLIBC_TARGET_TRIPLE=aarch64-linux-gnu.
Follow up changes will add a baremetal config and also appropriate
documentation about cross compiling the libc for CPU targets.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D140351
Diffstat (limited to 'libc/CMakeLists.txt')
-rw-r--r-- | libc/CMakeLists.txt | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt index fa0ce829a168..8eb45838f954 100644 --- a/libc/CMakeLists.txt +++ b/libc/CMakeLists.txt @@ -55,17 +55,18 @@ option(LLVM_LIBC_FULL_BUILD "Build and test LLVM libc as if it is the full libc" option(LLVM_LIBC_IMPLEMENTATION_DEFINED_TEST_BEHAVIOR "Build LLVM libc tests assuming our implementation-defined behavior" ON) option(LLVM_LIBC_ENABLE_LINTING "Enables linting of libc source files" OFF) -set(LLVM_LIBC_TARGET_OS ${CMAKE_SYSTEM_NAME} CACHE STRING "Target operating system for LLVM libc") -string(TOLOWER ${LLVM_LIBC_TARGET_OS} LIBC_TARGET_OS) +option(LIBC_GPU_BUILD "Build libc for the GPU. All CPU build options will be ignored." OFF) +set(LIBC_TARGET_TRIPLE "" CACHE STRING "The target triple for the libc build.") # Defines LIBC_TARGET_ARCHITECTURE and associated macros. include(LLVMLibCArchitectures) -include(LLVMLibCCheckMPFR) if(LIBC_TARGET_ARCHITECTURE_IS_GPU) include(prepare_libc_gpu_build) endif() +include(LLVMLibCCheckMPFR) + if(LLVM_LIBC_CLANG_TIDY) set(LLVM_LIBC_ENABLE_LINTING ON) endif() |