Skip to content

Commit 0dccb71

Browse files
committed
Require Zig 0.14.0
1 parent 0466e88 commit 0dccb71

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
zig-version: [0.13.0]
17+
zig-version: [0.14.0]
1818
os: [ubuntu-latest, macos-latest, windows-latest]
1919
runs-on: ${{ matrix.os }}
2020
steps:

build.zig

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,23 @@ pub fn build(b: *std.Build) void {
55
const optimize = b.standardOptimizeOption(.{});
66
const t = target.result;
77

8-
const is_android = if (@hasDecl(@TypeOf(t), "isAndroid")) t.isAndroid() else t.abi.isAndroid();
9-
const is_shared_library = is_android;
10-
const lib = if (!is_shared_library) b.addStaticLibrary(.{
8+
const lib = b.addLibrary(.{
119
.name = "SDL2",
12-
.target = target,
13-
.optimize = optimize,
14-
.link_libc = true,
15-
}) else b.addSharedLibrary(.{
16-
.name = "SDL2",
17-
.target = target,
18-
.optimize = optimize,
19-
.link_libc = true,
10+
.version = .{ .major = 2, .minor = 32, .patch = 2 },
11+
.linkage = if (t.abi.isAndroid()) .dynamic else .static,
12+
.root_module = b.createModule(.{
13+
.target = target,
14+
.optimize = optimize,
15+
.link_libc = true,
16+
}),
2017
});
2118

2219
const sdl_include_path = b.path("include");
2320
lib.addCSourceFiles(.{ .files = &generic_src_files });
2421
lib.root_module.addCMacro("SDL_USE_BUILTIN_OPENGL_DEFINITIONS", "1");
2522
lib.root_module.addCMacro("HAVE_GCC_ATOMICS", "1");
2623
lib.root_module.addCMacro("HAVE_GCC_SYNC_LOCK_TEST_AND_SET", "1");
27-
lib.linkLibC();
24+
2825
switch (t.os.tag) {
2926
.windows => {
3027
lib.root_module.addCMacro("SDL_STATIC_LIB", "");
@@ -75,7 +72,7 @@ pub fn build(b: *std.Build) void {
7572
lib.addIncludePath(.{ .cwd_relative = cache_include });
7673
},
7774
else => {
78-
if (is_android) {
75+
if (t.abi.isAndroid()) {
7976
lib.root_module.addCSourceFiles(.{
8077
.files = &android_src_files,
8178
});
@@ -116,7 +113,7 @@ pub fn build(b: *std.Build) void {
116113

117114
const use_pregenerated_config = switch (t.os.tag) {
118115
.windows, .macos, .emscripten => true,
119-
.linux => is_android,
116+
.linux => t.abi.isAndroid(),
120117
else => false,
121118
};
122119

@@ -159,14 +156,14 @@ pub fn build(b: *std.Build) void {
159156
.style = .{ .cmake = b.path("include/SDL_revision.h.cmake") },
160157
.include_path = "SDL_revision.h",
161158
}, .{
162-
.SDL_REVISION = "SDL-2.32.2",
159+
.SDL_REVISION = b.fmt("SDL-{}", .{lib.version.?}),
163160
.SDL_VENDOR_INFO = "allyourcodebase.com",
164161
});
165162
lib.addConfigHeader(revision_header);
166163
lib.installHeader(revision_header.getOutput(), "SDL2/SDL_revision.h");
167164
}
168165

169-
const use_hidapi = b.option(bool, "use_hidapi", "Use hidapi shared library") orelse is_android;
166+
const use_hidapi = b.option(bool, "use_hidapi", "Use hidapi shared library") orelse t.abi.isAndroid();
170167

171168
if (use_hidapi) {
172169
const hidapi_lib = b.addSharedLibrary(.{

build.zig.zon

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
.{
2-
.name = "SDL",
2+
.name = .sdl,
33
.version = "2.32.2",
4-
.minimum_zig_version = "0.13.0",
4+
.fingerprint = 0xec638ccbca4e96e2,
5+
.minimum_zig_version = "0.14.0",
56
.dependencies = .{},
67
.paths = .{
78
"LICENSE.txt",

0 commit comments

Comments
 (0)