@@ -40,6 +40,7 @@ from swift_build_support.swift_build_support import shell
40
40
from swift_build_support .swift_build_support .toolchain import host_toolchain
41
41
42
42
isDarwin = platform .system () == "Darwin"
43
+ isSwiftContainedInLLVMProject = os .path .exists (os .path .join (SWIFT_SOURCE_ROOT , "llvm" ))
43
44
44
45
45
46
class Builder (object ):
@@ -227,7 +228,10 @@ class Builder(object):
227
228
"-DLLVM_ENABLE_PROJECTS=clang;swift" ,
228
229
"-DLLVM_EXTERNAL_PROJECTS=swift" ,
229
230
]
230
- cmake_args += ["-DSWIFT_BUILD_ONLY_SYNTAXPARSERLIB=TRUE" ]
231
+ cmake_args += [
232
+ "-DSWIFT_BUILD_ONLY_SYNTAXPARSERLIB=TRUE" ,
233
+ "-DSWIFT_BUILD_SYNTAXPARSERTEST=TRUE" ,
234
+ ]
231
235
cmake_args += ["-DSWIFT_BUILD_PERF_TESTSUITE=NO" , "-DSWIFT_INCLUDE_DOCS=NO" ]
232
236
cmake_args += [
233
237
"-DSWIFT_BUILD_REMOTE_MIRROR=FALSE" ,
@@ -253,7 +257,10 @@ class Builder(object):
253
257
"-DCLANG_INCLUDE_TESTS=FALSE" ,
254
258
"-DSWIFT_INCLUDE_TESTS=FALSE" ,
255
259
]
256
- cmake_args += [os .path .join (SWIFT_SOURCE_ROOT , "llvm-project" , "llvm" )]
260
+ llvm_src_path = os .path .join (SWIFT_SOURCE_ROOT , "llvm" ) \
261
+ if isSwiftContainedInLLVMProject \
262
+ else os .path .join (SWIFT_SOURCE_ROOT , "llvm-project" , "llvm" )
263
+ cmake_args += [llvm_src_path ]
257
264
self .call (cmake_args , env = environment )
258
265
259
266
def build_target (self , build_dir , target , env = None ):
@@ -473,16 +480,17 @@ Example invocations:
473
480
if not args .install_destdir and not args .no_install :
474
481
args .install_destdir = os .path .join (args .build_dir , "install" )
475
482
476
- swift_src_path = os .path .join (SWIFT_SOURCE_ROOT , "swift" )
477
- swift_src_in_llvm_project_path = \
478
- os .path .join (SWIFT_SOURCE_ROOT , "llvm-project" , "swift" )
479
- # Need to symlink 'swift' into 'llvm-project' since we will be doing
480
- # a unified configure with 'swift' as an external project.
481
- if not os .path .exists (swift_src_in_llvm_project_path ):
482
- print ("Symlinking '%s' to '%s'" %
483
- (swift_src_path , swift_src_in_llvm_project_path ), file = sys .stderr )
484
- shell .symlink (swift_src_path , swift_src_in_llvm_project_path ,
485
- dry_run = args .dry_run , echo = args .verbose )
483
+ if not isSwiftContainedInLLVMProject :
484
+ swift_src_path = os .path .join (SWIFT_SOURCE_ROOT , "swift" )
485
+ swift_src_in_llvm_project_path = \
486
+ os .path .join (SWIFT_SOURCE_ROOT , "llvm-project" , "swift" )
487
+ # Need to symlink 'swift' into 'llvm-project' since we will be doing
488
+ # a unified configure with 'swift' as an external project.
489
+ if not os .path .exists (swift_src_in_llvm_project_path ):
490
+ print ("Symlinking '%s' to '%s'" %
491
+ (swift_src_path , swift_src_in_llvm_project_path ), file = sys .stderr )
492
+ shell .symlink (swift_src_path , swift_src_in_llvm_project_path ,
493
+ dry_run = args .dry_run , echo = args .verbose )
486
494
487
495
architectures = args .architectures .split (" " )
488
496
architectures = [arch for arch in architectures if arch != "" ]
0 commit comments