From 27818005ee80ea30b5278b4ce92af043c8aa0cbc Mon Sep 17 00:00:00 2001 From: andromeda Date: Sun, 14 Jun 2026 22:46:08 +0200 Subject: nicer interface --- build.zig | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'build.zig') diff --git a/build.zig b/build.zig index 8c5eefa..99d8664 100644 --- a/build.zig +++ b/build.zig @@ -30,28 +30,38 @@ pub fn build(b: *std.Build) !void { std.debug.panic("no backend other than OpenGL supported by RSGL.h", .{}); } - const rgfw = b.addTranslateC(.{ + const rgfw_raw = b.addTranslateC(.{ .root_source_file = b.path("include/RGFW.h"), .target = target, .optimize = optimize, }); - for (macros.items) |macro| {rgfw.defineCMacro(macro[0], macro[1]);} - const rgfw_mod = rgfw.addModule("rgfw"); + for (macros.items) |macro| {rgfw_raw.defineCMacro(macro[0], macro[1]);} + const rgfw_raw_mod = rgfw_raw.addModule("rgfw_raw"); - const rsgl = b.addTranslateC(.{ + const rsgl_raw = b.addTranslateC(.{ .root_source_file = b.path("include/RSGL_gl.h"), .target = target, .optimize = optimize, }); - for (macros.items) |macro| {rsgl.defineCMacro(macro[0], macro[1]);} - const rsgl_mod = rsgl.addModule("rsgl"); + for (macros.items) |macro| {rsgl_raw.defineCMacro(macro[0], macro[1]);} + const rsgl_raw_mod = rsgl_raw.addModule("rsgl"); + + const rsgl_mod = b.createModule(.{ + .root_source_file = b.path("rsgl.zig"), + .target = target, + .optimize = optimize, + .imports = &.{ + .{.name = "rsgl_raw", .module = rsgl_raw_mod}, + }, + }); const term = b.createModule(.{ .root_source_file = b.path("main.zig"), .target = target, .optimize = optimize, .imports = &.{ - .{.name = "rgfw", .module = rgfw_mod}, + .{.name = "rgfw_raw", .module = rgfw_raw_mod}, + .{.name = "rsgl_raw", .module = rsgl_raw_mod}, .{.name = "rsgl", .module = rsgl_mod}, }, }); -- cgit v1.3.1