Reorganize and refactor project tooling
This commit is contained in:
parent
489ece4b7b
commit
1891a420e8
|
@ -2,13 +2,13 @@
|
|||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Build",
|
||||
"name": "Debug",
|
||||
"type": "gdb",
|
||||
"request": "launch",
|
||||
"target": "${workspaceFolder}/zig-out/bin/ona",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"valuesFormatting": "parseText",
|
||||
"preLaunchTask": "Build",
|
||||
"preLaunchTask": "Build Debug",
|
||||
},
|
||||
{
|
||||
"name": "Test",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Build",
|
||||
"label": "Build Debug",
|
||||
"type": "shell",
|
||||
"command": "zig build",
|
||||
|
||||
|
@ -41,15 +41,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Test",
|
||||
"type": "shell",
|
||||
"command": "$(find zig-cache -name test) src/main.zig",
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
},
|
||||
},
|
||||
{
|
||||
"label": "Build Test",
|
||||
"type": "shell",
|
||||
|
|
42
build.zig
42
build.zig
|
@ -10,39 +10,35 @@ pub fn build(builder: *std.build.Builder) void {
|
|||
|
||||
// Engine executable.
|
||||
{
|
||||
const engine_exe = builder.addExecutable("ona", "./src/engine/main.zig");
|
||||
const oar_pkg = projectPkg("oar", &.{ona_pkg});
|
||||
const exe = builder.addExecutable("engine", "./src/engine/main.zig");
|
||||
|
||||
engine_exe.addPackage(oar_pkg);
|
||||
engine_exe.addPackage(ona_pkg);
|
||||
engine_exe.setTarget(target);
|
||||
engine_exe.setBuildMode(mode);
|
||||
engine_exe.install();
|
||||
engine_exe.addIncludeDir("./ext");
|
||||
engine_exe.linkSystemLibrary("SDL2");
|
||||
engine_exe.linkLibC();
|
||||
|
||||
const run_cmd = engine_exe.run();
|
||||
|
||||
run_cmd.step.dependOn(builder.getInstallStep());
|
||||
|
||||
if (builder.args) |args| run_cmd.addArgs(args);
|
||||
|
||||
builder.step("run", "Run Ona application").dependOn(&run_cmd.step);
|
||||
exe.addPackage(projectPkg("oar", &.{ona_pkg}));
|
||||
exe.addPackage(ona_pkg);
|
||||
exe.setTarget(target);
|
||||
exe.setBuildMode(mode);
|
||||
exe.install();
|
||||
exe.addIncludeDir("./ext");
|
||||
exe.linkSystemLibrary("SDL2");
|
||||
exe.linkLibC();
|
||||
}
|
||||
|
||||
// Oar executable.
|
||||
{
|
||||
const exe = builder.addExecutable("oar", "./src/oar/main.zig");
|
||||
|
||||
exe.addPackage(ona_pkg);
|
||||
exe.setTarget(target);
|
||||
exe.setBuildMode(mode);
|
||||
exe.install();
|
||||
}
|
||||
|
||||
// Ona tests.
|
||||
// Tests executable.
|
||||
{
|
||||
const ona_tests = builder.addTestExe("test", "./src/main.zig");
|
||||
const tests = builder.addTestExe("test", "./src/tests.zig");
|
||||
|
||||
ona_tests.setTarget(target);
|
||||
ona_tests.setBuildMode(mode);
|
||||
builder.step("test", "Run Ona unit tests").dependOn(&ona_tests.step);
|
||||
tests.setTarget(target);
|
||||
tests.setBuildMode(mode);
|
||||
builder.step("test", "Run unit tests").dependOn(&tests.step);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ const std = @import("std");
|
|||
const sys = @import("./sys.zig");
|
||||
|
||||
///
|
||||
/// Entry point.
|
||||
/// Starts the the game engine.
|
||||
///
|
||||
pub fn main() anyerror!void {
|
||||
return nosuspend await async sys.runGraphics(anyerror, run);
|
||||
|
|
|
@ -48,7 +48,7 @@ pub const Archive = struct {
|
|||
.header = find_header: {
|
||||
var header = Entry.Header{
|
||||
.revision = 0,
|
||||
.path = Path.empty,
|
||||
.path = std.mem.zeroes(Path),
|
||||
.file_size = 0,
|
||||
.absolute_offset = 0
|
||||
};
|
||||
|
@ -161,9 +161,13 @@ pub const Entry = struct {
|
|||
pub const Path = extern struct {
|
||||
buffer: [255]u8,
|
||||
length: u8,
|
||||
};
|
||||
|
||||
///
|
||||
/// Starts the **O**na **Ar**chive packer utility.
|
||||
///
|
||||
///
|
||||
pub const empty = std.mem.zeroes(Path);
|
||||
};
|
||||
pub fn main() u8 {
|
||||
// TODO: Implement.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
test {
|
||||
_ = @import("./engine/main.zig");
|
||||
_ = @import("./oar/main.zig");
|
||||
_ = @import("./ona/main.zig");
|
||||
}
|
Loading…
Reference in New Issue