diff --git a/docker/Dockerfile b/docker/Dockerfile index 1d21e10..edbf6ba 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -20,6 +20,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ # Update PATH for cargo ENV RUSTUP_HOME=/usr/local/rustup \ CARGO_HOME=/usr/local/cargo \ + RUSTFLAGS="-C codegen-units=1" \ + CARGO_PROFILE_RELEASE_LTO=fat \ PATH=/usr/local/cargo/bin:$PATH # Install Rust toolchain, see https://rust-lang.github.io/rustup/installation/other.html diff --git a/publish_windows.py b/publish_windows.py index 98e70e4..81845d3 100644 --- a/publish_windows.py +++ b/publish_windows.py @@ -24,6 +24,13 @@ pathlib.Path(dst_dir).mkdir(parents=True, exist_ok=True) pathlib.Path(dst_dir_debug).mkdir(parents=True, exist_ok=True) +# Build GDNative library with production optimizations +subprocess.run( + ["cargo", "build", "--release"], + cwd="rust", + env={"RUSTFLAGS": "-C codegen-units=1", "CARGO_PROFILE_RELEASE_LTO": "fat"} +) + # Copy all dlls src_dir = "godot" for dll in glob.iglob(os.path.join(src_dir, "*.dll")):