Skip to content

Add support for Windows on Arm64 (WoA) build #413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions bundles/org.eclipse.swt/.classpath_win32_aarch64
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="src" path="Eclipse SWT/win32"/>
<classpathentry kind="src" path="Eclipse SWT/common"/>
<classpathentry kind="src" path="Eclipse SWT PI/common"/>
<classpathentry kind="src" path="Eclipse SWT PI/win32">
<attributes>
<attribute value="org.eclipse.swt.win32.win32.aarch64" name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="Eclipse SWT OLE Win32/win32"/>
<classpathentry kind="src" path="Eclipse SWT Accessibility/win32"/>
<classpathentry kind="src" path="Eclipse SWT Accessibility/common"/>
<classpathentry kind="src" path="Eclipse SWT AWT/win32"/>
<classpathentry kind="src" path="Eclipse SWT AWT/common"/>
<classpathentry kind="src" path="Eclipse SWT Drag and Drop/win32"/>
<classpathentry kind="src" path="Eclipse SWT Drag and Drop/common"/>
<classpathentry kind="src" path="Eclipse SWT Printing/win32"/>
<classpathentry kind="src" path="Eclipse SWT Printing/common"/>
<classpathentry kind="src" path="Eclipse SWT Program/win32"/>
<classpathentry kind="src" path="Eclipse SWT Program/common"/>
<classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/>
<classpathentry kind="src" path="Eclipse SWT Browser/common"/>
<classpathentry kind="src" path="Eclipse SWT Browser/win32"/>
<classpathentry kind="src" path="Eclipse SWT OpenGL/win32"/>
<classpathentry kind="src" path="Eclipse SWT OpenGL/common"/>
<classpathentry kind="output" path="bin"/>
</classpath>
26 changes: 15 additions & 11 deletions bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@rem ***************************************************************************

@rem The original build.bat source is located in /org.eclipse.swt/Eclipse SWT PI/win32/library/build.bat. It is copied during various build(s).
@rem Typically it's not ran directly, instead it is reached by build.xml's build_libraries target found in eclipse.platform.swt.binaries\bundles\org.eclipse.swt.win32.win32.x86*
@rem Typically it's not run directly, instead it is reached by build.xml's build_libraries target found in eclipse.platform.swt.binaries\bundles\org.eclipse.swt.win32.win32.*

@echo off
echo
Expand All @@ -36,7 +36,7 @@ IF "%MSVC_HOME%"=="" CALL :ECHO "'MSVC_HOME' was not provided, auto-searching fo
IF "%MSVC_HOME%"=="" CALL :FindVisualStudio "%SWT_BUILDDIR%\Microsoft\Visual Studio\$MSVC_VERSION$"
@rem Bug 574007: Path used on Azure build machines
IF "%MSVC_HOME%"=="" CALL :FindVisualStudio "%ProgramFiles(x86)%\Microsoft Visual Studio\$MSVC_VERSION$\BuildTools"
@rem Bug 578519: Common installation paths; VisualStudio is installed in x64 ProgramFiles since VS2022
@rem Bug 578519: Common installation paths; VisualStudio is installed in 64-bit ProgramFiles since VS2022
IF "%MSVC_HOME%"=="" CALL :FindVisualStudio "%ProgramFiles%\Microsoft Visual Studio\$MSVC_VERSION$\$MSVC_EDITION$"
@rem Bug 578519: Common installation paths; VisualStudio is installed in x86 ProgramFiles before VS2022
IF "%MSVC_HOME%"=="" CALL :FindVisualStudio "%ProgramFiles(x86)%\Microsoft Visual Studio\$MSVC_VERSION$\$MSVC_EDITION$"
Expand All @@ -59,25 +59,28 @@ IF "%SWT_JAVA_HOME%"=="" CALL :TryToUseJdk "%SWT_BUILDDIR%\Java\Oracle\jdk1.8.0-
@rem Note that first found JDK wins, so sort them by order of preference.
IF "%SWT_JAVA_HOME%"=="" CALL :TryToUseJdk "%ProgramFiles%\Java\jdk*"
IF "%SWT_JAVA_HOME%"=="" CALL :TryToUseJdk "%ProgramFiles%\AdoptOpenJDK\jdk*"
IF "%SWT_JAVA_HOME%"=="" CALL :TryToUseJdk "%JAVA_HOME%"
@rem Report
IF NOT EXIST "%SWT_JAVA_HOME%" (
CALL :ECHO "WARNING: x64 Java JDK not found. Please set SWT_JAVA_HOME to your JDK directory."
CALL :ECHO "WARNING: 64-bit Java JDK not found. Please set SWT_JAVA_HOME to your JDK directory."
CALL :ECHO " Refer steps for SWT Windows native setup: https://www.eclipse.org/swt/swt_win_native.php"
) ELSE (
CALL :ECHO "SWT_JAVA_HOME x64: %SWT_JAVA_HOME%"
CALL :ECHO "SWT_JAVA_HOME 64-bit: %SWT_JAVA_HOME%"
)

