stuff is broken right now but we going to fix it
This commit is contained in:
parent
fc8165eb83
commit
fdb23323fe
31
CLAUDE.md
31
CLAUDE.md
|
|
@ -96,6 +96,37 @@ The shader compilation system automatically discovers `.hlsl` files in `engine/*
|
|||
- The build system generates API wrappers automatically for enabled modules
|
||||
- Content directory location is determined by `content.txt` file pointing to `projects/content/`
|
||||
|
||||
### MakeModlib Build Helper
|
||||
|
||||
The project uses a custom `MakeModlib` helper function (defined in `lib/bh/build.zig`) to create library modules with consistent patterns:
|
||||
|
||||
```zig
|
||||
const mylib = bh.MakeModlib(b, .{
|
||||
.name = "mylib",
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.static_build = static_build,
|
||||
.root = b.path("src/mylib.zig"),
|
||||
});
|
||||
```
|
||||
|
||||
**What MakeModlib creates:**
|
||||
- A Zig module (`.mod`) for compile-time imports
|
||||
- A library artifact (`.lib`) for linking (static or dynamic based on `static_build` flag)
|
||||
- The library uses an empty stub source file and is intended to carry C dependencies
|
||||
|
||||
**Usage pattern:**
|
||||
All libraries using `MakeModlib` follow this pattern in their test executables:
|
||||
```zig
|
||||
tests.root_module.addImport("mylib", mylib.mod); // Import the module
|
||||
tests.root_module.linkLibrary(mylib.lib); // Link the library
|
||||
```
|
||||
|
||||
**Libraries using MakeModlib:**
|
||||
- `bh`, `cimgui`, `enet`, `lua`, `miniaudio`, `nfd`, `objLoader`, `p2`, `packer`, `spng`, `tracy`, `watcher`, `zgltf`, `zmath`
|
||||
|
||||
This pattern separates Zig code (in the module) from C/C++ dependencies (in the library), allowing for flexible static/dynamic linking while maintaining consistent module interfaces.
|
||||
|
||||
## Common Development Tasks
|
||||
|
||||
- Adding new engine modules: Create in `engine/` with `build.zig` and add to `engineDepList`
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
const std = @import("std");
|
||||
pub const bh = @import("bh");
|
||||
|
||||
pub const ModLib = bh.ModLib;
|
||||
pub const MakeModLib = bh.MakeModLib;
|
||||
|
||||
const dependencyList = [_][]const u8{
|
||||
"p2",
|
||||
|
|
@ -12,6 +16,8 @@ pub fn build(b: *std.Build) void {
|
|||
const optimize = b.standardOptimizeOption(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
|
||||
const core = MakeModLib();
|
||||
|
||||
const mod = b.addModule("core", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
// with -Dtracy = false, this one pulls in no C dependencies
|
||||
.tracy = .{ .path = "../../lib/tracy" },
|
||||
.bh = .{.path = "../../lib/bh" }
|
||||
|
||||
// these are zig only
|
||||
.zmath = .{ .path = "../../lib/zmath" },
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ pub fn MakeModlib(b: *std.Build, o: ModLibOptions) ModLib {
|
|||
const mod = b.addModule(o.name, .{
|
||||
.target = o.target,
|
||||
.optimize = o.optimize,
|
||||
.root_source_file = if (o.root != null) o.root.? else b.path(b.fmt("src/{s}", .{o.name})),
|
||||
.root_source_file = if (o.root != null) o.root.? else b.path(b.fmt("src/{s}.zig", .{o.name})),
|
||||
});
|
||||
|
||||
const empty_file = b.addWriteFile("stubs", "");
|
||||
|
|
|
|||
|
|
@ -1,45 +1,39 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
// very tiny, not intended to build anything just to run tests linked with libc
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
_ = static_build;
|
||||
|
||||
const mod = b.addModule("cimgui", .{
|
||||
const cimgui = bh.MakeModlib(b, .{
|
||||
.name = "cimgui",
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.link_libc = true,
|
||||
.root_source_file = b.path("src/cimgui.zig"),
|
||||
.static_build = static_build,
|
||||
});
|
||||
|
||||
mod.addIncludePath(b.path("cimgui/imgui"));
|
||||
mod.addIncludePath(b.path("cimgui/SDL/include"));
|
||||
mod.addIncludePath(b.path("cimplot"));
|
||||
mod.addIncludePath(b.path("cimplot/implot"));
|
||||
cimgui.install();
|
||||
|
||||
const cimgui = b.addLibrary(.{
|
||||
.name = "cimgui",
|
||||
.root_module = b.createModule(.{
|
||||
.optimize = optimize,
|
||||
.target = target,
|
||||
}),
|
||||
});
|
||||
cimgui.mod.addIncludePath(b.path("cimgui/imgui"));
|
||||
cimgui.mod.addIncludePath(b.path("cimgui/SDL/include"));
|
||||
cimgui.mod.addIncludePath(b.path("cimplot"));
|
||||
cimgui.mod.addIncludePath(b.path("cimplot/implot"));
|
||||
|
||||
cimgui.linkLibC();
|
||||
cimgui.lib.linkLibC();
|
||||
|
||||
if (target.result.abi != .msvc)
|
||||
cimgui.linkLibCpp();
|
||||
cimgui.lib.linkLibCpp();
|
||||
|
||||
cimgui.addIncludePath(b.path("cimgui"));
|
||||
cimgui.addIncludePath(b.path("cimplot"));
|
||||
cimgui.addIncludePath(b.path("cimgui/imgui"));
|
||||
cimgui.addIncludePath(b.path("cimgui/imgui/backends"));
|
||||
cimgui.addIncludePath(b.path("cimgui/imgui/backends"));
|
||||
cimgui.addIncludePath(b.path("cimgui/SDL/include/"));
|
||||
cimgui.lib.addIncludePath(b.path("cimgui"));
|
||||
cimgui.lib.addIncludePath(b.path("cimplot"));
|
||||
cimgui.lib.addIncludePath(b.path("cimgui/imgui"));
|
||||
cimgui.lib.addIncludePath(b.path("cimgui/imgui/backends"));
|
||||
cimgui.lib.addIncludePath(b.path("cimgui/imgui/backends"));
|
||||
cimgui.lib.addIncludePath(b.path("cimgui/SDL/include/"));
|
||||
|
||||
cimgui.addCSourceFiles(.{
|
||||
cimgui.lib.addCSourceFiles(.{
|
||||
.root = b.path("cimgui/imgui"),
|
||||
.files = &[_][]const u8{
|
||||
"cimgui.cpp",
|
||||
|
|
@ -54,7 +48,7 @@ pub fn build(b: *std.Build) void {
|
|||
},
|
||||
});
|
||||
|
||||
cimgui.addCSourceFiles(.{
|
||||
cimgui.lib.addCSourceFiles(.{
|
||||
.root = b.path("cimplot"),
|
||||
.files = &[_][]const u8{
|
||||
"cimplot.cpp",
|
||||
|
|
@ -64,8 +58,6 @@ pub fn build(b: *std.Build) void {
|
|||
},
|
||||
});
|
||||
|
||||
mod.linkLibrary(cimgui);
|
||||
|
||||
// I could've made cimgui a seperate lib,
|
||||
// I can seperate it out later if needed.
|
||||
const test_step = b.step("test", "run unit tests for imgui");
|
||||
|
|
@ -77,7 +69,9 @@ pub fn build(b: *std.Build) void {
|
|||
}),
|
||||
});
|
||||
|
||||
tests.root_module.addImport("cimgui", mod);
|
||||
tests.root_module.addImport("cimgui", cimgui.mod);
|
||||
tests.root_module.linkLibrary(cimgui.lib);
|
||||
|
||||
const runArtifact = b.addRunArtifact(tests);
|
||||
test_step.dependOn(&runArtifact.step);
|
||||
b.installArtifact(tests);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
const cimgui = @import("cimgui");
|
||||
|
||||
test "huh" {
|
||||
cimgui.initialize();
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
_ = static_build;
|
||||
|
||||
// am i good to always have enet as static?
|
||||
// const enet = if (true) b.addStaticLibrary(.{
|
||||
|
|
@ -17,18 +17,18 @@ pub fn build(b: *std.Build) void {
|
|||
// .optimize = optimize,
|
||||
// });
|
||||
|
||||
const enet = b.addLibrary(.{
|
||||
.name = "enet_c",
|
||||
.linkage = .static,
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
}),
|
||||
const enet = bh.MakeModlib(b, .{
|
||||
.name = "enet",
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.static_build = static_build,
|
||||
});
|
||||
|
||||
enet.linkLibC();
|
||||
enet.install();
|
||||
|
||||
enet.addCSourceFiles(.{
|
||||
enet.lib.linkLibC();
|
||||
|
||||
enet.lib.addCSourceFiles(.{
|
||||
.root = b.path("enet-1.3.18"),
|
||||
.files = &.{
|
||||
"callbacks.c",
|
||||
|
|
@ -44,13 +44,13 @@ pub fn build(b: *std.Build) void {
|
|||
.flags = &.{"-DHAS_OFFSETOF=1"},
|
||||
});
|
||||
|
||||
enet.addIncludePath(b.path("enet-1.3.18/include"));
|
||||
enet.lib.addIncludePath(b.path("enet-1.3.18/include"));
|
||||
|
||||
// Platform-specific configuration
|
||||
switch (target.result.os.tag) {
|
||||
.windows => {
|
||||
enet.linkSystemLibrary("ws2_32");
|
||||
enet.linkSystemLibrary("winmm");
|
||||
enet.lib.linkSystemLibrary("ws2_32");
|
||||
enet.lib.linkSystemLibrary("winmm");
|
||||
// Use .def file to control exports and avoid CRT symbol conflicts
|
||||
},
|
||||
.linux, .macos => {
|
||||
|
|
@ -59,17 +59,7 @@ pub fn build(b: *std.Build) void {
|
|||
else => {},
|
||||
}
|
||||
|
||||
b.installArtifact(enet);
|
||||
|
||||
const mod = b.addModule("enet", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("src/enet.zig"),
|
||||
.link_libc = true,
|
||||
});
|
||||
|
||||
mod.linkLibrary(enet);
|
||||
mod.addIncludePath(b.path("enet-1.3.18/include/"));
|
||||
enet.mod.addIncludePath(b.path("enet-1.3.18/include/"));
|
||||
|
||||
const test_step = b.step("test", "run unit tests for enet");
|
||||
const tests = b.addTest(.{
|
||||
|
|
@ -81,7 +71,7 @@ pub fn build(b: *std.Build) void {
|
|||
}),
|
||||
});
|
||||
|
||||
tests.root_module.addImport("enet", mod);
|
||||
tests.root_module.addImport("enet", enet.mod);
|
||||
tests.root_module.addIncludePath(b.path("enet-1.3.18/include/"));
|
||||
const runArtifact = b.addRunArtifact(tests);
|
||||
test_step.dependOn(&runArtifact.step);
|
||||
|
|
@ -95,7 +85,7 @@ pub fn build(b: *std.Build) void {
|
|||
.optimize = optimize,
|
||||
}),
|
||||
});
|
||||
test_server.root_module.addImport("enet", mod);
|
||||
test_server.root_module.addImport("enet", enet.mod);
|
||||
test_server.linkLibC();
|
||||
|
||||
// Test client executable
|
||||
|
|
@ -107,7 +97,7 @@ pub fn build(b: *std.Build) void {
|
|||
.optimize = optimize,
|
||||
}),
|
||||
});
|
||||
test_client.root_module.addImport("enet", mod);
|
||||
test_client.root_module.addImport("enet", enet.mod);
|
||||
test_client.linkLibC();
|
||||
|
||||
// Install test programs
|
||||
|
|
@ -135,6 +125,12 @@ pub fn build(b: *std.Build) void {
|
|||
const build_tests_step = b.step("build-tests", "Build test server and client programs");
|
||||
build_tests_step.dependOn(&install_test_server.step);
|
||||
build_tests_step.dependOn(&install_test_client.step);
|
||||
|
||||
test_server.linkLibrary(enet.lib);
|
||||
test_client.linkLibrary(enet.lib);
|
||||
|
||||
b.installArtifact(test_server);
|
||||
b.installArtifact(test_client);
|
||||
}
|
||||
|
||||
// Custom step to run server and client concurrently for loopback testing
|
||||
|
|
|
|||
|
|
@ -1,30 +1,32 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
|
||||
const mod = b.addModule("lua", .{
|
||||
const lua = bh.MakeModlib(b, .{
|
||||
.name = "lua",
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("src/lua.zig"),
|
||||
.link_libc = true,
|
||||
.static_build = static_build,
|
||||
.root = b.path("src/lua.zig"),
|
||||
});
|
||||
|
||||
const luac = b.addLibrary(.{
|
||||
.name = "luac",
|
||||
.linkage = if (static_build) .static else .dynamic,
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.link_libc = true,
|
||||
}),
|
||||
});
|
||||
lua.install();
|
||||
|
||||
b.installArtifact(luac);
|
||||
// Add include paths to module (for Zig @cImport)
|
||||
lua.mod.addIncludePath(b.path("lua/src/"));
|
||||
lua.mod.addIncludePath(b.path("src/"));
|
||||
|
||||
luac.addCSourceFiles(.{
|
||||
// Configure library
|
||||
lua.lib.linkLibC();
|
||||
|
||||
lua.lib.addIncludePath(b.path("lua/src/"));
|
||||
lua.lib.addIncludePath(b.path("src/"));
|
||||
|
||||
lua.lib.addCSourceFiles(.{
|
||||
.root = b.path("lua/src/"),
|
||||
.files = &.{
|
||||
"lapi.c",
|
||||
|
|
@ -62,25 +64,16 @@ pub fn build(b: *std.Build) void {
|
|||
},
|
||||
});
|
||||
|
||||
luac.addCSourceFile(.{ .file = b.path("src/limited_io.c") });
|
||||
lua.lib.addCSourceFile(.{ .file = b.path("src/limited_io.c") });
|
||||
|
||||
if (target.result.os.tag == .windows) {
|
||||
luac.addCSourceFile(.{ .file = b.path("src/minidumpsetup.cpp") });
|
||||
lua.lib.addCSourceFile(.{ .file = b.path("src/minidumpsetup.cpp") });
|
||||
if (target.result.abi != .msvc)
|
||||
luac.linkLibCpp();
|
||||
luac.linkLibC();
|
||||
lua.lib.linkLibCpp();
|
||||
} else {
|
||||
luac.addCSourceFile(.{ .file = b.path("src/minidumpstub.cpp") });
|
||||
lua.lib.addCSourceFile(.{ .file = b.path("src/minidumpstub.cpp") });
|
||||
}
|
||||
|
||||
luac.addIncludePath(b.path("lua/src/"));
|
||||
luac.addIncludePath(b.path("src/"));
|
||||
|
||||
mod.addIncludePath(b.path("lua/src/"));
|
||||
mod.addIncludePath(b.path("src/"));
|
||||
|
||||
mod.linkLibrary(luac);
|
||||
|
||||
const run_step = b.step("test", "");
|
||||
const tests = b.addExecutable(.{
|
||||
.name = "run-lua",
|
||||
|
|
@ -92,7 +85,9 @@ pub fn build(b: *std.Build) void {
|
|||
}),
|
||||
});
|
||||
|
||||
tests.root_module.addImport("lua", mod);
|
||||
tests.root_module.addImport("lua", lua.mod);
|
||||
tests.root_module.linkLibrary(lua.lib);
|
||||
const runArtifact = b.addRunArtifact(tests);
|
||||
run_step.dependOn(&runArtifact.step);
|
||||
b.installArtifact(tests);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,29 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
|
||||
const miniaudio_c = b.addLibrary(.{
|
||||
.name = "miniaudio_c",
|
||||
.linkage = if (static_build) .static else .dynamic,
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.link_libc = true,
|
||||
}),
|
||||
const miniaudio = bh.MakeModlib(b, .{
|
||||
.name = "miniaudio",
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.static_build = static_build,
|
||||
.root = b.path("src/miniaudio.zig"),
|
||||
});
|
||||
|
||||
b.installArtifact(miniaudio_c);
|
||||
miniaudio_c.addCSourceFile(.{ .file = b.path("src/miniaudio.cpp"), .flags = &.{"-fno-sanitize=all"}, .language = .c });
|
||||
miniaudio_c.addIncludePath(b.path("include"));
|
||||
miniaudio.install();
|
||||
|
||||
const mod = b.addModule("miniaudio", .{ .target = target, .optimize = optimize, .root_source_file = b.path("src/miniaudio.zig") });
|
||||
// Add include paths to module (for Zig @cImport)
|
||||
miniaudio.mod.addIncludePath(b.path("./include"));
|
||||
|
||||
mod.linkLibrary(miniaudio_c);
|
||||
mod.addIncludePath(b.path("./include"));
|
||||
// Configure library
|
||||
miniaudio.lib.linkLibC();
|
||||
|
||||
miniaudio.lib.addIncludePath(b.path("include"));
|
||||
miniaudio.lib.addCSourceFile(.{ .file = b.path("src/miniaudio.cpp"), .flags = &.{"-fno-sanitize=all"}, .language = .c });
|
||||
|
||||
// ======== tests ============
|
||||
const test_step = b.step("test", "");
|
||||
|
|
@ -36,7 +37,8 @@ pub fn build(b: *std.Build) void {
|
|||
});
|
||||
tests.addIncludePath(b.path("./include"));
|
||||
|
||||
tests.root_module.addImport("miniaudio", mod);
|
||||
tests.root_module.addImport("miniaudio", miniaudio.mod);
|
||||
tests.root_module.linkLibrary(miniaudio.lib);
|
||||
const runArtifact = b.addRunArtifact(tests);
|
||||
test_step.dependOn(&runArtifact.step);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,56 +1,65 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
|
||||
const mod = b.addModule("nfd", .{
|
||||
const nfd = bh.MakeModlib(b, .{
|
||||
.name = "nfd",
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("src/nfd.zig"),
|
||||
.link_libc = true,
|
||||
.static_build = static_build,
|
||||
.root = b.path("src/nfd.zig"),
|
||||
});
|
||||
|
||||
mod.addCSourceFile(.{
|
||||
nfd.install();
|
||||
|
||||
// Add include paths to module (for Zig @cImport)
|
||||
nfd.mod.addIncludePath(b.path("include"));
|
||||
|
||||
// Configure library
|
||||
nfd.lib.linkLibC();
|
||||
|
||||
nfd.lib.addIncludePath(b.path("include"));
|
||||
nfd.lib.addCSourceFile(.{
|
||||
.file = b.path("src/nfd_common.c"),
|
||||
.flags = &.{},
|
||||
});
|
||||
|
||||
mod.addIncludePath(b.path("include"));
|
||||
|
||||
if (target.result.os.tag == .macos) {
|
||||
mod.addCSourceFile(.{
|
||||
nfd.lib.addCSourceFile(.{
|
||||
.file = b.path("src/nfd_cocoa.m"),
|
||||
.flags = &.{},
|
||||
});
|
||||
mod.linkFramework("AppKit", .{});
|
||||
nfd.lib.linkFramework("AppKit");
|
||||
} else if (target.result.os.tag == .windows) {
|
||||
mod.addCSourceFile(.{
|
||||
nfd.lib.addCSourceFile(.{
|
||||
.file = b.path("src/nfd_win.cpp"),
|
||||
.flags = &.{},
|
||||
});
|
||||
mod.linkSystemLibrary("ole32", .{});
|
||||
nfd.lib.linkSystemLibrary("ole32");
|
||||
} else if (target.result.os.tag == .linux) {
|
||||
// mod.addCSourceFile(.{
|
||||
// nfd.lib.addCSourceFile(.{
|
||||
// .file = b.path("src/nfd_gtk.c"),
|
||||
// .flags = &.{},
|
||||
// });
|
||||
mod.addCSourceFile(.{
|
||||
nfd.lib.addCSourceFile(.{
|
||||
.file = b.path("src/nfd_null.c"),
|
||||
.flags = &.{},
|
||||
});
|
||||
// mod.linkSystemLibrary("gdk-3", .{});
|
||||
// mod.linkSystemLibrary("atk-1.0", .{});
|
||||
// mod.linkSystemLibrary("gtk-3", .{});
|
||||
// mod.linkSystemLibrary("glib-2.0", .{});
|
||||
// mod.linkSystemLibrary("gobject-2.0", .{});
|
||||
// nfd.lib.linkSystemLibrary("gdk-3", .{});
|
||||
// nfd.lib.linkSystemLibrary("atk-1.0", .{});
|
||||
// nfd.lib.linkSystemLibrary("gtk-3", .{});
|
||||
// nfd.lib.linkSystemLibrary("glib-2.0", .{});
|
||||
// nfd.lib.linkSystemLibrary("gobject-2.0", .{});
|
||||
}
|
||||
|
||||
const p2dep = b.dependency("p2", .{ .target = target, .optimize = optimize, .static_build = static_build });
|
||||
|
||||
const p2mod = p2dep.module("p2");
|
||||
mod.addImport("p2", p2mod);
|
||||
nfd.mod.addImport("p2", p2mod);
|
||||
|
||||
const test_step = b.step("test", "");
|
||||
const tests = b.addTest(.{
|
||||
|
|
@ -63,7 +72,8 @@ pub fn build(b: *std.Build) void {
|
|||
});
|
||||
tests.addIncludePath(b.path("./include"));
|
||||
|
||||
tests.root_module.addImport("nfd", mod);
|
||||
tests.root_module.addImport("nfd", nfd.mod);
|
||||
tests.root_module.linkLibrary(nfd.lib);
|
||||
tests.root_module.addImport("p2", p2mod);
|
||||
const runArtifact = b.addRunArtifact(tests);
|
||||
test_step.dependOn(&runArtifact.step);
|
||||
|
|
|
|||
|
|
@ -1,17 +1,21 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
_ = static_build;
|
||||
|
||||
const mod = b.addModule("objLoader", .{
|
||||
const objLoader = bh.MakeModlib(b, .{
|
||||
.name = "objLoader",
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("src/obj_loader.zig"),
|
||||
.static_build = static_build,
|
||||
.root = b.path("src/obj_loader.zig"),
|
||||
});
|
||||
|
||||
objLoader.install();
|
||||
|
||||
const test_step = b.step("test", "");
|
||||
const tests = b.addTest(.{
|
||||
.root_module = b.createModule(.{
|
||||
|
|
@ -22,7 +26,8 @@ pub fn build(b: *std.Build) void {
|
|||
}),
|
||||
});
|
||||
|
||||
tests.root_module.addImport("objLoader", mod);
|
||||
tests.root_module.addImport("objLoader", objLoader.mod);
|
||||
tests.root_module.linkLibrary(objLoader.lib);
|
||||
const runArtifact = b.addRunArtifact(tests);
|
||||
test_step.dependOn(&runArtifact.step);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,21 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse true;
|
||||
_ = static_build;
|
||||
|
||||
const mod = b.addModule("p2", .{
|
||||
const p2 = bh.MakeModlib(b, .{
|
||||
.name = "p2",
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("src/p2.zig"),
|
||||
.static_build = static_build,
|
||||
.root = b.path("src/p2.zig"),
|
||||
});
|
||||
|
||||
p2.install();
|
||||
|
||||
const test_step = b.step("test", "test p2");
|
||||
const tests = b.addTest(.{
|
||||
.root_module = b.createModule(.{
|
||||
|
|
@ -22,7 +26,8 @@ pub fn build(b: *std.Build) void {
|
|||
// .link_libc = true,
|
||||
});
|
||||
|
||||
tests.root_module.addImport("p2", mod);
|
||||
tests.root_module.addImport("p2", p2.mod);
|
||||
tests.root_module.linkLibrary(p2.lib);
|
||||
const runArtifact = b.addRunArtifact(tests);
|
||||
test_step.dependOn(&runArtifact.step);
|
||||
if (b.args) |args| {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
|
|
@ -6,16 +7,20 @@ pub fn build(b: *std.Build) void {
|
|||
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
|
||||
const p2dep = b.dependency("p2", .{ .target = target, .optimize = optimize, .static_build = static_build });
|
||||
|
||||
const mod = b.addModule("packer", .{
|
||||
const packer = bh.MakeModlib(b, .{
|
||||
.name = "packer",
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("src/packer.zig"),
|
||||
.static_build = static_build,
|
||||
.root = b.path("src/packer.zig"),
|
||||
});
|
||||
|
||||
packer.install();
|
||||
|
||||
const p2dep = b.dependency("p2", .{ .target = target, .optimize = optimize, .static_build = static_build });
|
||||
|
||||
const p2mod = p2dep.module("p2");
|
||||
mod.addImport("p2", p2mod);
|
||||
packer.mod.addImport("p2", p2mod);
|
||||
|
||||
const test_exe = b.addTest(.{
|
||||
.root_module = b.createModule(.{
|
||||
|
|
@ -24,7 +29,8 @@ pub fn build(b: *std.Build) void {
|
|||
.root_source_file = b.path("tests/test.zig"),
|
||||
}),
|
||||
});
|
||||
test_exe.root_module.addImport("packer", mod);
|
||||
test_exe.root_module.addImport("packer", packer.mod);
|
||||
test_exe.root_module.linkLibrary(packer.lib);
|
||||
test_exe.root_module.addImport("p2", p2mod);
|
||||
|
||||
const test_step = b.step("test", "runs sample unit tests for packer");
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
|
|
@ -6,34 +7,30 @@ pub fn build(b: *std.Build) void {
|
|||
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
|
||||
const spng_c = b.addLibrary(.{
|
||||
.linkage = if (static_build) .static else .dynamic,
|
||||
.name = "spng_c",
|
||||
.root_module = b.createModule(.{
|
||||
.optimize = optimize,
|
||||
.target = target,
|
||||
.link_libc = true,
|
||||
}),
|
||||
});
|
||||
|
||||
spng_c.addCSourceFile(.{ .file = b.path("spng/spng.c") });
|
||||
spng_c.addCSourceFile(.{ .file = b.path("miniz.c") });
|
||||
spng_c.addIncludePath(b.path("spng"));
|
||||
spng_c.addIncludePath(b.path("./"));
|
||||
|
||||
spng_c.root_module.addCMacro("SPNG_USE_MINIZ", "1");
|
||||
|
||||
const mod = b.addModule("spng", .{
|
||||
const spng = bh.MakeModlib(b, .{
|
||||
.name = "spng",
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("src/spng.zig"),
|
||||
.static_build = static_build,
|
||||
.root = b.path("src/spng.zig"),
|
||||
});
|
||||
|
||||
mod.addIncludePath(b.path("spng"));
|
||||
mod.addIncludePath(b.path("./"));
|
||||
mod.linkLibrary(spng_c);
|
||||
spng.install();
|
||||
|
||||
b.installArtifact(spng_c);
|
||||
// Add include paths to module (for Zig @cImport)
|
||||
spng.mod.addIncludePath(b.path("spng"));
|
||||
spng.mod.addIncludePath(b.path("./"));
|
||||
|
||||
// Configure library
|
||||
spng.lib.linkLibC();
|
||||
|
||||
spng.lib.addIncludePath(b.path("spng"));
|
||||
spng.lib.addIncludePath(b.path("./"));
|
||||
|
||||
spng.lib.addCSourceFile(.{ .file = b.path("spng/spng.c") });
|
||||
spng.lib.addCSourceFile(.{ .file = b.path("miniz.c") });
|
||||
|
||||
spng.lib.root_module.addCMacro("SPNG_USE_MINIZ", "1");
|
||||
|
||||
const test_step = b.step("test", "run unit tests for spng");
|
||||
const tests = b.addTest(.{
|
||||
|
|
@ -44,7 +41,8 @@ pub fn build(b: *std.Build) void {
|
|||
.link_libc = true,
|
||||
}),
|
||||
});
|
||||
tests.root_module.linkLibrary(spng_c);
|
||||
tests.root_module.addImport("spng", spng.mod);
|
||||
tests.root_module.linkLibrary(spng.lib);
|
||||
tests.root_module.addIncludePath(b.path("spng"));
|
||||
tests.root_module.addIncludePath(b.path("./"));
|
||||
const runArtifact = b.addRunArtifact(tests);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
const tracy_path = "tracy-0.10/public";
|
||||
const tracy_path_include = tracy_path ++ "/tracy";
|
||||
|
|
@ -7,7 +8,6 @@ pub fn build(b: *std.Build) void {
|
|||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
_ = static_build;
|
||||
|
||||
//const tracy_enabled = b.option(bool, "tracy", "Enables tracy integration") orelse false;
|
||||
|
||||
|
|
@ -17,17 +17,26 @@ pub fn build(b: *std.Build) void {
|
|||
// }
|
||||
// std.debug.print("tracy enabled {s}\n", .{if (tracy_enabled) "true" else "false"});
|
||||
|
||||
const mod = b.addModule("tracy", .{
|
||||
const tracy = bh.MakeModlib(b, .{
|
||||
.name = "tracy",
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("tracy.zig"),
|
||||
.link_libc = tracy_enabled,
|
||||
.link_libcpp = tracy_enabled,
|
||||
.static_build = static_build,
|
||||
.root = b.path("tracy.zig"),
|
||||
});
|
||||
|
||||
tracy.install();
|
||||
|
||||
if (tracy_enabled) {
|
||||
mod.addIncludePath(b.path(tracy_path_include));
|
||||
mod.addCSourceFile(.{
|
||||
// Add include paths to module (for Zig @cImport)
|
||||
tracy.mod.addIncludePath(b.path(tracy_path_include));
|
||||
|
||||
// Configure library
|
||||
tracy.lib.linkLibC();
|
||||
tracy.lib.linkLibCpp();
|
||||
|
||||
tracy.lib.addIncludePath(b.path(tracy_path_include));
|
||||
tracy.lib.addCSourceFile(.{
|
||||
.file = b.path(tracy_path ++ "/TracyClient.cpp"),
|
||||
.flags = &[_][]const u8{
|
||||
"-DTRACY_ENABLE",
|
||||
|
|
@ -40,16 +49,16 @@ pub fn build(b: *std.Build) void {
|
|||
});
|
||||
|
||||
if (target.result.os.tag == .windows) {
|
||||
mod.linkSystemLibrary("Advapi32", .{});
|
||||
mod.linkSystemLibrary("User32", .{});
|
||||
mod.linkSystemLibrary("Ws2_32", .{});
|
||||
mod.linkSystemLibrary("DbgHelp", .{});
|
||||
tracy.lib.linkSystemLibrary("Advapi32");
|
||||
tracy.lib.linkSystemLibrary("User32");
|
||||
tracy.lib.linkSystemLibrary("Ws2_32");
|
||||
tracy.lib.linkSystemLibrary("DbgHelp");
|
||||
}
|
||||
}
|
||||
|
||||
const opts = b.addOptions();
|
||||
opts.addOption(bool, "tracy_enabled", tracy_enabled);
|
||||
mod.addOptions("build_options", opts);
|
||||
tracy.mod.addOptions("build_options", opts);
|
||||
|
||||
// ========== tests =============
|
||||
const test_step = b.step("test", "run unit tests for tracy");
|
||||
|
|
@ -60,7 +69,8 @@ pub fn build(b: *std.Build) void {
|
|||
.root_source_file = b.path("tracy_test.zig"),
|
||||
}),
|
||||
});
|
||||
tests.root_module.addImport("tracy", mod);
|
||||
tests.root_module.addImport("tracy", tracy.mod);
|
||||
tests.root_module.linkLibrary(tracy.lib);
|
||||
const runArtifact = b.addRunArtifact(tests);
|
||||
test_step.dependOn(&runArtifact.step);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,29 +1,37 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
_ = static_build;
|
||||
|
||||
const mod = b.addModule("watcher", .{
|
||||
const watcher = bh.MakeModlib(b, .{
|
||||
.name = "watcher",
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("src/watcher.zig"),
|
||||
.link_libc = true,
|
||||
.link_libcpp = true,
|
||||
.static_build = static_build,
|
||||
.root = b.path("src/watcher.zig"),
|
||||
});
|
||||
|
||||
mod.addCSourceFile(.{ .file = b.path("src/watcher.cpp") });
|
||||
watcher.install();
|
||||
|
||||
// Add include paths to module (for Zig @cImport)
|
||||
watcher.mod.addIncludePath(b.path("src/include"));
|
||||
|
||||
// Configure library
|
||||
watcher.lib.linkLibC();
|
||||
watcher.lib.linkLibCpp();
|
||||
|
||||
watcher.lib.addIncludePath(b.path("src/include"));
|
||||
watcher.lib.addCSourceFile(.{ .file = b.path("src/watcher.cpp") });
|
||||
|
||||
if (target.result.os.tag == .macos) {
|
||||
mod.linkFramework("CoreFoundation", .{});
|
||||
mod.linkFramework("CoreServices", .{});
|
||||
watcher.lib.linkFramework("CoreFoundation");
|
||||
watcher.lib.linkFramework("CoreServices");
|
||||
}
|
||||
|
||||
mod.addIncludePath(b.path("src/include"));
|
||||
|
||||
const test_exe = b.addTest(.{
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
|
|
@ -31,7 +39,8 @@ pub fn build(b: *std.Build) void {
|
|||
.root_source_file = b.path("tests/test.zig"),
|
||||
}),
|
||||
});
|
||||
test_exe.root_module.addImport("watcher", mod);
|
||||
test_exe.root_module.addImport("watcher", watcher.mod);
|
||||
test_exe.root_module.linkLibrary(watcher.lib);
|
||||
|
||||
const test_step = b.step("test", "runs sample unit tests for watcher");
|
||||
test_step.dependOn(&b.addRunArtifact(test_exe).step);
|
||||
|
|
|
|||
|
|
@ -1,21 +1,31 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
_ = static_build;
|
||||
|
||||
const mod = b.addModule("zgltf", .{
|
||||
.root_source_file = b.path("src/zgltf.zig"),
|
||||
const zgltf = bh.MakeModlib(b, .{
|
||||
.name = "zgltf",
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.static_build = static_build,
|
||||
.root = b.path("src/zgltf.zig"),
|
||||
});
|
||||
|
||||
zgltf.install();
|
||||
|
||||
const tests = b.addTest(.{
|
||||
.root_module = mod,
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("src/zgltf.zig"),
|
||||
}),
|
||||
});
|
||||
tests.root_module.addImport("zgltf", zgltf.mod);
|
||||
tests.root_module.linkLibrary(zgltf.lib);
|
||||
b.installArtifact(tests);
|
||||
|
||||
var run_tests = b.addRunArtifact(tests);
|
||||
|
|
|
|||
|
|
@ -1,17 +1,21 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
_ = static_build;
|
||||
|
||||
const mod = b.addModule("zmath", .{
|
||||
const zmath = bh.MakeModlib(b, .{
|
||||
.name = "zmath",
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.root_source_file = b.path("zmath.zig"),
|
||||
.static_build = static_build,
|
||||
.root = b.path("zmath.zig"),
|
||||
});
|
||||
|
||||
zmath.install();
|
||||
|
||||
const test_step = b.step("test", "runs tests for zmath");
|
||||
const tests = b.addTest(.{
|
||||
.root_module = b.createModule(.{
|
||||
|
|
@ -22,7 +26,8 @@ pub fn build(b: *std.Build) void {
|
|||
}),
|
||||
});
|
||||
|
||||
tests.root_module.addImport("zmath", mod);
|
||||
tests.root_module.addImport("zmath", zmath.mod);
|
||||
tests.root_module.linkLibrary(zmath.lib);
|
||||
const runArtifact = b.addRunArtifact(tests);
|
||||
test_step.dependOn(&runArtifact.step);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -487,8 +487,6 @@ pub const ExternGameObject = struct {
|
|||
_ = dt;
|
||||
//self.time += @floatCast(dt);
|
||||
|
||||
//core.debugSphere(.{ .y = 10 + std.math.sin(self.time) }, 5, .{});
|
||||
|
||||
if (core.getEngineObject(imgui.utils.TopBar)) |topbar| {
|
||||
topbar.menuOpen = platform.context().isCursorEnabled();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue