From f534aac5443c1cadfa571562f186e92627500c65 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Mon, 19 Jun 2023 11:14:21 -0500 Subject: [PATCH] chore: update depdendencies ZBA now specifically targets Zig v0.11.0-dev.3395+1e7dcaa3a --- .github/workflows/main.yml | 4 ++-- .gitmodules | 18 --------------- build.zig | 46 +++++++++++++------------------------- build.zig.zon | 30 +++++++++++++++++++++++++ lib/SDL.zig | 2 +- lib/known-folders | 1 - lib/nfd-zig | 1 - lib/zba-gdbstub | 1 - lib/zba-util | 1 - lib/zgui | 2 +- lib/zig-clap | 1 - lib/zig-datetime | 1 - 12 files changed, 49 insertions(+), 59 deletions(-) create mode 100644 build.zig.zon delete mode 160000 lib/known-folders delete mode 160000 lib/nfd-zig delete mode 160000 lib/zba-gdbstub delete mode 160000 lib/zba-util delete mode 160000 lib/zig-clap delete mode 160000 lib/zig-datetime diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f7baf54..bc0f936 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ jobs: steps: - uses: goto-bus-stop/setup-zig@v2 with: - version: master + version: 0.11.0-dev.3395+1e7dcaa3a - name: prepare-linux if: runner.os == 'Linux' run: | @@ -54,6 +54,6 @@ jobs: submodules: recursive - uses: goto-bus-stop/setup-zig@v2 with: - version: master + version: 0.11.0-dev.3395+1e7dcaa3a - run: zig fmt src/**/*.zig \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 475af46..e4695a9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,27 +1,9 @@ [submodule "lib/SDL.zig"] path = lib/SDL.zig url = https://github.com/MasterQ32/SDL.zig -[submodule "lib/zig-clap"] - path = lib/zig-clap - url = https://github.com/Hejsil/zig-clap -[submodule "lib/known-folders"] - path = lib/known-folders - url = https://github.com/ziglibs/known-folders -[submodule "lib/zig-datetime"] - path = lib/zig-datetime - url = https://github.com/frmdstryr/zig-datetime [submodule "lib/zig-toml"] path = lib/zig-toml url = https://github.com/aeronavery/zig-toml -[submodule "lib/zba-gdbstub"] - path = lib/zba-gdbstub - url = https://git.musuka.dev/paoda/zba-gdbstub [submodule "lib/zgui"] path = lib/zgui url = https://git.musuka.dev/paoda/zgui -[submodule "lib/nfd-zig"] - path = lib/nfd-zig - url = https://github.com/fabioarnold/nfd-zig -[submodule "lib/zba-util"] - path = lib/zba-util - url = https://git.musuka.dev/paoda/zba-util.git diff --git a/build.zig b/build.zig index de5bec9..c2c72e4 100644 --- a/build.zig +++ b/build.zig @@ -2,9 +2,7 @@ const std = @import("std"); const builtin = @import("builtin"); const Sdk = @import("lib/SDL.zig/Sdk.zig"); -const gdbstub = @import("lib/zba-gdbstub/build.zig"); const zgui = @import("lib/zgui/build.zig"); -const nfd = @import("lib/nfd-zig/build.zig"); pub fn build(b: *std.Build) void { // Minimum Zig Version @@ -26,45 +24,31 @@ pub fn build(b: *std.Build) void { exe.setMainPkgPath("."); // Necessary so that src/main.zig can embed example.toml - // Known Folders (%APPDATA%, XDG, etc.) - exe.addAnonymousModule("known_folders", .{ .source_file = .{ .path = "lib/known-folders/known-folders.zig" } }); + exe.addModule("known_folders", b.dependency("known-folders", .{}).module("known-folders")); // https://github.com/ziglibs/known-folders + exe.addModule("datetime", b.dependency("zig-datetime", .{}).module("zig-datetime")); // https://github.com/frmdstryr/zig-datetime + exe.addModule("clap", b.dependency("zig-clap", .{}).module("clap")); // https://github.com/Hejsil/zig-clap + exe.addModule("gdbstub", b.dependency("zba-gdbstub", .{}).module("gdbstub")); // https://git.musuka.dev/paoda/zba-gdbstub + exe.addModule("zba-util", b.dependency("zba-util", .{}).module("zba-util")); // https://git.musuka.dev/paoda/zba-util - // DateTime Library - exe.addAnonymousModule("datetime", .{ .source_file = .{ .path = "lib/zig-datetime/src/main.zig" } }); + // https://github.com/fabioarnold/nfd-zig + const nfd_dep = b.dependency("nfd", .{ .target = target, .optimize = optimize }); + exe.linkLibrary(nfd_dep.artifact("nfd")); + exe.addModule("nfd", nfd_dep.module("nfd")); - // Bitfield type from FlorenceOS: https://github.com/FlorenceOS/ - exe.addAnonymousModule("bitfield", .{ .source_file = .{ .path = "lib/bitfield.zig" } }); - - // Argument Parsing Library - exe.addAnonymousModule("clap", .{ .source_file = .{ .path = "lib/zig-clap/clap.zig" } }); - - // TOML Library - exe.addAnonymousModule("toml", .{ .source_file = .{ .path = "lib/zig-toml/src/toml.zig" } }); - - // OpenGL 3.3 Bindings - exe.addAnonymousModule("gl", .{ .source_file = .{ .path = "lib/gl.zig" } }); - - // ZBA utility code - exe.addAnonymousModule("zba-util", .{ .source_file = .{ .path = "lib/zba-util/src/lib.zig" } }); - - // gdbstub - exe.addModule("gdbstub", gdbstub.getModule(b)); - - // NativeFileDialog(ue) Bindings - exe.linkLibrary(nfd.makeLib(b, target, optimize)); - exe.addModule("nfd", nfd.getModule(b)); - - // Zig SDL Bindings: https://github.com/MasterQ32/SDL.zig + // https://github.com/MasterQ32/SDL.zig const sdk = Sdk.init(b, null); sdk.link(exe, .dynamic); exe.addModule("sdl2", sdk.getNativeModule()); - // Dear ImGui bindings - + // https://git.musuka.dev/paoda/zgui // .shared option should stay in sync with SDL.zig call above where true == .dynamic, and false == .static const zgui_pkg = zgui.package(b, target, optimize, .{ .options = .{ .backend = .sdl2_opengl3, .shared = true } }); zgui_pkg.link(exe); + exe.addAnonymousModule("bitfield", .{ .source_file = .{ .path = "lib/bitfield.zig" } }); // https://github.com/FlorenceOS/ + exe.addAnonymousModule("toml", .{ .source_file = .{ .path = "lib/zig-toml/src/toml.zig" } }); // https://github.com/aeronavery/zig-toml + exe.addAnonymousModule("gl", .{ .source_file = .{ .path = "lib/gl.zig" } }); // https://github.com/MasterQ32/zig-opengl + b.installArtifact(exe); const run_cmd = b.addRunArtifact(exe); diff --git a/build.zig.zon b/build.zig.zon new file mode 100644 index 0000000..9f2d033 --- /dev/null +++ b/build.zig.zon @@ -0,0 +1,30 @@ +.{ + .name = "zba", + .version = "0.1.0", + .dependencies = .{ + .nfd = .{ + .url = "https://github.com/fabioarnold/nfd-zig/archive/8520a6807f046a23ecf3143e22fc49d2a9d1c189.tar.gz", + .hash = "122089e0f5ab5e4729a09aed48d721b98ed2b362923ead797c6af3b54ef9a725203f", + }, + .@"known-folders" = .{ + .url = "https://github.com/ziglibs/known-folders/archive/d13ba6137084e55f873f6afb67447fe8906cc951.tar.gz", + .hash = "122028c00915d9b37296059be8a3883c718dbb5bd174350caedf152fed1f46f99607", + }, + .@"zig-datetime" = .{ + .url = "https://github.com/frmdstryr/zig-datetime/archive/e4a2bc92b3771a745145c9a6961f0b5277a48335.tar.gz", + .hash = "12209fc05ecb5add8f87152f03f99243a419c9dd5a04c6b4a359d6b4f13426fede0c", + }, + .@"zig-clap" = .{ + .url = "https://github.com/Hejsil/zig-clap/archive/a1b7a7301b0006bb4c8daaaf5ade8a6df8ec13ae.tar.gz", + .hash = "12205aeff59f41f96033d280471730c171c9a825d8758743249bed834e1590f593e3", + }, + .@"zba-gdbstub" = .{ + .url = "https://git.musuka.dev/paoda/zba-gdbstub/archive/39a4260ffd83bae7bb44bb098872c96382fb5ba3.tar.gz", + .hash = "12208d44e3ab611b523f66e2d6fdb0283c3ee498a6a9fe4080c6d252ee8469059f1c", + }, + .@"zba-util" = .{ + .url = "https://git.musuka.dev/paoda/zba-util/archive/e616cf09e53f5c402c8f040d14baa211683e70e3.tar.gz", + .hash = "1220b80b2c0989dcc47275ab9d7d70da4858ef3c1fe1f934e8d838e65028127f6ef3", + }, + }, +} diff --git a/lib/SDL.zig b/lib/SDL.zig index e6f9576..fbe5f59 160000 --- a/lib/SDL.zig +++ b/lib/SDL.zig @@ -1 +1 @@ -Subproject commit e6f9576eab562140632806e57539ef658e62fed9 +Subproject commit fbe5f599c65b7a5642990443b2a686d1c53a4985 diff --git a/lib/known-folders b/lib/known-folders deleted file mode 160000 index d13ba61..0000000 --- a/lib/known-folders +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d13ba6137084e55f873f6afb67447fe8906cc951 diff --git a/lib/nfd-zig b/lib/nfd-zig deleted file mode 160000 index d14635d..0000000 --- a/lib/nfd-zig +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d14635d112531292dfa46476d0f7f8015669b626 diff --git a/lib/zba-gdbstub b/lib/zba-gdbstub deleted file mode 160000 index 215e053..0000000 --- a/lib/zba-gdbstub +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 215e053b9ace6e6e561b64cb06e2516021f76897 diff --git a/lib/zba-util b/lib/zba-util deleted file mode 160000 index 77d11c9..0000000 --- a/lib/zba-util +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 77d11c9903d7f4a3a31ef59fc954421d7dfa0eb1 diff --git a/lib/zgui b/lib/zgui index 281f95b..5149d4b 160000 --- a/lib/zgui +++ b/lib/zgui @@ -1 +1 @@ -Subproject commit 281f95b4606d449b7877f13cd5f408790b410491 +Subproject commit 5149d4b1def740194cf627d8d68bce18024dc7ce diff --git a/lib/zig-clap b/lib/zig-clap deleted file mode 160000 index 05a50fe..0000000 --- a/lib/zig-clap +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 05a50fe7fe833059db8550c34bc69fedd8bb0af8 diff --git a/lib/zig-datetime b/lib/zig-datetime deleted file mode 160000 index 46ba305..0000000 --- a/lib/zig-datetime +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 46ba305a45a30747066d29421bcac0699254d4ae