56 lines
1.7 KiB
Zig
56 lines
1.7 KiB
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
const exe_mod = b.createModule(.{
|
|
.root_source_file = b.path("src/main.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
|
|
const exe = b.addExecutable(.{
|
|
.name = "snake",
|
|
.root_module = exe_mod,
|
|
});
|
|
|
|
const raylib_dep = b.dependency("raylib_zig", .{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.shared = true,
|
|
});
|
|
|
|
const raylib = raylib_dep.module("raylib");
|
|
const raygui = raylib_dep.module("raygui");
|
|
const raylib_artifact = raylib_dep.artifact("raylib");
|
|
|
|
raylib_artifact.root_module.addCMacro("SUPPORT_FILEFORMAT_JPG", "");
|
|
|
|
exe.linkLibrary(raylib_artifact);
|
|
exe.root_module.addImport("raylib", raylib);
|
|
exe.root_module.addImport("raygui", raygui);
|
|
|
|
b.installArtifact(exe);
|
|
|
|
const run_cmd = b.addRunArtifact(exe);
|
|
run_cmd.step.dependOn(b.getInstallStep());
|
|
|
|
if (b.args) |args| {
|
|
run_cmd.addArgs(args);
|
|
}
|
|
|
|
const run_step = b.step("run", "Run the app");
|
|
run_step.dependOn(&run_cmd.step);
|
|
|
|
const main_tests = b.addTest(.{ .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize });
|
|
const game_tests = b.addTest(.{ .root_source_file = b.path("src/game.zig"), .target = target, .optimize = optimize });
|
|
|
|
const run_exe_main_tests = b.addRunArtifact(main_tests);
|
|
const run_exe_game_tests = b.addRunArtifact(game_tests);
|
|
|
|
const test_step = b.step("test", "Run unit tests");
|
|
test_step.dependOn(&run_exe_main_tests.step);
|
|
test_step.dependOn(&run_exe_game_tests.step);
|
|
}
|