Fixed android test

0.8
Bruno Van de Velde 2018-07-28 16:51:56 +02:00
parent a4281ab6fb
commit a87a4a3075
2 changed files with 26 additions and 11 deletions

View File

@ -49,7 +49,7 @@ jobs:
- name: Android - name: Android
language: android language: android
env: env:
- ANDROID_NDK=$HOME/android-ndk-r17b - NDK_DIR=$HOME/android-ndk
android: android:
components: components:
- android-23 - android-23
@ -59,7 +59,7 @@ jobs:
- ant - ant
cache: cache:
directories: directories:
- $ANDROID_NDK/sources/sfml - $HOME/sfml-cache
script: script:
- chmod +x tests/travis_android.sh - chmod +x tests/travis_android.sh
- tests/travis_android.sh - tests/travis_android.sh

View File

@ -1,34 +1,49 @@
set -e set -e
mkdir -p $ANDROID_NDK NDK_DIR=$HOME/android-ndk
wget -nv https://dl.google.com/android/repository/android-ndk-r17b-linux-x86_64.zip NDK_VER=r17b
unzip -o -q android-ndk-r17b-linux-x86_64.zip -d $HOME
wget -nv https://dl.google.com/android/repository/android-ndk-${NDK_VER}-linux-x86_64.zip
unzip -o -q android-ndk-${NDK_VER}-linux-x86_64.zip
mv android-ndk-${NDK_VER} $NDK_DIR
sudo apt purge cmake
wget -nv https://cmake.org/files/v3.12/cmake-3.12.0-Linux-x86_64.tar.gz
tar -xvf cmake-3.12.0-Linux-x86_64.tar.gz > /dev/null
sudo cp -r cmake-3.12.0-Linux-x86_64/bin /usr/
sudo cp -r cmake-3.12.0-Linux-x86_64/share /usr/
mkdir -p $HOME/sfml-cache
git clone --depth 1 https://github.com/SFML/SFML git clone --depth 1 https://github.com/SFML/SFML
cd SFML cd SFML
if [[ ! -d "$ANDROID_NDK/sources/sfml/lib" || ! -f "$ANDROID_NDK/sources/sfml/revision_cache" || `git rev-parse HEAD` != `cat "$ANDROID_NDK/sources/sfml/revision_cache"` ]]; then if [[ ! -d "$HOME/sfml-cache/lib" || ! -f "$HOME/sfml-cache/revision_cache" || `git rev-parse HEAD` != `cat "$HOME/sfml-cache/revision_cache"` ]]; then
if [[ ! -d "$ANDROID_NDK/sources/sfml/lib" ]]; then if [[ ! -d "$HOME/sfml-cache/lib" ]]; then
echo "$(tput setaf 3)Rebuilding SFML: no cache available$(tput sgr 0)" echo "$(tput setaf 3)Rebuilding SFML: no cache available$(tput sgr 0)"
else else
echo "$(tput setaf 3)Rebuilding SFML: updating version$(tput sgr 0)" echo "$(tput setaf 3)Rebuilding SFML: updating version$(tput sgr 0)"
fi fi
git rev-parse HEAD > "$ANDROID_NDK/sources/sfml/revision_cache" git rev-parse HEAD > "$HOME/sfml-cache/revision_cache"
cmake -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK=$ANDROID_NDK -DCMAKE_ANDROID_ARCH_ABI=x86 -DCMAKE_ANDROID_STL_TYPE=c++_static -DCMAKE_BUILD_TYPE=Debug -DSFML_BUILD_AUDIO=FALSE -DSFML_BUILD_NETWORK=FALSE . cmake -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK=$NDK_DIR -DCMAKE_ANDROID_ARCH_ABI=x86 -DCMAKE_ANDROID_STL_TYPE=c++_static -DCMAKE_BUILD_TYPE=Debug -DCMAKE_ANDROID_API=19 .
make -j2 make -j2
make install make install
else else
echo "$(tput setaf 2)Using cached SFML directory$(tput sgr 0)" echo "$(tput setaf 2)Using cached SFML directory$(tput sgr 0)"
mkdir -p $NDK_DIR/sources/third_party/sfml
cp -R $HOME/sfml-cache/* $NDK_DIR/sources/third_party/sfml/
fi fi
cd .. cd ..
mkdir build-android mkdir build-android
cd build-android cd build-android
cmake -DTGUI_OPTIMIZE_SINGLE_BUILD=TRUE -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK=/home/texus/Documents/android/android-ndk-r13b/ -DCMAKE_ANDROID_ARCH_ABI=x86 -DCMAKE_ANDROID_STL_TYPE=c++_static -DCMAKE_BUILD_TYPE=Debug .. cmake -DTGUI_OPTIMIZE_SINGLE_BUILD=TRUE -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK=$NDK_DIR -DCMAKE_ANDROID_ARCH_ABI=x86 -DCMAKE_ANDROID_STL_TYPE=c++_static -DCMAKE_BUILD_TYPE=Debug ..
make -j2 make -j2
make install make install
cd ../examples/android cd ../examples/android
android update project --name TGUI --path . --target android-23 android update project --name TGUI --path . --target android-23
$ANDROID_NDK/ndk-build $NDK_DIR/ndk-build
ant debug ant debug
rm -R $HOME/sfml-cache/*
mv $NDK_DIR/sources/third_party/sfml/* $HOME/sfml-cache/