From 5b53ce720e2a119c4d5054785548aca627b1d1e9 Mon Sep 17 00:00:00 2001 From: Mahesh Bandara Wijerathna Date: Fri, 19 Apr 2024 11:08:26 +0530 Subject: [PATCH] [Cargo] Use new `dist` profile with `fat` LTO for release builds --- .cargo/config.toml | 4 ++-- Cargo.toml | 4 ++++ pack/src/main.rs | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 75d400b..42674cf 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -2,7 +2,7 @@ rustflags = ["-C", "target-feature=+crt-static"] [alias] -build-win32 = 'build --release --package ufc-ripper --features=exe_res' -build-linux = 'build --release --package ufc-ripper' +build-win32 = 'build --profile dist --package ufc-ripper --features=exe_res' +build-linux = 'build --profile dist --package ufc-ripper' pack-win32 = 'run --release --package pack -- --platform win32' pack-linux = 'run --release --package pack -- --platform linux' diff --git a/Cargo.toml b/Cargo.toml index 2fa8916..cdc234f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,3 +16,7 @@ license = "MIT" repository = "https://github.com/m4heshd/ufc-ripper" edition = "2021" publish = false + +[profile.dist] +inherits = "release" +lto = "fat" diff --git a/pack/src/main.rs b/pack/src/main.rs index 682fe8e..306d228 100644 --- a/pack/src/main.rs +++ b/pack/src/main.rs @@ -29,9 +29,9 @@ fn main() -> anyhow::Result<()> { let cli_args = CLIArgs::parse(); let platform = cli_args.platform.as_str(); let bin_path = if platform == "win32" { - "target/release/ufc-ripper.exe" + "target/dist/ufc-ripper.exe" } else if platform == "linux" { - "target/release/ufc-ripper" + "target/dist/ufc-ripper" } else { log_err!("This platform is not supported\n"); panic!();