Skip to content

Commit 3d71dbb

Browse files
authored
CMake: allow to only build Core and Onone when building the stdlib (#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
1 parent 1e350f5 commit 3d71dbb

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

stdlib/cmake/modules/StdlibOptions.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ option(SWIFT_STDLIB_EMIT_API_DESCRIPTORS
9999
"Emit api descriptors for the standard library"
100100
FALSE)
101101

102+
option(SWIFT_STDLIB_BUILD_ONLY_CORE_MODULES
103+
"Build only the core subset of the standard library,
104+
ignoring additional libraries such as Concurrency, Distributed and StringProcessing.
105+
This is an option meant for internal configurations inside Apple
106+
that need to build the standard libraries in chunks when constructing an SDK"
107+
FALSE)
108+
102109
if("${SWIFT_HOST_VARIANT_SDK}" IN_LIST SWIFT_DARWIN_PLATFORMS)
103110
set(SWIFT_STDLIB_ENABLE_PRESPECIALIZATION_default TRUE)
104111
elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "LINUX")

stdlib/public/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,12 @@ if(SWIFT_BUILD_STDLIB)
166166
add_subdirectory(stubs)
167167
add_subdirectory(core)
168168
add_subdirectory(SwiftOnoneSupport)
169+
endif()
169170

171+
if(SWIFT_BUILD_STDLIB AND NOT SWIFT_STDLIB_BUILD_ONLY_CORE_MODULES)
172+
# In some internal Apple configurations we have the need
173+
# to build Core and Onone separately from the rest
174+
# of the stdlib
170175
if(SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING)
171176
add_subdirectory(Differentiation)
172177
endif()

0 commit comments

Comments
 (0)