Sketch export for armv6hf (v2)

Includes a lot of improvements suggested by Ben.
This commit is contained in:
gohai
2015-07-31 10:11:54 +02:00
parent a339138e3e
commit 25a4f406ff
6 changed files with 71 additions and 27 deletions

View File

@@ -35,6 +35,7 @@ import processing.app.SketchException;
import processing.app.Util;
import processing.app.contrib.ModeContribution;
import processing.core.PApplet;
import processing.core.PConstants;
import processing.mode.java.runner.Runner;
@@ -280,14 +281,9 @@ public class Commander implements RunnerListener {
JavaBuild build = new JavaBuild(sketch);
build.build(true);
if (build != null) {
// if (platformBits == 0) {
// platformBits = Base.getNativeBits();
// }
// if (platformBits == 0 &&
// Library.hasMultipleArch(platform, build.getImportedLibraries())) {
// complainAndQuit("This sketch can be exported for 32- or 64-bit, please specify one.", true);
// }
success = build.exportApplication(outputFolder, platform, platformBits, embedJava);
String variant = Base.getVariant();
success = build.exportApplication(outputFolder, platform, variant, embedJava);
}
}
}

View File

@@ -796,17 +796,24 @@ public class JavaBuild {
if (Library.hasMultipleArch(platform, importedLibraries)) {
// export the 32-bit version
folder = new File(sketch.getFolder(), "application." + platformName + "32");
if (!exportApplication(folder, platform, 32, embedJava && Base.getNativeBits() == 32)) {
if (!exportApplication(folder, platform, "32", embedJava && Base.getNativeBits() == 32 && "x86".equals(Base.getNativeArch()))) {
return false;
}
// export the 64-bit version
folder = new File(sketch.getFolder(), "application." + platformName + "64");
if (!exportApplication(folder, platform, 64, embedJava && Base.getNativeBits() == 64)) {
if (!exportApplication(folder, platform, "64", embedJava && Base.getNativeBits() == 64 && "x86".equals(Base.getNativeArch()))) {
return false;
}
if (platform == PConstants.LINUX) {
// export the armv6hf version as well
folder = new File(sketch.getFolder(), "application.linux-armv6hf");
if (!exportApplication(folder, platform, "armv6hf", embedJava && Base.getNativeBits() == 32 && "arm".equals(Base.getNativeArch()))) {
return false;
}
}
} else { // just make a single one for this platform
folder = new File(sketch.getFolder(), "application." + platformName);
if (!exportApplication(folder, platform, 0, embedJava)) {
if (!exportApplication(folder, platform, "", embedJava)) {
return false;
}
}
@@ -847,18 +854,18 @@ public class JavaBuild {
*/
protected boolean exportApplication(File destFolder,
int exportPlatform,
int exportBits,
String exportVariant,
boolean embedJava) throws IOException, SketchException {
// TODO this should probably be a dialog box instead of a warning
// on the terminal. And the message should be written better than this.
// http://code.google.com/p/processing/issues/detail?id=884
for (Library library : importedLibraries) {
if (!library.supportsArch(exportPlatform, exportBits)) {
if (!library.supportsArch(exportPlatform, exportVariant)) {
String pn = PConstants.platformNames[exportPlatform];
Base.showWarning("Quibbles 'n Bits",
"The application." + pn + exportBits +
"The application." + pn + exportVariant +
" folder will not be created\n" +
"because no " + exportBits + "-bit version of " +
"because no " + exportVariant + " version of " +
library.getName() + " is available for " + pn, null);
return true; // don't cancel all exports for this, just move along
}
@@ -1062,7 +1069,7 @@ public class JavaBuild {
/// add contents of 'library' folders to the export
for (Library library : importedLibraries) {
// add each item from the library folder / export list to the output
for (File exportFile : library.getApplicationExports(exportPlatform, exportBits)) {
for (File exportFile : library.getApplicationExports(exportPlatform, exportVariant)) {
// System.out.println("export: " + exportFile);
String exportName = exportFile.getName();
if (!exportFile.exists()) {

View File

@@ -90,9 +90,11 @@ public class Runner implements MessageConsumer {
// Make sure all the imported libraries will actually run with this setup.
int bits = Base.getNativeBits();
String variant = Base.getVariant();
for (Library library : build.getImportedLibraries()) {
if (!library.supportsArch(PApplet.platform, bits)) {
sketchErr.println(library.getName() + " does not run in " + bits + "-bit mode.");
if (!library.supportsArch(PApplet.platform, variant)) {
sketchErr.println(library.getName() + " does not run on this architecture: " + variant);
int opposite = (bits == 32) ? 64 : 32;
if (Base.isMacOS()) {
//if (library.supportsArch(PConstants.MACOSX, opposite)) { // should always be true