[interop] add target-build-swift-link-cxx option for windows to link correctly

This commit is contained in:
Alex Lorenz
2022-03-10 08:05:52 -08:00
parent 1d3b68208e
commit 846fdb5307
3 changed files with 5 additions and 2 deletions

View File

@@ -3,7 +3,7 @@
// RUN: %target-swift-frontend %S/cdecl.swift -typecheck -module-name CdeclFunctions -emit-cxx-header-path %t/functions.h
// RUN: %target-clangxx -c %s -I %t -o %t/cdecl-execution.o
// RUN: %target-build-swift %S/cdecl.swift -o %t/cdecl-execution -Xlinker %t/cdecl-execution.o -module-name Functions -Xfrontend -entry-point-function-name -Xfrontend swiftMain -Xfrontend -enable-cxx-interop
// RUN: %target-build-swift-link-cxx %S/cdecl.swift -o %t/cdecl-execution -Xlinker %t/cdecl-execution.o -module-name Functions -Xfrontend -entry-point-function-name -Xfrontend swiftMain
// RUN: %target-codesign %t/cdecl-execution
// RUN: %target-run %t/cdecl-execution

View File

@@ -3,7 +3,7 @@
// RUN: %target-swift-frontend %S/swift-functions.swift -typecheck -module-name Functions -emit-cxx-header-path %t/functions.h
// RUN: %target-clangxx -c %s -I %t -o %t/swift-functions-execution.o
// RUN: %target-build-swift %S/swift-functions.swift -o %t/swift-functions-execution -Xlinker %t/swift-functions-execution.o -module-name Functions -Xfrontend -entry-point-function-name -Xfrontend swiftMain -Xfrontend -enable-cxx-interop
// RUN: %target-build-swift-link-cxx %S/swift-functions.swift -o %t/swift-functions-execution -Xlinker %t/swift-functions-execution.o -module-name Functions -Xfrontend -entry-point-function-name -Xfrontend swiftMain
// RUN: %target-codesign %t/swift-functions-execution
// RUN: %target-run %t/swift-functions-execution | %FileCheck %s

View File

@@ -6,9 +6,12 @@ def get_target_os():
(run_cpu, run_vendor, run_os, run_version) = re.match('([^-]+)-([^-]+)-([^0-9]+)(.*)', config.variant_triple).groups()
return run_os
libc_opt = ''
if get_target_os() in ['windows-msvc']:
config.substitutions.insert(0, ('%target-abi', 'WIN'))
libc_opt = '-libc MT '
else:
# FIXME(compnerd) do all the targets we currently support use SysV ABI?
config.substitutions.insert(0, ('%target-abi', 'SYSV'))
config.substitutions.insert(0, ('%target-build-swift-link-cxx', '%target-build-swift -Xfrontend -enable-cxx-interop ' + libc_opt))