Files
qt-creator/src/qtcreatorplugin.pri

106 lines
3.3 KiB
Plaintext
Raw Normal View History

depfile = $$replace(_PRO_FILE_PWD_, ([^/]+$), \\1/\\1_dependencies.pri)
exists($$depfile) {
include($$depfile)
isEmpty(QTC_PLUGIN_NAME): \
error("$$basename(depfile) does not define QTC_PLUGIN_NAME.")
} else {
isEmpty(QTC_PLUGIN_NAME): \
error("QTC_PLUGIN_NAME is empty. Maybe you meant to create $$basename(depfile)?")
}
TARGET = $$QTC_PLUGIN_NAME
plugin_deps = $$QTC_PLUGIN_DEPENDS
plugin_test_deps = $$QTC_TEST_DEPENDS
plugin_recmds = $$QTC_PLUGIN_RECOMMENDS
include(../qtcreator.pri)
defineReplace(dependencyName) {
dependencies_file =
for(dir, QTC_PLUGIN_DIRS) {
exists($$dir/$$1/$${1}_dependencies.pri) {
dependencies_file = $$dir/$$1/$${1}_dependencies.pri
break()
}
}
isEmpty(dependencies_file): \
error("Plugin dependency $$dep not found")
include($$dependencies_file)
return($$QTC_PLUGIN_NAME)
}
# for substitution in the .json
dependencyList =
for(dep, plugin_deps) {
dependencyList += " { \"Name\" : \"$$dependencyName($$dep)\", \"Version\" : \"$$QTCREATOR_VERSION\" }"
}
for(dep, plugin_recmds) {
dependencyList += " { \"Name\" : \"$$dependencyName($$dep)\", \"Version\" : \"$$QTCREATOR_VERSION\", \"Type\" : \"optional\" }"
}
for(dep, plugin_test_deps) {
dependencyList += " { \"Name\" : \"$$dependencyName($$dep)\", \"Version\" : \"$$QTCREATOR_VERSION\", \"Type\" : \"test\" }"
}
dependencyList = $$join(dependencyList, ",$$escape_expand(\\n)")
dependencyList = "\"Dependencies\" : [$$escape_expand(\\n)$$dependencyList$$escape_expand(\\n) ]"
Add precompiled headers to Qt Creator sources, to any library and plugin Precompiled headers are a performance feature supported by some compilers to reduce the (re-)compilation time substantially. Usage in Qt: http://doc.qt.nokia.com/4.7/qmake-precompiledheaders.html Due to the usage of precompiled headers Qt without demos/examples/webkit etc might be compiled even faster than Qt Creator on some systems. Despite of Qt, Qt Creator consist of mostly quite small subprojects (plugins and libraries) where the effect would not be so noticeable but still will be visible. This patch adds default precompiled headers to any plugin and library (i.e. by changes in src/qtcreatorplugin.pri and src/qtcreatorlibrary.pri respectively). Almost the same headers are included to general precompiled header (src/shared/qtcreator_pch.h) like used in QtCore, just QPointer/QScopedPointer etc and QDebug are added, it is used almost in any subproject. Also for plugins some QtGui related headers are added (src/shared/qtcreator_gui_pch.h). Default precompiled headers are enabled so: isEmpty(PRECOMPILED_HEADER):PRECOMPILED_HEADER = $$PWD/shared/header.h So it is possible to override this variable in any place in the project file in case if it will be needed. Such overriding is used for Botan (src/libs/3rdparty/botan) - it is not a Qt project, just a pure C++. Most usable headers were used to create special precompiled header for Botan. It is 3rd party component so also src/libs/3rdparty/precompiled_headers folder was created - to use for any future 3rd party components' precompiled headers. To enable a usage of precompiled headers feature in Qt projects 'precompile_header' has to be added to CONFIG. It is done by default for limited platforms only (e.g. not for Linux now), so to enable it on any other platform - e.g. special qmake command has to be used: qmake "CONFIG *= precompile_header" -r ../../qt-creator/ To disable a usage of precompiled headers (on platforms where it is pre-enabled - otherwise it will be used automatically): qmake "CONFIG -= precompile_header" -r ../../qt-creator/ To see on which platforms precompiled headers feature is enabled by default - qt/mkspecs folder has to be checked. Precompiled headers require an additional space on the disk, it looks like for Qt Creator full size of the shadow build folder grows up to 2 times (e.g. 1.5 GB to 3 GB). Test results: Linux x64, gcc 4.4, T7500, 3 GB RAM: About 22.5 minutes are reduced to about 14 minutes (almost 80% faster). Windows x86, vs2008, P8400, 2 GB RAM: About 70 minutes are reduced to about 20 minutes (amazing 250% faster). Merge-request: 2182 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2010-10-13 14:02:49 +02:00
# use gui precompiled header for plugins by default
isEmpty(PRECOMPILED_HEADER):PRECOMPILED_HEADER = $$PWD/shared/qtcreator_gui_pch.h
isEmpty(USE_USER_DESTDIR) {
DESTDIR = $$IDE_PLUGIN_PATH
} else {
win32 {
DESTDIRAPPNAME = "qtcreator"
DESTDIRBASE = "$$(LOCALAPPDATA)"
isEmpty(DESTDIRBASE):DESTDIRBASE="$$(USERPROFILE)\Local Settings\Application Data"
} else:macx {
DESTDIRAPPNAME = "Qt Creator"
DESTDIRBASE = "$$(HOME)/Library/Application Support"
} else:unix {
DESTDIRAPPNAME = "qtcreator"
DESTDIRBASE = "$$(XDG_DATA_HOME)"
isEmpty(DESTDIRBASE):DESTDIRBASE = "$$(HOME)/.local/share/data"
else:DESTDIRBASE = "$$DESTDIRBASE/data"
}
DESTDIR = "$$DESTDIRBASE/QtProject/$$DESTDIRAPPNAME/plugins/$$QTCREATOR_VERSION"
}
2008-12-02 12:01:29 +01:00
LIBS += -L$$DESTDIR
INCLUDEPATH += $$OUT_PWD
2008-12-02 12:01:29 +01:00
# copy the plugin spec
isEmpty(TARGET) {
error("qtcreatorplugin.pri: You must provide a TARGET")
2008-12-02 12:01:29 +01:00
}
PLUGINJSON = $$_PRO_FILE_PWD_/$${TARGET}.json
PLUGINJSON_IN = $${PLUGINJSON}.in
exists($$PLUGINJSON_IN) {
DISTFILES += $$PLUGINJSON_IN
QMAKE_SUBSTITUTES += $$PLUGINJSON_IN
PLUGINJSON = $$OUT_PWD/$${TARGET}.json
} else {
# need to support that for external plugins
DISTFILES += $$PLUGINJSON
}
osx: QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/PlugIns/
include(rpath.pri)
2008-12-02 12:01:29 +01:00
contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
TEMPLATE = lib
CONFIG += plugin plugin_with_soname
linux*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
!macx {
target.path = $$QTC_PREFIX/$$IDE_LIBRARY_BASENAME/qtcreator/plugins
INSTALLS += target
}
MIMETYPES = $$_PRO_FILE_PWD_/$${TARGET}.mimetypes.xml
exists($$MIMETYPES):DISTFILES += $$MIMETYPES
TARGET = $$qtLibraryName($$TARGET)