applyPathCLIOptions
Propagates toolchain and SDK paths known to the Swift SDK to swiftc
CLI options.
mutating func applyPathCLIOptions()
Propagates toolchain and SDK paths known to the Swift SDK to swiftc
CLI options.
mutating func applyPathCLIOptions()
import PackageModel
struct SwiftSDK
Swift SDK model type which has information about everything that’s required to build a SwiftPM package for a certain platform.
init(hostTriple: Triple? = nil, targetTriple: Triple? = nil, toolset: Toolset, pathsConfiguration: PathsConfiguration, xctestSupport: XCTestSupport = .supported)
Creates a Swift SDK with the specified properties.
static func decode(fromFile path: AbsolutePath, fileSystem: FileSystem, observabilityScope: ObservabilityScope) throws -> [SwiftSDK]
Load a SwiftSDK
description from a JSON representation from disk.
static func defaultSwiftSDK(for targetTriple: Triple, hostSDK: SwiftSDK) -> SwiftSDK?
Returns a default Swift SDK of a given target environment.
static func deriveTargetSwiftSDK(hostSwiftSDK: SwiftSDK, hostTriple: Triple, customCompileDestination: AbsolutePath? = nil, customCompileTriple: Triple? = nil, customCompileToolchain: AbsolutePath? = nil, customCompileSDK: AbsolutePath? = nil, swiftSDKSelector: String? = nil, architectures: [String] = [], store: SwiftSDKBundleStore, observabilityScope: ObservabilityScope, fileSystem: FileSystem) throws -> SwiftSDK
Computes the target Swift SDK for the given options.
static func hostSwiftSDK(_ binDir: AbsolutePath? = nil, environment: Environment = .current, observabilityScope: ObservabilityScope? = nil, fileSystem: any FileSystem = localFileSystem) throws -> SwiftSDK
The Swift SDK for the host platform.
static func sdkPlatformFrameworkPaths(environment: Environment = .current) throws -> (fwk: AbsolutePath, lib: AbsolutePath)
Returns macosx
sdk platform framework path.
var architectures: [String]?
The architectures to build for. We build for host architecture if this is empty.
let hostTriple: Triple?
The clang/LLVM triple describing the host platform that supports this Swift SDK.
var pathsConfiguration: PathsConfiguration
Configuration of file system paths used by this Swift SDK when building.
var targetTriple: Triple?
The clang/LLVM triple describing the target OS and architecture.
var toolset: Toolset { get }
Set of tools and their properties used for building code for the target triple. While a serialized Swift SDK metadata may specify multiple toolset files, these files are consolidated into a single Toolset
value during deserialization.
let xctestSupport: XCTestSupport
Whether or not the receiver supports using XCTest.
mutating func append(toolsetRootPath: AbsolutePath)
Appends a path to the array of toolset root paths.
mutating func prepend(toolsetRootPath path: AbsolutePath)
Prepends a path to the array of toolset root paths.
struct PathsConfiguration
enum XCTestSupport
Whether or not the receiver supports testing using XCTest.
init(hostTriple: Triple? = nil, targetTriple: Triple? = nil, sdkRootDir: AbsolutePath?, toolchainBinDir: AbsolutePath, extraFlags: BuildFlags = BuildFlags())
Creates a Swift SDK with the specified properties.
init(hostTriple: Triple? = nil, targetTriple: Triple? = nil, toolset: Toolset, pathsConfiguration: PathsConfiguration, supportsTesting: Bool)
Creates a Swift SDK with the specified properties.
init(target: Triple? = nil, sdk: AbsolutePath?, binDir: AbsolutePath, extraCCFlags: [String] = [], extraSwiftCFlags: [String] = [], extraCPPFlags: [String] = [])
Creates a Swift SDK with the specified properties.
static func defaultDestination(for triple: Triple, host: SwiftSDK) -> SwiftSDK?
Returns a default Swift SDK for a given target environment
static func hostDestination(_ binDir: AbsolutePath? = nil, originalWorkingDirectory: AbsolutePath? = nil, environment: Environment) throws -> SwiftSDK
The Swift SDK describing the host platform.
var binDir: AbsolutePath { get }
Path to a directory containing the toolchain (compilers/linker) to be used for the compilation.
var extraCCFlags: [String] { get }
Additional flags to be passed to the C compiler.
var extraCPPFlags: [String] { get }
Additional flags to be passed to the C++ compiler.
var extraFlags: BuildFlags { get }
Additional flags to be passed to the build tools.
var extraSwiftCFlags: [String] { get }
Additional flags to be passed to the Swift compiler.
var sdk: AbsolutePath? { get set }
Root directory path of the SDK used to compile for the target triple.
var sdkRootDir: AbsolutePath? { get set }
Root directory path of the SDK used to compile for the target triple.
var supportsTesting: Bool { get }
Whether or not the receiver supports testing.
var toolchainBinDir: AbsolutePath { get }
Path to a directory containing the toolchain (compilers/linker) to be used for the compilation.