Skip to content

Commit fa01736

Browse files
committed
example: macOS: Use nativeApplication instead of tasks.register<Exec>
1 parent d214ac9 commit fa01736

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

example/build.gradle.kts

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ kotlin {
3737
it.binaries.framework {
3838
baseName = appName + "Framework"
3939
isStatic = true
40-
freeCompilerArgs += "-Xbinary=bundleId=$pkgName.framework"
40+
freeCompilerArgs += listOf(
41+
"-Xbinary=bundleId=$pkgName.framework",
42+
"-linker-option", "-framework", "-linker-option", "Metal",
43+
"-linker-option", "-framework", "-linker-option", "CoreText",
44+
"-linker-option", "-framework", "-linker-option", "CoreGraphics"
45+
)
4146
xcf.add(this)
4247
}
4348
}
@@ -167,19 +172,33 @@ android {
167172
compose.desktop {
168173
application {
169174
mainClass = "Main_desktopKt"
170-
171175
buildTypes.release.proguard {
172176
configurationFiles.from("proguard-rules-jvm.pro")
173177
version.set("7.6.1")
174178
optimize.set(false)
175179
}
176-
177180
nativeDistributions {
178181
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
179182
packageName = appName
180183
packageVersion = verName
181184
}
182185
}
186+
nativeApplication {
187+
targets(kotlin.targets.getByName("macosArm64"))
188+
distributions {
189+
targetFormats(TargetFormat.Dmg)
190+
packageName = "$appName-MacosArm64-Native"
191+
packageVersion = verName
192+
}
193+
}
194+
nativeApplication {
195+
targets(kotlin.targets.getByName("macosX64"))
196+
distributions {
197+
targetFormats(TargetFormat.Dmg)
198+
packageName = "$appName-MacosX64-Native"
199+
packageVersion = verName
200+
}
201+
}
183202
}
184203

185204
fun getGitCommitCount(): Int {
@@ -212,19 +231,3 @@ val generateVersionInfo by tasks.registering {
212231
tasks.withType<KotlinCompile>().configureEach {
213232
dependsOn(generateVersionInfo)
214233
}
215-
216-
tasks.register<Exec>("assembleMacosArm64ReleaseBinary") {
217-
dependsOn(":example:desktopTest", ":example:linkReleaseExecutableMacosArm64")
218-
commandLine("lipo", "-create", "-output", "Miuix_macOSArm64", "bin/macosArm64/releaseExecutable/Miuix.kexe")
219-
workingDir = layout.buildDirectory.get().asFile
220-
group = "macos native"
221-
description = "Build macOS Arm64 Binary"
222-
}
223-
224-
tasks.register<Exec>("assembleMacosX64ReleaseBinary") {
225-
dependsOn(":example:desktopTest", ":example:linkReleaseExecutableMacosX64")
226-
commandLine("lipo", "-create", "-output", "Miuix_macOSX64", "bin/macosX64/releaseExecutable/Miuix.kexe")
227-
workingDir = layout.buildDirectory.get().asFile
228-
group = "macos native"
229-
description = "Build macOS X64 Binary"
230-
}

0 commit comments

Comments
 (0)