Skip to content

Commit b55a18f

Browse files
committed
Separate CMake option for "build concurrency lib" and "import concurrency lib"
The CMake option `SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY` was originally meant to imply that we should build the _Concurrency module, which it still does. However, to support minimal stdlib builds, it also became a way to configure the compiler to avoid implicitly importing the _Concurrency module. However, we build configurations of Swift where we want the implicit import but don't want to build the _Concurrency library. Use a new, different option (`SWIFT_IMPLICIT_CONCURRENCY_IMPORT`) for the "implicit import" behavior within the compiler, which defaults to "true", and disable that for minimal stdlib builds. Fixes rdar://78544947. (cherry picked from commit 4c1c8ed)
1 parent 913da06 commit b55a18f

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,12 @@ option(SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING
403403
"Enable experimental Swift differentiable programming features"
404404
FALSE)
405405

406+
option(SWIFT_IMPLICIT_CONCURRENCY_IMPORT
407+
"Implicitly import the Swift concurrency module"
408+
TRUE)
409+
406410
option(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
407-
"Enable experimental Swift concurrency model"
411+
"Enable build of the Swift concurrency module"
408412
FALSE)
409413

410414
option(SWIFT_ENABLE_DISPATCH

include/swift/Basic/LangOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ namespace swift {
275275

276276
/// Disable the implicit import of the _Concurrency module.
277277
bool DisableImplicitConcurrencyModuleImport =
278-
!SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY;
278+
!SWIFT_IMPLICIT_CONCURRENCY_IMPORT;
279279

280280
/// Should we check the target OSs of serialized modules to see that they're
281281
/// new enough?

include/swift/Config.h.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88

99
#cmakedefine HAVE_PROC_PID_RUSAGE 1
1010

11-
#cmakedefine01 SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
11+
#cmakedefine01 SWIFT_IMPLICIT_CONCURRENCY_IMPORT
1212

1313
#endif // SWIFT_CONFIG_H

utils/build-presets.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2395,7 +2395,7 @@ swift-enable-compatibility-overrides=0
23952395
swift-runtime-macho-no-dyld=1
23962396
swift-stdlib-single-threaded-runtime=1
23972397
swift-stdlib-os-versioning=0
2398-
extra-cmake-options=-DSWIFT_ENABLE_DISPATCH:BOOL=FALSE
2398+
extra-cmake-options=-DSWIFT_ENABLE_DISPATCH:BOOL=FALSE -DSWIFT_IMPLICIT_CONCURRENCY_IMPORT:BOOL=FALSE
23992399

24002400
[preset: stdlib_S_standalone_minimal_macho_x86_64,build]
24012401
mixin-preset=

0 commit comments

Comments
 (0)