aboutsummaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorNic Gaffney <gaffney_nic@protonmail.com>2024-06-11 21:48:36 -0500
committerNic Gaffney <gaffney_nic@protonmail.com>2024-06-11 21:48:36 -0500
commitd26fb18e04d4a02a4e9c186a00a1db1969330a1b (patch)
tree59adb427488f6cc19df6a9ce57f07e34fd5666e0 /build.zig
downloadparticle-sim-d26fb18e04d4a02a4e9c186a00a1db1969330a1b.tar.gz
Initial Commit
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig50
1 files changed, 50 insertions, 0 deletions
diff --git a/build.zig b/build.zig
new file mode 100644
index 0000000..e1266e6
--- /dev/null
+++ b/build.zig
@@ -0,0 +1,50 @@
+const std = @import("std");
+
+pub fn build(b: *std.Build) void {
+ const target = b.standardTargetOptions(.{});
+
+ const optimize = b.standardOptimizeOption(.{});
+
+ const exe = b.addExecutable(.{
+ .name = "particle-sim",
+ .root_source_file = b.path("src/main.zig"),
+ .target = target,
+ .optimize = optimize,
+ });
+
+ 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 exe_unit_tests = b.addTest(.{
+ .root_source_file = b.path("src/main.zig"),
+ .target = target,
+ .optimize = optimize,
+ });
+
+ const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
+
+ const test_step = b.step("test", "Run unit tests");
+ test_step.dependOn(&run_exe_unit_tests.step);
+
+ const raylib_dep = b.dependency("raylib-zig", .{
+ .target = target,
+ .optimize = optimize,
+ });
+
+ const raylib = raylib_dep.module("raylib"); // main raylib module
+ const raygui = raylib_dep.module("raygui"); // raygui module
+ const raylib_artifact = raylib_dep.artifact("raylib"); // raylib C library
+ exe.linkLibrary(raylib_artifact);
+ exe.root_module.addImport("raylib", raylib);
+ exe.root_module.addImport("raygui", raygui);
+}