@@ -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
@@ -411,6 +412,24 @@ option(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
411
412
"Enable experimental Swift concurrency model"
412
413
FALSE )
413
414
415
+ option (SWIFT_ENABLE_DISPATCH
416
+ "Enable use of libdispatch"
417
+ TRUE )
418
+
419
+ cmake_dependent_option(SWIFT_BUILD_SYNTAXPARSERLIB
420
+ "Build the Swift Syntax Parser library" TRUE
421
+ "SWIFT_ENABLE_DISPATCH" FALSE )
422
+ cmake_dependent_option(SWIFT_BUILD_ONLY_SYNTAXPARSERLIB
423
+ "Only build the Swift Syntax Parser library" FALSE
424
+ "SWIFT_BUILD_SYNTAXPARSERLIB" FALSE )
425
+
426
+ cmake_dependent_option(SWIFT_BUILD_SOURCEKIT
427
+ "Build SourceKit" TRUE
428
+ "SWIFT_ENABLE_DISPATCH" FALSE )
429
+ cmake_dependent_option(SWIFT_ENABLE_SOURCEKIT_TESTS
430
+ "Enable running SourceKit tests" TRUE
431
+ "SWIFT_BUILD_SOURCEKIT" FALSE )
432
+
414
433
#
415
434
# End of user-configurable options.
416
435
#
@@ -434,11 +453,6 @@ if(CMAKE_C_COMPILER_ID MATCHES Clang)
434
453
add_compile_options ($<$<OR :$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Werror=gnu>)
435
454
endif ()
436
455
437
- option (SWIFT_BUILD_SYNTAXPARSERLIB "Build the Swift Syntax Parser library" TRUE )
438
- option (SWIFT_BUILD_ONLY_SYNTAXPARSERLIB "Only build the Swift Syntax Parser library" FALSE )
439
- option (SWIFT_BUILD_SOURCEKIT "Build SourceKit" TRUE )
440
- option (SWIFT_ENABLE_SOURCEKIT_TESTS "Enable running SourceKit tests" ${SWIFT_BUILD_SOURCEKIT} )
441
-
442
456
# Use dispatch as the system scheduler by default.
443
457
# For convenience, we set this to false when concurrency is disabled.
444
458
set (SWIFT_CONCURRENCY_USES_DISPATCH FALSE )
@@ -447,14 +461,12 @@ if(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY AND NOT SWIFT_STDLIB_SINGLE_THREADED_RU
447
461
endif ()
448
462
449
463
set (SWIFT_BUILD_HOST_DISPATCH FALSE )
450
- if (SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT )
451
- if (NOT CMAKE_SYSTEM_NAME STREQUAL Darwin )
464
+ if (SWIFT_ENABLE_DISPATCH AND NOT CMAKE_SYSTEM_NAME STREQUAL Darwin )
465
+ if (SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT )
452
466
set (SWIFT_BUILD_HOST_DISPATCH TRUE )
453
467
endif ()
454
- endif ()
455
468
456
- if (SWIFT_BUILD_HOST_DISPATCH OR SWIFT_CONCURRENCY_USES_DISPATCH)
457
- if (NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
469
+ if (SWIFT_BUILD_HOST_DISPATCH OR SWIFT_CONCURRENCY_USES_DISPATCH)
458
470
if (NOT EXISTS "${SWIFT_PATH_TO_LIBDISPATCH_SOURCE} " )
459
471
message (SEND_ERROR "SyntaxParserLib, SourceKit, and concurrency require libdispatch on non-Darwin hosts. Please specify SWIFT_PATH_TO_LIBDISPATCH_SOURCE" )
460
472
endif ()
@@ -996,7 +1008,9 @@ if (LLVM_ENABLE_DOXYGEN)
996
1008
message (STATUS "Doxygen: enabled" )
997
1009
endif ()
998
1010
999
- include (Libdispatch)
1011
+ if (SWIFT_ENABLE_DISPATCH)
1012
+ include (Libdispatch)
1013
+ endif ()
1000
1014
1001
1015
# Add all of the subdirectories, where we actually do work.
1002
1016
0 commit comments