My patch didn't work as-is. I guess I missed some place where I was
supposed to change int to long, but I don't see where yet. If anyone has an
idea let me know.

Here is the patch so far. Ignore the changes in cmake files.

On Wed, Aug 19, 2015 at 10:28 AM, Thomas Fjellstrom <[email protected]>
wrote:

> On Wed 19 Aug 2015 10:12:43 AM Trent Gamblin wrote:
> > Ug, never reply to the list with gna...
>
> I've just gotten into the habit of "reply to all" for other lists...
>
> > On 2015-08-19 10:11 AM, Trent Gamblin wrote:
> > > As long as it's verified to work, no harm in it.
> > >
> > > On 2015-08-19 12:36 AM, Jon Rafkind wrote:
> > >> Right now the android port won't build for the android x86_64 target
> > >> because pointers are passed around as int's. I think this can be
> > >> worked around by passing around 'jlong', which is guaranteed to be
> > >> 64-bits.
> > >>
> > >> The build will fail on x86_64 due to line 24 of android_input_stream.c
> > >>
> > >>   ALLEGRO_STATIC_ASSERT(android, sizeof(int) == sizeof(ALLEGRO_FILE
> *));
> > >>
> > >> The AllegroInputStream class currently accepts uses 'int' for the
> > >> handle, but could be changed to use 'long' (which corresponds to
> > >> jlong in the jni code). In this way, both 32-bit and 64-bit pointers
> > >> will be able to be stored in a handle.
> > >>
> > >> I can send a patch and/or just commit it if this sounds fine.
> >
> > _______________________________________________
> > Allegro-developers mailing list
> > [email protected]
> > https://mail.gna.org/listinfo/allegro-developers
>
> --
> Thomas Fjellstrom
> [email protected]
>
> _______________________________________________
> Allegro-developers mailing list
> [email protected]
> https://mail.gna.org/listinfo/allegro-developers
>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3ccdcb5..d28d2d1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -345,8 +345,8 @@ endif()
 if(ARCH_X86 AND WANT_ALLOW_SSE)
     if(COMPILER_GCC_OR_CLANG)
         message(STATUS "Allowing GCC/Clang to use SSE instructions")
-        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse")
-        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse")
+        #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse")
+        #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse")
     endif(COMPILER_GCC_OR_CLANG)
 
     # Flags for other compilers should be added here.
diff --git a/android/allegro_activity/src/AllegroInputStream.java b/android/allegro_activity/src/AllegroInputStream.java
index 0762e58..397077e 100644
--- a/android/allegro_activity/src/AllegroInputStream.java
+++ b/android/allegro_activity/src/AllegroInputStream.java
@@ -7,12 +7,12 @@ public class AllegroInputStream extends InputStream
 {
    private static final String TAG = "AllegroInputStream";
 
-   private int handle;
+   private long handle;
 
-   public native int nativeRead(int handle, byte[] buffer, int offset, int length);
-   public native void nativeClose(int handle);
+   public native int nativeRead(long handle, byte[] buffer, int offset, int length);
+   public native void nativeClose(long handle);
 
-   public AllegroInputStream(int handle)
+   public AllegroInputStream(long handle)
    {
       super();
       this.handle = handle;
diff --git a/cmake/Toolchain-android.cmake b/cmake/Toolchain-android.cmake
index 9d1b5ae..d9cefd8 100644
--- a/cmake/Toolchain-android.cmake
+++ b/cmake/Toolchain-android.cmake
@@ -30,13 +30,15 @@ find_program(CMAKE_MAKE_PROGRAM make)
 
 #setup build targets, mutually exclusive
 set(PossibleArmTargets
-  "x86;armeabi;armeabi-v7a;armeabi-v7a with NEON")
+  "x86;x86_64;armeabi;armeabi-v7a;armeabi-v7a with NEON")
 set(ARM_TARGETS "armeabi-v7a" CACHE STRING 
     "the arm targets for android, recommend armeabi-v7a 
     for floating point support and NEON.")
 
 if(ARM_TARGETS STREQUAL "x86")
     set(ANDROID_ARCH "i686-linux-android")
+elseif(ARM_TARGETS STREQUAL "x86_64")
+    set(ANDROID_ARCH "x86_64-linux-android")
 else()
     set(ANDROID_ARCH "arm-linux-androideabi")
 endif()
@@ -85,6 +87,11 @@ elseif(ARM_TARGETS STREQUAL "x86")
        CACHE PATH "path for android libs" FORCE)
   set(  CMAKE_INSTALL_PREFIX ${ANDROID_NDK_TOOLCHAIN_ROOT}/user/x86
       CACHE STRING "path for installing" FORCE)
+elseif(ARM_TARGETS STREQUAL "x86_64")
+  set( LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH_ROOT}/libs/x86_64
+       CACHE PATH "path for android libs" FORCE)
+  set(  CMAKE_INSTALL_PREFIX ${ANDROID_NDK_TOOLCHAIN_ROOT}/user/x86_64
+      CACHE STRING "path for installing" FORCE)
 else()
   if(ARM_TARGETS STREQUAL "armeabi-v7a with NEON")
     set(NEON true)
