Skip to content

Commit

Permalink
macOS fixes (#1274)
Browse files Browse the repository at this point in the history
  • Loading branch information
jperedadnr authored Sep 6, 2024
1 parent f93489a commit 28e2103
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ private String getJniPlatformArg() {
private String getJniPlatform() {
Triplet target = projectConfiguration.getTargetTriplet();
Version graalVersion = projectConfiguration.getGraalVersion();
boolean graalVM221 = ((graalVersion.getMajor() > 21) && (graalVersion.getMinor() > 0));
boolean graalVM221or23 = graalVersion.getMajor() > 22 || (graalVersion.getMajor() > 21 && graalVersion.getMinor() > 0);
String os = target.getOs();
String arch = target.getArch();
switch (os) {
Expand All @@ -429,7 +429,7 @@ private String getJniPlatform() {
case Constants.OS_DARWIN:
switch (arch) {
case Constants.ARCH_AMD64:
return graalVM221 ? "MACOS_AMD64" : "DARWIN_AMD64";
return graalVM221or23 ? "MACOS_AMD64" : "DARWIN_AMD64";
case Constants.ARCH_AARCH64:
return "MACOS_AARCH64";
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*/
package com.gluonhq.substrate.target;

import com.gluonhq.substrate.Constants;
import com.gluonhq.substrate.model.InternalProjectConfiguration;
import com.gluonhq.substrate.model.ProcessPaths;
import com.gluonhq.substrate.util.FileOps;
Expand All @@ -46,7 +47,8 @@

public class MacOSTargetConfiguration extends DarwinTargetConfiguration {

private static final String MIN_MACOS_VERSION = "11";
private static final String MIN_MACOS_VERSION_AMD64 = "11";
private static final String MIN_MACOS_VERSION_AARCH64 = "12";

private static final List<String> javaDarwinLibs = Arrays.asList("pthread", "z", "dl", "stdc++");
private static final List<String> javaDarwinFrameworks = Arrays.asList("Foundation", "AppKit");
Expand All @@ -65,9 +67,11 @@ public class MacOSTargetConfiguration extends DarwinTargetConfiguration {
"icui18n", "SqliteJava", "XSLTJava", "PAL", "WebCoreTestSupport",
"WTF", "icuuc", "icudata"
);
private final String minVersion;

public MacOSTargetConfiguration(ProcessPaths paths, InternalProjectConfiguration configuration) {
super(paths, configuration);
minVersion = Constants.ARCH_AMD64.equals(projectConfiguration.getTargetTriplet().getArch()) ? MIN_MACOS_VERSION_AMD64 : MIN_MACOS_VERSION_AARCH64;
}

@Override
Expand All @@ -93,14 +97,14 @@ List<String> getTargetSpecificLinkOutputFlags() {

@Override
List<String> getTargetSpecificCCompileFlags() {
return Arrays.asList("-mmacosx-version-min=" + MIN_MACOS_VERSION);
return Arrays.asList("-mmacosx-version-min=" + minVersion);
}

@Override
List<String> getTargetSpecificLinkFlags(boolean useJavaFX, boolean usePrismSW) {
List<String> linkFlags = new ArrayList<>(asListOfLibraryLinkFlags(javaDarwinLibs));

linkFlags.add("-mmacosx-version-min=" + MIN_MACOS_VERSION);
linkFlags.add("-mmacosx-version-min=" + minVersion);
if (projectConfiguration.isSharedLibrary()) {
linkFlags.addAll(Arrays.asList(
"-shared",
Expand Down

0 comments on commit 28e2103

Please sign in to comment.