Skip to content

Commit

Permalink
Merge pull request #2 from Peter0x44/master
Browse files Browse the repository at this point in the history
Build FTE using SDL
  • Loading branch information
MotoLegacy authored Jun 14, 2024
2 parents da05bd5 + 15f4495 commit 35ab1ae
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 29 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build-all-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: pc-nzp-linux32.zip
path: ./engine/release/nzportable32
path: ./engine/release/nzportable32-sdl
Compile-Linux64:
runs-on: ubuntu-latest
container:
Expand All @@ -32,7 +32,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: pc-nzp-linux64.zip
path: ./engine/release/nzportable64
path: ./engine/release/nzportable64-sdl
Compile-LinuxArm64:
runs-on: ubuntu-latest
container:
Expand All @@ -48,7 +48,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: pc-nzp-linux_arm64.zip
path: ./engine/release/nzportablearm64
path: ./engine/release/nzportablearm64-sdl
Compile-LinuxArmhf:
runs-on: ubuntu-latest
container:
Expand All @@ -64,7 +64,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: pc-nzp-linux_armhf.zip
path: ./engine/release/nzportablearmhf
path: ./engine/release/nzportablearmhf-sdl
Compile-Windows32:
runs-on: ubuntu-latest
container:
Expand All @@ -80,7 +80,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: pc-nzp-win32.zip
path: ./engine/release/nzportable.exe
path: ./engine/release/nzportable-sdl.exe
Compile-Windows64:
runs-on: ubuntu-latest
container:
Expand All @@ -96,7 +96,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: pc-nzp-win64.zip
path: ./engine/release/nzportable64.exe
path: ./engine/release/nzportable-sdl64.exe
Compile-WASM:
runs-on: ubuntu-latest
container:
Expand Down Expand Up @@ -231,4 +231,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
id: ${{ steps.create_release.outputs.id }}
id: ${{ steps.create_release.outputs.id }}
29 changes: 14 additions & 15 deletions engine/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#note: cross compiling will typically require 'make makelibs FTE_TARGET=mytarget', which avoids installing lots of extra system packages.

#
CC=gcc
CC?=gcc
WINDRES=windres
STRIP?=strip

Expand Down Expand Up @@ -1143,28 +1143,27 @@ ifeq (win_SDL,$(findstring win,$(FTE_TARGET))$(findstring _SDL,$(FTE_TARGET)))

EXEPOSTFIX=.exe

CC_MACHINE:=$(shell $(CC) -dumpmachine)
ARCH_PREDEP=$(BASE_DIR)/libs/SDL2-$(SDL2VER)/$(CC_MACHINE)/bin/sdl2-config
SDLCONFIG=$(ARCH_PREDEP) --prefix=$(BASE_DIR)/libs/SDL2-$(SDL2VER)/$(CC_MACHINE)
ARCH_PREDEP=$(BASE_DIR)/libs-$(ARCH)/SDL2-$(SDL2VER)/$(ARCH)/bin/sdl2-config
SDLCONFIG=$(ARCH_PREDEP) --prefix=$(BASE_DIR)/libs-$(ARCH)/SDL2-$(SDL2VER)/$(ARCH)
ARCH_CFLAGS=`$(SDLCONFIG) --cflags`

