From 7cbb5a1510edc6f9877ba3d366410f6add0b7780 Mon Sep 17 00:00:00 2001 From: "Alison G. Watson" Date: Thu, 4 Jul 2019 04:51:04 -0400 Subject: [PATCH] tycho: restructure platform-specific build info --- tycho/build.rs | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/tycho/build.rs b/tycho/build.rs index 836b3f2..d92eebb 100644 --- a/tycho/build.rs +++ b/tycho/build.rs @@ -3,6 +3,12 @@ use std::{io::prelude::*, path::PathBuf}; 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 mut config = configuration::parse("bindings.json").unwrap(); @@ -35,30 +41,20 @@ fn main() let path = PathBuf::from(&ln); let path = path.parent().unwrap(); - let (ty, path) = if cfg!(target_os = "macos") { - ("framework", path.parent().unwrap()) + let path = if cfg!(target_os = "macos") { + path.parent().unwrap() } 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") { - ("framework", "Qt") - } else { - ("dylib", "Qt5") - }; + println!("cargo:rustc-link-lib={}={}Core", lty, qtpre); + println!("cargo:rustc-link-lib={}={}Widgets", lty, qtpre); + println!("cargo:rustc-link-lib={}={}Gui", lty, qtpre); - println!("cargo:rustc-link-lib={}={}Core", ty, pre); - 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++"); - } + println!("cargo:rustc-link-lib=dylib={}", cxx); } // EOF