Skip to content

Commit 6f3360b

Browse files
committed
Add initial support for "none" triples using the Swift Build backend
This will need to be cleaned up later as we refine how target triples are communicated through the build request, but will allow us to start experimenting with more Swift Embedded workflows in the meantime.
1 parent 71b11e7 commit 6f3360b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Sources/SwiftBuildSupport/SwiftBuildSystem.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,16 @@ public final class SwiftBuildSystem: SPMBuildCore.BuildSystem {
666666
}
667667
}
668668

669+
// FIXME: "none" triples get a placeholder SDK/platform and don't support any specific triple by default. Unlike most platforms, where the vendor and environment is implied as a function of the arch and "platform", bare metal operates in terms of triples directly. We need to replace this bringup convenience with a more idiomatic mechanism, perhaps in the build request.
670+
if buildParameters.triple.os == .noneOS {
671+
settings["ARCHS"] = buildParameters.triple.archName
672+
settings["VALID_ARCHS"] = buildParameters.triple.archName
673+
settings["LLVM_TARGET_TRIPLE_VENDOR"] = buildParameters.triple.vendorName
674+
if !buildParameters.triple.environmentName.isEmpty {
675+
settings["LLVM_TARGET_TRIPLE_SUFFIX"] = "-" + buildParameters.triple.environmentName
676+
}
677+
}
678+
669679
settings["LIBRARY_SEARCH_PATHS"] = try "$(inherited) \(buildParameters.toolchain.toolchainLibDir.pathString)"
670680
settings["OTHER_CFLAGS"] = (
671681
["$(inherited)"]

0 commit comments

Comments
 (0)