-
Notifications
You must be signed in to change notification settings - Fork 0
/
Package.swift
227 lines (223 loc) · 8.94 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
// swift-tools-version: 5.7
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
//#if !(arch(x86_64) || arch(arm64))
//fatalError("arch not supported")
//#endif
//
//#if !(os(Linux) || os(macOS))
//fatalError("os not supported")
//#endif
let package = Package(
name: "libwebsockets",
platforms: [
.macOS(.v10_15),
.iOS(.v13),
.watchOS(.v6),
.tvOS(.v13),
],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "libwebsockets",
targets: ["libwebsockets"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-nio.git", from: "2.57.0"),
// .package(url: "https://github.com/swift-server/swift-backtrace.git", from: "1.3.3"),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "libwebsockets",
dependencies: [
"Clibwebsockets",
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
.product(name: "NIOFoundationCompat", package: "swift-nio"),
]
),
.target(
name: "Clibwebsockets",
dependencies: ["COpenSSL", "CDBus", "CZlib", "Csqlite3"],
exclude: [
"include/",
"src/tls/tls-jit-trust.c",
"src/tls/mbedtls",
"src/system/metrics",
"src/system/ntpclient",
"src/system/dhcpclient",
"src/system/async-dns",
"src/system/fault-injection",
"src/secure-streams",
"src/roles/netlink",
"src/roles/raw-proxy",
"src/roles/http/server/access-log.c",
"src/roles/http/compression/brotli",
"src/roles/http/compression/deflate",
"src/roles/http/compression/stream.c",
"src/roles/http/server/ranges.c",
"src/roles/http/minilex.c",
"src/roles/h2/minihuf.c",
"src/roles/cgi",
"src/roles/dbus",
"src/roles/mqtt",
"src/plat/windows",
"src/plat/freertos",
"src/plat/optee",
"src/plat/unix/unix-spawn.c",
"src/plat/unix/android",
"src/misc/threadpool",
"src/misc/peer-limits.c",
"src/misc/fsmount.c",
"src/misc/getifaddrs.c",
"src/misc/daemonize.c",
"src/jose",
"src/event-libs/uloop",
"src/event-libs/sdevent",
"src/event-libs/libevent",
"src/event-libs/libev",
"src/event-libs/libuv",
"src/event-libs/glib",
"src/drivers",
"src/core-net/socks5-client.c",
"src/core-net/route.c",
"src/core-net/sequencer.c",
"src/abstract",
"src/CMakeLists.txt",
"src/README.md",
"src/abstract/CMakeLists.txt",
"src/abstract/README.md",
"src/core/CMakeLists.txt",
"src/core-net/CMakeLists.txt",
"src/core-net/README.md",
"src/cose/CMakeLists.txt",
"src/drivers/CMakeLists.txt",
"src/drivers/README.md",
"src/drivers/button/README.md",
"src/drivers/display/README.md",
"src/drivers/led/README.md",
"src/event-libs/CMakeLists.txt",
"src/event-libs/README.md",
"src/event-libs/glib/CMakeLists.txt",
"src/event-libs/libev/CMakeLists.txt",
"src/event-libs/libevent/CMakeLists.txt",
"src/event-libs/libuv/CMakeLists.txt",
"src/event-libs/poll/CMakeLists.txt",
"src/event-libs/sdevent/CMakeLists.txt",
"src/event-libs/uloop/CMakeLists.txt",
"src/jose/CMakeLists.txt",
"src/jose/README.md",
"src/misc/CMakeLists.txt",
"src/misc/fts/README.md",
"src/misc/lwsac/README.md",
"src/misc/threadpool/README.md",
"src/plat/freertos/CMakeLists.txt",
"src/plat/optee/CMakeLists.txt",
"src/plat/unix/CMakeLists.txt",
"src/plat/windows/CMakeLists.txt",
"src/roles/CMakeLists.txt",
"src/roles/README.md",
"src/roles/cgi/CMakeLists.txt",
"src/roles/dbus/CMakeLists.txt",
"src/roles/dbus/README.md",
"src/roles/h1/CMakeLists.txt",
"src/roles/h2/CMakeLists.txt",
"src/roles/http/CMakeLists.txt",
"src/roles/http/compression/README.md",
"src/roles/listen/CMakeLists.txt",
"src/roles/mqtt/CMakeLists.txt",
"src/roles/raw-file/CMakeLists.txt",
"src/roles/raw-proxy/CMakeLists.txt",
"src/roles/raw-skt/CMakeLists.txt",
"src/roles/ws/CMakeLists.txt",
"src/secure-streams/CMakeLists.txt",
"src/secure-streams/README.md",
"src/secure-streams/cpp/README.md",
"src/secure-streams/protocols/README.md",
"src/system/CMakeLists.txt",
"src/system/README.md",
"src/system/metrics/CMakeLists.txt",
"src/system/smd/CMakeLists.txt",
"src/system/smd/README.md",
"src/tls/CMakeLists.txt",
"src/tls/mbedtls/CMakeLists.txt",
],
sources: ["src/"],
publicHeadersPath: "include/",
cSettings: [
.headerSearchPath("include"),
.headerSearchPath("src"),
.headerSearchPath("src/abstract"),
.headerSearchPath("src/core"),
.headerSearchPath("src/core-net"),
.headerSearchPath("src/cose"),
.headerSearchPath("src/drivers"),
.headerSearchPath("src/event-libs"),
.headerSearchPath("src/jose"),
.headerSearchPath("src/misc"),
.headerSearchPath("src/plat"),
.headerSearchPath("src/plat/freertos"),
.headerSearchPath("src/plat/optee"),
.headerSearchPath("src/plat/unix"),
.headerSearchPath("src/plat/windows"),
.headerSearchPath("src/roles"),
.headerSearchPath("src/roles/cgi"),
.headerSearchPath("src/roles/dbus"),
.headerSearchPath("src/roles/h1"),
.headerSearchPath("src/roles/h2"),
.headerSearchPath("src/roles/http"),
.headerSearchPath("src/roles/listen"),
.headerSearchPath("src/roles/mqtt"),
.headerSearchPath("src/roles/netlink"),
.headerSearchPath("src/roles/pipe"),
.headerSearchPath("src/roles/raw-file"),
.headerSearchPath("src/roles/raw-proxy"),
.headerSearchPath("src/roles/raw-skt"),
.headerSearchPath("src/roles/ws"),
.headerSearchPath("src/secure-streams"),
.headerSearchPath("src/system"),
.headerSearchPath("src/system/smd"),
.headerSearchPath("src/system/metrics"),
.headerSearchPath("src/tls"),
.headerSearchPath("src/tls/openssl"),
]
),
.systemLibrary(name: "COpenSSL",
pkgConfig: "openssl",
providers: [
.brew(["openssl"]),
.apt(["libssl-dev"])
]
),
.systemLibrary(name: "CDBus",
pkgConfig: "dbus-1",
providers: [
.brew(["dbus"]),
.apt(["libdbus-1-dev"])
]
),
.systemLibrary(name: "CZlib",
pkgConfig: "zlib",
providers: [
// .brew(["zlib-devel"]),
.apt(["libz-dev"])
]
),
.systemLibrary(name: "Csqlite3",
pkgConfig: "sqlite3",
providers: [
.brew(["sqlite3"]),
.apt(["libsqlite3-dev"])
]
),
.testTarget(
name: "libwebsocketsTests",
dependencies: [
"libwebsockets",
.product(name: "NIOPosix", package: "swift-nio"),
// .product(name: "Backtrace", package: "swift-backtrace"),
]),
]
)