change matrix and enable caching for Android, iOS and macOS (cross-compile)

This commit is contained in:
Rhody Lugo 2017-11-12 19:02:47 -04:00
parent 49a12ddbc5
commit f09bbfa372
8 changed files with 355 additions and 43 deletions

View File

@ -2,40 +2,31 @@ language: cpp
sudo: false
compiler:
- gcc
- clang
os:
- linux
- osx
env:
- GODOT_TARGET=iphone
- GODOT_TARGET=osx
- GODOT_TARGET=x11
#- GODOT_TARGET=android
cache: ccache
matrix:
include:
- env: STATIC_CHECKS=yes
exclude:
- os: linux
env: GODOT_TARGET=iphone
- os: linux
env: GODOT_TARGET=osx
- os: linux
env: GODOT_TARGET=android
- os: osx
env: GODOT_TARGET=x11
- compiler: gcc
env: GODOT_TARGET=iphone
- compiler: gcc
env: GODOT_TARGET=osx
- compiler: clang
env: GODOT_TARGET=android
- compiler: clang
env: GODOT_TARGET=x11
os: linux
compiler: clang
- env: GODOT_TARGET=x11 TOOLS=yes
os: linux
compiler: gcc
#- env: GODOT_TARGET=x11 TOOLS=no
# os: linux
# compiler: clang
#- env: GODOT_TARGET=windows TOOLS=yes
# os: linux
# compiler: gcc
- env: GODOT_TARGET=android TOOLS=no
os: linux
compiler: gcc
- env: GODOT_TARGET=osx TOOLS=yes
os: osx
compiler: clang
#- env: GODOT_TARGET=iphone TOOLS=no
# os: osx
# compiler: clang
addons:
apt:
@ -59,13 +50,29 @@ addons:
# For style checks.
- clang-format-3.9
install:
- if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$GODOT_TARGET" = "android" ]; then
misc/travis/android-tools-linux.sh;
fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then
misc/travis/scons-local-osx.sh;
misc/travis/ccache-osx.sh;
fi
- if [ "$TRAVIS_OS_NAME" = "osx" ] && [ "$GODOT_TARGET" = "android" ]; then
misc/travis/android-tools-osx.sh;
fi
before_script:
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; brew install scons; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ] && [ "$GODOT_TARGET" = "android" ]; then
brew update; brew install -v android-sdk;
brew install -v android-ndk | grep -v "inflating:" | grep -v "creating:";
export ANDROID_HOME=/usr/local/opt/android-sdk; export ANDROID_NDK_ROOT=/usr/local/opt/android-ndk;
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then
export CCACHE="/usr/bin/ccache";
fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then
export CCACHE="/usr/local/bin/ccache";
export PATH="/usr/local/opt/ccache/libexec:$PATH";
fi
- if [ "$GODOT_TARGET" = "android" ]; then
export ANDROID_HOME=$TRAVIS_BUILD_DIR/godot-dev/build-tools/android-sdk;
export ANDROID_NDK_ROOT=$TRAVIS_BUILD_DIR/godot-dev/build-tools/android-ndk;
fi
script:
@ -74,3 +81,10 @@ script:
else
scons -j 2 platform=$GODOT_TARGET progress=no verbose=yes CXX=$CXX builtin_openssl=yes;
fi
after_success:
- if [ "$STATIC_CHECKS" != "yes" ] && [ $(command -v ccache) ]; then
which ccache;
ccache --version | grep "ccache version";
ccache -s;
fi;

View File