@rem -----------------------
IF NOT "x.%1"=="x.x86_64" (
CALL :ECHO "ERROR: 32-bit builds are no longer supported."
IF "x.%1"=="x.x86_64" (
set BUILD_ARCH=x64
IF "x.%OUTPUT_DIR%"=="x." set OUTPUT_DIR=..\..\..\org.eclipse.swt.win32.win32.x86_64
) ELSE IF "x.%1"=="x.aarch64" (
set BUILD_ARCH=arm64
IF "x.%OUTPUT_DIR%"=="x." set OUTPUT_DIR=..\..\..\org.eclipse.swt.win32.win32.aarch64
) ELSE (
CALL :ECHO "ERROR: %1 builds are no longer supported."
EXIT /B 1
)

set PROCESSOR_ARCHITECTURE=AMD64
IF "x.%OUTPUT_DIR%"=="x." set OUTPUT_DIR=..\..\..\org.eclipse.swt.win32.win32.x86_64

set CFLAGS=-DJNI64
call "%MSVC_HOME%\VC\Auxiliary\Build\vcvarsall.bat" x64
call "%MSVC_HOME%\VC\Auxiliary\Build\vcvarsall.bat" %BUILD_ARCH%
shift

@rem if call to vcvarsall.bat (which sets up environment) silently fails, then provide advice to user.
Expand Down Expand Up @@ -117,6 +120,7 @@ GOTO :EOF
CALL :FindVisualStudio3 "%~1" "%~2" "Community"
CALL :FindVisualStudio3 "%~1" "%~2" "Enterprise"
CALL :FindVisualStudio3 "%~1" "%~2" "Professional"
CALL :FindVisualStudio3 "%~1" "%~2" "Preview"
) ELSE (
CALL :FindVisualStudio3 "%~1" "%~2" "%MSVC_EDITION%"
)
Expand Down
12 changes: 12 additions & 0 deletions bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_custom.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ BOOL Validate_AllowDarkModeForWindow(const BYTE* functionPtr)
return TRUE;
}

return FALSE;
#elif defined(_M_ARM64)
/* Not implemented yet */
functionPtr; /* to prevent: warning C4100: 'functionPtr': unreferenced formal parameter */
return FALSE;
#else
#error Unsupported processor type
Expand Down Expand Up @@ -121,6 +125,10 @@ BOOL Validate_AllowDarkModeForWindowWithTelemetryId(const BYTE* functionPtr)
return TRUE;
}

