Improved search path and README for libymfm.a links (#2) #211
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v1 | |
with: | |
submodules: recursive | |
token: ${{secrets.GITHUB_TOKEN}} | |
- name: Cache wasi-sdk-19 | |
id: cache-wasi-sdk-19 | |
uses: actions/cache@v3 | |
with: | |
path: ./wasi-sdk-19.0 | |
key: ${{ runner.os }}-wasi-sdk-19 | |
- name: wasi-sdk Toolchain Setup | |
if: steps.cache-wasi-sdk-19.outputs.cache-hit != 'true' | |
run: | | |
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-linux.tar.gz | |
tar zxvf wasi-sdk-19.0-linux.tar.gz | |
- name: Rust Toolchain Setup | |
run: | | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
rustup install nightly | |
rustup default nightly | |
rustup target add wasm32-wasi | |
- name: Build libymfm | |
run: | | |
export WASI_SDK_PATH=$(pwd)/wasi-sdk-19.0 | |
export CARGO_TARGET_WASM32_WASI_LINKER=${WASI_SDK_PATH}/bin/lld | |
export CARGO_TARGET_WASM32_WASI_RUSTFLAGS="-L ${WASI_SDK_PATH}/share/wasi-sysroot/lib/wasm32-wasi" | |
cmake -DCMAKE_TOOLCHAIN_FILE=./cmake/wasi.cmake -S . -B build | |
cmake --build build --parallel $(nproc) | |
cargo +nightly build --release --target wasm32-wasi --features bindgen | |
ls -laF target/wasm32-wasi/release/ | |
- name: Buile examples/web | |
run: | | |
cargo install wasm-bindgen-cli --version 0.2.78 | |
wasm-bindgen target/wasm32-wasi/release/libymfm.wasm --out-dir ./examples/web/src/wasm/ | |
(cd examples/web && npm install && npm run build) | |
ls -laF examples/web/dist/ |