Files
filament/build/linux/ci-common.sh
Romain Guy b3284edb36 Android standalone toolchains are not longer necessary (#874)
* Android standalone toolchains are not longer necessary

The latest NDK (19) contains ABI/API level specific command line
tools making standalone toolchains unnecessary. This change adapts
to the new model which greatly simplifies the build script and
ensures the latest version of the tools is being used.

Note that this requires a fairly recent version of CMake which fixes
a bug related to ranlib. This change was tested with CMake 3.13
(CMake 3.7 does not work).

* Modify CI build script to fetch recent CMake

* Remove dependency on standalone toolchains in Windows README

* Use correct CMake path

* Update NDK to latest

* Only download CMake and NDK for Android builds

* Add version constant for ninja

* Make output more quiet
2019-02-25 15:14:31 -08:00

95 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
# version of clang we want to use
CLANG_VERSION=7
# version of libcxx and libcxxabi we want to use
CXX_VERSION=7.0.0
# version of CMake to use instead of the default one
CMAKE_VERSION=3.13.4
# version of ninja to use
NINJA_VERSION=1.8.2
# Steps specific to our CI environment
# CI runs on Ubuntu 14.04, we need to install clang-7.0 and the
# appropriate libc++ ourselves
if [ "$KOKORO_BUILD_ID" ]; then
sudo ln -s /usr/include/x86_64-linux-gnu/asm /usr/include/asm
if [ "$FILAMENT_ANDROID_CI_BUILD" ]; then
# Update NDK
yes | $ANDROID_HOME/tools/bin/sdkmanager "ndk-bundle" > /dev/null
# Install CMake
mkdir -p cmake
cd cmake
sudo wget https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-Linux-x86_64.sh
sudo chmod +x ./cmake-$CMAKE_VERSION-Linux-x86_64.sh
sudo ./cmake-$CMAKE_VERSION-Linux-x86_64.sh --skip-license > /dev/null
sudo update-alternatives --install /usr/bin/cmake cmake `pwd`/bin/cmake 1 --force
cd ..
fi
# Install clang
# This may or may not be needed...
# sudo apt-key adv --keyserver apt.llvm.org --recv-keys 15CF4D18AF4F7421
sudo apt-add-repository "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-$CLANG_VERSION main"
sudo apt-get update -y
sudo apt-get --assume-yes --force-yes install clang-$CLANG_VERSION
mkdir -p clang
cd clang
# download LLVM sources
curl -O http://releases.llvm.org/$CXX_VERSION/llvm-$CXX_VERSION.src.tar.xz
tar xf llvm-$CXX_VERSION.src.tar.xz
mv llvm-$CXX_VERSION.src llvm_src
# download libc++ sources
curl -O http://releases.llvm.org/$CXX_VERSION/libcxx-$CXX_VERSION.src.tar.xz
tar xf libcxx-$CXX_VERSION.src.tar.xz
mv libcxx-$CXX_VERSION.src llvm_src/projects/libcxx
# download libc++abi sources
curl -O http://releases.llvm.org/$CXX_VERSION/libcxxabi-$CXX_VERSION.src.tar.xz
tar xf libcxxabi-$CXX_VERSION.src.tar.xz
mv libcxxabi-$CXX_VERSION.src llvm_src/projects/libcxxabi
mkdir -p build
cd build
export CC=/usr/bin/clang-$CLANG_VERSION
export CXX=/usr/bin/clang++-$CLANG_VERSION
# prepare makefiles
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DLIBCXX_ENABLE_RTTI=YES \
-DLIBCXX_ENABLE_EXCEPTIONS=YES \
-DLIBCXX_USE_COMPILER_RT=NO \
-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=YES \
-DLIBCXXABI_USE_COMPILER_RT=NO \
../llvm_src
# compile libraries
make -j cxx
make -j cxxabi
# install libraries
(cd projects/libcxx && sudo make -j install)
(cd projects/libcxxabi && sudo make -j install)
cd ../..
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH
# set to true to link against libc++abi
export FILAMENT_REQUIRES_CXXABI=false
fi
wget -q https://github.com/ninja-build/ninja/releases/download/v$NINJA_VERSION/ninja-linux.zip
unzip -q ninja-linux.zip
export PATH="$PWD:$PATH"