const Dependency = Build.Dependency;
const sokol = @import("sokol");
const cimgui = @import("cimgui");
+const shdc = @import("shdc");
pub fn build(b: *Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
- const opt_docking = b.option(bool, "docking", "Build with docking support") orelse false;
-
// Get the matching Zig module name, C header search path and C library for
// vanilla imgui vs the imgui docking branch.
- const cimgui_conf = cimgui.getConfig(opt_docking);
+ const cimgui_conf = cimgui.getConfig(true);
// note that the sokol dependency is built with `.with_sokol_imgui = true`
const dep_sokol = b.dependency("sokol", .{
// shaders
dep_sokol.artifact("sokol_clib").addIncludePath(b.path("ext/cimgui"));
- const dep_shdc = dep_sokol.builder.dependency("shdc", .{});
- const shdc_step = try sokol.shdc.createSourceFile(b, .{
+ const dep_shdc = b.dependency("shdc", .{});
+ const shdc_step = try shdc.createSourceFile(b, .{
.shdc_dep = dep_shdc,
- .input = "src/shader/quad.glsl",
- .output = "src/shader/quad.glsl.zig",
+ .input = "shd/main.glsl",
+ .output = "src/shd/main.glsl.zig",
.slang = .{ .glsl430 = true },
});
.{ .name = "sokol", .module = dep_sokol.module("sokol") },
.{ .name = cimgui_conf.module_name, .module = dep_cimgui.module(cimgui_conf.module_name) },
},
+ .link_libc = true,
});
- const mod_options = b.addOptions();
- mod_options.addOption(bool, "docking", opt_docking);
- mod_main.addOptions("build_options", mod_options);
+
+ mod_main.addIncludePath(b.path("src"));
+ mod_main.addCSourceFile(.{.file = b.path("src/stb_image.c")});
// from here on different handling for native vs wasm builds
if (target.result.cpu.arch.isWasm()) {
} else {
const exe = try buildNative(b, mod_main);
exe.step.dependOn(shdc_step);
+
+ exe.root_module.link_libc = true;
+ exe.root_module.linkSystemLibrary("X11", .{ .needed = true });
+ exe.root_module.linkSystemLibrary("Xcursor", .{ .needed = true });
+
+ const exe_check = b.addExecutable(.{
+ .name = "sporegirl",
+ .root_module = mod_main,
+ });
+ const check = b.step("check", "Check");
+ check.dependOn(&exe_check.step);
}
}
fn buildNative(b: *Build, mod: *Build.Module) !*Build.Step.Compile {
const exe = b.addExecutable(.{
- .name = "demo",
+ .name = "sporegirl",
.root_module = mod,
});
b.installArtifact(exe);
- b.step("run", "Run demo").dependOn(&b.addRunArtifact(exe).step);
+ b.step("run", "Run Sporegirl").dependOn(&b.addRunArtifact(exe).step);
return exe;
}