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..fd1648a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,15 +1,6 @@ [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 @@ -19,9 +10,6 @@ [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..9017c26 100644 --- a/build.zig +++ b/build.zig @@ -4,7 +4,6 @@ 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 +25,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", gdbstub.getModule(b)); // https://git.musuka.dev/paoda/zba-gdbstub - // 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 + exe.addAnonymousModule("zba-util", .{ .source_file = .{ .path = "lib/zba-util/src/lib.zig" } }); // https://git.musuka.dev/paoda/zba-util + 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..a88ab40 --- /dev/null +++ b/build.zig.zon @@ -0,0 +1,22 @@ +.{ + .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", + }, + }, +} 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/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