@@ -483,7 +483,7 @@ def install_binary(args, binary, dest_dir, ignored_patterns=[]):
483
483
# Build functions
484
484
# -----------------------------------------------------------
485
485
486
- def build_with_cmake (args , cmake_args , source_path , build_dir ):
486
+ def build_with_cmake (args , cmake_args , ninja_args , source_path , build_dir ):
487
487
"""Runs CMake if needed, then builds with Ninja."""
488
488
cache_path = os .path .join (build_dir , "CMakeCache.txt" )
489
489
if args .reconfigure or not os .path .isfile (cache_path ) or not args .swiftc_path in open (cache_path ).read ():
@@ -514,7 +514,8 @@ def build_with_cmake(args, cmake_args, source_path, build_dir):
514
514
if args .verbose :
515
515
ninja_cmd .append ("-v" )
516
516
517
- call (ninja_cmd , cwd = build_dir , verbose = args .verbose )
517
+
518
+ call (ninja_cmd + ninja_args , cwd = build_dir , verbose = args .verbose )
518
519
519
520
def build_llbuild (args ):
520
521
"""Builds LLBuild using CMake."""
@@ -541,7 +542,7 @@ def build_llbuild(args):
541
542
flags .append ("-DSQLite3_INCLUDE_DIR=%s/usr/include" % args .sysroot )
542
543
543
544
args .source_dirs ["llbuild" ] = get_llbuild_source_path (args )
544
- build_with_cmake (args , flags , args .source_dirs ["llbuild" ], args .build_dirs ["llbuild" ])
545
+ build_with_cmake (args , flags , [], args .source_dirs ["llbuild" ], args .build_dirs ["llbuild" ])
545
546
546
547
def build_dependency (args , target_name , common_cmake_flags = [], non_darwin_cmake_flags = []):
547
548
note ("Building " + target_name )
@@ -554,11 +555,11 @@ def build_dependency(args, target_name, common_cmake_flags = [], non_darwin_cmak
554
555
else :
555
556
cmake_flags += non_darwin_cmake_flags
556
557
557
- build_with_cmake (args , cmake_flags , args .source_dirs [target_name ], args .build_dirs [target_name ])
558
+ build_with_cmake (args , cmake_flags , [], args .source_dirs [target_name ], args .build_dirs [target_name ])
558
559
559
560
def add_rpath_for_cmake_build (args , rpath ):
560
- "Adds the given rpath to the CMake-built swift-build "
561
- swift_build = os .path .join (args .bootstrap_dir , "bin/swift-build " )
561
+ "Adds the given rpath to the CMake-built swift-bootstrap "
562
+ swift_build = os .path .join (args .bootstrap_dir , "bin/swift-bootstrap " )
562
563
add_rpath_cmd = ["install_name_tool" , "-add_rpath" , rpath , swift_build ]
563
564
note (' ' .join (add_rpath_cmd ))
564
565
subprocess .call (add_rpath_cmd , stderr = subprocess .PIPE )
@@ -594,7 +595,7 @@ def build_swiftpm_with_cmake(args):
594
595
cmake_flags .append ("-DCMAKE_C_FLAGS=-target %s%s" % (get_build_target (args ), g_macos_deployment_target ))
595
596
cmake_flags .append ("-DCMAKE_OSX_DEPLOYMENT_TARGET=%s" % g_macos_deployment_target )
596
597
597
- build_with_cmake (args , cmake_flags , args .project_root , args .bootstrap_dir )
598
+ build_with_cmake (args , cmake_flags , [ "swift-bootstrap" , "PackageDescription" , "PackagePlugin" ], args .project_root , args .bootstrap_dir )
598
599
599
600
if args .llbuild_link_framework :
600
601
add_rpath_for_cmake_build (args , args .build_dirs ["llbuild" ])
@@ -620,9 +621,9 @@ def build_swiftpm_with_swiftpm(args, integrated_swift_driver):
620
621
]
621
622
622
623
if args .bootstrap :
623
- note ("Building SwiftPM (with a freshly built swift-build )" )
624
+ note ("Building SwiftPM (with a freshly built swift-bootstrap )" )
624
625
swiftpm_args .append ("SWIFTPM_CUSTOM_LIBS_DIR=" + os .path .join (args .bootstrap_dir , "pm" ))
625
- swiftpm_args .append (os .path .join (args .bootstrap_dir , "bin/swift-build " ))
626
+ swiftpm_args .append (os .path .join (args .bootstrap_dir , "bin/swift-bootstrap " ))
626
627
else :
627
628
note ("Building SwiftPM (with a prebuilt swift-build)" )
628
629
swiftpm_args .append (os .path .join (os .path .split (args .swiftc_path )[0 ], "swift-build" ))
0 commit comments