forked from uNetworking/uSockets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
65 lines (53 loc) · 1.79 KB
/
build.zig
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
const std = @import("std");
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const single_threaded = b.option(bool, "single_threaded", "Build single threaded") orelse false;
// const openssl = b.dependency("openssl", .{});
const lib = b.addStaticLibrary(.{
.name = "uSockets",
.target = target,
.optimize = optimize,
.single_threaded = single_threaded,
.root_source_file = .{ .path = "src/bsd.c" },
});
// lib.defineCMacro("WITH_OPENSSL", null);
// lib.defineCMacro("LIBUS_USE_OPENSSL", null);
lib.defineCMacro("LIBUS_NO_SSL", null);
lib.addCSourceFiles(&.{
"src/context.c",
"src/loop.c",
"src/quic.c",
"src/socket.c",
"src/udp.c",
"src/crypto/openssl.c",
"src/eventing/epoll_kqueue.c",
"src/eventing/gcd.c",
"src/eventing/libuv.c",
"src/io_uring/io_context.c",
"src/io_uring/io_loop.c",
"src/io_uring/io_socket.c",
}, &.{});
// lib.addCSourceFiles(&.{
// "src/crypto/sni_tree.cpp",
// }, &.{
// "-std=c++17",
// });
if (target.isWindows()) {
const uv = b.dependency("uv", .{
.target = target,
.optimize = optimize,
.single_threaded = single_threaded,
});
lib.linkLibrary(uv.artifact("uv"));
lib.defineCMacro("LIBUS_USE_LIBUV", null);
}
lib.linkLibCpp();
lib.linkLibC();
lib.addIncludePath(.{ .path = "capi" });
lib.addIncludePath(.{ .path = "src" });
// lib.linkLibrary(openssl.artifact("ssl"));
// lib.linkLibrary(openssl.artifact("crypto"));
lib.installHeader("src/libusockets.h", "libusockets.h");
b.installArtifact(lib);
}