Unverified Commit ae47b1d7 authored by Nikolay Igotti's avatar Nikolay Igotti Committed by GitHub

Move to Kotlin 1.5.10, improve cross-compilation. (#130)

parent 913a31a1
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
kotlin("jvm") version "1.3.72" kotlin("jvm") version "1.5.10"
application application
} }
......
...@@ -18,7 +18,7 @@ import java.io.File ...@@ -18,7 +18,7 @@ import java.io.File
import java.nio.file.Files import java.nio.file.Files
import javax.imageio.ImageIO import javax.imageio.ImageIO
fun main(args: Array<String>) { fun main() {
val windows = 1 val windows = 1
repeat(windows) { repeat(windows) {
createWindow("window $it", windows == 1) createWindow("window $it", windows == 1)
......
...@@ -6,7 +6,7 @@ import org.jetbrains.kotlin.gradle.tasks.CInteropProcess ...@@ -6,7 +6,7 @@ import org.jetbrains.kotlin.gradle.tasks.CInteropProcess
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile
plugins { plugins {
kotlin("multiplatform") version "1.4.30" kotlin("multiplatform") version "1.5.10"
`cpp-library` `cpp-library`
`maven-publish` `maven-publish`
id("org.gradle.crypto.checksum") version "1.1.0" id("org.gradle.crypto.checksum") version "1.1.0"
...@@ -286,6 +286,7 @@ tasks.withType(CppCompile::class.java).configureEach { ...@@ -286,6 +286,7 @@ tasks.withType(CppCompile::class.java).configureEach {
"-DSK_SHAPER_CORETEXT_AVAILABLE", "-DSK_SHAPER_CORETEXT_AVAILABLE",
"-DSK_BUILD_FOR_MAC", "-DSK_BUILD_FOR_MAC",
"-DSK_METAL", "-DSK_METAL",
*targetArch.clangFlags,
*buildType.clangFlags *buildType.clangFlags
) )
) )
...@@ -342,6 +343,7 @@ project.tasks.register<Exec>("objcCompile") { ...@@ -342,6 +343,7 @@ project.tasks.register<Exec>("objcCompile") {
val skiaDir = skiaDir.get().absolutePath val skiaDir = skiaDir.get().absolutePath
commandLine = listOf( commandLine = listOf(
"clang", "clang",
*targetArch.clangFlags,
"-mmacosx-version-min=10.13", "-mmacosx-version-min=10.13",
"-I$jdkHome/include", "-I$jdkHome/include",
"-I$jdkHome/include/darwin", "-I$jdkHome/include/darwin",
...@@ -428,6 +430,7 @@ tasks.withType(LinkSharedLibrary::class.java).configureEach { ...@@ -428,6 +430,7 @@ tasks.withType(LinkSharedLibrary::class.java).configureEach {
dependsOn(project.tasks.named("objcCompile")) dependsOn(project.tasks.named("objcCompile"))
linkerArgs.addAll( linkerArgs.addAll(
listOf( listOf(
*targetArch.clangFlags,
"-dead_strip", "-dead_strip",
"-framework", "AppKit", "-framework", "AppKit",
"-framework", "CoreFoundation", "-framework", "CoreFoundation",
......
...@@ -11,9 +11,9 @@ enum class OS(val id: String) { ...@@ -11,9 +11,9 @@ enum class OS(val id: String) {
get() = this == Windows get() = this == Windows
} }
enum class Arch(val id: String) { enum class Arch(val id: String, val clangFlags: Array<String>) {
X64("x64"), X64("x64", arrayOf("-arch", "x86_64")),
Arm64("arm64"), Arm64("arm64", arrayOf("-arch", "arm64"))
} }
enum class SkiaBuildType( enum class SkiaBuildType(
......
...@@ -39,7 +39,7 @@ val hostId by lazy { ...@@ -39,7 +39,7 @@ val hostId by lazy {
} }
internal val hostFullName by lazy { internal val hostFullName by lazy {
"${System.getProperty("os.name")}, ${System.getProperty("os.version")}, ${hostArch.toString().toLowerCase()}" "${System.getProperty("os.name")}, ${System.getProperty("os.version")}, ${hostArch.id}"
} }
internal val javaVendor by lazy { internal val javaVendor by lazy {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment