Skip to content

Commit

Permalink
Add swt.win32.aarch64 fragment and compile natives for Windows on Arm64
Browse files Browse the repository at this point in the history
This adds the org.eclipse.swt.win32.aarch64 fragment and contains
changes to the build.bat file, to support compiling the SWT natives for
the Windows on Arm64 (WoA) platform.

On a WoA box, run the following commands to produce the
SWT natives (swt*.dll) for WoA:

  cd binaries\org.eclipse.swt.win32.win32.aarch64
  mvn clean process-resources -Dnative=win32.win32.aarch64

and the swt*.dll files for WoA will be created in the current directory.

Cross-compiling between the x64 and Arm64 platforms, where either of
them can be host or target, is also possible, after setting up the
TARGET_ARCH environment variable with correct target architecture value,
and with the SWT_JAVA_HOME property pointing to an available JDK of
the target architecture.

For example, to cross-compile on an x64 host and produce SWT natives for
Arm64 target, run the following commands:

  set TARGET_ARCH=arm64
  cd binaries\org.eclipse.swt.win32.win32.aarch64
  mvn clean process-resources -Dnative=win32.win32.aarch64
-DSWT_JAVA_HOME=\path\to\arm64_jdk

and the swt*.dll files for WoA will be created in the current directory.
Note the above SWT_JAVA_HOME property in the command line which points
to an available Arm64 JDK of the target architecture.

Similarly, to cross-compile on an Arm64 host and produce SWT natives for
x64 target, run the following commands:

  set TARGET_ARCH=x64
  cd binaries\org.eclipse.swt.win32.win32.x86_64
  mvn clean process-resources -Dnative=win32.win32.x86_64
-DSWT_JAVA_HOME=\path\to\x64_jdk

and the swt*.dll files for x64 will be created in the current directory.

Note that for cross-compiling between x64 and Arm64 to work, install the
MSVC compiler version 2022, with mandatory build tools for both
platforms included in the installation.

Once the SWT natives for Arm64 are generated, the SWT binaries module's
files can be produced with the following build commands in current
directory:

  mvn clean verify -DskipTests=true

and the module's jar/zip files will be produced in the target directory:

  org.eclipse.swt.win32.win32.aarch64-<version>.jar
  org.eclipse.swt.win32.win32.aarch64-<version>-sources.jar
  swt-<version>-win32-win32-aarch64.zip

Also add the WebView2Loader.dll version 1.0.1150.38 (matching the
swt.win32.x86_64 fragment), obtained from the NuGet package
microsoft.web.webview2
https://nuget.info/packages/Microsoft.Web.WebView2/1.0.1150.38
located in the sub-folder build/native/arm64
  • Loading branch information
chirontt authored and HannesWell committed Mar 29, 2024
1 parent 2922a9c commit 4513c52
Show file tree
Hide file tree
Showing 11 changed files with 868 additions and 7 deletions.
14 changes: 13 additions & 1 deletion Jenkinsfile
Expand Up @@ -51,6 +51,18 @@ spec:

/** Returns the download URL of the JDK against whoose C headers (in the 'include/' folder) and native libaries the SWT natives are compiled.*/
def getNativeJdkUrl(String os, String arch){ // To update the used JDK version update the URL template below
if('win32'.equals(os) && 'aarch64'.equals(arch)) {
// Temporary workaround until there are official Temurin GA releases for Windows on ARM that can be consumed through JustJ
dir("${WORKSPACE}/repackage-win32.aarch64-jdk") {
sh """
curl -L 'https://github.com/adoptium/temurin17-binaries/releases/download/jdk17u-2024-02-07-14-14-beta/OpenJDK17U-jdk_aarch64_windows_hotspot_2024-02-07-14-14.zip' > jdk.zip
unzip -q jdk.zip jdk-17.0.11+1/include/** jdk-17.0.11+1/lib/**
cd jdk-17.0.11+1
tar -czf ../jdk.tar.gz include/ lib/
"""
}
return "file://${WORKSPACE}/repackage-win32.aarch64-jdk/jdk.tar.gz"
}
return "https://download.eclipse.org/justj/jres/17/downloads/20230428_1804/org.eclipse.justj.openjdk.hotspot.jre.minimal.stripped-17.0.7-${os}-${arch}.tar.gz"
}

