Skip to content

Commit a3c1950

Browse files
authored
Merge pull request #17 from pgvee/master
Fix building against MSVC for new projects
2 parents 5a68a47 + 39d33d2 commit a3c1950

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

ui-sys/build.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,33 @@ fn main() {
2626
}
2727
}
2828

29+
// Deterimine if we're building for MSVC
30+
let target = env::var("TARGET").unwrap();
31+
let msvc = target.contains("msvc");
2932
// Build libui if needed. Otherwise, assume it's in lib/
3033
let mut dst;
3134
if cfg!(feature = "build") {
3235
dst = Config::new("libui").build_target("").profile("release").build();
3336

34-
let postfix = Path::new("build").join("out");
37+
let mut postfix = Path::new("build").join("out");
38+
if msvc {
39+
postfix = postfix.join("Release");
40+
}
3541
dst = dst.join(&postfix);
3642
} else {
3743
dst = env::current_dir()
3844
.expect("Unable to retrieve current directory location.");
3945
dst.push("lib");
4046
}
41-
println!("cargo:rustc-link-search=native={}", dst.display());
42-
43-
// Deterimine if we're building for MSVC
44-
let target = env::var("TARGET").unwrap();
45-
let msvc = target.contains("msvc");
47+
4648

4749
let libname;
4850
if msvc {
4951
libname = "libui";
5052
} else {
5153
libname = "ui";
5254
}
55+
56+
println!("cargo:rustc-link-search=native={}", dst.display());
5357
println!("cargo:rustc-link-lib={}", libname);
5458
}

ui-sys/src/ffi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ extern {
211211

212212
pub enum uiEditableCombobox {}
213213

214-
#[link(name = "ui")]
214+
// #[link(name = "ui")]
215215
extern {
216216
pub fn uiNewEditableCombobox() -> *mut uiEditableCombobox;
217217
pub fn uiEditableComboboxAppend(c: *mut uiEditableCombobox, text: *const c_char);

ui-sys/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ extern {
220220

221221
pub enum uiEditableCombobox {}
222222

223-
#[link(name = "ui")]
223+
// #[link(name = "ui")]
224224
extern {
225225
pub fn uiNewEditableCombobox() -> *mut uiEditableCombobox;
226226
pub fn uiEditableComboboxAppend(c: *mut uiEditableCombobox, text: *const c_char);

0 commit comments

Comments
 (0)