Skip to content

Commit

Permalink
chore: add notes for Windows users
Browse files Browse the repository at this point in the history
  • Loading branch information
jkawamoto committed Jun 21, 2024
1 parent 76ba300 commit f74df8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ and [Apple Accelerate](https://developer.apple.com/documentation/accelerate).

The installation of CMake is required to compile the library.

Additional notes for Windows:
it is necessary to add `RUSTFLAGS=-C target-feature=+crt-static` to the environment variables for compilation.

## Model Conversion for CTranslate2

To use model files with CTranslate2, they must first be converted.
Expand Down
5 changes: 5 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ fn main() {
.define("WITH_MKL", "OFF")
.define("OPENMP_RUNTIME", "NONE");
if cfg!(target_os = "windows") {
let rustflags = env::var("RUSTFLAGS").unwrap_or_default();
if !rustflags.contains("target-feature=+crt-static") {
println!("cargo:warning=For Windows compilation, set `RUSTFLAGS=-C target-feature=+crt-static`.");
}

println!("cargo::rustc-link-arg=/FORCE:MULTIPLE");
cmake.profile("Release");
}
Expand Down

0 comments on commit f74df8e

Please sign in to comment.