android fixes

This commit is contained in:
Vadim Lopatin 2016-04-19 16:27:52 +03:00
parent 7e230f3d02
commit bdb483b45a
7 changed files with 38 additions and 14 deletions

View File

@ -188,7 +188,7 @@ void app_dummy() {
}
extern(C) static void android_app_destroy(android_app* android_app) {
static void android_app_destroy(android_app* android_app) {
LOGV("android_app_destroy!");
free_saved_state(android_app);
pthread_mutex_lock(&android_app.mutex);
@ -202,7 +202,7 @@ extern(C) static void android_app_destroy(android_app* android_app) {
// Can't touch android_app object after this.
}
extern(C) static void process_input(android_app* app, android_poll_source* source) {
static void process_input(android_app* app, android_poll_source* source) {
AInputEvent* event = null;
while (AInputQueue_getEvent(app.inputQueue, &event) >= 0) {
LOGV("New input event: type=%d\n", AInputEvent_getType(event));
@ -215,14 +215,14 @@ extern(C) static void process_input(android_app* app, android_poll_source* sourc
}
}
extern(C) static void process_cmd(android_app* app, android_poll_source* source) {
static void process_cmd(android_app* app, android_poll_source* source) {
byte cmd = android_app_read_cmd(app);
android_app_pre_exec_cmd(app, cmd);
if (app.onAppCmd != null) app.onAppCmd(app, cmd);
android_app_post_exec_cmd(app, cmd);
}
extern(C) static void* android_app_entry(void* param) {
void* android_app_entry(void* param) {
android_app* android_app = cast(android_app*)param;
android_app.config = AConfiguration_new();
@ -247,7 +247,11 @@ extern(C) static void* android_app_entry(void* param) {
pthread_cond_broadcast(&android_app.cond);
pthread_mutex_unlock(&android_app.mutex);
//import core.runtime;
//rt_init();
android_main(android_app);
//rt_term();
android_app_destroy(android_app);
return null;

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="com.example.native_activity"
package="org.dlangui.native_activity"
android:versionCode="1"
android:versionName="1.0">
@ -20,7 +20,7 @@
android:configChanges="orientation|keyboardHidden">
<!-- Tell NativeActivity the name of or .so -->
<meta-data android:name="android.app.lib_name"
android:value="native-activity" />
android:value="dlangui-activity" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />

View File

@ -1,7 +1,7 @@
# List application source files here
# application library name ("app" -> libapp.so)
LOCAL_MODULE=native-activity
LOCAL_MODULE=dlangui-activity
# applicatino source files
LOCAL_SRC_FILES="\

View File

@ -15,6 +15,9 @@ echo "LDC: $LDC"
# application sources
. ./android_app.mk
#PLATFORM_DIR=arm
PLATFORM_DIR=armeabi-v7a
echo "\nLOCAL_MODULE: $LOCAL_MODULE"
#echo "DLANGUI SOURCES: $DLANGUI_SOURCES"
@ -25,20 +28,27 @@ export CC=$NDK/toolchains/llvm/prebuilt/linux-$NDK_ARCH/bin/clang
SOURCES="$LOCAL_SRC_FILES $DLANGUI_SOURCES"
SOURCE_PATHS="-I./jni $DLANGUI_SOURCE_PATHS $DLANGUI_IMPORT_PATHS"
TARGET="libs/armeabi-v7a/lib$LOCAL_MODULE.so"
OBJFILE="build/armeabi-v7a/lib$LOCAL_MODULE.o"
TARGET="libs/$PLATFORM_DIR/lib$LOCAL_MODULE.so"
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 \
-llog \
-landroid \
-lEGL \
-lGLESv3 \
-lGLESv1_CM \
-lc -lm \
$LOCAL_LDLIBS \
"
#-lGLESv1_CM \
LINK_OPTIONS="\
-Wl,-soname,libnative-activity.so \
--sysroot=$NDK/platforms/android-9/arch-arm \
--sysroot=$NDK/platforms/android-19/arch-arm \
-gcc-toolchain $NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-$NDK_ARCH \
-no-canonical-prefixes \
-target armv7-none-linux-androideabi \
@ -51,8 +61,8 @@ LINK_OPTIONS="\
-mthumb \
"
mkdir -p libs/armeabi-v7a/
mkdir -p build/armeabi-v7a/
mkdir -p libs/$PLATFORM_DIR/
mkdir -p build/$PLATFORM_DIR/
#=========================================================
echo "\nCompiling $OBJFILE\n"

View File

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

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">DlangUI Test</string>
</resources>

6
examples/android/watch_logs.sh Executable file
View File

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