android: Update toolchain build to handle single ABI
authorCody Northrop <cnorthrop@google.com>
Fri, 29 Sep 2017 21:34:45 +0000 (15:34 -0600)
committerCody Northrop <cnorthrop@google.com>
Fri, 29 Sep 2017 22:31:37 +0000 (16:31 -0600)
This reduces local arm32 toolchain build from 3m30s to 42s.

Also update Travis-CI config to use the new flag, greatly reducing
Android build time.

.travis.yml
build-android/update_external_sources_android.sh

index 7249da1..a95ea05 100644 (file)
@@ -54,7 +54,7 @@ script:
   - if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then cmake -H. -Bdbuild -DCMAKE_BUILD_TYPE=Debug; fi
   - if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then make -C dbuild; fi
   - if [[ "$VULKAN_BUILD_TARGET" == "ANDROID" ]]; then pushd build-android; fi
-  - if [[ "$VULKAN_BUILD_TARGET" == "ANDROID" ]]; then ./update_external_sources_android.sh; fi
+  - if [[ "$VULKAN_BUILD_TARGET" == "ANDROID" ]]; then ./update_external_sources_android.sh --abi $ANDROID_ABI; fi
   - if [[ "$VULKAN_BUILD_TARGET" == "ANDROID" ]]; then ./android-generate.sh; fi
   - if [[ "$VULKAN_BUILD_TARGET" == "ANDROID" ]]; then ndk-build APP_ABI=$ANDROID_ABI; fi
   - if [[ "$VULKAN_BUILD_TARGET" == "ANDROID" ]]; then popd; fi
index b1ee742..be1b410 100755 (executable)
@@ -48,6 +48,50 @@ elif [[ $(uname) == "Darwin" ]]; then
     cores=$(sysctl -n hw.ncpu)
 fi
 
+#
+# Parse parameters
+#
+
+function printUsage {
+   echo "Supported parameters are:"
+   echo "    --abi <abi> (optional)"
+   echo
+   echo "i.e. ${0##*/} --abi arm64-v8a \\"
+   exit 1
+}
+
+if [[ $(($# % 2)) -ne 0 ]]
+then
+    echo Parameters must be provided in pairs.
+    echo parameter count = $#
+    echo
+    printUsage
+    exit 1
+fi
+
+while [[ $# -gt 0 ]]
+do
+    case $1 in
+        --abi)
+            abi="$2"
+            shift 2
+            ;;
+        *)
+            # unknown option
+            echo Unknown option: $1
+            echo
+            printUsage
+            exit 1
+            ;;
+    esac
+done
+
+echo abi=$abi
+if [[ -z $abi ]]
+then
+    echo No abi provided, so building for all supported abis.
+fi
+
 function create_glslang () {
    rm -rf $BASEDIR/glslang
    echo "Creating local glslang repository ($BASEDIR/glslang)."
@@ -135,7 +179,11 @@ function update_shaderc () {
 function build_shaderc () {
    echo "Building $BASEDIR/shaderc"
    cd $BASEDIR/shaderc/android_test
-   ndk-build THIRD_PARTY_PATH=../.. -j $cores
+   if [[ $abi ]]; then
+      ndk-build THIRD_PARTY_PATH=../.. APP_ABI=$abi -j $cores;
+   else
+      ndk-build THIRD_PARTY_PATH=../.. -j $cores;
+   fi
 }
 
 if [ ! -d "$BASEDIR/glslang" -o ! -d "$BASEDIR/glslang/.git" -o -d "$BASEDIR/glslang/.svn" ]; then