Skip to content

Commit

Permalink
update SDL port to SDL 3.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
asiekierka committed Apr 13, 2024
1 parent 0dcc00f commit ca40d22
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 112 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ endif
endif
CFLAGS += -mwindows
LDFLAGS += -mwindows
LIBS = -Wl,-Bstatic -lmingw32 -lwinpthread -lm -lgcc -lSDL2main -lpng -lz -lssp -Wl,-Bdynamic -lSDL2 -lopengl32
LIBS = -Wl,-Bstatic -lmingw32 -lwinpthread -lm -lgcc -lpng -lz -lssp -Wl,-Bdynamic -lSDL3 -lopengl32
TARGET = $(BUILDDIR)/zeta86.exe
else ifeq (${PLATFORM},macos-sdl)
USE_SDL = 1
CC = clang
LIBS = -framework OpenGL -lSDL2 -lSDL2main -lpng -lm
LIBS = -framework OpenGL -lSDL3 -lpng -lm
TARGET = $(BUILDDIR)/zeta86
ifeq (${ARCH},x86_64)
CFLAGS += -target x86_64-apple-macos10.12
Expand All @@ -56,7 +56,7 @@ LDFLAGS += -target arm64-apple-macos11
endif
else ifeq (${PLATFORM},unix-sdl)
USE_SDL = 1
LIBS = -lGL -lSDL2 -lSDL2main -lpng -lm
LIBS = -lGL -lSDL3 -lpng -lm
TARGET = $(BUILDDIR)/zeta86
else ifeq (${PLATFORM},unix-curses)
USE_CURSES = 1
Expand Down
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ zeta_SOURCES = \
src/util.c \
src/asset_loader.c

if FRONTEND_SDL2
if FRONTEND_SDL3
zeta_SOURCES += \
src/posix_vfs.c \
src/render_software.c \
Expand Down
18 changes: 9 additions & 9 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ AC_ARG_WITH([frontend],
AS_HELP_STRING([--with-frontend=FRONTEND], [Use specified frontend]))
AC_ARG_WITH([resampler],
AS_HELP_STRING([--with-resampler=RESAMPLER], [Use specified resampler: nearest, linear, bandlimited]))
AC_ARG_ENABLE([opengl], AS_HELP_STRING([--enable-opengl], [Enable OpenGL support (for SDL2 frontend; default: auto)]), [use_opengl=$enableval])
AC_ARG_ENABLE([opengl], AS_HELP_STRING([--enable-opengl], [Enable OpenGL support (for SDL3 frontend; default: auto)]), [use_opengl=$enableval])

AC_SUBST(FRONTEND_CFLAGS)
AC_SUBST(FRONTEND_LDFLAGS)
Expand All @@ -33,7 +33,7 @@ AX_CHECK_COMPILE_FLAG([-std=c11], [

dnl Pick frontend.
AS_IF([test "x$with_frontend" = "x"], [
with_frontend=sdl2
with_frontend=sdl3
])

AS_CASE([$with_frontend],
Expand All @@ -42,16 +42,16 @@ AS_CASE([$with_frontend],
FRONTEND_CFLAGS="$FRONTEND_CFLAGS $NCURSES_CFLAGS"
FRONTEND_LDFLAGS="$FRONTEND_LDFLAGS $NCURSES_LIBS"
],
[sdl2], [
PKG_CHECK_MODULES(SDL2, sdl2 >= 2.0.0)
[sdl3], [
PKG_CHECK_MODULES(SDL3, sdl3 >= 3.1.1)
case "${host_os}" in
mingw*)
FRONTEND_CFLAGS="$FRONTEND_CFLAGS -mwindows $SDL2_CFLAGS"
FRONTEND_LDFLAGS="$FRONTEND_LDFLAGS -Wl,-Bstatic -lstdc++ -lpthread -lmingw32 -lSDL2main -Wl,-Bdynamic $SDL2_LIBS -static-libgcc -static-libstdc++"
FRONTEND_CFLAGS="$FRONTEND_CFLAGS -mwindows $SDL3_CFLAGS"
FRONTEND_LDFLAGS="$FRONTEND_LDFLAGS -Wl,-Bstatic -lstdc++ -lpthread -lmingw32 -Wl,-Bdynamic $SDL3_LIBS -static-libgcc -static-libstdc++"
;;
*)
FRONTEND_CFLAGS="$FRONTEND_CFLAGS $SDL2_CFLAGS"
FRONTEND_LDFLAGS="$FRONTEND_LDFLAGS $SDL2_LIBS"
FRONTEND_CFLAGS="$FRONTEND_CFLAGS $SDL3_CFLAGS"
FRONTEND_LDFLAGS="$FRONTEND_LDFLAGS $SDL3_LIBS"
;;
esac
PKG_CHECK_MODULES(LIBPNG, libpng >= 1.6.0, [
Expand All @@ -76,7 +76,7 @@ AS_CASE([$with_frontend],
)

AM_CONDITIONAL([FRONTEND_NCURSES], [test "x$with_frontend" = "xncurses"])
AM_CONDITIONAL([FRONTEND_SDL2], [test "x$with_frontend" = "xsdl2"])
AM_CONDITIONAL([FRONTEND_SDL3], [test "x$with_frontend" = "xsdl3"])

dnl Pick resampler.
AS_IF([test "x$with_resampler" = "x"], [
Expand Down
Loading

0 comments on commit ca40d22

Please sign in to comment.