#the defaults for sdl come first
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(LTO_END) resources.o $(LTO_START)
GL_EXE_NAME=../$(EXE_NAME)-sdl-gl$(BITS)$(EXEPOSTFIX)
GLCL_EXE_NAME=../$(EXE_NAME)-sdl-glcl$(BITS)$(EXEPOSTFIX)
ifdef windir
# ifdef windir
GL_LDFLAGS=$(GLLDFLAGS) -lmingw32 -lws2_32 `$(SDLCONFIG) --static-libs`
VK_LDFLAGS=$(GLLDFLAGS) -lmingw32 -lws2_32 `$(SDLCONFIG) --static-libs`
M_LDFLAGS=$(MLDFLAGS) -lmingw32 -lws2_32 `$(SDLCONFIG) --static-libs`
SV_LDFLAGS=-lm -lmingw32 -lws2_32 -lwinmm `$(SDLCONFIG) --static-libs`
QCC_LDFLAGS=
else
GL_LDFLAGS=$(IMAGELDFLAGS) -lws2_32 -lmingw32 $(SDL_LDFLAGS) -mwindows -ldxguid -lwinmm -lole32 $(GLLDFLAGS) `$(SDLCONFIG) --libs`
VK_LDFLAGS=$(IMAGELDFLAGS) -lws2_32 -lmingw32 $(SDL_LDFLAGS) -mwindows -ldxguid -lwinmm -lole32 $(GLLDFLAGS) `$(SDLCONFIG) --libs`
M_LDFLAGS=$(IMAGELDFLAGS) -lws2_32 -lmingw32 $(SDL_LDFLAGS) -mwindows -ldxguid -lwinmm -lole32 $(MLDFLAGS) `$(SDLCONFIG) --libs`
SV_LDFLAGS=-lm -lmingw32 -lws2_32 -lwinmm `$(SDLCONFIG) --libs`
QCC_LDFLAGS=
endif
# else
# GL_LDFLAGS=$(IMAGELDFLAGS) -lws2_32 -lmingw32 $(SDL_LDFLAGS) -mwindows -ldxguid -lwinmm -lole32 $(GLLDFLAGS) `$(SDLCONFIG) --libs`
# VK_LDFLAGS=$(IMAGELDFLAGS) -lws2_32 -lmingw32 $(SDL_LDFLAGS) -mwindows -ldxguid -lwinmm -lole32 $(GLLDFLAGS) `$(SDLCONFIG) --libs`
# M_LDFLAGS=$(IMAGELDFLAGS) -lws2_32 -lmingw32 $(SDL_LDFLAGS) -mwindows -ldxguid -lwinmm -lole32 $(MLDFLAGS) `$(SDLCONFIG) --libs`
# SV_LDFLAGS=-lm -lmingw32 -lws2_32 -lwinmm `$(SDLCONFIG) --libs`
# QCC_LDFLAGS=
# endif

GL_CFLAGS=-DFTE_SDL $(GLCFLAGS) $(CLIENTLIBFLAGS) $(DX7SDK)

Expand Down Expand Up @@ -2271,11 +2270,11 @@ droid-help:
@-echo
@-echo "Note that 'make droid-rel' will automatically generate a keystore. If you forget the password, just do a 'make dist-clean'."

$(BASE_DIR)/libs/SDL2-$(SDL2VER)/i686-w64-mingw32/bin/sdl2-config:
$(BASE_DIR)/libs-$(ARCH)/SDL2-$(SDL2VER)/i686-w64-mingw32/bin/sdl2-config:
wget http://www.libsdl.org/release/SDL2-devel-$(SDL2VER)-mingw.tar.gz -O $(BASE_DIR)/sdl2.tar.gz
cd $(BASE_DIR)/libs && tar -xvzf $(BASE_DIR)/sdl2.tar.gz
cd $(BASE_DIR)/libs-$(ARCH) && tar -xvzf $(BASE_DIR)/sdl2.tar.gz
rm $(BASE_DIR)/sdl2.tar.gz
$(BASE_DIR)/libs/SDL2-$(SDL2VER)/x86_64-w64-mingw32/bin/sdl2-config: $(BASE_DIR)/libs/SDL2-$(SDL2VER)/i686-w64-mingw32/bin/sdl2-config
$(BASE_DIR)/libs-$(ARCH)/SDL2-$(SDL2VER)/x86_64-w64-mingw32/bin/sdl2-config: $(BASE_DIR)/libs-$(ARCH)/SDL2-$(SDL2VER)/i686-w64-mingw32/bin/sdl2-config



