Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
skiko
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liuqiang
skiko
Commits
52640c31
Unverified
Commit
52640c31
authored
Sep 06, 2022
by
dima.avdeev
Committed by
GitHub
Sep 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix skiko sample on iosSimulatorArm64 (#589)
parent
186bc0d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
61 deletions
+59
-61
README.md
samples/SkiaMultiplatformSample/README.md
+0
-1
build.gradle.kts
samples/SkiaMultiplatformSample/build.gradle.kts
+59
-60
No files found.
samples/SkiaMultiplatformSample/README.md
View file @
52640c31
# Skia multiplatform samples
# Skia multiplatform samples
## run iOS with Xcode
## run iOS with Xcode
-
Works only on Mac with Intel CPU (for now)
-
Install xcodegen
-
Install xcodegen
-
run
`xcodegen`
-
run
`xcodegen`
-
run
`open SkikoSample.xcodeproj`
-
run
`open SkikoSample.xcodeproj`
...
...
samples/SkiaMultiplatformSample/build.gradle.kts
View file @
52640c31
import
org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
buildscript
{
buildscript
{
repositories
{
repositories
{
mavenLocal
()
mavenLocal
()
...
@@ -14,7 +16,7 @@ buildscript {
...
@@ -14,7 +16,7 @@ buildscript {
plugins
{
plugins
{
kotlin
(
"multiplatform"
)
version
"1.6.10"
kotlin
(
"multiplatform"
)
version
"1.6.10"
id
(
"org.jetbrains.gradle.apple.applePlugin"
)
version
"222.
849-0.15.1
"
id
(
"org.jetbrains.gradle.apple.applePlugin"
)
version
"222.
3345.143-0.16
"
}
}
val
coroutinesVersion
=
"1.5.2"
val
coroutinesVersion
=
"1.5.2"
...
@@ -61,30 +63,20 @@ val unzipTask = tasks.register("unzipWasm", Copy::class) {
...
@@ -61,30 +63,20 @@ val unzipTask = tasks.register("unzipWasm", Copy::class) {
}
}
kotlin
{
kotlin
{
val
targets
=
mutableListOf
<
org
.
jetbrains
.
kotlin
.
gradle
.
plugin
.
mpp
.
KotlinNativeTarget
>()
if
(
hostOs
==
"macos"
)
{
if
(
hostOs
==
"macos"
)
{
val
nativeHostTarget
=
when
(
host
)
{
macosX64
()
{
"macos-x64"
->
macosX64
()
configureToLaunchFromXcode
()
"macos-arm64"
->
macosArm64
()
else
->
throw
GradleException
(
"Host OS is not supported yet"
)
}
}
targets
.
add
(
nativeHostTarget
)
macosArm64
()
{
configureToLaunchFromXcode
()
targets
.
add
(
iosX64
())
}
targets
.
add
(
iosArm64
())
ios
()
{
configureToLaunchFromAppCode
()
ios
{
configureToLaunchFromXcode
()
binaries
{
}
framework
{
iosSimulatorArm64
()
{
baseName
=
"shared"
configureToLaunchFromAppCode
()
freeCompilerArgs
+=
listOf
(
configureToLaunchFromXcode
()
"-linker-option"
,
"-framework"
,
"-linker-option"
,
"Metal"
,
"-linker-option"
,
"-framework"
,
"-linker-option"
,
"CoreText"
,
"-linker-option"
,
"-framework"
,
"-linker-option"
,
"CoreGraphics"
)
}
}
}
}
}
}
...
@@ -99,21 +91,6 @@ kotlin {
...
@@ -99,21 +91,6 @@ kotlin {
binaries
.
executable
()
binaries
.
executable
()
}
}
targets
.
forEach
{
it
.
apply
{
binaries
{
executable
{
entryPoint
=
"org.jetbrains.skiko.sample.main"
freeCompilerArgs
+=
listOf
(
"-linker-option"
,
"-framework"
,
"-linker-option"
,
"Metal"
,
"-linker-option"
,
"-framework"
,
"-linker-option"
,
"CoreText"
,
"-linker-option"
,
"-framework"
,
"-linker-option"
,
"CoreGraphics"
)
}
}
}
}
sourceSets
{
sourceSets
{
val
commonMain
by
getting
{
val
commonMain
by
getting
{
dependencies
{
dependencies
{
...
@@ -148,28 +125,16 @@ kotlin {
...
@@ -148,28 +125,16 @@ kotlin {
}
}
if
(
hostOs
==
"macos"
)
{
if
(
hostOs
==
"macos"
)
{
val
archTargetMain
=
when
(
host
)
{
val
macosX64Main
by
getting
{
"macos-x64"
->
{
dependsOn
(
macosMain
)
val
macosX64Main
by
getting
{
}
dependsOn
(
macosMain
)
val
macosArm64Main
by
getting
{
}
dependsOn
(
macosMain
)
macosX64Main
}
"macos-arm64"
->
{
val
macosArm64Main
by
getting
{
dependsOn
(
macosMain
)
}
macosArm64Main
}
else
->
throw
GradleException
(
"Host OS is not supported"
)
}
}
val
iosMain
by
getting
{
val
iosMain
by
getting
{
dependsOn
(
darwinMain
)
dependsOn
(
darwinMain
)
}
}
val
iosX64Main
by
getting
{
val
iosSimulatorArm64Main
by
getting
{
dependsOn
(
iosMain
)
}
val
iosArm64Main
by
getting
{
dependsOn
(
iosMain
)
dependsOn
(
iosMain
)
}
}
}
}
...
@@ -180,7 +145,12 @@ if (hostOs == "macos") {
...
@@ -180,7 +145,12 @@ if (hostOs == "macos") {
project
.
tasks
.
register
<
Exec
>(
"runIosSim"
)
{
project
.
tasks
.
register
<
Exec
>(
"runIosSim"
)
{
val
device
=
"iPhone 11"
val
device
=
"iPhone 11"
workingDir
=
project
.
buildDir
workingDir
=
project
.
buildDir
val
binTask
=
project
.
tasks
.
named
(
"linkReleaseExecutableIosX64"
)
val
linkExecutableTaskName
=
when
(
host
)
{
"macos-x64"
->
"linkReleaseExecutableIosX64"
"macos-arm64"
->
"linkReleaseExecutableIosSimulatorArm64"
else
->
throw
GradleException
(
"Host OS is not supported"
)
}
val
binTask
=
project
.
tasks
.
named
(
linkExecutableTaskName
)
dependsOn
(
binTask
)
dependsOn
(
binTask
)
commandLine
=
listOf
(
commandLine
=
listOf
(
"xcrun"
,
"xcrun"
,
...
@@ -234,7 +204,7 @@ tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile>().configureEach
...
@@ -234,7 +204,7 @@ tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile>().configureEach
enum
class
Target
(
val
simulator
:
Boolean
,
val
key
:
String
)
{
enum
class
Target
(
val
simulator
:
Boolean
,
val
key
:
String
)
{
WATCHOS_X86
(
true
,
"watchos"
),
WATCHOS_ARM64
(
false
,
"watchos"
),
WATCHOS_X86
(
true
,
"watchos"
),
WATCHOS_ARM64
(
false
,
"watchos"
),
IOS_X64
(
true
,
"iosX64"
),
IOS_ARM64
(
false
,
"iosArm64"
)
IOS_X64
(
true
,
"iosX64"
),
IOS_ARM64
(
false
,
"iosArm64"
)
,
IOS_SIMULATOR_ARM64
(
true
,
"iosSimulatorArm64"
)
}
}
...
@@ -245,10 +215,13 @@ if (hostOs == "macos") {
...
@@ -245,10 +215,13 @@ if (hostOs == "macos") {
val
target
=
sdkName
.
orEmpty
().
let
{
val
target
=
sdkName
.
orEmpty
().
let
{
when
{
when
{
it
.
startsWith
(
"iphoneos"
)
->
Target
.
IOS_ARM64
it
.
startsWith
(
"iphoneos"
)
->
Target
.
IOS_ARM64
it
.
startsWith
(
"iphonesimulator"
)
->
Target
.
IOS_X64
it
.
startsWith
(
"watchos"
)
->
Target
.
WATCHOS_ARM64
it
.
startsWith
(
"watchos"
)
->
Target
.
WATCHOS_ARM64
it
.
startsWith
(
"watchsimulator"
)
->
Target
.
WATCHOS_X86
it
.
startsWith
(
"watchsimulator"
)
->
Target
.
WATCHOS_X86
else
->
Target
.
IOS_X64
else
->
when
(
host
)
{
"macos-x64"
->
Target
.
IOS_X64
"macos-arm64"
->
Target
.
IOS_SIMULATOR_ARM64
else
->
throw
GradleException
(
"Host OS is not supported"
)
}
}
}
}
}
...
@@ -305,3 +278,29 @@ apple {
...
@@ -305,3 +278,29 @@ apple {
}
}
}
}
}
}
fun
KotlinNativeTarget
.
configureToLaunchFromAppCode
()
{
binaries
{
framework
{
baseName
=
"shared"
freeCompilerArgs
+=
listOf
(
"-linker-option"
,
"-framework"
,
"-linker-option"
,
"Metal"
,
"-linker-option"
,
"-framework"
,
"-linker-option"
,
"CoreText"
,
"-linker-option"
,
"-framework"
,
"-linker-option"
,
"CoreGraphics"
)
}
}
}
fun
KotlinNativeTarget
.
configureToLaunchFromXcode
()
{
binaries
{
executable
{
entryPoint
=
"org.jetbrains.skiko.sample.main"
freeCompilerArgs
+=
listOf
(
"-linker-option"
,
"-framework"
,
"-linker-option"
,
"Metal"
,
"-linker-option"
,
"-framework"
,
"-linker-option"
,
"CoreText"
,
"-linker-option"
,
"-framework"
,
"-linker-option"
,
"CoreGraphics"
)
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment