mirror of
https://github.com/huggingface/candle.git
synced 2025-06-15 10:26:33 +00:00
fix: candle-flash-attn
linux and msvc
build (#2829)
* fix: candle-flash-attn linux and msvc build * Missing newline at eof. --------- Co-authored-by: laurent <laurent.mazare@gmail.com>
This commit is contained in:
@ -88,19 +88,26 @@ fn main() -> Result<()> {
|
||||
.arg("--use_fast_math")
|
||||
.arg("--verbose");
|
||||
|
||||
let mut is_target_msvc = false;
|
||||
if let Ok(target) = std::env::var("TARGET") {
|
||||
if target.contains("msvc") {
|
||||
is_target_msvc = true;
|
||||
builder = builder.arg("-D_USE_MATH_DEFINES");
|
||||
}
|
||||
}
|
||||
|
||||
if !is_target_msvc {
|
||||
builder = builder.arg("-Xcompiler").arg("-fPIC");
|
||||
}
|
||||
|
||||
let out_file = build_dir.join("libflashattention.a");
|
||||
builder.build_lib(out_file);
|
||||
|
||||
println!("cargo:rustc-link-search={}", build_dir.display());
|
||||
println!("cargo:rustc-link-lib=flashattention");
|
||||
println!("cargo:rustc-link-lib=dylib=cudart");
|
||||
println!("cargo:rustc-link-lib=dylib=stdc++");
|
||||
|
||||
if !is_target_msvc {
|
||||
println!("cargo:rustc-link-lib=dylib=stdc++");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user