Skip to content

Commit 88da2d7

Browse files
committed
Move SWIFT_CONCURRENCY_USES_DISPATCH to StdlibOptions.cmake
It is only used in the stdlib build, so really has no business being set in the root `CMakeLists.txt`.
1 parent 7d1e9a7 commit 88da2d7

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

CMakeLists.txt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -700,13 +700,6 @@ if(NOT EXISTS "${SWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE}")
700700
message(SEND_ERROR "swift-syntax is required to build the Swift compiler. Please run update-checkout or specify SWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE")
701701
endif()
702702

703-
# Use dispatch as the system scheduler by default.
704-
# For convenience, we set this to false when concurrency is disabled.
705-
set(SWIFT_CONCURRENCY_USES_DISPATCH FALSE)
706-
if(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY AND "${SWIFT_CONCURRENCY_GLOBAL_EXECUTOR}" STREQUAL "dispatch")
707-
set(SWIFT_CONCURRENCY_USES_DISPATCH TRUE)
708-
endif()
709-
710703
set(SWIFT_BUILD_HOST_DISPATCH FALSE)
711704
if(SWIFT_ENABLE_DISPATCH AND NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
712705
# Only build libdispatch for the host if the host tools are being built and
@@ -715,9 +708,9 @@ if(SWIFT_ENABLE_DISPATCH AND NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
715708
set(SWIFT_BUILD_HOST_DISPATCH TRUE)
716709
endif()
717710

718-
if(SWIFT_BUILD_HOST_DISPATCH OR SWIFT_CONCURRENCY_USES_DISPATCH)
711+
if(SWIFT_BUILD_HOST_DISPATCH)
719712
if(NOT EXISTS "${SWIFT_PATH_TO_LIBDISPATCH_SOURCE}")
720-
message(SEND_ERROR "SourceKit and concurrency require libdispatch on non-Darwin hosts. Please specify SWIFT_PATH_TO_LIBDISPATCH_SOURCE")
713+
message(SEND_ERROR "SourceKit requires libdispatch on non-Darwin hosts. Please specify SWIFT_PATH_TO_LIBDISPATCH_SOURCE")
721714
endif()
722715
endif()
723716
endif()

stdlib/cmake/modules/StdlibOptions.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,16 @@ set(SWIFT_RUNTIME_FIXED_BACKTRACER_PATH "" CACHE STRING
239239
"If set, provides a fixed path to the swift-backtrace binary. This
240240
will disable dynamic determination of the path and will also disable
241241
the setting in SWIFT_BACKTRACE.")
242+
243+
# Use dispatch as the system scheduler by default.
244+
# For convenience, we set this to false when concurrency is disabled.
245+
set(SWIFT_CONCURRENCY_USES_DISPATCH FALSE)
246+
if(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY AND "${SWIFT_CONCURRENCY_GLOBAL_EXECUTOR}" STREQUAL "dispatch")
247+
set(SWIFT_CONCURRENCY_USES_DISPATCH TRUE)
248+
endif()
249+
250+
if(SWIFT_CONCURRENCY_USES_DISPATCH)
251+
if(NOT EXISTS "${SWIFT_PATH_TO_LIBDISPATCH_SOURCE}")
252+
message(SEND_ERROR "Concurrency require libdispatch on non-Darwin hosts. Please specify SWIFT_PATH_TO_LIBDISPATCH_SOURCE")
253+
endif()
254+
endif()

0 commit comments

Comments
 (0)