From 21d4d0857b6c2e4d7a3407362f8f7181fde97552 Mon Sep 17 00:00:00 2001 From: link2xt Date: Thu, 4 Apr 2024 16:33:21 +0000 Subject: [PATCH] Enable LTO via `cargo` profile setting Enabling LTO via RUSTFLAGS results in error: lto can only be run for executables, cdylibs and static library outputs --- scripts/build-core.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/build-core.sh b/scripts/build-core.sh index 68c2f7d26..12c53d33e 100755 --- a/scripts/build-core.sh +++ b/scripts/build-core.sh @@ -17,7 +17,9 @@ rustup target add aarch64-apple-ios x86_64-apple-ios --toolchain `cat ../rust-to # Depending your setup, specify the rustup toolchain explicitly. # # --no-sanitize-env prevents removal of IPHONEOS_DEPLOYMENT_TARGET variable. -RUSTFLAGS="-C lto=on -C embed-bitcode=yes" \ +CARGO_PROFILE_RELEASE_LTO=true \ +CARGO_PROFILE_DEV_LTO=true \ +RUSTFLAGS="-C embed-bitcode=yes" \ cargo +`cat ../rust-toolchain` lipo --xcode-integ --no-sanitize-env --manifest-path "$DIR/deltachat-core-rust/deltachat-ffi/Cargo.toml" --features jsonrpc # cargo-lipo drops result in different folder, depending on the config.