@ -0,0 +1,107 @@
#!/bin/bash
# SDK
# https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
# SHA-256 444e22ce8ca0f67353bda4b85175ed3731cae3ffa695ca18119cbacef1c1bea0
# latest version available here: https://developer.android.com/studio/index.html
# NDK
# https://dl.google.com/android/repository/android-ndk-r15c-linux-x86_64.zip
# SHA-1 0bf02d4e8b85fd770fd7b9b2cdec57f9441f27a2
# latest version available here: https://developer.android.com/ndk/downloads/index.html
BASH_RC=~/.bashrc
GODOT_BUILD_TOOLS_PATH=./godot-dev/build-tools
mkdir -p $GODOT_BUILD_TOOLS_PATH
cd $GODOT_BUILD_TOOLS_PATH
ANDROID_BASE_URL=http://dl.google.com/android/repository
ANDROID_SDK_RELEASE=3859397
ANDROID_SDK_DIR=android-sdk
ANDROID_SDK_FILENAME=sdk-tools-linux-$ANDROID_SDK_RELEASE.zip
ANDROID_SDK_URL=$ANDROID_BASE_URL/$ANDROID_SDK_FILENAME
ANDROID_SDK_PATH=$GODOT_BUILD_TOOLS_PATH/$ANDROID_SDK_DIR
ANDROID_SDK_SHA256=444e22ce8ca0f67353bda4b85175ed3731cae3ffa695ca18119cbacef1c1bea0
ANDROID_NDK_RELEASE=r15c
ANDROID_NDK_DIR=android-ndk
ANDROID_NDK_FILENAME=android-ndk-$ANDROID_NDK_RELEASE-linux-x86_64.zip
ANDROID_NDK_URL=$ANDROID_BASE_URL/$ANDROID_NDK_FILENAME
ANDROID_NDK_PATH=$GODOT_BUILD_TOOLS_PATH/$ANDROID_NDK_DIR
ANDROID_NDK_SHA1=0bf02d4e8b85fd770fd7b9b2cdec57f9441f27a2
echo
echo "Download and install Android development tools ..."
echo
if [ ! -e $ANDROID_SDK_FILENAME ]; then
echo "Downloading: Android SDK ..."
curl -L -O $ANDROID_SDK_URL
else
echo $ANDROID_SDK_SHA1 $ANDROID_SDK_FILENAME > $ANDROID_SDK_FILENAME.sha1
if [ $(shasum -a 256 < $ANDROID_SDK_FILENAME | awk '{print $1;}') != $ANDROID_SDK_SHA1 ]; then
echo "Downloading: Android SDK ..."
curl -L -O $ANDROID_SDK_URL
fi
fi
if [ ! -d $ANDROID_SDK_DIR ]; then
echo "Extracting: Android SDK ..."
unzip -qq $ANDROID_SDK_FILENAME -d $ANDROID_SDK_DIR
echo
fi
if [ ! -e $ANDROID_NDK_FILENAME ]; then
echo "Downloading: Android NDK ..."
curl -L -O $ANDROID_NDK_URL
else
echo $ANDROID_NDK_MD5 $ANDROID_NDK_FILENAME > $ANDROID_NDK_FILENAME.md5
if [ $(shasum -a 1 < $ANDROID_NDK_FILENAME | awk '{print $1;}') != $ANDROID_NDK_SHA1 ]; then
echo "Downloading: Android NDK ..."
curl -L -O $ANDROID_NDK_URL
fi
fi
if [ ! -d $ANDROID_NDK_DIR ]; then
echo "Extracting: Android NDK ..."
unzip -qq $ANDROID_NDK_FILENAME
mv android-ndk-$ANDROID_NDK_RELEASE $ANDROID_NDK_DIR
echo
fi
echo "Installing: Android Tools ..."
#$ANDROID_SDK_DIR/tools/bin/sdkmanager --all
yes | $ANDROID_SDK_DIR/tools/bin/sdkmanager --licenses > /dev/null
$ANDROID_SDK_DIR/tools/bin/sdkmanager 'tools' > /dev/null
$ANDROID_SDK_DIR/tools/bin/sdkmanager 'platform-tools' > /dev/null
$ANDROID_SDK_DIR/tools/bin/sdkmanager 'build-tools;26.0.2' > /dev/null
echo
EXPORT_VAL="export ANDROID_HOME=$ANDROID_SDK_PATH"
if ! grep -q "^$EXPORT_VAL" $BASH_RC; then
echo $EXPORT_VAL >> $BASH_RC
fi
#eval $EXPORT_VAL
EXPORT_VAL="export ANDROID_NDK_ROOT=$ANDROID_NDK_PATH"
if ! grep -q "^$EXPORT_VAL" $BASH_RC; then
echo $EXPORT_VAL >> $BASH_RC
fi
#eval $EXPORT_VAL
EXPORT_VAL="export PATH=$PATH:$ANDROID_SDK_PATH/tools"
if ! grep -q "^export PATH=.*$ANDROID_SDK_PATH/tools.*" $BASH_RC; then
echo $EXPORT_VAL >> $BASH_RC
fi
#eval $EXPORT_VAL
EXPORT_VAL="export PATH=$PATH:$ANDROID_SDK_PATH/tools/bin"
if ! grep -q "^export PATH=.*$ANDROID_SDK_PATH/tools/bin.*" $BASH_RC; then
echo $EXPORT_VAL >> $BASH_RC
fi
#eval $EXPORT_VAL
echo
echo "Done!"
echo

