forked from BVE-Reborn/rend3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.bash
More file actions
46 lines (44 loc) · 1.73 KB
/
build.bash
File metadata and controls
46 lines (44 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
set -ex
case $1 in
web-bin)
shift
if [ $1 == "release" ]; then
shift
BUILD_FLAGS=--release
WASM_BUILD_DIR=release
else
WASM_BUILD_DIR=debug
fi
RUSTFLAGS=--cfg=web_sys_unstable_apis cargo build --target wasm32-unknown-unknown $BUILD_FLAGS --bin $@
mkdir -p target/generated/
rm -rf target/generated/*
cp -r examples/$1/resources/ target/generated/ || true
sed "s/{{example}}/$1/g" > target/generated/index.html < examples/resources/index.html
wasm-bindgen --out-dir target/generated --target web target/wasm32-unknown-unknown/$WASM_BUILD_DIR/$1.wasm
;;
serve)
shift
simple-http-server target/generated -c wasm,html,js -i
;;
ci)
cargo fmt
cargo clippy
cargo test
cargo rend3-doc
RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown --workspace --exclude rend3-imgui --exclude rend3-imgui-example
cargo deny check
;;
help | *)
set +x
echo "rend3 build script"
echo ""
echo "Contains helpful sets of commands for rend3's development."
echo "Building rend3 does not require any of these. Just use cargo as normal."
echo ""
echo "Subcommands:"
echo "help This message."
echo "web-bin [release] <BINARY> Builds BINARY as wasm, and runs wasm-bindgen on the result."
echo "shaders Calls glslc to build all glsl to spirv, and calls naga to create wgsl from it."
echo "serve Serve a web server from target/generated using simple-http-server."
esac