Makefile.toml (1217B)
1 # This make file contains tasks for the web build of the game 2 # Build a web release by running `cargo make release` (release is the `build/web` directory) 3 4 [env] 5 TARGET_DIR = "target/wasm32-unknown-unknown/release/" 6 7 [tasks.release] 8 dependencies = ["build-and-bind-wasm", "copy-files-for-release"] 9 10 [tasks.build-and-bind-wasm] 11 args = ["--out-dir", "${TARGET_DIR}", "--out-name", "wasm", "--target", "web", "--no-typescript", "${TARGET_DIR}${CARGO_MAKE_CRATE_NAME}.wasm"] 12 command = "wasm-bindgen" 13 dependencies = ["cargo-build-web", "wasm-bindgen-cli"] 14 15 [tasks.cargo-build-web] 16 args = ["build", "--target", "wasm32-unknown-unknown", "--release"] 17 command = "cargo" 18 19 [tasks.wasm-bindgen-cli] 20 install_crate = { crate_name = "wasm-bindgen-cli", binary = "wasm-bindgen", test_arg="--help", version="0.2.78" } 21 22 [tasks.copy-files-for-release] 23 script_runner = "@duckscript" 24 script = [ 25 ''' 26 target = set "./build/web/target" 27 web = set "./build/web" 28 windows = set "./build/windows" 29 30 rm -r ${web} 31 mkdir ${target} 32 33 cp ${windows}/icon.ico ${web}/favicon.ico 34 35 cp ${TARGET_DIR}wasm.js ${target}/wasm.js 36 cp ${TARGET_DIR}wasm_bg.wasm ${target}/wasm_bg.wasm 37 cp ./index.html ${web}/index.html 38 cp ./assets ${web} 39 cp ./credits ${web} 40 ''']