From bc9016decb4f663411cd3c8d74c1482792d847db Mon Sep 17 00:00:00 2001 From: "jose.pereda" Date: Fri, 6 Sep 2024 17:09:04 +0200 Subject: [PATCH] macOS fixes --- .../substrate/target/AbstractTargetConfiguration.java | 4 ++-- .../substrate/target/MacOSTargetConfiguration.java | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/gluonhq/substrate/target/AbstractTargetConfiguration.java b/src/main/java/com/gluonhq/substrate/target/AbstractTargetConfiguration.java index fb3c1ffe..7f160b43 100644 --- a/src/main/java/com/gluonhq/substrate/target/AbstractTargetConfiguration.java +++ b/src/main/java/com/gluonhq/substrate/target/AbstractTargetConfiguration.java @@ -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) { @@ -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: diff --git a/src/main/java/com/gluonhq/substrate/target/MacOSTargetConfiguration.java b/src/main/java/com/gluonhq/substrate/target/MacOSTargetConfiguration.java index 8791be0b..57de4930 100644 --- a/src/main/java/com/gluonhq/substrate/target/MacOSTargetConfiguration.java +++ b/src/main/java/com/gluonhq/substrate/target/MacOSTargetConfiguration.java @@ -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; @@ -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 javaDarwinLibs = Arrays.asList("pthread", "z", "dl", "stdc++"); private static final List javaDarwinFrameworks = Arrays.asList("Foundation", "AppKit"); @@ -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 @@ -93,14 +97,14 @@ List getTargetSpecificLinkOutputFlags() { @Override List getTargetSpecificCCompileFlags() { - return Arrays.asList("-mmacosx-version-min=" + MIN_MACOS_VERSION); + return Arrays.asList("-mmacosx-version-min=" + minVersion); } @Override List getTargetSpecificLinkFlags(boolean useJavaFX, boolean usePrismSW) { List 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",