Skip to content

Commit

Permalink
Fix Qt linkage on macOS when Qt was configured with -no-framework
Browse files Browse the repository at this point in the history
Detect the presents of QtCore.framework and link it as framework,
otherwise link it "regular unix style".
  • Loading branch information
tronical authored and ogoffart committed Feb 7, 2024
1 parent 855840e commit d1441fa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions qttypes/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,12 @@ fn main() {
println!("cargo:FOUND=1");
println!("cargo:COMPILE_FLAGS={}", flags.join(";"));

let macos_lib_search = if cargo_target_os == "macos" { "=framework" } else { "" };
let use_macos_frameworks =
cargo_target_os == "macos" && Path::new(&qt_library_path).join("QtCore.framework").exists();

let macos_lib_search = if use_macos_frameworks { "=framework" } else { "" };
let vers_suffix =
if cargo_target_os == "macos" { "".to_string() } else { qt_version.major.to_string() };
if use_macos_frameworks { "".to_string() } else { qt_version.major.to_string() };

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

0 comments on commit d1441fa

Please sign in to comment.