I want to slim my application down (again). QtDeclarative depends on QtXmlPatterns, QtSvg and QtSql which I don’t use at 开发者_JAVA技巧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) ?
You should be able to configure Qt as follows:
./configure -no-xmlpatterns -no-svg
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
in src/declarative
and note the conditional inclusion of qdeclarativexmllistmodel.cpp
in src/declarative/util/util.pri
.
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.
精彩评论