@@ -156,6 +156,8 @@ def build(args):
156
156
build_dir = os .path .abspath (args .build_dir )
157
157
static_lib_build_dir = GenericUnixStrategy .static_lib_build_dir (build_dir )
158
158
foundation_build_dir = os .path .abspath (args .foundation_build_dir )
159
+ swift_build_dir = os .path .abspath (args .swift_build_dir )
160
+ arch = platform .machine ()
159
161
core_foundation_build_dir = GenericUnixStrategy .core_foundation_build_dir (
160
162
foundation_build_dir , args .foundation_install_prefix )
161
163
if args .libdispatch_build_dir :
@@ -200,15 +202,17 @@ def build(args):
200
202
libdispatch_args = libdispatch_args ,
201
203
source_paths = " " .join (sourcePaths )))
202
204
run ("{swiftc} -emit-library {build_dir}/XCTest.o "
203
- "-L {dispatch_build_dir} -L {foundation_build_dir} -lswiftGlibc -lswiftCore -lFoundation -lm "
205
+ "-L {dispatch_build_dir} -L {foundation_build_dir} -L {swift_build_dir} "
206
+ "-lswiftGlibc -lswiftCore -lFoundation -lm "
204
207
# We embed an rpath of `$ORIGIN` to ensure other referenced
205
208
# libraries (like `Foundation`) can be found solely via XCTest.
206
209
"-Xlinker -rpath=\\ $ORIGIN "
207
210
"-o {build_dir}/libXCTest.so" .format (
208
211
swiftc = swiftc ,
209
212
build_dir = build_dir ,
210
213
dispatch_build_dir = os .path .join (args .libdispatch_build_dir , 'src' , '.libs' ),
211
- foundation_build_dir = foundation_build_dir ))
214
+ foundation_build_dir = foundation_build_dir ,
215
+ swift_build_dir = os .path .join (args .swift_build_dir , 'lib' , 'swift' , 'linux' , arch )))
212
216
213
217
# Build the static library.
214
218
run ("mkdir -p {static_lib_build_dir}" .format (static_lib_build_dir = static_lib_build_dir ))
@@ -431,6 +435,10 @@ def main(args=sys.argv[1:]):
431
435
"dependencies are expected to be found under "
432
436
"FOUNDATION_BUILD_DIR/FOUNDATION_INSTALL_PREFIX." ,
433
437
default = "/usr" )
438
+ build_parser .add_argument (
439
+ "--swift-build-dir" ,
440
+ help = "Path to swift build products, which the built XCTest.so "
441
+ "will be linked against." )
434
442
build_parser .add_argument (
435
443
"--libdispatch-build-dir" ,
436
444
help = "Path to swift-corelibs-libdispatch build products, which "
0 commit comments