Skip to content

Commit 4f68fdc

Browse files
authored
Add Windows target on Windows host build option (#68)
Project can be build on windows using rust stable-x86_64-pc-windows-gnu and msys2/Mingw64. The MINGW64_DIR environment variable becomes mandatory and must point to the local mingw64 toolchain install.
1 parent ca36198 commit 4f68fdc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,15 @@ fn generate_bindings() -> Result<(), Box<dyn Error>> {
172172
.clang_arg(format!("--target={}", "x86_64-pc-windows-gnu"));
173173
}
174174

175+
if is_host(OperatingSystem::Windows)? && is_target(OperatingSystem::Windows)? {
176+
let mingw_path = env::var("MINGW64_DIR")
177+
.expect("Please set MINGW64_DIR to the location of your mingw64 installation ");
178+
let mingw_include_path = format!("{mingw_path}\\include");
179+
bindings = bindings
180+
.clang_arg(format!("-I{}", mingw_include_path))
181+
.clang_arg(format!("--target={}", "x86_64-pc-windows-gnu"));
182+
}
183+
175184
let out_dir = env::var("OUT_DIR")?;
176185
bindings
177186
.allowlist_type("CBL.*")

0 commit comments

Comments
 (0)