From 3de52098e0f2483568d1b7c424bc227d87d74f3f Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Fri, 8 Mar 2019 10:45:53 -0500 Subject: [PATCH] Specify simulator in target triple I notice that simulator builds don't have the `-simulator` [environment](http://llvm.org/doxygen/classllvm_1_1Triple.html#a1778f5c464f88710033f7e11e84a9324) in the target triple. With this change, `-simulator` is added for platforms where `is_device` is false. This matches Xcode. Closes #154. RELNOTES: `-simulator` is now added to the target triple passed to `swiftc` (e.g., "-target x86_64-apple-ios10.3-simulator") by the Xcode toolchain when targeting simulator platforms. PiperOrigin-RevId: 237447785 --- swift/internal/xcode_swift_toolchain.bzl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/swift/internal/xcode_swift_toolchain.bzl b/swift/internal/xcode_swift_toolchain.bzl index ea7307685..c59a60fb4 100644 --- a/swift/internal/xcode_swift_toolchain.bzl +++ b/swift/internal/xcode_swift_toolchain.bzl @@ -375,8 +375,13 @@ def _swift_apple_target_triple(cpu, platform, version): if platform_string == "macos": platform_string = "macosx" - return "{cpu}-apple-{platform}{version}".format( + environment = "" + if not platform.is_device: + environment = "-simulator" + + return "{cpu}-apple-{platform}{version}{environment}".format( cpu = cpu, + environment = environment, platform = platform_string, version = version, )