mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
As the headers are not part of the Swift package, the safe header search option cannot be used. The use of the unsafe flags enables building the package on Windows.
86 lines
2.5 KiB
Swift
86 lines
2.5 KiB
Swift
// swift-tools-version:5.9
|
|
//===--- Package.swift.in - SwiftCompiler SwiftPM package -----------------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2021 - 2022 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
import PackageDescription
|
|
|
|
private extension Target {
|
|
static func compilerModuleTarget(
|
|
name: String,
|
|
dependencies: [Dependency],
|
|
path: String? = nil,
|
|
sources: [String]? = nil,
|
|
swiftSettings: [SwiftSetting] = []) -> Target {
|
|
.target(
|
|
name: name,
|
|
dependencies: dependencies,
|
|
path: path ?? "Sources/\(name)",
|
|
exclude: ["CMakeLists.txt"],
|
|
sources: sources,
|
|
swiftSettings: [
|
|
.interoperabilityMode(.Cxx),
|
|
.unsafeFlags([
|
|
"-Xcc", "-I../include",
|
|
"-Xcc", "-I../../llvm-project/llvm/include",
|
|
"-Xcc", "-I../../llvm-project/clang/include",
|
|
"-cross-module-optimization",
|
|
]),
|
|
] + swiftSettings)
|
|
}
|
|
}
|
|
|
|
let package = Package(
|
|
name: "SwiftCompilerSources",
|
|
platforms: [
|
|
.macOS("10.9"),
|
|
],
|
|
products: [
|
|
.library(
|
|
name: "swiftCompilerModules",
|
|
type: .static,
|
|
targets: ["Basic", "AST", "Parse", "SIL", "Optimizer", "_CompilerRegexParser"]),
|
|
],
|
|
dependencies: [
|
|
],
|
|
// Note that targets and their dependencies must align with
|
|
// 'SwiftCompilerSources/Sources/CMakeLists.txt'
|
|
targets: [
|
|
.compilerModuleTarget(
|
|
name: "_CompilerRegexParser",
|
|
dependencies: [],
|
|
path: "_RegexParser_Sources",
|
|
swiftSettings: [
|
|
// Workaround until `_CompilerRegexParser` is imported as implementation-only
|
|
// by `_StringProcessing`.
|
|
.unsafeFlags([
|
|
"-Xfrontend",
|
|
"-disable-implicit-string-processing-module-import"
|
|
])]),
|
|
.compilerModuleTarget(
|
|
name: "Basic",
|
|
dependencies: []),
|
|
.compilerModuleTarget(
|
|
name: "AST",
|
|
dependencies: ["Basic"]),
|
|
.compilerModuleTarget(
|
|
name: "Parse",
|
|
dependencies: ["Basic", "AST", "_CompilerRegexParser"]),
|
|
.compilerModuleTarget(
|
|
name: "SIL",
|
|
dependencies: ["Basic"]),
|
|
.compilerModuleTarget(
|
|
name: "Optimizer",
|
|
dependencies: ["Basic", "SIL", "Parse"]),
|
|
],
|
|
cxxLanguageStandard: .cxx17
|
|
)
|