Compare commits

...

3 Commits

Author SHA1 Message Date
Alison G. Watson 7cbb5a1510 tycho: restructure platform-specific build info 2019-07-04 04:51:04 -04:00
Alison G. Watson f328ced8f9 tycho: use clang libc++ on mac 2019-07-04 04:47:56 -04:00
Alison G. Watson ed50dd2d1c tycho: add handling for macOS frameworks 2019-07-04 04:28:48 -04:00
2 changed files with 42 additions and 5 deletions

View File

@ -73,6 +73,16 @@ target_compile_definitions(
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
)
file(
GENERATE
OUTPUT link.txt
CONTENT
"$<TARGET_PROPERTY:Qt5::Core,IMPORTED_LOCATION_RELEASE>
$<TARGET_PROPERTY:Qt5::Widgets,IMPORTED_LOCATION_RELEASE>
$<TARGET_PROPERTY:Qt5::Gui,IMPORTED_LOCATION_RELEASE>"
)
install(TARGETS maraiah-tycho-hermes)
install(FILES ${CMAKE_BINARY_DIR}/link.txt TYPE SYSCONF)
## EOF

View File

@ -1,8 +1,14 @@
use rust_qt_binding_generator::*;
use std::path::PathBuf;
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();
@ -21,13 +27,34 @@ fn main()
let out_dir = config.build();
let lib_dir = out_dir.join("lib");
let etc_dir = out_dir.join("etc");
println!("cargo:rustc-link-search=native={}", lib_dir.display());
println!("cargo:rustc-link-lib=static=maraiah-tycho-hermes");
println!("cargo:rustc-link-lib=dylib=Qt5Core");
println!("cargo:rustc-link-lib=dylib=Qt5Widgets");
println!("cargo:rustc-link-lib=dylib=Qt5Gui");
println!("cargo:rustc-link-lib=dylib=stdc++");
let fp = std::fs::File::open(etc_dir.join("link.txt")).unwrap();
let fp = std::io::BufReader::new(fp);
for ln in fp.lines() {
let ln = ln.unwrap();
let path = PathBuf::from(&ln);
let path = path.parent().unwrap();
let path = if cfg!(target_os = "macos") {
path.parent().unwrap()
} else {
path
};
println!("cargo:rustc-link-search={}={}", dty, path.display());
}
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=dylib={}", cxx);
}
// EOF