107
misc/travis/android-tools-osx.sh Executable file
View File

@ -0,0 +1,107 @@
#!/bin/bash
# SDK
# https://dl.google.com/android/repository/sdk-tools-darwin-3859397.zip
# SHA-256 4a81754a760fce88cba74d69c364b05b31c53d57b26f9f82355c61d5fe4b9df9
# latest version available here: https://developer.android.com/studio/index.html
# NDK
# https://dl.google.com/android/repository/android-ndk-r15c-darwin-x86_64.zip
# SHA-1 ea4b5d76475db84745aa8828000d009625fc1f98
# latest version available here: https://developer.android.com/ndk/downloads/index.html
BASH_RC=~/.bashrc
GODOT_BUILD_TOOLS_PATH=./godot-dev/build-tools
mkdir -p $GODOT_BUILD_TOOLS_PATH
cd $GODOT_BUILD_TOOLS_PATH
ANDROID_BASE_URL=http://dl.google.com/android/repository
ANDROID_SDK_RELEASE=3859397
ANDROID_SDK_DIR=android-sdk
ANDROID_SDK_FILENAME=sdk-tools-darwin-$ANDROID_SDK_RELEASE.zip
ANDROID_SDK_URL=$ANDROID_BASE_URL/$ANDROID_SDK_FILENAME
ANDROID_SDK_PATH=$GODOT_BUILD_TOOLS_PATH/$ANDROID_SDK_DIR
ANDROID_SDK_SHA256=4a81754a760fce88cba74d69c364b05b31c53d57b26f9f82355c61d5fe4b9df9
ANDROID_NDK_RELEASE=r15c
ANDROID_NDK_DIR=android-ndk
ANDROID_NDK_FILENAME=android-ndk-$ANDROID_NDK_RELEASE-darwin-x86_64.zip
ANDROID_NDK_URL=$ANDROID_BASE_URL/$ANDROID_NDK_FILENAME
ANDROID_NDK_PATH=$GODOT_BUILD_TOOLS_PATH/$ANDROID_NDK_DIR
ANDROID_NDK_SHA1=ea4b5d76475db84745aa8828000d009625fc1f98
echo
echo "Download and install Android development tools ..."
echo
if [ ! -e $ANDROID_SDK_FILENAME ]; then
echo "Downloading: Android SDK ..."
curl -L -O $ANDROID_SDK_URL
else
echo $ANDROID_SDK_SHA1 $ANDROID_SDK_FILENAME > $ANDROID_SDK_FILENAME.sha1
if [ $(shasum -a 256 < $ANDROID_SDK_FILENAME | awk '{print $1;}') != $ANDROID_SDK_SHA1 ]; then
echo "Downloading: Android SDK ..."
curl -L -O $ANDROID_SDK_URL
fi
fi
if [ ! -d $ANDROID_SDK_DIR ]; then
echo "Extracting: Android SDK ..."
mkdir -p $ANDROID_SDK_DIR && tar -xf $ANDROID_SDK_FILENAME -C $ANDROID_SDK_DIR
echo
fi
if [ ! -e $ANDROID_NDK_FILENAME ]; then
echo "Downloading: Android NDK ..."
curl -L -O $ANDROID_NDK_URL
else
echo $ANDROID_NDK_MD5 $ANDROID_NDK_FILENAME > $ANDROID_NDK_FILENAME.md5
if [ $(shasum -a 1 < $ANDROID_NDK_FILENAME | awk '{print $1;}') != $ANDROID_NDK_SHA1 ]; then
echo "Downloading: Android NDK ..."
curl -L -O $ANDROID_NDK_URL
fi
fi
if [ ! -d $ANDROID_NDK_DIR ]; then
echo "Extracting: Android NDK ..."
tar -xf $ANDROID_NDK_FILENAME
mv android-ndk-$ANDROID_NDK_RELEASE $ANDROID_NDK_DIR
echo
fi
echo "Installing: Android Tools ..."
#$ANDROID_SDK_DIR/tools/bin/sdkmanager --all
yes | $ANDROID_SDK_DIR/tools/bin/sdkmanager --licenses > /dev/null
$ANDROID_SDK_DIR/tools/bin/sdkmanager 'tools' > /dev/null
$ANDROID_SDK_DIR/tools/bin/sdkmanager 'platform-tools' > /dev/null
$ANDROID_SDK_DIR/tools/bin/sdkmanager 'build-tools;26.0.2' > /dev/null
echo
EXPORT_VAL="export ANDROID_HOME=$ANDROID_SDK_PATH"
if ! grep -q "^$EXPORT_VAL" $BASH_RC; then
echo $EXPORT_VAL >> $BASH_RC
fi
#eval $EXPORT_VAL
EXPORT_VAL="export ANDROID_NDK_ROOT=$ANDROID_NDK_PATH"
if ! grep -q "^$EXPORT_VAL" $BASH_RC; then
echo $EXPORT_VAL >> $BASH_RC
fi
#eval $EXPORT_VAL
EXPORT_VAL="export PATH=$PATH:$ANDROID_SDK_PATH/tools"
if ! grep -q "^export PATH=.*$ANDROID_SDK_PATH/tools.*" $BASH_RC; then
echo $EXPORT_VAL >> $BASH_RC
fi
#eval $EXPORT_VAL
EXPORT_VAL="export PATH=$PATH:$ANDROID_SDK_PATH/tools/bin"
if ! grep -q "^export PATH=.*$ANDROID_SDK_PATH/tools/bin.*" $BASH_RC; then
echo $EXPORT_VAL >> $BASH_RC
fi
#eval $EXPORT_VAL
echo
echo "Done!"
echo

