Skip to content

Commit

Permalink
0.14.0 works
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig committed Feb 20, 2025
1 parent 9dec04a commit 4d27333
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
1 change: 0 additions & 1 deletion SDL.zig
Submodule SDL.zig deleted from 606505
19 changes: 9 additions & 10 deletions build.zig
Original file line number Diff line number Diff line change
@@ -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());

Expand All @@ -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);
Expand Down
13 changes: 8 additions & 5 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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",
},
Expand Down
1 change: 1 addition & 0 deletions lib/SDL.zig
Submodule SDL.zig added at 38ca4e

0 comments on commit 4d27333

Please sign in to comment.