From e6cd499e9894d24a4382e9838db33b3565a6afe8 Mon Sep 17 00:00:00 2001 From: Sergei Grebnov Date: Wed, 22 Jan 2025 13:19:48 -0800 Subject: [PATCH] Fix candle-flash-attn build on Windows (msvc) (#2734) --- candle-flash-attn/build.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/candle-flash-attn/build.rs b/candle-flash-attn/build.rs index 37247646e..18694524f 100644 --- a/candle-flash-attn/build.rs +++ b/candle-flash-attn/build.rs @@ -88,6 +88,12 @@ fn main() -> Result<()> { .arg("--use_fast_math") .arg("--verbose"); + if let Ok(target) = std::env::var("TARGET") { + if target.contains("msvc") { + builder = builder.arg("-D_USE_MATH_DEFINES"); + } + } + let out_file = build_dir.join("libflashattention.a"); builder.build_lib(out_file);