diff options
-rwxr-xr-x | configure | 14 | ||||
-rw-r--r-- | mkspecs/features/default_post.prf | 5 | ||||
-rw-r--r-- | mkspecs/features/qt.prf | 20 | ||||
-rw-r--r-- | mkspecs/features/qt_module_config.prf | 20 | ||||
-rw-r--r-- | mkspecs/features/qt_plugin.prf | 3 | ||||
-rw-r--r-- | src/concurrent/qtconcurrent_global.h | 20 | ||||
-rw-r--r-- | src/corelib/global/qglobal.h | 122 | ||||
-rw-r--r-- | src/testlib/qtest_global.h | 2 | ||||
-rw-r--r-- | tools/configure/configureapp.cpp | 20 |
9 files changed, 105 insertions, 121 deletions
@@ -5103,10 +5103,10 @@ elif [ "$CFG_DEBUG" = "no" ]; then fi if [ "$CFG_SHARED" = "yes" ]; then QMAKE_OUTDIR="${QMAKE_OUTDIR}-shared" - QMAKE_CONFIG="$QMAKE_CONFIG shared dll" + QT_CONFIG="$QT_CONFIG shared" elif [ "$CFG_SHARED" = "no" ]; then QMAKE_OUTDIR="${QMAKE_OUTDIR}-static" - QMAKE_CONFIG="$QMAKE_CONFIG static" + QT_CONFIG="$QT_CONFIG static" fi #FIXME: qpa is implicit this should all be removed @@ -5552,6 +5552,16 @@ EOF echo '/* Compile time features */' >>"$outpath/src/corelib/global/qconfig.h.new" [ '!' -z "$LicenseKeyExt" ] && echo "#define QT_PRODUCT_LICENSEKEY \"$LicenseKeyExt\"" >>"$outpath/src/corelib/global/qconfig.h.new" +if [ "$CFG_SHARED" = "no" ]; then + cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF +/* Qt was configured for a static build */ +#if !defined(QT_SHARED) && !defined(QT_STATIC) +# define QT_STATIC +#endif + +EOF +fi + if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then echo "#define QT_LARGEFILE_SUPPORT 64" >>"$outpath/src/corelib/global/qconfig.h.new" fi diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index c56729a70d..349faba976 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -2,6 +2,11 @@ contains(TEMPLATE, ".*(lib|app)"):CONFIG += have_target !have_target:!force_qt: CONFIG -= qt +!shared:!dll:!static:!staticlib { + contains(QT_CONFIG, static): CONFIG += static + else: CONFIG += shared +} + QT_BREAKPAD_ROOT_PATH = $$(QT_BREAKPAD_ROOT_PATH) !isEmpty(QT_BREAKPAD_ROOT_PATH): \ # quick test first whether requested ... !staticlib:!static:CONFIG(release, debug|release):have_target: \ # is it applicable? 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 diff --git a/mkspecs/features/qt_module_config.prf b/mkspecs/features/qt_module_config.prf index 65c54f7a21..2046fc5eda 100644 --- a/mkspecs/features/qt_module_config.prf +++ b/mkspecs/features/qt_module_config.prf @@ -12,6 +12,16 @@ isEmpty(MODULE):MODULE = $$section($$list($$basename(_PRO_FILE_)), ., 0, 0) isEmpty(TARGET):error("You must set TARGET before include()'ing $${_FILE_}") isEmpty(VERSION):VERSION = $$QT_VERSION +# Compile as shared/DLL or static according to the option given to configure +# unless overridden +staticlib: CONFIG += static +!static:!shared { + contains(QT_CONFIG, static): \ + CONFIG += static + else: \ + CONFIG += shared +} + ucmodule = $$upper($$MODULE) MODULE_DEPENDS = $$replace(QT, -private$, ) @@ -48,9 +58,9 @@ MODULE_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules-inst/qt_$${MODULE}.pri } else { module_privdep = } - staticlib: \ + static: \ module_build_type = "QT.$${MODULE}.module_config = staticlib" - else:mac:!static:contains(QT_CONFIG, qt_framework): \ + else:mac:contains(QT_CONFIG, qt_framework): \ module_build_type = "QT.$${MODULE}.module_config = lib_bundle" else: \ module_build_type = @@ -157,8 +167,6 @@ mac { } } -win32:!shared:CONFIG += static - win32-borland { # Keep the size of the .tds file for the Qt library smaller than # 34 Mbytes to avoid linking problems @@ -166,8 +174,10 @@ win32-borland { QMAKE_CXXFLAGS_DEBUG += -vi -y- } +DEFINES += QT_BUILDING_QT win32 { INCLUDEPATH += tmp + # ### QT_MAKEDLL is compatibility, remove before the Qt 5.0 release !static: DEFINES+=QT_MAKEDLL } win32-borland:INCLUDEPATH += kernel @@ -177,8 +187,6 @@ aix-g++* { QMAKE_CXXFLAGS += -mminimal-toc } -!static:PRL_EXPORT_DEFINES += QT_SHARED - #install directives load(qt_installs) diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf index d2826822c3..5c29b1d16b 100644 --- a/mkspecs/features/qt_plugin.prf +++ b/mkspecs/features/qt_plugin.prf @@ -12,6 +12,9 @@ contains(QT_CONFIG, separate_debug_info):CONFIG += separate_debug_info contains(QT_CONFIG, separate_debug_info_nocopy):CONFIG += separate_debug_info_nocopy contains(QT_CONFIG, c++11):CONFIG += c++11 +contains(QT_CONFIG, static):CONFIG += static +else:CONFIG += shared + load(qt_targets) wince*:LIBS += $$QMAKE_LIBS_GUI diff --git a/src/concurrent/qtconcurrent_global.h b/src/concurrent/qtconcurrent_global.h index 422bca0258..7bcd6942c5 100644 --- a/src/concurrent/qtconcurrent_global.h +++ b/src/concurrent/qtconcurrent_global.h @@ -48,24 +48,14 @@ # define QT_NO_QFUTURE #endif -#if defined(Q_OS_WIN) && !defined(QT_NODLL) -# if defined(QT_MAKEDLL) -# if defined(QT_BUILD_CONCURRENT_LIB) -# define Q_CONCURRENT_EXPORT Q_DECL_EXPORT -# else -# define Q_CONCURRENT_EXPORT Q_DECL_IMPORT -# endif -# elif defined(QT_DLL) -# define Q_CONCURRENT_EXPORT Q_DECL_IMPORT -# endif -#endif - -#if !defined(Q_CONCURRENT_EXPORT) -# if defined(QT_SHARED) +#ifndef QT_STATIC +# if defined(QT_BUILD_CONCURRENT_LIB) # define Q_CONCURRENT_EXPORT Q_DECL_EXPORT # else -# define Q_CONCURRENT_EXPORT +# define Q_CONCURRENT_EXPORT Q_DECL_IMPORT # endif +#else +# define Q_CONCURRENT_EXPORT #endif #endif // include guard diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 93bdd3c03a..1710e7bb3e 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -460,16 +460,29 @@ class QDataStream; #define QT_SUPPORTS(FEATURE) (!defined(QT_NO_##FEATURE)) /* - Create Qt DLL if QT_DLL is defined (Windows only) + The Qt modules' export macros. + The options are: + - defined(QT_STATIC): Qt was built or is being built in static mode + - defined(QT_SHARED): Qt was built or is being built in shared/dynamic mode + If neither was defined, then QT_SHARED is implied. If Qt was compiled in static + mode, QT_STATIC is defined in qconfig.h. In shared mode, QT_STATIC is implied + for the bootstrapped tools. */ -#if defined(Q_OS_WIN) -# if defined(QT_NODLL) -# undef QT_MAKEDLL -# undef QT_DLL -# elif defined(QT_MAKEDLL) /* create a Qt DLL library */ -# if defined(QT_DLL) -# undef QT_DLL +#ifdef QT_BOOTSTRAPPED +# ifdef QT_SHARED +# error "QT_SHARED and QT_BOOTSTRAPPED together don't make sense. Please fix the build" +# elif !defined(QT_STATIC) +# define QT_STATIC +# endif +#endif + +#if defined(QT_SHARED) || !defined(QT_STATIC) +# ifdef QT_STATIC +# error "Both QT_SHARED and QT_STATIC defined, please make up your mind" +# else +# ifndef QT_SHARED +# define QT_SHARED # endif # if defined(QT_BUILD_CORE_LIB) # define Q_CORE_EXPORT Q_DECL_EXPORT @@ -561,76 +574,27 @@ class QDataStream; # else # define Q_DBUS_EXPORT Q_DECL_IMPORT # endif -# define Q_TEMPLATEDLL -# elif defined(QT_DLL) /* use a Qt DLL library */ -# define Q_CORE_EXPORT Q_DECL_IMPORT -# define Q_GUI_EXPORT Q_DECL_IMPORT -# define Q_WIDGETS_EXPORT Q_DECL_IMPORT -# define Q_PLATFORMSUPPORT_EXPORT Q_DECL_IMPORT -# define Q_PRINTSUPPORT_EXPORT Q_DECL_IMPORT -# define Q_SQL_EXPORT Q_DECL_IMPORT -# define Q_NETWORK_EXPORT Q_DECL_IMPORT -# define Q_SVG_EXPORT Q_DECL_IMPORT -# define Q_CANVAS_EXPORT Q_DECL_IMPORT -# define Q_OPENGL_EXPORT Q_DECL_IMPORT -# define Q_MULTIMEDIA_EXPORT Q_DECL_IMPORT -# define Q_OPENVG_EXPORT Q_DECL_IMPORT -# define Q_XML_EXPORT Q_DECL_IMPORT -# define Q_XMLPATTERNS_EXPORT Q_DECL_IMPORT -# define Q_SCRIPT_EXPORT Q_DECL_IMPORT -# define Q_SCRIPTTOOLS_EXPORT Q_DECL_IMPORT -# define Q_COMPAT_EXPORT Q_DECL_IMPORT -# define Q_DBUS_EXPORT Q_DECL_IMPORT -# define Q_TEMPLATEDLL # endif -# define Q_NO_DECLARED_NOT_DEFINED #else -# if defined(Q_OS_LINUX) && defined(Q_CC_BOR) -# define Q_TEMPLATEDLL -# define Q_NO_DECLARED_NOT_DEFINED -# endif -# undef QT_MAKEDLL /* ignore these for other platforms */ -# undef QT_DLL -#endif - -#if !defined(Q_CORE_EXPORT) -# if defined(QT_SHARED) -# define Q_CORE_EXPORT Q_DECL_EXPORT -# define Q_GUI_EXPORT Q_DECL_EXPORT -# define Q_WIDGETS_EXPORT Q_DECL_EXPORT -# define Q_PLATFORMSUPPORT_EXPORT Q_DECL_EXPORT -# define Q_PRINTSUPPORT_EXPORT Q_DECL_EXPORT -# define Q_SQL_EXPORT Q_DECL_EXPORT -# define Q_NETWORK_EXPORT Q_DECL_EXPORT -# define Q_SVG_EXPORT Q_DECL_EXPORT -# define Q_OPENGL_EXPORT Q_DECL_EXPORT -# define Q_MULTIMEDIA_EXPORT Q_DECL_EXPORT -# define Q_OPENVG_EXPORT Q_DECL_EXPORT -# define Q_XML_EXPORT Q_DECL_EXPORT -# define Q_XMLPATTERNS_EXPORT Q_DECL_EXPORT -# define Q_SCRIPT_EXPORT Q_DECL_EXPORT -# define Q_SCRIPTTOOLS_EXPORT Q_DECL_EXPORT -# define Q_COMPAT_EXPORT Q_DECL_EXPORT -# define Q_DBUS_EXPORT Q_DECL_EXPORT -# else -# define Q_CORE_EXPORT -# define Q_GUI_EXPORT -# define Q_WIDGETS_EXPORT -# define Q_PLATFORMSUPPORT_EXPORT -# define Q_PRINTSUPPORT_EXPORT -# define Q_SQL_EXPORT -# define Q_NETWORK_EXPORT -# define Q_SVG_EXPORT -# define Q_OPENGL_EXPORT -# define Q_MULTIMEDIA_EXPORT -# define Q_OPENVG_EXPORT -# define Q_XML_EXPORT -# define Q_XMLPATTERNS_EXPORT -# define Q_SCRIPT_EXPORT -# define Q_SCRIPTTOOLS_EXPORT -# define Q_COMPAT_EXPORT -# define Q_DBUS_EXPORT -# endif +# define Q_CORE_EXPORT +# define Q_GUI_EXPORT +# define Q_WIDGETS_EXPORT +# define Q_PLATFORMSUPPORT_EXPORT +# define Q_PRINTSUPPORT_EXPORT +# define Q_SQL_EXPORT +# define Q_NETWORK_EXPORT +# define Q_SVG_EXPORT +# define Q_QUICK1_EXPORT +# define Q_DECLARATIVE_EXPORT +# define Q_OPENGL_EXPORT +# define Q_MULTIMEDIA_EXPORT +# define Q_OPENVG_EXPORT +# define Q_XML_EXPORT +# define Q_SCRIPT_EXPORT +# define Q_SCRIPTTOOLS_EXPORT +# define Q_CANVAS_EXPORT +# define Q_COMPAT_EXPORT +# define Q_DBUS_EXPORT #endif /* @@ -638,12 +602,10 @@ class QDataStream; for Qt's internal unit tests. If you want slower loading times and more symbols that can vanish from version to version, feel free to define QT_BUILD_INTERNAL. */ -#if defined(QT_BUILD_INTERNAL) && defined(Q_OS_WIN) && defined(QT_MAKEDLL) +#if defined(QT_BUILD_INTERNAL) && defined(QT_BUILDING_QT) && defined(QT_SHARED) # define Q_AUTOTEST_EXPORT Q_DECL_EXPORT -#elif defined(QT_BUILD_INTERNAL) && defined(Q_OS_WIN) && defined(QT_DLL) +#elif defined(QT_BUILD_INTERNAL) && defined(QT_SHARED) # define Q_AUTOTEST_EXPORT Q_DECL_IMPORT -#elif defined(QT_BUILD_INTERNAL) && !defined(Q_OS_WIN) && defined(QT_SHARED) -# define Q_AUTOTEST_EXPORT Q_DECL_EXPORT #else # define Q_AUTOTEST_EXPORT #endif diff --git a/src/testlib/qtest_global.h b/src/testlib/qtest_global.h index 18d09ba162..13a813ce41 100644 --- a/src/testlib/qtest_global.h +++ b/src/testlib/qtest_global.h @@ -49,7 +49,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -#if !defined(QT_SHARED) && !defined(QT_DLL) +#if defined(QT_STATIC) # define Q_TESTLIB_EXPORT #else # ifdef QT_BUILD_TESTLIB_LIB diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 9188b9a257..56d8d9f8c5 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2305,6 +2305,11 @@ void Configure::generateOutputVars() qtConfig += "release"; } + if (dictionary[ "SHARED" ] == "no") + qtConfig += "static"; + else + qtConfig += "shared"; + if (dictionary[ "WIDGETS" ] == "no") qtConfig += "no-widgets"; @@ -2937,10 +2942,6 @@ void Configure::generateQConfigPri() configStream << "CONFIG+= "; configStream << dictionary[ "BUILD" ]; - if (dictionary[ "SHARED" ] == "yes") - configStream << " shared"; - else - configStream << " static"; if (dictionary[ "LTCG" ] == "yes") configStream << " ltcg"; @@ -3094,12 +3095,13 @@ void Configure::generateConfigfiles() } tmpStream << endl; - if (dictionary[ "SHARED" ] == "yes") { - tmpStream << "#ifndef QT_DLL" << endl; - tmpStream << "#define QT_DLL" << endl; - tmpStream << "#endif" << endl; + if (dictionary[ "SHARED" ] == "no") { + tmpStream << "/* Qt was configured for a static build */" << endl + << "#if !defined(QT_SHARED) && !defined(QT_STATIC)" << endl + << "# define QT_STATIC" << endl + << "#endif" << endl + << endl; } - tmpStream << endl; tmpStream << "/* License information */" << endl; tmpStream << "#define QT_PRODUCT_LICENSEE \"" << licenseInfo[ "LICENSEE" ] << "\"" << endl; tmpStream << "#define QT_PRODUCT_LICENSE \"" << dictionary[ "EDITION" ] << "\"" << endl; |