Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,3 @@ jobs:
yarn build --target ${{ matrix.settings.target }}
yarn build --target ${{ matrix.settings.target }} --release
fi
- name: Build with static CRT
if: ${{ matrix.settings.target == 'x86_64-pc-windows-msvc' }}
working-directory: example
run: yarn build --target ${{ matrix.settings.target }} --release
env:
RUSTFLAGS: "-C target-feature=+crt-static -C link-arg=/FORCE:MULTIPLE"
28 changes: 10 additions & 18 deletions libmimalloc-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ fn main() {
cmake_config.define("MI_TRACK_ETW", "ON");
}

if profile == "debug" {
// it's complicated to link ucrt in debug mode on windows
if profile == "debug" && target_env != "msvc" {
cmake_config
.define("MI_DEBUG_FULL", "ON")
.define("MI_SHOW_ERRORS", "ON");
Expand Down Expand Up @@ -82,31 +83,22 @@ fn main() {
if target_env == "msvc" {
cmake_config
.define("MI_USE_CXX", "ON")
.define("MI_WIN_USE_FIXED_TLS", "ON");
if !std::env::var("CARGO_CFG_TARGET_FEATURE")
.map(|s| s.contains("+crt-static"))
.unwrap_or(false)
{
if profile == "debug" {
println!("cargo:rustc-link-lib=ucrtd");
} else {
println!("cargo:rustc-link-lib=ucrt");
}
}
.define("MI_WIN_USE_FIXED_TLS", "ON")
// always turn off debug full and show errors on msvc
.define("MI_DEBUG_FULL", "OFF")
.define("MI_SHOW_ERRORS", "OFF")
.profile("release")
.static_crt(true);
}

let dst = cmake_config.build();

if target_os == "windows" {
println!(
"cargo:rustc-link-search=native={}/build/{}",
"cargo:rustc-link-search=native={}/build/Release",
dst.display(),
if profile == "debug" {
"Debug"
} else {
"Release"
}
);
println!("cargo:rustc-link-search=native={}/build", dst.display());
} else {
println!("cargo:rustc-link-search=native={}/build", dst.display());
}
Expand Down