Skip to content

[LLVM] Add 'LLVM_EXTRA_RUNTIME_TARGETS' to append to default list #82513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions libc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,14 @@ if(LLVM_LIBC_FULL_BUILD OR LIBC_GPU_BUILD OR LIBC_GPU_ARCHITECTURES)
endif()
endif()

foreach(name default ${LLVM_RUNTIME_TARGETS} ${LLVM_EXTRA_RUNTIME_TARGETS})
if("libc" IN_LIST LLVM_ENABLE_RUNTIMES OR "libc" IN_LIST RUNTIMES_${name}_LLVM_ENABLE_RUNTIMES)
set(LIBC_RUNTIMES_BUILD ON)
endif()
endforeach()

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)
if((LIBC_RUNTIMES_BUILD 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.
Expand Down
18 changes: 10 additions & 8 deletions llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,17 @@ foreach(proj IN LISTS LLVM_ENABLE_RUNTIMES)
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")
foreach(name default ${LLVM_RUNTIME_TARGETS} ${LLVM_EXTRA_RUNTIME_TARGETS})
if("libc" IN_LIST LLVM_ENABLE_RUNTIMES OR "libc" IN_LIST RUNTIMES_${name}_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()
endif()
endforeach()

# LLVM_ENABLE_PROJECTS_USED is `ON` if the user has ever used the
# `LLVM_ENABLE_PROJECTS` CMake cache variable. This exists for
Expand Down
6 changes: 3 additions & 3 deletions llvm/runtimes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -449,14 +449,14 @@ if(runtimes)
endforeach()
endif()
endif()
if(NOT LLVM_RUNTIME_TARGETS)
if(NOT LLVM_RUNTIME_TARGETS AND NOT LLVM_EXTRA_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)
if("default" IN_LIST LLVM_RUNTIME_TARGETS OR LLVM_EXTRA_RUNTIME_TARGETS)
runtime_default_target(
DEPENDS ${builtins_dep} ${extra_deps}
CMAKE_ARGS ${libc_cmake_args}
Expand All @@ -481,7 +481,7 @@ if(runtimes)
endif()
endif()

foreach(name ${LLVM_RUNTIME_TARGETS})
foreach(name ${LLVM_RUNTIME_TARGETS} ${LLVM_EXTRA_RUNTIME_TARGETS})
if(builtins_dep)
if (LLVM_BUILTIN_TARGETS)
set(builtins_dep_name "${builtins_dep}-${name}")
Expand Down