-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPackage.swift
73 lines (67 loc) · 1.72 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
70
71
72
73
// swift-tools-version: 5.10
import PackageDescription
let embeddedSwiftSettings: [SwiftSetting] = [
.enableExperimentalFeature("Embedded"),
.interoperabilityMode(.Cxx),
.unsafeFlags([
"-wmo", "-disable-cmo",
"-Xfrontend", "-gnone",
"-Xfrontend", "-disable-stack-protector",
"-Xfrontend", "-emit-empty-object-file"
])
]
let embeddedCSettings: [CSetting] = [
.unsafeFlags(["-fdeclspec"])
]
let linkerSettings: [LinkerSetting] = [
.unsafeFlags([
"-Xclang-linker", "-nostdlib",
"-Xlinker", "--no-entry"
])
]
let libcSettings: [CSetting] = [
.define("LACKS_TIME_H"),
.define("LACKS_SYS_TYPES_H"),
.define("LACKS_STDLIB_H"),
.define("LACKS_STRING_H"),
.define("LACKS_SYS_MMAN_H"),
.define("LACKS_FCNTL_H"),
.define("NO_MALLOC_STATS", to: "1"),
.define("__wasilibc_unmodified_upstream"),
]
let package = Package(
name: "EmbeddedFoundation",
products: [
.library(
name: "Foundation",
targets: [
"Foundation"
]
),
],
targets: [
.target(
name: "Foundation",
dependencies: [
"_CFoundation"
],
cSettings: embeddedCSettings,
swiftSettings: embeddedSwiftSettings,
linkerSettings: linkerSettings
),
.target(
name: "_CFoundation",
dependencies: [
"dlmalloc"
],
cSettings: libcSettings
),
.target(
name: "dlmalloc",
cSettings: libcSettings
),
.testTarget(
name: "FoundationTests",
dependencies: ["Foundation"]),
]
)