Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS fixes #1274

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading