Skip to content

Commit cf4fc06

Browse files
committed
build: require libdispatch on non-Darwin targets
libdispatch is already required for Foundation. At this point libdispatch is available on all the supported platforms. We simply enable SyntaxParserLib and SourceKit on all targets, allowing users to disable them. If enabled on non-Darwin platforms, the user must specify `SWIFT_PATH_TO_LIBDISPATCH_SOURCE` to indicate where to find libdispatch. This is done implicitly by build-script, resulting in no change for users.
1 parent 25949c2 commit cf4fc06

File tree

1 file changed

+9
-22
lines changed

1 file changed

+9
-22
lines changed

CMakeLists.txt

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -459,28 +459,15 @@ if(CMAKE_C_COMPILER_ID MATCHES Clang)
459459
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Werror=gnu>)
460460
endif()
461461

462-
if(CMAKE_SYSTEM_NAME STREQUAL Darwin OR
463-
EXISTS "${SWIFT_PATH_TO_LIBDISPATCH_SOURCE}")
464-
set(SWIFT_BUILD_SYNTAXPARSERLIB_default TRUE)
465-
set(SWIFT_BUILD_SOURCEKIT_default TRUE)
466-
else()
467-
set(SWIFT_BUILD_SYNTAXPARSERLIB_default FALSE)
468-
set(SWIFT_BUILD_SOURCEKIT_default FALSE)
469-
endif()
470-
option(SWIFT_BUILD_SYNTAXPARSERLIB
471-
"Build the Swift Syntax Parser library"
472-
${SWIFT_BUILD_SYNTAXPARSERLIB_default})
473-
option(SWIFT_BUILD_ONLY_SYNTAXPARSERLIB
474-
"Only build the Swift Syntax Parser library" FALSE)
475-
option(SWIFT_BUILD_SOURCEKIT
476-
"Build SourceKit"
477-
${SWIFT_BUILD_SOURCEKIT_default})
478-
option(SWIFT_ENABLE_SOURCEKIT_TESTS
479-
"Enable running SourceKit tests"
480-
${SWIFT_BUILD_SOURCEKIT_default})
481-
482-
if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" AND
483-
(SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT))
462+
option(SWIFT_BUILD_SYNTAXPARSERLIB "Build the Swift Syntax Parser library" TRUE)
463+
option(SWIFT_BUILD_ONLY_SYNTAXPARSERLIB "Only build the Swift Syntax Parser library" FALSE)
464+
option(SWIFT_BUILD_SOURCEKIT "Build SourceKit" TRUE)
465+
option(SWIFT_ENABLE_SOURCEKIT_TESTS "Enable running SourceKit tests" TRUE)
466+
467+
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
468+
if(NOT EXISTS "${SWIFT_PATH_TO_LIBDISPATCH_SOURCE}")
469+
message(SEND_ERROR "SyntaxParserLib and SourceKit require libdispatch on non-Darwin hosts. Please specify SWIFT_PATH_TO_LIBDISPATCH_SOURCE")
470+
endif()
484471
set(SWIFT_NEED_EXPLICIT_LIBDISPATCH TRUE)
485472
else()
486473
set(SWIFT_NEED_EXPLICIT_LIBDISPATCH FALSE)

0 commit comments

Comments
 (0)