summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/qt.prf
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-05-30 12:09:00 +0200
committerQt by Nokia <qt-info@nokia.com>2012-06-28 06:21:48 +0200
commit96166fa56abb52157387c4911efbd4e5e6beee93 (patch)
tree4c7b1620d3f9964b41110b2a9c450ef85cc9ff0f /mkspecs/features/qt.prf
parent50eed2d068138e30d508f8b230cfaaeb116e659c (diff)
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>
Diffstat (limited to 'mkspecs/features/qt.prf')
-rw-r--r--mkspecs/features/qt.prf20
1 files changed, 12 insertions, 8 deletions
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index 8af10b143d..03e58b3afd 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -2,15 +2,19 @@ CONFIG *= thread
#handle defines
win32 {
- qt_static:DEFINES += QT_NODLL
- !contains(DEFINES, QT_NODLL) {
- QT_ENV_DLL = $$(QT_DLL)
- QT_ENV_NO_DLL = $$(QT_NODLL)
- isEmpty(QT_ENV_NO_DLL) {
- shared|!isEmpty(QT_ENV_DLL):DEFINES += QT_DLL
- }
- contains(DEFINES, QT_MAKEDLL)|contains(DEFINES, QT_DLL):QMAKE_QT_DLL = 1
+ # ### QT_NODLL and QT_DLL are compatibility, remove before the Qt 5.0 release
+ contains(QT_CONFIG, shared) {
+ DEFINES += QT_DLL
+
+ # 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
+ } else {
+ DEFINES += QT_NODLL
}
+
# Some files include qplatformdefs.h, which lives in the individual mkspec directory
# However, if QMAKESPEC_ORIGINAL is set, the module/app is outside of the QtBase
# directory, and using the default profile. So we add the original mkspecs directory