File tree Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Original file line number Diff line number Diff line change 1
- SET (SWIFTPM_PATH_TO_SWIFT_SYNTAX_SOURCE ${CMAKE_SOURCE_DIR} /../swift-syntax )
2
- message (STATUS "swift-syntax path: ${SWIFTPM_PATH_TO_SWIFT_SYNTAX_SOURCE} " )
3
-
4
1
include (FetchContent )
5
2
6
- if (NOT EXISTS "${SWIFTPM_PATH_TO_SWIFT_SYNTAX_SOURCE} " )
7
- message (SEND_ERROR "swift-syntax is required to build SwiftPM. Please run update-checkout or specify SWIFTPM_PATH_TO_SWIFT_SYNTAX_SOURCE" )
8
- return ()
9
- endif ()
10
-
11
- # Build swift-syntax libraries with FetchContent.
12
- # set(CMAKE_Swift_COMPILER_TARGET ${SWIFT_HOST_TRIPLE})
13
3
set (BUILD_SHARED_LIBS OFF )
14
4
15
- file (TO_CMAKE_PATH "${SWIFTPM_PATH_TO_SWIFT_SYNTAX_SOURCE} " swift_syntax_path )
16
- FetchContent_Declare (SwiftSyntax SOURCE_DIR "${swift_syntax_path} " )
5
+ if (DEFINED SWIFTPM_PATH_TO_SWIFT_SYNTAX_SOURCE )
6
+ file (TO_CMAKE_PATH "${SWIFTPM_PATH_TO_SWIFT_SYNTAX_SOURCE} " swift_syntax_path )
7
+ FetchContent_Declare (SwiftSyntax
8
+ SOURCE_DIR "${swift_syntax_path} " )
9
+ else ()
10
+ FetchContent_Declare (SwiftSyntax
11
+ GIT_REPOSITORY https://github.com/apple/swift-syntax
12
+ GIT_TAG main )
13
+ endif ()
17
14
FetchContent_MakeAvailable (SwiftSyntax )
Original file line number Diff line number Diff line change @@ -202,6 +202,7 @@ def parse_global_args(args):
202
202
args .source_dirs ["swift-collections" ] = os .path .join (args .project_root , ".." , "swift-collections" )
203
203
args .source_dirs ["swift-certificates" ] = os .path .join (args .project_root , ".." , "swift-certificates" )
204
204
args .source_dirs ["swift-asn1" ] = os .path .join (args .project_root , ".." , "swift-asn1" )
205
+ args .source_dirs ["swift-syntax" ] = os .path .join (args .project_root , ".." , "swift-syntax" )
205
206
args .source_root = os .path .join (args .project_root , "Sources" )
206
207
207
208
if platform .system () == 'Darwin' :
@@ -608,6 +609,7 @@ def build_swiftpm_with_cmake(args):
608
609
"-DSwiftCrypto_DIR=" + os .path .join (args .build_dirs ["swift-crypto" ], "cmake/modules" ),
609
610
"-DSwiftASN1_DIR=" + os .path .join (args .build_dirs ["swift-asn1" ], "cmake/modules" ),
610
611
"-DSwiftCertificates_DIR=" + os .path .join (args .build_dirs ["swift-certificates" ], "cmake/modules" ),
612
+ "-DSWIFTPM_PATH_TO_SWIFT_SYNTAX_SOURCE=" + args .source_dirs ["swift-syntax" ],
611
613
]
612
614
613
615
if platform .system () == 'Darwin' :
You can’t perform that action at this time.
0 commit comments