Skip to content

Commit

Permalink
Add win32-aarch64 to build.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
tresf committed Nov 17, 2020
1 parent 36a70d0 commit cef2d76
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
8 changes: 7 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,8 @@ com/sun/jna/win32-x86/jnidispatch.dll;
processor=x86;osname=win,
com/sun/jna/win32-x86-64/jnidispatch.dll;
processor=x86-64;osname=win,
com/sun/jna/win32-aarch64/jnidispatch.dll;
processor=aarch64;osname=win,
com/sun/jna/w32ce-arm/jnidispatch.dll;
processor=arm;osname=wince,
Expand Down Expand Up @@ -627,6 +629,9 @@ osname=macosx;processor=x86;processor=x86-64;processor=ppc
<zipfileset src="${lib.native}/win32-x86-64.jar"
includes="*jnidispatch*"
prefix="com/sun/jna/win32-x86-64"/>
<zipfileset src="${lib.native}/win32-aarch64.jar"
includes="*jnidispatch*"
prefix="com/sun/jna/win32-aarch64"/>
<zipfileset src="${lib.native}/w32ce-arm.jar"
includes="*jnidispatch*"
prefix="com/sun/jna/w32ce-arm"/>
Expand Down Expand Up @@ -784,6 +789,7 @@ osname=macosx;processor=x86;processor=x86-64;processor=ppc
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/darwin.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/win32-x86.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/win32-x86-64.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/win32-aarch64.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/w32ce-arm.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/linux-x86.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/linux-x86-64.jar" overwrite="true"/>
Expand Down Expand Up @@ -876,7 +882,7 @@ osname=macosx;processor=x86;processor=x86-64;processor=ppc
<equals arg1="${os.prefix}" arg2="android-armv7"/>
</condition>
<condition property="ARCH" value="aarch64">
<equals arg1="${os.prefix}" arg2="android-aarch64"/>
<matches string="${os.prefix}" pattern="-aarch64$"/>
</condition>
<condition property="ARCH" value="x86">
<equals arg1="${os.prefix}" arg2="android-x86"/>
Expand Down
Binary file added lib/native/win32-aarch64.jar
Binary file not shown.
21 changes: 19 additions & 2 deletions native/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ WINDRES=$(MINGW_PREFIX)windres
MINGW=$(MINGW_PREFIX)gcc

ifeq ($(USE_MSVC),true)
ifeq ($(ARCH),aarch64)
# Force $(CC) fallback; avoid arch mismatch
WINDRES=false
# Disable mingw; no aarch64 support
MINGW=
endif
# MS compiler
CC=$(FFI_SRC)/msvcc.sh
CDEFINES+=-DHAVE_PROTECTION
Expand All @@ -246,8 +252,15 @@ LIBS=psapi.lib
ARSFX=.lib
ifeq ($(ARCH),amd64)
CC+= -m64
endif
FFI_CONFIG+= && rm -f include/ffitarget.h && cp $(FFI_SRC)/include/*.h $(FFI_SRC)/src/x86/ffitarget.h include
FFI_TARGET=$(FFI_SRC)/src/x86/ffitarget.h
else ifeq ($(ARCH),aarch64)
CC+= -marm64
FFI_CONFIG+=--host=aarch64-cygwin
# Disable ASMFN for aarch64, don't bulid dll-callback.o
DLLCB=$(BUILD)/callback.o
endif
FFI_TARGET?=$(FFI_SRC)/src/$(ARCH)/ffitarget.h
FFI_CONFIG+= && rm -f include/ffitarget.h && cp $(FFI_SRC)/include/*.h $(FFI_TARGET) include
FFI_ENV+=LD="$(LD)" CPP="$(CPP)" CXXCPP="$(CPP)"
EXTRAOBJS+=$(DLLCB)

Expand Down Expand Up @@ -452,6 +465,10 @@ install:
ifeq ($(ARCH), amd64)
$(DLLCB): dll-callback.c
$(MINGW) -DDEFINE_CALLBACKS -c $< $(COUT)
else ifeq ($(ARCH), aarch64)
# Build without ASMFN support
$(DLLCB): callback.c
$(CC) -DDEFINE_CALLBACKS -DASMFN_OFF $(CINCLUDES) $(CDEFINES) -c $< $(COUT)
endif

$(RSRC): $(BUILD)/jnidispatch.rc $(BUILD)/$(JNA_JNI_VERSION).stamp
Expand Down
2 changes: 1 addition & 1 deletion native/callback.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
extern "C" {
#endif

#if defined(_WIN32) && !defined(_WIN32_WCE)
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(ASMFN_OFF)
#include "com_sun_jna_win32_DLLCallback.h"
#ifdef _WIN64
#ifdef _MSC_VER
Expand Down
3 changes: 2 additions & 1 deletion src/com/sun/jna/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ else if (osName.equalsIgnoreCase("netbsd")) {
RO_FIELDS = osType != WINDOWSCE;
C_LIBRARY_NAME = osType == WINDOWS ? "msvcrt" : osType == WINDOWSCE ? "coredll" : "c";
MATH_LIBRARY_NAME = osType == WINDOWS ? "msvcrt" : osType == WINDOWSCE ? "coredll" : "m";
HAS_DLL_CALLBACKS = osType == WINDOWS;
ARCH = getCanonicalArchitecture(System.getProperty("os.arch"), osType);
// Windows aarch64 callbacks disabled via ASMFN_OFF (no mingw support)
HAS_DLL_CALLBACKS = osType == WINDOWS && !ARCH.startsWith("aarch");
RESOURCE_PREFIX = getNativeLibraryResourcePrefix();
}
private Platform() { }
Expand Down

0 comments on commit cef2d76

Please sign in to comment.