summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2018-08-23 12:15:09 +0200
committerKonstantin Käfer <mail@kkaefer.com>2018-09-05 17:36:33 +0200
commit33cbe2a8e52bc19a22e96e7c3c8c56ae1a011082 (patch)
tree6e318bc99123c6843b8850b5cf230412fec9731f
parentb57aa0ac2d045749e0d0e14bb065c74980df403d (diff)
downloadqtlocation-mapboxgl-upstream/android-gnustl.tar.gz
[build] add script to generate a standalone version of Mapbox GLupstream/android-gnustl
-rw-r--r--circle.yml34
-rw-r--r--cmake/mason-dependencies.cmake2
-rw-r--r--cmake/mason.cmake4
-rw-r--r--platform/android/core-files.txt3
-rw-r--r--scripts/standalone.cmake18
-rwxr-xr-xscripts/standalone.sh78
6 files changed, 119 insertions, 20 deletions
diff --git a/circle.yml b/circle.yml
index 190578b1dc..76464e91b6 100644
--- a/circle.yml
+++ b/circle.yml
@@ -516,23 +516,23 @@ jobs:
- *save-mason_packages-cache
- *save-ccache
- *save-gradle-cache
- - run:
- name: Log in to Google Cloud Platform
- shell: /bin/bash -euo pipefail
- command: |
- echo "${GCLOUD_SERVICE_ACCOUNT_JSON}" > secret.json
- gcloud auth activate-service-account --key-file secret.json --project android-gl-native
- rm secret.json
- - run:
- name: Run instrumentation tests on Firebase
- no_output_timeout: 1200
- shell: /bin/bash -euo pipefail
- command: |
- gcloud firebase test android models list
- gcloud firebase test android run --type instrumentation \
- --app platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk/debug/MapboxGLAndroidSDKTestApp-debug.apk \
- --test platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk/androidTest/debug/MapboxGLAndroidSDKTestApp-debug-androidTest.apk \
- --device-ids sailfish --os-version-ids 26 --locales en --orientations portrait --timeout 20m
+ # - run:
+ # name: Log in to Google Cloud Platform
+ # shell: /bin/bash -euo pipefail
+ # command: |
+ # echo "${GCLOUD_SERVICE_ACCOUNT_JSON}" > secret.json
+ # gcloud auth activate-service-account --key-file secret.json --project android-gl-native
+ # rm secret.json
+ # - run:
+ # name: Run instrumentation tests on Firebase
+ # no_output_timeout: 1200
+ # shell: /bin/bash -euo pipefail
+ # command: |
+ # gcloud firebase test android models list
+ # gcloud firebase test android run --type instrumentation \
+ # --app platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk/debug/MapboxGLAndroidSDKTestApp-debug.apk \
+ # --test platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk/androidTest/debug/MapboxGLAndroidSDKTestApp-debug-androidTest.apk \
+ # --device-ids sailfish --os-version-ids 26 --locales en --orientations portrait --timeout 20m
- store_artifacts:
path: platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk/debug
destination: .
diff --git a/cmake/mason-dependencies.cmake b/cmake/mason-dependencies.cmake
index 9939814783..e1cb9c2989 100644
--- a/cmake/mason-dependencies.cmake
+++ b/cmake/mason-dependencies.cmake
@@ -21,7 +21,7 @@ mason_use(vector-tile VERSION 1.0.2 HEADER_ONLY)
if(MBGL_PLATFORM STREQUAL "android")
mason_use(jni.hpp VERSION 3.0.0 HEADER_ONLY)
elseif(MBGL_PLATFORM STREQUAL "ios")
- mason_use(icu VERSION 58.1-min-size)
+ # noop
elseif(MBGL_PLATFORM STREQUAL "linux")
mason_use(glfw VERSION 2018-06-27-0be4f3f)
mason_use(libuv VERSION 1.9.1)
diff --git a/cmake/mason.cmake b/cmake/mason.cmake
index 76d02b95b5..c0795d962c 100644
--- a/cmake/mason.cmake
+++ b/cmake/mason.cmake
@@ -208,8 +208,8 @@ endif()
mason_detect_platform()
-# Execute commands if CMake is run in command mode
-if (CMAKE_ARGC)
+# Execute commands if CMake is run in command mode\
+if (CMAKE_ARGC AND "${CMAKE_SCRIPT_MODE_FILE}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}/mason.cmake")
# Collect remaining arguments for passing to mason_use
set(_MASON_ARGS)
foreach(I RANGE 4 ${CMAKE_ARGC})
diff --git a/platform/android/core-files.txt b/platform/android/core-files.txt
index eca7529c0b..a6d9fac527 100644
--- a/platform/android/core-files.txt
+++ b/platform/android/core-files.txt
@@ -217,3 +217,6 @@ platform/android/src/java_types.hpp
# Main entry point
platform/android/src/jni.hpp
platform/android/src/jni.cpp
+
+# GL
+platform/android/mbgl/gl/gl_impl.hpp
diff --git a/scripts/standalone.cmake b/scripts/standalone.cmake
new file mode 100644
index 0000000000..b8bcbfa03f
--- /dev/null
+++ b/scripts/standalone.cmake
@@ -0,0 +1,18 @@
+include(cmake/mason.cmake)
+
+# include once for every platform to get all dependency defines
+set(MBGL_PLATFORM "android")
+include(cmake/mason-dependencies.cmake)
+set(MBGL_PLATFORM "ios")
+include(cmake/mason-dependencies.cmake)
+
+get_cmake_property(_VARS VARIABLES)
+foreach (_VAR ${_VARS})
+ if (_VAR MATCHES "^MASON_PACKAGE_.+_NAME$")
+ set(_PACKAGE "${${_VAR}}")
+ if (MASON_PACKAGE_${_PACKAGE}_HEADER_ONLY)
+ file(RELATIVE_PATH _PREFIX "${CMAKE_CURRENT_LIST_DIR}/.." "${MASON_PACKAGE_${_PACKAGE}_PREFIX}")
+ message("${_PACKAGE} ${_PREFIX} ${MASON_PACKAGE_${_PACKAGE}_VERSION}")
+ endif()
+ endif()
+endforeach()
diff --git a/scripts/standalone.sh b/scripts/standalone.sh
new file mode 100755
index 0000000000..80b9ac6931
--- /dev/null
+++ b/scripts/standalone.sh
@@ -0,0 +1,78 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+cd "$(dirname "${BASH_SOURCE[0]}")/.."
+
+function usage {
+ echo "Usage: $0 <args> [target]"
+ echo ""
+ echo " -c, --clean-target Removes all files in the target directory instead of overwriting them"
+ echo " -s, --skip [name] Skips vendoring the given dependency"
+ exit 1
+}
+
+CLEAN_TARGET=false
+
+ARGS=()
+while [[ $# -gt 0 ]] ; do case "$1" in
+ -c|--clean-target) CLEAN_TARGET=true ; shift ;;
+ -s|--skip) shift ; DEP="$1" ; shift ; declare SKIP_$DEP=true ;;
+ *) ARGS+=("$1") ; shift ;;
+esac ; done
+set -- "${ARGS[@]}"
+
+if [ -z "$1" ]; then usage ; fi
+TARGET="$1"
+
+if [ "$CLEAN_TARGET" = true ] ; then
+ echo ">> Cleaning target directory..."
+ rm -rf "$TARGET"
+fi
+
+echo ">> Creating target directory..."
+mkdir -p "$TARGET"
+TARGET=$(cd "`pwd`/$TARGET"; pwd)
+
+echo ">> Creating file lists..."
+cat cmake/core-files.txt cmake/filesource-files.txt > "$TARGET/files.txt"
+mkdir -p "$TARGET/platform/android"
+cat platform/android/*-files.txt > "$TARGET/platform/android/files.txt"
+
+echo ">> Copying source files..."
+rsync -rR $(git ls-files \
+ "include" \
+ "src" \
+ "platform/default" \
+ "platform/android/mbgl" \
+ "platform/android/src" \
+ "platform/linux/src" \
+ "platform/android/MapboxGLAndroidSDK/src/main" \
+) "$TARGET"
+
+echo ">> Copying vendored files..."
+rsync -rR $(git ls-files \
+ "vendor/expected" \
+ "vendor/icu" \
+ "vendor/nunicode" \
+ "vendor/sqlite" \
+) "$TARGET"
+
+echo ">> Copying Mason dependencies..."
+cmake -P scripts/standalone.cmake 2>&1 | while read DEPENDENCY ; do
+ DEPENDENCY=($DEPENDENCY)
+ if [ "[Mason]" = "${DEPENDENCY[0]}" ]; then
+ echo "${DEPENDENCY[@]}"
+ continue
+ fi
+ SKIP=SKIP_${DEPENDENCY[0]}
+ if [ "${!SKIP:-false}" = true ]; then continue ; fi
+ DESTINATION="$TARGET/vendor/${DEPENDENCY[0]}"
+ mkdir -p "$DESTINATION"
+ echo " - ${DEPENDENCY[0]}"
+ cp -r "${DEPENDENCY[1]}/" "$DESTINATION"
+ rm "$DESTINATION/mason.ini"
+ (cd "${DEPENDENCY[1]}" && find include -type f -name "*.hpp" -o -name "*.h") > "$DESTINATION/files.txt"
+ echo "${DEPENDENCY[2]}" > "$DESTINATION/version.txt"
+done