Skip to content

Commit

Permalink
Add JVM target (#5)
Browse files Browse the repository at this point in the history
- Use KJna
- Add flake.nix
- Remove native Windows target
  • Loading branch information
toasterofbread authored Jun 23, 2024
1 parent 6dde651 commit 35275d8
Show file tree
Hide file tree
Showing 124 changed files with 2,547 additions and 1,972 deletions.
48 changes: 24 additions & 24 deletions .github/workflows/build-linux-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,23 @@ jobs:

env:
TOOLCHAIN_VERSION: aarch64-unknown-linux-gnu-gcc-8.3.0-glibc-2.25-kernel-4.9-2
JAVA_HOME: /usr/lib/jvm/java-17-openjdk/
JAVA_HOME: /usr/lib/jvm/java-21-openjdk/

steps:
- run: echo "TOOLCHAIN=$GITHUB_WORKSPACE/toolchain" >> $GITHUB_ENV
- run: echo "SPMS_ARCH=arm64" >> $GITHUB_ENV

- run: apt update
- run: apt install -y nodejs
if: env.ACT

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
java-version: |
22
21
- name: Test Java
run: $JAVA_HOME/bin/java --version
Expand Down Expand Up @@ -82,8 +85,8 @@ jobs:
working-directory: zeromq-4.3.5
run: make -j$(nproc) && make install

- name: Copy libzmq into src/nativeInterop/linux-arm64
run: mkdir -p src/nativeInterop/linux-arm64 && cp -r libzmq/* src/nativeInterop/linux-arm64
- name: Copy libzmq into library/src/nativeInterop/linuxArm64
run: mkdir -p library/src/nativeInterop/linuxArm64 && cp -r libzmq/* library/src/nativeInterop/linuxArm64

- name: Add arm64 architecture to dpkg
run: dpkg --add-architecture arm64
Expand Down Expand Up @@ -117,48 +120,45 @@ jobs:
- name: Install arm64 development libraries
run: |
apt update
apt install -y libmpv-dev:arm64 libappindicator3-dev:arm64
apt-get update
apt-get install -y libmpv-dev:arm64 libayatana-appindicator3-dev:arm64
- name: Set up Gradle
uses: gradle/gradle-build-action@v3

- name: Grant execute permission for gradlew
run: chmod +x gradle

- name: Build linux-arm64 binaries
run: ./gradlew linux-arm64Binaries -PLINK_STATIC
- name: Build Linux Arm64 minimal binaries
run: ./gradlew app:linuxArm64Binaries -PMINIMAL --stacktrace

- name: Strip release binary
run: $TOOLCHAIN/bin/aarch64-unknown-linux-gnu-strip build/bin/linux-arm64/releaseExecutable/*.kexe
run: $TOOLCHAIN/bin/aarch64-unknown-linux-gnu-strip app/build/bin/linuxArm64/releaseExecutable/*.kexe

- name: Upload debug binary
uses: actions/upload-artifact@v3
with:
name: spms-linux-arm64-debug
path: build/bin/linux-arm64/debugExecutable/*.kexe
name: spms-minimal-linux-arm64-debug
path: app/build/bin/linuxArm64/debugExecutable/*.kexe

- name: Upload release binary
uses: actions/upload-artifact@v3
with:
name: spms-linux-arm64-release
path: build/bin/linux-arm64/releaseExecutable/*.kexe
name: spms-minimal-linux-arm64-release
path: app/build/bin/linuxArm64/releaseExecutable/*.kexe

- name: Build linux-arm64 binaries without mpv
run: ./gradlew linux-arm64Binaries -PLINK_STATIC -PDISABLE_MPV
- name: Build Linux Arm64 full binaries
run: ./gradlew app:linuxArm64Binaries --stacktrace

- name: Strip release binary
run: $TOOLCHAIN/bin/aarch64-unknown-linux-gnu-strip build/bin/linux-arm64/releaseExecutable/*.kexe
run: $TOOLCHAIN/bin/aarch64-unknown-linux-gnu-strip app/build/bin/linuxArm64/releaseExecutable/*.kexe

- name: Upload debug binary
uses: actions/upload-artifact@v3
with:
name: spms-nompv-linux-arm64-debug
path: build/bin/linux-arm64/debugExecutable/*.kexe
name: spms-linux-arm64-debug
path: app/build/bin/linuxArm64/debugExecutable/*.kexe

- name: Upload release binary
uses: actions/upload-artifact@v3
with:
name: spms-nompv-linux-arm64-release
path: build/bin/linux-arm64/releaseExecutable/*.kexe
name: spms-linux-arm64-release
path: app/build/bin/linuxArm64/releaseExecutable/*.kexe

52 changes: 24 additions & 28 deletions .github/workflows/build-linux-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,27 @@ jobs:

env:
TOOLCHAIN_VERSION: x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9-2
JAVA_HOME: /usr/lib/jvm/java-17-openjdk/
JAVA_HOME: /usr/lib/jvm/java-21-openjdk/

steps:
- run: echo "TOOLCHAIN=$GITHUB_WORKSPACE/toolchain" >> $GITHUB_ENV

- run: apt update
- run: apt-get update

- run: apt install -y nodejs
- run: apt-get install -y nodejs
if: env.ACT
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
java-version: |
22
21
- name: Test Java
run: $JAVA_HOME/bin/java --version

- run: apt install -y --reinstall git make wget pkg-config libmpv-dev libcurl4-openssl-dev libappindicator3-dev
- run: apt-get install -y --reinstall git make wget pkg-config libmpv-dev libcurl4-openssl-dev libayatana-appindicator3-dev

- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -80,50 +82,44 @@ jobs:
working-directory: zeromq-4.3.5
run: make -j$(nproc) && make install

- name: Copy libzmq into src/nativeInterop/linux-x86_64
run: mkdir -p src/nativeInterop/linux-x86_64 && cp -r libzmq/* src/nativeInterop/linux-x86_64
- name: Copy libzmq into library/src/nativeInterop/linuxX64
run: mkdir -p library/src/nativeInterop/linuxX64 && cp -r libzmq/* library/src/nativeInterop/linuxX64

- name: Set up Gradle
uses: gradle/gradle-build-action@v3

- name: Grant execute permission for gradlew
run: chmod +x gradle

- name: Build linux-x86_64 binaries
run: ./gradlew linux-x86_64Binaries -PLINK_STATIC
- name: Build Linux x86_64 minimal binaries
run: ./gradlew app:linuxX64Binaries -PMINIMAL --stacktrace

- name: Strip release binary
run: $TOOLCHAIN/bin/x86_64-unknown-linux-gnu-strip build/bin/linux-x86_64/releaseExecutable/*.kexe
run: $TOOLCHAIN/bin/x86_64-unknown-linux-gnu-strip app/build/bin/linuxX64/releaseExecutable/*.kexe

- name: Upload debug binary
uses: actions/upload-artifact@v3
with:
name: spms-linux-x86_64-debug
path: build/bin/linux-x86_64/debugExecutable/*.kexe
name: spms-minimal-linux-x86_64-debug
path: app/build/bin/linuxX64/debugExecutable/*.kexe

- name: Upload release binary
uses: actions/upload-artifact@v3
with:
name: spms-linux-x86_64-release
path: build/bin/linux-x86_64/releaseExecutable/*.kexe
name: spms-minimal-linux-x86_64-release
path: app/build/bin/linuxX64/releaseExecutable/*.kexe

- name: Clean build
run: ./gradlew clean

- name: Build linux-x86_64 binaries without mpv
run: ./gradlew linux-x86_64Binaries -PLINK_STATIC -PDISABLE_MPV
- name: Build Linux x86_64 full binaries
run: ./gradlew app:linuxX64Binaries --stacktrace

- name: Strip release binary
run: $TOOLCHAIN/bin/x86_64-unknown-linux-gnu-strip build/bin/linux-x86_64/releaseExecutable/*.kexe
run: $TOOLCHAIN/bin/x86_64-unknown-linux-gnu-strip app/build/bin/linuxX64/releaseExecutable/*.kexe

- name: Upload debug binary
uses: actions/upload-artifact@v3
with:
name: spms-nompv-linux-x86_64-debug
path: build/bin/linux-x86_64/debugExecutable/*.kexe
name: spms-linux-x86_64-debug
path: app/build/bin/linuxX64/debugExecutable/*.kexe

- name: Upload release binary
uses: actions/upload-artifact@v3
with:
name: spms-nompv-linux-x86_64-release
path: build/bin/linux-x86_64/releaseExecutable/*.kexe
name: spms-linux-x86_64-release
path: app/build/bin/linuxX64/releaseExecutable/*.kexe
89 changes: 0 additions & 89 deletions .github/workflows/build-windows-x86_64.yml

This file was deleted.

10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ build/
*.gen.kt
.vscode
/.kotlin
/.konan
*.log

/src/nativeInterop/*
!/src/nativeInterop/buildscripts/
/src/nativeInterop/buildscripts/build
/library/src/jvmMain/java

/library/src/nativeInterop/*
!/library/src/nativeInterop/buildscripts/
/library/src/nativeInterop/buildscripts/build
Loading

0 comments on commit 35275d8

Please sign in to comment.