From 0c28c2aad6bfebf436c13a06db70413166d15d6d Mon Sep 17 00:00:00 2001
From: Robin Watts <robin.watts@artifex.com>
Date: Tue, 15 Nov 2016 17:41:15 +0000
Subject: Update JNI code to load 32 or 64 bit DLL as appropriate.

Make the JNI code detect whether it is running on a 32 or
64 bit machine, and change the name of the DLL appropriately.

Update Android Makefile to make mupdf_java32 instead of mupdf_java.

Update Java Makefile to make mupdf_java32 or mupdf_java64 based
on the system it is running on. This choice can be overruled by
defining BITS to be "32" or "64" before calling make.

Update Windows Solution to make mupdf_java32 or mupdf_java64 as
appropriate.
---
 platform/android/example/Readme.txt                              | 4 ++--
 platform/android/viewer/jni/Android.mk                           | 2 +-
 platform/android/viewer/jni/mupdf.c                              | 4 ++--
 platform/android/viewer/src/com/artifex/mupdfdemo/MuPDFCore.java | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

(limited to 'platform/android')

diff --git a/platform/android/example/Readme.txt b/platform/android/example/Readme.txt
index e87baf8a..7138ddcf 100644
--- a/platform/android/example/Readme.txt
+++ b/platform/android/example/Readme.txt
@@ -11,11 +11,11 @@ mupdf/platform/android/example - build instructions
 4.  copy the resulting .so file:
 
 	mkdir -p ../example/mupdf/libs/armeabi-v7a
-	rm -f ../example/mupdf/libs/armeabi-v7a/libmupdf_java.so
+	rm -f ../example/mupdf/libs/armeabi-v7a/libmupdf_java32.so
 	cp ./libs/armeabi-v7a/libmupdf_java.so ../example/mupdf/libs/armeabi-v7a/
 
 5.  Open the example in Android Studio
 
 6.  build and run
 
-If you modify C code, do steps 3, 4 and 6 as needed
\ No newline at end of file
+If you modify C code, do steps 3, 4 and 6 as needed
diff --git a/platform/android/viewer/jni/Android.mk b/platform/android/viewer/jni/Android.mk
index 27f481a8..4e6038d4 100644
--- a/platform/android/viewer/jni/Android.mk
+++ b/platform/android/viewer/jni/Android.mk
@@ -19,7 +19,7 @@ LOCAL_C_INCLUDES := \
 	$(MUPDF_ROOT)/source/pdf \
 	$(MUPDF_ROOT)/platform/java
 LOCAL_CFLAGS := -DHAVE_ANDROID
-LOCAL_MODULE := mupdf_java
+LOCAL_MODULE := mupdf_java32
 
 LOCAL_SRC_FILES := \
 	mupdf.c \
diff --git a/platform/android/viewer/jni/mupdf.c b/platform/android/viewer/jni/mupdf.c
index 701390a6..581da497 100644
--- a/platform/android/viewer/jni/mupdf.c
+++ b/platform/android/viewer/jni/mupdf.c
@@ -290,7 +290,7 @@ JNI_FN(MuPDFCore_openFile)(JNIEnv * env, jobject thiz, jstring jfilename)
 	jclass clazz;
 
 #ifdef NDK_PROFILER
-	monstartup("libmupdf_java.so");
+	monstartup("libmupdf_java32.so");
 #endif
 
 	clazz = (*env)->GetObjectClass(env, thiz);
@@ -441,7 +441,7 @@ JNI_FN(MuPDFCore_openBuffer)(JNIEnv * env, jobject thiz, jstring jmagic)
 	const char *magic;
 
 #ifdef NDK_PROFILER
-	monstartup("libmupdf_java.so");
+	monstartup("libmupdf_java32.so");
 #endif
 
 	clazz = (*env)->GetObjectClass(env, thiz);
diff --git a/platform/android/viewer/src/com/artifex/mupdfdemo/MuPDFCore.java b/platform/android/viewer/src/com/artifex/mupdfdemo/MuPDFCore.java
index 9d5f3818..6c105e0d 100644
--- a/platform/android/viewer/src/com/artifex/mupdfdemo/MuPDFCore.java
+++ b/platform/android/viewer/src/com/artifex/mupdfdemo/MuPDFCore.java
@@ -12,7 +12,7 @@ public class MuPDFCore
 	private static boolean gs_so_available = false;
 	static {
 		System.out.println("Loading dll");
-		System.loadLibrary("mupdf_java");
+		System.loadLibrary("mupdf_java32");
 		System.out.println("Loaded dll");
 		if (gprfSupportedInternal())
 		{
-- 
cgit v1.2.3