如何在没有 QtXmlPatterns、QtSvg 和 QtSql 的情况下编译 QtDeclarative
我想(再次)精简我的申请。 QtDeclarative 依赖于 QtXmlPatterns、QtSvg 和 QtSql,我根本不使用它们,所以我想在没有它们的情况下编译该库。
有人更改了 QtDeclarative 的源文件(或如何执行此操作的线索)吗?
I want to slim my application down (again).
QtDeclarative depends on QtXmlPatterns, QtSvg and QtSql which I don’t use at all, so I’d like to compile the library without them.
Has someone altered source-file for QtDeclarative (or a clue how to do this) ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
删除依赖项可能会导致问题,但您可以在 pro 文件中尝试
QT -= sql
等,看看会出现什么错误。否则,您可能会尝试修改 QtDeclarative 的源代码并重新编译 QT,但由于它使用 QML 布局,我认为删除对 QtXmlPatterns 的依赖可能非常困难。这是 QT 的已知缺点之一,您可以使用该框架获得大量功能,但同时也会出现严重的臃肿。另请记住,如果您要做的不仅仅是链接到现有库,LGPL 要求您提供在 QT 本身中更改的源代码。
It likely will cause problems to remove dependencies but you can try
QT -= sql
etc in your pro file and see what errors you get. Otherwise you may attempt modifying the source for QtDeclarative and recompiling QT but since it uses QML layouts I think it might be very difficult to remove the dependency on QtXmlPatterns.This is one of the known drawbacks of QT you get tons of functionality with that framework but at the same time you get significant bloat. Also keep in mind the LGPL requires you to ship the source that you change in QT itself if you are doing more than just linking to existing libraries.
您应该能够按如下方式配置 Qt:
QtDeclarative 中依赖于这些模块的部分将被自动禁用。例如,删除 QtXmlPatterns 只会导致 XmlListModel 不可用,因为它基于 XQuery。
这不会是 LGPL 意义上的 Qt 修改,因此无需自行分发 Qt 源代码。
不幸的是,目前
-no-sql
选项不存在预处理器逻辑,因此这似乎是 QtDeclarative 的硬依赖项。然而,我可以想象一个使这个选项成为可选的补丁将会被接受。如果您想了解如何完成此操作,请查看src/declarative
中#ifdef QT_NO_XMLPATTERNS
的用法,并注意qdeclarativexmllistmodel 的条件包含。 src/declarative/util/util.pri 中的 .cpp
。You should be able to configure Qt as follows:
The parts in QtDeclarative that depend on these modules will be automatically disabled. Removal of QtXmlPatterns will for example just result in the unavailability of XmlListModel, since that is based on XQuery.
This would not be a modification to Qt in the LGPL sense, so no need to go around and distribute Qt source code yourself.
Unfortunately, currently no preprocessor logic exists for the
-no-sql
option, which thus seems to be a hard dependency of QtDeclarative. However, I can imagine a patch that makes this optional would be accepted. If you want to get an idea of how this could be done, check out usage of#ifdef QT_NO_XMLPATTERNS
insrc/declarative
and note the conditional inclusion ofqdeclarativexmllistmodel.cpp
insrc/declarative/util/util.pri
.