-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.zig
56 lines (46 loc) · 1.76 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
const std = @import("std");
const mem = std.mem;
const fs = std.fs;
const Builder = std.build.Builder;
const ArrayList = std.ArrayList;
const builtin = @import("builtin");
const Target = std.Target;
const FileSource = std.build.FileSource;
pub fn build(b: *Builder) void {
const exe = b.addExecutable("iotmonitor", "iotmonitor.zig");
const target = b.standardTargetOptions(.{});
exe.setTarget(target);
exe.setBuildMode(b.standardReleaseOptions());
exe.addPackagePath("toml", "zig-toml/src/toml.zig");
exe.addPackagePath("clap", "zig-clap/clap.zig");
exe.addPackage(.{
.name = "routez",
.path = FileSource.relative("routez/src/routez.zig"),
.dependencies = &[_]std.build.Pkg{.{
.name = "zuri",
.path = FileSource.relative("routez/zuri/src/zuri.zig"),
}},
});
const Activate_Tracy = false;
if (Activate_Tracy) {
exe.addPackage(.{ .name = "tracy", .path = FileSource.relative("zig-tracy/src/lib.zig") });
exe.addIncludeDir("tracy/");
exe.addLibPath("tracy/library/unix");
exe.linkSystemLibrary("tracy-debug");
} else {
exe.addPackage(.{ .name = "tracy", .path = FileSource.relative("nozig-tracy/src/lib.zig") });
}
exe.setOutputDir("bin");
// exe.setTarget(.{ .cpu = builtin.Arch.arm });
// stripping symbols reduce the size of the exe
// exe.strip = true;
exe.linkLibC();
// static add the paho mqtt library
exe.addIncludeDir("paho.mqtt.c/src");
exe.addLibPath("paho.mqtt.c/build/output");
exe.addLibPath("paho.mqtt.c/src");
exe.addObjectFile("paho.mqtt.c/src/libpaho-mqtt3c.a");
// these libs are needed by leveldb backend
exe.linkSystemLibrary("leveldb");
b.default_step.dependOn(&exe.step);
}