Add JavaFX module args and auto-detect mac/mac-aarch64 platform
--add-modules javafx.media,javafx.swing,javafx.graphics needed for native codec loading on macOS (AVFoundation for MOV playback). Platform auto-detects mac-aarch64 vs mac based on os.arch.
This commit is contained in:
@@ -33,19 +33,31 @@ dependencies {
|
||||
implementation(libs.logback.classic)
|
||||
|
||||
// JavaFX media for Live Photo video playback in preview dialog
|
||||
// Using OpenJFX which works with both Corretto and other JDK distributions
|
||||
val javafxVersion = "21.0.3"
|
||||
val javafxPlatform = "mac" // mac, mac-aarch64, win, linux
|
||||
// Detect platform: mac-aarch64 for Apple Silicon, mac for Intel
|
||||
val osArch = System.getProperty("os.arch") ?: "x86_64"
|
||||
val javafxPlatform = when {
|
||||
System.getProperty("os.name").contains("Mac", ignoreCase = true) && osArch.contains("aarch64") -> "mac-aarch64"
|
||||
System.getProperty("os.name").contains("Mac", ignoreCase = true) -> "mac"
|
||||
System.getProperty("os.name").contains("Win", ignoreCase = true) -> "win"
|
||||
else -> "linux"
|
||||
}
|
||||
implementation("org.openjfx:javafx-media:$javafxVersion:$javafxPlatform")
|
||||
implementation("org.openjfx:javafx-swing:$javafxVersion:$javafxPlatform")
|
||||
implementation("org.openjfx:javafx-graphics:$javafxVersion:$javafxPlatform")
|
||||
implementation("org.openjfx:javafx-base:$javafxVersion:$javafxPlatform")
|
||||
implementation("org.openjfx:javafx-controls:$javafxVersion:$javafxPlatform")
|
||||
}
|
||||
|
||||
compose.desktop {
|
||||
application {
|
||||
mainClass = "com.bolenpad.photophetch.MainKt"
|
||||
|
||||
jvmArgs(
|
||||
"--add-modules", "javafx.media,javafx.swing,javafx.graphics",
|
||||
"--add-opens", "javafx.graphics/com.sun.javafx.application=ALL-UNNAMED",
|
||||
)
|
||||
|
||||
nativeDistributions {
|
||||
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
|
||||
packageName = "PhotoPhetch"
|
||||
|
||||
Reference in New Issue
Block a user