diff --git a/stdlib/cmake/modules/StdlibOptions.cmake b/stdlib/cmake/modules/StdlibOptions.cmake index 6c8bd8b43f29f..a23f379e6486b 100644 --- a/stdlib/cmake/modules/StdlibOptions.cmake +++ b/stdlib/cmake/modules/StdlibOptions.cmake @@ -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") diff --git a/stdlib/public/CMakeLists.txt b/stdlib/public/CMakeLists.txt index 20364f2470d52..86115cbf8ea75 100644 --- a/stdlib/public/CMakeLists.txt +++ b/stdlib/public/CMakeLists.txt @@ -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()