@@ -172,7 +172,7 @@ def handle_invocation(toolchain_bin, args):
172
172
elif args .action == 'install' :
173
173
if platform .system () == 'Darwin' :
174
174
distribution_build_dir = os .path .join (args .build_path , 'dist' )
175
- build_for_distribution (args , toolchain_bin , distribution_build_dir )
175
+ build_for_toolchain_install (args , toolchain_bin , distribution_build_dir )
176
176
install (args , distribution_build_dir )
177
177
else :
178
178
bin_path = swiftpm_bin_path (swift_exec , swiftpm_args , env )
@@ -210,7 +210,7 @@ def install(args, build_dir):
210
210
211
211
# Binary Swift Modules:
212
212
# swift-driver: SwiftDriver.swiftmodule, SwiftOptions.swiftmodule
213
- # swift-argument-parser: ArgumentParser.swiftmodule
213
+ # TODO: swift-argument-parser: ArgumentParser.swiftmodule
214
214
# swift-tools-support-core: TSCUtility.swiftmodule, TSCLibc.swiftmodule, TSCBasic.swiftmodule
215
215
install_binary_swift_modules (args , build_dir , toolchain_lib )
216
216
@@ -275,36 +275,21 @@ def install_libraries(args, build_dir, universal_lib_dir, toolchain_lib_dir):
275
275
276
276
# Install the libSwiftDriver and libSwiftOptions shared libraries into the toolchain lib
277
277
for lib in ['libSwiftDriver' , 'libSwiftOptions' ]:
278
- shared_lib_file = lib + shared_lib_ext
279
- output_dylib_path = os .path .join (universal_lib_dir , shared_lib_file )
280
- lipo_cmd = ['lipo' ]
281
- for arch in macos_target_architectures :
282
- input_lib_path = os .path .join (build_dir , arch + '-apple-macos' + macos_deployment_target ,
283
- 'swift-driver' , 'lib' , shared_lib_file )
284
- lipo_cmd .append (input_lib_path )
285
- lipo_cmd .extend (['-create' , '-output' , output_dylib_path ])
286
- subprocess .check_call (lipo_cmd )
287
- install_binary (shared_lib_file , universal_lib_dir , toolchain_lib_dir , args .verbose )
278
+ install_library (args , build_dir , lib , universal_lib_dir , toolchain_lib_dir , 'swift-driver' )
288
279
289
280
for lib in ['libTSCBasic' , 'libTSCLibc' , 'libTSCUtility' ]:
290
- shared_lib_file = lib + shared_lib_ext
291
- output_dylib_path = os .path .join (universal_lib_dir , shared_lib_file )
292
- lipo_cmd = ['lipo' ]
293
- for arch in macos_target_architectures :
294
- input_lib_path = os .path .join (build_dir , arch + '-apple-macos' + macos_deployment_target ,
295
- 'swift-tools-support-core' , 'lib' , shared_lib_file )
296
- lipo_cmd .append (input_lib_path )
297
- lipo_cmd .extend (['-create' , '-output' , output_dylib_path ])
298
- subprocess .check_call (lipo_cmd )
299
- install_binary (shared_lib_file , universal_lib_dir , toolchain_lib_dir , args .verbose )
281
+ install_library (args , build_dir , lib , universal_lib_dir , toolchain_lib_dir , 'swift-tools-support-core' )
282
+
283
+ # TODO: Until the argument parser is used, avoid installing it into the toolchain
284
+ #install_library(args, build_dir, 'libArgumentParser', universal_lib_dir, toolchain_lib_dir, 'swift-argument-parser')
300
285
301
- def install_library (args , lib_name , ):
302
- shared_lib_file = lib + shared_lib_ext
286
+ def install_library (args , build_dir , lib_name , universal_lib_dir , toolchain_lib_dir , package_name ):
287
+ shared_lib_file = lib_name + shared_lib_ext
303
288
output_dylib_path = os .path .join (universal_lib_dir , shared_lib_file )
304
289
lipo_cmd = ['lipo' ]
305
290
for arch in macos_target_architectures :
306
291
input_lib_path = os .path .join (build_dir , arch + '-apple-macos' + macos_deployment_target ,
307
- 'swift-driver' , 'lib' , shared_lib_file )
292
+ package_name , 'lib' , shared_lib_file )
308
293
lipo_cmd .append (input_lib_path )
309
294
lipo_cmd .extend (['-create' , '-output' , output_dylib_path ])
310
295
subprocess .check_call (lipo_cmd )
@@ -319,7 +304,8 @@ def install_binary_swift_modules(args, build_dir, toolchain_lib_dir):
319
304
install_module (args , build_dir , product_subpath , toolchain_lib_dir , module , 'swift-driver' )
320
305
321
306
# swift-argument-parser
322
- install_module (args , build_dir , product_subpath , toolchain_lib_dir , 'ArgumentParser' , 'swift-argument-parser' )
307
+ # TODO: Until the argument parser is used, avoid installing it into the toolchain
308
+ #install_module(args, build_dir, product_subpath, toolchain_lib_dir, 'ArgumentParser', 'swift-argument-parser')
323
309
324
310
# swift-tools-support-core
325
311
for module in ['TSCUtility' , 'TSCLibc' , 'TSCBasic' ]:
@@ -357,7 +343,7 @@ def install_module_includes(args, toolchain_include_dir, src_include_dir, dst_mo
357
343
shutil .rmtree (toolchain_module_include_dir , ignore_errors = True )
358
344
shutil .copytree (src_include_dir , toolchain_module_include_dir )
359
345
360
- def build_for_distribution (args , toolchain_bin , build_dir ):
346
+ def build_for_toolchain_install (args , toolchain_bin , build_dir ):
361
347
print ('Preparing SwiftDriver for distribution using CMake.' )
362
348
swiftc_exec = os .path .join (toolchain_bin , 'swiftc' )
363
349
@@ -427,7 +413,7 @@ def build_argument_parser_using_cmake(args, target, swiftc_exec, cmake_target_di
427
413
print ('Building Argument Parser for target: %s' % target )
428
414
parser_source_dir = os .path .join (os .path .dirname (args .package_path ), 'swift-argument-parser' )
429
415
parser_build_dir = os .path .join (cmake_target_dir , 'swift-argument-parser' )
430
- custom_flags = ['-DBUILD_SHARED_LIBS=OFF' , '- DBUILD_TESTING=NO' , '-DBUILD_EXAMPLES=NO' ]
416
+ custom_flags = ['-DBUILD_TESTING=NO' , '-DBUILD_EXAMPLES=NO' ]
431
417
parser_flags = base_cmake_flags + custom_flags
432
418
cmake_build (args , swiftc_exec , parser_flags , parser_source_dir , parser_build_dir )
433
419
return
0 commit comments