Inject SDL2 specific flags into variables via pkgconf when available
SDL2 is only available at a non-default path on some systems. pkgconf, when installed, may help in those cases
This commit is contained in:
parent
19a165cac7
commit
5d800b3964
10
build.sh
10
build.sh
|
@ -1,14 +1,14 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
cflags="-Wall -O3 -g -std=gnu11 -fno-strict-aliasing -Isrc"
|
cflags="-Wall -O3 -g -std=gnu11 -fno-strict-aliasing -Isrc"
|
||||||
lflags="-lSDL2 -lm"
|
lflags="-lm"
|
||||||
|
|
||||||
if [[ $* == *windows* ]]; then
|
if [[ $* == *windows* ]]; then
|
||||||
platform="windows"
|
platform="windows"
|
||||||
outfile="lite.exe"
|
outfile="lite.exe"
|
||||||
compiler="x86_64-w64-mingw32-gcc"
|
compiler="x86_64-w64-mingw32-gcc"
|
||||||
cflags="$cflags -DLUA_USE_POPEN -Iwinlib/SDL2-2.0.10/x86_64-w64-mingw32/include"
|
cflags="$cflags -DLUA_USE_POPEN -Iwinlib/SDL2-2.0.10/x86_64-w64-mingw32/include"
|
||||||
lflags="$lflags -Lwinlib/SDL2-2.0.10/x86_64-w64-mingw32/lib"
|
lflags="$lflags -lSDL2 -Lwinlib/SDL2-2.0.10/x86_64-w64-mingw32/lib"
|
||||||
lflags="-lmingw32 -lSDL2main $lflags -mwindows -o $outfile res.res"
|
lflags="-lmingw32 -lSDL2main $lflags -mwindows -o $outfile res.res"
|
||||||
x86_64-w64-mingw32-windres res.rc -O coff -o res.res
|
x86_64-w64-mingw32-windres res.rc -O coff -o res.res
|
||||||
else
|
else
|
||||||
|
@ -17,6 +17,12 @@ else
|
||||||
compiler="cc"
|
compiler="cc"
|
||||||
cflags="$cflags -DLUA_USE_POSIX"
|
cflags="$cflags -DLUA_USE_POSIX"
|
||||||
lflags="$lflags -o $outfile"
|
lflags="$lflags -o $outfile"
|
||||||
|
if command -v pkgconf >/dev/null; then
|
||||||
|
cflags="$cflags $(pkgconf --cflags --silence-errors sdl2)"
|
||||||
|
lflags="$lflags $(pkgconf --libs --silence-errors sdl2)"
|
||||||
|
else
|
||||||
|
lflags="$lflags -lSDL2"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v ccache >/dev/null; then
|
if command -v ccache >/dev/null; then
|
||||||
|
|
Loading…
Reference in New Issue