{"id":35525101,"url":"https://github.com/allyourcodebase/sdl3","last_synced_at":"2026-04-14T21:01:58.071Z","repository":{"id":296970889,"uuid":"991664221","full_name":"allyourcodebase/SDL3","owner":"allyourcodebase","description":"SDL3 ported to the Zig build system.","archived":false,"fork":false,"pushed_at":"2026-01-15T09:32:28.000Z","size":1645,"stargazers_count":33,"open_issues_count":7,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-03-28T00:38:34.521Z","etag":null,"topics":["zig-package"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/allyourcodebase.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-28T01:17:24.000Z","updated_at":"2026-03-12T23:23:21.000Z","dependencies_parsed_at":"2025-07-24T03:29:32.353Z","dependency_job_id":"1a9d005a-1573-4c90-840d-f4b851511355","html_url":"https://github.com/allyourcodebase/SDL3","commit_stats":null,"previous_names":["games-by-mason/sdl_zig"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/allyourcodebase/SDL3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allyourcodebase%2FSDL3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allyourcodebase%2FSDL3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allyourcodebase%2FSDL3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allyourcodebase%2FSDL3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allyourcodebase","download_url":"https://codeload.github.com/allyourcodebase/SDL3/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allyourcodebase%2FSDL3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31815080,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T18:05:02.291Z","status":"ssl_error","status_checked_at":"2026-04-14T18:05:01.765Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["zig-package"],"created_at":"2026-01-04T00:50:34.750Z","updated_at":"2026-04-14T21:01:58.065Z","avatar_url":"https://github.com/allyourcodebase.png","language":"Zig","readme":"[![CI](https://github.com/Games-By-Mason/sdl_zig/actions/workflows/ci.yaml/badge.svg)](https://github.com/Games-By-Mason/sdl_zig/actions)\n\n# SDL3 Zig\n\nSDL3 ported to the Zig build system.\n\nSupports cross compilation and custom platform configuration.\n\n# Versioning\n\nSee `build.zig.zon` for the current Zig version, see releases for support for previous Zig versions.\n\nThe versions specified in `build.zig.zon` are split between the package version (before the plus) and the SDL version (after the plus). For example, version `1.0.0+3.4.4` is package version 1.0.0 with support for SDL 3.4.4.\n\n# Setup\n\nYou can add SDL3 to your project like this by updating `build.zig.zon` from the command line:\n```sh\nzig fetch --save \u003curl-of-this-repo\u003e\n```\n\nAnd then you can add it to your `build.zig` like this:\n```zig\nconst sdl = b.dependency(\"sdl\", .{\n    .optimize = optimize,\n    .target = target,\n});\nexe.linkLibrary(sdl.artifact(\"SDL3\"));\n```\n\nFinally, you can use SDL's C API from Zig like this:\n```zig\nconst std = @import(\"std\");\nconst c = @cImport({\n    @cInclude(\"SDL3/SDL.h\");\n});\nif (!c.SDL_Init(c.SDL_INIT_VIDEO)) {\n    std.debug.panic(\"SDL_Init failed: {s}\\n\", .{c.SDL_GetError()});\n}\ndefer c.SDL_Quit();\n```\n\n## Example\n\nYou can run `src/example.zig` from the command line:\n```sh\nzig build run-example\n```\n\nThis should produce a window with a pulsing gradient.\n\n## Help, `SDL_Init` failed on Linux!\n\n```sh\nSDL_Init failed: No available video device\n```\n\nBy default, [SDL loads most of its dependencies at runtime on Linux.](https://wiki.libsdl.org/SDL3/README-linux) This lets it decide at runtime which audio drivers to use, whether to use Wayland or X11, etc.\n\nFor this to work, the libraries SDL is looking for need to be on your `LD_LIBRARY_PATH`. This may not be the case by default on distributions like NixOS.\n\nHere's a `shell.nix` for a Vulkan app as an example of running an SDL application on NixOS with either X11 or Wayland.\n```\n{ pkgs ? import \u003cnixpkgs\u003e {}}:\n\npkgs.mkShell {\n  packages = with pkgs; [\n    vulkan-validation-layers\n  ];\n  LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (with pkgs; [\n    alsa-lib\n    libdecor\n    libusb1\n    libxkbcommon\n    vulkan-loader\n    wayland\n    xorg.libX11\n    xorg.libXext\n    xorg.libXi\n    udev\n  ]);\n}\n```\n\nNot all of these dependencies in this example are required. Since both X11 and Wayland dependencies are listed, SDL will use its judgement to decide which to prefer unless `SDL_VIDEODRIVER` is set.\n\n# Target Configuration\n\nThis library provides a default configuration for common targets:\n* [x] Linux (including Steam Deck)\n  * [x] Steam Deck\n* [x] Windows\n* [x] macOS (no cross compilation due to Apple licensing)\n* [ ] [Emscripten (help wanted!)](https://github.com/allyourcodebase/SDL3/issues/5)\n* [ ] [Consoles (help wanted!)](https://github.com/allyourcodebase/SDL3/issues/6)\n\nYou can override the default target configuration by setting `default_target_config` to `false`, and then providing your own configuration. This is typically only necessary when your platform doesn't yet have a default configuration:\n```zig\nconst sdl = b.dependency(\"sdl\", .{\n    .optimize = optimize,\n    .target = target,\n    .default_target_config = false,\n});\nconst sdl_lib = sdl.artifact(\"SDL3\");\nsdl_lib.addIncludePath(...); // Path to your `SDL_build_config.h`, see `windows.zig` for an example of generating this\n```\n\nAny other necessary tweaks such as turning of linking with libc, linking with dependencies, or adding other headers can be done here as well.\n\nIf you're interested in adding default configuration for additional targets, listed or not, contributions are welcome! See [src/linux.zig](src/linux.zig) or [src/windows.zig](src/windows.zig) for examples of how this works.\n\nWhen making a PR that adds support for a new target:\n* Replicate the [default SDL configuration for the target](https://github.com/libsdl-org/SDL/tree/main/include/build_config) within reason\n* Pull dependencies in via the build system rather than vendoring them when possible. If this isn't possible, vendor the needed files in `/deps` with a README explaining why they couldn't be pulled in via the build system and any relevant licensing information.\n* Cross compilation to all targets should be possible within reason unless forbidden by licensing.\n* Update [.github/workflows/ci.yaml](.github/workflows/ci.yaml) to test the new target.\n\n# Updating Dependencies\n\n## SDL\n\n* Modify `build.zig.zon` to point to the desired SDL version\n* If you get linker errors or missing headers relating to Wayland protocols on Linux, new Wayland protocols were added upstream. You can fix this by running `zig build wayland-scanner` with `wayland-scanner`.\n* If you get any other linker errors or missing files, sources were added or renamed upstream, and you need to update `src/sdl.zon`.\n\n## SDL's Dependencies\n\nThis should rarely be necessary. When it is, you can update their version in `build.zig.zon` if present, and any relevant files in `/deps` if present.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallyourcodebase%2Fsdl3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallyourcodebase%2Fsdl3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallyourcodebase%2Fsdl3/lists"}