-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.zig
59 lines (44 loc) · 1.4 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
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const libs_to_link = [_][]const u8{"mysqlclient","zstd","ssl", "crypto" ,"resolv" ,"m"};
const module = b.addModule("zconn", .{
.root_source_file = std.Build.LazyPath.relative("src/root.zig"),
});
const lib = b.addStaticLibrary(.{
.name = "zconn",
.root_source_file = .{ .path = "src/root.zig"},
.optimize = optimize,
.target = target
});
lib.linkLibC();
for(libs_to_link) |l| {
lib.linkSystemLibrary(l);
}
b.installArtifact(lib);
const main_tests = b.addTest(.{
.root_source_file = .{ .path = "tests.zig" },
.optimize = optimize,
.link_libc = true,
});
for(libs_to_link) |l| {
main_tests.linkSystemLibrary(l);
}
const run_tests = b.addRunArtifact(main_tests);
const test_step = b.step("test", "Run library tests");
test_step.dependOn(&run_tests.step);
const short = b.addExecutable(.{
.target = target,
.name = "short",
.root_source_file = .{ .path = "src/main.zig" },
.optimize = optimize
});
short.linkLibC();
for(libs_to_link) |l| {
short.linkSystemLibrary(l);
}
//short.root_module.addImport("zconn", module);
b.installArtifact(short);
_ = module;
}