diff options
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 29 |
1 files changed, 16 insertions, 13 deletions
@@ -928,16 +928,25 @@ pub fn build(b: *std.Build) void { if (b.lazyDependency("sketchbook", .{ .@"gpu-only" = true })) |sb| { const gpu = b.createModule(.{ .root_source_file = sb.path("src/gpu/Executor.zig"), .imports = &.{ .{ .name = "abi", .module = sb.module("abi") }, .{ .name = "c", .module = gui_c_mod } } }); gm.addImport("sketch_gpu", gpu); - // pardes's renderer, moved to sketchbook (src/gpu/), compiled - // against pardes's SDL; its tests run with unit-test. - const cells_mod = b.createModule(.{ .root_source_file = sb.path("src/gpu/Cells.zig"), .imports = &.{.{ .name = "c", .module = gui_c_mod }} }); - gm.addImport("gpu_cells", cells_mod); - gm.addImport("gpu_present", b.createModule(.{ .root_source_file = sb.path("src/gpu/Present.zig"), .imports = &.{ .{ .name = "c", .module = gui_c_mod }, .{ .name = "gpu_cells", .module = cells_mod } } })); - if (cells_test == null) cells_test = b.addTest(.{ .root_module = b.createModule(.{ .root_source_file = sb.path("src/gpu/Cells.zig"), .target = target, .optimize = optimize, .imports = &.{.{ .name = "c", .module = gui_c_mod }} }), .filters = test_filters }); // The glyph atlas (src/font/Atlas.zig) over the font shim // (vendor/font.{c,h}), compiled below against pardes's // FreeType and HarfBuzz. - gm.addImport("font_atlas", b.createModule(.{ .root_source_file = sb.path("src/font/Atlas.zig"), .imports = &.{.{ .name = "c", .module = gui_c_mod }} })); + const atlas_mod = b.createModule(.{ .root_source_file = sb.path("src/font/Atlas.zig"), .imports = &.{.{ .name = "c", .module = gui_c_mod }} }); + gm.addImport("font_atlas", atlas_mod); + // pardes's renderer, moved to sketchbook (src/gpu/), compiled + // against pardes's SDL; its tests run with unit-test. Its + // SPIR-V is sketchbook's GLSL through glslc, or the prebuilt + // copies with -Dprebuilt-shaders. + const cells_mod = b.createModule(.{ .root_source_file = sb.path("src/gpu/Cells.zig"), .imports = &.{ .{ .name = "c", .module = gui_c_mod }, .{ .name = "font_atlas", .module = atlas_mod } } }); + for (gui_shaders) |name| cells_mod.addAnonymousImport(b.fmt("{s}.spv", .{name}), .{ + .root_source_file = if (prebuilt_shaders) + sb.path(b.fmt("src/gpu/shaders/prebuilt/{s}.spv", .{name})) + else + compileGlsl(b, sb.path(b.fmt("src/gpu/shaders/{s}.glsl", .{name})), name), + }); + gm.addImport("gpu_cells", cells_mod); + gm.addImport("gpu_present", b.createModule(.{ .root_source_file = sb.path("src/gpu/Present.zig"), .imports = &.{ .{ .name = "c", .module = gui_c_mod }, .{ .name = "gpu_cells", .module = cells_mod } } })); + if (cells_test == null) cells_test = b.addTest(.{ .root_module = b.createModule(.{ .root_source_file = sb.path("src/gpu/Cells.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "c", .module = gui_c_mod }, .{ .name = "font_atlas", .module = atlas_mod } } }), .filters = test_filters }); gui_c.addIncludePath(sb.path("vendor")); gm.addImport("gpu_scene", sb.module("gpu_scene")); } @@ -1015,12 +1024,6 @@ pub fn build(b: *std.Build) void { gm.addAnonymousImport("AdwaitaMono-Regular.ttf", .{ .root_source_file = b.path("assets/AdwaitaMono-Regular.ttf"), }); - if (b.lazyDependency("sketchbook", .{ .@"gpu-only" = true })) |sb| for (gui_shaders) |name| gm.addAnonymousImport(b.fmt("{s}.spv", .{name}), .{ - .root_source_file = if (prebuilt_shaders) - sb.path(b.fmt("src/gpu/shaders/prebuilt/{s}.spv", .{name})) - else - compileGlsl(b, sb.path(b.fmt("src/gpu/shaders/{s}.glsl", .{name})), name), - }); }; if (target.result.os.tag == .macos) if (sdl_include) |include| { const adapter_test = b.addSystemCommand(&.{ "xcrun", "clang", "-fobjc-arc", "-O1", "-framework", "Cocoa", "-I" }); |
