| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -98,6 +98,8 @@ public class Base { | |||
| 98 | 98 | } | |
| 99 | 99 | } | |
| 100 | 100 | ||
| 101 | + static String nativeArch = System.getProperty("os.arch"); | ||
| 102 | + | ||
| 101 | 103 | static private boolean commandLine; | |
| 102 | 104 | ||
| 103 | 105 | // A single instance of the preferences window | |
@@ -1546,6 +1548,30 @@ static public int getNativeBits() { | |||
| 1546 | 1548 | return nativeBits; | |
| 1547 | 1549 | } | |
| 1548 | 1550 | ||
| 1551 | + /** | ||
| 1552 | + * Return the value of the os.arch propery | ||
| 1553 | + */ | ||
| 1554 | + static public String getNativeArch() { | ||
| 1555 | + return nativeArch; | ||
| 1556 | + } | ||
| 1557 | + | ||
| 1558 | + /* | ||
| 1559 | + * Return a string that identifies the variant of a platform | ||
| 1560 | + * e.g. "32" or "64" on Intel | ||
| 1561 | + */ | ||
| 1562 | + static public String getVariant() { | ||
| 1563 | + return getVariant(PApplet.platform, getNativeArch(), getNativeBits()); | ||
| 1564 | + } | ||
| 1565 | + | ||
| 1566 | + static public String getVariant(int platform, String arch, int bits) { | ||
| 1567 | + if (platform == PConstants.LINUX && bits == 32 && "arm".equals(Base.getNativeArch())) { | ||
| 1568 | + // assume armv6hf for now | ||
| 1569 | + return "armv6hf"; | ||
| 1570 | + } else { | ||
| 1571 | + // 32 or 64 | ||
| 1572 | + return Integer.toString(bits); | ||
| 1573 | + } | ||
| 1574 | + } | ||
| 1549 | 1575 | ||
| 1550 | 1576 | /* | |
| 1551 | 1577 | static public String getPlatformName() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -173,6 +173,7 @@ private Library(File folder, String groupName) { | |||
| 173 | 173 | String platformName = platformNames[i]; | |
| 174 | 174 | String platformName32 = platformName + "32"; | |
| 175 | 175 | String platformName64 = platformName + "64"; | |
| 176 | + String platformNameArmv6hh = platformName + "-armv6hf"; | ||
| 176 | 177 | ||
| 177 | 178 | // First check for things like 'application.macosx=' or 'application.windows32' in the export.txt file. | |
| 178 | 179 | // These will override anything in the platform-specific subfolders. | |
@@ -182,6 +183,8 @@ private Library(File folder, String groupName) { | |||
| 182 | 183 | String[] platformList32 = platform32 == null ? null : PApplet.splitTokens(platform32, ", "); | |
| 183 | 184 | String platform64 = exportTable.get("application." + platformName + "64"); | |
| 184 | 185 | String[] platformList64 = platform64 == null ? null : PApplet.splitTokens(platform64, ", "); | |
| 186 | + String platformArmv6hf = exportTable.get("application." + platformName + "-armv6hf"); | ||
| 187 | + String[] platformListArmv6hf = platformArmv6hf == null ? null : PApplet.splitTokens(platformArmv6hf, ", "); | ||
| 185 | 188 | ||
| 186 | 189 | // If nothing specified in the export.txt entries, look for the platform-specific folders. | |
| 187 | 190 | if (platformAll == null) { | |
@@ -193,14 +196,17 @@ private Library(File folder, String groupName) { | |||
| 193 | 196 | if (platform64 == null) { | |
| 194 | 197 | platformList64 = listPlatformEntries(libraryFolder, platformName64, baseList); | |
| 195 | 198 | } | |
| 199 | + if (platformListArmv6hf == null) { | ||
| 200 | + platformListArmv6hf = listPlatformEntries(libraryFolder, platformNameArmv6hh, baseList); | ||
| 201 | + } | ||
| 196 | 202 | ||
| 197 | - if (platformList32 != null || platformList64 != null) { | ||
| 203 | + if (platformList32 != null || platformList64 != null || platformListArmv6hf != null) { | ||
| 198 | 204 | multipleArch[i] = true; | |
| 199 | 205 | } | |
| 200 | 206 | ||
| 201 | 207 | // if there aren't any relevant imports specified or in their own folders, | |
| 202 | 208 | // then use the baseList (root of the library folder) as the default. | |
| 203 | - if (platformList == null && platformList32 == null && platformList64 == null) { | ||
| 209 | + if (platformList == null && platformList32 == null && platformList64 == null && platformListArmv6hf == null) { | ||
| 204 | 210 | exportList.put(platformName, baseList); | |
| 205 | 211 | ||
| 206 | 212 | } else { | |
@@ -215,6 +221,9 @@ private Library(File folder, String groupName) { | |||
| 215 | 221 | if (platformList64 != null) { | |
| 216 | 222 | exportList.put(platformName64, platformList64); | |
| 217 | 223 | } | |
| 224 | + if (platformListArmv6hf != null) { | ||
| 225 | + exportList.put(platformNameArmv6hh, platformListArmv6hf); | ||
| 226 | + } | ||
| 218 | 227 | } | |
| 219 | 228 | } | |
| 220 | 229 | // for (String p : exportList.keySet()) { | |
@@ -369,8 +378,8 @@ public File[] getAppletExports() { | |||
| 369 | 378 | } | |
| 370 | 379 | ||
| 371 | 380 | ||
| 372 | - public File[] getApplicationExports(int platform, int bits) { | ||
| 373 | - String[] list = getApplicationExportList(platform, bits); | ||
| 381 | + public File[] getApplicationExports(int platform, String variant) { | ||
| 382 | + String[] list = getApplicationExportList(platform, variant); | ||
| 374 | 383 | return wrapFiles(list); | |
| 375 | 384 | } | |
| 376 | 385 | ||
@@ -380,14 +389,17 @@ public File[] getApplicationExports(int platform, int bits) { | |||
| 380 | 389 | * If no 32 or 64-bit version of the exports exists, it returns the version | |
| 381 | 390 | * that doesn't specify bit depth. | |
| 382 | 391 | */ | |
| 383 | - public String[] getApplicationExportList(int platform, int bits) { | ||
| 392 | + public String[] getApplicationExportList(int platform, String variant) { | ||
| 384 | 393 | String platformName = PConstants.platformNames[platform]; | |
| 385 | - if (bits == 32) { | ||
| 394 | + if (variant.equals("32")) { | ||
| 386 | 395 | String[] pieces = exportList.get(platformName + "32"); | |
| 387 | 396 | if (pieces != null) return pieces; | |
| 388 | - } else if (bits == 64) { | ||
| 397 | + } else if (variant.equals("64")) { | ||
| 389 | 398 | String[] pieces = exportList.get(platformName + "64"); | |
| 390 | 399 | if (pieces != null) return pieces; | |
| 400 | + } else if (variant.equals("armv6hf")) { | ||
| 401 | + String[] pieces = exportList.get(platformName + "-armv6hf"); | ||
| 402 | + if (pieces != null) return pieces; | ||
| 391 | 403 | } | |
| 392 | 404 | return exportList.get(platformName); | |
| 393 | 405 | } | |
@@ -408,12 +420,12 @@ public boolean hasMultipleArch(int platform) { | |||
| 408 | 420 | } | |
| 409 | 421 | ||
| 410 | 422 | ||
| 411 | - public boolean supportsArch(int platform, int bits) { | ||
| 423 | + public boolean supportsArch(int platform, String variant) { | ||
| 412 | 424 | // If this is a universal library, or has no natives, then we're good. | |
| 413 | 425 | if (multipleArch[platform] == false) { | |
| 414 | 426 | return true; | |
| 415 | 427 | } | |
| 416 | - return getApplicationExportList(platform, bits) != null; | ||
| 428 | + return getApplicationExportList(platform, variant) != null; | ||
| 417 | 429 | } | |
| 418 | 430 | ||
| 419 | 431 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,3 +8,4 @@ application.windows32=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-wind | |||
| 8 | 8 | application.windows64=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-windows-amd64.jar,gluegen-rt-natives-windows-amd64.jar | |
| 9 | 9 | application.linux32=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-i586.jar,gluegen-rt-natives-linux-i586.jar | |
| 10 | 10 | application.linux64=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-amd64.jar,gluegen-rt-natives-linux-amd64.jar | |
| 11 | + application.linux-armv6hf=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-armv6hf.jar,gluegen-rt-natives-linux-armv6hf.jar | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,6 +35,7 @@ | |||
| 35 | 35 | import processing.app.Util; | |
| 36 | 36 | import processing.app.contrib.ModeContribution; | |
| 37 | 37 | import processing.core.PApplet; | |
| 38 | + import processing.core.PConstants; | ||
| 38 | 39 | import processing.mode.java.runner.Runner; | |
| 39 | 40 | ||
| 40 | 41 | ||
@@ -280,14 +281,9 @@ public Commander(String[] args) { | |||
| 280 | 281 | JavaBuild build = new JavaBuild(sketch); | |
| 281 | 282 | build.build(true); | |
| 282 | 283 | if (build != null) { | |
| 283 | - // if (platformBits == 0) { | ||
| 284 | - // platformBits = Base.getNativeBits(); | ||
| 285 | - // } | ||
| 286 | - // if (platformBits == 0 && | ||
| 287 | - // Library.hasMultipleArch(platform, build.getImportedLibraries())) { | ||
| 288 | - // complainAndQuit("This sketch can be exported for 32- or 64-bit, please specify one.", true); | ||
| 289 | - // } | ||
| 290 | - success = build.exportApplication(outputFolder, platform, platformBits, embedJava); | ||
| 284 | + | ||
| 285 | + String variant = Base.getVariant(); | ||
| 286 | + success = build.exportApplication(outputFolder, platform, variant, embedJava); | ||
| 291 | 287 | } | |
| 292 | 288 | } | |
| 293 | 289 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -796,17 +796,24 @@ protected boolean exportApplication() throws IOException, SketchException { | |||
| 796 | 796 | if (Library.hasMultipleArch(platform, importedLibraries)) { | |
| 797 | 797 | // export the 32-bit version | |
| 798 | 798 | folder = new File(sketch.getFolder(), "application." + platformName + "32"); | |
| 799 | - if (!exportApplication(folder, platform, 32, embedJava && Base.getNativeBits() == 32)) { | ||
| 799 | + if (!exportApplication(folder, platform, "32", embedJava && Base.getNativeBits() == 32 && "x86".equals(Base.getNativeArch()))) { | ||
| 800 | 800 | return false; | |
| 801 | 801 | } | |
| 802 | 802 | // export the 64-bit version | |
| 803 | 803 | folder = new File(sketch.getFolder(), "application." + platformName + "64"); | |
| 804 | - if (!exportApplication(folder, platform, 64, embedJava && Base.getNativeBits() == 64)) { | ||
| 804 | + if (!exportApplication(folder, platform, "64", embedJava && Base.getNativeBits() == 64 && "x86".equals(Base.getNativeArch()))) { | ||
| 805 | 805 | return false; | |
| 806 | 806 | } | |
| 807 | + if (platform == PConstants.LINUX) { | ||
| 808 | + // export the armv6hf version as well | ||
| 809 | + folder = new File(sketch.getFolder(), "application.linux-armv6hf"); | ||
| 810 | + if (!exportApplication(folder, platform, "armv6hf", embedJava && Base.getNativeBits() == 32 && "arm".equals(Base.getNativeArch()))) { | ||
| 811 | + return false; | ||
| 812 | + } | ||
| 813 | + } | ||
| 807 | 814 | } else { // just make a single one for this platform | |
| 808 | 815 | folder = new File(sketch.getFolder(), "application." + platformName); | |
| 809 | - if (!exportApplication(folder, platform, 0, embedJava)) { | ||
| 816 | + if (!exportApplication(folder, platform, "", embedJava)) { | ||
| 810 | 817 | return false; | |
| 811 | 818 | } | |
| 812 | 819 | } | |
@@ -847,18 +854,18 @@ protected boolean exportApplication() throws IOException, SketchException { | |||
| 847 | 854 | */ | |
| 848 | 855 | protected boolean exportApplication(File destFolder, | |
| 849 | 856 | int exportPlatform, | |
| 850 | - int exportBits, | ||
| 857 | + String exportVariant, | ||
| 851 | 858 | boolean embedJava) throws IOException, SketchException { | |
| 852 | 859 | // TODO this should probably be a dialog box instead of a warning | |
| 853 | 860 | // on the terminal. And the message should be written better than this. | |
| 854 | 861 | // http://code.google.com/p/processing/issues/detail?id=884 | |
| 855 | 862 | for (Library library : importedLibraries) { | |
| 856 | - if (!library.supportsArch(exportPlatform, exportBits)) { | ||
| 863 | + if (!library.supportsArch(exportPlatform, exportVariant)) { | ||
| 857 | 864 | String pn = PConstants.platformNames[exportPlatform]; | |
| 858 | 865 | Base.showWarning("Quibbles 'n Bits", | |
| 859 | - "The application." + pn + exportBits + | ||
| 866 | + "The application." + pn + exportVariant + | ||
| 860 | 867 | " folder will not be created\n" + | |
| 861 | - "because no " + exportBits + "-bit version of " + | ||
| 868 | + "because no " + exportVariant + " version of " + | ||
| 862 | 869 | library.getName() + " is available for " + pn, null); | |
| 863 | 870 | return true; // don't cancel all exports for this, just move along | |
| 864 | 871 | } | |
@@ -1062,7 +1069,7 @@ protected boolean exportApplication(File destFolder, | |||
| 1062 | 1069 | /// add contents of 'library' folders to the export | |
| 1063 | 1070 | for (Library library : importedLibraries) { | |
| 1064 | 1071 | // add each item from the library folder / export list to the output | |
| 1065 | - for (File exportFile : library.getApplicationExports(exportPlatform, exportBits)) { | ||
| 1072 | + for (File exportFile : library.getApplicationExports(exportPlatform, exportVariant)) { | ||
| 1066 | 1073 | // System.out.println("export: " + exportFile); | |
| 1067 | 1074 | String exportName = exportFile.getName(); | |
| 1068 | 1075 | if (!exportFile.exists()) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -90,9 +90,11 @@ public Runner(JavaBuild build, RunnerListener listener) throws SketchException { | |||
| 90 | 90 | ||
| 91 | 91 | // Make sure all the imported libraries will actually run with this setup. | |
| 92 | 92 | int bits = Base.getNativeBits(); | |
| 93 | + String variant = Base.getVariant(); | ||
| 94 | + | ||
| 93 | 95 | for (Library library : build.getImportedLibraries()) { | |
| 94 | - if (!library.supportsArch(PApplet.platform, bits)) { | ||
| 95 | - sketchErr.println(library.getName() + " does not run in " + bits + "-bit mode."); | ||
| 96 | + if (!library.supportsArch(PApplet.platform, variant)) { | ||
| 97 | + sketchErr.println(library.getName() + " does not run on this architecture: " + variant); | ||
| 96 | 98 | int opposite = (bits == 32) ? 64 : 32; | |
| 97 | 99 | if (Base.isMacOS()) { | |
| 98 | 100 | //if (library.supportsArch(PConstants.MACOSX, opposite)) { // should always be true | |
| Back | FazBrowse Home | New Git URL |
0 commit comments