tycho: add handling for macOS frameworks
parent
5389062d44
commit
ed50dd2d1c
|
@ -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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use rust_qt_binding_generator::*;
|
||||
use std::path::PathBuf;
|
||||
use std::{io::prelude::*, path::PathBuf};
|
||||
|
||||
fn main()
|
||||
{
|
||||
|
@ -21,13 +21,42 @@ 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 (ty, path) = if cfg!(target_os = "macos") {
|
||||
("framework", path.parent().unwrap())
|
||||
} else {
|
||||
("native", path)
|
||||
};
|
||||
|
||||
println!("cargo:rustc-link-search={}={}", ty, path.display());
|
||||
}
|
||||
|
||||
let (ty, pre) = if cfg!(target_os = "macos") {
|
||||
("framework", "Qt")
|
||||
} else {
|
||||
("dylib", "Qt5")
|
||||
};
|
||||
|
||||
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=stdc++");
|
||||
}
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
|
Loading…
Reference in New Issue