switch from raylib to capy

This commit is contained in:
Fabien Freling 2024-05-04 19:03:50 +02:00
parent f5a5157e80
commit b4202d4120
11 changed files with 56 additions and 103 deletions

View file

@ -1,48 +1,29 @@
const std = @import("std");
const raylib = @import("./3rdparty/raylib/src/build.zig");
const capy = @import("capy");
pub fn build(b: *std.build.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.
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const mode = b.standardOptimizeOption(.{});
// Standard release options allow the person running `zig build` to select
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
const mode = b.standardReleaseOptions();
const exe = b.addExecutable(.{
.name = "doggo",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = mode,
});
const exe = b.addExecutable("doggo", "src/main.zig");
exe.setTarget(target);
b.installArtifact(exe);
const ray = raylib.addRaylib(b, exe.target);
exe.linkLibrary(ray);
exe.addIncludeDir("3rdparty/raylib/src");
exe.addIncludeDir("3rdparty/raygui/src");
exe.addIncludeDir("3rdparty/raygui/examples");
const raylib_flags = &[_][]const u8{
"-std=gnu99",
"-DPLATFORM_DESKTOP",
"-DGL_SILENCE_DEPRECATION=199309L",
"-fno-sanitize=undefined",
};
exe.addCSourceFile("src/raylib.c", raylib_flags);
exe.setBuildMode(mode);
exe.install();
const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_cmd = try capy.install(exe, .{ .args = b.args });
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
run_step.dependOn(run_cmd);
const exe_tests = b.addTest("src/main.zig");
exe_tests.setTarget(target);
exe_tests.setBuildMode(mode);
const exe_tests = b.addTest(.{
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = mode,
});
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&exe_tests.step);