Merge pull request #5002 from gohai/arm64

Add support for 64-bit ARM boards
This commit is contained in:
Ben Fry
2017-04-20 14:37:20 -04:00
committed by GitHub
6 changed files with 65 additions and 13 deletions
+24 -5
View File
@@ -71,6 +71,7 @@ public class Library extends LocalContribution {
if (name.equals("linux32")) return false;
if (name.equals("linux64")) return false;
if (name.equals("linux-armv6hf")) return false;
if (name.equals("linux-arm64")) return false;
if (name.equals("android")) return false;
}
return true;
@@ -173,6 +174,12 @@ public class Library extends LocalContribution {
nativeLibraryFolder = hostLibrary;
}
}
if (hostPlatform.equals("linux") && System.getProperty("os.arch").equals("aarch64")) {
hostLibrary = new File(libraryFolder, "linux-arm64");
if (hostLibrary.exists()) {
nativeLibraryFolder = hostLibrary;
}
}
// save that folder for later use
nativeLibraryPath = nativeLibraryFolder.getAbsolutePath();
@@ -182,7 +189,8 @@ public class Library extends LocalContribution {
String platformName = platformNames[i];
String platformName32 = platformName + "32";
String platformName64 = platformName + "64";
String platformNameArmv6hh = platformName + "-armv6hf";
String platformNameArmv6hf = platformName + "-armv6hf";
String platformNameArm64 = platformName + "-arm64";
// First check for things like 'application.macosx=' or 'application.windows32' in the export.txt file.
// These will override anything in the platform-specific subfolders.
@@ -194,6 +202,8 @@ public class Library extends LocalContribution {
String[] platformList64 = platform64 == null ? null : PApplet.splitTokens(platform64, ", ");
String platformArmv6hf = exportTable.get("application." + platformName + "-armv6hf");
String[] platformListArmv6hf = platformArmv6hf == null ? null : PApplet.splitTokens(platformArmv6hf, ", ");
String platformArm64 = exportTable.get("application." + platformName + "-arm64");
String[] platformListArm64 = platformArm64 == null ? null : PApplet.splitTokens(platformArm64, ", ");
// If nothing specified in the export.txt entries, look for the platform-specific folders.
if (platformAll == null) {
@@ -206,16 +216,19 @@ public class Library extends LocalContribution {
platformList64 = listPlatformEntries(libraryFolder, platformName64, baseList);
}
if (platformListArmv6hf == null) {
platformListArmv6hf = listPlatformEntries(libraryFolder, platformNameArmv6hh, baseList);
platformListArmv6hf = listPlatformEntries(libraryFolder, platformNameArmv6hf, baseList);
}
if (platformListArm64 == null) {
platformListArm64 = listPlatformEntries(libraryFolder, platformNameArm64, baseList);
}
if (platformList32 != null || platformList64 != null || platformListArmv6hf != null) {
if (platformList32 != null || platformList64 != null || platformListArmv6hf != null || platformListArm64 != null) {
multipleArch[i] = true;
}
// if there aren't any relevant imports specified or in their own folders,
// then use the baseList (root of the library folder) as the default.
if (platformList == null && platformList32 == null && platformList64 == null && platformListArmv6hf == null) {
if (platformList == null && platformList32 == null && platformList64 == null && platformListArmv6hf == null && platformListArm64 == null) {
exportList.put(platformName, baseList);
} else {
@@ -231,7 +244,10 @@ public class Library extends LocalContribution {
exportList.put(platformName64, platformList64);
}
if (platformListArmv6hf != null) {
exportList.put(platformNameArmv6hh, platformListArmv6hf);
exportList.put(platformNameArmv6hf, platformListArmv6hf);
}
if (platformListArm64 != null) {
exportList.put(platformNameArm64, platformListArm64);
}
}
}
@@ -412,6 +428,9 @@ public class Library extends LocalContribution {
} else if (variant.equals("armv6hf")) {
String[] pieces = exportList.get(platformName + "-armv6hf");
if (pieces != null) return pieces;
} else if (variant.equals("arm64")) {
String[] pieces = exportList.get(platformName + "-arm64");
if (pieces != null) return pieces;
}
return exportList.get(platformName);
}
+6 -1
View File
@@ -195,6 +195,7 @@ public class Platform {
* Return the value of the os.arch property
*/
static public String getNativeArch() {
// This will return "arm" for 32-bit ARM, "aarch64" for 64-bit ARM (both on Linux)
return System.getProperty("os.arch");
}
@@ -211,8 +212,12 @@ public class Platform {
static public String getVariant(int platform, String arch, int bits) {
if (platform == PConstants.LINUX &&
bits == 32 && "arm".equals(Platform.getNativeArch())) {
return "armv6hf"; // assume armv6hf for now
return "armv6hf"; // assume armv6hf
} else if (platform == PConstants.LINUX &&
bits == 64 && "aarch64".equals(Platform.getNativeArch())) {
return "arm64";
}
return Integer.toString(bits); // 32 or 64
}
+24 -4
View File
@@ -32,13 +32,25 @@
<equals arg1="${sun.arch.data.model}" arg2="32" />
</and>
</condition>
<condition property="linux-arm64" value="linux-arm64">
<and>
<equals arg1="${platform}" arg2="linux" />
<equals arg1="${os.arch}" arg2="aarch64" />
<equals arg1="${sun.arch.data.model}" arg2="64" />
</and>
</condition>
<!-- there is currently no JRE available for ARM -->
<target name="check-linux-arm32" if="linux-arm32">
<!-- there is currently no JRE available -->
<property name="jre.download.jdk" value="true" />
<property name="jre.downloader" value="linux-arm32-vfp-hflt.tar.gz" />
<property name="linux.dist" value="linux/processing-${version}-linux-armv6hf.tgz" />
</target>
<target name="check-linux-arm64" if="linux-arm64">
<property name="jre.download.jdk" value="true" />
<property name="jre.downloader" value="linux-arm64-vfp-hflt.tar.gz" />
<property name="linux.dist" value="linux/processing-${version}-linux-arm64.tgz" />
</target>
<!-- Require Java 8 everywhere. -->
<fail message="Unsupported Java version: ${java.version}. To build, make sure that Java 8 (aka Java 1.8) is installed.">
@@ -348,11 +360,13 @@
<subant buildpath="../java" target="build"/>
</target>
<!-- I/O library is only compiled on supported ARM platforms -->
<target name="subprojects-build-linux-arm32" if="linux-arm32">
<!-- I/O library is only compiled on supported ARM platforms -->
<subant buildpath="../java/libraries/io" target="build"/>
</target>
<target name="subprojects-build-linux-arm64" if="linux-arm64">
<subant buildpath="../java/libraries/io" target="build"/>
</target>
<!-- - - - - - - - - -->
<!-- Basic Assembly -->
@@ -750,7 +764,7 @@
<fail message="wrong platform (${os.name})" />
</target>
<target name="linux-build" depends="ignore-tools, check-linux-arm32, revision-check, linux-check-os, jre-download, subprojects-build, subprojects-build-linux-arm32" description="Build Linux version">
<target name="linux-build" depends="ignore-tools, check-linux-arm32, check-linux-arm64, revision-check, linux-check-os, jre-download, subprojects-build, subprojects-build-linux-arm32, subprojects-build-linux-arm64" description="Build Linux version">
<mkdir dir="linux/work" />
<copy todir="linux/work">
@@ -932,12 +946,18 @@
<condition property="linux.deb" value="linux/processing-${version}-linux-armv6hf.deb">
<equals arg1="${linux-arm32}" arg2="linux-arm32" />
</condition>
<condition property="linux.deb" value="linux/processing-${version}-linux-arm64.deb">
<equals arg1="${linux-arm64}" arg2="linux-arm64" />
</condition>
<property name="linux.deb" value="linux/processing-${version}-linux${sun.arch.data.model}.deb" />
<!-- Raspbian seems to borrow armhf for armv6hf, so this works -->
<condition property="deb.arch" value="armhf">
<equals arg1="${linux-arm32}" arg2="linux-arm32" />
</condition>
<condition property="deb.arch" value="arm64">
<equals arg1="${linux-arm64}" arg2="linux-arm64" />
</condition>
<condition property="deb.arch" value="i386">
<equals arg1="${sun.arch.data.model}" arg2="32" />
</condition>
+4 -1
View File
@@ -37,7 +37,10 @@
<!-- JavaFX got removed from the Oracle's JDK for arm -->
<condition property="fx.unavailable" value="true">
<equals arg1="${os.arch}" arg2="arm" />
<or>
<equals arg1="${os.arch}" arg2="arm" />
<equals arg1="${os.arch}" arg2="aarch64" />
</or>
</condition>
<!-- link against apple.jar for the ThinkDifferent class -->
+2 -1
View File
@@ -8,4 +8,5 @@ application.windows32=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-wind
application.windows64=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-windows-amd64.jar,gluegen-rt-natives-windows-amd64.jar
application.linux32=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-i586.jar,gluegen-rt-natives-linux-i586.jar
application.linux64=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-amd64.jar,gluegen-rt-natives-linux-amd64.jar
application.linux-armv6hf=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-armv6hf.jar,gluegen-rt-natives-linux-armv6hf.jar
application.linux-armv6hf=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-armv6hf.jar,gluegen-rt-natives-linux-armv6hf.jar
application.linux-arm64=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-aarch64.jar,gluegen-rt-natives-linux-aarch64.jar
+5 -1
View File
@@ -709,11 +709,15 @@ public class JavaBuild {
return false;
}
if (platform == PConstants.LINUX) {
// export the armv6hf version as well
// export the arm versions as well
folder = new File(sketch.getFolder(), "application.linux-armv6hf");
if (!exportApplication(folder, platform, "armv6hf", embedJava && (bits == 32) && "arm".equals(arch))) {
return false;
}
folder = new File(sketch.getFolder(), "application.linux-arm64");
if (!exportApplication(folder, platform, "arm64", embedJava && (bits == 64) && "aarch64".equals(arch))) {
return false;
}
}
} else { // just make a single one for this platform
folder = new File(sketch.getFolder(), "application." + platformName);