qt5base-lts/mkspecs/features/qt.prf

138 lines
5.3 KiB
Plaintext
Raw Normal View History

CONFIG *= thread
#handle defines
win32 {
Update the macros for shared/DLL and static builds Up until now, we had a mess of different macros used for building DLLs, for building shared libraries on Unix systems and for building static libraries. Some of the macros were contradictory and did not work. From now on, there shall be only: - QT_STATIC: indicates that it's a static Qt build and the export macros should expand to empty - QT_SHARED: indicates that it's a shared / dynamic Qt build and the export macros should expand to Q_DECL_EXPORT or Q_DECL_IMPORT, depending on whether the macro corresponds to the current module being built (the QT_BUILD_XXXX_LIB macro comes from the module's .pro file) QT_BOOTSTRAPPED implies QT_STATIC since the bootstrapped tools link statically to some source code. QT_STATIC is recorded in qconfig.h by configure when Qt is configured for static builds. Nothing is recorded for a shared / dynamic build, so QT_SHARED is implied if nothing is defined. This allows for the existence of a static_and_shared build: with nothing recorded, defining QT_STATIC before qglobal.h causes the export macros to be that of the static form. Linking to the static libraries is out of the scope of this change (something for the buildsystem and linker to figure out). From this commit on, the proper way of declaring the export macros for a module called QtFoo is: #ifndef QT_STATIC # ifdef QT_BUILD_FOO_LIB # define Q_FOO_EXPORT Q_DECL_EXPORT # else # define Q_FOO_EXPORT Q_DECL_IMPORT # endif #else # define Q_FOO_EXPORT #endif The type of the Qt build is recorded in QT_CONFIG (in qconfig.pri) so all Qt modules build by default the same type of library. The keywords are "static" and "shared", used in both QT_CONFIG and CONFIG. The previous keyword of "staticlib" is deprecated and should not be used. Discussed-on: http://lists.qt-project.org/pipermail/development/2012-April/003172.html Change-Id: I127896607794795b681c98d08467efd8af49bcf3 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-05-30 10:09:00 +00:00
contains(QT_CONFIG, shared) {
# this variable is read by qmake in qmake/generators/win32/msvc_vcproj.cpp
# function VcprojGenerator::initDeploymentTool(), which contains some hardcoded
# library names (the ones that were static in Qt 4)
# it probably doesn't work anymore and should not be in this file
QMAKE_QT_DLL = 1
}
}
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG
contains(QT_CONFIG, force_asserts):DEFINES += QT_FORCE_ASSERTS
no_keywords:DEFINES += QT_NO_KEYWORDS
plugin { #Qt plugins
static:DEFINES += QT_STATICPLUGIN
DEFINES += QT_PLUGIN
# Triggers both on Qt being configured with -arch boundschecker,
# and if you qmake CONFIG+=boundchecker on your plugin project
boundschecker|contains(QT_CONFIG,boundschecker) {
# This option is added for plugins when Qt is configured for Boundschecker,
# since we want Boundschecker to not instrument the qt_plugin_query_verification_data
# function, as we call that function without the plugin's dependent DLLs, thus
# Boundscheckers instrumentation will fail. The function only returns a const char *,
# so no instrumentation is really needed on that function anyways.
QMAKE_CFLAGS += /nmignore:*:qt_plugin_query_verification_data
QMAKE_CXXFLAGS += /nmignore:*:qt_plugin_query_verification_data
}
}
qtestlib {
warning("CONFIG+=qtestlib is deprecated. Use QT+=testlib instead.")
QT += testlib
}
qdbus {
warning("CONFIG+=qdbus is deprecated. Use QT+=dbus instead.")
QT += dbus
}
help {
warning("CONFIG+=help is deprecated. Use QT+=help instead.")
QT += help-private # sic!
}
designer {
warning("CONFIG+=designer is deprecated. Use QT+=designer instead.")
QT += designer
}
uitools {
warning("CONFIG+=uitools is deprecated. Use QT+=uitools instead.")
QT += uitools
}
qaxcontainer {
warning("CONFIG+=qaxcontainer is deprecated. Use QT+=axcontainer instead.")
QT += axcontainer
}
qaxserver {
warning("CONFIG+=qaxserver is deprecated. Use QT+=axserver instead.")
QT += axserver
}
unset(using_privates)
qtAddModules(QT, LIBS)
qtAddModules(QT_PRIVATE, LIBS_PRIVATE)
!isEmpty(using_privates):!auto_use_privates:!no_private_qt_headers_warning:if(!debug_and_release|!build_pass) {
message("This project is using private headers and will therefore be tied to this specific Qt module build version.")
message("Running this project against other versions of the Qt modules may crash at any arbitrary point.")
message("This is not a bug, but a result of using Qt internals. You have been warned!")
}
qtAddRpathLink($$QT $$QT_PRIVATE)
wince*:static:gui {
QTLIB += qmenu_wce.res
}
QT_PLUGIN_VERIFY = DEPLOYMENT_PLUGIN
contains(QT_CONFIG, static) {
QT_PLUGIN_VERIFY += QTPLUGIN
force_import_plugins|contains(TEMPLATE, .*app) {
needs_qpa_plugin:import_qpa_plugin {
qpa_minimal_plugin: \
QTPLUGIN += qminimal
else: \
QTPLUGIN += $$QT_DEFAULT_QPA_PLUGIN
}
import_plugins:!isEmpty(QTPLUGIN) {
IMPORT_FILE_CONT = \
"// This file is autogenerated by qmake. It imports static plugin classes for" \
"// static plugins specified using QTPLUGIN and QT_PLUGIN_CLASS.<plugin> variables." \
"$${LITERAL_HASH}include <QtPlugin>"
for(IMPORT_PLUG, $$list($$unique(QTPLUGIN))) {
PLUG_CLASS = $$eval(QT_PLUGIN.$${IMPORT_PLUG}.CLASS_NAME)
!isEmpty(PLUG_CLASS): \
IMPORT_FILE_CONT += "Q_IMPORT_PLUGIN($$PLUG_CLASS)"
else: \
warning("Plugin class name could not be determined for $$IMPORT_PLUG plugin.")
}
IMPORT_CPP = $$OUT_PWD/$$lower($$basename(TARGET))_plugin_import.cpp
write_file($$IMPORT_CPP, IMPORT_FILE_CONT)|error("Aborting.")
SOURCES += $$IMPORT_CPP
QMAKE_DISTCLEAN += $$IMPORT_CPP
}
}
}
for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) {
for(QTPLUG, $$list($$lower($$unique($$QT_CURRENT_VERIFY)))) {
# Check if the plugin is known to Qt. We can use this to determine
# the plugin path. Unknown plugins must rely on the default link path.
QT_PLUGINPATH = $$eval(QT_PLUGIN.$${QTPLUG}.TYPE)
# Generate the plugin linker line
target_qt:isEqual(TARGET, QTPLUG) {
warning($$TARGET cannot have a QTPLUGIN of $$QTPLUG)
} else {
QT_LINKAGE = -l$${QTPLUG}$$qtPlatformTargetSuffix()
}
# Only link against plugin in static builds
isEqual(QT_CURRENT_VERIFY, QTPLUGIN): {
!isEmpty(QT_PLUGINPATH): LIBS *= -L$$[QT_INSTALL_PLUGINS/get]/$$QT_PLUGINPATH
LIBS += $$QT_LINKAGE
# if the plugin is linked statically there is no need to deploy it
DEPLOYMENT_PLUGIN -= $$QT_CURRENT_VERIFY
}
isEqual(QT_CURRENT_VERIFY, DEPLOYMENT_PLUGIN):shared:wince*: {
QT_ITEM =
CONFIG(debug, debug|release): QT_ITEM = $${QTPLUG}d4.dll
else: QT_ITEM = $${QTPLUG}4.dll
eval(qt_additional_plugin_$${QTPLUG}.files = $$[QT_INSTALL_PLUGINS/get]/$${QT_PLUGINPATH}/$${QT_ITEM})
eval(qt_additional_plugin_$${QTPLUG}.path = $${QT_PLUGINPATH})
DEPLOYMENT *= qt_additional_plugin_$${QTPLUG}
}
}
}