From 7cb6c5d75a067539065089c51a603cd1de705e12 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Tue, 19 May 2020 13:43:41 +0200 Subject: [PATCH] Add riverctl binary to build.zig --- build.zig | 33 +++++++++++++++++++-------------- src/{main.zig => river.zig} | 0 src/riverctl.zig | 26 ++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 14 deletions(-) rename src/{main.zig => river.zig} (100%) create mode 100644 src/riverctl.zig diff --git a/build.zig b/build.zig index d57a142..2e66934 100644 --- a/build.zig +++ b/build.zig @@ -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"}); diff --git a/src/main.zig b/src/river.zig similarity index 100% rename from src/main.zig rename to src/river.zig diff --git a/src/riverctl.zig b/src/riverctl.zig new file mode 100644 index 0000000..b26bcb7 --- /dev/null +++ b/src/riverctl.zig @@ -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 . + +const std = @import("std"); + +const c = @cImport({ + @cInclude(); +}); + +pub fn main() void { + std.debug.warn("hello world\n", .{}); +}