diff --git a/SDL.zig b/SDL.zig deleted file mode 160000 index 6065059..0000000 --- a/SDL.zig +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 60650591b9c7deff6a1e57c18901c5068f852e26 diff --git a/build.zig b/build.zig index 8b94e54..14fc341 100644 --- a/build.zig +++ b/build.zig @@ -1,21 +1,21 @@ const std = @import("std"); -const sdl = @import("SDL.zig/build.zig"); +const sdl = @import("sdl"); pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); - const sdk = sdl.init(b, null); + const sdk = sdl.init(b, .{}); // link build main exe const exe = b.addExecutable(.{ .name = "GBEMU", - .root_source_file = b.path("src/main.zig"), + .root_source_file = .{ .cwd_relative = "src/main.zig" }, .target = target, .optimize = optimize, }); // sdl2 - sdk.link(exe, .dynamic); + sdk.link(exe, .dynamic, .SDL2); // exe.root_module.addImport("sdl2", sdk.getWrapperModule()); exe.root_module.addImport("sdl2", sdk.getNativeModule()); @@ -31,27 +31,26 @@ pub fn build(b: *std.Build) void { const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step); - // partial buildfor zls + // // partial buildfor zls const exe_check = b.addExecutable(.{ .name = "GBEMU", - .root_source_file = b.path("src/main.zig"), + .root_source_file = .{ .cwd_relative = "src/main.zig" }, .target = target, .optimize = optimize, }); - sdk.link(exe_check, .dynamic); + sdk.link(exe_check, .dynamic, .SDL2); exe_check.root_module.addImport("sdl2", sdk.getNativeModule()); const check = b.step("check", "Check the app"); check.dependOn(&exe_check.step); - // unit tests const exe_unit_tests = b.addTest(.{ - .root_source_file = b.path("src/main.zig"), + .root_source_file = .{ .cwd_relative = "src/main.zig" }, .target = target, .optimize = optimize, }); exe_unit_tests.root_module.addImport("sdl2", sdk.getNativeModule()); - sdk.link(exe_unit_tests, .dynamic); + sdk.link(exe_unit_tests, .dynamic, .SDL2); b.installArtifact(exe_unit_tests); const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); diff --git a/build.zig.zon b/build.zig.zon index 8c07eaa..a27eada 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -2,7 +2,7 @@ .name = "GBEMU", // This is a [Semantic Version](https://semver.org/). // In a future version of Zig it will be used for package deduplication. - .version = "0.0.0", + .version = "0.1.0", // This field is optional. // This is currently advisory only; Zig does not yet do anything @@ -43,6 +43,9 @@ // // actually used. // .lazy = false, //}, + .sdl = .{ + .path = "lib/SDL.zig", + }, }, // Specifies the set of files and directories that are included in this package. @@ -56,11 +59,11 @@ // better to explicitly list the files and directories instead, to insure that // fetching from tarballs, file system paths, and version control all result // in the same contents hash. - "", + // "", // For example... - //"build.zig", - //"build.zig.zon", - //"src", + "build.zig", + "build.zig.zon", + "src", //"LICENSE", //"README.md", }, diff --git a/lib/SDL.zig b/lib/SDL.zig new file mode 160000 index 0000000..38ca4ef --- /dev/null +++ b/lib/SDL.zig @@ -0,0 +1 @@ +Subproject commit 38ca4efa99d05431902021df0997f804a6c6d4f3