Skip to content

Build script / deprecation fixups #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,11 @@ pub fn link_SDL3(compile_step: *std.Build.Step.Compile) void {
pub fn testVersionCheckSDL2(b: *std.Build, target: std.Build.ResolvedTarget) *std.Build.Step {
const test_sdl2_version_check = b.addTest(.{
.name = "sdl2-version-check",
.root_source_file = b.dependency("zsdl", .{}).path("src/sdl2_version_check.zig"),
.target = target,
.optimize = .ReleaseSafe,
.root_module = b.createModule(.{
.root_source_file = b.dependency("zsdl", .{}).path("src/sdl2_version_check.zig"),
.target = target,
.optimize = .ReleaseSafe,
}),
});

link_SDL2(test_sdl2_version_check);
Expand Down Expand Up @@ -342,7 +344,7 @@ pub const prebuilt_sdl3 = struct {
return &b.addInstallFileWithDir(
sdl3_prebuilt.path("bin/SDL3.dll"),
install_dir,
"SDL2.dll",
"SDL3.dll",
).step;
}
}
Expand All @@ -353,7 +355,7 @@ pub const prebuilt_sdl3 = struct {
return &b.addInstallFileWithDir(
sdl3_prebuilt.path("lib/libSDL3.so"),
install_dir,
"libSDL2.so",
"libSDL3.so",
).step;
}
}
Expand Down Expand Up @@ -383,12 +385,22 @@ fn addTests(
const b = test_step.owner;
const tests = b.addTest(.{
.name = name,
.root_source_file = b.path(root_src_path),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path(root_src_path),
.target = target,
.optimize = optimize,
}),
});
b.installArtifact(tests);
test_step.dependOn(&b.addRunArtifact(tests).step);

const run = b.addRunArtifact(tests);
if (target.result.os.tag == .windows) {
run.setCwd(.{
.cwd_relative = b.getInstallPath(.bin, ""),
});
}

test_step.dependOn(&run.step);
return tests;
}

Expand Down
2 changes: 1 addition & 1 deletion src/sdl2.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2397,7 +2397,7 @@ pub const AudioCallback = *const fn (
userdata: ?*anyopaque,
stream: [*c]u8,
len: c_int,
) callconv(.C) void;
) callconv(.c) void;

pub const AudioFormat = u16;

Expand Down
2 changes: 1 addition & 1 deletion src/sdl3.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3270,7 +3270,7 @@ pub const AudioStreamCallback = *const fn (
stream: ?*AudioStream,
additional_amount: c_int,
total_amount: c_int,
) callconv(.C) void;
) callconv(.c) void;

// TODO
// - SDL_SetAudioStreamGetCallback
Expand Down