generated from NiklasEi/bevy_game_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.toml
40 lines (31 loc) · 1.19 KB
/
Makefile.toml
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
# This make file contains tasks for the web build of the game
# Build a web release by running `cargo make release` (release is the `build/web` directory)
[env]
TARGET_DIR = "target/wasm32-unknown-unknown/release/"
[tasks.release]
dependencies = ["build-and-bind-wasm", "copy-files-for-release"]
[tasks.build-and-bind-wasm]
args = ["--out-dir", "${TARGET_DIR}", "--out-name", "wasm", "--target", "web", "--no-typescript", "${TARGET_DIR}${CARGO_MAKE_CRATE_NAME}.wasm"]
command = "wasm-bindgen"
dependencies = ["cargo-build-web", "wasm-bindgen-cli"]
[tasks.cargo-build-web]
args = ["build", "--target", "wasm32-unknown-unknown", "--release"]
command = "cargo"
[tasks.wasm-bindgen-cli]
install_crate = { crate_name = "wasm-bindgen-cli", binary = "wasm-bindgen", test_arg="--help", version="0.2.78" }
[tasks.copy-files-for-release]
script_runner = "@duckscript"
script = [
'''
target = set "./build/web/target"
web = set "./build/web"
windows = set "./build/windows"
rm -r ${web}
mkdir ${target}
cp ${windows}/icon.ico ${web}/favicon.ico
cp ${TARGET_DIR}wasm.js ${target}/wasm.js
cp ${TARGET_DIR}wasm_bg.wasm ${target}/wasm_bg.wasm
cp ./index.html ${web}/index.html
cp ./assets ${web}
cp ./credits ${web}
''']