-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
Package.swift
69 lines (66 loc) · 2.55 KB
/
Package.swift
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// swift-tools-version:5.8
import PackageDescription
// NOTE: needed for embedded customizations, ideally this will not be necessary at all in the future, or can be replaced with traits
let shouldBuildForEmbedded = Context.environment["JAVASCRIPTKIT_EXPERIMENTAL_EMBEDDED_WASM"].flatMap(Bool.init) ?? false
let package = Package(
name: "JavaScriptKit",
products: [
.library(name: "JavaScriptKit", targets: ["JavaScriptKit"]),
.library(name: "JavaScriptEventLoop", targets: ["JavaScriptEventLoop"]),
.library(name: "JavaScriptBigIntSupport", targets: ["JavaScriptBigIntSupport"]),
.library(name: "JavaScriptEventLoopTestSupport", targets: ["JavaScriptEventLoopTestSupport"]),
],
targets: [
.target(
name: "JavaScriptKit",
dependencies: ["_CJavaScriptKit"],
resources: shouldBuildForEmbedded ? [] : [.copy("Runtime")],
cSettings: shouldBuildForEmbedded ? [
.unsafeFlags(["-fdeclspec"])
] : nil,
swiftSettings: shouldBuildForEmbedded
? [
.enableExperimentalFeature("Embedded"),
.enableExperimentalFeature("Extern"),
.unsafeFlags(["-Xfrontend", "-emit-empty-object-file"])
] : nil
),
.target(name: "_CJavaScriptKit"),
.target(
name: "JavaScriptBigIntSupport",
dependencies: ["_CJavaScriptBigIntSupport", "JavaScriptKit"]
),
.target(name: "_CJavaScriptBigIntSupport", dependencies: ["_CJavaScriptKit"]),
.target(
name: "JavaScriptEventLoop",
dependencies: ["JavaScriptKit", "_CJavaScriptEventLoop"]
),
.testTarget(
name: "JavaScriptEventLoopTests",
dependencies: [
"JavaScriptEventLoop",
"JavaScriptKit",
"JavaScriptEventLoopTestSupport",
],
swiftSettings: [
.enableExperimentalFeature("Extern")
]
),
.target(name: "_CJavaScriptEventLoop"),
.target(
name: "JavaScriptEventLoopTestSupport",
dependencies: [
"_CJavaScriptEventLoopTestSupport",
"JavaScriptEventLoop",
]
),
.target(name: "_CJavaScriptEventLoopTestSupport"),
.testTarget(
name: "JavaScriptEventLoopTestSupportTests",
dependencies: [
"JavaScriptKit",
"JavaScriptEventLoopTestSupport"
]
),
]
)