zcatgui/build.zig
reugenio 59c597fc18 feat: zCatGui v0.1.0 - Initial project setup
Immediate Mode GUI library for Zig with software rendering.

Core features:
- SDL2 backend for cross-platform window/events
- Software rasterizer (works everywhere, including SSH)
- Macro recording system (cornerstone feature, like Vim)
- Command-list rendering (DrawRect, DrawText, etc.)
- Layout system with constraints
- Color/Style system with themes

Project structure:
- src/core/: context, command, input, layout, style
- src/macro/: MacroRecorder, MacroPlayer, MacroStorage
- src/render/: Framebuffer, SoftwareRenderer, Font
- src/backend/: Backend interface, SDL2 implementation
- examples/: hello.zig, macro_demo.zig
- docs/: Architecture, research (Gio, immediate-mode libs, Simifactu)

Build: zig build (requires SDL2-devel)
Tests: 16 tests passing

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

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

82 lines
2.7 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);
}