Skip to content

Commit

Permalink
CMake: allow to only build Core and Onone when building the stdlib (#…
Browse files Browse the repository at this point in the history
…69747)

This is needed for some Apple internal configurations that needs to build the
standard library in pieces to construct an SDK.
Given the limited audience, only introduce this flag in CMake.

Addresses rdar://118178539
  • Loading branch information
edymtt committed Nov 9, 2023
1 parent 1e350f5 commit 3d71dbb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions stdlib/cmake/modules/StdlibOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ option(SWIFT_STDLIB_EMIT_API_DESCRIPTORS
"Emit api descriptors for the standard library"
FALSE)

option(SWIFT_STDLIB_BUILD_ONLY_CORE_MODULES
"Build only the core subset of the standard library,
ignoring additional libraries such as Concurrency, Distributed and StringProcessing.
This is an option meant for internal configurations inside Apple
that need to build the standard libraries in chunks when constructing an SDK"
FALSE)

if("${SWIFT_HOST_VARIANT_SDK}" IN_LIST SWIFT_DARWIN_PLATFORMS)
set(SWIFT_STDLIB_ENABLE_PRESPECIALIZATION_default TRUE)
elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "LINUX")
Expand Down
5 changes: 5 additions & 0 deletions stdlib/public/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,12 @@ if(SWIFT_BUILD_STDLIB)
add_subdirectory(stubs)
add_subdirectory(core)
add_subdirectory(SwiftOnoneSupport)
endif()

if(SWIFT_BUILD_STDLIB AND NOT SWIFT_STDLIB_BUILD_ONLY_CORE_MODULES)
# In some internal Apple configurations we have the need
# to build Core and Onone separately from the rest
# of the stdlib
if(SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING)
add_subdirectory(Differentiation)
endif()
Expand Down

0 comments on commit 3d71dbb

Please sign in to comment.