Skip to content

Commit 6a711ea

Browse files
authored
Merge pull request #24 from kcbanner/fixups_build
Build script / deprecation fixups
2 parents 99b084d + fe0168e commit 6a711ea

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

build.zig

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,11 @@ pub fn link_SDL3(compile_step: *std.Build.Step.Compile) void {
152152
pub fn testVersionCheckSDL2(b: *std.Build, target: std.Build.ResolvedTarget) *std.Build.Step {
153153
const test_sdl2_version_check = b.addTest(.{
154154
.name = "sdl2-version-check",
155-
.root_source_file = b.dependency("zsdl", .{}).path("src/sdl2_version_check.zig"),
156-
.target = target,
157-
.optimize = .ReleaseSafe,
155+
.root_module = b.createModule(.{
156+
.root_source_file = b.dependency("zsdl", .{}).path("src/sdl2_version_check.zig"),
157+
.target = target,
158+
.optimize = .ReleaseSafe,
159+
}),
158160
});
159161

160162
link_SDL2(test_sdl2_version_check);
@@ -342,7 +344,7 @@ pub const prebuilt_sdl3 = struct {
342344
return &b.addInstallFileWithDir(
343345
sdl3_prebuilt.path("bin/SDL3.dll"),
344346
install_dir,
345-
"SDL2.dll",
347+
"SDL3.dll",
346348
).step;
347349
}
348350
}
@@ -353,7 +355,7 @@ pub const prebuilt_sdl3 = struct {
353355
return &b.addInstallFileWithDir(
354356
sdl3_prebuilt.path("lib/libSDL3.so"),
355357
install_dir,
356-
"libSDL2.so",
358+
"libSDL3.so",
357359
).step;
358360
}
359361
}
@@ -383,12 +385,22 @@ fn addTests(
383385
const b = test_step.owner;
384386
const tests = b.addTest(.{
385387
.name = name,
386-
.root_source_file = b.path(root_src_path),
387-
.target = target,
388-
.optimize = optimize,
388+
.root_module = b.createModule(.{
389+
.root_source_file = b.path(root_src_path),
390+
.target = target,
391+
.optimize = optimize,
392+
}),
389393
});
390394
b.installArtifact(tests);
391-
test_step.dependOn(&b.addRunArtifact(tests).step);
395+
396+
const run = b.addRunArtifact(tests);
397+
if (target.result.os.tag == .windows) {
398+
run.setCwd(.{
399+
.cwd_relative = b.getInstallPath(.bin, ""),
400+
});
401+
}
402+
403+
test_step.dependOn(&run.step);
392404
return tests;
393405
}
394406

src/sdl2.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2397,7 +2397,7 @@ pub const AudioCallback = *const fn (
23972397
userdata: ?*anyopaque,
23982398
stream: [*c]u8,
23992399
len: c_int,
2400-
) callconv(.C) void;
2400+
) callconv(.c) void;
24012401

24022402
pub const AudioFormat = u16;
24032403

src/sdl3.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3270,7 +3270,7 @@ pub const AudioStreamCallback = *const fn (
32703270
stream: ?*AudioStream,
32713271
additional_amount: c_int,
32723272
total_amount: c_int,
3273-
) callconv(.C) void;
3273+
) callconv(.c) void;
32743274

32753275
// TODO
32763276
// - SDL_SetAudioStreamGetCallback

0 commit comments

Comments
 (0)