43
misc/travis/ccache-osx.sh Executable file
View File

@ -0,0 +1,43 @@
#!/bin/bash
echo
echo "Download and install ccache ..."
echo
echo "Downloading sources ..."
curl -L -O https://www.samba.org/ftp/ccache/ccache-3.3.4.tar.gz # latest version available here: https://ccache.samba.org/download.html
echo "Extracting to build directory ..."
tar xzf ccache-3.3.4.tar.gz
cd ccache-3.3.4
echo "Compiling sources ..."
./configure --prefix=/usr/local --with-bundled-zlib > /dev/null
make
echo "Installing ..."
mkdir /usr/local/opt/ccache
mkdir /usr/local/opt/ccache/bin
cp ccache /usr/local/opt/ccache/bin
ln -s /usr/local/opt/ccache/bin/ccache /usr/local/bin/ccache
mkdir /usr/local/opt/ccache/libexec
links=(
clang
clang++
cc
gcc gcc2 gcc3 gcc-3.3 gcc-4.0 gcc-4.2 gcc-4.3 gcc-4.4 gcc-4.5 gcc-4.6 gcc-4.7 gcc-4.8 gcc-4.9 gcc-5 gcc-6 gcc-7
c++ c++3 c++-3.3 c++-4.0 c++-4.2 c++-4.3 c++-4.4 c++-4.5 c++-4.6 c++-4.7 c++-4.8 c++-4.9 c++-5 c++-6 c++-7
g++ g++2 g++3 g++-3.3 g++-4.0 g++-4.2 g++-4.3 g++-4.4 g++-4.5 g++-4.6 g++-4.7 g++-4.8 g++-4.9 g++-5 g++-6 g++-7
)
for link in "${links[@]}"; do
ln -s ../bin/ccache /usr/local/opt/ccache/libexec/$link
done
#/usr/local/bin/ccache -M 2G
cd $TRAVIS_BUILD_DIR
echo
echo "Done!"
echo

