11
11
# ----------------------------------------------------------------------------
12
12
13
13
import os
14
+ import platform
14
15
15
16
from . import cmark
16
17
from . import foundation
23
24
from . import swift_testing
24
25
from . import xctest
25
26
from .. import shell
26
- from ..targets import StdlibDeploymentTarget
27
+ from ..targets import StdlibDeploymentTarget , darwin_toolchain_prefix
27
28
28
29
29
30
class SwiftPM (product .Product ):
@@ -50,6 +51,10 @@ def run_bootstrap_script(
50
51
* ,
51
52
compile_only_for_running_host_architecture = False ,
52
53
):
54
+ toolchain_path = _get_toolchain_path (host_target , self , self .args )
55
+ swift_lib_path = os .path .join (toolchain_path ,
56
+ 'usr' , 'lib' , 'swift' , 'macosx' )
57
+
53
58
script_path = os .path .join (
54
59
self .source_dir , 'Utilities' , 'bootstrap' )
55
60
@@ -79,7 +84,8 @@ def run_bootstrap_script(
79
84
"--cmake-path" , self .toolchain .cmake ,
80
85
"--ninja-path" , self .toolchain .ninja ,
81
86
"--build-dir" , self .build_dir ,
82
- "--llbuild-build-dir" , llbuild_build_dir
87
+ "--llbuild-build-dir" , llbuild_build_dir ,
88
+ "--extra-dynamic-library-path" , swift_lib_path
83
89
]
84
90
85
91
# Pass Dispatch directory down if we built it
@@ -169,3 +175,16 @@ def get_dependencies(cls):
169
175
xctest .XCTest ,
170
176
llbuild .LLBuild ,
171
177
swift_testing .SwiftTesting ]
178
+
179
+ def _get_toolchain_path (host_target , product , args ):
180
+ # TODO check if we should prefer using product.install_toolchain_path
181
+ # this logic initially was inside run_build_script_helper
182
+ # and was factored out so it can be used in testing as well
183
+
184
+ toolchain_path = product .host_install_destdir (host_target )
185
+ if platform .system () == 'Darwin' :
186
+ # The prefix is an absolute path, so concatenate without os.path.
187
+ toolchain_path += \
188
+ darwin_toolchain_prefix (args .install_prefix )
189
+
190
+ return toolchain_path
0 commit comments