Skip to content

Commit d6fd048

Browse files
committed
Fix qreal detection on macos
1 parent 6699a4c commit d6fd048

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

qttypes/build.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@ fn qmake_query(var: &str) -> Result<String, std::io::Error> {
3131

3232
// qreal is a double, unless QT_COORD_TYPE says otherwise:
3333
// https://doc.qt.io/qt-5/qtglobal.html#qreal-typedef
34-
fn detect_qreal_size(qt_include_path: &str) {
35-
let path = Path::new(qt_include_path).join("QtCore").join("qconfig.h");
34+
fn detect_qreal_size(qt_include_path: &str, qt_library_path: &str) {
35+
let mut path = Path::new(qt_include_path).join("QtCore/qconfig.h");
36+
if cfg!(target_os = "macos") {
37+
if !path.exists() {
38+
path = Path::new(qt_library_path).join("QtCore.framework/Headers/qconfig.h");
39+
}
40+
}
3641
let f = std::fs::File::open(&path).expect(&format!("Cannot open `{:?}`", path));
3742
let b = BufReader::new(f);
3843

@@ -77,7 +82,7 @@ fn main() {
7782
config.flag(qt_library_path.trim());
7883
}
7984

80-
detect_qreal_size(&qt_include_path.trim());
85+
detect_qreal_size(&qt_include_path.trim(), qt_library_path.trim());
8186

8287
config.include(qt_include_path.trim()).build("src/lib.rs");
8388

0 commit comments

Comments
 (0)