Skip to content
This repository has been archived by the owner on Jan 29, 2025. It is now read-only.

Commit

Permalink
Test Rust extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash-L2L committed Oct 25, 2024
1 parent 8d89809 commit 29e2518
Show file tree
Hide file tree
Showing 7 changed files with 391 additions and 11 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ jobs:
build: [macos, windows, linux]
include:
- build: linux
rustflags: ""
target-bin: 'cusf_launcher.x86_64'
target-triple: x86_64-unknown-linux-gnu
- build: macos
rustflags: ""
target-bin: 'cusf_launcher.dmg'
target-triple: x86_64-apple-darwin
- build: windows
rustflags: "-C linker=/usr/bin/x86_64-w64-mingw32-gcc"
target-bin: 'cusf_launcher.exe'
target-triple: x86_64-pc-windows-gnu

steps:
- uses: actions/checkout@v3
Expand All @@ -34,6 +40,16 @@ jobs:
- name: Verify Setup
run: godot --version

- name: Install latest stable Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: ${{ matrix.target-triple }}

- name: Install mingw-w64
run: sudo apt install mingw-w64
if: ${{ matrix.target-triple == 'x86_64-pc-windows-gnu' }}

- name: Import certificate to Keychain
if: ${{ matrix.build == 'macos' }}
run: |
Expand Down Expand Up @@ -61,6 +77,14 @@ jobs:
- name: Initialize godot cache
run: python3 .github/scripts/godot_ci_cache.py

- name: Build rust extensions
run: |
pushd cusf_launcher_crypto
cargo build --release --target ${{ matrix.target-triple }}
popd
env:
RUSTFLAGS: ${{ matrix.rustflags }}

- name: Export build
run: |
name="${{fromJSON('{"windows": "Windows", "macos": "Mac", "linux": "Linux"}')[matrix.build] }}"
Expand Down
35 changes: 24 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
# cusf_launcher

Requirements:
Godot v4.3 :
https://github.com/godotengine/godot/releases/tag/4.3-stable
## Requirements:
* Godot v4.3 : https://github.com/godotengine/godot/releases/tag/4.3-stable
* Rust/Cargo : https://rustup.rs/

Command line build instructions:
If cross-compiling for Windows, mingw-64 is required.

Linux:
## Command line build instructions:

`godot --headless --path cusf_launcher/ --export-release "Linux" cusf_launcher.x86_64`
Linux:
```
pushd cusf_launcher_crypto
cargo build --release --target x86_64-unknown-linux-gnu
popd
godot --headless --path cusf_launcher/ --export-release "Linux" cusf_launcher.x86_64
```

Windows:

`godot --headless --path cusf_launcher/ --export-release "Windows" cusf_launcher.exe`
```
pushd cusf_launcher_crypto
RUSTFLAGS="-C linker=/usr/bin/x86_64-w64-mingw32-gcc" cargo build --release --target x86_64-pc-windows-gnu
popd
godot --headless --path cusf_launcher/ --export-release "Windows" cusf_launcher.exe
```

Mac:

`godot --headless --path cusf_launcher/ --export-release "Mac" cusf_launcher.dmg`

```
pushd cusf_launcher_crypto
cargo build --release --target x86_64-apple-darwin
popd
godot --headless --path cusf_launcher/ --export-release "Mac" cusf_launcher.dmg`
```

14 changes: 14 additions & 0 deletions cusf_launcher/CusfLauncherCrypto.gdextension
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[configuration]
entry_symbol = "gdext_cusf_launcher_crypto_init"
compatibility_minimum = 4.1
reloadable = true

[libraries]
linux.debug.x86_64 = "res://../cusf_launcher_crypto/target/x86_64-unknown-linux-gnu/debug/libcusf_launcher_crypto.so"
linux.release.x86_64 = "res://../cusf_launcher_crypto/target/x86_64-unknown-linux-gnu/release/libcusf_launcher_crypto.so"
windows.debug.x86_64 = "res://../cusf_launcher_crypto/target/x86_64-pc-windows-gnu/debug/cusf_launcher_crypto.dll"
windows.release.x86_64 = "res://../cusf_launcher_crypto/target/x86_64-pc-windows-gnu/release/cusf_launcher_crypto.dll"
macos.debug = "res://../cusf_launcher_crypto/target/x86_64-apple-darwin/debug/libcusf_launcher_crypto.dylib"
macos.release = "res://../cusf_launcher_crypto/target/x86_64-apple-darwin/release/libcusf_launcher_crypto.dylib"
macos.debug.arm64 = "res://../cusf_launcher_crypto/target/aarch64-apple-darwin/debug/libcusf_launcher_crypto.dylib"
macos.release.arm64 = "res://../cusf_launcher_crypto/target/aarch64-apple-darwin/release/libcusf_launcher_crypto.dylib"
1 change: 1 addition & 0 deletions cusf_launcher_crypto/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
282 changes: 282 additions & 0 deletions cusf_launcher_crypto/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 29e2518

Please sign in to comment.