plugin: give moc qtdeclarative include path so QML attrs reach qmltyperegistrar
This commit is contained in:
parent
78abe800ed
commit
1b07787764
3 changed files with 17 additions and 28 deletions
|
|
@ -7,11 +7,14 @@
|
|||
runCommand,
|
||||
}:
|
||||
let
|
||||
# nixpkgs splits Qt tools across packages: moc/rcc/qtpaths live in qtbase,
|
||||
# qmltyperegistrar and qmlcachegen live in qtdeclarative. qt-build-utils
|
||||
# finds tools via `qmake -query QT_INSTALL_LIBEXECS`, which only returns
|
||||
# qtbase paths, so those two tools are invisible. Fix: combine them into a
|
||||
# single symlink tree and point a qmake wrapper at it.
|
||||
# nixpkgs splits Qt: tools (moc/rcc/qtpaths in qtbase, qmltyperegistrar/qmlcachegen
|
||||
# in qtdeclarative) and headers (qtbase has Qt6Core etc., qtdeclarative has Qt6Qml
|
||||
# incl. qqmlregistration.h). qt-build-utils derives both from `qmake -query`, which
|
||||
# only knows about qtbase. Symptom of missing headers: moc warns "Potential QML
|
||||
# registration macro was found, but no header containing it was included", silently
|
||||
# strips QML_NAMED_ELEMENT/QML_SINGLETON from the JSON, qmltyperegistrar emits an
|
||||
# empty qml_register_types_*, and the QML import resolves to no types. Fix: combine
|
||||
# tools and headers into symlink trees and point a qmake wrapper at them.
|
||||
qtBuildTools = runCommand "qt6-build-tools" { } ''
|
||||
mkdir -p $out/libexec $out/bin
|
||||
for f in ${qt6.qtbase}/libexec/* ${qt6.qtbase}/bin/*; do
|
||||
|
|
@ -22,6 +25,12 @@ let
|
|||
[ -f "$src" ] && ln -sf "$src" "$out/libexec/$tool"
|
||||
done
|
||||
'';
|
||||
qtIncludeRoots = runCommand "qt6-include-roots" { } ''
|
||||
mkdir -p $out/include
|
||||
for src in ${qt6.qtbase.dev}/include/* ${qt6.qtdeclarative.dev}/include/*; do
|
||||
ln -sfn "$src" "$out/include/$(basename "$src")"
|
||||
done
|
||||
'';
|
||||
qmakeWrapper = writeShellScript "qmake6" ''
|
||||
if [ "$1" = "-query" ]; then
|
||||
case "$2" in
|
||||
|
|
@ -29,6 +38,8 @@ let
|
|||
echo "${qtBuildTools}/libexec"; exit 0;;
|
||||
QT_HOST_BINS|QT_HOST_BINS/get|QT_INSTALL_BINS|QT_INSTALL_BINS/get)
|
||||
echo "${qtBuildTools}/bin"; exit 0;;
|
||||
QT_HOST_INCLUDES|QT_HOST_INCLUDES/get|QT_INSTALL_HEADERS|QT_INSTALL_HEADERS/get)
|
||||
echo "${qtIncludeRoots}/include"; exit 0;;
|
||||
esac
|
||||
fi
|
||||
exec ${qt6.qtbase}/bin/qmake6 "$@"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue