Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
# SDL for Zig

This is a fork of [SDL](https://www.libsdl.org/), packaged for [Zig](https://ziglang.org).
Unnecessary files have been deleted, and the build system has been replaced with `build.zig`.
The package provides version 2 of SDL. For version 3, consider https://github.com/castholm/SDL.

## Getting started

### Linking SDL2 to your project

Fetch SDL and add to your `build.zig.zon` :
```bash
zig fetch --save=SDL git+https://github.com/allyourcodebase/SDL
```

Add this to your `build.zig` :
```zig
pub fn build(b: *std.Build) void {
// ...

const sdl_dep = b.dependency("SDL", .{
.optimize = .ReleaseFast,
.target = target,
});

// ...

exe.linkLibrary(sdl_dep.artifact("SDL2"));

// ...
}
```
8 changes: 4 additions & 4 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1082,8 +1082,8 @@ fn configHeader(b: *std.Build, t: std.Target) *std.Build.Step.ConfigHeader {
.HAVE_MEMMOVE = 1,
.HAVE_MEMCMP = 1,
.HAVE_WCSLEN = 1,
.HAVE_WCSLCPY = !is_musl,
.HAVE_WCSLCAT = !is_musl,
.HAVE_WCSLCPY = !is_linux,
.HAVE_WCSLCAT = !is_linux,
.HAVE__WCSDUP = 0,
.HAVE_WCSDUP = 1,
.HAVE_WCSSTR = 1,
Expand All @@ -1094,8 +1094,8 @@ fn configHeader(b: *std.Build, t: std.Target) *std.Build.Step.ConfigHeader {
.HAVE_WCSNCASECMP = 1,
.HAVE__WCSNICMP = 0,
.HAVE_STRLEN = 1,
.HAVE_STRLCPY = 1,
.HAVE_STRLCAT = 1,
.HAVE_STRLCPY = !is_linux or is_musl,
.HAVE_STRLCAT = !is_linux or is_musl,
.HAVE__STRREV = 0,
.HAVE__STRUPR = 0,
.HAVE__STRLWR = 0,
Expand Down
Loading