diff options
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 36 |
1 files changed, 20 insertions, 16 deletions
@@ -6,6 +6,8 @@ pub fn build(b: *std.Build) !void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); + const vaxis_dep = b.dependency("vaxis", .{}); + const gloves_module = b.createModule(.{ .root_source_file = b.path("src/gloves.zig"), .target = target, @@ -33,6 +35,8 @@ pub fn build(b: *std.Build) !void { }), }); + shock.root_module.addImport("vaxis", vaxis_dep.module("vaxis")); + const capstone_lib = capstone(b, .{ .optimize = optimize, .target = target, @@ -73,34 +77,34 @@ pub fn build(b: *std.Build) !void { }); // Looooopy - const gcc_test = b.addSystemCommand(&.{"gcc"}); - gcc_test.addFileArg(b.path("tests/c/hello-world.c")); - gcc_test.addArg("-o"); - const gcc_hello_file = gcc_test.addOutputFileArg("hello-world"); + const c_file = b.createModule(.{ + .optimize = .ReleaseFast, + .target = target, + .link_libc = true, + }); + const c_test_exe = b.addExecutable(.{ + .root_module = c_file, + .name = "sample_exe", + }); + c_file.addCSourceFile(.{ .file = b.path("tests/c/hello-world.c") }); - const runner = b.addRunArtifact(shock); - runner.addFileArg(gcc_hello_file); - runner.addFileArg(gcc_hello_file); + const runner = b.addRunArtifact(elfo); + runner.addArtifactArg(c_test_exe); const loop_step = b.step("loop", "Interative Programming Loop! you should run it with watch: i.e. zig build loop --watch"); loop_step.dependOn(&runner.step); // --- - const test_step = b.step("test", "Run unit tests"); - const run_elfo_step = b.step("elfo", "See the pretty elfo!"); - const run_shock_step = b.step("shock", "SHOCK something!"); - const run_gloves_step = b.step("gloves", "See the pretty gloves!"); - const zls_check = b.step("check", "Check if the program compiles"); zls_check.dependOn(&elfo.step); zls_check.dependOn(&shock.step); zls_check.dependOn(&unit_tests.step); const run_steps = [_]struct { *std.Build.Step, *std.Build.Step.Compile }{ - .{ test_step, unit_tests }, - .{ run_elfo_step, elfo }, - .{ run_gloves_step, gloves }, - .{ run_shock_step, shock }, + .{ b.step("test", "Run unit tests"), unit_tests }, + .{ b.step("elfo", "See the pretty elfo!"), elfo }, + .{ b.step("gloves", "See the pretty gloves!"), gloves }, + .{ b.step("shock", "SHOCK something!"), shock }, }; const gdbscript = b.addWriteFile("gdbscript", |
