Skip to content

Commit

Permalink
Implement initial support for no_std
Browse files Browse the repository at this point in the history
This implements initial support for no_std. Modules such as parsing,
saving and rendering are disabled and timing has to be manually provided
by registering a global handler. The rendering module is on its way to
no_std support as well, but not all Pull Requests to the necessary
dependencies are done yet.

See #223 for more information.
  • Loading branch information
CryZe committed Nov 19, 2019
1 parent adcf751 commit 9246acc
Show file tree
Hide file tree
Showing 112 changed files with 890 additions and 321 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ main() {
release_flag="--release"
fi

$cargo build -p cdylib --target $TARGET $release_flag
$cargo build -p cdylib --target $TARGET $release_flag $FEATURES
}

main
13 changes: 9 additions & 4 deletions .github/workflows/build_static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,25 @@ main() {
release_flag="--release"
fi

if [ "$NO_STD" = "true" ]; then
(cd crates/no-std-test && cargo build --target $TARGET $FEATURES)
return
fi

case $TARGET in
asmjs-unknown-emscripten)
$cargo build -p livesplit --target $TARGET --release
$cargo build -p livesplit --target $TARGET --release $FEATURES
;;
wasm32-unknown-emscripten)
rm target/wasm32-unknown-emscripten/release/deps/*.wasm 2>/dev/null || :
rm target/wasm32-unknown-emscripten/release/deps/*.js 2>/dev/null || :
$cargo build -p livesplit --target $TARGET --release
$cargo build -p livesplit --target $TARGET --release $FEATURES
;;
wasm32-unknown-unknown)
$cargo build -p cdylib --target $TARGET --release
$cargo build -p cdylib --target $TARGET --release $FEATURES
;;
*)
$cargo build -p staticlib --target $TARGET $release_flag
$cargo build -p staticlib --target $TARGET $release_flag $FEATURES
;;
esac
}
Expand Down
182 changes: 170 additions & 12 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,25 @@ jobs:
fail-fast: false
matrix:
label:
# Bare Metal
- Bare Metal Nvidia PTX 64
- Bare Metal ARM Cortex-M thumbv6m
- Bare Metal ARM Cortex-M thumbv7em
- Bare Metal ARM Cortex-M thumbv7em Hardware Float
- Bare Metal ARM Cortex-M thumbv7m
- Bare Metal ARM Cortex-M thumbv8m.base
- Bare Metal ARM Cortex-M thumbv8m.main
- Bare Metal ARM Cortex-M thumbv8m.main Hardware Float
- Bare Metal RISC-V 32 i
- Bare Metal RISC-V 32 imac
- Bare Metal RISC-V 32 imc
- Bare Metal RISC-V 64 gc
- Bare Metal RISC-V 64 imac

# Web
# FIXME: asmjs is broken at the moment. It's unclear why.
# FIXME: emscripten is broken at the moment. cross' emscripten is too old.
# - Web asmjs
- Web wasm32 emscripten
# - Web wasm32 emscripten
- Web wasm32

# Windows
Expand Down Expand Up @@ -104,6 +119,140 @@ jobs:
- macOS Nightly

include:
# Bare Metal
- label: Bare Metal Nvidia PTX 64
target: nvptx64-nvidia-cuda
os: ubuntu-latest
toolchain: stable
tests: skip
dylib: skip
release: skip
no_std: true
install_target: true

- label: Bare Metal ARM Cortex-M thumbv6m
target: thumbv6m-none-eabi
os: ubuntu-latest
toolchain: stable
tests: skip
dylib: skip
release: skip
no_std: true
install_target: true
features: "--features doesnt-have-atomics"

- label: Bare Metal ARM Cortex-M thumbv7em
target: thumbv7em-none-eabi
os: ubuntu-latest
toolchain: stable
tests: skip
dylib: skip
release: skip
no_std: true
install_target: true

- label: Bare Metal ARM Cortex-M thumbv7em Hardware Float
target: thumbv7em-none-eabihf
os: ubuntu-latest
toolchain: stable
tests: skip
dylib: skip
release: skip
no_std: true
install_target: true

- label: Bare Metal ARM Cortex-M thumbv7m
target: thumbv7m-none-eabi
os: ubuntu-latest
toolchain: stable
tests: skip
dylib: skip
release: skip
no_std: true
install_target: true

- label: Bare Metal ARM Cortex-M thumbv8m.base
target: thumbv8m.base-none-eabi
os: ubuntu-latest
toolchain: stable
tests: skip
dylib: skip
release: skip
no_std: true
install_target: true

- label: Bare Metal ARM Cortex-M thumbv8m.main
target: thumbv8m.main-none-eabi
os: ubuntu-latest
toolchain: stable
tests: skip
dylib: skip
release: skip
no_std: true
install_target: true

- label: Bare Metal ARM Cortex-M thumbv8m.main Hardware Float
target: thumbv8m.main-none-eabihf
os: ubuntu-latest
toolchain: stable
tests: skip
dylib: skip
release: skip
no_std: true
install_target: true

- label: Bare Metal RISC-V 32 i
target: riscv32i-unknown-none-elf
os: ubuntu-latest
toolchain: stable
tests: skip
dylib: skip
release: skip
no_std: true
install_target: true
features: "--features doesnt-have-atomics"

- label: Bare Metal RISC-V 32 imac
target: riscv32imac-unknown-none-elf
os: ubuntu-latest
toolchain: stable
tests: skip
dylib: skip
release: skip
no_std: true
install_target: true

- label: Bare Metal RISC-V 32 imc
target: riscv32imc-unknown-none-elf
os: ubuntu-latest
toolchain: stable
tests: skip
dylib: skip
release: skip
no_std: true
install_target: true
features: "--features doesnt-have-atomics"

- label: Bare Metal RISC-V 64 gc
target: riscv64gc-unknown-none-elf
os: ubuntu-latest
toolchain: stable
tests: skip
dylib: skip
release: skip
no_std: true
install_target: true

- label: Bare Metal RISC-V 64 imac
target: riscv64imac-unknown-none-elf
os: ubuntu-latest
toolchain: stable
tests: skip
dylib: skip
release: skip
no_std: true
install_target: true

# Web
# - label: Web asmjs
# target: asmjs-unknown-emscripten
Expand All @@ -113,21 +262,19 @@ jobs:
# dylib: skip
# release_anyway: true

- label: Web wasm32 emscripten
target: wasm32-unknown-emscripten
os: ubuntu-latest
toolchain: stable
tests: skip
dylib: skip
release_anyway: true
# - label: Web wasm32 emscripten
# target: wasm32-unknown-emscripten
# os: ubuntu-latest
# toolchain: stable
# tests: skip
# dylib: skip

- label: Web wasm32
target: wasm32-unknown-unknown
os: ubuntu-latest
tests: skip
dylib: skip
install_target: true
release_anyway: true

# Windows
- label: Windows aarch64
Expand Down Expand Up @@ -394,24 +541,28 @@ jobs:
target: x86_64-pc-windows-msvc
os: windows-latest
toolchain: beta
release: skip
cross: skip

- label: Windows Nightly
target: x86_64-pc-windows-msvc
os: windows-latest
toolchain: nightly
release: skip
cross: skip

- label: Windows Beta gnu
target: x86_64-pc-windows-gnu
toolchain: beta-x86_64-pc-windows-gnu
release: skip
os: windows-latest
cross: skip
install_target: true

- label: Windows Nightly gnu
target: x86_64-pc-windows-gnu
toolchain: nightly-x86_64-pc-windows-gnu
release: skip
os: windows-latest
cross: skip
install_target: true
Expand All @@ -420,22 +571,26 @@ jobs:
target: x86_64-unknown-linux-gnu
os: ubuntu-latest
toolchain: beta
release: skip

- label: Linux Nightly
target: x86_64-unknown-linux-gnu
os: ubuntu-latest
toolchain: nightly
release: skip

- label: macOS Beta
target: x86_64-apple-darwin
os: macOS-latest
toolchain: beta
release: skip
cross: skip

- label: macOS Nightly
target: x86_64-apple-darwin
os: macOS-latest
toolchain: nightly
release: skip
cross: skip

steps:
Expand Down Expand Up @@ -463,6 +618,8 @@ jobs:
TARGET: ${{ matrix.target }}
SKIP_CROSS: ${{ matrix.cross }}
IS_DEPLOY: ${{ startsWith(github.ref, 'refs/tags/') && (matrix.release_anyway != '' || !(startsWith(matrix.toolchain, 'nightly') || startsWith(matrix.toolchain, 'beta'))) }}
FEATURES: ${{ matrix.features }}
NO_STD: ${{ matrix.no_std }}

- name: Build Shared Library
if: matrix.dylib == ''
Expand All @@ -471,6 +628,7 @@ jobs:
TARGET: ${{ matrix.target }}
SKIP_CROSS: ${{ matrix.cross }}
IS_DEPLOY: ${{ startsWith(github.ref, 'refs/tags/') && (matrix.release_anyway != '' || !(startsWith(matrix.toolchain, 'nightly') || startsWith(matrix.toolchain, 'beta'))) }}
FEATURES: ${{ matrix.features }}

- name: Test
if: matrix.tests == ''
Expand All @@ -480,15 +638,15 @@ jobs:
SKIP_CROSS: ${{ matrix.cross }}

- name: Prepare Release
if: startsWith(github.ref, 'refs/tags/') && (matrix.release_anyway != '' || !(startsWith(matrix.toolchain, 'nightly') || startsWith(matrix.toolchain, 'beta')))
if: startsWith(github.ref, 'refs/tags/') && matrix.release == ''
shell: bash
run: .github/workflows/before_deploy.sh
env:
OS_NAME: ${{ matrix.os }}
TARGET: ${{ matrix.target }}

- name: Release
if: startsWith(github.ref, 'refs/tags/') && (matrix.release_anyway != '' || !(startsWith(matrix.toolchain, 'nightly') || startsWith(matrix.toolchain, 'beta')))
if: startsWith(github.ref, 'refs/tags/') && matrix.release == ''
uses: softprops/action-gh-release@v1
with:
files: livesplit-core-*.*
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ main() {
fi

$cargo test -p livesplit-core --all-features --target $TARGET
$cargo test -p livesplit-core --no-default-features --target $TARGET
$cargo test -p livesplit-core --no-default-features --features std --target $TARGET
}

main

0 comments on commit 9246acc

Please sign in to comment.