Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve native library loading #34

Merged
merged 14 commits into from
Dec 28, 2022
Merged
19 changes: 11 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ jobs:
- uses: actions/upload-artifact@v2
with:
name: macos-x64-jars
path: target/skija-macos-x64-*.jar
path: target/skija-macos-x64-*
- run: python3 script/clean.py
- run: python3 script/build.py --arch arm64
- run: python3 script/package_platform.py --arch arm64
- uses: actions/upload-artifact@v2
with:
name: macos-arm64-jars
path: target/skija-macos-arm64-*.jar
path: target/skija-macos-arm64-*

build_linux:
runs-on: ubuntu-20.04
Expand All @@ -63,8 +63,8 @@ jobs:
- run: python3 script/package_platform.py
- uses: actions/upload-artifact@v2
with:
name: linux-jars
path: target/skija-linux-*.jar
name: linux-x64-jars
path: target/skija-linux-x64-*

build_windows:
runs-on: windows-2019
Expand All @@ -83,8 +83,8 @@ jobs:
- run: python3 script/package_platform.py
- uses: actions/upload-artifact@v2
with:
name: windows-jars
path: target/skija-windows-*.jar
name: windows-x64-jars
path: target/skija-windows-x64-*

release:
if: startsWith(github.ref, 'refs/tags/')
Expand All @@ -109,11 +109,11 @@ jobs:
path: target
- uses: actions/download-artifact@v2
with:
name: linux-jars
name: linux-x64-jars
path: target
- uses: actions/download-artifact@v2
with:
name: windows-jars
name: windows-x64-jars
path: target
- name: Release to Maven Central
run: |
Expand All @@ -123,3 +123,6 @@ jobs:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
- uses: softprops/action-gh-release@v1
with:
files: target/*.jmod
2 changes: 1 addition & 1 deletion examples/bitmap/script/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def main():
else:
build.main()
classpath += [
os.path.join('..', '..', 'platform', 'target', 'classes'),
os.path.join('..', '..', 'platform', 'target', common.classifier, 'classes'),
os.path.join('..', '..', 'shared', 'target', 'classes-java9'),
os.path.join('..', '..', 'shared', 'target', 'classes')
]
Expand Down
2 changes: 1 addition & 1 deletion examples/clojure-snake/deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
org.lwjgl/lwjgl-opengl {:mvn/version "3.2.3"}
io.github.humbleui/types {:mvn/version "0.1.2"}
}
:paths ["src" "../../platform/build" "../../platform/target/classes" "../../shared/target/classes-java9" "../../shared/target/classes"]
:paths ["src" "../../shared/target/classes-java9" "../../shared/target/classes"]
:aliases {
:macos {
:extra-deps {
Expand Down
11 changes: 8 additions & 3 deletions examples/clojure-snake/script/run.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#! /usr/bin/env python3
import os, platform, subprocess, sys
import os, subprocess, sys
sys.path.append(os.path.normpath(os.path.dirname(__file__) + '/../../../script'))
import build_utils, common

def main():
os.chdir(os.path.join(os.path.dirname(__file__), os.pardir))
system = {'Darwin': 'macos', 'Linux': 'linux', 'Windows': 'windows'}[platform.system()]
subprocess.check_call(["clj", "-M:" + system, "-m", "snake.main"])
subprocess.check_call([
"clj",
"-J--module-path=" + os.path.join('..', '..', 'platform', 'target', common.classifier, 'classes'),
"-M:" + build_utils.system,
"-m", "snake.main"])
return 0

if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion examples/clojure/deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
nrepl/nrepl {:mvn/version "0.8.3"}
io.github.humbleui/types {:mvn/version "0.1.2"}
}
:paths ["src" "../../platform/build" "../../platform/target/classes" "../../shared/target/classes-java9" "../../shared/target/classes" ]
:paths ["src" "../../shared/target/classes-java9" "../../shared/target/classes" ]
:aliases {
:macos {
:extra-deps {
Expand Down
11 changes: 8 additions & 3 deletions examples/clojure/script/run.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#! /usr/bin/env python3
import os, platform, subprocess, sys
import os, subprocess, sys
sys.path.append(os.path.normpath(os.path.dirname(__file__) + '/../../../script'))
import build_utils, common

def main():
os.chdir(os.path.join(os.path.dirname(__file__), os.pardir))
system = {'Darwin': 'macos', 'Linux': 'linux', 'Windows': 'windows'}[platform.system()]
subprocess.check_call(["clj", "-M:" + system, "-m", "lwjgl.main"])
subprocess.check_call([
"clj",
"-J--module-path=" + os.path.join('..', '..', 'platform', 'target', common.classifier, 'classes'),
"-M:" + build_utils.system,
"-m", "lwjgl.main"])
return 0

if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion examples/jwm/script/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def main():
else:
build.main()
classpath += [
os.path.join('..', '..', 'platform', 'target', 'classes'),
os.path.join('..', '..', 'platform', 'target', common.classifier, 'classes'),
os.path.join('..', '..', 'shared', 'target', 'classes-java9'),
os.path.join('..', '..', 'shared', 'target', 'classes')
]
Expand Down
5 changes: 2 additions & 3 deletions examples/jwm/src/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ public class Main implements Consumer<Event> {
public Main() {
Stats.enabled = true;

switch (io.github.humbleui.skija.impl.Platform.CURRENT) {
case MACOS_X64:
case MACOS_ARM64:
switch (io.github.humbleui.skija.impl.OperatingSystem.CURRENT) {
case MACOS:
_layers = new String[] { "Metal", "GL" };
break;
case WINDOWS:
Expand Down
4 changes: 2 additions & 2 deletions examples/kwinit/script/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def main():
else:
build.main()
classpath += [
os.path.join('..', '..', 'platform', 'target', 'classes'),
os.path.join('..', '..', 'platform', 'target', common.classifier, 'classes'),
os.path.join('..', '..', 'shared', 'target', 'classes-java9'),
os.path.join('..', '..', 'shared', 'target', 'classes')
]
Expand All @@ -41,7 +41,7 @@ def main():
# if 'windows' == build_utils.system:
# env['KWINIT_ANGLE'] = '1'

common.check_call([
subprocess.check_call([
'java',
'--class-path', build_utils.classpath_join(['target/classes'] + classpath)]
+ (['-XstartOnFirstThread'] if 'macos' == build_utils.system else [])
Expand Down
2 changes: 1 addition & 1 deletion examples/lwjgl/script/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def main():
else:
build.main()
classpath += [
os.path.join('..', '..', 'platform', 'target', 'classes'),
os.path.join('..', '..', 'platform', 'target', common.classifier, 'classes'),
os.path.join('..', '..', 'shared', 'target', 'classes-java9'),
os.path.join('..', '..', 'shared', 'target', 'classes')
]
Expand Down
2 changes: 1 addition & 1 deletion examples/swt/script/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def main():
else:
build.main()
classpath += [
os.path.join('..', '..', 'platform', 'target', 'classes'),
os.path.join('..', '..', 'platform', 'target', common.classifier, 'classes'),
os.path.join('..', '..', 'shared', 'target', 'classes-java9'),
os.path.join('..', '..', 'shared', 'target', 'classes')
]
Expand Down
1 change: 0 additions & 1 deletion platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ if(APPLE)
add_definitions(-DSK_ENABLE_API_AVAILABLE
-DSK_METAL
-DSK_SHAPER_CORETEXT_AVAILABLE)
set_target_properties(skija PROPERTIES OUTPUT_NAME "skija_${SKIA_ARCH}")

elseif(UNIX)
target_include_directories(skija PRIVATE $ENV{JAVA_HOME}/include $ENV{JAVA_HOME}/include/linux)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
artifactId=skija-linux
artifactId=${artifact}
groupId=io.github.humbleui
version=${version}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<modelVersion>4.0.0</modelVersion>

<groupId>io.github.humbleui</groupId>
<artifactId>skija-linux</artifactId>
<artifactId>${artifact}</artifactId>
<version>${version}</version>
<packaging>jar</packaging>

<name>io.github.humbleui:skija-linux</name>
<name>io.github.humbleui:${artifact}</name>
<description>Java bindings for Skia</description>
<url>https://github.com/humbleui/skija</url>

Expand All @@ -33,8 +33,8 @@
</scm>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>9</maven.compiler.source>
<maven.compiler.target>9</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions platform/java-linux/LibraryFinder.java

This file was deleted.

4 changes: 0 additions & 4 deletions platform/java-linux/module-info.java

This file was deleted.

Loading