@@ -111,6 +118,9 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
 if(ARM_TARGETS STREQUAL "x86")
   SET(CMAKE_CXX_FLAGS "-DGL_GLEXT_PROTOTYPES -fPIC -DANDROID -Wno-psabi")
   SET(CMAKE_C_FLAGS "-DGL_GLEXT_PROTOTYPES -fPIC -DANDROID -Wno-psabi")
+elseif(ARM_TARGETS STREQUAL "x86_64")
+  SET(CMAKE_CXX_FLAGS "-DGL_GLEXT_PROTOTYPES -fPIC -DANDROID -Wno-psabi")
+  SET(CMAKE_C_FLAGS "-DGL_GLEXT_PROTOTYPES -fPIC -DANDROID -Wno-psabi")
 else()
   #Setup arm specific stuff
   #It is recommended to use the -mthumb compiler flag to force the generation
diff --git a/include/allegro5/internal/aintern_android.h b/include/allegro5/internal/aintern_android.h
index 945b39a..f17093f 100644
--- a/include/allegro5/internal/aintern_android.h
+++ b/include/allegro5/internal/aintern_android.h
@@ -193,9 +193,9 @@ extern JNI_FUNC(bool, AllegroSurface, nativeOnDestroy, (JNIEnv *env, jobject obj
 extern JNI_FUNC(void, AllegroSurface, nativeOnChange, (JNIEnv *env, jobject obj,
          jint format, jint width, jint height));
 extern JNI_FUNC(int, AllegroInputStream, nativeRead, (JNIEnv *env, jobject obj,
-         int handle, jbyteArray array, int offset, int length));
+         jlong handle, jbyteArray array, int offset, int length));
 extern JNI_FUNC(void, AllegroInputStream, nativeClose, (JNIEnv *env, jobject obj,
-         int handle));
+         jlong handle));
 extern JNI_FUNC(void, KeyListener, nativeOnKeyDown, (JNIEnv *env, jobject obj,
          jint scancode, jint unichar));
 extern JNI_FUNC(void, KeyListener, nativeOnKeyUp, (JNIEnv *env, jobject obj,
diff --git a/src/android/android_image.c b/src/android/android_image.c
index ce370f2..b0a46e9 100644
--- a/src/android/android_image.c
+++ b/src/android/android_image.c
@@ -139,7 +139,7 @@ ALLEGRO_BITMAP *_al_android_load_image_f(ALLEGRO_FILE *fh, int flags)
    input_stream_ctor = _jni_call(jnienv, jclass, GetMethodID,
        input_stream_class, "<init>", "(I)V");
    input_stream = _jni_call(jnienv, jobject, NewObject, input_stream_class,
-      input_stream_ctor, (jint)fh);
+      input_stream_ctor, (jlong)fh);
    if (!input_stream) {
       ALLEGRO_ERROR("failed to create new AllegroInputStream object");
       return NULL;
diff --git a/src/android/android_input_stream.c b/src/android/android_input_stream.c
index 9fec021..6a9f2a4 100644
--- a/src/android/android_input_stream.c
+++ b/src/android/android_input_stream.c
@@ -21,10 +21,10 @@
 ALLEGRO_DEBUG_CHANNEL("android")
 
 /* XXX ALLEGRO_FILE pointers currently passed as ints */
-ALLEGRO_STATIC_ASSERT(android, sizeof(int) == sizeof(ALLEGRO_FILE *));
+ALLEGRO_STATIC_ASSERT(android, sizeof(jlong) >= sizeof(ALLEGRO_FILE *));
 
 JNI_FUNC(int, AllegroInputStream, nativeRead, (JNIEnv *env, jobject obj,
-   int handle, jbyteArray array, int offset, int length))
+   jlong handle, jbyteArray array, int offset, int length))
 {
    ALLEGRO_FILE *fp = (ALLEGRO_FILE *)handle;
    int ret = -1;
@@ -32,7 +32,7 @@ JNI_FUNC(int, AllegroInputStream, nativeRead, (JNIEnv *env, jobject obj,
    ASSERT(fp != NULL);
 
    (void)obj;
-   ALLEGRO_DEBUG("nativeRead begin: handle:%i fp:%p offset:%i length:%i",
+   ALLEGRO_DEBUG("nativeRead begin: handle:%ll fp:%p offset:%i length:%i",
       handle, fp, offset, length);
 
    int array_len = _jni_call(env, int, GetArrayLength, array);
@@ -56,7 +56,7 @@ JNI_FUNC(int, AllegroInputStream, nativeRead, (JNIEnv *env, jobject obj,
 }
 
 JNI_FUNC(void, AllegroInputStream, nativeClose, (JNIEnv *env, jobject obj,
-   int handle))
+   jlong handle))
 {
    ALLEGRO_FILE *fp = (ALLEGRO_FILE *)handle;
    (void)env;
_______________________________________________
Allegro-developers mailing list
[email protected]
https://mail.gna.org/listinfo/allegro-developers

Reply via email to