return FALSE;
#elif defined(_M_ARM64)
/* Not implemented yet */
functionPtr; /* to prevent: warning C4100: 'functionPtr': unreferenced formal parameter */
return FALSE;
#else
#error Unsupported processor type
Expand Down Expand Up @@ -212,6 +220,10 @@ BOOL Validate_SetPreferredAppMode(const BYTE* functionPtr)
(functionPtr[0x00] == 0x8B) && (functionPtr[0x01] == 0x05) && // mov eax,dword ptr [uxtheme!g_preferredAppMode]
(functionPtr[0x06] == 0x87) && (functionPtr[0x07] == 0x0D) && // xchg ecx,dword ptr [uxtheme!g_preferredAppMode]
(functionPtr[0x0C] == 0xC3); // ret
#elif defined(_M_ARM64)
/* Not implemented yet */
functionPtr; /* to prevent: warning C4100: 'functionPtr': unreferenced formal parameter */
return FALSE;
#else
#error Unsupported processor type
#endif
Expand Down
13 changes: 10 additions & 3 deletions bundles/org.eclipse.swt/buildSWT.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
<param name="library_count" value="7"/>
<param name="fragment" value="org.eclipse.swt.gtk.linux.x86_64"/>
</antcall>
<antcall target="check_fragment_libraries">
<param name="library_count" value="4"/>
<param name="fragment" value="org.eclipse.swt.win32.win32.aarch64"/>
</antcall>
<antcall target="check_fragment_libraries">
<param name="library_count" value="4"/>
<param name="fragment" value="org.eclipse.swt.win32.win32.x86_64"/>
Expand All @@ -86,15 +90,15 @@
<target name="check_fragment_libraries" depends="get_version">
<echo>Checking ${fragment}</echo>
<property name="checkdir" value="~/build/check_libraries"/>
<property name="library_count" value="31"/>
<property name="library_count" value="35"/>
<property name="fragment" value=""/>
<fileset id="match" dir="${repo.bin}/bundles/${fragment}" includes="**/org.eclipse.swt.gtk.linux.aarch64/**, **/org.eclipse.swt.gtk.linux.ppc64le/**, **/org.eclipse.swt.gtk.linux.x86_64/**, **/org.eclipse.swt.win32.win32.x86_64/**, **/org.eclipse.swt.cocoa.macosx.aarch64/**, **/org.eclipse.swt.cocoa.macosx.x86_64/**">
<fileset id="match" dir="${repo.bin}/bundles/${fragment}" includes="**/org.eclipse.swt.gtk.linux.aarch64/**, **/org.eclipse.swt.gtk.linux.ppc64le/**, **/org.eclipse.swt.gtk.linux.x86_64/**, **/org.eclipse.swt.win32.win32.aarch64/**, **/org.eclipse.swt.win32.win32.x86_64/**, **/org.eclipse.swt.cocoa.macosx.aarch64/**, **/org.eclipse.swt.cocoa.macosx.x86_64/**">
<filename regex="[0-9][0-9][0-9][0-9]"/>
<filename regex="${swt_version}"/>
<exclude name="**/.git/**"/>
</fileset>
<echo>Matched files ${toString:match}</echo>
<fileset id="not_match" dir="${repo.bin}/bundles/${fragment}" includes="**/org.eclipse.swt.gtk.linux.aarch64/**, **/org.eclipse.swt.gtk.linux.ppc64le/**, **/org.eclipse.swt.gtk.linux.x86_64/**, **/org.eclipse.swt.win32.win32.x86_64/**, **/org.eclipse.swt.cocoa.macosx.aarch64/**, **/org.eclipse.swt.cocoa.macosx.x86_64/**">
<fileset id="not_match" dir="${repo.bin}/bundles/${fragment}" includes="**/org.eclipse.swt.gtk.linux.aarch64/**, **/org.eclipse.swt.gtk.linux.ppc64le/**, **/org.eclipse.swt.gtk.linux.x86_64/**, **/org.eclipse.swt.win32.win32.aarch64/**, **/org.eclipse.swt.win32.win32.x86_64/**, **/org.eclipse.swt.cocoa.macosx.aarch64/**, **/org.eclipse.swt.cocoa.macosx.x86_64/**">
<filename regex="[0-9][0-9][0-9][0-9]"/>
<filename regex="${swt_version}" negate="true"/>
<exclude name="**/.git/**"/>
Expand Down Expand Up @@ -255,6 +259,9 @@
<antcall target="build_classes">
<param name="cp" value=".classpath_win32"/>
</antcall>
<antcall target="build_classes">
<param name="cp" value=".classpath_win32_aarch64"/>
</antcall>

<antcall target="check_preprocessing"/>
</target>
Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@
<version>${tycho.version}</version>
<configuration>
<environments>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>aarch64</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
Expand Down