ref: d80b7edcd358f2159238f84b5efcc064b9a650c4
parent: a5f65d4218f9e45229c7012e08423f3af37d1676
author: Alibek Omarov <a1ba.omarov@gmail.com>
date: Sun Sep 2 19:40:14 EDT 2018
travis: build sdl2 from sources
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,8 +1,6 @@
language: c
addons:
apt:
- sources:
- - sourceline: 'ppa:keithw/glfw3'
packages:
- libc6-dev-i386
- linux-libc-dev:i386
@@ -17,8 +15,6 @@
- libc6-powerpc-cross
- libc6-dev-arm64-cross
- libc6-dev-powerpc-cross
- - libglfw3-dev
- - libsdl2-dev
- qemu
os:
@@ -29,7 +25,7 @@
script:
- scripts/build.sh
- - (pushd player/; ./build.sh; popd)
+ - (pushd player/; ./build.sh linux; popd)
after_success:
- bash <(curl -s https://codecov.io/bash)
--- /dev/null
+++ b/player/build-sdl.sh
@@ -1,0 +1,25 @@
+set -e
+
+SDL_VERSION=2.0.8
+
+if [ ! -d "SDL" ]; then
+ wget https://www.libsdl.org/release/SDL2-$SDL_VERSION.tar.gz
+ tar -xf SDL2-$SDL_VERSION.tar.gz
+ mv SDL2-$SDL_VERSION SDL
+ rm SDL2-$SDL_VERSION.tar.gz
+fi
+SDL_DIR=SDL/build-$1
+if [ "$1" = "win" ]; then
+ TOOLCHAIN="-DCMAKE_TOOLCHAIN_FILE=../../windows/mingw64.cmake -DRENDER_D3D=OFF"
+fi
+if [ ! -d "$SDL_DIR" ]; then
+ mkdir $SDL_DIR
+ cd $SDL_DIR
+ cmake $TOOLCHAIN -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=TRUE -DVIDEO_OPENGLES=0 -DSDL_SHARED=OFF -DPTHREADS_SEM=OFF -DOSS=OFF -DSNDIO=OFF -DDISKAUDIO=OFF -DVIDEO_WAYLAND=OFF -DCMAKE_CXX_FLAGS=-m32 -DCMAKE_C_FLAGS=-m32 ..
+ make -j4
+ cd ../../
+fi
+if [ ! -d "SDL/include/SDL2" ]; then
+ mkdir SDL/include/SDL2
+ cp SDL/include/*.h SDL/include/SDL2
+fi
--- a/player/build.sh
+++ b/player/build.sh
@@ -1,1 +1,3 @@
-gcc -O2 -o player *.cpp *.c -lstdc++ -lGL -lpthread -lm -ldl -lSDL2
+./build-sdl.sh $1
+
+gcc -O2 -o player *.cpp *.c -lstdc++ -lGL -lpthread -lm -ldl -LSDL/build-$1 -ISDL/include -lSDL2