mirror of https://github.com/buggins/dlangui.git
#119 fix build of android native app example
This commit is contained in:
parent
bdb483b45a
commit
83d691693e
|
@ -248,10 +248,10 @@ void* android_app_entry(void* param) {
|
||||||
pthread_mutex_unlock(&android_app.mutex);
|
pthread_mutex_unlock(&android_app.mutex);
|
||||||
|
|
||||||
|
|
||||||
//import core.runtime;
|
import core.runtime;
|
||||||
//rt_init();
|
rt_init();
|
||||||
android_main(android_app);
|
android_main(android_app);
|
||||||
//rt_term();
|
rt_term();
|
||||||
|
|
||||||
android_app_destroy(android_app);
|
android_app_destroy(android_app);
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -145,6 +145,17 @@ DLANGUI_IMPORT_PATHS="\
|
||||||
-J$DLANGUI_DIR/views/res/shaders \
|
-J$DLANGUI_DIR/views/res/shaders \
|
||||||
"
|
"
|
||||||
|
|
||||||
|
DLANGUI_LDLIBS="\
|
||||||
|
-lgcc \
|
||||||
|
-llog \
|
||||||
|
-landroid \
|
||||||
|
-lEGL \
|
||||||
|
-lGLESv3 \
|
||||||
|
-lGLESv1_CM \
|
||||||
|
-lc \
|
||||||
|
-lm \
|
||||||
|
"
|
||||||
|
|
||||||
#echo "Import paths: $DLANGUI_IMPORT_PATHS"
|
#echo "Import paths: $DLANGUI_IMPORT_PATHS"
|
||||||
#echo "Source paths: $DLANGUI_SOURCE_PATHS"
|
#echo "Source paths: $DLANGUI_SOURCE_PATHS"
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit b77b9ca9351511296a59c53edc79092f84da4246
|
Subproject commit 769c5b6439d805cdcb29a9d1bcf4423bc513dd8b
|
|
@ -1 +1 @@
|
||||||
Subproject commit 174ad753193330e55cb18c3f9e8745e0eab3d418
|
Subproject commit 4f2e6ea479a0e48e2e62fe963922fd141a440adc
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- BEGIN_INCLUDE(manifest) -->
|
<!-- BEGIN_INCLUDE(manifest) -->
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.dlangui.native_activity"
|
package="org.dlangui.example"
|
||||||
android:versionCode="1"
|
android:versionCode="1"
|
||||||
android:versionName="1.0">
|
android:versionName="1.0">
|
||||||
|
|
||||||
|
|
|
@ -10,3 +10,5 @@ export NDK=$HOME/android-ndk-r11c
|
||||||
export SDK=$HOME/android-sdk-linux
|
export SDK=$HOME/android-sdk-linux
|
||||||
export LDC=$HOME/ldc2-android-arm-0.17.0-alpha2-linux-x86_64
|
export LDC=$HOME/ldc2-android-arm-0.17.0-alpha2-linux-x86_64
|
||||||
export NDK_ARCH=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/
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
# load settings for paths
|
# load settings for paths
|
||||||
. ./android_build_config.mk
|
. ./android_build_config.mk
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "===================================="
|
||||||
echo "DlangUI Build for Android native app"
|
echo "DlangUI Build for Android native app"
|
||||||
echo "===================================="
|
echo "===================================="
|
||||||
echo "DLANGUI_DIR: $DLANGUI_DIR"
|
echo "DLANGUI_DIR: $DLANGUI_DIR"
|
||||||
|
@ -15,9 +17,21 @@ echo "LDC: $LDC"
|
||||||
# application sources
|
# application sources
|
||||||
. ./android_app.mk
|
. ./android_app.mk
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$0:" "$@" >&2
|
||||||
|
}
|
||||||
|
die () {
|
||||||
|
rc=$1
|
||||||
|
shift
|
||||||
|
warn "$@"
|
||||||
|
exit $rc
|
||||||
|
}
|
||||||
|
|
||||||
#PLATFORM_DIR=arm
|
#PLATFORM_DIR=arm
|
||||||
PLATFORM_DIR=armeabi-v7a
|
PLATFORM_DIR=armeabi-v7a
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo "\nLOCAL_MODULE: $LOCAL_MODULE"
|
echo "\nLOCAL_MODULE: $LOCAL_MODULE"
|
||||||
#echo "DLANGUI SOURCES: $DLANGUI_SOURCES"
|
#echo "DLANGUI SOURCES: $DLANGUI_SOURCES"
|
||||||
|
|
||||||
|
@ -33,21 +47,15 @@ OBJFILE="build/$PLATFORM_DIR/lib$LOCAL_MODULE.o"
|
||||||
|
|
||||||
LIBS="\
|
LIBS="\
|
||||||
-L$NDK/platforms/android-19/arch-arm/usr/lib \
|
-L$NDK/platforms/android-19/arch-arm/usr/lib \
|
||||||
$LDC/lib/libphobos2-ldc.a $LDC/lib/libdruntime-ldc.a \
|
$LDC/lib/libphobos2-ldc.a \
|
||||||
-lgcc \
|
$LDC/lib/libdruntime-ldc.a \
|
||||||
-llog \
|
|
||||||
-landroid \
|
|
||||||
-lEGL \
|
|
||||||
-lGLESv3 \
|
|
||||||
-lGLESv1_CM \
|
|
||||||
-lc -lm \
|
|
||||||
$LOCAL_LDLIBS \
|
$LOCAL_LDLIBS \
|
||||||
|
$DLANGUI_LDLIBS \
|
||||||
"
|
"
|
||||||
|
|
||||||
#-lGLESv1_CM \
|
|
||||||
|
|
||||||
LINK_OPTIONS="\
|
LINK_OPTIONS="\
|
||||||
-Wl,-soname,libnative-activity.so \
|
-Wl,-soname,libnative-activity.so \
|
||||||
|
-shared \
|
||||||
--sysroot=$NDK/platforms/android-19/arch-arm \
|
--sysroot=$NDK/platforms/android-19/arch-arm \
|
||||||
-gcc-toolchain $NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-$NDK_ARCH \
|
-gcc-toolchain $NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-$NDK_ARCH \
|
||||||
-no-canonical-prefixes \
|
-no-canonical-prefixes \
|
||||||
|
@ -64,17 +72,21 @@ LINK_OPTIONS="\
|
||||||
mkdir -p libs/$PLATFORM_DIR/
|
mkdir -p libs/$PLATFORM_DIR/
|
||||||
mkdir -p build/$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 || die 2 "ldc2 build for $OBJFILE is failed"
|
||||||
$LDC/bin/ldc2 $LDC_PARAMS $SOURCE_PATHS $SOURCES -c -singleobj -of=$OBJFILE || exit 1
|
|
||||||
|
|
||||||
|
echo "\n\nLinking $TARGET...\n"
|
||||||
#=========================================================
|
#=========================================================
|
||||||
echo "\n\nLinking $TARGET\n"
|
$CC $OBJFILE $LIBS $LINK_OPTIONS -o $TARGET || die 2 "$TARGET linking is failed"
|
||||||
$CC $OBJFILE $LIBS $LINK_OPTIONS -o $TARGET || exit 1
|
|
||||||
|
|
||||||
echo "Library is linked ok\n"
|
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
|
echo "Building APK..."
|
||||||
ant debug
|
#=========================================================
|
||||||
|
ant debug || die 4 "Android APK creation is failed"
|
||||||
|
|
||||||
|
echo "Successful."
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
export SDK=$HOME/android-sdk-linux
|
. ./android_build_config.mk
|
||||||
|
|
||||||
$SDK/platform-tools/adb install -r bin/NativeActivity-debug.apk
|
$SDK/platform-tools/adb install -r bin/NativeActivity-debug.apk
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
export SDK=$HOME/android-sdk-linux
|
. ./android_build_config.mk
|
||||||
|
|
||||||
$SDK/platform-tools/adb logcat | less
|
$SDK/platform-tools/adb logcat | less
|
||||||
#$SDK/platform-tools/adb logcat | grep "native"
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue