-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.zig
69 lines (57 loc) · 1.42 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
66
67
68
69
const std = @import("std");
pub fn build(b: *std.build.Builder) void {
const features = [_][]const u8{
"-DXINERAMA",
"-DICONS",
"-DSYSTRAY",
//"-TAG_PREVIEWS",
//"-DDEBUG",
};
const debug = false;
const args = features ++ [_][]const u8{
"-D_POSIX_C_SOURCE=200809L",
"-DVERSION=\"1.0\"",
"-std=c99",
"-pedantic",
"-Wall",
"-Wno-unused-function",
"-Wno-unused-variable",
};
const debugflags = [_][]const u8{
"-Wextra",
"-flto",
"-fsanitize=address,undefined,leak",
};
const opt = [_][]const u8{
"-march=native",
"-Ofast",
"-flto=auto",
};
if (debug) {
_ = args ++ debugflags;
} else {
_ = args ++ opt;
}
const libs = [_][]const u8{
"imlib2",
"x11-xcb",
"xcb",
"xcb-res",
"fontconfig",
"X11",
"Xft",
"Xrender",
"Xinerama",
};
const exe = b.addExecutable("demwm", null);
const mode = b.standardReleaseOptions();
exe.addCSourceFiles(&.{ "demwm.c", "util.c", "drw.c" }, &args);
exe.setBuildMode(mode);
exe.linkLibC();
// INCS = -I${X11INC} -I${FREETYPEINC}
exe.addIncludePath("/usr/X11R6/include");
exe.addLibraryPath("/usr/X11R6/lib");
// external libs
for (libs) |lib| exe.linkSystemLibrary(lib);
exe.install();
}