Skip to content

Commit

Permalink
Add support for SDL3
Browse files Browse the repository at this point in the history
  • Loading branch information
gen2brain committed Dec 3, 2024
1 parent 5df9325 commit ea071de
Show file tree
Hide file tree
Showing 21 changed files with 88 additions and 50 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ It is also possible to build the DLL yourself. You can find more info at [raylib

* `drm` - build for Linux native [DRM](https://en.wikipedia.org/wiki/Direct_Rendering_Manager) mode, including Raspberry Pi 4 and other devices (PLATFORM_DRM)
* `sdl` - build for [SDL](https://github.com/libsdl-org/SDL) backend (PLATFORM_DESKTOP_SDL)
* `sdl3` - build for [SDL](https://github.com/libsdl-org/SDL) v3 backend (PLATFORM_DESKTOP_SDL3)
* `rgfw` - build for [RGFW](https://github.com/ColleagueRiley/RGFW) backend (PLATFORM_DESKTOP_RGFW)
* `noaudio` - disables audio functions
* `opengl43` - uses OpenGL 4.3 backend
Expand Down
4 changes: 2 additions & 2 deletions raylib/cgo_darwin.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build darwin && !rgfw && !sdl
// +build darwin,!rgfw,!sdl
//go:build darwin && !rgfw && !sdl && !sdl3
// +build darwin,!rgfw,!sdl,!sdl3

package rl

Expand Down
4 changes: 2 additions & 2 deletions raylib/cgo_darwin_rgfw.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build darwin && rgfw && !sdl
// +build darwin,rgfw,!sdl
//go:build darwin && rgfw && !sdl && !sdl3
// +build darwin,rgfw,!sdl,!sdl3

package rl

Expand Down
13 changes: 9 additions & 4 deletions raylib/cgo_darwin_sdl.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
//go:build darwin && sdl && !rgfw
// +build darwin,sdl,!rgfw
//go:build darwin && (sdl || sdl3) && !rgfw
// +build darwin
// +build sdl sdl3
// +build !rgfw

package rl

/*
#cgo darwin LDFLAGS: -framework Cocoa -framework IOKit -framework CoreVideo -framework CoreFoundation
#cgo darwin CFLAGS: -Wno-deprecated-declarations -Wno-implicit-const-int-float-conversion -DPLATFORM_DESKTOP_SDL
#cgo darwin pkg-config: sdl2
#cgo darwin CFLAGS: -Wno-deprecated-declarations -Wno-implicit-const-int-float-conversion
#cgo darwin,sdl CFLAGS: -DPLATFORM_DESKTOP_SDL
#cgo darwin,sdl3 CFLAGS: -DPLATFORM_DESKTOP_SDL -DPLATFORM_DESKTOP_SDL3
#cgo darwin,sdl pkg-config: sdl2
#cgo darwin,sdl3 pkg-config: sdl3
#cgo darwin,!es2,!es3 LDFLAGS: -framework OpenGL
Expand Down
4 changes: 2 additions & 2 deletions raylib/cgo_freebsd.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build freebsd && !linux && !rgfw && !drm && !sdl && !android
// +build freebsd,!linux,!rgfw,!drm,!sdl,!android
//go:build freebsd && !linux && !rgfw && !drm && !sdl && !sdl3 && !android
// +build freebsd,!linux,!rgfw,!drm,!sdl,!sdl3,!android

package rl

Expand Down
4 changes: 2 additions & 2 deletions raylib/cgo_freebsd_rgfw.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build freebsd && rgfw && !linux && !drm && !sdl && !android
// +build freebsd,rgfw,!linux,!drm,!sdl,!android
//go:build freebsd && rgfw && !linux && !drm && !sdl && !sdl3 && !android
// +build freebsd,rgfw,!linux,!drm,!sdl,!sdl3,!android

package rl

Expand Down
16 changes: 12 additions & 4 deletions raylib/cgo_freebsd_sdl.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
//go:build freebsd && !linux && sdl && !rgfw && !drm && !android
// +build freebsd,!linux,sdl,!rgfw,!drm,!android
//go:build freebsd && !linux && (sdl || sdl3) && !rgfw && !drm && !android
// +build freebsd
// +build !linux
// +build sdl sdl3
// +build !rgfw
// +build !drm
// +build !android

package rl

/*
#cgo freebsd CFLAGS: -I. -I/usr/local/include -DPLATFORM_DESKTOP_SDL
#cgo freebsd CFLAGS: -I. -I/usr/local/include
#cgo freebsd,sdl CFLAGS: -DPLATFORM_DESKTOP_SDL
#cgo freebsd,sdl3 CFLAGS: -DPLATFORM_DESKTOP_SDL -DPLATFORM_DESKTOP_SDL3
#cgo freebsd LDFLAGS: -L/usr/local/lib
#cgo freebsd pkg-config: sdl2
#cgo freebsd,sdl pkg-config: sdl2
#cgo freebsd,sdl3 pkg-config: sdl3
#cgo freebsd,!es2,!es3 LDFLAGS: -lGL
Expand Down
4 changes: 2 additions & 2 deletions raylib/cgo_linux.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build linux && !rgfw && !drm && !sdl && !android
// +build linux,!rgfw,!drm,!sdl,!android
//go:build linux && !rgfw && !drm && !sdl && !sdl3 && !android
// +build linux,!rgfw,!drm,!sdl,!sdl3,!android

package rl

Expand Down
4 changes: 2 additions & 2 deletions raylib/cgo_linux_drm.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build linux && drm && !rgfw && !sdl && !android
// +build linux,drm,!rgfw,!sdl,!android
//go:build linux && drm && !rgfw && !sdl && !sdl3 && !android
// +build linux,drm,!rgfw,!sdl,!sdl3,!android

package rl

Expand Down
4 changes: 2 additions & 2 deletions raylib/cgo_linux_rgfw.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build linux && rgfw && !drm && !sdl && !android
// +build linux,rgfw,!drm,!sdl,!android
//go:build linux && rgfw && !drm && !sdl && !sdl3 && !android
// +build linux,rgfw,!drm,!sdl,!sdl3,!android

package rl

Expand Down
15 changes: 11 additions & 4 deletions raylib/cgo_linux_sdl.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
//go:build linux && sdl && !rgfw && !drm && !android
// +build linux,sdl,!rgfw,!drm,!android
//go:build linux && (sdl || sdl3) && !rgfw && !drm && !android
// +build linux
// +build sdl sdl3
// +build !rgfw
// +build !drm
// +build !android

package rl

/*
#cgo linux,!es2 LDFLAGS: -lm
#cgo linux CFLAGS: -DPLATFORM_DESKTOP_SDL -Wno-stringop-overflow
#cgo linux pkg-config: sdl2
#cgo linux CFLAGS: -Wno-stringop-overflow
#cgo linux,sdl CFLAGS: -DPLATFORM_DESKTOP_SDL
#cgo linux,sdl3 CFLAGS: -DPLATFORM_DESKTOP_SDL -DPLATFORM_DESKTOP_SDL3
#cgo linux,sdl pkg-config: sdl2
#cgo linux,sdl3 pkg-config: sdl3
#cgo linux,!es2,!es3 LDFLAGS: -lGL
Expand Down
4 changes: 2 additions & 2 deletions raylib/cgo_openbsd.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build openbsd && !linux && !rgfw && !drm && !sdl && !android
// +build openbsd,!linux,!rgfw,!drm,!sdl,!android
//go:build openbsd && !linux && !rgfw && !drm && !sdl && !sdl3 && !android
// +build openbsd,!linux,!rgfw,!drm,!sdl,!sdl3,!android

package rl

Expand Down
4 changes: 2 additions & 2 deletions raylib/cgo_openbsd_rgfw.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build openbsd && rgfw && !linux && !sdl && !drm && !android
// +build openbsd,rgfw,!linux,!sdl,!drm,!android
//go:build openbsd && rgfw && !linux && !sdl && !sdl3 && !drm && !android
// +build openbsd,rgfw,!linux,!sdl,!sdl3,!drm,!android

package rl

Expand Down
16 changes: 12 additions & 4 deletions raylib/cgo_openbsd_sdl.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
//go:build openbsd && !linux && sdl && !rgfw && !drm && !android
// +build openbsd,!linux,sdl,!rgfw,!drm,!android
//go:build openbsd && !linux && (sdl || sdl3) && !rgfw && !drm && !android
// +build openbsd
// +build !linux
// +build sdl sdl3
// +build !rgfw
// +build !drm
// +build !android

package rl

/*
#cgo openbsd CFLAGS: -I. -I/usr/X11R6/include -DPLATFORM_DESKTOP_SDL
#cgo openbsd CFLAGS: -I. -I/usr/X11R6/include
#cgo openbsd,sdl CFLAGS: -DPLATFORM_DESKTOP_SDL
#cgo openbsd,sdl3 CFLAGS: -DPLATFORM_DESKTOP_SDL -DPLATFORM_DESKTOP_SDL3
#cgo openbsd LDFLAGS: -L/usr/X11R6/lib
#cgo openbsd pkg-config: sdl2
#cgo openbsd,sdl pkg-config: sdl2
#cgo openbsd,sdl3 pkg-config: sdl3
#cgo openbsd,!es2,!es3 LDFLAGS: -lGL
Expand Down
4 changes: 2 additions & 2 deletions raylib/cgo_windows.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build windows && !rgfw && !sdl
// +build windows,!rgfw,!sdl
//go:build windows && !rgfw && !sdl && !sdl3
// +build windows,!rgfw,!sdl,!sdl3

package rl

Expand Down
4 changes: 2 additions & 2 deletions raylib/cgo_windows_rgfw.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build windows && rgfw && !sdl
// +build windows,rgfw,!sdl
//go:build windows && rgfw && !sdl && !sdl3
// +build windows,rgfw,!sdl,!sdl3

package rl

Expand Down
14 changes: 10 additions & 4 deletions raylib/cgo_windows_sdl.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
//go:build windows && sdl && !rgfw
// +build windows,sdl,!rgfw
//go:build windows && (sdl || sdl3) && !rgfw
// +build windows
// +build sdl sdl3
// +build !rgfw

package rl

/*
#cgo windows LDFLAGS: -lgdi32 -lwinmm -lole32 -lSDL2
#cgo windows CFLAGS: -Iexternal -DPLATFORM_DESKTOP_SDL -Wno-stringop-overflow
#cgo windows LDFLAGS: -lgdi32 -lwinmm -lole32
#cgo windows,sdl LDFLAGS: -lSDL2
#cgo windows,sdl3 LDFLAGS: -lSDL3
#cgo windows CFLAGS: -Iexternal -Wno-stringop-overflow
#cgo windows,sdl CFLAGS: -DPLATFORM_DESKTOP_SDL
#cgo windows,sdl3 CFLAGS: -DPLATFORM_DESKTOP_SDL -DPLATFORM_DESKTOP_SDL3
#cgo windows,!es2,!es3 LDFLAGS: -lopengl32
Expand Down
4 changes: 2 additions & 2 deletions raylib/platform_desktop.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build !rgfw && !sdl && !drm && !android
// +build !rgfw,!sdl,!drm,!android
//go:build !rgfw && !sdl && !sdl3 && !drm && !android
// +build !rgfw,!sdl,!sdl3,!drm,!android

package rl

Expand Down
4 changes: 2 additions & 2 deletions raylib/platform_desktop_rgfw.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build rgfw && !sdl && !drm && !android
// +build rgfw,!sdl,!drm,!android
//go:build rgfw && !sdl && !sdl3 && !drm && !android
// +build rgfw,!sdl,!sdl3,!drm,!android

package rl

Expand Down
7 changes: 5 additions & 2 deletions raylib/platform_desktop_sdl.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//go:build sdl && !rgfw && !drm && !android
// +build sdl,!rgfw,!drm,!android
//go:build (sdl || sdl3) && !rgfw && !drm && !android
// +build sdl sdl3
// +build !rgfw
// +build !drm
// +build !android

package rl

Expand Down
4 changes: 2 additions & 2 deletions raylib/platform_drm.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build linux && drm && !rgfw && !sdl && !android
// +build linux,drm,!rgfw,!sdl,!android
//go:build linux && drm && !rgfw && !sdl && !sdl3 && !android
// +build linux,drm,!rgfw,!sdl,!sdl3,!android

package rl

Expand Down

0 comments on commit ea071de

Please sign in to comment.