18
misc/travis/scons-local-osx.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
echo
echo "Download and install Scons local package ..."
echo
echo "Downloading sources ..."
curl -L -O http://prdownloads.sourceforge.net/scons/scons-local-3.0.0.zip # latest version available here: http://scons.org/pages/download.html
echo "Extracting to build directory ..."
unzip -qq -n scons-local-3.0.0.zip -d $TRAVIS_BUILD_DIR/scons-local
echo "Installing symlinks ..."
ln -s $TRAVIS_BUILD_DIR/scons-local/scons.py /usr/local/bin/scons
echo
echo "Done!"
echo

View File

@ -146,8 +146,15 @@ def configure(env):
# For Clang to find NDK tools in preference of those system-wide
env.PrependENVPath('PATH', tools_path)
env['CC'] = compiler_path + '/clang'
env['CXX'] = compiler_path + '/clang++'
ccache_path = os.environ.get("CCACHE")
if ccache_path == None:
env['CC'] = compiler_path + '/clang'
env['CXX'] = compiler_path + '/clang++'
else:
# there aren't any ccache wrappers available for Android,
# to enable caching we need to prepend the path to the ccache binary
env['CC'] = ccache_path + ' ' + compiler_path + '/clang'
env['CXX'] = ccache_path + ' ' + compiler_path + '/clang++'
env['AR'] = tools_path + "/ar"
env['RANLIB'] = tools_path + "/ranlib"
env['AS'] = tools_path + "/as"

View File

@ -48,10 +48,19 @@ def configure(env):
env['ENV']['PATH'] = env['IPHONEPATH'] + "/Developer/usr/bin/:" + env['ENV']['PATH']
env['CC'] = '$IPHONEPATH/usr/bin/${ios_triple}clang'
env['CXX'] = '$IPHONEPATH/usr/bin/${ios_triple}clang++'
env['AR'] = '$IPHONEPATH/usr/bin/${ios_triple}ar'
env['RANLIB'] = '$IPHONEPATH/usr/bin/${ios_triple}ranlib'
compiler_path = '$IPHONEPATH/usr/bin/${ios_triple}'
ccache_path = os.environ.get("CCACHE")
if ccache_path == None:
env['CC'] = compiler_path + 'clang'
env['CXX'] = compiler_path + 'clang++'
else:
# there aren't any ccache wrappers available for iOS,
# to enable caching we need to prepend the path to the ccache binary
env['CC'] = ccache_path + ' ' + compiler_path + 'clang'
env['CXX'] = ccache_path + ' ' + compiler_path + 'clang++'
env['AR'] = compiler_path + 'ar'
env['RANLIB'] = compiler_path + 'ranlib'
import string
if (env["ios_sim"] == "yes" or env["arch"] == "x86"): # i386, simulator

View File

@ -76,8 +76,15 @@ def configure(env):
else: # 64-bit, default
basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-"
env['CC'] = basecmd + "cc"
env['CXX'] = basecmd + "c++"
ccache_path = os.environ.get("CCACHE")
if ccache_path == None:
env['CC'] = basecmd + "cc"
env['CXX'] = basecmd + "c++"
else:
# there aren't any ccache wrappers available for OS X cross-compile,
# to enable caching we need to prepend the path to the ccache binary
env['CC'] = ccache_path + " " + basecmd + "cc"
env['CXX'] = ccache_path + " " + basecmd + "c++"
env['AR'] = basecmd + "ar"
env['RANLIB'] = basecmd + "ranlib"
env['AS'] = basecmd + "as"