@@ -50,6 +50,7 @@ set(CMAKE_CXX_EXTENSIONS NO)
50
50
# First include general CMake utilities.
51
51
include (SwiftUtils )
52
52
include (CheckSymbolExists )
53
+ include (CMakeDependentOption )
53
54
54
55
#
55
56
# User-configurable options that control the inclusion and default build
@@ -406,6 +407,24 @@ option(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
406
407
"Enable experimental Swift concurrency model"
407
408
FALSE )
408
409
410
+ option (SWIFT_ENABLE_DISPATCH
411
+ "Enable use of libdispatch"
412
+ TRUE )
413
+
414
+ cmake_dependent_option (SWIFT_BUILD_SYNTAXPARSERLIB
415
+ "Build the Swift Syntax Parser library" TRUE
416
+ "SWIFT_ENABLE_DISPATCH" FALSE )
417
+ cmake_dependent_option (SWIFT_BUILD_ONLY_SYNTAXPARSERLIB
418
+ "Only build the Swift Syntax Parser library" FALSE
419
+ "SWIFT_BUILD_SYNTAXPARSERLIB" FALSE )
420
+
421
+ cmake_dependent_option (SWIFT_BUILD_SOURCEKIT
422
+ "Build SourceKit" TRUE
423
+ "SWIFT_ENABLE_DISPATCH" FALSE )
424
+ cmake_dependent_option (SWIFT_ENABLE_SOURCEKIT_TESTS
425
+ "Enable running SourceKit tests" TRUE
426
+ "SWIFT_BUILD_SOURCEKIT" FALSE )
427
+
409
428
#
410
429
# End of user-configurable options.
411
430
#
@@ -429,11 +448,6 @@ if(CMAKE_C_COMPILER_ID MATCHES Clang)
429
448
add_compile_options ($< $< OR:$< COMPILE_LANGUAGE:C> ,$< COMPILE_LANGUAGE:CXX> > :-Werror=gnu> )
430
449
endif ()
431
450
432
- option (SWIFT_BUILD_SYNTAXPARSERLIB "Build the Swift Syntax Parser library" TRUE )
433
- option (SWIFT_BUILD_ONLY_SYNTAXPARSERLIB "Only build the Swift Syntax Parser library" FALSE )
434
- option (SWIFT_BUILD_SOURCEKIT "Build SourceKit" TRUE )
435
- option (SWIFT_ENABLE_SOURCEKIT_TESTS "Enable running SourceKit tests" ${SWIFT_BUILD_SOURCEKIT} )
436
-
437
451
# Use dispatch as the system scheduler by default.
438
452
# For convenience, we set this to false when concurrency is disabled.
439
453
set (SWIFT_CONCURRENCY_USES_DISPATCH FALSE )
@@ -442,14 +456,12 @@ if(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY AND NOT SWIFT_STDLIB_SINGLE_THREADED_RU
442
456
endif ()
443
457
444
458
set (SWIFT_BUILD_HOST_DISPATCH FALSE )
445
- if (SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT )
446
- if (NOT CMAKE_SYSTEM_NAME STREQUAL Darwin )
459
+ if (SWIFT_ENABLE_DISPATCH AND NOT CMAKE_SYSTEM_NAME STREQUAL Darwin )
460
+ if (SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT )
447
461
set (SWIFT_BUILD_HOST_DISPATCH TRUE )
448
462
endif ()
449
- endif ()
450
463
451
- if (SWIFT_BUILD_HOST_DISPATCH OR SWIFT_CONCURRENCY_USES_DISPATCH )
452
- if (NOT CMAKE_SYSTEM_NAME STREQUAL Darwin )
464
+ if (SWIFT_BUILD_HOST_DISPATCH OR SWIFT_CONCURRENCY_USES_DISPATCH )
453
465
if (NOT EXISTS "${SWIFT_PATH_TO_LIBDISPATCH_SOURCE} " )
454
466
message (SEND_ERROR "SyntaxParserLib, SourceKit, and concurrency require libdispatch on non-Darwin hosts. Please specify SWIFT_PATH_TO_LIBDISPATCH_SOURCE" )
455
467
endif ()
@@ -961,7 +973,9 @@ if (LLVM_ENABLE_DOXYGEN)
961
973
message (STATUS "Doxygen: enabled" )
962
974
endif ()
963
975
964
- include (Libdispatch )
976
+ if (SWIFT_ENABLE_DISPATCH )
977
+ include (Libdispatch )
978
+ endif ()
965
979
966
980
# Add all of the subdirectories, where we actually do work.
967
981
0 commit comments