[libc-commits] [libc] [llvm] [libc] Disable old headergen checks unless enabled (PR #104629)
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Fri Aug 16 11:39:43 PDT 2024
https://github.com/michaelrj-google created https://github.com/llvm/llvm-project/pull/104629
Old Headergen needed extra build rules to ensure that it worked in
runtimes mode. This patch disables those checks if new headergen is
enabled.
>From 87d103d4a173be7f0e472aa19ae590daaf856942 Mon Sep 17 00:00:00 2001
From: Michael Jones <michaelrj at google.com>
Date: Fri, 16 Aug 2024 11:36:43 -0700
Subject: [PATCH] [libc] Disable old headergen checks unless enabled
Old Headergen needed extra build rules to ensure that it worked in
runtimes mode. This patch disables those checks if new headergen is
enabled.
---
libc/CMakeLists.txt | 33 +++++++++++++++++----------------
llvm/runtimes/CMakeLists.txt | 3 ++-
2 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index dd45d6cc8cb6ab..133686acf6fa62 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -50,31 +50,32 @@ set(LIBC_NAMESPACE ${default_namespace}
CACHE STRING "The namespace to use to enclose internal implementations. Must start with '__llvm_libc'."
)
+option(LIBC_USE_NEW_HEADER_GEN "Generate header files using new headergen instead of the old one" ON)
-add_subdirectory(newhdrgen)
-
-
-if(LLVM_LIBC_FULL_BUILD OR LLVM_LIBC_GPU_BUILD)
- if(NOT LIBC_HDRGEN_EXE)
- # We need to set up hdrgen first since other targets depend on it.
- add_subdirectory(utils/LibcTableGenUtil)
- add_subdirectory(utils/HdrGen)
- # Calling add_tablegen sets variables like LIBC_TABLEGEN_EXE in
- # PARENT_SCOPE which get lost until saved in the cache.
- set(LIBC_TABLEGEN_EXE "${LIBC_TABLEGEN_EXE}" CACHE INTERNAL "")
- set(LIBC_TABLEGEN_TARGET "${LIBC_TABLEGEN_TARGET}" CACHE INTERNAL "")
- else()
- message(STATUS "Will use ${LIBC_HDRGEN_EXE} for libc header generation.")
+if(LIBC_USE_NEW_HEADER_GEN)
+ add_subdirectory(newhdrgen)
+else()
+ if(LLVM_LIBC_FULL_BUILD OR LLVM_LIBC_GPU_BUILD)
+ if(NOT LIBC_HDRGEN_EXE)
+ # We need to set up hdrgen first since other targets depend on it.
+ add_subdirectory(utils/LibcTableGenUtil)
+ add_subdirectory(utils/HdrGen)
+ # Calling add_tablegen sets variables like LIBC_TABLEGEN_EXE in
+ # PARENT_SCOPE which get lost until saved in the cache.
+ set(LIBC_TABLEGEN_EXE "${LIBC_TABLEGEN_EXE}" CACHE INTERNAL "")
+ set(LIBC_TABLEGEN_TARGET "${LIBC_TABLEGEN_TARGET}" CACHE INTERNAL "")
+ else()
+ message(STATUS "Will use ${LIBC_HDRGEN_EXE} for libc header generation.")
+ endif()
endif()
endif()
+
# We will build the GPU utilities if we are not doing a runtimes build.
option(LIBC_BUILD_GPU_LOADER "Always build the GPU loader utilities" OFF)
if(LIBC_BUILD_GPU_LOADER OR (LLVM_LIBC_GPU_BUILD AND NOT LLVM_RUNTIMES_BUILD))
add_subdirectory(utils/gpu)
endif()
-option(LIBC_USE_NEW_HEADER_GEN "Generate header files using new headergen instead of the old one" ON)
-
set(NEED_LIBC_HDRGEN FALSE)
if(NOT LLVM_RUNTIMES_BUILD)
if("libc" IN_LIST LLVM_ENABLE_RUNTIMES)
diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 187c44fb9d04d2..76202b2cfe0421 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -521,7 +521,8 @@ if(build_runtimes)
endforeach()
endif()
if("libc" IN_LIST LLVM_ENABLE_PROJECTS AND
- (LLVM_LIBC_FULL_BUILD OR LLVM_LIBC_GPU_BUILD))
+ (LLVM_LIBC_FULL_BUILD OR LLVM_LIBC_GPU_BUILD) AND
+ (NOT LIBC_USE_NEW_HEADER_GEN))
if(LIBC_HDRGEN_EXE)
set(hdrgen_exe ${LIBC_HDRGEN_EXE})
else()
More information about the libc-commits
mailing list