Add riverctl binary to build.zig

This commit is contained in:
Isaac Freund 2020-05-19 13:43:41 +02:00
parent 0904dc5346
commit 7cb6c5d75a
No known key found for this signature in database
GPG key ID: 86DED400DDFD7A11
3 changed files with 45 additions and 14 deletions

View file

@ -19,30 +19,35 @@ pub fn build(b: *std.build.Builder) !void {
const scan_protocols = ScanProtocolsStep.create(b);
const exe = b.addExecutable("river", "src/main.zig");
exe.setTarget(target);
exe.setBuildMode(mode);
exe.addBuildOption(bool, "xwayland", xwayland);
addDeps(exe, &scan_protocols.step);
exe.install();
const river = b.addExecutable("river", "src/river.zig");
river.setTarget(target);
river.setBuildMode(mode);
river.addBuildOption(bool, "xwayland", xwayland);
addServerDeps(river, &scan_protocols.step);
river.install();
const run_cmd = exe.run();
const run_cmd = river.run();
run_cmd.step.dependOn(b.getInstallStep());
const run_step = b.step("run", "Run the compositor");
run_step.dependOn(&run_cmd.step);
const test_exe = b.addTest("src/test_main.zig");
test_exe.setTarget(target);
test_exe.setBuildMode(mode);
test_exe.addBuildOption(bool, "xwayland", xwayland);
addDeps(test_exe, &scan_protocols.step);
const riverctl = b.addExecutable("riverctl", "src/riverctl.zig");
riverctl.setTarget(target);
riverctl.setBuildMode(mode);
riverctl.install();
const river_test = b.addTest("src/test_main.zig");
river_test.setTarget(target);
river_test.setBuildMode(mode);
river_test.addBuildOption(bool, "xwayland", xwayland);
addServerDeps(river_test, &scan_protocols.step);
const test_step = b.step("test", "Run the tests");
test_step.dependOn(&test_exe.step);
test_step.dependOn(&river_test.step);
}
fn addDeps(exe: *std.build.LibExeObjStep, protocol_step: *std.build.Step) void {
fn addServerDeps(exe: *std.build.LibExeObjStep, protocol_step: *std.build.Step) void {
exe.step.dependOn(protocol_step);
exe.addIncludeDir("protocol");
exe.addCSourceFile("protocol/river-window-management-unstable-v1-protocol.c", &[_][]const u8{"-std=c99"});

26
src/riverctl.zig Normal file
View file

@ -0,0 +1,26 @@
// This file is part of river, a dynamic tiling wayland compositor.
//
// Copyright 2020 Isaac Freund
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
const std = @import("std");
const c = @cImport({
@cInclude();
});
pub fn main() void {
std.debug.warn("hello world\n", .{});
}