Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdl, docs: support pkgconf sdl2-compat via -d sdl_compat #939

Merged
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ SDL2 is backwards compatible - so anything written against `v2.0.8` can be compi
against newer versions of the SDL2 library.

Also note that SDL2 **is not** compatible with SDL `v1.x`.
SDL2 is however compatible with SDL3 through the [`sdl2-compat`](https://github.com/libsdl-org/sdl2-compat) layer.
Which makes it possible to use the SDL2 API through the SDL3 libraries.
You can tell `sdl` to use this compatibility layer on systems that support `pkgconfig` by
passing the compile time flag `-d sdl_compat` when building your `sdl`/SDL2 based V application.

## Notes on garbage collection and memory issues

Expand Down
7 changes: 6 additions & 1 deletion c/sdl.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ $if !windows {
// This is especially useful when building/linking against a
// custom compiled version of the libs on *nix.
$if !sdl_no_compile_flags ? {
#pkgconfig --cflags --libs sdl2
$if sdl_compat ? {
// Use SDL2 through SDL3 via the compatibility layer
#pkgconfig --cflags --libs sdl2_compat
} $else {
#pkgconfig --cflags --libs sdl2
}
}
}
} $else {
Expand Down
Loading