zcatgui/build.zig
reugenio 6ac3856ae2 feat: zcatgui v0.5.0 - Complete widget library + research docs
Widgets implemented (13 total):
- Label: Static text with alignment
- Button: With importance levels (primary/normal/danger)
- TextInput: Single-line text entry with cursor
- Checkbox: Boolean toggle
- Select: Dropdown selection
- List: Scrollable selectable list
- Focus: Focus manager with tab navigation
- Table: Editable table with dirty tracking, keyboard nav
- Split: HSplit/VSplit draggable panels
- Panel: Container with title bar, collapsible
- Modal: Dialogs (alert, confirm, inputDialog)
- AutoComplete: ComboBox with prefix/contains/fuzzy matching

Core improvements:
- InputState now tracks keyboard state (keys_down, key_events)
- Full keyboard navigation for Table widget

Research documentation:
- WIDGET_COMPARISON.md: zcatgui vs DVUI vs Gio vs zcatui
- SIMIFACTU_ADVANCEDTABLE.md: Analysis of 10K LOC table component
- LEGO_PANELS_SYSTEM.md: Modular panel composition architecture

Examples:
- widgets_demo.zig: All basic widgets showcase
- table_demo.zig: Table, Split, Panel demonstration

All tests passing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-09 11:00:49 +01:00

124 lines
4.1 KiB
Zig

const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// ===========================================
// Main library module
// ===========================================
const zcatgui_mod = b.createModule(.{
.root_source_file = b.path("src/zcatgui.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
// Link SDL2 to the module
zcatgui_mod.linkSystemLibrary("SDL2", .{});
// ===========================================
// Tests
// ===========================================
const lib_unit_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/zcatgui.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
}),
});
lib_unit_tests.root_module.linkSystemLibrary("SDL2", .{});
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_lib_unit_tests.step);
// ===========================================
// Examples
// ===========================================
// Hello World example
const hello_exe = b.addExecutable(.{
.name = "hello",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/hello.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
.imports = &.{
.{ .name = "zcatgui", .module = zcatgui_mod },
},
}),
});
hello_exe.root_module.linkSystemLibrary("SDL2", .{});
b.installArtifact(hello_exe);
const run_hello = b.addRunArtifact(hello_exe);
run_hello.step.dependOn(b.getInstallStep());
const hello_step = b.step("hello", "Run hello world example");
hello_step.dependOn(&run_hello.step);
// Macro demo
const macro_exe = b.addExecutable(.{
.name = "macro-demo",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/macro_demo.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
.imports = &.{
.{ .name = "zcatgui", .module = zcatgui_mod },
},
}),
});
macro_exe.root_module.linkSystemLibrary("SDL2", .{});
b.installArtifact(macro_exe);
const run_macro = b.addRunArtifact(macro_exe);
run_macro.step.dependOn(b.getInstallStep());
const macro_step = b.step("macro-demo", "Run macro recording demo");
macro_step.dependOn(&run_macro.step);
// Widgets demo
const widgets_exe = b.addExecutable(.{
.name = "widgets-demo",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/widgets_demo.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
.imports = &.{
.{ .name = "zcatgui", .module = zcatgui_mod },
},
}),
});
widgets_exe.root_module.linkSystemLibrary("SDL2", .{});
b.installArtifact(widgets_exe);
const run_widgets = b.addRunArtifact(widgets_exe);
run_widgets.step.dependOn(b.getInstallStep());
const widgets_step = b.step("widgets-demo", "Run widgets demo");
widgets_step.dependOn(&run_widgets.step);
// Table demo
const table_exe = b.addExecutable(.{
.name = "table-demo",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/table_demo.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
.imports = &.{
.{ .name = "zcatgui", .module = zcatgui_mod },
},
}),
});
table_exe.root_module.linkSystemLibrary("SDL2", .{});
b.installArtifact(table_exe);
const run_table = b.addRunArtifact(table_exe);
run_table.step.dependOn(b.getInstallStep());
const table_step = b.step("table-demo", "Run table demo with split panels");
table_step.dependOn(&run_table.step);
}