* LTO2

* more
This commit is contained in:
Logan McNaughton 2025-07-06 13:18:56 +02:00 committed by GitHub
parent d42e145b1f
commit e37633ecbd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 0 deletions

View File

@ -1,3 +1,9 @@
[target.'cfg(not(target_os = "windows"))']
rustflags = ["-C", "linker=clang", "-C", "link-arg=-fuse-ld=lld"]
[target.'cfg(target_os = "windows")']
rustflags = ["-C", "linker=lld-link", "-C", "link-arg=-fuse-ld=lld-link"]
[target.'cfg(target_arch = "x86_64")']
rustflags = ["-C", "target-cpu=x86-64-v3"]

View File

@ -44,3 +44,4 @@ cc = { version = "1.2", features = ["parallel"] }
[profile.release]
panic = "abort"
lto = true

View File

@ -61,6 +61,7 @@ fn main() {
let os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let profile = std::env::var("PROFILE").unwrap();
if arch == "x86_64" {
rdp_build.flag("-march=x86-64-v3");
} else if arch == "aarch64" {
@ -78,6 +79,9 @@ fn main() {
.unwrap();
}
if profile == "release" {
rdp_build.flag("-flto");
}
rdp_build.compile("parallel-rdp");
let out_path = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap());
@ -153,6 +157,9 @@ fn main() {
simd_build.file("src/compat/aarch64.c");
simd_build.file(std::env::temp_dir().join("bindgen").join("extern.c"));
simd_build.include(".");
if profile == "release" {
simd_build.flag("-flto");
}
simd_build.compile("simd");
}