diff --git a/examples/dminer/android_project/AndroidManifest.xml b/examples/dminer/android_project/AndroidManifest.xml new file mode 100644 index 00000000..480fea61 --- /dev/null +++ b/examples/dminer/android_project/AndroidManifest.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/dminer/android_project/README.md b/examples/dminer/android_project/README.md new file mode 100644 index 00000000..cedc99c5 --- /dev/null +++ b/examples/dminer/android_project/README.md @@ -0,0 +1,19 @@ +This is template for DlangUI Android project. +============================================ + +Copy this directory to some DlangUI project's directory to allow Android builds. + + +Modify android_app.mk, android_build_config.mk + +android_app.mk +============== + +Update LOCAL_SRC_FILES to include all your project's files. + + +android_build_config.mk +======================= + +Update paths to Android NDK, SDK, DlangUI source directory. + diff --git a/examples/dminer/android_project/android_app.mk b/examples/dminer/android_project/android_app.mk new file mode 100644 index 00000000..f4f02095 --- /dev/null +++ b/examples/dminer/android_project/android_app.mk @@ -0,0 +1,26 @@ +# List application source files here + +# application library name ("app" -> libapp.so) +LOCAL_MODULE=dlangui-activity + +# applicatino source files: put list of your source files here +LOCAL_SRC_FILES="\ +../src/minermain.d \ +../src/dminer/core/minetypes.d \ +../src/dminer/core/blocks.d \ +../src/dminer/core/generators.d \ +../src/dminer/core/world.d \ +../src/dminer/core/terrain.d \ +../src/dminer/core/chunk.d \ +-J../views \ +-J../views/res \ +-J../views/res/mdpi \ +-J../views/res/i18n \ +-release -enable-inlining -O3 \ +" + +# Additional libraries to link +LOCAL_LDLIBS="" + +# Android SDK target +ANDROID_TARGET="android-19" diff --git a/examples/dminer/android_project/android_build_config.mk b/examples/dminer/android_project/android_build_config.mk new file mode 100644 index 00000000..d44305f1 --- /dev/null +++ b/examples/dminer/android_project/android_build_config.mk @@ -0,0 +1,11 @@ +#!/bin/sh + +#========================================================================= +# Modify this file to specify DLANGUI, Android NDK, SDK and LDC2 locations. + +export DLANGUI_DIR=$HOME/src/d/dlangui +export NDK=$HOME/android-ndk-r11c +export SDK=$HOME/android-sdk-linux +export LDC=$HOME/ldc2-android-arm-0.17.0-alpha2-linux-x86_64 +export NDK_ARCH=x86_64 +export JAVA_HOME=/usr/lib/jvm/java-8-oracle/ diff --git a/examples/dminer/android_project/build_apk.sh b/examples/dminer/android_project/build_apk.sh new file mode 100755 index 00000000..df6f2b8c --- /dev/null +++ b/examples/dminer/android_project/build_apk.sh @@ -0,0 +1,42 @@ +#!/bin/sh +# load settings for paths +. ./android_build_config.mk + +echo "" +echo "====================================" +echo "DlangUI Build for Android native app" +echo "====================================" +echo "DLANGUI_DIR: $DLANGUI_DIR" +echo "NDK: $NDK" +echo "SDK: $SDK" +echo "LDC: $LDC" + +# dlangui sources +. $DLANGUI_DIR/android/dlangui_source_files.mk + +# local application sources +. ./android_app.mk + +warn () { + echo "$0:" "$@" >&2 +} +die () { + rc=$1 + shift + warn "$@" + exit $rc +} + +# LDC2 arm build +. $DLANGUI_DIR/android/android_ldc_armv7a.mk + + +echo "Updating ant project..." +#========================================================= +$SDK/tools/android update project -p . -s --target $ANDROID_TARGET || die 3 "Android Project update is failed" + +echo "Building APK..." +#========================================================= +ant debug || die 4 "Android APK creation is failed" + +echo "Successful." diff --git a/examples/dminer/android_project/deploy_apk.sh b/examples/dminer/android_project/deploy_apk.sh new file mode 100755 index 00000000..15c9183e --- /dev/null +++ b/examples/dminer/android_project/deploy_apk.sh @@ -0,0 +1,4 @@ +#!/bin/sh +. ./android_build_config.mk + +$SDK/platform-tools/adb install -r bin/NativeActivity-debug.apk diff --git a/examples/dminer/android_project/res/values/strings.xml b/examples/dminer/android_project/res/values/strings.xml new file mode 100644 index 00000000..365f83a0 --- /dev/null +++ b/examples/dminer/android_project/res/values/strings.xml @@ -0,0 +1,4 @@ + + + DlangUI Miner + diff --git a/examples/dminer/android_project/watch_logs.sh b/examples/dminer/android_project/watch_logs.sh new file mode 100755 index 00000000..7ad96032 --- /dev/null +++ b/examples/dminer/android_project/watch_logs.sh @@ -0,0 +1,4 @@ +#!/bin/sh +. ./android_build_config.mk + +$SDK/platform-tools/adb logcat | less