Skip to content

Commit

Permalink
Update for SDL 3.1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
castholm committed Jan 18, 2025
1 parent 84dbadd commit 0f9b915
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SPDX-License-Identifier: MIT

# SDL ported to the Zig build system

This is a port of [SDL](https://libsdl.org/) 3.0 to the Zig build system, packaged for the Zig package manager.
This is a port of [SDL](https://libsdl.org/) to the Zig build system, packaged for the Zig package manager.

## Usage

Expand Down Expand Up @@ -35,27 +35,32 @@ Example projects using this SDL package:
Target \ Host|Windows|Linux|macOS
-|:-:|:-:|:-:
`x86_64-windows-gnu`|✅|✅|✅
`aarch64-windows-gnu`|🧪|🧪|🧪
`x86_64-linux-gnu`|✅|✅|✅
`aarch64-linux-gnu`|🧪|🧪|🧪
`x86_64-macos-none`|❌|❌|🉑
`aarch64-macos-none`|❌|❌|🉑

Legend:

- ✅ Supported
- 🉑 Supported, but requires external SDKs
- 🧪 Experimental
- ❌ Not supported

### Windows

Building for x86-64 Windows from any host system works out of the box.
Building for x86-64 Windows from any host system works out of the box. AArch64 Windows support is experimental and not yet actively tested.

### Linux

Building for x86-64 Linux from any host system works out of the box. The [castholm/SDL_linux_deps](https://github.com/castholm/SDL_linux_deps) package provides supplementary headers and source files required for compiling for Linux.
Building for x86-64 Linux from any host system works out of the box. AArch64 Linux support is experimental and not yet actively tested.

The [castholm/SDL_linux_deps](https://github.com/castholm/SDL_linux_deps) package provides supplementary headers and source files required for compiling for Linux.

### macOS

Building for macOS requires Xcode 14.1 or later to be installed on the host system.
Building for x86-64 or AArch64 macOS requires Xcode 14.1 or later to be installed on the host system.

When building for non-native targets (for example for x86-64 from an AArch64 Mac), you must provide a path to the macOS SDK via `--sysroot`. This path can be obtained by running `xcrun --sdk macosx --show-sdk-path`:

Expand All @@ -74,6 +79,6 @@ This repository is [REUSE-compliant](https://reuse.software/). The effective SPD
(BSD-3-Clause OR GPL-3.0 OR HIDAPI) AND Apache-2.0 AND BSD-3-Clause AND CC0-1.0 AND HIDAPI AND HPND-sell-variant AND MIT AND SunPro AND Zlib
```

(This is the same as the upstream SDL repository.)
(This is identical to the upstream SDL repository, just expressed in more explicit terms.)

Copyright notices and license texts have been reproduced in [`LICENSE.txt`](LICENSE.txt), for your convenience.
22 changes: 12 additions & 10 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

const std = @import("std");

pub const version: std.SemanticVersion = .{ .major = 3, .minor = 1, .patch = 8 };
pub const version: std.SemanticVersion = .{ .major = 3, .minor = 1, .patch = 10 };
const formatted_version = std.fmt.comptimePrint("SDL-{}", .{version});
pub const vendor_info = "https://github.com/castholm/SDL 0.1.1";
pub const vendor_info = "https://github.com/castholm/SDL 0.1.2";
pub const revision = formatted_version ++ " (" ++ vendor_info ++ ")";

pub fn build(b: *std.Build) void {
Expand Down Expand Up @@ -643,6 +643,7 @@ pub fn build(b: *std.Build) void {
"src/events/SDL_events.c",
"src/events/SDL_keyboard.c",
"src/events/SDL_keymap.c",
"src/events/SDL_keysym_to_keycode.c",
"src/events/SDL_keysym_to_scancode.c",
"src/events/SDL_mouse.c",
"src/events/SDL_pen.c",
Expand All @@ -651,13 +652,13 @@ pub fn build(b: *std.Build) void {
"src/events/SDL_touch.c",
"src/events/SDL_windowevents.c",
"src/events/imKStoUCS.c",
"src/file/SDL_asyncio.c",
"src/file/SDL_iostream.c",
"src/file/generic/SDL_asyncio_generic.c",
"src/filesystem/SDL_filesystem.c",
"src/gpu/SDL_gpu.c",
"src/haptic/SDL_haptic.c",
"src/hidapi/SDL_hidapi.c",
"src/io/SDL_asyncio.c",
"src/io/SDL_iostream.c",
"src/io/generic/SDL_asyncio_generic.c",
"src/joystick/SDL_gamepad.c",
"src/joystick/SDL_joystick.c",
"src/joystick/SDL_steam_virtual_gamepad.c",
Expand Down Expand Up @@ -765,6 +766,7 @@ pub fn build(b: *std.Build) void {
"src/core/windows/SDL_xinput.c",
"src/core/windows/pch.c",
"src/main/windows/SDL_sysmain_runapp.c",
"src/io/windows/SDL_asyncio_windows_ioring.c",
"src/misc/windows/SDL_sysurl.c",
"src/audio/directsound/SDL_directsound.c",
"src/audio/wasapi/SDL_wasapi.c",
Expand Down Expand Up @@ -923,7 +925,7 @@ pub fn build(b: *std.Build) void {
"src/core/linux/SDL_udev.c",
"src/core/linux/SDL_evdev.c",
"src/core/linux/SDL_evdev_kbd.c",
"src/file/io_uring/SDL_asyncio_liburing.c",
"src/io/io_uring/SDL_asyncio_liburing.c",
"src/core/linux/SDL_evdev_capabilities.c",
"src/core/linux/SDL_threadprio.c",
"src/joystick/hidapi/SDL_hidapi_combined.c",
Expand Down Expand Up @@ -1107,10 +1109,10 @@ pub fn build(b: *std.Build) void {
sdl_mod.linkFramework("AudioToolbox", .{});
sdl_mod.linkFramework("AVFoundation", .{});
sdl_mod.linkFramework("Foundation", .{});
sdl_mod.linkFramework("GameController", .{ .weak = true });
sdl_mod.linkFramework("Metal", .{ .weak = true });
sdl_mod.linkFramework("QuartzCore", .{ .weak = true });
sdl_mod.linkFramework("CoreHaptics", .{});
sdl_mod.linkFramework("GameController", .{});
sdl_mod.linkFramework("Metal", .{});
sdl_mod.linkFramework("QuartzCore", .{});
sdl_mod.linkFramework("CoreHaptics", .{ .weak = true });
}

sdl_lib.installHeadersDirectory(b.path("include/SDL3"), "SDL3", .{
Expand Down
2 changes: 1 addition & 1 deletion build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

.{
.name = "sdl",
.version = "0.1.1+SDL-3.1.8",
.version = "0.1.2+SDL-3.1.10",
.minimum_zig_version = "0.12.1",
.dependencies = .{
.sdl_linux_deps = .{
Expand Down

0 comments on commit 0f9b915

Please sign in to comment.