[libc-commits] [libc] 4fafa39 - [libc] Add an option to make `libc` only build the `libc-hdrgen` tool

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Mon May 22 20:25:05 PDT 2023


Author: Joseph Huber
Date: 2023-05-22T22:24:57-05:00
New Revision: 4fafa39b76b8e11960a75d7b15d762840330ecbf

URL: https://github.com/llvm/llvm-project/commit/4fafa39b76b8e11960a75d7b15d762840330ecbf
DIFF: https://github.com/llvm/llvm-project/commit/4fafa39b76b8e11960a75d7b15d762840330ecbf.diff

LOG: [libc] Add an option to make `libc` only build the `libc-hdrgen` tool

The `libc-hdergen` tool is required for cross-builds, however some cases
can cause issues when configuring this build. This patch adds an
ovveride option `LIBC_HDRGEN_ONLY` to allow us to retain the old
(incorrect) behaviour where `libc` would not build with any other
runtimes enabled.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D151155

Added: 
    

Modified: 
    libc/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 62bfee9f089a..80e9ead40db6 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -28,7 +28,9 @@ if(LLVM_LIBC_FULL_BUILD OR LIBC_GPU_BUILD OR LIBC_GPU_ARCHITECTURES)
   endif()
 endif()
 
-if("libc" IN_LIST LLVM_ENABLE_RUNTIMES AND NOT LLVM_RUNTIMES_BUILD)
+option(LIBC_HDRGEN_ONLY "Only build the 'libc-hdrgen' executable" OFF)
+if(("libc" IN_LIST LLVM_ENABLE_RUNTIMES AND NOT LLVM_RUNTIMES_BUILD) OR 
+   LIBC_HDRGEN_ONLY)
   # When libc is build as part of the runtimes/bootstrap build's CMake run, we
   # only need to build the host tools to build the libc. So, we just do enough
   # to build libc-hdrgen and return.


        


More information about the libc-commits mailing list