Expand Down Expand Up @@ -177,7 +189,7 @@ pipeline {
axes {
axis {
name 'PLATFORM'
values 'cocoa.macosx.aarch64' , 'cocoa.macosx.x86_64', 'gtk.linux.aarch64', 'gtk.linux.ppc64le', 'gtk.linux.x86_64', 'win32.win32.x86_64'
values 'cocoa.macosx.aarch64' , 'cocoa.macosx.x86_64', 'gtk.linux.aarch64', 'gtk.linux.ppc64le', 'gtk.linux.x86_64', 'win32.win32.aarch64', 'win32.win32.x86_64'
}
}
stages {
Expand Down
117 changes: 117 additions & 0 deletions binaries/org.eclipse.swt.win32.win32.aarch64/.project
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.swt.win32.win32.aarch64</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
</natures>
<linkedResources>
<link>
<name>.classpath</name>
<type>1</type>
<locationURI>PARENT-1-PROJECT_LOC/.classpath_win32</locationURI>
</link>
<link>
<name>.settings/.api_filters</name>
<type>1</type>
<locationURI>PROJECT_LOC/.settings/.api_filters</locationURI>
</link>
<link>
<name>.settings</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/.settings</locationURI>
</link>
<link>
<name>Eclipse SWT</name>
<type>2</type>
<locationURI>SWT_HOST_PLUGIN/Eclipse%20SWT</locationURI>
</link>
<link>
<name>Eclipse SWT Accessibility</name>
<type>2</type>
<locationURI>SWT_HOST_PLUGIN/Eclipse%20SWT%20Accessibility</locationURI>
</link>
<link>
<name>Eclipse SWT AWT</name>
<type>2</type>
<locationURI>SWT_HOST_PLUGIN/Eclipse%20SWT%20AWT</locationURI>
</link>
<link>
<name>Eclipse SWT Browser</name>
<type>2</type>
<locationURI>SWT_HOST_PLUGIN/Eclipse%20SWT%20Browser</locationURI>
</link>
<link>
<name>Eclipse SWT Custom Widgets</name>
<type>2</type>
<locationURI>SWT_HOST_PLUGIN/Eclipse%20SWT%20Custom%20Widgets</locationURI>
</link>
<link>
<name>Eclipse SWT Drag and Drop</name>
<type>2</type>
<locationURI>SWT_HOST_PLUGIN/Eclipse%20SWT%20Drag%20and%20Drop</locationURI>
</link>
<link>
<name>Eclipse SWT OLE Win32</name>
<type>2</type>
<locationURI>SWT_HOST_PLUGIN/Eclipse%20SWT%20OLE%20Win32</locationURI>
</link>
<link>
<name>Eclipse SWT OpenGL</name>
<type>2</type>
<locationURI>SWT_HOST_PLUGIN/Eclipse%20SWT%20OpenGL</locationURI>
</link>
<link>
<name>Eclipse SWT PI</name>
<type>2</type>
<locationURI>SWT_HOST_PLUGIN/Eclipse%20SWT%20PI</locationURI>
</link>
<link>
<name>Eclipse SWT Printing</name>
<type>2</type>
<locationURI>SWT_HOST_PLUGIN/Eclipse%20SWT%20Printing</locationURI>
</link>
<link>
<name>Eclipse SWT Program</name>
<type>2</type>
<locationURI>SWT_HOST_PLUGIN/Eclipse%20SWT%20Program</locationURI>
</link>
<link>
<name>Eclipse SWT WebKit</name>
<type>2</type>
<locationURI>SWT_HOST_PLUGIN/Eclipse%20SWT%20WebKit</locationURI>
</link>
</linkedResources>
<variableList>
<variable>
<name>SWT_HOST_PLUGIN</name>
<value>$%7BPARENT-2-PROJECT_LOC%7D/bundles/org.eclipse.swt</value>
</variable>
</variableList>
</projectDescription>

0 comments on commit 4513c52

Please sign in to comment.