Skip to content

Commit d3f7c4e

Browse files
authored
Remove ucrt link logic (#4)
1 parent df2a6ed commit d3f7c4e

File tree

2 files changed

+10
-24
lines changed

2 files changed

+10
-24
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,3 @@ jobs:
196196
yarn build --target ${{ matrix.settings.target }}
197197
yarn build --target ${{ matrix.settings.target }} --release
198198
fi
199-
- name: Build with static CRT
200-
if: ${{ matrix.settings.target == 'x86_64-pc-windows-msvc' }}
201-
working-directory: example
202-
run: yarn build --target ${{ matrix.settings.target }} --release
203-
env:
204-
RUSTFLAGS: "-C target-feature=+crt-static -C link-arg=/FORCE:MULTIPLE"

libmimalloc-sys/build.rs

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ fn main() {
4242
cmake_config.define("MI_TRACK_ETW", "ON");
4343
}
4444

45-
if profile == "debug" {
45+
// it's complicated to link ucrt in debug mode on windows
46+
if profile == "debug" && target_env != "msvc" {
4647
cmake_config
4748
.define("MI_DEBUG_FULL", "ON")
4849
.define("MI_SHOW_ERRORS", "ON");
@@ -82,31 +83,22 @@ fn main() {
8283
if target_env == "msvc" {
8384
cmake_config
8485
.define("MI_USE_CXX", "ON")
85-
.define("MI_WIN_USE_FIXED_TLS", "ON");
86-
if !std::env::var("CARGO_CFG_TARGET_FEATURE")
87-
.map(|s| s.contains("+crt-static"))
88-
.unwrap_or(false)
89-
{
90-
if profile == "debug" {
91-
println!("cargo:rustc-link-lib=ucrtd");
92-
} else {
93-
println!("cargo:rustc-link-lib=ucrt");
94-
}
95-
}
86+
.define("MI_WIN_USE_FIXED_TLS", "ON")
87+
// always turn off debug full and show errors on msvc
88+
.define("MI_DEBUG_FULL", "OFF")
89+
.define("MI_SHOW_ERRORS", "OFF")
90+
.profile("release")
91+
.static_crt(true);
9692
}
9793

9894
let dst = cmake_config.build();
9995

10096
if target_os == "windows" {
10197
println!(
102-
"cargo:rustc-link-search=native={}/build/{}",
98+
"cargo:rustc-link-search=native={}/build/Release",
10399
dst.display(),
104-
if profile == "debug" {
105-
"Debug"
106-
} else {
107-
"Release"
108-
}
109100
);
101+
println!("cargo:rustc-link-search=native={}/build", dst.display());
110102
} else {
111103
println!("cargo:rustc-link-search=native={}/build", dst.display());
112104
}

0 commit comments

Comments
 (0)