initial
This commit is contained in:
79
build.zig
Normal file
79
build.zig
Normal file
@@ -0,0 +1,79 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const engineStatic = b.addStaticLibrary(.{
|
||||
.name = "neonucleus",
|
||||
.root_source_file = b.path("src/engine.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const install = b.getInstallStep();
|
||||
|
||||
b.installArtifact(engineStatic);
|
||||
|
||||
const engineShared = b.addSharedLibrary(.{
|
||||
.name = "neonucleus",
|
||||
.root_source_file = b.path("src/engine.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
b.installArtifact(engineShared);
|
||||
|
||||
const engineStep = b.step("engine", "Builds the engine as a static library");
|
||||
engineStep.dependOn(&engineStatic.step);
|
||||
engineStep.dependOn(install);
|
||||
|
||||
const sharedStep = b.step("shared", "Builds the engine as a shared library");
|
||||
sharedStep.dependOn(&engineShared.step);
|
||||
sharedStep.dependOn(install);
|
||||
|
||||
const emulator = b.addExecutable(.{
|
||||
.name = "neunucleus",
|
||||
.root_source_file = b.path("src/main.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
// forces us to link in everything too
|
||||
emulator.linkLibrary(engineStatic);
|
||||
|
||||
b.installArtifact(emulator);
|
||||
b.step("emulator", "Builds the emulator").dependOn(&emulator.step);
|
||||
|
||||
const run_cmd = b.addRunArtifact(emulator);
|
||||
|
||||
run_cmd.step.dependOn(install);
|
||||
|
||||
if (b.args) |args| {
|
||||
run_cmd.addArgs(args);
|
||||
}
|
||||
|
||||
const run_step = b.step("run", "Run the emulator");
|
||||
run_step.dependOn(&run_cmd.step);
|
||||
|
||||
const lib_unit_tests = b.addTest(.{
|
||||
.root_source_file = b.path("src/engine.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
|
||||
|
||||
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_lib_unit_tests.step);
|
||||
test_step.dependOn(&run_exe_unit_tests.step);
|
||||
}
|
||||
Reference in New Issue
Block a user