Skip to content

Commit 4b4aa1f

Browse files
authored
Merge pull request #22 from Speedy37/win-link-fixes
fix #18: release Debug build fail on windows
2 parents 5ee4154 + e04effc commit 4b4aa1f

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

libmimalloc-sys/build.rs

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ fn main() {
7676
// This set mi_option_verbose and mi_option_show_errors options to false.
7777
cfg = cfg.define("mi_defines", "MI_DEBUG=0");
7878

79-
let is_debug = match get_cmake_build_type() {
80-
Ok(CMakeBuildType::Debug) => true,
81-
Ok(CMakeBuildType::Release) => false,
82-
Ok(CMakeBuildType::RelWithDebInfo) => false,
83-
Ok(CMakeBuildType::MinSizeRel) => false,
79+
let (is_debug, win_folder) = match get_cmake_build_type() {
80+
Ok(CMakeBuildType::Debug) => (true, "Debug"),
81+
Ok(CMakeBuildType::Release) => (false, "Release"),
82+
Ok(CMakeBuildType::RelWithDebInfo) => (false, "RelWithDebInfo"),
83+
Ok(CMakeBuildType::MinSizeRel) => (false, "MinSizeRel"),
8484
Err(e) => panic!("Cannot determine CMake build type: {}", e),
8585
};
8686

@@ -99,32 +99,37 @@ fn main() {
9999
}
100100
}
101101

102-
let (out_dir, out_name) = if cfg!(all(windows, target_env = "msvc")) {
102+
let mut out_dir = "./build".to_string();
103+
if cfg!(all(windows, target_env = "msvc")) {
104+
out_dir.push_str("/");
105+
out_dir.push_str(win_folder);
106+
}
107+
let out_name = if cfg!(all(windows, target_env = "msvc")) {
103108
if is_debug {
104109
if cfg!(feature = "secure") {
105-
("./build/Debug", "mimalloc-static-secure-debug")
110+
"mimalloc-static-secure-debug"
106111
} else {
107-
("./build/Debug", "mimalloc-static-debug")
112+
"mimalloc-static-debug"
108113
}
109114
} else {
110115
if cfg!(feature = "secure") {
111-
("./build/Release", "mimalloc-static-secure")
116+
"mimalloc-static-secure"
112117
} else {
113-
("./build/Release", "mimalloc-static")
118+
"mimalloc-static"
114119
}
115120
}
116121
} else {
117122
if is_debug {
118123
if cfg!(feature = "secure") {
119-
("./build", "mimalloc-secure-debug")
124+
"mimalloc-secure-debug"
120125
} else {
121-
("./build", "mimalloc-debug")
126+
"mimalloc-debug"
122127
}
123128
} else {
124129
if cfg!(feature = "secure") {
125-
("./build", "mimalloc-secure")
130+
"mimalloc-secure"
126131
} else {
127-
("./build", "mimalloc")
132+
"mimalloc"
128133
}
129134
}
130135
};

0 commit comments

Comments
 (0)