-
-
Notifications
You must be signed in to change notification settings - Fork 7
48 lines (44 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// swift-tools-version: 6.0
import PackageDescription
let shouldBuildForEmbedded = Context.environment["JAVASCRIPTKIT_EXPERIMENTAL_EMBEDDED_WASM"].flatMap(Bool.init) ?? false
var featureFlags: [SwiftSetting] = [
.enableUpcomingFeature("ExistentialAny"),
]
if shouldBuildForEmbedded {
// currently this work-around only works for SwiftPM package dependencies on branches, not version tags
// see https://github.com/swiftlang/swift-package-manager/issues/7612
featureFlags.append(contentsOf: [
.enableExperimentalFeature("Embedded"),
.enableExperimentalFeature("Extern"),
.unsafeFlags([
"-Xfrontend", "-emit-empty-object-file",
]),
])
}
let package = Package(
name: "elementary",
platforms: [
.macOS(.v14),
.iOS(.v17),
.tvOS(.v17),
.watchOS(.v10),
],
products: [
.library(
name: "Elementary",
targets: ["Elementary"]
),
],
targets: [
.target(
name: "Elementary",
cSettings: shouldBuildForEmbedded ? [.unsafeFlags(["-fdeclspec"])] : nil,
swiftSettings: featureFlags
),
.testTarget(
name: "ElementaryTests",
dependencies: ["Elementary"],
swiftSettings: featureFlags
),
]
)