Skip to content

Commit

Permalink
Display supported platforms in block dialog for FMI 3.0 (#419)
Browse files Browse the repository at this point in the history
fixes #416
  • Loading branch information
t-sommer committed Apr 29, 2023
1 parent c579f1d commit 7cc7d66
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions Java/src/main/java/fmikit/ui/FMUBlockDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -1252,8 +1252,10 @@ private List<String> getPlatforms() {

ArrayList<String> platforms = new ArrayList<String>();

Implementation implementation = modelDescription.coSimulation != null ? modelDescription.coSimulation : modelDescription.modelExchange;
final Implementation implementation = modelDescription.coSimulation != null ? modelDescription.coSimulation : modelDescription.modelExchange;
final String modelIdentifier = implementation.modelIdentifier;

// FMI 1.0 & 2.0
if (!implementation.sourceFiles.isEmpty()) {

boolean hasSources = true;
Expand All @@ -1271,8 +1273,6 @@ private List<String> getPlatforms() {

}

String modelIdentifier = implementation.modelIdentifier;

if (Util.isFile(unzipdir, "binaries", "darwin64", modelIdentifier + ".dylib")) {
platforms.add("darwin64");
}
Expand All @@ -1293,6 +1293,31 @@ private List<String> getPlatforms() {
platforms.add("win64");
}

// FMI 3.0
if (Util.isFile(unzipdir, "sources", "buildDescription.xml")) {
platforms.add("c-code");
}

if (Util.isFile(unzipdir, "binaries", "x86_64-darwin", modelIdentifier + ".dylib")) {
platforms.add("x86_64-darwin");
}

if (Util.isFile(unzipdir, "binaries", "x86-linux", modelIdentifier + ".so")) {
platforms.add("x86-linux");
}

if (Util.isFile(unzipdir, "binaries", "x86_64-linux", modelIdentifier + ".so")) {
platforms.add("x86_64-linux");
}

if (Util.isFile(unzipdir, "binaries", "x86-windows", modelIdentifier + ".dll")) {
platforms.add("x86-windows");
}

if (Util.isFile(unzipdir, "binaries", "x86_64-windows", modelIdentifier + ".dll")) {
platforms.add("x86_64-windows");
}

return platforms;
}

Expand Down

0 comments on commit 7cc7d66

Please sign in to comment.