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
09d1b61f
Unverified
Commit
09d1b61f
authored
Nov 18, 2020
by
Nikolay Igotti
Committed by
GitHub
Nov 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Macos arm (#19)
parent
c412e811
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
40 deletions
+86
-40
build.gradle
samples/SkijaInjectSample/build.gradle
+19
-9
build.gradle.kts
skiko/build.gradle.kts
+21
-21
properties.kt
skiko/buildSrc/src/main/kotlin/properties.kt
+42
-7
gradle.properties
skiko/gradle.properties
+4
-3
No files found.
samples/SkijaInjectSample/build.gradle
View file @
09d1b61f
...
...
@@ -14,17 +14,27 @@ repositories {
}
}
def
os
=
System
.
getProperty
(
"os.name"
)
def
target
=
""
if
(
os
==
"Mac OS X"
)
{
target
=
"macos"
}
else
if
(
os
.
startsWith
(
"Win"
))
{
target
=
"windows"
}
else
if
(
os
.
startsWith
(
"Linux"
))
{
target
=
"linux"
def
os
Name
=
System
.
getProperty
(
"os.name"
)
def
target
Os
=
""
if
(
os
Name
==
"Mac OS X"
)
{
target
Os
=
"macos"
}
else
if
(
os
Name
.
startsWith
(
"Win"
))
{
target
Os
=
"windows"
}
else
if
(
os
Name
.
startsWith
(
"Linux"
))
{
target
Os
=
"linux"
}
else
{
throw
Error
(
"Unsupported OS: $
target
"
)
throw
Error
(
"Unsupported OS: $
os
"
)
}
def
osArch
=
System
.
getProperty
(
"os.arch"
)
def
targetArch
=
""
if
(
osArch
==
"x86_64"
)
{
targetArch
=
"x64"
}
else
if
(
osArch
==
"aarch64"
)
{
targetArch
=
"arm64"
}
else
{
throw
Error
(
"Unsupported arch: $osArch"
)
}
def
target
=
"${targetOs}_${targetArch}"
def
version
=
"0.1-SNAPSHOT"
if
(
project
.
hasProperty
(
'skiko.version'
))
{
...
...
skiko/build.gradle.kts
View file @
09d1b61f
...
...
@@ -142,11 +142,11 @@ kotlin {
withJava
()
}
val
isMingwX64
=
hostOs
.
startsWith
(
"Windows"
)
val
nativeTarget
=
when
{
hostOs
==
"Mac OS X"
->
macosX64
(
"native"
)
hostOs
==
"Linux"
->
linuxX64
(
"native"
)
isMingwX64
->
mingwX64
(
"native"
)
val
nativeTarget
=
when
(
targetOs
)
{
// TODO: not entirely correct for macOS ARM.
OS
.
MacOS
->
macosX64
(
"native"
)
OS
.
Linux
->
linuxX64
(
"native"
)
OS
.
Windows
->
mingwX64
(
"native"
)
else
->
throw
GradleException
(
"Host OS is not supported in Kotlin/Native."
)
}
...
...
@@ -221,8 +221,8 @@ tasks.withType(CppCompile::class.java).configureEach {
"-DSK_UNICODE_AVAILABLE"
,
"-DNDEBUG"
))
when
(
target
)
{
"macos"
->
{
when
(
target
Os
)
{
OS
.
MacOS
->
{
compilerArgs
.
addAll
(
listOf
(
"-std=c++14"
,
...
...
@@ -236,7 +236,7 @@ tasks.withType(CppCompile::class.java).configureEach {
)
)
}
"linux"
->
{
OS
.
Linux
->
{
compilerArgs
.
addAll
(
listOf
(
"-std=c++14"
,
...
...
@@ -249,7 +249,7 @@ tasks.withType(CppCompile::class.java).configureEach {
)
)
}
"windows"
->
{
OS
.
Windows
->
{
compilerArgs
.
addAll
(
listOf
(
"-I$jdkHome/include/win32"
,
...
...
@@ -271,7 +271,7 @@ tasks.withType(CppCompile::class.java).configureEach {
// Very hacky way to compile Objective-C sources and add the
// resulting object files into the final library.
project
.
tasks
.
register
<
Exec
>(
"objcCompile"
)
{
val
inputDir
=
"$projectDir/src/jvmMain/objectiveC/$
target
"
val
inputDir
=
"$projectDir/src/jvmMain/objectiveC/$
{targetOs.id}
"
val
outDir
=
"$buildDir/objc/$target"
val
objcSrc
=
"drawlayer"
commandLine
=
listOf
(
...
...
@@ -290,8 +290,8 @@ project.tasks.register<Exec>("objcCompile") {
}
tasks
.
withType
(
LinkSharedLibrary
::
class
.
java
).
configureEach
{
when
(
target
)
{
"macos"
->
{
when
(
target
Os
)
{
OS
.
MacOS
->
{
dependsOn
(
project
.
tasks
.
named
(
"objcCompile"
))
linkerArgs
.
addAll
(
listOf
(
...
...
@@ -308,7 +308,7 @@ tasks.withType(LinkSharedLibrary::class.java).configureEach {
)
)
}
"linux"
->
{
OS
.
Linux
->
{
linkerArgs
.
addAll
(
listOf
(
"-lGL"
,
...
...
@@ -316,7 +316,7 @@ tasks.withType(LinkSharedLibrary::class.java).configureEach {
)
)
}
"windows"
->
{
OS
.
Windows
->
{
linkerArgs
.
addAll
(
listOf
(
"gdi32.lib"
,
...
...
@@ -333,7 +333,7 @@ extensions.configure<CppLibrary> {
source
.
from
(
skijaDir
.
map
{
fileTree
(
it
.
resolve
(
"native/src"
))
},
fileTree
(
"$projectDir/src/jvmMain/cpp/common"
),
fileTree
(
"$projectDir/src/jvmMain/cpp/$
target
"
)
fileTree
(
"$projectDir/src/jvmMain/cpp/$
{targetOs.id}
"
)
)
}
...
...
@@ -345,8 +345,8 @@ library {
dependencies
{
implementation
(
skiaDir
.
map
{
fileTree
(
it
.
resolve
(
"out/Release-
x64
"
))
.
matching
{
include
(
if
(
target
==
"windows"
)
"**.lib"
else
"**.a"
)
}
fileTree
(
it
.
resolve
(
"out/Release-
${targetArch.id}
"
))
.
matching
{
include
(
if
(
target
Os
.
isWindows
)
"**.lib"
else
"**.a"
)
}
}
)
implementation
(
fileTree
(
"$buildDir/objc/$target"
).
matching
{
...
...
@@ -371,10 +371,10 @@ val skikoJvmJar: Provider<Jar> by tasks.registering(Jar::class) {
}
val
createChecksums
by
project
.
tasks
.
registering
(
org
.
gradle
.
crypto
.
checksum
.
Checksum
::
class
)
{
val
linkTask
=
project
.
tasks
.
named
(
"linkRelease${target.capitalize()}"
)
val
linkTask
=
project
.
tasks
.
named
(
"linkRelease${target
Os.id
.capitalize()}"
)
dependsOn
(
linkTask
)
files
=
linkTask
.
get
().
outputs
.
files
.
filter
{
it
.
isFile
}
+
if
(
target
==
"windows"
)
files
(
skiaDir
.
map
{
it
.
resolve
(
"out/Release-x64/icudtl.dat"
)
})
else
files
()
if
(
target
Os
.
isWindows
)
files
(
skiaDir
.
map
{
it
.
resolve
(
"out/Release-x64/icudtl.dat"
)
})
else
files
()
algorithm
=
Checksum
.
Algorithm
.
SHA256
outputDir
=
file
(
"$buildDir/checksums"
)
}
...
...
@@ -383,10 +383,10 @@ val skikoJvmRuntimeJar by project.tasks.registering(Jar::class) {
archiveBaseName
.
set
(
"skiko-$target"
)
dependsOn
(
createChecksums
)
from
(
skikoJvmJar
.
map
{
zipTree
(
it
.
archiveFile
)
})
from
(
project
.
tasks
.
named
(
"linkRelease${target.capitalize()}"
).
map
{
from
(
project
.
tasks
.
named
(
"linkRelease${target
Os.id
.capitalize()}"
).
map
{
it
.
outputs
.
files
.
filter
{
it
.
isFile
}
})
if
(
target
==
"windows"
)
{
if
(
target
Os
.
isWindows
)
{
from
(
files
(
skiaDir
.
map
{
it
.
resolve
(
"out/Release-x64/icudtl.dat"
)
}))
}
from
(
createChecksums
.
get
().
outputs
.
files
)
...
...
skiko/buildSrc/src/main/kotlin/properties.kt
View file @
09d1b61f
import
org.gradle.api.Project
import
java.io.File
val
hostOs
=
System
.
getProperty
(
"os.name"
)
val
target
=
when
{
hostOs
==
"Mac OS X"
->
"macos"
hostOs
==
"Linux"
->
"linux"
hostOs
.
startsWith
(
"Win"
)
->
"windows"
else
->
throw
Error
(
"Unknown os $hostOs"
)
enum
class
OS
(
val
id
:
String
)
{
Linux
(
"linux"
),
Windows
(
"windows"
),
MacOS
(
"macos"
)
;
val
isWindows
get
()
=
this
==
Windows
}
enum
class
Arch
(
val
id
:
String
)
{
X64
(
"x64"
),
Arm64
(
"arm64"
)
}
val
hostOs
by
lazy
{
val
osName
=
System
.
getProperty
(
"os.name"
)
when
{
osName
==
"Mac OS X"
->
OS
.
MacOS
osName
==
"Linux"
->
OS
.
Linux
osName
.
startsWith
(
"Win"
)
->
OS
.
Windows
else
->
throw
Error
(
"Unknown OS $osName"
)
}
}
val
hostArch
by
lazy
{
val
osArch
=
System
.
getProperty
(
"os.arch"
).
also
{
println
(
"arch is $it"
)
}
when
(
osArch
)
{
"x86_64"
->
Arch
.
X64
"aarch64"
->
Arch
.
Arm64
else
->
throw
Error
(
"Unknown arch $osArch"
)
}
}
val
targetOs
=
hostOs
val
targetArch
=
hostArch
val
target
=
"${targetOs.id}_${targetArch.id}"
val
jdkHome
=
System
.
getProperty
(
"java.home"
)
?:
error
(
"'java.home' is null"
)
class
SkikoProperties
(
private
val
myProject
:
Project
)
{
...
...
@@ -42,7 +76,8 @@ class SkikoProperties(private val myProject: Project) {
get
()
=
System
.
getenv
()[
"SKIJA_DIR"
]
?.
let
{
File
(
it
)
}
?.
takeIf
{
it
.
isDirectory
}
val
skiaDir
:
File
?
get
()
=
(
System
.
getenv
()[
"SKIA_DIR"
]
?:
System
.
getProperty
(
"skia.dir"
))
?.
let
{
File
(
it
)
}
?.
takeIf
{
it
.
isDirectory
}
get
()
=
(
System
.
getenv
()[
"SKIA_DIR"
]
?:
System
.
getProperty
(
"skia.dir"
))
?.
let
{
File
(
it
)
}
?.
takeIf
{
it
.
isDirectory
}
val
composeRepoUrl
:
String
get
()
=
System
.
getenv
(
"COMPOSE_REPO_URL"
)
?:
"https://maven.pkg.jetbrains.space/public/p/compose/dev"
...
...
skiko/gradle.properties
View file @
09d1b61f
...
...
@@ -2,6 +2,7 @@ kotlin.code.style=official
deploy.version
=
0.1
dependencies.skija.git.commit
=
8fc45764727610bd4b3d228198432f6f327a34ad
dependencies.skia.windows
=
m88-59bafeeaa7/Skia-m88-59bafeeaa7-windows-Release-x64
dependencies.skia.linux
=
m88-59bafeeaa7/Skia-m88-59bafeeaa7-linux-Release-x64
dependencies.skia.macos
=
m88-59bafeeaa7/Skia-m88-59bafeeaa7-macos-Release-x64
dependencies.skia.windows_x64
=
m88-59bafeeaa7/Skia-m88-59bafeeaa7-windows-Release-x64
dependencies.skia.linux_x64
=
m88-59bafeeaa7/Skia-m88-59bafeeaa7-linux-Release-x64
dependencies.skia.macos_x64
=
m88-59bafeeaa7/Skia-m88-59bafeeaa7-macos-Release-x64
dependencies.skia.macos_arm64
=
m88-59bafeeaa7/Skia-m88-59bafeeaa7-macos-Release-arm64
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