diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 17bb5b924..b171de32c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,7 +12,6 @@ jobs: strategy: fail-fast: false matrix: - zig-version: [0.14.0, latest] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: @@ -27,8 +26,6 @@ jobs: - name: Setup Zig uses: mlugg/setup-zig@v2 - with: - version: ${{ matrix.zig-version }} - name: Check Formatting run: zig fmt --ast-check --check . diff --git a/build.zig b/build.zig index fd601216f..5c1e95c76 100644 --- a/build.zig +++ b/build.zig @@ -8,16 +8,18 @@ pub fn build(b: *std.Build) void { const upstream = b.dependency("SDL_image", .{}); + const mod = b.createModule(.{ + .target = target, + .optimize = optimize, + .link_libc = true, + .sanitize_c = sanitize_c, + }); + const lib = b.addLibrary(.{ .name = "SDL2_image", .version = .{ .major = 2, .minor = 8, .patch = 4 }, .linkage = .static, - .root_module = b.createModule(.{ - .target = target, - .optimize = optimize, - .link_libc = true, - .sanitize_c = sanitize_c, - }), + .root_module = mod, }); const sdl_dep = b.dependency("SDL", .{ @@ -25,58 +27,58 @@ pub fn build(b: *std.Build) void { .optimize = optimize, }); const sdl_lib = sdl_dep.artifact("SDL2"); - lib.linkLibrary(sdl_lib); - lib.addIncludePath(sdl_lib.getEmittedIncludeTree().path(b, "SDL2")); + mod.linkLibrary(sdl_lib); + mod.addIncludePath(sdl_lib.getEmittedIncludeTree().path(b, "SDL2")); // Use stb_image for loading JPEG and PNG files. Native alternatives such as // Windows Imaging Component and Apple's Image I/O framework are not yet // supported by this build script. - lib.root_module.addCMacro("USE_STBIMAGE", ""); + mod.addCMacro("USE_STBIMAGE", ""); // The following are options for supported file formats. AVIF, JXL, TIFF, // and WebP are not yet supported by this build script, as they require // additional dependencies. if (b.option(bool, "enable-bmp", "Support loading BMP images") orelse true) - lib.root_module.addCMacro("LOAD_BMP", ""); + mod.addCMacro("LOAD_BMP", ""); if (b.option(bool, "enable-gif", "Support loading GIF images") orelse true) - lib.root_module.addCMacro("LOAD_GIF", ""); + mod.addCMacro("LOAD_GIF", ""); if (b.option(bool, "enable-jpg", "Support loading JPEG images") orelse true) - lib.root_module.addCMacro("LOAD_JPG", ""); + mod.addCMacro("LOAD_JPG", ""); if (b.option(bool, "enable-lbm", "Support loading LBM images") orelse true) - lib.root_module.addCMacro("LOAD_LBM", ""); + mod.addCMacro("LOAD_LBM", ""); if (b.option(bool, "enable-pcx", "Support loading PCX images") orelse true) - lib.root_module.addCMacro("LOAD_PCX", ""); + mod.addCMacro("LOAD_PCX", ""); if (b.option(bool, "enable-png", "Support loading PNG images") orelse true) - lib.root_module.addCMacro("LOAD_PNG", ""); + mod.addCMacro("LOAD_PNG", ""); if (b.option(bool, "enable-pnm", "Support loading PNM images") orelse true) - lib.root_module.addCMacro("LOAD_PNM", ""); + mod.addCMacro("LOAD_PNM", ""); if (b.option(bool, "enable-qoi", "Support loading QOI images") orelse true) - lib.root_module.addCMacro("LOAD_QOI", ""); + mod.addCMacro("LOAD_QOI", ""); if (b.option(bool, "enable-svg", "Support loading SVG images") orelse true) - lib.root_module.addCMacro("LOAD_SVG", ""); + mod.addCMacro("LOAD_SVG", ""); if (b.option(bool, "enable-tga", "Support loading TGA images") orelse true) - lib.root_module.addCMacro("LOAD_TGA", ""); + mod.addCMacro("LOAD_TGA", ""); if (b.option(bool, "enable-xcf", "Support loading XCF images") orelse true) - lib.root_module.addCMacro("LOAD_XCF", ""); + mod.addCMacro("LOAD_XCF", ""); if (b.option(bool, "enable-xpm", "Support loading XPM images") orelse true) - lib.root_module.addCMacro("LOAD_XPM", ""); + mod.addCMacro("LOAD_XPM", ""); if (b.option(bool, "enable-xv", "Support loading XV images") orelse true) - lib.root_module.addCMacro("LOAD_XV", ""); + mod.addCMacro("LOAD_XV", ""); - lib.addIncludePath(upstream.path("include")); - lib.addIncludePath(upstream.path("src")); + mod.addIncludePath(upstream.path("include")); + mod.addIncludePath(upstream.path("src")); - lib.addCSourceFiles(.{ + mod.addCSourceFiles(.{ .root = upstream.path("src"), .files = srcs, }); if (target.result.os.tag == .macos) { - lib.addCSourceFile(.{ + mod.addCSourceFile(.{ .file = upstream.path("src/IMG_ImageIO.m"), }); - lib.linkFramework("Foundation"); - lib.linkFramework("ApplicationServices"); + mod.linkFramework("Foundation", .{}); + mod.linkFramework("ApplicationServices", .{}); } lib.installHeader(upstream.path("include/SDL_image.h"), "SDL2/SDL_image.h"); diff --git a/build.zig.zon b/build.zig.zon index e263d3947..dc3fd8519 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -2,11 +2,11 @@ .name = .SDL_image, .version = "2.8.8", .fingerprint = 0x7d6df3671d68a2f9, - .minimum_zig_version = "0.14.0", + .minimum_zig_version = "0.15.1", .dependencies = .{ .SDL = .{ - .url = "git+https://github.com/allyourcodebase/SDL#a91ef63a07449874ec049dacfd6459b1131fd27b", - .hash = "SDL-2.32.10-JToi3_a0EgFQAnsafUA-gNv9ku-yxMoYF9Wjq7HhD5q5", + .url = "git+https://github.com/allyourcodebase/SDL#25dc764272bf117198f3cd6f44f52dae5c45d60a", + .hash = "SDL-2.32.10-JToi38G1EgFICTNzwfhy7XOMuWw7gN1xDvPOQ5CCoI8R", }, .SDL_image = .{ .url = "git+https://github.com/libsdl-org/SDL_image#release-2.8.8",