Go to file
Thiago Macieira 96166fa56a 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-06-28 06:21:48 +02:00
bin let default_pre add modules to the qmake path 2012-06-19 16:46:03 +02:00
config.tests clang: Do not use libstdc++ when C++11 is enabled 2012-06-19 00:39:28 +02:00
dist Document that the object of a plugin must be default-constructible. 2012-06-27 14:43:00 +02:00
doc Remove the MacMainWindow example. 2012-05-30 01:54:45 +02:00
examples QGraphicsItem::setAcceptsHoverEvents is deprecated, replace it 2012-06-26 04:18:22 +02:00
lib Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
mkspecs Update the macros for shared/DLL and static builds 2012-06-28 06:21:48 +02:00
qmake clean up specdir() 2012-06-26 19:29:34 +02:00
src Update the macros for shared/DLL and static builds 2012-06-28 06:21:48 +02:00
tests Fixed qsslsocket_onDemandCertificates_{static,member} 2012-06-28 02:18:42 +02:00
tools Update the macros for shared/DLL and static builds 2012-06-28 06:21:48 +02:00
util QUnicodeTables: some internal API renamings 2012-06-22 09:47:59 +02:00
.gitattributes Added .tag file with Git revision. 2011-05-03 16:23:49 +02:00
.gitignore ignore mkspecs/modules-inst/ 2012-06-26 11:51:29 +02:00
.tag Added .tag file with Git revision. 2011-05-03 16:23:49 +02:00
configure Update the macros for shared/DLL and static builds 2012-06-28 06:21:48 +02:00
configure.bat Remove Q_BYTE_ORDER and -*-endian arguments from configures 2012-03-02 14:48:00 +01:00
header.BSD Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
header.FDL Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
header.LGPL Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
header.LGPL-ONLY Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
INSTALL Remove Symbian specific code from qtbase. 2012-01-31 07:08:31 +01:00
LGPL_EXCEPTION.txt Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
LICENSE.FDL Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
LICENSE.GPL Add the LICENSE.GPL file to the module referenced from license headers 2012-05-20 22:41:08 +02:00
LICENSE.LGPL Update contact information in license headers. 2012-01-23 04:04:33 +01:00
LICENSE.PREVIEW.COMMERCIAL Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
qtbase.pro Restore building of examples, tests. 2012-06-22 05:21:52 +02:00
sync.profile don't refer to removed headers 2012-06-19 16:46:04 +02:00