Skip to content

Commit d1441fa

Browse files
tronicalogoffart
authored andcommitted
Fix Qt linkage on macOS when Qt was configured with -no-framework
Detect the presents of QtCore.framework and link it as framework, otherwise link it "regular unix style".
1 parent 855840e commit d1441fa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

qttypes/build.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,12 @@ fn main() {
197197
println!("cargo:FOUND=1");
198198
println!("cargo:COMPILE_FLAGS={}", flags.join(";"));
199199

200-
let macos_lib_search = if cargo_target_os == "macos" { "=framework" } else { "" };
200+
let use_macos_frameworks =
201+
cargo_target_os == "macos" && Path::new(&qt_library_path).join("QtCore.framework").exists();
202+
203+
let macos_lib_search = if use_macos_frameworks { "=framework" } else { "" };
201204
let vers_suffix =
202-
if cargo_target_os == "macos" { "".to_string() } else { qt_version.major.to_string() };
205+
if use_macos_frameworks { "".to_string() } else { qt_version.major.to_string() };
203206

204207
// Windows debug suffix exclusively from MSVC land
205208
let debug = std::env::var("DEBUG").ok().map_or(false, |s| s == "true");

0 commit comments

Comments
 (0)