From ab66241354b8454706fb84fe331fa20bc3aa452c Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Sat, 23 Feb 2019 23:59:34 -0800 Subject: [PATCH 1/8] 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). --- README.md | 81 +-------------------- build.sh | 60 +-------------- build/toolchain-aarch64-linux-android.cmake | 13 +++- build/toolchain-arm7-linux-android.cmake | 16 +++- build/toolchain-x86-linux-android.cmake | 13 +++- build/toolchain-x86_64-linux-android.cmake | 13 +++- 6 files changed, 47 insertions(+), 149 deletions(-) diff --git a/README.md b/README.md index 2f5b7aee2d7..7069ce9047e 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ and tools. To build Filament, you must first install the following tools: -- CMake 3.4 (or more recent) +- CMake 3.13 (or more recent) - clang 7.0 (or more recent) - [ninja 1.8](https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages) (or more recent) @@ -169,7 +169,7 @@ To build Filament for Android you must also install the following: - Android Studio 3.3 - Android SDK -- Android NDK +- Android NDK 19 or higher ### Environment variables @@ -334,10 +334,9 @@ Install the following components: - [Windows 10 SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk) - [Visual Studio 2015 or 2017](https://www.visualstudio.com/downloads) -- [Clang 6](http://releases.llvm.org/download.html) +- [Clang 7](http://releases.llvm.org/download.html) - [Python 3.7](https://www.python.org/ftp/python/3.7.0/python-3.7.0.exe) -- [Git 2.16.1 or later](https://github.com/git-for-windows/git/releases/download/v2.16.1.windows.4/PortableGit-2.16.1.4-64-bit.7z.exe) -- [Cmake 3.11 or later](https://cmake.org/files/v3.11/cmake-3.11.0-rc1-win64-x64.msi) +- [Cmake 3.13 or later](https://github.com/Kitware/CMake/releases/download/v3.13.4/cmake-3.13.4-win64-x64.msi) If you're using Visual Studio 2017, you'll also need to install the [LLVM Compiler Toolchain](https://marketplace.visualstudio.com/items?itemName=LLVMExtensions.llvm-toolchain) @@ -463,24 +462,6 @@ Run `build.sh -h` for more information. #### ARM 64-bit target (arm64-v8a) -##### Linux toolchain - -``` -$ $SDK/ndk-bundle/build/tools/make_standalone_toolchain.py --arch arm64 --api 21 \ - --stl libc++ --force \ - --install-dir toolchains/Linux/aarch64-linux-android-4.9 -``` - -##### Darwin toolchain - -``` -$ $SDK/ndk-bundle/build/tools/make_standalone_toolchain.py --arch arm64 --api 21 \ - --stl libc++ --force \ - --install-dir toolchains/Darwin/aarch64-linux-android-4.9 -``` - -##### Compiling - Then invoke CMake in a build directory of your choice, inside of filament's directory: ``` @@ -508,24 +489,6 @@ binaries should be found in `out/android-release/filament/lib/arm64-v8a`. #### ARM 32-bit target (armeabi-v7a) -##### Linux toolchain - -``` -$ $SDK/ndk-bundle/build/tools/make_standalone_toolchain.py --arch arm --api 21 \ - --stl libc++ --force \ - --install-dir toolchains/Linux/arm-linux-androideabi-4.9 -``` - -##### Darwin toolchain - -``` -$ $SDK/ndk-bundle/build/tools/make_standalone_toolchain.py --arch arm --api 21 \ - --stl libc++ --force \ - --install-dir toolchains/Darwin/arm-linux-androideabi-4.9 -``` - -##### Compiling - Then invoke CMake in a build directory of your choice, inside of filament's directory: ``` @@ -553,24 +516,6 @@ binaries should be found in `out/android-release/filament/lib/armeabi-v7a`. #### Intel 64-bit target (x86_64) -##### Linux toolchain - -``` -$ $SDK/ndk-bundle/build/tools/make_standalone_toolchain.py --arch x86_64 --api 21 \ - --stl libc++ --force \ - --install-dir toolchains/Linux/x86_64-linux-android-4.9 -``` - -##### Darwin toolchain - -``` -$ $SDK/ndk-bundle/build/tools/make_standalone_toolchain.py --arch x86_64 --api 21 \ - --stl libc++ --force \ - --install-dir toolchains/Darwin/x86_64-linux-android-4.9 -``` - -##### Compiling - Then invoke CMake in a build directory of your choice, sibling of filament's directory: ``` @@ -598,24 +543,6 @@ binaries should be found in `out/android-release/filament/lib/x86_64`. #### Intel 32-bit target (x86) -##### Linux toolchain - -``` -$ $SDK/ndk-bundle/build/tools/make_standalone_toolchain.py --arch x86 --api 21 \ - --stl libc++ --force \ - --install-dir toolchains/Linux/i686-linux-android-4.9 -``` - -##### Darwin toolchain - -``` -$ $SDK/ndk-bundle/build/tools/make_standalone_toolchain.py --arch x86 --api 21 \ - --stl libc++ --force \ - --install-dir toolchains/Darwin/i686-linux-android-4.9 -``` - -##### Compiling - Then invoke CMake in a build directory of your choice, sibling of filament's directory: ``` diff --git a/build.sh b/build.sh index 2d3bbba921a..36738f25dfe 100755 --- a/build.sh +++ b/build.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -# NDK API level -API_LEVEL=21 # Host tools required by Android, WebGL, and iOS builds MOBILE_HOST_TOOLS="matc resgen cmgen" WEB_HOST_TOOLS="${MOBILE_HOST_TOOLS} mipgen filamesh" @@ -31,10 +29,8 @@ function print_help { echo " -p platform1,platform2,..." echo " Where platformN is [desktop|android|ios|webgl|all]." echo " Platform(s) to build, defaults to desktop." - echo " Building for Android or iOS will automatically generate / download" + echo " Building for iOS will automatically generate / download" echo " the toolchains if needed and perform a partial desktop build." - echo " -t" - echo " Generate the Android toolchain, requires \$ANDROID_HOME to be set." echo " -u" echo " Run all unit tests, will trigger a debug build if needed." echo " -v" @@ -100,8 +96,6 @@ ENABLE_JAVA=ON INSTALL_COMMAND= -GENERATE_TOOLCHAINS=false - VULKAN_ANDROID_OPTION="-DFILAMENT_SUPPORTS_VULKAN=OFF" BUILD_FILAMAT_ANDROID=false @@ -116,8 +110,6 @@ BUILD_CUSTOM_TARGETS= UNAME=`echo $(uname)` LC_UNAME=`echo ${UNAME} | tr '[:upper:]' '[:lower:]'` -TOOLCHAIN_SCRIPT=${ANDROID_HOME}/ndk-bundle/build/tools/make_standalone_toolchain.py - # Functions function build_clean { @@ -127,43 +119,6 @@ function build_clean { rm -Rf android/filament-android/.externalNativeBuild } -function generate_toolchain { - local ARCH=$1 - local ARCH_NAME=$2 - local TOOLCHAIN_NAME=toolchains/${UNAME}/${ARCH_NAME}-4.9 - - if [ -z "$ANDROID_HOME" ]; then - echo "The environment variable \$ANDROID_HOME is not set." >&2 - exit 1 - fi - - if [ ! -f "$TOOLCHAIN_SCRIPT" ]; then - echo "The NDK is not properly installed in $ANDROID_HOME." >&2 - exit 1 - fi - - if [ -d "$TOOLCHAIN_NAME" ]; then - echo "Removing existing $ARCH toolchain..." - rm -Rf ${TOOLCHAIN_NAME} - fi - - echo "Generating $ARCH toolchain..." - - ${TOOLCHAIN_SCRIPT} \ - --arch ${ARCH} \ - --api ${API_LEVEL} \ - --stl libc++ \ - --force \ - --install-dir ${TOOLCHAIN_NAME} -} - -function generate_toolchains { - generate_toolchain "arm64" "aarch64-linux-android" - generate_toolchain "arm" "arm-linux-androideabi" - generate_toolchain "x86_64" "x86_64-linux-android" - generate_toolchain "x86" "i686-linux-android" -} - function build_desktop_target { local LC_TARGET=`echo $1 | tr '[:upper:]' '[:lower:]'` local BUILD_TARGETS=$2 @@ -319,12 +274,6 @@ function build_android_target { function build_android_arch { local ARCH=$1 local ARCH_NAME=$2 - local TOOLCHAIN_ARCH=$3 - local TOOLCHAIN_NAME=toolchains/${UNAME}/${ARCH_NAME}-4.9 - - if [ ! -d "$TOOLCHAIN_NAME" ]; then - generate_toolchain ${TOOLCHAIN_ARCH} ${ARCH_NAME} - fi if [ "$ISSUE_DEBUG_BUILD" == "true" ]; then build_android_target "Debug" "$ARCH" @@ -635,9 +584,6 @@ while getopts ":hacfijmp:tuvsl" opt; do esac done ;; - t) - GENERATE_TOOLCHAINS=true - ;; u) ISSUE_DEBUG_BUILD=true RUN_TESTS=true @@ -700,10 +646,6 @@ if [ "$ISSUE_CLEAN" == "true" ]; then build_clean fi -if [ "$GENERATE_TOOLCHAINS" == "true" ]; then - generate_toolchains -fi - if [ "$ISSUE_DESKTOP_BUILD" == "true" ]; then build_desktop fi diff --git a/build/toolchain-aarch64-linux-android.cmake b/build/toolchain-aarch64-linux-android.cmake index 0d51c654b92..6b2c0eda56a 100644 --- a/build/toolchain-aarch64-linux-android.cmake +++ b/build/toolchain-aarch64-linux-android.cmake @@ -20,12 +20,16 @@ set(CMAKE_SYSTEM_NAME Linux) # this one not so much set(CMAKE_SYSTEM_VERSION 1) +# android +set(API_LEVEL 21) + # architecture set(ARCH aarch64-linux-android) set(DIST_ARCH arm64-v8a) # toolchain -set(TOOLCHAIN ${CMAKE_SOURCE_DIR}/toolchains/${CMAKE_HOST_SYSTEM_NAME}/${ARCH}-4.9) +string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} HOST_NAME_L) +set(TOOLCHAIN $ENV{ANDROID_HOME}/ndk-bundle/toolchains/llvm/prebuilt/${HOST_NAME_L}-x86_64/) # specify the cross compiler set(COMPILER_SUFFIX) @@ -33,8 +37,11 @@ if(WIN32) set(COMPILER_SUFFIX ".cmd") set(CMAKE_AR ${TOOLCHAIN}/bin/${ARCH}-ar.exe CACHE FILEPATH "Archiver") endif() -set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${ARCH}-clang${COMPILER_SUFFIX}) -set(CMAKE_CXX_COMPILER ${TOOLCHAIN}/bin/${ARCH}-clang++${COMPILER_SUFFIX}) +set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${ARCH}${API_LEVEL}-clang${COMPILER_SUFFIX}) +set(CMAKE_CXX_COMPILER ${TOOLCHAIN}/bin/${ARCH}${API_LEVEL}-clang++${COMPILER_SUFFIX}) +set(CMAKE_AR ${TOOLCHAIN}/bin/${ARCH}-ar${COMPILER_SUFFIX}) +set(CMAKE_RANLIB ${TOOLCHAIN}/bin/${ARCH}-ranlib${COMPILER_SUFFIX}) +set(CMAKE_STRIP ${TOOLCHAIN}/bin/${ARCH}-strip${COMPILER_SUFFIX}) # where is the target environment set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/sysroot) diff --git a/build/toolchain-arm7-linux-android.cmake b/build/toolchain-arm7-linux-android.cmake index 19c2047b967..7083cb55f0d 100644 --- a/build/toolchain-arm7-linux-android.cmake +++ b/build/toolchain-arm7-linux-android.cmake @@ -20,12 +20,17 @@ set(CMAKE_SYSTEM_NAME Linux) # this one not so much set(CMAKE_SYSTEM_VERSION 1) +# android +set(API_LEVEL 21) + # architecture -set(ARCH arm-linux-androideabi) +set(ARCH armv7a-linux-androideabi) +set(AR_ARCH arm-linux-androideabi) set(DIST_ARCH armeabi-v7a) # toolchain -set(TOOLCHAIN ${CMAKE_SOURCE_DIR}/toolchains/${CMAKE_HOST_SYSTEM_NAME}/${ARCH}-4.9) +string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} HOST_NAME_L) +set(TOOLCHAIN $ENV{ANDROID_HOME}/ndk-bundle/toolchains/llvm/prebuilt/${HOST_NAME_L}-x86_64/) # specify the cross compiler set(COMPILER_SUFFIX) @@ -33,8 +38,11 @@ if(WIN32) set(COMPILER_SUFFIX ".cmd") set(CMAKE_AR ${TOOLCHAIN}/bin/${ARCH}-ar.exe CACHE FILEPATH "Archiver") endif() -set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${ARCH}-clang${COMPILER_SUFFIX}) -set(CMAKE_CXX_COMPILER ${TOOLCHAIN}/bin/${ARCH}-clang++${COMPILER_SUFFIX}) +set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${ARCH}${API_LEVEL}-clang${COMPILER_SUFFIX}) +set(CMAKE_CXX_COMPILER ${TOOLCHAIN}/bin/${ARCH}${API_LEVEL}-clang++${COMPILER_SUFFIX}) +set(CMAKE_AR ${TOOLCHAIN}/bin/${AR_ARCH}-ar${COMPILER_SUFFIX}) +set(CMAKE_RANLIB ${TOOLCHAIN}/bin/${AR_ARCH}-ranlib${COMPILER_SUFFIX}) +set(CMAKE_STRIP ${TOOLCHAIN}/bin/${AR_ARCH}-strip${COMPILER_SUFFIX}) # where is the target environment set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/sysroot) diff --git a/build/toolchain-x86-linux-android.cmake b/build/toolchain-x86-linux-android.cmake index a80c20e9774..99c914b07b0 100644 --- a/build/toolchain-x86-linux-android.cmake +++ b/build/toolchain-x86-linux-android.cmake @@ -20,12 +20,16 @@ set(CMAKE_SYSTEM_NAME Linux) # this one not so much set(CMAKE_SYSTEM_VERSION 1) +# android +set(API_LEVEL 21) + # architecture set(ARCH i686-linux-android) set(DIST_ARCH x86) # toolchain -set(TOOLCHAIN ${CMAKE_SOURCE_DIR}/toolchains/${CMAKE_HOST_SYSTEM_NAME}/${ARCH}-4.9) +string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} HOST_NAME_L) +set(TOOLCHAIN $ENV{ANDROID_HOME}/ndk-bundle/toolchains/llvm/prebuilt/${HOST_NAME_L}-x86_64/) # specify the cross compiler set(COMPILER_SUFFIX) @@ -33,8 +37,11 @@ if(WIN32) set(COMPILER_SUFFIX ".cmd") set(CMAKE_AR ${TOOLCHAIN}/bin/${ARCH}-ar.exe CACHE FILEPATH "Archiver") endif() -set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${ARCH}-clang${COMPILER_SUFFIX}) -set(CMAKE_CXX_COMPILER ${TOOLCHAIN}/bin/${ARCH}-clang++${COMPILER_SUFFIX}) +set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${ARCH}${API_LEVEL}-clang${COMPILER_SUFFIX}) +set(CMAKE_CXX_COMPILER ${TOOLCHAIN}/bin/${ARCH}${API_LEVEL}-clang++${COMPILER_SUFFIX}) +set(CMAKE_AR ${TOOLCHAIN}/bin/${ARCH}-ar${COMPILER_SUFFIX}) +set(CMAKE_RANLIB ${TOOLCHAIN}/bin/${ARCH}-ranlib${COMPILER_SUFFIX}) +set(CMAKE_STRIP ${TOOLCHAIN}/bin/${ARCH}-strip${COMPILER_SUFFIX}) # where is the target environment set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/sysroot) diff --git a/build/toolchain-x86_64-linux-android.cmake b/build/toolchain-x86_64-linux-android.cmake index d68ce53422d..5e2bc103744 100644 --- a/build/toolchain-x86_64-linux-android.cmake +++ b/build/toolchain-x86_64-linux-android.cmake @@ -20,12 +20,16 @@ set(CMAKE_SYSTEM_NAME Linux) # this one not so much set(CMAKE_SYSTEM_VERSION 1) +# android +set(API_LEVEL 21) + # architecture set(ARCH x86_64-linux-android) set(DIST_ARCH x86_64) # toolchain -set(TOOLCHAIN ${CMAKE_SOURCE_DIR}/toolchains/${CMAKE_HOST_SYSTEM_NAME}/${ARCH}-4.9) +string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} HOST_NAME_L) +set(TOOLCHAIN $ENV{ANDROID_HOME}/ndk-bundle/toolchains/llvm/prebuilt/${HOST_NAME_L}-x86_64/) # specify the cross compiler set(COMPILER_SUFFIX) @@ -33,8 +37,11 @@ if(WIN32) set(COMPILER_SUFFIX ".cmd") set(CMAKE_AR ${TOOLCHAIN}/bin/${ARCH}-ar.exe CACHE FILEPATH "Archiver") endif() -set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${ARCH}-clang${COMPILER_SUFFIX}) -set(CMAKE_CXX_COMPILER ${TOOLCHAIN}/bin/${ARCH}-clang++${COMPILER_SUFFIX}) +set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${ARCH}${API_LEVEL}-clang${COMPILER_SUFFIX}) +set(CMAKE_CXX_COMPILER ${TOOLCHAIN}/bin/${ARCH}${API_LEVEL}-clang++${COMPILER_SUFFIX}) +set(CMAKE_AR ${TOOLCHAIN}/bin/${ARCH}-ar${COMPILER_SUFFIX}) +set(CMAKE_RANLIB ${TOOLCHAIN}/bin/${ARCH}-ranlib${COMPILER_SUFFIX}) +set(CMAKE_STRIP ${TOOLCHAIN}/bin/${ARCH}-strip${COMPILER_SUFFIX}) # where is the target environment set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/sysroot) From 1cbc2637c44d28de09ea6e4338798fc1ca84d837 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Mon, 25 Feb 2019 14:05:14 -0800 Subject: [PATCH 2/8] Modify CI build script to fetch recent CMake --- build/linux/ci-common.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/build/linux/ci-common.sh b/build/linux/ci-common.sh index efa3c851efc..83960a00cc9 100755 --- a/build/linux/ci-common.sh +++ b/build/linux/ci-common.sh @@ -4,6 +4,8 @@ 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 # Steps specific to our CI environment # CI runs on Ubuntu 14.04, we need to install clang-6.0 and the @@ -11,6 +13,16 @@ CXX_VERSION=7.0.0 if [ "$KOKORO_BUILD_ID" ]; then sudo ln -s /usr/include/x86_64-linux-gnu/asm /usr/include/asm + 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 + sudo update-alternatives --install /usr/bin/cmake cmake `pwd`/cmake/bin/cmake 1 --force + + cd .. + # 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" From e4a729b507c927a3ca89d0d82bff6059b4370057 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Mon, 25 Feb 2019 14:06:55 -0800 Subject: [PATCH 3/8] Remove dependency on standalone toolchains in Windows README --- android/Windows.md | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/android/Windows.md b/android/Windows.md index fdcdb47bc7b..fb95ff079f8 100644 --- a/android/Windows.md +++ b/android/Windows.md @@ -39,43 +39,6 @@ ninja matc resgen cmgen The build should succeed and a `ImportExecutables-Release.cmake` file should automatically be created at Filament's root directory. -## Toolchains - -Generate a toolchain for each Android architecture you're interested in building for. - -From Filament's root directory, run the NDK `make_standalone_toolchain.py` script for each -architecture. - -``` -python %ANDROID_HOME%\ndk-bundle\build\tools\make_standalone_toolchain.py ^ - --arch arm64 ^ - --api 21 ^ - --stl libc++ ^ - --force ^ - --install-dir "toolchains/Windows/aarch64-linux-android-4.9" - -python %ANDROID_HOME%\ndk-bundle\build\tools\make_standalone_toolchain.py ^ - --arch arm ^ - --api 21 ^ - --stl libc++ ^ - --force ^ - --install-dir "toolchains/Windows/arm-linux-android-4.9" - -python %ANDROID_HOME%\ndk-bundle\build\tools\make_standalone_toolchain.py ^ - --arch x86_64 ^ - --api 21 ^ - --stl libc++ ^ - --force ^ - --install-dir "toolchains/Windows/x86_64-linux-android-4.9" - -python %ANDROID_HOME%\ndk-bundle\build\tools\make_standalone_toolchain.py ^ - --arch x86 ^ - --api 21 ^ - --stl libc++ ^ - --force ^ - --install-dir "toolchains/Windows/x86-linux-android-4.9" -```` - ## Build 1. Create the build directories. From 13d2d0d262a3182c5d012b03e01ec5e7dd9cb3d5 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Mon, 25 Feb 2019 14:24:13 -0800 Subject: [PATCH 4/8] Use correct CMake path --- build/linux/ci-common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/linux/ci-common.sh b/build/linux/ci-common.sh index 83960a00cc9..68f787a6484 100755 --- a/build/linux/ci-common.sh +++ b/build/linux/ci-common.sh @@ -19,7 +19,7 @@ if [ "$KOKORO_BUILD_ID" ]; then 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 - sudo update-alternatives --install /usr/bin/cmake cmake `pwd`/cmake/bin/cmake 1 --force + sudo update-alternatives --install /usr/bin/cmake cmake `pwd`/bin/cmake 1 --force cd .. From b5fcd72b0ae7aba3e8ed0efd086e9726616e48d8 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Mon, 25 Feb 2019 14:28:31 -0800 Subject: [PATCH 5/8] Update NDK to latest --- build/linux/ci-common.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build/linux/ci-common.sh b/build/linux/ci-common.sh index 68f787a6484..85c1b6300e1 100755 --- a/build/linux/ci-common.sh +++ b/build/linux/ci-common.sh @@ -8,11 +8,15 @@ CXX_VERSION=7.0.0 CMAKE_VERSION=3.13.4 # Steps specific to our CI environment -# CI runs on Ubuntu 14.04, we need to install clang-6.0 and the +# 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 + # Update NDK + yes | $ANDROID_HOME/tools/bin/sdkmanager "ndk-bundle" + + # Install CMake mkdir -p cmake cd cmake @@ -23,6 +27,7 @@ if [ "$KOKORO_BUILD_ID" ]; then cd .. + # 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" From 8dd52780dc44ffc15c00e1a6fae5db63ad2cd6bb Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Mon, 25 Feb 2019 14:52:54 -0800 Subject: [PATCH 6/8] Only download CMake and NDK for Android builds --- build/android/build.sh | 2 ++ build/linux/ci-common.sh | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/build/android/build.sh b/build/android/build.sh index 921ce919339..21ddec475f9 100755 --- a/build/android/build.sh +++ b/build/android/build.sh @@ -14,6 +14,8 @@ set -x UNAME=`echo $(uname)` LC_UNAME=`echo $UNAME | tr '[:upper:]' '[:lower:]'` +FILAMENT_ANDROID_CI_BUILD=true + # build-common.sh will generate the following variables: # $GENERATE_ARCHIVES # $BUILD_DEBUG diff --git a/build/linux/ci-common.sh b/build/linux/ci-common.sh index 85c1b6300e1..d6e28ccdf9b 100755 --- a/build/linux/ci-common.sh +++ b/build/linux/ci-common.sh @@ -13,19 +13,21 @@ CMAKE_VERSION=3.13.4 if [ "$KOKORO_BUILD_ID" ]; then sudo ln -s /usr/include/x86_64-linux-gnu/asm /usr/include/asm - # Update NDK - yes | $ANDROID_HOME/tools/bin/sdkmanager "ndk-bundle" + if [ "$FILAMENT_ANDROID_CI_BUILD" ]; then + # Update NDK + yes | $ANDROID_HOME/tools/bin/sdkmanager "ndk-bundle" - # Install CMake - mkdir -p cmake - cd cmake + # 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 - sudo update-alternatives --install /usr/bin/cmake cmake `pwd`/bin/cmake 1 --force + 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 + sudo update-alternatives --install /usr/bin/cmake cmake `pwd`/bin/cmake 1 --force - cd .. + cd .. + fi # Install clang # This may or may not be needed... From 46d8c36d417cd4e7e9adb8d637fb2126b48e053e Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Mon, 25 Feb 2019 14:55:42 -0800 Subject: [PATCH 7/8] Add version constant for ninja --- build/linux/ci-common.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/linux/ci-common.sh b/build/linux/ci-common.sh index d6e28ccdf9b..2d45fafdee7 100755 --- a/build/linux/ci-common.sh +++ b/build/linux/ci-common.sh @@ -6,6 +6,8 @@ CLANG_VERSION=7 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 @@ -87,6 +89,6 @@ if [ "$KOKORO_BUILD_ID" ]; then export FILAMENT_REQUIRES_CXXABI=false fi -wget -q https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip +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" From 98f1fabacb5353dbf688d233e841f3bf1dedd8cb Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Mon, 25 Feb 2019 15:07:08 -0800 Subject: [PATCH 8/8] Make output more quiet --- build/linux/ci-common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/linux/ci-common.sh b/build/linux/ci-common.sh index 2d45fafdee7..e2f6a3b44dc 100755 --- a/build/linux/ci-common.sh +++ b/build/linux/ci-common.sh @@ -17,7 +17,7 @@ if [ "$KOKORO_BUILD_ID" ]; then if [ "$FILAMENT_ANDROID_CI_BUILD" ]; then # Update NDK - yes | $ANDROID_HOME/tools/bin/sdkmanager "ndk-bundle" + yes | $ANDROID_HOME/tools/bin/sdkmanager "ndk-bundle" > /dev/null # Install CMake mkdir -p cmake @@ -25,7 +25,7 @@ if [ "$KOKORO_BUILD_ID" ]; then 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 + 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 ..