tycho: restructure platform-specific build info

master
Alison G. Watson 2019-07-04 04:51:04 -04:00
parent f328ced8f9
commit 7cbb5a1510
1 changed files with 14 additions and 18 deletions

View File

@ -3,6 +3,12 @@ use std::{io::prelude::*, path::PathBuf};
fn main() fn main()
{ {
let (lty, dty, qtpre, cxx) = if cfg!(target_os = "macos") {
("framework", "framework", "Qt", "c++")
} else {
("dylib", "native", "Qt5", "stdc++")
};
let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap()); let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap());
let mut config = configuration::parse("bindings.json").unwrap(); let mut config = configuration::parse("bindings.json").unwrap();
@ -35,30 +41,20 @@ fn main()
let path = PathBuf::from(&ln); let path = PathBuf::from(&ln);
let path = path.parent().unwrap(); let path = path.parent().unwrap();
let (ty, path) = if cfg!(target_os = "macos") { let path = if cfg!(target_os = "macos") {
("framework", path.parent().unwrap()) path.parent().unwrap()
} else { } else {
("native", path) path
}; };
println!("cargo:rustc-link-search={}={}", ty, path.display()); println!("cargo:rustc-link-search={}={}", dty, path.display());
} }
let (ty, pre) = if cfg!(target_os = "macos") { println!("cargo:rustc-link-lib={}={}Core", lty, qtpre);
("framework", "Qt") println!("cargo:rustc-link-lib={}={}Widgets", lty, qtpre);
} else { println!("cargo:rustc-link-lib={}={}Gui", lty, qtpre);
("dylib", "Qt5")
};
println!("cargo:rustc-link-lib={}={}Core", ty, pre); println!("cargo:rustc-link-lib=dylib={}", cxx);
println!("cargo:rustc-link-lib={}={}Widgets", ty, pre);
println!("cargo:rustc-link-lib={}={}Gui", ty, pre);
if cfg!(target_os = "macos") {
println!("cargo:rustc-link-lib=dylib=c++");
} else {
println!("cargo:rustc-link-lib=dylib=stdc++");
}
} }
// EOF // EOF