Expand Down
5 changes: 4 additions & 1 deletion tools/build-nzp-linux32.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
cd ../engine
make makelibs FTE_TARGET=linux32 && make m-rel FTE_TARGET=linux32 FTE_CONFIG=nzportable -j32
export CC=i686-linux-gnu-gcc
export STRIP=i686-linux-gnu-strip
make makelibs FTE_TARGET=SDL2 && make m-rel FTE_TARGET=SDL2 FTE_CONFIG=nzportable -j32
mv release/nzportable-sdl2 release/nzportable32-sdl
5 changes: 4 additions & 1 deletion tools/build-nzp-linux64.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
cd ../engine
make makelibs FTE_TARGET=linux64 && make m-rel FTE_TARGET=linux64 FTE_CONFIG=nzportable -j32
export CC=x86_64-linux-gnu-gcc
export STRIP=x86_64-linux-gnu-strip
make makelibs FTE_TARGET=SDL2 && make m-rel FTE_TARGET=SDL2 FTE_CONFIG=nzportable -j32
mv release/nzportable-sdl2 release/nzportable64-sdl
5 changes: 4 additions & 1 deletion tools/build-nzp-linux_arm64.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
cd ../engine
make makelibs FTE_TARGET=linux_arm64 && make m-rel FTE_TARGET=linux_arm64 FTE_CONFIG=nzportable -j32
export CC=aarch64-linux-gnu-gcc
export STRIP=aarch64-linux-gnu-strip
make makelibs FTE_TARGET=SDL2 && make m-rel FTE_TARGET=SDL2 FTE_CONFIG=nzportable -j32
mv release/nzportable-sdl2 release/nzportablearm64-sdl
5 changes: 4 additions & 1 deletion tools/build-nzp-linux_armhf.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
cd ../engine
make makelibs FTE_TARGET=linux_armhf && make m-rel FTE_TARGET=linux_armhf FTE_CONFIG=nzportable -j32
export CC=arm-linux-gnueabihf-gcc
export STRIP=arm-linux-gnueabihf-strip
make makelibs FTE_TARGET=SDL2 && make m-rel FTE_TARGET=SDL2 FTE_CONFIG=nzportable -j32
mv release/nzportable-sdl2 release/nzportablearmhf-sdl
2 changes: 1 addition & 1 deletion tools/build-nzp-macosx_x86.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export MACOSX_DEPLOYMENT_TARGET=10.14
osxcross-macports install libsdl2 libsdl
cd ../engine
make makelibs FTE_TARGET=macosx_x86 && make m-rel FTE_TARGET=macosx_x86 FTE_CONFIG=nzportable -j8
make makelibs FTE_TARGET=macosx_x86 && make m-rel FTE_TARGET=macosx_x86 FTE_CONFIG=nzportable -j8
5 changes: 4 additions & 1 deletion tools/build-nzp-win32.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
cd ../engine
make makelibs FTE_TARGET=win32 && make m-rel FTE_TARGET=win32 FTE_CONFIG=nzportable -j32
make makelibs FTE_TARGET=win32_SDL2 && make m-rel FTE_TARGET=win32_SDL2 FTE_CONFIG=nzportable -j32
# Running make once is not sufficient... there are link errors (undefined reference to SDL's functions).
# Doing it twice works. I don't know why.
make m-rel FTE_TARGET=win32_SDL2 FTE_CONFIG=nzportable -j32
5 changes: 4 additions & 1 deletion tools/build-nzp-win64.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
cd ../engine
make makelibs FTE_TARGET=win64 && make m-rel FTE_TARGET=win64 FTE_CONFIG=nzportable -j32
make makelibs FTE_TARGET=win64_SDL2 && make m-rel FTE_TARGET=win64_SDL2 FTE_CONFIG=nzportable -j32
# Running make once is not sufficient... there are link errors (undefined reference to SDL's functions).
# Doing it twice works. I don't know why.
make m-rel FTE_TARGET=win64_SDL2 FTE_CONFIG=nzportable -j32

0 comments on commit 35ab1ae

Please sign in to comment.