this repo has no description

workflows: fix missing system libraries

altagos.dev f3c5c1a6 3d6965dc

verified
+43 -41
+6 -6
.tangled/workflows/build.yml
··· 1 when: 2 - - event: ["push", "pull_request"] 3 - branch: ["main"] 4 5 engine: nixery 6 7 dependencies: 8 nixpkgs: 9 - - mise 10 11 steps: 12 - name: Setup Zig 13 command: | 14 mise trust 15 - mise exec zig -- zig version 16 - name: Run Tests 17 command: | 18 - mise exec zig -- zig build test --summary all 19 - name: Build ReleaseSafe 20 command: | 21 - mise exec zig -- zig build -Doptimize=ReleaseSafe -Ddocking
··· 1 when: 2 + - event: ["push", "pull_request"] 3 + branch: ["main", "workflows"] 4 5 engine: nixery 6 7 dependencies: 8 nixpkgs: 9 + - mise 10 11 steps: 12 - name: Setup Zig 13 command: | 14 mise trust 15 + mise exec zig -- zig version 16 - name: Run Tests 17 command: | 18 + zig build test -Dbuild-gui=false --summary all 19 - name: Build ReleaseSafe 20 command: | 21 + zig build -Doptimize=ReleaseSafe -Dbuild-gui=false
-18
.tangled/workflows/web.yml
··· 1 - when: 2 - - event: ["push", "pull_request"] 3 - branch: ["main"] 4 - 5 - engine: nixery 6 - 7 - dependencies: 8 - nixpkgs: 9 - - mise 10 - 11 - steps: 12 - - name: Setup Zig 13 - command: | 14 - mise trust 15 - mise exec zig -- zig version 16 - - name: Build ReleaseSafe 17 - command: | 18 - mise exec zig -- zig build -Doptimize=ReleaseSmall -Dtarget=wasm32-emscripten -Ddocking
···
+37 -17
build.zig
··· 5 const cimgui = @import("cimgui"); 6 7 const Options = struct { 8 mod_ft: *Build.Module, 9 mod_exe: *Build.Module, 10 dep_sokol: *Build.Dependency, ··· 17 const optimize = b.standardOptimizeOption(.{}); 18 19 const opt_docking = b.option(bool, "docking", "Build with docking support") orelse false; 20 21 const cimgui_conf = cimgui.getConfig(opt_docking); 22 ··· 60 mod_exe.addOptions("build_options", options_mod_exe); 61 62 const opts = Options{ 63 .mod_ft = mod_ft, 64 .mod_exe = mod_exe, 65 .dep_sokol = dep_sokol, ··· 69 if (target.result.cpu.arch.isWasm()) { 70 try buildWeb(b, opts); 71 } else { 72 - try buildNative(b, opts); 73 } 74 } 75 76 fn buildNative(b: *Build, opts: Options) !void { 77 const exe = b.addExecutable(.{ 78 .name = "factorio_toolbox", ··· 90 if (b.args) |args| { 91 run_cmd.addArgs(args); 92 } 93 - 94 - const mod_tests = b.addTest(.{ 95 - .name = "mod tests", 96 - .root_module = opts.mod_ft, 97 - }); 98 - const run_mod_tests = b.addRunArtifact(mod_tests); 99 - 100 - const exe_tests = b.addTest(.{ 101 - .name = "exe tests", 102 - .root_module = opts.mod_exe, 103 - }); 104 - const run_exe_tests = b.addRunArtifact(exe_tests); 105 - 106 - const test_step = b.step("test", "Run tests"); 107 - test_step.dependOn(&run_mod_tests.step); 108 - test_step.dependOn(&run_exe_tests.step); 109 } 110 111 fn buildWeb(b: *Build, opts: Options) !void { ··· 138 }); 139 run.step.dependOn(&link_step.step); 140 b.step("run", "Run the web app").dependOn(&run.step); 141 } 142 143 fn createShaderModule(b: *Build, dep_sokol: *Build.Dependency) !*Build.Module {
··· 5 const cimgui = @import("cimgui"); 6 7 const Options = struct { 8 + build_gui: bool, 9 mod_ft: *Build.Module, 10 mod_exe: *Build.Module, 11 dep_sokol: *Build.Dependency, ··· 18 const optimize = b.standardOptimizeOption(.{}); 19 20 const opt_docking = b.option(bool, "docking", "Build with docking support") orelse false; 21 + const build_gui_opt = b.option(bool, "build-gui", "When disabled only build factorio-toolbox library and not the gui app") orelse true; 22 23 const cimgui_conf = cimgui.getConfig(opt_docking); 24 ··· 62 mod_exe.addOptions("build_options", options_mod_exe); 63 64 const opts = Options{ 65 + .build_gui = build_gui_opt, 66 .mod_ft = mod_ft, 67 .mod_exe = mod_exe, 68 .dep_sokol = dep_sokol, ··· 72 if (target.result.cpu.arch.isWasm()) { 73 try buildWeb(b, opts); 74 } else { 75 + if (opts.build_gui) { 76 + try buildNative(b, opts); 77 + } else { 78 + buildFTLib(b, opts); 79 + } 80 + tests(b, opts); 81 } 82 } 83 84 + fn buildFTLib(b: *Build, opts: Options) void { 85 + const lib = b.addLibrary(.{ 86 + .name = "factorio-toolbox", 87 + .root_module = opts.mod_ft, 88 + }); 89 + b.installArtifact(lib); 90 + } 91 + 92 fn buildNative(b: *Build, opts: Options) !void { 93 const exe = b.addExecutable(.{ 94 .name = "factorio_toolbox", ··· 106 if (b.args) |args| { 107 run_cmd.addArgs(args); 108 } 109 } 110 111 fn buildWeb(b: *Build, opts: Options) !void { ··· 138 }); 139 run.step.dependOn(&link_step.step); 140 b.step("run", "Run the web app").dependOn(&run.step); 141 + } 142 + 143 + fn tests(b: *Build, opts: Options) void { 144 + const test_step = b.step("test", "Run tests"); 145 + 146 + const mod_tests = b.addTest(.{ 147 + .name = "mod tests", 148 + .root_module = opts.mod_ft, 149 + }); 150 + const run_mod_tests = b.addRunArtifact(mod_tests); 151 + test_step.dependOn(&run_mod_tests.step); 152 + 153 + if (opts.build_gui) { 154 + const exe_tests = b.addTest(.{ 155 + .name = "exe tests", 156 + .root_module = opts.mod_exe, 157 + }); 158 + const run_exe_tests = b.addRunArtifact(exe_tests); 159 + test_step.dependOn(&run_exe_tests.step); 160 + } 161 } 162 163 fn createShaderModule(b: *Build, dep_sokol: *Build.Dependency) !*Build.Module {