2020-03-19 08:29:22 -07:00
|
|
|
const Builder = @import("std").build.Builder;
|
|
|
|
|
|
|
|
pub fn build(b: *Builder) void {
|
|
|
|
// Standard target options allows the person running `zig build` to choose
|
|
|
|
// what target to build for. Here we do not override the defaults, which
|
|
|
|
// means any target is allowed, and the default is native. Other options
|
|
|
|
// for restricting supported target set are available.
|
|
|
|
const target = b.standardTargetOptions(.{});
|
|
|
|
|
|
|
|
// Standard release options allow the person running `zig build` to select
|
|
|
|
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
|
|
|
|
const mode = b.standardReleaseOptions();
|
|
|
|
|
2020-03-27 03:58:59 -07:00
|
|
|
const exe = b.addExecutable("river", "src/main.zig");
|
2020-03-19 08:29:22 -07:00
|
|
|
exe.setTarget(target);
|
|
|
|
exe.setBuildMode(mode);
|
2020-04-08 15:05:28 -07:00
|
|
|
|
|
|
|
exe.addIncludeDir(".");
|
2020-03-20 18:34:59 -07:00
|
|
|
exe.addIncludeDir("protocol");
|
2020-03-21 08:55:42 -07:00
|
|
|
exe.addCSourceFile("include/render.c", &[_][]const u8{"-std=c99"});
|
2020-04-08 15:05:28 -07:00
|
|
|
|
|
|
|
exe.linkLibC();
|
2020-03-20 14:52:03 -07:00
|
|
|
exe.linkSystemLibrary("wayland-server");
|
|
|
|
exe.linkSystemLibrary("wlroots");
|
|
|
|
exe.linkSystemLibrary("xkbcommon");
|
2020-04-08 15:05:28 -07:00
|
|
|
|
2020-03-19 08:29:22 -07:00
|
|
|
exe.install();
|
|
|
|
|
|
|
|
const run_cmd = exe.run();
|
|
|
|
run_cmd.step.dependOn(b.getInstallStep());
|
|
|
|
|
2020-04-03 09:53:36 -07:00
|
|
|
const run_step = b.step("run", "Run the compositor");
|
2020-03-19 08:29:22 -07:00
|
|
|
run_step.dependOn(&run_cmd.step);
|
2020-04-03 09:53:36 -07:00
|
|
|
|
|
|
|
const test_exe = b.addTest("src/test_main.zig");
|
|
|
|
test_exe.setTarget(target);
|
|
|
|
test_exe.setBuildMode(mode);
|
2020-04-08 15:05:28 -07:00
|
|
|
|
|
|
|
test_exe.addIncludeDir(".");
|
2020-04-03 09:53:36 -07:00
|
|
|
test_exe.addIncludeDir("protocol");
|
|
|
|
test_exe.addCSourceFile("include/render.c", &[_][]const u8{"-std=c99"});
|
2020-04-08 15:05:28 -07:00
|
|
|
|
|
|
|
test_exe.linkLibC();
|
2020-04-03 09:53:36 -07:00
|
|
|
test_exe.linkSystemLibrary("wayland-server");
|
|
|
|
test_exe.linkSystemLibrary("wlroots");
|
|
|
|
test_exe.linkSystemLibrary("xkbcommon");
|
|
|
|
|
|
|
|
const test_step = b.step("test", "Run the tests");
|
|
|
|
test_step.dependOn(&test_exe.step);
|
2020-03-19 08:29:22 -07:00
|
|
|
}
|