From d3f4241e04ea5482e2b2cc3c5fedd740f5bbafe8 Mon Sep 17 00:00:00 2001 From: Magnus Ulimoen Date: Mon, 30 Mar 2020 22:54:31 +0200 Subject: [PATCH] improve release builds for web --- webfront/make_wasm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/webfront/make_wasm.py b/webfront/make_wasm.py index c94cb84..f5a7754 100755 --- a/webfront/make_wasm.py +++ b/webfront/make_wasm.py @@ -5,6 +5,7 @@ from subprocess import check_call from shutil import copyfile, copytree import tempfile import pathlib +import os if __name__ == "__main__": parser = ArgumentParser(description="Build js and wasm") @@ -25,10 +26,12 @@ if __name__ == "__main__": target_triple = "wasm32-unknown-unknown" command = ["cargo", "build", "--target", target_triple] + env = os.environ.copy() if args.release: + env["RUSTFLAGS"] = "-C opt-level=3 -C codegen-units=1 -C lto=fat" command.append("--release") - check_call(command) + check_call(command, env=env) target = ( pathlib.Path("../target")