do check for whether all native libs are supported when running

This commit is contained in:
benfry
2011-11-12 23:13:49 +00:00
parent cddc18b090
commit cf6c895311
2 changed files with 16 additions and 2 deletions

View File

@@ -1644,6 +1644,12 @@ public class Base {
return PConstants.platformNames[PApplet.platform];
}
/**
* Return whether sketches will run as 32- or 64-bits. On Linux and Windows,
* this is the bit depth of the machine, while on OS X it's determined by the
* setting from preferences, since both 32- and 64-bit are supported.
*/
static public int getNativeBits() {
if (Base.isMacOS()) {
return Preferences.getInteger("run.options.bits");

View File

@@ -84,7 +84,7 @@ public class Runner implements MessageConsumer {
// private String appletClassName;
public Runner(JavaBuild build, RunnerListener listener) {
public Runner(JavaBuild build, RunnerListener listener) throws SketchException {
this.listener = listener;
// this.sketch = sketch;
this.build = build;
@@ -94,6 +94,14 @@ public class Runner implements MessageConsumer {
// } else {
// System.out.println("actually it's a " + listener.getClass().getName());
}
// Make sure all the imported libraries will actually run with this setup.
int bits = Base.getNativeBits();
for (Library library : build.getImportedLibraries()) {
if (!library.supportsArch(PApplet.platform, bits)) {
throw new SketchException(library.getName() + " does not run in " + bits + "-bit mode.");
}
}
}
@@ -281,7 +289,7 @@ public class Runner implements MessageConsumer {
"java -Xrunjdwp:transport=dt_shmem,address=" + addr + ",suspend=y ";
} else if (Base.isMacOS()) {
commandArgs =
"java -d" + Preferences.get("run.options.bits") +
"java -d" + Base.getNativeBits() + //Preferences.get("run.options.bits") +
" -Xrunjdwp:transport=dt_socket,address=" + addr + ",suspend=y ";
}