#119 fix build of android native app example

This commit is contained in:
Vadim Lopatin 2016-04-20 09:55:02 +03:00
parent bdb483b45a
commit 83d691693e
9 changed files with 51 additions and 29 deletions

View File

@ -248,10 +248,10 @@ void* android_app_entry(void* param) {
pthread_mutex_unlock(&android_app.mutex);
//import core.runtime;
//rt_init();
import core.runtime;
rt_init();
android_main(android_app);
//rt_term();
rt_term();
android_app_destroy(android_app);
return null;

View File

@ -145,6 +145,17 @@ DLANGUI_IMPORT_PATHS="\
-J$DLANGUI_DIR/views/res/shaders \
"
DLANGUI_LDLIBS="\
-lgcc \
-llog \
-landroid \
-lEGL \
-lGLESv3 \
-lGLESv1_CM \
-lc \
-lm \
"
#echo "Import paths: $DLANGUI_IMPORT_PATHS"
#echo "Source paths: $DLANGUI_SOURCE_PATHS"

2
deps/DerelictGL3 vendored

@ -1 +1 @@
Subproject commit b77b9ca9351511296a59c53edc79092f84da4246
Subproject commit 769c5b6439d805cdcb29a9d1bcf4423bc513dd8b

2
deps/DerelictSDL2 vendored

@ -1 +1 @@
Subproject commit 174ad753193330e55cb18c3f9e8745e0eab3d418
Subproject commit 4f2e6ea479a0e48e2e62fe963922fd141a440adc

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- BEGIN_INCLUDE(manifest) -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.dlangui.native_activity"
package="org.dlangui.example"
android:versionCode="1"
android:versionName="1.0">

View File

@ -10,3 +10,5 @@ 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/local/java/jdk1.7.0_40
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/

View File

@ -2,6 +2,8 @@
# load settings for paths
. ./android_build_config.mk
echo ""
echo "===================================="
echo "DlangUI Build for Android native app"
echo "===================================="
echo "DLANGUI_DIR: $DLANGUI_DIR"
@ -15,9 +17,21 @@ echo "LDC: $LDC"
# application sources
. ./android_app.mk
warn () {
echo "$0:" "$@" >&2
}
die () {
rc=$1
shift
warn "$@"
exit $rc
}
#PLATFORM_DIR=arm
PLATFORM_DIR=armeabi-v7a
echo "\nLOCAL_MODULE: $LOCAL_MODULE"
#echo "DLANGUI SOURCES: $DLANGUI_SOURCES"
@ -33,21 +47,15 @@ OBJFILE="build/$PLATFORM_DIR/lib$LOCAL_MODULE.o"
LIBS="\
-L$NDK/platforms/android-19/arch-arm/usr/lib \
$LDC/lib/libphobos2-ldc.a $LDC/lib/libdruntime-ldc.a \
-lgcc \
-llog \
-landroid \
-lEGL \
-lGLESv3 \
-lGLESv1_CM \
-lc -lm \
$LDC/lib/libphobos2-ldc.a \
$LDC/lib/libdruntime-ldc.a \
$LOCAL_LDLIBS \
$DLANGUI_LDLIBS \
"
#-lGLESv1_CM \
LINK_OPTIONS="\
-Wl,-soname,libnative-activity.so \
-shared \
--sysroot=$NDK/platforms/android-19/arch-arm \
-gcc-toolchain $NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-$NDK_ARCH \
-no-canonical-prefixes \
@ -64,17 +72,21 @@ LINK_OPTIONS="\
mkdir -p libs/$PLATFORM_DIR/
mkdir -p build/$PLATFORM_DIR/
echo "\nCompiling $OBJFILE...\n"
#=========================================================
echo "\nCompiling $OBJFILE\n"
$LDC/bin/ldc2 $LDC_PARAMS $SOURCE_PATHS $SOURCES -c -singleobj -of=$OBJFILE || exit 1
$LDC/bin/ldc2 $LDC_PARAMS $SOURCE_PATHS $SOURCES -c -singleobj -of=$OBJFILE || die 2 "ldc2 build for $OBJFILE is failed"
echo "\n\nLinking $TARGET...\n"
#=========================================================
echo "\n\nLinking $TARGET\n"
$CC $OBJFILE $LIBS $LINK_OPTIONS -o $TARGET || exit 1
$CC $OBJFILE $LIBS $LINK_OPTIONS -o $TARGET || die 2 "$TARGET linking is failed"
echo "Library is linked ok\n"
echo "Building APK"
echo "Updating ant project..."
#=========================================================
$SDK/tools/android update project -p . -s --target 1 || die 3 "Android Project update is failed"
$SDK/tools/android update project -p . -s --target 1
ant debug
echo "Building APK..."
#=========================================================
ant debug || die 4 "Android APK creation is failed"
echo "Successful."

View File

@ -1,5 +1,4 @@
#!/bin/sh
export SDK=$HOME/android-sdk-linux
. ./android_build_config.mk
$SDK/platform-tools/adb install -r bin/NativeActivity-debug.apk

View File

@ -1,6 +1,4 @@
#!/bin/sh
export SDK=$HOME/android-sdk-linux
. ./android_build_config.mk
$SDK/platform-tools/adb logcat | less
#$SDK/platform-tools/adb logcat | grep "native"