[PATCH] D141460: [bootstrap build] Add libc-hdrgen as a build dep for libc bootstrap build.
Siva Chandra via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 3 16:47:07 PST 2023
sivachandra updated this revision to Diff 494774.
sivachandra added a comment.
Add "libc" to enabled projects if it is listed in enabled runtimes.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141460/new/
https://reviews.llvm.org/D141460
Files:
llvm/CMakeLists.txt
llvm/runtimes/CMakeLists.txt
Index: llvm/runtimes/CMakeLists.txt
===================================================================
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -193,7 +193,7 @@
endforeach()
function(runtime_default_target)
- cmake_parse_arguments(ARG "" "" "DEPENDS;PREFIXES" ${ARGN})
+ cmake_parse_arguments(ARG "" "" "DEPENDS;CMAKE_ARGS;PREFIXES" ${ARGN})
include(${LLVM_BINARY_DIR}/runtimes/Components.cmake OPTIONAL)
set(SUB_CHECK_TARGETS ${SUB_CHECK_TARGETS} PARENT_SCOPE)
@@ -236,6 +236,7 @@
-DCMAKE_ASM_COMPILER_WORKS=ON
${COMMON_CMAKE_ARGS}
${RUNTIMES_CMAKE_ARGS}
+ ${ARG_CMAKE_ARGS}
PASSTHROUGH_PREFIXES LLVM_ENABLE_RUNTIMES
LLVM_USE_LINKER
${ARG_PREFIXES}
@@ -384,15 +385,31 @@
list(APPEND extra_deps llvm-link)
endif()
endif()
+ if("libc" IN_LIST LLVM_ENABLE_RUNTIMES AND LLVM_LIBC_FULL_BUILD)
+ if(TARGET libc-hdrgen)
+ set(libc_tools libc-hdrgen)
+ set(libc_cmake_args "-DLIBC_HDRGEN_EXE=$<TARGET_FILE:libc-hdrgen>"
+ "-DLLVM_LIBC_FULL_BUILD=ON")
+ list(APPEND extra_deps ${libc_tools})
+ else()
+ # We want to build the libc build tools before we can build the libc
+ # itself. So, the libc project should be included in LLVM_ENABLE_PROJECTS.
+ # This should have been done in llvm/CMakeLists.txt automatically when
+ # "libc" is detected in LLVM_ENABLE_RUNTIMES.
+ message(FATAL_ERROR "libc-hdrgen target missing unexpectedly")
+ endif()
+ endif()
if(NOT LLVM_RUNTIME_TARGETS)
runtime_default_target(
DEPENDS ${builtins_dep} ${extra_deps}
+ CMAKE_ARGS ${libc_cmake_args}
PREFIXES ${prefixes})
set(test_targets check-runtimes)
else()
if("default" IN_LIST LLVM_RUNTIME_TARGETS)
runtime_default_target(
DEPENDS ${builtins_dep} ${extra_deps}
+ CMAKE_ARGS ${libc_cmake_args}
PREFIXES ${prefixes})
list(REMOVE_ITEM LLVM_RUNTIME_TARGETS "default")
else()
@@ -428,7 +445,9 @@
endif()
endif()
runtime_register_target(${name} ${name}
- DEPENDS ${builtins_dep_name})
+ DEPENDS ${builtins_dep_name} ${libc_tools}
+ CMAKE_ARGS ${libc_cmake_args}
+ PREFIXES ${prefixes})
add_dependencies(runtimes runtimes-${name})
add_dependencies(runtimes-configure runtimes-${name}-configure)
Index: llvm/CMakeLists.txt
===================================================================
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -168,6 +168,16 @@
endif()
endforeach()
+if ("libc" IN_LIST LLVM_ENABLE_RUNTIMES)
+ # To build the libc runtime, we need to be able to build few libc build
+ # tools from the "libc" project. So, we add it to the list of enabled
+ # projects.
+ if (NOT "libc" IN_LIST LLVM_ENABLE_PROJECTS)
+ message(STATUS "Enabling libc project to build libc build tools")
+ list(APPEND LLVM_ENABLE_PROJECTS "libc")
+ endif()
+endif()
+
# LLVM_ENABLE_PROJECTS_USED is `ON` if the user has ever used the
# `LLVM_ENABLE_PROJECTS` CMake cache variable. This exists for
# several reasons:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141460.494774.patch
Type: text/x-patch
Size: 3364 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230204/55eb4764/attachment.bin>
More information about the llvm-commits
mailing list