Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
zig-*/
.zig-*/
.vscode/
.cursor
23 changes: 23 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,18 @@ pub fn build(b: *Build) !void {
const dep_sokol = b.dependency("sokol", .{
.target = target,
.optimize = optimize,
.with_sokol_imgui = true,
});
const dep_cimgui = b.dependency("cimgui", .{
.target = target,
.optimize = optimize,
});

// inject the cimgui header search path into the sokol C library compile step
dep_sokol.artifact("sokol_clib").addIncludePath(dep_cimgui.path("src"));
const dep_shdc = dep_sokol.builder.dependency("shdc", .{});
const mod_sokol = dep_sokol.module("sokol");
const mod_cimgui = dep_cimgui.module("cimgui");

// shader module
const mod_shaders = try sokol.shdc.createModule(b, "shaders", mod_sokol, .{
Expand Down Expand Up @@ -58,10 +67,22 @@ pub fn build(b: *Build) !void {
.optimize = optimize,
.imports = &.{
.{ .name = "sokol", .module = dep_sokol.module("sokol") },
.{ .name = "cimgui", .module = dep_cimgui.module("cimgui") },
.{ .name = "common", .module = mod_common },
.{ .name = "shaders", .module = mod_shaders },
},
});
const mod_ui = b.addModule("ui", .{
.root_source_file = b.path("src/ui/ui.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "sokol", .module = dep_sokol.module("sokol") },
.{ .name = "cimgui", .module = dep_cimgui.module("cimgui") },
.{ .name = "common", .module = mod_common },
.{ .name = "chips", .module = mod_chips },
},
});

// top-level modules
const mod_chipz = b.addModule("chipz", .{
Expand All @@ -73,6 +94,7 @@ pub fn build(b: *Build) !void {
.{ .name = "chips", .module = mod_chips },
.{ .name = "systems", .module = mod_systems },
.{ .name = "host", .module = mod_host },
.{ .name = "ui", .module = mod_ui },
},
});

Expand All @@ -94,5 +116,6 @@ pub fn build(b: *Build) !void {
.optimize = optimize,
.mod_chipz = mod_chipz,
.mod_sokol = mod_sokol,
.mod_cimgui = mod_cimgui,
});
}
8 changes: 6 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
.fingerprint = 0x3ecb34175baf6f81,
.dependencies = .{
.sokol = .{
.url = "git+https://github.com/floooh/sokol-zig.git#59c7eb03b59ff0936bbdf21ae5f7b2df51e5a50a",
.hash = "sokol-0.1.0-pb1HK4jQLQD-hG8KuP-i7qkA5RY5pVfL7hLg56FlckV0",
.url = "git+https://github.com/floooh/sokol-zig.git#1d6a902f007fc32501ef26676f7cb73dcd81b047",
.hash = "sokol-0.1.0-pb1HK_ZPLgC-2uMA63u1iiB2BqPcibWOEZVH0Hz1ursz",
},
.cimgui = .{
.url = "git+https://github.com/floooh/dcimgui.git#581c2e909c899c21923c779d4c41ea56ab93bbb4",
.hash = "cimgui-0.1.0-44ClkQ14kwAiwcr3ioDjxvPuiWQctWrt-tIFtsfP6xmU",
},
},
.paths = .{
Expand Down
4 changes: 4 additions & 0 deletions emus/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub const Options = struct {
optimize: OptimizeMode,
mod_chipz: *Build.Module,
mod_sokol: *Build.Module,
mod_cimgui: *Build.Module,
};

pub fn build(b: *Build, opts: Options) void {
Expand All @@ -43,6 +44,7 @@ pub fn build(b: *Build, opts: Options) void {
.optimize = opts.optimize,
.mod_chipz = opts.mod_chipz,
.mod_sokol = opts.mod_sokol,
.mod_cimgui = opts.mod_cimgui,
});
}
}
Expand All @@ -55,6 +57,7 @@ const EmuOptions = struct {
optimize: OptimizeMode,
mod_chipz: *Build.Module,
mod_sokol: *Build.Module,
mod_cimgui: *Build.Module,
};

fn addEmulator(b: *Build, opts: EmuOptions) void {
Expand All @@ -65,6 +68,7 @@ fn addEmulator(b: *Build, opts: EmuOptions) void {
.imports = &.{
.{ .name = "chipz", .module = opts.mod_chipz },
.{ .name = "sokol", .module = opts.mod_sokol },
.{ .name = "cimgui", .module = opts.mod_cimgui },
},
});
if (opts.model != .NONE) {
Expand Down
Loading
Loading