Skip to content
/ SDL Public
forked from libsdl-org/SDL

SDL ported to the Zig build system

License

Notifications You must be signed in to change notification settings

castholm/SDL

 
 

Repository files navigation

SDL ported to the Zig build system

This is a port of SDL 3.0 to the Zig build system, packaged for the Zig package manager.

Usage

Requires Zig 0.12.1, 0.13.0 or 0.14.0-dev (master).

zig fetch --save git+https://github.com/castholm/SDL.git
const sdl_dep = b.dependency("sdl", .{
    .target = target,
    .optimize = optimize,
    //.preferred_link_mode = .static, // or .dynamic
});
const sdl_lib = sdl_dep.artifact("SDL3");
const sdl_test_lib = sdl_dep.artifact("SDL3_test");

Example projects using this SDL package:

Supported targets

Target \ Host Windows Linux macOS
x86_64-windows-gnu
x86_64-linux-gnu
x86_64-macos-none 🉑
aarch64-macos-none 🉑

Legend:

  • ✅ Supported
  • 🉑 Supported, but requires external SDKs
  • ❌ Not supported

Windows

Building for x86-64 Windows from any host system works out of the box.

Linux

Building for x86-64 Linux from any host system works out of the box. The castholm/SDL_linux_deps package provides supplementary headers and source files requires for compiling for Linux.

macOS

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

When building for non-native targets (such as for x86-64 from a 64-bit ARM Mac), you must provide a path to the macOS SDK with --sysroot, which can be obtained by running xcrun --sdk macosx --show-sdk-path:

macos_sdk_path=$(xcrun --sdk macosx --show-sdk-path)
zig build -Dtarget=x86_64-macos-none --sysroot "$macos_sdk_path"

Cross-compiling for macOS from Windows or Linux host systems is not supported because the Xcode and Apple SDKs Agreement explicitly prohibits using macOS SDK files from non-Apple-branded computers or devices.

License

This repository is REUSE-compliant. The effective SPDX license expression for the repository as a whole is:

(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.)

Copyright notices and license texts have been reproduced in LICENSE.txt, for your convenience.

About

SDL ported to the Zig build system

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • C 89.1%
  • C++ 6.6%
  • Objective-C 4.0%
  • Other 0.3%