-
Notifications
You must be signed in to change notification settings - Fork 106
Qt header discovery & framework support; vendor simplecpp update #302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Qt header discovery & framework support; vendor simplecpp update #302
Conversation
|
@jamesobutler Now this has been proposed upstream, we will be able to contribute |
|
@mrbean-bremen Thanks for the review 🙏 I will revisit and update shortly 🚀 |
…a4f49b (bfc53ad); was master (37fa4f4) Upstream: commontk/simplecpp@bfc53ad Source date: 2025-08-30 Files: generator/simplecpp/simplecpp.h, generator/simplecpp/simplecpp.cpp Patch: generator/simplecpp/do_not_stop_on_error.patch re-applied Compare: commontk/simplecpp@37fa4f4...bfc53ad
4c7ea5a to
9a945d4
Compare
- Prefer `QLibraryInfo::{HeadersPath}` to locate Qt headers; fall back to
`$QTDIR/include` when `QLibraryInfo` is unavailable or invalid.
- Accept include roots from `PYTHONQT_INCLUDE` and `--include-paths`; warn
and skip non-existent paths; normalize with `QDir::cleanPath`.
- Probe module subdirs under the Qt include root and append those that
exist (QtCore, QtGui, QtNetwork, QtOpenGL, QtXml).
- Use `DUI::addIncludePath(...)` instead of pushing to `includePaths`.
- Minor cleanups: Use QStringLiteral, add helpers for path joining/dir checks.
Remove hardcoded macOS `/Library/Frameworks` header paths from the QTDIR-missing
branch anticipating the addition of `getFrameworkDirectories` function.
9a945d4 to
b330ba7
Compare
… PYTHONQT_FRAMEWORK
Add `getFrameworkDirectories` to collect framework/library search roots from:
- `.` (cwd),
- `PYTHONQT_FRAMEWORK` (path-list, validated),
- `--framework-paths` CLI arg (validated),
- `${QTDIR}/lib/<Module>` when present, plus `${QTDIR}/lib`.
Co-authored-by: Hans Johnson <hans-johnson@uiowa.edu>
- Extend Qt version discovery to accept framework roots (e.g., .../QtCore.framework) in addition to include dirs. - On macOS, also probe `Versions/A/Headers/qtcoreversion.h`. - Try include paths first, then framework paths; abort with a clear error if neither yields a version. Co-authored-by: Hans Johnson <hans-johnson@uiowa.edu>
…generated on macOS
This improves header file detection on macOS by introducing support for additional common paths where `qtcoreversion.h` might be located. This change enhances compatibility with different Qt installations.
9689614 to
dd42ec8
Compare
|
@mrbean-bremen This now ready for final review & integration 🙏 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice - thank you!
| // Prefer QLibraryInfo (works without QTDIR) | ||
| QString qtInclude = QLibraryInfo::location(QLibraryInfo::HeadersPath); | ||
| if (!isDir(qtInclude)) { | ||
| // Fallback to QTDIR/include | ||
| const QString qtDir = qEnvironmentVariable("QTDIR"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dislike a little bit the fact that now we can't generate the bindings for a different Qt version than the version with which the generator was built. Sure, this is a little bit of a corner case, but I know that I have used this at some time during development.
Could we get another override mechanism for the Qt include directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very sensible point. This is an oversight & I will revisit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dislike a little bit the fact that now we can't generate the bindings for a different Qt version than the version with which the generator was built. Sure, this is a little bit of a corner case, but I know that I have used this at some time during development.
For future reference, this has been addressed in #313
This PR modernizes how the generator discovers Qt headers/frameworks and vendors a newer
simplecppwith framework-aware search logic. Together these changes make builds robust on macOS (Qt frameworks) and cleaner across all platforms.Vendor
simplecppupdateBumps
generator/simplecpp/{simplecpp.h, simplecpp.cpp}to patched-2025-08-30-37fa4f49b (upstream: commontk/simplecpp@bfc53ad; previously danmar/simplecpp@37fa4f4).Re-applies local patch:
generator/simplecpp/do_not_stop_on_error.patch.Introduces a typed, ordered search path API:
DUI::PathKind { Include, SystemInclude, Framework, SystemFramework }DUI::searchPathsplus helpersaddIncludePath,addSystemIncludePath,addFrameworkPath,addSystemFrameworkPathsearchPathsis empty, legacyincludePathsis mirrored asInclude.Adds Apple framework resolution for
#include <Pkg/Hdr.h>→<Pkg.framework/Headers/Hdr.h>(andPrivateHeadersfallback).Interleaves
-Iand-Fin the original CLI order; handles-isystemand-iframework.Upstream compare: commontk/simplecpp@37fa4f4...bfc53ad
Note
This changes are vendored from the
commontk/simplecppfork including commit backported from:-I,-isystem,-F,-iframework+ Darwin framework support (with legacy-Iback-compat) danmar/simplecpp#511Generator: discover Qt headers via
QLibraryInfoPrefers
QLibraryInfo::HeadersPath; falls back to$QTDIR/includeif needed.Accepts include roots from:
PYTHONQT_INCLUDE(path list; validated)--include-paths(validated)Probes and appends existing module subdirs under the Qt include root:
QtCore,QtGui,QtNetwork,QtOpenGL,QtXml.Starts using
DUI::addIncludePath(...)instead of pushing to the legacyincludePaths.Removes hardcoded macOS
/Library/Frameworks/.../Headersassumptions (to defer to new framework discovery).Generator: discover Qt framework paths dynamically (macOS)
New
getFrameworkDirectories(...)collects framework/library search roots from:.(cwd)PYTHONQT_FRAMEWORK(validated)--framework-paths(validated)${QTDIR}/lib/<Module>.frameworkwhen present, plus${QTDIR}/libQLibraryInfo::LibrariesPathwhen availablePasses these paths to the preprocessor using
DUI::addFrameworkPath(...).Generator: detect Qt version from frameworks on macOS
getQtVersion(...)now accepts either header include directories or framework roots.Versions/A/Headers/qtcoreversion.hwhen given a framework root (e.g.,.../QtCore.framework).This pull request supersedes the following ones:
This pull request fixes the following issues: