Skip to content

Commit

Permalink
Apply Auto Splitter Template
Browse files Browse the repository at this point in the history
This applies all the fancy things we added to the auto splitter
template.
  • Loading branch information
CryZe committed Jul 2, 2023
1 parent 5cfe385 commit dc729ea
Show file tree
Hide file tree
Showing 8 changed files with 186 additions and 54 deletions.
12 changes: 11 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
[build]
target = "wasm32-unknown-unknown"
rustflags = ["-C", "target-feature=+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,+simd128"]
rustflags = [
# The auto splitting runtime supports all the following WASM features.
"-C", "target-feature=+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,+simd128",
]

[alias]
# Alias for building an optimized version of the auto splitter.
# Command: cargo b
b = [
"build", "--release",
]
69 changes: 69 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build

on:
pull_request:
push:
branches:
- 'master'
tags:
- '*'

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Commit
uses: actions/checkout@v3

- name: Install Rust
uses: hecrj/setup-rust-action@v1
with:
components: rust-src
rust-version: nightly
targets: wasm32-unknown-unknown

- name: Build
env:
RUSTFLAGS: -Z virtual-function-elimination -C lto -C target-feature=+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,+simd128
run: |
cargo +nightly build --locked --release --features nightly -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort
- name: Release
if: github.ref == 'refs/heads/master'
uses: softprops/action-gh-release@v1
with:
files: target/wasm32-unknown-unknown/release/lunistice_auto_splitter.wasm
name: Latest
tag_name: latest

clippy:
name: Check clippy lints
runs-on: ubuntu-latest
steps:
- name: Checkout Commit
uses: actions/checkout@v3

- name: Install Rust
uses: hecrj/setup-rust-action@v1
with:
components: clippy
targets: wasm32-unknown-unknown

- name: Run Clippy
run: cargo clippy

format:
name: Check formatting
runs-on: ubuntu-latest
steps:
- name: Checkout Commit
uses: actions/checkout@v3

- name: Install Rust
uses: hecrj/setup-rust-action@v1
with:
components: rustfmt

- name: Run cargo fmt
run: cargo fmt -- --check || true
40 changes: 40 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Build nightly",
"type": "process",
"command": "cargo",
"args": [
"+nightly",
"build",
"--release",
"--features",
"nightly",
"-Z",
"build-std=std,panic_abort",
"-Z",
"build-std-features=panic_immediate_abort"
],
"options": {
"env": {
"RUSTFLAGS": "-Z virtual-function-elimination -C lto -C target-feature=+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,+simd128"
}
},
"problemMatcher": [
"$rustc"
]
},
{
"label": "Build stable",
"type": "process",
"command": "cargo",
"args": [
"b"
],
"problemMatcher": [
"$rustc"
]
}
]
}
16 changes: 8 additions & 8 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ strip = true

[profile.release.build-override]
opt-level = 0

[features]
nightly = []
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Lunistice Auto Splitter

An auto splitter for Lunistice.

## Compilation

This auto splitter is written in Rust. In order to compile it, you need to
install the Rust compiler: [Install Rust](https://www.rust-lang.org/tools/install).

Afterwards install the WebAssembly target:
```sh
rustup target add wasm32-unknown-unknown --toolchain stable
```

The auto splitter can now be compiled:
```sh
cargo b
```

The auto splitter is then available at:
```
target/wasm32-unknown-unknown/release/lunistice_auto_splitter.wasm
```

Make sure too look into the [API documentation](https://livesplit.org/asr/asr/) for the `asr` crate.

You can use the [debugger](https://github.com/CryZe/asr-debugger) while
developing the auto splitter to more easily see the log messages, statistics,
dump memory and more.
Loading

0 comments on commit dc729ea

Please sign in to comment.