diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-05-28 16:41:49 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-06-03 15:14:42 +0200 |
commit | e4079eca49adce16e31dac2a18d49d7a55817891 (patch) | |
tree | 1dfb960ec1115b1f552afe8a013058542389505e /qmake | |
parent | f32a6cfb6b6236533508901f114ab57396da8ff3 (diff) | |
parent | ec6dc5f78453048c4f0604655a34c6c20c79d819 (diff) |
Merge remote-tracking branch 'origin/dev' into wip/cmake
Take 5.
Change-Id: Ifb2d20e95ba824e45e667fba6c2ba45389991cc3
Diffstat (limited to 'qmake')
35 files changed, 619 insertions, 414 deletions
diff --git a/qmake/.prev_CMakeLists.txt b/qmake/.prev_CMakeLists.txt new file mode 100644 index 0000000000..f6b331b762 --- /dev/null +++ b/qmake/.prev_CMakeLists.txt @@ -0,0 +1,178 @@ +# Generated from qmake.pro. + +##################################################################### +## qmake Binary: +##################################################################### + +add_qt_executable(qmake + SOURCES + ../src/corelib/codecs/qutfcodec.cpp ../src/corelib/codecs/qutfcodec_p.h + ../src/corelib/global/qglobal.cpp ../src/corelib/global/qglobal.h + ../src/corelib/global/qlibraryinfo.cpp + ../src/corelib/global/qlogging.cpp + ../src/corelib/global/qmalloc.cpp + ../src/corelib/global/qnumeric.cpp ../src/corelib/global/qnumeric.h + ../src/corelib/io/qabstractfileengine.cpp ../src/corelib/io/qabstractfileengine_p.h + ../src/corelib/io/qbuffer.cpp ../src/corelib/io/qbuffer.h + ../src/corelib/io/qdir.cpp ../src/corelib/io/qdir.h ../src/corelib/io/qdir_p.h + ../src/corelib/io/qdiriterator.cpp ../src/corelib/io/qdiriterator.h + ../src/corelib/io/qfile.cpp ../src/corelib/io/qfile.h + ../src/corelib/io/qfiledevice.cpp + ../src/corelib/io/qfileinfo.cpp ../src/corelib/io/qfileinfo.h + ../src/corelib/io/qfilesystemengine.cpp + ../src/corelib/io/qfilesystementry.cpp + ../src/corelib/io/qfsfileengine.cpp + ../src/corelib/io/qfsfileengine_iterator.cpp + ../src/corelib/io/qiodevice.cpp ../src/corelib/io/qiodevice.h + ../src/corelib/io/qsettings.cpp + ../src/corelib/io/qtemporaryfile.cpp ../src/corelib/io/qtemporaryfile.h + ../src/corelib/kernel/qmetatype.cpp ../src/corelib/kernel/qmetatype.h + ../src/corelib/kernel/qsystemerror.cpp ../src/corelib/kernel/qsystemerror_p.h + ../src/corelib/kernel/qvariant.cpp + ../src/corelib/plugin/quuid.cpp ../src/corelib/plugin/quuid.h + ../src/corelib/serialization/qjson.cpp ../src/corelib/serialization/qjson_p.h + ../src/corelib/serialization/qjsonarray.cpp ../src/corelib/serialization/qjsonarray.h + ../src/corelib/serialization/qjsondocument.cpp ../src/corelib/serialization/qjsondocument.h + ../src/corelib/serialization/qjsonobject.cpp ../src/corelib/serialization/qjsonobject.h + ../src/corelib/serialization/qjsonparser.cpp ../src/corelib/serialization/qjsonparser_p.h + ../src/corelib/serialization/qjsonvalue.cpp ../src/corelib/serialization/qjsonvalue.h + ../src/corelib/serialization/qjsonwriter_p.h + ../src/corelib/serialization/qtextstream.cpp ../src/corelib/serialization/qtextstream.h + ../src/corelib/serialization/qxmlstream.cpp ../src/corelib/serialization/qxmlstream.h + ../src/corelib/serialization/qxmlutils.cpp ../src/corelib/serialization/qxmlutils_p.h + ../src/corelib/tools/qarraydata.cpp ../src/corelib/tools/qarraydata.h + ../src/corelib/tools/qarraydataops.h + ../src/corelib/tools/qarraydatapointer.h + ../src/corelib/tools/qbitarray.cpp ../src/corelib/tools/qbitarray.h + ../src/corelib/tools/qbytearray.cpp ../src/corelib/tools/qbytearray.h + ../src/corelib/tools/qbytearraymatcher.cpp ../src/corelib/tools/qbytearraymatcher.h + ../src/corelib/tools/qchar.h + ../src/corelib/tools/qcryptographichash.cpp ../src/corelib/tools/qcryptographichash.h + ../src/corelib/tools/qdatetime.cpp ../src/corelib/tools/qdatetime.h ../src/corelib/tools/qdatetime_p.h + ../src/corelib/tools/qhash.cpp ../src/corelib/tools/qhash.h + ../src/corelib/tools/qlist.cpp ../src/corelib/tools/qlist.h + ../src/corelib/tools/qlocale.cpp ../src/corelib/tools/qlocale.h + ../src/corelib/tools/qlocale_tools.cpp ../src/corelib/tools/qlocale_tools_p.h + ../src/corelib/tools/qmap.cpp ../src/corelib/tools/qmap.h + ../src/corelib/tools/qregexp.cpp ../src/corelib/tools/qregexp.h + ../src/corelib/tools/qstring.cpp ../src/corelib/tools/qstring.h + ../src/corelib/tools/qstring_compat.cpp + ../src/corelib/tools/qstringlist.cpp ../src/corelib/tools/qstringlist.h + ../src/corelib/tools/qstringmatcher.h + ../src/corelib/tools/qvector.h + ../src/corelib/tools/qversionnumber.cpp ../src/corelib/tools/qversionnumber.h + ../src/corelib/tools/qvsnprintf.cpp + cachekeys.h + generators/mac/pbuilder_pbx.cpp generators/mac/pbuilder_pbx.h + generators/makefile.cpp generators/makefile.h + generators/makefiledeps.cpp generators/makefiledeps.h + generators/metamakefile.cpp generators/metamakefile.h + generators/projectgenerator.cpp generators/projectgenerator.h + generators/unix/unixmake.cpp generators/unix/unixmake.h + generators/unix/unixmake2.cpp + generators/win32/mingw_make.cpp generators/win32/mingw_make.h + generators/win32/msbuild_objectmodel.cpp generators/win32/msbuild_objectmodel.h + generators/win32/msvc_nmake.cpp generators/win32/msvc_nmake.h + generators/win32/msvc_objectmodel.cpp generators/win32/msvc_objectmodel.h + generators/win32/msvc_vcproj.cpp generators/win32/msvc_vcproj.h + generators/win32/msvc_vcxproj.cpp generators/win32/msvc_vcxproj.h + generators/win32/winmakefile.cpp generators/win32/winmakefile.h + generators/xmloutput.cpp generators/xmloutput.h + library/ioutils.cpp library/ioutils.h + library/proitems.cpp library/proitems.h + library/qmake_global.h + library/qmakebuiltins.cpp + library/qmakeevaluator.cpp library/qmakeevaluator.h library/qmakeevaluator_p.h + library/qmakeglobals.cpp library/qmakeglobals.h + library/qmakeparser.cpp library/qmakeparser.h + library/qmakevfs.cpp library/qmakevfs.h + main.cpp + meta.cpp meta.h + option.cpp option.h + project.cpp project.h + property.cpp property.h + DEFINES + =\"\" + PROEVALUATOR_FULL + QT_BOOTSTRAPPED + QT_BUILD_QMAKE + QT_NO_FOREACH + QT_VERSION_MAJOR= + QT_VERSION_MINOR= + QT_VERSION_PATCH= + INCLUDE_DIRECTORIES + . + ../include + ../include/QtCore ../include/QtCore + ../include/QtCore//QtCore + ../src/corelib/global + generators + generators/mac + generators/unix + generators/win32 + library +) + +#### Keys ignored in scope 1:.:.:qmake.pro:<TRUE>: +# CONFIG = "cmdline" "-qt" +# PRECOMPILED_HEADER = "qmake_pch.h" +# _OPTION = "host_build" + +## Scopes: +##################################################################### + +extend_target(qmake CONDITION WIN32 + SOURCES + ../src/corelib/global/qoperatingsystemversion_win.cpp + ../src/corelib/io/qfilesystemengine_win.cpp + ../src/corelib/io/qfilesystemiterator_win.cpp + ../src/corelib/io/qfsfileengine_win.cpp + ../src/corelib/io/qsettings_win.cpp + ../src/corelib/plugin/qsystemlibrary.cpp + ../src/corelib/tools/qlocale_win.cpp + registry.cpp-NOTFOUND + DEFINES + UNICODE + _CRT_SECURE_NO_WARNINGS + _ENABLE_EXTENDED_ALIGNED_STORAGE + _SCL_SECURE_NO_WARNINGS + PUBLIC_LIBRARIES + advapi32 + kernel32 + netapi32 + ole32 +) + +extend_target(qmake CONDITION UNIX + SOURCES + ../src/corelib/io/qfilesystemengine_unix.cpp + ../src/corelib/io/qfilesystemiterator_unix.cpp + ../src/corelib/io/qfsfileengine_unix.cpp + ../src/corelib/kernel/qcore_unix.cpp + ../src/corelib/tools/qlocale_unix.cpp +) + +extend_target(qmake CONDITION APPLE_OSX + SOURCES + qcore_foundation.mm + qcore_mac.cpp + qoperatingsystemversion_darwin.mm + qsettings_mac.cpp + PUBLIC_LIBRARIES + ${FWApplicationServices} + ${FWCoreServices} + ${FWFoundation} + COMPILE_OPTIONS + -fconstant-cfstrings +) + +extend_target(qmake CONDITION WIN32 AND mingw + PUBLIC_LIBRARIES + uuid +) + +extend_target(qmake CONDITION CLANG AND WIN32 + COMPILE_OPTIONS + -Wno-microsoft-enum-value + -fms-compatibility-version=19.00.23506 +) diff --git a/qmake/CMakeLists.txt b/qmake/CMakeLists.txt index 04b89c3f95..9354558de0 100644 --- a/qmake/CMakeLists.txt +++ b/qmake/CMakeLists.txt @@ -67,7 +67,6 @@ add_qt_tool(qmake # special case ../src/corelib/tools/qcryptographichash.cpp ../src/corelib/tools/qcryptographichash.h ../src/corelib/tools/qdatetime.cpp ../src/corelib/tools/qdatetime.h ../src/corelib/tools/qdatetime_p.h ../src/corelib/tools/qhash.cpp ../src/corelib/tools/qhash.h - ../src/corelib/tools/qlinkedlist.cpp ../src/corelib/tools/qlinkedlist.h ../src/corelib/tools/qlist.cpp ../src/corelib/tools/qlist.h ../src/corelib/tools/qlocale.cpp ../src/corelib/tools/qlocale.h ../src/corelib/tools/qlocale_tools.cpp ../src/corelib/tools/qlocale_tools_p.h @@ -123,9 +122,10 @@ add_qt_tool(qmake # special case # . # special case library generators + generators/mac generators/unix generators/win32 - generators/mac + library $<TARGET_PROPERTY:Qt::CorePrivate,INTERFACE_INCLUDE_DIRECTORIES> # special case ${CMAKE_BINARY_DIR}/src/corelib/global # special case: for qconfig.cpp ) @@ -152,8 +152,8 @@ extend_target(qmake CONDITION WIN32 library/registry.cpp # special case DEFINES UNICODE - _ENABLE_EXTENDED_ALIGNED_STORAGE _CRT_SECURE_NO_WARNINGS + _ENABLE_EXTENDED_ALIGNED_STORAGE _SCL_SECURE_NO_WARNINGS PUBLIC_LIBRARIES advapi32 diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index 0f69b6b487..166ec33c1b 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -28,7 +28,7 @@ QOBJS = \ qmetatype.o qsystemerror.o qvariant.o \ quuid.o \ qarraydata.o qbitarray.o qbytearray.o qbytearraymatcher.o \ - qcryptographichash.o qdatetime.o qhash.o qlinkedlist.o qlist.o \ + qcryptographichash.o qdatetime.o qhash.o qlist.o \ qlocale.o qlocale_tools.o qmap.o qregexp.o qringbuffer.o \ qstringbuilder.o qstring_compat.o qstring.o qstringlist.o qversionnumber.o \ qvsnprintf.o qxmlstream.o qxmlutils.o \ @@ -112,7 +112,6 @@ DEPEND_SRC = \ $(SOURCE_PATH)/src/corelib/tools/qcryptographichash.cpp \ $(SOURCE_PATH)/src/corelib/tools/qdatetime.cpp \ $(SOURCE_PATH)/src/corelib/tools/qhash.cpp \ - $(SOURCE_PATH)/src/corelib/tools/qlinkedlist.cpp \ $(SOURCE_PATH)/src/corelib/tools/qlist.cpp \ $(SOURCE_PATH)/src/corelib/tools/qlocale.cpp \ $(SOURCE_PATH)/src/corelib/tools/qlocale_tools.cpp \ @@ -442,9 +441,6 @@ qmap.o: $(SOURCE_PATH)/src/corelib/tools/qmap.cpp qhash.o: $(SOURCE_PATH)/src/corelib/tools/qhash.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< -qlinkedlist.o: $(SOURCE_PATH)/src/corelib/tools/qlinkedlist.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $< - qcryptographichash.o: $(SOURCE_PATH)/src/corelib/tools/qcryptographichash.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 6ab40c6765..1777741df4 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -88,7 +88,6 @@ QTOBJS= \ qringbuffer.obj \ qdebug.obj \ qlist.obj \ - qlinkedlist.obj \ qlocale.obj \ qlocale_tools.obj \ qlocale_win.obj \ diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index aba5be61dd..b271abcee3 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -974,6 +974,12 @@ the compiler does not support C++17, or can't select the C++ standard. By default, support is disabled. \row \li c++17 \li Same as c++1z. + \row \li c++2a \li C++2a support is enabled. This option has no effect if + the compiler does not support C++2a, or can't select the C++ standard. + By default, support is disabled. + \row \li c++latest \li Support for the latest C++ language standard is + enabled that is supported by the compiler. By default, this option is + disabled. \row \li strict_c++ \li Disables support for C++ compiler extensions. By default, they are enabled. \row \li depend_includepath \li Appending the value of INCLUDEPATH to @@ -1105,6 +1111,8 @@ \header \li Option \li Description \row \li app_bundle \li Puts the executable into a bundle (this is the default). \row \li lib_bundle \li Puts the library into a library bundle. + \row \li plugin_bundle \li Puts the plugin into a plugin bundle. This value + is not supported by the Xcode project generator. \endtable The build process for bundles is also influenced by @@ -1146,8 +1154,9 @@ \target DEPENDPATH \section1 DEPENDPATH - Specifies a list of all directories to look in to resolve dependencies. This - variable is used when crawling through \c included files. + Specifies a list of directories for qmake to scan, to resolve dependencies. + This variable is used when qmake crawls through the header files that you + \c{#include} in your source code. \target DESTDIR \section1 DESTDIR @@ -1158,6 +1167,10 @@ \snippet code/doc_src_qmake-manual.pro 30 + \note The list of supported characters can depend on + the used build tool. In particular, parentheses do not + work with \c{make}. + \target DISTFILES \section1 DISTFILES @@ -1271,6 +1284,41 @@ \snippet code/doc_src_qmake-manual.pro 36 + \c INSTALLS has a \c{.CONFIG} member that can take several values: + + \table + \header + \li Value + \li Description + \row + \li no_check_exists + \li If not set, qmake looks to see if the files to install actually + exist. If these files don't exist, qmake doesn’t create the + install rule. Use this config value if you need to install + files that are generated as part of your build process, like + HTML files created by qdoc. + \row + \li nostrip + \li If set, the typical Unix strip functionality is turned off and + the debug information will remain in the binary. + \row + \li executable + \li On Unix, this sets the executable flag. + \row + \li no_build + \li When you do a \c{make install}, and you don't have a build of + the project yet, the project is first built, and then installed. + If you don't want this behavior, set this config value to ensure + that the build target is not added as a dependency to the install + target. + \row + \li no_default_install + \li A project has a top-level project target where, when you do a + \c{make install}, everything is installed. But, if you have an + install target with this config value set, it's not installed by + default. You then have to explicitly say \c{make install_<file>}. + \endtable + For more information, see \l{Installing Files}. This variable is also used to specify which additional files will be @@ -1580,6 +1628,14 @@ The value of this variable is typically handled by qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + \target QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO + \section1 QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO + + Specifies the C compiler flags for release builds where + \c{force_debug_info} is set in \c{CONFIG}. + The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + \target QMAKE_CFLAGS_SHLIB \section1 QMAKE_CFLAGS_SHLIB @@ -1648,6 +1704,14 @@ The value of this variable is typically handled by qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + \target QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO + \section1 QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO + + Specifies the C++ compiler flags for release builds where + \c{force_debug_info} is set in \c{CONFIG}. + The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + \target QMAKE_CXXFLAGS_SHLIB \section1 QMAKE_CXXFLAGS_SHLIB @@ -2028,6 +2092,12 @@ The value of this variable is typically handled by qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + \section1 QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO + + Specifies the linker flags for release builds where \c{force_debug_info} is + set in \c{CONFIG}. The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + \section1 QMAKE_LFLAGS_APP Specifies the linker flags for building applications. @@ -4508,7 +4578,10 @@ \c QMAKEFEATURES environment variable) \li \c $$QMAKEFEATURES/myfeatures.prf (for each directory listed in the \c QMAKEFEATURES property variable) - \li \c myfeatures.prf (in the project's root directory) + \li \c myfeatures.prf (in the project's root directory). The project root + is determined by the top-level \c{.pro} file. However, if you place the + \c{.qmake.cache} file in a sub-directory or the directory of a + sub-project, then the project root becomes the sub-directory itself. \li \c $QMAKEPATH/mkspecs/features/unix/myfeatures.prf and \c $QMAKEPATH/mkspecs/features/myfeatures.prf (for each directory listed in the \c QMAKEPATH environment variable) @@ -4813,6 +4886,7 @@ \li Unix \list \li GCC 3.4 and above + \li clang \endlist \endlist diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 07832041a7..b3c6ba4869 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -60,11 +60,6 @@ static QString qtSha1(const QByteArray &src) return QString::fromLatin1(digest.toHex()); } -ProjectBuilderMakefileGenerator::ProjectBuilderMakefileGenerator() : UnixMakefileGenerator() -{ - -} - bool ProjectBuilderMakefileGenerator::writeMakefile(QTextStream &t) { @@ -541,7 +536,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) debug_msg(1, "pbuilder: Creating file: %s", mkfile.toLatin1().constData()); QTextStream mkt(&mkf); writeHeader(mkt); - mkt << "QMAKE = " << var("QMAKE_QMAKE") << endl; + mkt << "QMAKE = " << var("QMAKE_QMAKE") << Qt::endl; project->values("QMAKE_MAKE_QMAKE_EXTRA_COMMANDS") << "@echo 'warning: Xcode project has been regenerated, custom settings have been lost. " \ "Use CONFIG+=no_autoqmake to prevent this behavior in the future, " \ @@ -740,15 +735,15 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) debug_msg(1, "pbuilder: Creating file: %s", mkfile.toLatin1().constData()); QTextStream mkt(&mkf); writeHeader(mkt); - mkt << "MOC = " << var("QMAKE_MOC") << endl; - mkt << "UIC = " << var("QMAKE_UIC") << endl; - mkt << "LEX = " << var("QMAKE_LEX") << endl; - mkt << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl; - mkt << "YACC = " << var("QMAKE_YACC") << endl; - mkt << "YACCFLAGS = " << var("QMAKE_YACCFLAGS") << endl; + mkt << "MOC = " << var("QMAKE_MOC") << Qt::endl; + mkt << "UIC = " << var("QMAKE_UIC") << Qt::endl; + mkt << "LEX = " << var("QMAKE_LEX") << Qt::endl; + mkt << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << Qt::endl; + mkt << "YACC = " << var("QMAKE_YACC") << Qt::endl; + mkt << "YACCFLAGS = " << var("QMAKE_YACCFLAGS") << Qt::endl; mkt << "DEFINES = " << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") - << varGlue("DEFINES","-D"," -D","") << endl; + << varGlue("DEFINES","-D"," -D","") << Qt::endl; mkt << "INCPATH ="; { const ProStringList &incs = project->values("INCLUDEPATH"); @@ -757,9 +752,9 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } if(!project->isEmpty("QMAKE_FRAMEWORKPATH_FLAGS")) mkt << " " << var("QMAKE_FRAMEWORKPATH_FLAGS"); - mkt << endl; - mkt << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; - mkt << "MOVE = " << var("QMAKE_MOVE") << endl << endl; + mkt << Qt::endl; + mkt << "DEL_FILE = " << var("QMAKE_DEL_FILE") << Qt::endl; + mkt << "MOVE = " << var("QMAKE_MOVE") << Qt::endl << Qt::endl; mkt << "preprocess: compilers\n"; mkt << "clean preprocess_clean: compiler_clean\n\n"; writeExtraTargets(mkt); @@ -789,7 +784,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } } } - mkt << endl; + mkt << Qt::endl; writeExtraCompilerTargets(mkt); writingUnixMakefileGenerator = false; } @@ -994,12 +989,12 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) tmp = project->values("SUBLIBS"); for(int i = 0; i < tmp.count(); i++) t << escapeFilePath("tmp/lib" + tmp[i] + ".a") << ' '; - t << endl << endl; + t << Qt::endl << Qt::endl; mkt << "sublibs: $(SUBLIBS)\n\n"; tmp = project->values("SUBLIBS"); for(int i = 0; i < tmp.count(); i++) t << escapeFilePath("tmp/lib" + tmp[i] + ".a") + ":\n\t" - << var(ProKey("MAKELIB" + tmp[i])) << endl << endl; + << var(ProKey("MAKELIB" + tmp[i])) << Qt::endl << Qt::endl; mkt.flush(); mkf.close(); writingUnixMakefileGenerator = false; @@ -1236,9 +1231,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n" << "\t\t};\n"; - QMapIterator<ProString, ProStringList> it(embedded_plugins); - while (it.hasNext()) { - it.next(); + for (auto it = embedded_plugins.cbegin(), end = embedded_plugins.cend(); it != end; ++it) { QString suffix = !it.key().isEmpty() ? (" (" + it.key() + ")") : QString(); QString grp3("Embed PlugIns" + suffix), key3 = keyFor(grp3); project->values("QMAKE_PBX_BUILDPHASES").append(key3); diff --git a/qmake/generators/mac/pbuilder_pbx.h b/qmake/generators/mac/pbuilder_pbx.h index f15c814cb4..ac0d63606d 100644 --- a/qmake/generators/mac/pbuilder_pbx.h +++ b/qmake/generators/mac/pbuilder_pbx.h @@ -61,19 +61,12 @@ class ProjectBuilderMakefileGenerator : public UnixMakefileGenerator QString writeSettings(const QString &var, const ProStringList &vals, int flags=0, int indent_level=0); public: - ProjectBuilderMakefileGenerator(); - ~ProjectBuilderMakefileGenerator(); - bool supportsMetaBuild() override { return false; } bool openOutput(QFile &, const QString &) const override; protected: bool doPrecompiledHeaders() const override { return false; } bool doDepends() const override { return writingUnixMakefileGenerator && UnixMakefileGenerator::doDepends(); } }; - -inline ProjectBuilderMakefileGenerator::~ProjectBuilderMakefileGenerator() -{ } - QT_END_NAMESPACE #endif // PBUILDER_PBX_H diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index b634ec622b..bf8eb3f5da 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -94,13 +94,6 @@ bool MakefileGenerator::mkdir(const QString &in_path) const return QDir().mkpath(path); } -// ** base makefile generator -MakefileGenerator::MakefileGenerator() : - no_io(false), project(nullptr) -{ -} - - void MakefileGenerator::verifyCompilers() { @@ -994,25 +987,25 @@ MakefileGenerator::writePrlFile(QTextStream &t) QString bdir = Option::output_dir; if(bdir.isEmpty()) bdir = qmake_getpwd(); - t << "QMAKE_PRL_BUILD_DIR =" << qv(bdir) << endl; + t << "QMAKE_PRL_BUILD_DIR =" << qv(bdir) << Qt::endl; - t << "QMAKE_PRO_INPUT =" << qv(project->projectFile().section('/', -1)) << endl; + t << "QMAKE_PRO_INPUT =" << qv(project->projectFile().section('/', -1)) << Qt::endl; if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) - t << "QMAKE_PRL_SOURCE_DIR =" << qv(project->first("QMAKE_ABSOLUTE_SOURCE_PATH")) << endl; - t << "QMAKE_PRL_TARGET =" << qv(project->first("LIB_TARGET")) << endl; + t << "QMAKE_PRL_SOURCE_DIR =" << qv(project->first("QMAKE_ABSOLUTE_SOURCE_PATH")) << Qt::endl; + t << "QMAKE_PRL_TARGET =" << qv(project->first("LIB_TARGET")) << Qt::endl; if(!project->isEmpty("PRL_EXPORT_DEFINES")) - t << "QMAKE_PRL_DEFINES =" << qv(project->values("PRL_EXPORT_DEFINES")) << endl; + t << "QMAKE_PRL_DEFINES =" << qv(project->values("PRL_EXPORT_DEFINES")) << Qt::endl; if(!project->isEmpty("PRL_EXPORT_CFLAGS")) - t << "QMAKE_PRL_CFLAGS =" << qv(project->values("PRL_EXPORT_CFLAGS")) << endl; + t << "QMAKE_PRL_CFLAGS =" << qv(project->values("PRL_EXPORT_CFLAGS")) << Qt::endl; if(!project->isEmpty("PRL_EXPORT_CXXFLAGS")) - t << "QMAKE_PRL_CXXFLAGS =" << qv(project->values("PRL_EXPORT_CXXFLAGS")) << endl; + t << "QMAKE_PRL_CXXFLAGS =" << qv(project->values("PRL_EXPORT_CXXFLAGS")) << Qt::endl; if(!project->isEmpty("CONFIG")) - t << "QMAKE_PRL_CONFIG =" << qv(project->values("CONFIG")) << endl; + t << "QMAKE_PRL_CONFIG =" << qv(project->values("CONFIG")) << Qt::endl; if(!project->isEmpty("TARGET_VERSION_EXT")) - t << "QMAKE_PRL_VERSION = " << project->first("TARGET_VERSION_EXT") << endl; + t << "QMAKE_PRL_VERSION = " << project->first("TARGET_VERSION_EXT") << Qt::endl; else if(!project->isEmpty("VERSION")) - t << "QMAKE_PRL_VERSION = " << project->first("VERSION") << endl; + t << "QMAKE_PRL_VERSION = " << project->first("VERSION") << Qt::endl; if(project->isActiveConfig("staticlib") || project->isActiveConfig("explicitlib")) { ProStringList libs; if (!project->isActiveConfig("staticlib")) @@ -1022,7 +1015,7 @@ MakefileGenerator::writePrlFile(QTextStream &t) t << "QMAKE_PRL_LIBS ="; for (ProStringList::Iterator it = libs.begin(); it != libs.end(); ++it) t << qv(project->values((*it).toKey())); - t << endl; + t << Qt::endl; } } @@ -1053,17 +1046,17 @@ MakefileGenerator::writeProjectMakefile() //install t << "install: "; - for(it = targets.begin(); it != targets.end(); ++it) - t << (*it)->target << "-install "; - t << endl; + for (SubTarget *s : qAsConst(targets)) + t << s->target << '-'; + t << "install " << Qt::endl; //uninstall t << "uninstall: "; for(it = targets.begin(); it != targets.end(); ++it) t << (*it)->target << "-uninstall "; - t << endl; + t << Qt::endl; } else { - t << "first: " << targets.first()->target << endl + t << "first: " << targets.first()->target << Qt::endl << "install: " << targets.first()->target << "-install\n" << "uninstall: " << targets.first()->target << "-uninstall\n"; } @@ -1072,7 +1065,7 @@ MakefileGenerator::writeProjectMakefile() if(!project->isActiveConfig("no_autoqmake")) { QString mkf = escapeDependencyPath(fileFixify(Option::output.fileName())); for(QList<SubTarget*>::Iterator it = targets.begin(); it != targets.end(); ++it) - t << escapeDependencyPath((*it)->makefile) << ": " << mkf << endl; + t << escapeDependencyPath((*it)->makefile) << ": " << mkf << Qt::endl; } qDeleteAll(targets); return true; @@ -1186,7 +1179,7 @@ MakefileGenerator::writeObj(QTextStream &t, const char *src) p.replace(stringObj, escapeFilePath(dstf)); t << "\n\t" << p; } - t << endl << endl; + t << Qt::endl << Qt::endl; } } @@ -1380,14 +1373,14 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild) QString tmp_dst = fileFixify((*pit).toQString(), FileFixifyAbsolute, false); t << mkdir_p_asstring(filePrefixRoot(root, tmp_dst)) << "\n\t"; } - t << target << endl << endl; + t << target << Qt::endl << Qt::endl; if(!uninst.isEmpty()) { t << "uninstall_" << (*it) << ": FORCE"; for (int i = uninst.size(); --i >= 0; ) t << "\n\t" << uninst.at(i); t << "\n\t-$(DEL_DIR) " << escapeFilePath(filePrefixRoot(root, dst)) << " \n\n"; } - t << endl; + t << Qt::endl; if (installConfigValues.indexOf("no_default_install") == -1) { all_installs += QString("install_") + (*it) + " "; @@ -1824,7 +1817,7 @@ MakefileGenerator::writeExtraTargets(QTextStream &t) t << escapeDependencyPath(targ) << ":" << deps; if(!cmd.isEmpty()) t << "\n\t" << cmd; - t << endl << endl; + t << Qt::endl << Qt::endl; } } @@ -1916,7 +1909,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) FileFixifyFromOutdir)); } } - t << endl; + t << Qt::endl; if (config.indexOf("no_clean") == -1) { QStringList raw_clean = project->values(ProKey(*it + ".clean")).toQStringList(); @@ -1981,7 +1974,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) } } } - t << endl; + t << Qt::endl; } QStringList tmp_dep = project->values(ProKey(*it + ".depends")).toQStringList(); if (config.indexOf("combine") != -1) { @@ -2002,14 +1995,11 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, tmp_out, LocalShell); dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd); if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) { - QString indeps; - while(!feof(proc)) { - int read_in = (int)fread(buff, 1, 255, proc); - if(!read_in) - break; - indeps += QByteArray(buff, read_in); - } + QByteArray depData; + while (int read_in = feof(proc) ? 0 : (int)fread(buff, 1, 255, proc)) + depData.append(buff, read_in); QT_PCLOSE(proc); + const QString indeps = QString::fromLocal8Bit(depData); if(!indeps.isEmpty()) { QDir outDir(Option::output_dir); QStringList dep_cmd_deps = splitDeps(indeps, dep_lines); @@ -2065,7 +2055,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) } else { t << " " << valList(escapeDependencyPaths(inputs)) << " " << valList(finalizeDependencyPaths(deps)); } - t << "\n\t" << cmd << endl << endl; + t << "\n\t" << cmd << Qt::endl << Qt::endl; continue; } for (ProStringList::ConstIterator input = tmp_inputs.cbegin(); input != tmp_inputs.cend(); ++input) { @@ -2090,14 +2080,11 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, out, LocalShell); dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd); if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) { - QString indeps; - while(!feof(proc)) { - int read_in = (int)fread(buff, 1, 255, proc); - if(!read_in) - break; - indeps += QByteArray(buff, read_in); - } + QByteArray depData; + while (int read_in = feof(proc) ? 0 : (int)fread(buff, 1, 255, proc)) + depData.append(buff, read_in); QT_PCLOSE(proc); + const QString indeps = QString::fromLocal8Bit(depData); if(!indeps.isEmpty()) { QDir outDir(Option::output_dir); QStringList dep_cmd_deps = splitDeps(indeps, dep_lines); @@ -2177,10 +2164,10 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) ++i; } t << escapeDependencyPath(out) << ": " << valList(finalizeDependencyPaths(deps)) << "\n\t" - << cmd << endl << endl; + << cmd << Qt::endl << Qt::endl; } } - t << "compiler_clean: " << clean_targets << endl << endl; + t << "compiler_clean: " << clean_targets << Qt::endl << Qt::endl; } void @@ -2196,17 +2183,17 @@ MakefileGenerator::writeExtraCompilerVariables(QTextStream &t) first = false; } t << "QMAKE_COMP_" << (*varit) << " = " - << valList(project->values((*varit).toKey())) << endl; + << valList(project->values((*varit).toKey())) << Qt::endl; } } if(!first) - t << endl; + t << Qt::endl; } void MakefileGenerator::writeExtraVariables(QTextStream &t) { - t << endl; + t << Qt::endl; ProStringList outlist; const ProValueMap &vars = project->variables(); @@ -2220,7 +2207,7 @@ MakefileGenerator::writeExtraVariables(QTextStream &t) } if (!outlist.isEmpty()) { t << "####### Custom Variables\n"; - t << outlist.join('\n') << endl << endl; + t << outlist.join('\n') << Qt::endl << Qt::endl; } } @@ -2236,11 +2223,11 @@ MakefileGenerator::writeExportedVariables(QTextStream &t) const ProString &name = project->first(ProKey(exp + ".name")); const ProString &value = project->first(ProKey(exp + ".value")); if (!value.isEmpty()) - t << name << " = " << value << endl; + t << name << " = " << value << Qt::endl; else t << name << " =\n"; } - t << endl; + t << Qt::endl; } bool @@ -2248,7 +2235,7 @@ MakefileGenerator::writeDummyMakefile(QTextStream &t) { if (project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) return false; - t << "QMAKE = " << var("QMAKE_QMAKE") << endl; + t << "QMAKE = " << var("QMAKE_QMAKE") << Qt::endl; const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) t << *it << " "; @@ -2264,7 +2251,7 @@ MakefileGenerator::writeDummyMakefile(QTextStream &t) bool MakefileGenerator::writeStubMakefile(QTextStream &t) { - t << "QMAKE = " << var("QMAKE_QMAKE") << endl; + t << "QMAKE = " << var("QMAKE_QMAKE") << Qt::endl; const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) t << *it << " "; @@ -2293,22 +2280,22 @@ MakefileGenerator::writeMakefile(QTextStream &t) void MakefileGenerator::writeDefaultVariables(QTextStream &t) { - t << "QMAKE = " << var("QMAKE_QMAKE") << endl; - t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; - t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; - t << "MKDIR = " << var("QMAKE_MKDIR") << endl; - t << "COPY = " << var("QMAKE_COPY") << endl; - t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl; - t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; - t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << endl; - t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl; - t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; - t << "QINSTALL = " << var("QMAKE_QMAKE") << " -install qinstall" << endl; - t << "QINSTALL_PROGRAM = " << var("QMAKE_QMAKE") << " -install qinstall -exe" << endl; - t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; - t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; - t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; - t << "MOVE = " << var("QMAKE_MOVE") << endl; + t << "QMAKE = " << var("QMAKE_QMAKE") << Qt::endl; + t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << Qt::endl; + t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << Qt::endl; + t << "MKDIR = " << var("QMAKE_MKDIR") << Qt::endl; + t << "COPY = " << var("QMAKE_COPY") << Qt::endl; + t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << Qt::endl; + t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << Qt::endl; + t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << Qt::endl; + t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << Qt::endl; + t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << Qt::endl; + t << "QINSTALL = " << var("QMAKE_QMAKE") << " -install qinstall" << Qt::endl; + t << "QINSTALL_PROGRAM = " << var("QMAKE_QMAKE") << " -install qinstall -exe" << Qt::endl; + t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << Qt::endl; + t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << Qt::endl; + t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << Qt::endl; + t << "MOVE = " << var("QMAKE_MOVE") << Qt::endl; } QString MakefileGenerator::buildArgs(bool withExtra) @@ -2349,18 +2336,18 @@ void MakefileGenerator::writeHeader(QTextStream &t) { t << "#############################################################################\n"; - t << "# Makefile for building: " << escapeFilePath(var("TARGET")) << endl; + t << "# Makefile for building: " << escapeFilePath(var("TARGET")) << Qt::endl; t << "# Generated by qmake (" QMAKE_VERSION_STR ") (Qt " QT_VERSION_STR ")\n"; - t << "# Project: " << fileFixify(project->projectFile()) << endl; - t << "# Template: " << var("TEMPLATE") << endl; + t << "# Project: " << fileFixify(project->projectFile()) << Qt::endl; + t << "# Template: " << var("TEMPLATE") << Qt::endl; if(!project->isActiveConfig("build_pass")) - t << "# Command: " << build_args().replace(QLatin1String("$(QMAKE)"), var("QMAKE_QMAKE")) << endl; + t << "# Command: " << build_args().replace(QLatin1String("$(QMAKE)"), var("QMAKE_QMAKE")) << Qt::endl; t << "#############################################################################\n"; - t << endl; + t << Qt::endl; QString ofile = Option::fixPathToTargetOS(Option::output.fileName()); if (ofile.lastIndexOf(Option::dir_sep) != -1) ofile.remove(0, ofile.lastIndexOf(Option::dir_sep) +1); - t << "MAKEFILE = " << escapeFilePath(ofile) << endl << endl; + t << "MAKEFILE = " << escapeFilePath(ofile) << Qt::endl << Qt::endl; t << "EQ = =\n\n"; } @@ -2492,7 +2479,7 @@ MakefileGenerator::writeSubDirs(QTextStream &t) void MakefileGenerator::writeSubMakeCall(QTextStream &t, const QString &callPrefix, const QString &makeArguments) { - t << callPrefix << "$(MAKE)" << makeArguments << endl; + t << callPrefix << "$(MAKE)" << makeArguments << Qt::endl; } void @@ -2511,20 +2498,30 @@ MakefileGenerator::writeSubTargetCall(QTextStream &t, writeSubMakeCall(t, out_directory_cdin + pfx, makefilein); } +static void chopEndLines(QString *s) +{ + while (!s->isEmpty()) { + const ushort c = s->at(s->size() - 1).unicode(); + if (c != '\n' && c != '\r') + break; + s->chop(1); + } +} + void MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubTarget*> targets, int flags) { // blasted includes const ProStringList &qeui = project->values("QMAKE_EXTRA_INCLUDES"); for (ProStringList::ConstIterator qeui_it = qeui.begin(); qeui_it != qeui.end(); ++qeui_it) - t << "include " << (*qeui_it) << endl; + t << "include " << (*qeui_it) << Qt::endl; if (!(flags & SubTargetSkipDefaultVariables)) { writeDefaultVariables(t); t << "SUBTARGETS = "; // subtargets are sub-directory for(int target = 0; target < targets.size(); ++target) t << " \\\n\t\t" << targets.at(target)->target; - t << endl << endl; + t << Qt::endl << Qt::endl; } writeExtraVariables(t); @@ -2536,6 +2533,14 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT << QString((flags & SubTargetInstalls) ? "uninstall_subtargets" : "uninstall"); } + struct SequentialInstallData + { + QString targetPrefix; + QString commands; + QTextStream commandsStream; + SequentialInstallData() : commandsStream(&commands) {} + }; + std::unique_ptr<SequentialInstallData> sequentialInstallData; bool dont_recurse = project->isActiveConfig("dont_recurse"); // generate target rules @@ -2580,7 +2585,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT if (!dont_recurse) writeSubMakeCall(t, out_directory_cdin, makefilein + " qmake_all"); else - t << endl; + t << Qt::endl; } { //actually compile @@ -2604,6 +2609,16 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT else if(s == "make_first") s = QString(); + if (project->isActiveConfig("build_all") && s == "install") { + if (!sequentialInstallData) + sequentialInstallData.reset(new SequentialInstallData); + sequentialInstallData->targetPrefix += subtarget->target + '-'; + writeSubTargetCall(sequentialInstallData->commandsStream, in_directory, in, + out_directory, out, out_directory_cdin, + makefilein + " " + s); + chopEndLines(&sequentialInstallData->commands); + } + if(flags & SubTargetOrdered) { t << subtarget->target << "-" << targetSuffixes.at(suffix) << "-ordered:"; if(target) @@ -2621,7 +2636,12 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT out_directory_cdin, makefilein + " " + s); } } - t << endl; + t << Qt::endl; + + if (sequentialInstallData) { + t << sequentialInstallData->targetPrefix << "install: FORCE" + << sequentialInstallData->commands << Qt::endl << Qt::endl; + } if (!(flags & SubTargetSkipDefaultTargets)) { writeMakeQmake(t, true); @@ -2670,7 +2690,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT } else if(suffix == "distclean") { QString ofile = fileFixify(Option::output.fileName()); if(!ofile.isEmpty()) - t << "\t-$(DEL_FILE) " << escapeFilePath(ofile) << endl; + t << "\t-$(DEL_FILE) " << escapeFilePath(ofile) << Qt::endl; t << fixFileVarGlue("QMAKE_DISTCLEAN", "\t-$(DEL_FILE) ", " ", "\n"); } } @@ -2683,7 +2703,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT cmd = var(ProKey(*qut_it + ".commands")), deps; if(targ.isEmpty()) targ = (*qut_it).toQString(); - t << endl; + t << Qt::endl; const ProStringList &deplist = project->values(ProKey(*qut_it + ".depends")); for (ProStringList::ConstIterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { @@ -2696,7 +2716,8 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT QSet<QString> recurse; const ProKey rkey(*qut_it + ".recurse"); if (project->isSet(rkey)) { - recurse = project->values(rkey).toQStringList().toSet(); + const QStringList values = project->values(rkey).toQStringList(); + recurse = QSet<QString>(values.begin(), values.end()); } else { for(int target = 0; target < targets.size(); ++target) recurse.insert(targets.at(target)->name); @@ -2758,7 +2779,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT deps += " FORCE"; t << escapeDependencyPath(Option::fixPathToTargetOS(targ, false)) << ":" << deps << "\n"; if(!cmd.isEmpty()) - t << "\t" << cmd << endl; + t << "\t" << cmd << Qt::endl; } if(flags & SubTargetInstalls) { @@ -2776,7 +2797,7 @@ MakefileGenerator::writeMakeQmake(QTextStream &t, bool noDummyQmakeAll) if(project->isEmpty("QMAKE_FAILED_REQUIREMENTS") && !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { QStringList files = escapeFilePaths(fileFixify(Option::mkfile::project_files)); t << escapeDependencyPath(project->first("QMAKE_INTERNAL_PRL_FILE").toQString()) << ": \n\t" - << "@$(QMAKE) -prl " << files.join(' ') << ' ' << buildArgs(true) << endl; + << "@$(QMAKE) -prl " << files.join(' ') << ' ' << buildArgs(true) << Qt::endl; } QString qmake = build_args(); @@ -2795,10 +2816,10 @@ MakefileGenerator::writeMakeQmake(QTextStream &t, bool noDummyQmakeAll) } const ProStringList &included = escapeDependencyPaths(project->values("QMAKE_INTERNAL_INCLUDED_FILES")); t << included.join(QString(" \\\n\t\t")) << "\n\t" - << qmake << endl; + << qmake << Qt::endl; const ProStringList &extraCommands = project->values("QMAKE_MAKE_QMAKE_EXTRA_COMMANDS"); if (!extraCommands.isEmpty()) - t << "\t" << extraCommands.join(QString("\n\t")) << endl; + t << "\t" << extraCommands.join(QString("\n\t")) << Qt::endl; for(int include = 0; include < included.size(); ++include) { const ProString &i = included.at(include); if(!i.isEmpty()) @@ -2806,7 +2827,7 @@ MakefileGenerator::writeMakeQmake(QTextStream &t, bool noDummyQmakeAll) } } if(project->first("QMAKE_ORIG_TARGET") != "qmake") { - t << "qmake: FORCE\n\t@" << qmake << endl << endl; + t << "qmake: FORCE\n\t@" << qmake << Qt::endl << Qt::endl; if (!noDummyQmakeAll) t << "qmake_all: FORCE\n\n"; } @@ -3298,11 +3319,11 @@ MakefileGenerator::writePkgConfigFile() if(includeDir.isEmpty()) includeDir = prefix + "/include"; - t << "prefix=" << prefix << endl; + t << "prefix=" << prefix << Qt::endl; t << "exec_prefix=${prefix}\n" << "libdir=" << pkgConfigFixPath(libDir) << "\n" - << "includedir=" << pkgConfigFixPath(includeDir) << endl; - t << endl; + << "includedir=" << pkgConfigFixPath(includeDir) << Qt::endl; + t << Qt::endl; //extra PKGCONFIG variables const ProStringList &pkgconfig_vars = project->values("QMAKE_PKGCONFIG_VARIABLES"); @@ -3323,17 +3344,17 @@ MakefileGenerator::writePkgConfigFile() } } if (!val.isEmpty()) - t << var << "=" << val << endl; + t << var << "=" << val << Qt::endl; } - t << endl; + t << Qt::endl; QString name = project->first("QMAKE_PKGCONFIG_NAME").toQString(); if(name.isEmpty()) { name = project->first("QMAKE_ORIG_TARGET").toQString().toLower(); name.replace(0, 1, name[0].toUpper()); } - t << "Name: " << name << endl; + t << "Name: " << name << Qt::endl; QString desc = project->values("QMAKE_PKGCONFIG_DESCRIPTION").join(' '); if(desc.isEmpty()) { if(name.isEmpty()) { @@ -3351,12 +3372,12 @@ MakefileGenerator::writePkgConfigFile() desc += " Application"; } } - t << "Description: " << desc << endl; + t << "Description: " << desc << Qt::endl; ProString version = project->first("QMAKE_PKGCONFIG_VERSION"); if (version.isEmpty()) version = project->first("VERSION"); if (!version.isEmpty()) - t << "Version: " << version << endl; + t << "Version: " << version << Qt::endl; // libs t << "Libs: "; @@ -3393,7 +3414,7 @@ MakefileGenerator::writePkgConfigFile() t << "Libs.private:"; for (ProStringList::ConstIterator it = libs.cbegin(); it != libs.cend(); ++it) t << ' ' << fixLibFlags((*it).toKey()).join(' '); - t << endl; + t << Qt::endl; } // flags @@ -3411,15 +3432,15 @@ MakefileGenerator::writePkgConfigFile() && libDir != QLatin1String("/Library/Frameworks")) { t << " -F${libdir}"; } - t << endl; + t << Qt::endl; // requires const QString requires = project->values("QMAKE_PKGCONFIG_REQUIRES").join(' '); if (!requires.isEmpty()) { - t << "Requires: " << requires << endl; + t << "Requires: " << requires << Qt::endl; } - t << endl; + t << Qt::endl; } static QString windowsifyPath(const QString &str) diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 350ebd377a..ecda6eb257 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -54,7 +54,7 @@ struct ReplaceExtraCompilerCacheKey; class MakefileGenerator : protected QMakeSourceFileInfo { QString spec; - bool no_io; + bool no_io = false; bool resolveDependenciesInFrameworks = false; QHash<QString, bool> init_compiler_already; QString makedir, chkexists; @@ -131,7 +131,7 @@ protected: QMakeLocalFileName fixPathForFile(const QMakeLocalFileName &, bool) override; QMakeLocalFileName findFileForDep(const QMakeLocalFileName &, const QMakeLocalFileName &) override; QFileInfo findFileInfo(const QMakeLocalFileName &) override; - QMakeProject *project; + QMakeProject *project = nullptr; //escape virtual QString escapeFilePath(const QString &path) const = 0; @@ -256,8 +256,6 @@ protected: const QString &fixedFile); public: - MakefileGenerator(); - ~MakefileGenerator(); QMakeProject *projectFile() const; void setProjectFile(QMakeProject *p); @@ -295,9 +293,6 @@ inline QString MakefileGenerator::installRoot() const inline bool MakefileGenerator::findLibraries(bool, bool) { return true; } -inline MakefileGenerator::~MakefileGenerator() -{ } - struct ReplaceExtraCompilerCacheKey { mutable uint hash; diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp index decc1d980c..1aab1987d2 100644 --- a/qmake/generators/makefiledeps.cpp +++ b/qmake/generators/makefiledeps.cpp @@ -837,7 +837,9 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) if(inc) { if(!includes) includes = new SourceFiles; - SourceFile *dep = includes->lookupFile(inc); + /* QTBUG-72383: Local includes "foo.h" must first be resolved relative to the + * sourceDir, only global includes <bar.h> are unique. */ + SourceFile *dep = try_local ? nullptr : includes->lookupFile(inc); if(!dep) { bool exists = false; QMakeLocalFileName lfn(inc); @@ -876,7 +878,11 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) dep->file = lfn; dep->type = QMakeSourceFileInfo::TYPE_C; files->addFile(dep); - includes->addFile(dep, inc, false); + /* QTBUG-72383: Local includes "foo.h" are keyed by the resolved + * path (stored in dep itself), only global includes <bar.h> are + * unique keys immediately. */ + const char *key = try_local ? nullptr : inc; + includes->addFile(dep, key, false); } dep->exists = exists; } diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 8ebd0c61ce..f9159ccd75 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -27,7 +27,6 @@ ****************************************************************************/ #include "metamakefile.h" -#include "qregexp.h" #include "qdir.h" #include "qdebug.h" #include "makefile.h" diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp index ef34955eb1..119dd652b3 100644 --- a/qmake/generators/projectgenerator.cpp +++ b/qmake/generators/projectgenerator.cpp @@ -50,10 +50,6 @@ QString project_builtin_regx() //calculate the builtin regular expression.. return ret; } -ProjectGenerator::ProjectGenerator() : MakefileGenerator() -{ -} - void ProjectGenerator::init() { @@ -324,14 +320,14 @@ ProjectGenerator::init() bool ProjectGenerator::writeMakefile(QTextStream &t) { - t << "######################################################################" << endl; - t << "# Automatically generated by qmake (" QMAKE_VERSION_STR ") " << QDateTime::currentDateTime().toString() << endl; - t << "######################################################################" << endl << endl; + t << "######################################################################" << Qt::endl; + t << "# Automatically generated by qmake (" QMAKE_VERSION_STR ") " << QDateTime::currentDateTime().toString() << Qt::endl; + t << "######################################################################" << Qt::endl << Qt::endl; if (!Option::globals->extra_cmds[QMakeEvalBefore].isEmpty()) - t << Option::globals->extra_cmds[QMakeEvalBefore] << endl; + t << Option::globals->extra_cmds[QMakeEvalBefore] << Qt::endl; t << getWritableVar("TEMPLATE_ASSIGN", false); if(project->first("TEMPLATE_ASSIGN") == "subdirs") { - t << endl << "# Directories" << "\n" + t << Qt::endl << "# Directories" << "\n" << getWritableVar("SUBDIRS"); } else { //figure out target @@ -343,7 +339,7 @@ ProjectGenerator::writeMakefile(QTextStream &t) t << getWritableVar("TARGET_ASSIGN") << getWritableVar("CONFIG", false) << getWritableVar("CONFIG_REMOVE", false) - << getWritableVar("INCLUDEPATH") << endl; + << getWritableVar("INCLUDEPATH") << Qt::endl; t << "# You can make your code fail to compile if you use deprecated APIs.\n" "# In order to do so, uncomment the following line.\n" @@ -362,7 +358,7 @@ ProjectGenerator::writeMakefile(QTextStream &t) << getWritableVar("TRANSLATIONS"); } if (!Option::globals->extra_cmds[QMakeEvalAfter].isEmpty()) - t << Option::globals->extra_cmds[QMakeEvalAfter] << endl; + t << Option::globals->extra_cmds[QMakeEvalAfter] << Qt::endl; return true; } diff --git a/qmake/generators/projectgenerator.h b/qmake/generators/projectgenerator.h index cbc9f371ab..e9b050cc74 100644 --- a/qmake/generators/projectgenerator.h +++ b/qmake/generators/projectgenerator.h @@ -46,15 +46,10 @@ protected: QString escapeFilePath(const QString &path) const override { Q_ASSERT(false); return QString(); } public: - ProjectGenerator(); - ~ProjectGenerator(); bool supportsMetaBuild() override { return false; } bool openOutput(QFile &, const QString &) const override; }; -inline ProjectGenerator::~ProjectGenerator() -{ } - QT_END_NAMESPACE #endif // PROJECTGENERATOR_H diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 7f42fbe09e..836737e77d 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -28,7 +28,6 @@ #include "unixmake.h" #include "option.h" -#include <qregexp.h> #include <qfile.h> #include <qhash.h> #include <qdir.h> diff --git a/qmake/generators/unix/unixmake.h b/qmake/generators/unix/unixmake.h index 5b0766855b..901419d3cc 100644 --- a/qmake/generators/unix/unixmake.h +++ b/qmake/generators/unix/unixmake.h @@ -35,15 +35,11 @@ QT_BEGIN_NAMESPACE class UnixMakefileGenerator : public MakefileGenerator { - bool include_deps; + bool include_deps = false; QString libtoolFileName(bool fixify=true); void writeLibtoolFile(); // for libtool void writePrlFile(QTextStream &) override; -public: - UnixMakefileGenerator(); - ~UnixMakefileGenerator(); - protected: virtual bool doPrecompiledHeaders() const { return project->isActiveConfig("precompile_header"); } bool doDepends() const override { return !Option::mkfile::do_stub_makefile && MakefileGenerator::doDepends(); } @@ -69,9 +65,6 @@ private: ProStringList libdirToFlags(const ProKey &key); }; -inline UnixMakefileGenerator::~UnixMakefileGenerator() -{ } - QT_END_NAMESPACE #endif // UNIXMAKE_H diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 7d8c70ec3b..7d72347d37 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -39,11 +39,6 @@ QT_BEGIN_NAMESPACE -UnixMakefileGenerator::UnixMakefileGenerator() : MakefileGenerator(), include_deps(false) -{ - -} - void UnixMakefileGenerator::writePrlFile(QTextStream &t) { @@ -83,8 +78,8 @@ void UnixMakefileGenerator::writeDefaultVariables(QTextStream &t) { MakefileGenerator::writeDefaultVariables(t); - t << "TAR = " << var("QMAKE_TAR") << endl; - t << "COMPRESS = " << var("QMAKE_GZIP") << endl; + t << "TAR = " << var("QMAKE_TAR") << Qt::endl; + t << "COMPRESS = " << var("QMAKE_GZIP") << Qt::endl; if (project->isEmpty("QMAKE_DISTNAME")) { ProString distname = project->first("QMAKE_ORIG_TARGET"); @@ -92,13 +87,13 @@ UnixMakefileGenerator::writeDefaultVariables(QTextStream &t) distname += project->first("VERSION"); project->values("QMAKE_DISTNAME") = distname; } - t << "DISTNAME = " << fileVar("QMAKE_DISTNAME") << endl; + t << "DISTNAME = " << fileVar("QMAKE_DISTNAME") << Qt::endl; if (project->isEmpty("QMAKE_DISTDIR")) project->values("QMAKE_DISTDIR") = project->first("QMAKE_DISTNAME"); t << "DISTDIR = " << escapeFilePath(fileFixify( (project->isEmpty("OBJECTS_DIR") ? ProString(".tmp/") : project->first("OBJECTS_DIR")) + project->first("QMAKE_DISTDIR"), - FileFixifyFromOutdir | FileFixifyAbsolute)) << endl; + FileFixifyFromOutdir | FileFixifyAbsolute)) << Qt::endl; } void @@ -106,10 +101,10 @@ UnixMakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator:: { MakefileGenerator::writeSubTargets(t, targets, flags); - t << "dist: distdir FORCE" << endl; + t << "dist: distdir FORCE" << Qt::endl; t << "\t(cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar)" " && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR)"; - t << endl << endl; + t << Qt::endl << Qt::endl; t << "distdir:"; for (int target = 0; target < targets.size(); ++target) { @@ -118,7 +113,7 @@ UnixMakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator:: } t << " FORCE\n\t" << mkdir_p_asstring("$(DISTDIR)", false) << "\n\t" - << "$(COPY_FILE) --parents " << fileVar("DISTFILES") << " $(DISTDIR)" << Option::dir_sep << endl << endl; + << "$(COPY_FILE) --parents " << fileVar("DISTFILES") << " $(DISTDIR)" << Option::dir_sep << Qt::endl << Qt::endl; const QString abs_source_path = project->first("QMAKE_ABSOLUTE_SOURCE_PATH").toQString(); for (int target = 0; target < targets.size(); ++target) { @@ -151,7 +146,7 @@ UnixMakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator:: t << subtarget->target << "-distdir: FORCE"; writeSubTargetCall(t, in_directory, in, out_directory, escapeFilePath(out), out_directory_cdin, makefilein); - t << endl; + t << Qt::endl; } } @@ -183,11 +178,11 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) writeExportedVariables(t); t << "####### Compiler, tools and options\n\n"; - t << "CC = " << var("QMAKE_CC") << endl; - t << "CXX = " << var("QMAKE_CXX") << endl; + t << "CC = " << var("QMAKE_CC") << Qt::endl; + t << "CXX = " << var("QMAKE_CXX") << Qt::endl; t << "DEFINES = " << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") - << varGlue("DEFINES","-D"," -D","") << endl; + << varGlue("DEFINES","-D"," -D","") << Qt::endl; t << "CFLAGS = " << var("QMAKE_CFLAGS") << " $(DEFINES)\n"; t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)\n"; t << "INCPATH ="; @@ -208,38 +203,38 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) } if(!project->isEmpty("QMAKE_FRAMEWORKPATH_FLAGS")) t << " " << var("QMAKE_FRAMEWORKPATH_FLAGS"); - t << endl; + t << Qt::endl; writeDefaultVariables(t); if(!project->isActiveConfig("staticlib")) { - t << "LINK = " << var("QMAKE_LINK") << endl; - t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; + t << "LINK = " << var("QMAKE_LINK") << Qt::endl; + t << "LFLAGS = " << var("QMAKE_LFLAGS") << Qt::endl; t << "LIBS = $(SUBLIBS) " << fixLibFlags("LIBS").join(' ') << ' ' << fixLibFlags("LIBS_PRIVATE").join(' ') << ' ' << fixLibFlags("QMAKE_LIBS").join(' ') << ' ' - << fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << endl; + << fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << Qt::endl; } - t << "AR = " << var("QMAKE_AR") << endl; - t << "RANLIB = " << var("QMAKE_RANLIB") << endl; - t << "SED = " << var("QMAKE_STREAM_EDITOR") << endl; - t << "STRIP = " << var("QMAKE_STRIP") << endl; + t << "AR = " << var("QMAKE_AR") << Qt::endl; + t << "RANLIB = " << var("QMAKE_RANLIB") << Qt::endl; + t << "SED = " << var("QMAKE_STREAM_EDITOR") << Qt::endl; + t << "STRIP = " << var("QMAKE_STRIP") << Qt::endl; - t << endl; + t << Qt::endl; t << "####### Output directory\n\n"; // This is used in commands by some .prf files. if (! project->values("OBJECTS_DIR").isEmpty()) - t << "OBJECTS_DIR = " << fileVar("OBJECTS_DIR") << endl; + t << "OBJECTS_DIR = " << fileVar("OBJECTS_DIR") << Qt::endl; else t << "OBJECTS_DIR = ./\n"; - t << endl; + t << Qt::endl; /* files */ t << "####### Files\n\n"; // This is used by the dist target. - t << "SOURCES = " << fileVarList("SOURCES") << ' ' << fileVarList("GENERATED_SOURCES") << endl; + t << "SOURCES = " << fileVarList("SOURCES") << ' ' << fileVarList("GENERATED_SOURCES") << Qt::endl; if(do_incremental) { const ProStringList &objs = project->values("OBJECTS"); const ProStringList &incrs = project->values("QMAKE_INCREMENTAL"); @@ -259,59 +254,59 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\\\n\t\t" << (*objit); } if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done! - t << escapeFilePaths(incrs_out).join(QString(" \\\n\t\t")) << endl; + t << escapeFilePaths(incrs_out).join(QString(" \\\n\t\t")) << Qt::endl; } else if(!incrs_out.count()) { - t << endl; + t << Qt::endl; } else { src_incremental = true; - t << endl; + t << Qt::endl; t << "INCREMENTAL_OBJECTS = " - << escapeFilePaths(incrs_out).join(QString(" \\\n\t\t")) << endl; + << escapeFilePaths(incrs_out).join(QString(" \\\n\t\t")) << Qt::endl; } } else { // Used all over the place in both deps and commands. - t << "OBJECTS = " << valList(escapeDependencyPaths(project->values("OBJECTS"))) << endl; + t << "OBJECTS = " << valList(escapeDependencyPaths(project->values("OBJECTS"))) << Qt::endl; } if(do_incremental && !src_incremental) do_incremental = false; t << "DIST = " << valList(fileFixify(project->values("DISTFILES").toQStringList())) << " " - << fileVarList("HEADERS") << ' ' << fileVarList("SOURCES") << endl; - t << "QMAKE_TARGET = " << fileVar("QMAKE_ORIG_TARGET") << endl; + << fileVarList("HEADERS") << ' ' << fileVarList("SOURCES") << Qt::endl; + t << "QMAKE_TARGET = " << fileVar("QMAKE_ORIG_TARGET") << Qt::endl; QString destd = fileVar("DESTDIR"); // When building on non-MSys MinGW, the path ends with a backslash, which // GNU make will interpret that as a line continuation. Doubling the backslash // avoids the problem, at the cost of the variable containing *both* backslashes. if (destd.endsWith('\\')) destd += '\\'; - t << "DESTDIR = " << destd << endl; - t << "TARGET = " << fileVar("TARGET") << endl; + t << "DESTDIR = " << destd << Qt::endl; + t << "TARGET = " << fileVar("TARGET") << Qt::endl; if(project->isActiveConfig("plugin")) { - t << "TARGETD = " << fileVar("TARGET") << endl; + t << "TARGETD = " << fileVar("TARGET") << Qt::endl; } else if(!project->isActiveConfig("staticlib") && project->values("QMAKE_APP_FLAG").isEmpty()) { - t << "TARGETA = " << fileVar("TARGETA") << endl; + t << "TARGETA = " << fileVar("TARGETA") << Qt::endl; if(!project->isEmpty("QMAKE_BUNDLE")) { - t << "TARGETD = " << fileVar("TARGET_x.y") << endl; - t << "TARGET0 = " << fileVar("TARGET_") << endl; + t << "TARGETD = " << fileVar("TARGET_x.y") << Qt::endl; + t << "TARGET0 = " << fileVar("TARGET_") << Qt::endl; } else if (!project->isActiveConfig("unversioned_libname")) { - t << "TARGET0 = " << fileVar("TARGET_") << endl; + t << "TARGET0 = " << fileVar("TARGET_") << Qt::endl; if (project->isEmpty("QMAKE_HPUX_SHLIB")) { - t << "TARGETD = " << fileVar("TARGET_x.y.z") << endl; - t << "TARGET1 = " << fileVar("TARGET_x") << endl; - t << "TARGET2 = " << fileVar("TARGET_x.y") << endl; + t << "TARGETD = " << fileVar("TARGET_x.y.z") << Qt::endl; + t << "TARGET1 = " << fileVar("TARGET_x") << Qt::endl; + t << "TARGET2 = " << fileVar("TARGET_x.y") << Qt::endl; } else { - t << "TARGETD = " << fileVar("TARGET_x") << endl; + t << "TARGETD = " << fileVar("TARGET_x") << Qt::endl; } } } writeExtraCompilerVariables(t); writeExtraVariables(t); - t << endl; + t << Qt::endl; // blasted includes const ProStringList &qeui = project->values("QMAKE_EXTRA_INCLUDES"); ProStringList::ConstIterator it; for(it = qeui.begin(); it != qeui.end(); ++it) - t << "include " << escapeDependencyPath(*it) << endl; + t << "include " << escapeDependencyPath(*it) << Qt::endl; /* rules */ t << "first:" << (!project->isActiveConfig("no_default_goal_deps") ? " all" : "") << "\n"; @@ -321,7 +316,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) ProStringList objects = project->values("OBJECTS"); for (ProStringList::Iterator it = objects.begin(); it != objects.end(); ++it) { QString d_file = (*it).toQString().replace(QRegExp(Option::obj_ext + "$"), ".d"); - t << "-include " << escapeDependencyPath(d_file) << endl; + t << "-include " << escapeDependencyPath(d_file) << Qt::endl; project->values("QMAKE_DISTCLEAN") << d_file; } } else { @@ -379,8 +374,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) QStringList deps = findDependencies((*it).toQString()).filter(QRegExp( "((^|/)" + Option::h_moc_mod + "|" + Option::cpp_moc_ext + "$)")); if(!deps.isEmpty()) - t << d_file_d << ": " << finalizeDependencyPaths(deps).join(' ') << endl; - t << "-include " << d_file_d << endl; + t << d_file_d << ": " << finalizeDependencyPaths(deps).join(' ') << Qt::endl; + t << "-include " << d_file_d << Qt::endl; project->values("QMAKE_DISTCLEAN") += d_file; } } @@ -399,7 +394,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) t << escapeFilePath(libdir + project->first("QMAKE_PREFIX_STATICLIB") + (*it) + '.' + project->first("QMAKE_EXTENSION_STATICLIB")) << ' '; - t << endl << endl; + t << Qt::endl << Qt::endl; } QString target_deps; if ((project->isActiveConfig("depend_prl") || project->isActiveConfig("fast_depend_prl")) @@ -504,7 +499,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "$(LINK) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(TARGET) " << incr_deps << " " << incr_objs << " $(OBJCOMP) $(LIBS)"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); - t << endl << endl; + t << Qt::endl << Qt::endl; } else { t << depVar("TARGET") << ": " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << target_deps << ' ' << depVar("POST_TARGETDEPS") << "\n\t"; @@ -517,7 +512,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) if (!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); } - t << endl << endl; + t << Qt::endl << Qt::endl; } allDeps = ' ' + depVar("TARGET"); } else if(!project->isActiveConfig("staticlib")) { @@ -548,7 +543,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) //actual target const QString link_deps = "$(OBJECTS) "; t << incr_target_dir_d << ": " << link_deps << "\n\t" - << "ld -r -o " << incr_target_dir_f << ' ' << link_deps << endl; + << "ld -r -o " << incr_target_dir_f << ' ' << link_deps << Qt::endl; //communicated below ProStringList &cmd = project->values("QMAKE_LINK_SHLIB_CMD"); cmd[0] = cmd.at(0).toQString().replace(QLatin1String("$(OBJECTS) "), QLatin1String("$(INCREMENTAL_OBJECTS)")); //ick @@ -606,7 +601,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << "-$(MOVE) $(TARGET) " << destdir << "$(TARGET)"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); - t << endl << endl; + t << Qt::endl << Qt::endl; } else if(!project->isEmpty("QMAKE_BUNDLE")) { bundledFiles << destdir_r + var("TARGET"); t << "\n\t" @@ -620,7 +615,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) " Versions/Current/$(TARGET) $(DESTDIR)$(TARGET0)") << "\n\t"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); - t << endl << endl; + t << Qt::endl << Qt::endl; } else if(project->isEmpty("QMAKE_HPUX_SHLIB")) { t << "\n\t"; @@ -654,7 +649,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) } if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); - t << endl << endl; + t << Qt::endl << Qt::endl; } else { t << "\n\t" << "-$(DEL_FILE) $(TARGET) $(TARGET0)\n\t" @@ -668,9 +663,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << "-$(MOVE) $(TARGET0) " << destdir << "$(TARGET0)\n\t"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); - t << endl << endl; + t << Qt::endl << Qt::endl; } - t << endl << endl; + t << Qt::endl << Qt::endl; if (! project->isActiveConfig("plugin")) { t << "staticlib: " << depVar("TARGETA") << "\n\n"; @@ -688,7 +683,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\n\t" << var("QMAKE_POST_LINK"); if(!project->isEmpty("QMAKE_RANLIB")) t << "\n\t$(RANLIB) $(TARGETA)"; - t << endl << endl; + t << Qt::endl << Qt::endl; } } else { QString destdir_r = project->first("DESTDIR").toQString(); @@ -708,7 +703,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t" << var("QMAKE_POST_LINK") << "\n"; if (!project->isEmpty("QMAKE_RANLIB")) t << "\t$(RANLIB) " << destdir << "$(TARGET)\n"; - t << endl << endl; + t << Qt::endl << Qt::endl; } writeMakeQmake(t); @@ -722,7 +717,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) } if(!meta_files.isEmpty()) t << escapeDependencyPaths(meta_files).join(" ") << ": \n\t" - << "@$(QMAKE) -prl " << escapeFilePath(project->projectFile()) << ' ' << buildArgs(true) << endl; + << "@$(QMAKE) -prl " << escapeFilePath(project->projectFile()) << ' ' << buildArgs(true) << Qt::endl; } if (!project->isEmpty("QMAKE_BUNDLE")) { @@ -743,7 +738,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << "@echo \"APPL" << (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) - << "\" > " << pkginfo_f << endl; + << "\" > " << pkginfo_f << Qt::endl; } if (!project->first("QMAKE_BUNDLE_RESOURCE_FILE").isEmpty()) { ProString resources = project->first("QMAKE_BUNDLE_RESOURCE_FILE"); @@ -852,7 +847,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << "-e \"s,\\$${EXECUTABLE_NAME}," << (app_bundle_name.isEmpty() ? app_bundle_name : plugin_bundle_name) << ",g\" " << "-e \"s,@TYPEINFO@,"<< typeInfo << ",g\" " << "-e \"s,\\$${QMAKE_PKGINFO_TYPEINFO},"<< typeInfo << ",g\" " - << "" << info_plist << " >" << info_plist_out << endl; + << "" << info_plist << " >" << info_plist_out << Qt::endl; //copy the icon if (!project->isEmpty("ICON")) { QString dir = bundle_dir + "Contents/Resources/"; @@ -863,7 +858,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << escapeDependencyPath(icon_path) << ": " << escapeDependencyPath(icon) << "\n\t" << mkdir_p_asstring(dir) << "\n\t" << "@$(DEL_FILE) " << icon_path_f << "\n\t" - << "@$(COPY_FILE) " << escapeFilePath(icon) << ' ' << icon_path_f << endl; + << "@$(COPY_FILE) " << escapeFilePath(icon) << ' ' << icon_path_f << Qt::endl; } } else { ProString lib_bundle_name = var("QMAKE_FRAMEWORK_BUNDLE_NAME"); @@ -880,7 +875,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << "-e \"s,\\$${EXECUTABLE_NAME}," << lib_bundle_name << ",g\" " << "-e \"s,@TYPEINFO@," << typeInfo << ",g\" " << "-e \"s,\\$${QMAKE_PKGINFO_TYPEINFO}," << typeInfo << ",g\" " - << "" << info_plist << " >" << info_plist_out << endl; + << "" << info_plist << " >" << info_plist_out << Qt::endl; } break; } // project->isActiveConfig("no_plist") @@ -924,10 +919,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) QFileInfo fi(fileInfo(fn)); if(fi.isDir()) t << "@$(DEL_FILE) -r " << dst << "\n\t" - << "@$(COPY_DIR) " << src << " " << dst << endl; + << "@$(COPY_DIR) " << src << " " << dst << Qt::endl; else t << "@$(DEL_FILE) " << dst << "\n\t" - << "@$(COPY_FILE) " << src << " " << dst << endl; + << "@$(COPY_FILE) " << src << " " << dst << Qt::endl; } } } @@ -940,7 +935,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) alldeps << symIt.key(); t << escapeDependencyPath(symIt.key()) << ":\n\t" << mkdir_p_asstring(bundle_dir) << "\n\t" - << "@$(SYMLINK) " << escapeFilePath(symIt.value()) << ' ' << bundle_dir_f << endl; + << "@$(SYMLINK) " << escapeFilePath(symIt.value()) << ' ' << bundle_dir_f << Qt::endl; } if (!project->isActiveConfig("shallow_bundle")) { @@ -952,24 +947,24 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << mkdir_p_asstring(bundle_dir + "Versions") << "\n\t" << "@-$(DEL_FILE) " << currentLink_f << "\n\t" << "@$(SYMLINK) " << project->first("QMAKE_FRAMEWORK_VERSION") - << ' ' << currentLink_f << endl; + << ' ' << currentLink_f << Qt::endl; } } } - t << endl << "all: " << deps + t << Qt::endl << "all: " << deps << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")), " \\\n\t\t", " \\\n\t\t", "") - << allDeps << endl << endl; + << allDeps << Qt::endl << Qt::endl; t << "dist: distdir FORCE\n\t"; t << "(cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar)" " && $(MOVE) `dirname $(DISTDIR)`" << Option::dir_sep << "$(DISTNAME).tar.gz ." " && $(DEL_FILE) -r $(DISTDIR)"; - t << endl << endl; + t << Qt::endl << Qt::endl; t << "distdir: FORCE\n\t" << mkdir_p_asstring("$(DISTDIR)", false) << "\n\t" - << "$(COPY_FILE) --parents $(DIST) $(DISTDIR)" << Option::dir_sep << endl; + << "$(COPY_FILE) --parents $(DIST) $(DISTDIR)" << Option::dir_sep << Qt::endl; if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) { const ProStringList &quc = project->values("QMAKE_EXTRA_COMPILERS"); for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { @@ -979,20 +974,20 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) if(val.isEmpty()) continue; t << "\t$(COPY_FILE) --parents " << escapeFilePaths(val).join(' ') - << " $(DISTDIR)" << Option::dir_sep << endl; + << " $(DISTDIR)" << Option::dir_sep << Qt::endl; } } } if(!project->isEmpty("TRANSLATIONS")) - t << "\t$(COPY_FILE) --parents " << fileVar("TRANSLATIONS") << " $(DISTDIR)" << Option::dir_sep << endl; - t << endl << endl; + t << "\t$(COPY_FILE) --parents " << fileVar("TRANSLATIONS") << " $(DISTDIR)" << Option::dir_sep << Qt::endl; + t << Qt::endl << Qt::endl; QString clean_targets = " compiler_clean " + depVar("CLEAN_DEPS"); if(do_incremental) { t << "incrclean:\n"; if(src_incremental) t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJECTS)\n"; - t << endl; + t << Qt::endl; } t << "clean:" << clean_targets << "\n\t"; @@ -1060,7 +1055,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "-$(DEL_FILE) $(INCREMENTAL_OBJECTS)\n\t"; t << fileVarGlue("QMAKE_CLEAN","-$(DEL_FILE) "," ","\n\t") << "-$(DEL_FILE) *~ core *.core\n" - << fileVarGlue("CLEAN_FILES","\t-$(DEL_FILE) "," ","") << endl << endl; + << fileVarGlue("CLEAN_FILES","\t-$(DEL_FILE) "," ","") << Qt::endl << Qt::endl; ProString destdir = project->first("DESTDIR"); if (!destdir.isEmpty() && !destdir.endsWith(Option::dir_sep)) @@ -1068,7 +1063,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "distclean: clean " << depVar("DISTCLEAN_DEPS") << '\n'; if(!project->isEmpty("QMAKE_BUNDLE")) { QString bundlePath = escapeFilePath(destdir + project->first("QMAKE_BUNDLE")); - t << "\t-$(DEL_FILE) -r " << bundlePath << endl; + t << "\t-$(DEL_FILE) -r " << bundlePath << Qt::endl; } else if (project->isActiveConfig("staticlib") || project->isActiveConfig("plugin")) { t << "\t-$(DEL_FILE) " << escapeFilePath(destdir) << "$(TARGET) \n"; } else if (project->values("QMAKE_APP_FLAG").isEmpty()) { @@ -1087,9 +1082,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) { QString ofile = fileFixify(Option::output.fileName()); if(!ofile.isEmpty()) - t << "\t-$(DEL_FILE) " << escapeFilePath(ofile) << endl; + t << "\t-$(DEL_FILE) " << escapeFilePath(ofile) << Qt::endl; } - t << endl << endl; + t << Qt::endl << Qt::endl; t << "####### Sub-libraries\n\n"; if (!project->values("SUBLIBS").isEmpty()) { @@ -1100,7 +1095,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) for (it = l.begin(); it != l.end(); ++it) t << escapeDependencyPath(libdir + project->first("QMAKE_PREFIX_STATICLIB") + (*it) + '.' + project->first("QMAKE_EXTENSION_STATICLIB")) << ":\n\t" - << var(ProKey("MAKELIB" + *it)) << endl << endl; + << var(ProKey("MAKELIB" + *it)) << Qt::endl << Qt::endl; } if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")) { @@ -1184,7 +1179,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) compilerExecutable = "$(CXX)"; // compile command - t << "\n\t" << compilerExecutable << cflags << " $(INCPATH) " << pchArchFlags << endl << endl; + t << "\n\t" << compilerExecutable << cflags << " $(INCPATH) " << pchArchFlags << Qt::endl << Qt::endl; } } } diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index de7363e51b..325823e1d9 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -38,10 +38,6 @@ QT_BEGIN_NAMESPACE -MingwMakefileGenerator::MingwMakefileGenerator() : Win32MakefileGenerator() -{ -} - QString MingwMakefileGenerator::escapeDependencyPath(const QString &path) const { QString ret = path; @@ -99,7 +95,7 @@ bool MingwMakefileGenerator::writeMakefile(QTextStream &t) writePkgConfigFile(); if(Option::mkfile::do_stub_makefile) { - t << "QMAKE = " << var("QMAKE_QMAKE") << endl; + t << "QMAKE = " << var("QMAKE_QMAKE") << Qt::endl; const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) t << escapeDependencyPath(*it) << ' '; @@ -148,7 +144,7 @@ void createLdResponseFile(const QString &fileName, const ProStringList &objList) .replace(QLatin1Char('\t'), QLatin1String("\\\t")) .replace(QLatin1Char('"'), QLatin1String("\\\"")) .replace(QLatin1Char('\''), QLatin1String("\\'")); - t << path << endl; + t << path << Qt::endl; } t.flush(); file.close(); @@ -162,9 +158,9 @@ void createArObjectScriptFile(const QString &fileName, const QString &target, co if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream t(&file); // ### quoting? - t << "CREATE " << target << endl; + t << "CREATE " << target << Qt::endl; for (ProStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) { - t << "ADDMOD " << *it << endl; + t << "ADDMOD " << *it << Qt::endl; } t << "SAVE\n"; t.flush(); @@ -183,13 +179,13 @@ void MingwMakefileGenerator::writeMingwParts(QTextStream &t) << finalizeDependencyPaths(findDependencies(header)).join(" \\\n\t\t") << "\n\t" << mkdir_p_asstring(preCompHeaderOut) << "\n\t$(CC) -x c-header -c $(CFLAGS) $(INCPATH) -o " << escapeFilePath(cHeader) - << ' ' << escapeFilePath(header) << endl << endl; + << ' ' << escapeFilePath(header) << Qt::endl << Qt::endl; QString cppHeader = preCompHeaderOut + Option::dir_sep + "c++"; t << escapeDependencyPath(cppHeader) << ": " << escapeDependencyPath(header) << " " << finalizeDependencyPaths(findDependencies(header)).join(" \\\n\t\t") << "\n\t" << mkdir_p_asstring(preCompHeaderOut) << "\n\t$(CXX) -x c++-header -c $(CXXFLAGS) $(INCPATH) -o " << escapeFilePath(cppHeader) - << ' ' << escapeFilePath(header) << endl << endl; + << ' ' << escapeFilePath(header) << Qt::endl << Qt::endl; } } @@ -274,21 +270,21 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t) t << "-I"; t << escapeFilePath(inc) << ' '; } - t << endl; + t << Qt::endl; } void MingwMakefileGenerator::writeLibsPart(QTextStream &t) { if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { - t << "LIB = " << var("QMAKE_LIB") << endl; + t << "LIB = " << var("QMAKE_LIB") << Qt::endl; } else { - t << "LINKER = " << var("QMAKE_LINK") << endl; - t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; + t << "LINKER = " << var("QMAKE_LINK") << Qt::endl; + t << "LFLAGS = " << var("QMAKE_LFLAGS") << Qt::endl; t << "LIBS = " << fixLibFlags("LIBS").join(' ') << ' ' << fixLibFlags("LIBS_PRIVATE").join(' ') << ' ' << fixLibFlags("QMAKE_LIBS").join(' ') << ' ' - << fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << endl; + << fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << Qt::endl; } } @@ -350,7 +346,7 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t) } if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" <<var("QMAKE_POST_LINK"); - t << endl; + t << Qt::endl; } void MingwMakefileGenerator::writeRcFilePart(QTextStream &t) diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h index 5da5b24088..8cae28a78b 100644 --- a/qmake/generators/win32/mingw_make.h +++ b/qmake/generators/win32/mingw_make.h @@ -35,9 +35,6 @@ QT_BEGIN_NAMESPACE class MingwMakefileGenerator : public Win32MakefileGenerator { -public: - MingwMakefileGenerator(); - ~MingwMakefileGenerator(); protected: using MakefileGenerator::escapeDependencyPath; QString escapeDependencyPath(const QString &path) const override; @@ -65,9 +62,6 @@ private: QString objectsLinkLine; }; -inline MingwMakefileGenerator::~MingwMakefileGenerator() -{ } - QT_END_NAMESPACE #endif // MINGW_MAKE_H diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index 0e95766f8e..3116238aa0 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -34,6 +34,7 @@ #include <qscopedpointer.h> #include <qstringlist.h> #include <qfileinfo.h> +#include <qregexp.h> QT_BEGIN_NAMESPACE @@ -142,6 +143,7 @@ const char _InterfaceIdentifierFileName[] = "InterfaceIdentifierFileName"; const char _IntermediateDirectory[] = "IntermediateDirectory"; const char _KeyContainer[] = "KeyContainer"; const char _KeyFile[] = "KeyFile"; +const char _LanguageStandard[] = "LanguageStandard"; const char _LargeAddressAware[] = "LargeAddressAware"; const char _LinkDLL[] = "LinkDLL"; const char _LinkErrorReporting[] = "LinkErrorReporting"; @@ -1477,6 +1479,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCCLCompilerTool &tool) << attrTagT(_IntrinsicFunctions, tool.EnableIntrinsicFunctions) << attrTagT(_MinimalRebuild, tool.MinimalRebuild) << attrTagT(_MultiProcessorCompilation, tool.MultiProcessorCompilation) + << attrTagS(_LanguageStandard, tool.LanguageStandard) << attrTagS(_ObjectFileName, tool.ObjectFile) << attrTagT(_OmitDefaultLibName, tool.OmitDefaultLibName) << attrTagT(_OmitFramePointers, tool.OmitFramePointers) diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 63d89a5388..1f6223f01d 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -38,11 +38,6 @@ QT_BEGIN_NAMESPACE -NmakeMakefileGenerator::NmakeMakefileGenerator() : usePCH(false), usePCHC(false) -{ - -} - bool NmakeMakefileGenerator::writeMakefile(QTextStream &t) { @@ -143,7 +138,7 @@ void NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) t << escapeDependencyPath(precompObj) << ": " << escapeDependencyPath(precompH) << ' ' << finalizeDependencyPaths(findDependencies(precompH)).join(" \\\n\t\t") << "\n\t$(CXX) " + precompRule +" $(CXXFLAGS) $(INCPATH) -TP " - << escapeFilePath(precompH) << endl << endl; + << escapeFilePath(precompH) << Qt::endl << Qt::endl; } if (usePCHC) { QString precompRuleC = QString("-c -Yc -Fp%1 -Fo%2") @@ -151,7 +146,7 @@ void NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) t << escapeDependencyPath(precompObjC) << ": " << escapeDependencyPath(precompH) << ' ' << finalizeDependencyPaths(findDependencies(precompH)).join(" \\\n\t\t") << "\n\t$(CC) " + precompRuleC +" $(CFLAGS) $(INCPATH) -TC " - << escapeFilePath(precompH) << endl << endl; + << escapeFilePath(precompH) << Qt::endl << Qt::endl; } } @@ -314,7 +309,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) t << " " << (*cit); for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) t << " " << (*cppit); - t << endl << endl; + t << Qt::endl << Qt::endl; bool useInferenceRules = !project->isActiveConfig("no_batch"); QSet<QString> source_directories; @@ -346,7 +341,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) QHash<QString, QString> fileNames; bool duplicatesFound = false; const QStringList sourceFilesFilter = sourceFilesForImplicitRulesFilter(); - QStringList fixifiedSourceDirs = fileFixify(source_directories.toList(), FileFixifyAbsolute); + QStringList fixifiedSourceDirs = fileFixify(QList<QString>(source_directories.constBegin(), source_directories.constEnd()), FileFixifyAbsolute); fixifiedSourceDirs.removeDuplicates(); for (const QString &sourceDir : qAsConst(fixifiedSourceDirs)) { QDirIterator dit(sourceDir, sourceFilesFilter, QDir::Files | QDir::NoDotAndDotDot); @@ -393,9 +388,9 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) } } else { for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) - t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; + t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << Qt::endl << Qt::endl; for(QStringList::Iterator cit = Option::c_ext.begin(); cit != Option::c_ext.end(); ++cit) - t << (*cit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; + t << (*cit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << Qt::endl << Qt::endl; } } @@ -498,7 +493,7 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) if(!project->isEmpty("QMAKE_POST_LINK")) { t << "\n\t" << var("QMAKE_POST_LINK"); } - t << endl; + t << Qt::endl; } void NmakeMakefileGenerator::writeLinkCommand(QTextStream &t, const QString &extraFlags, const QString &extraInlineFileContent) diff --git a/qmake/generators/win32/msvc_nmake.h b/qmake/generators/win32/msvc_nmake.h index 5bfdba2bbc..3064f06521 100644 --- a/qmake/generators/win32/msvc_nmake.h +++ b/qmake/generators/win32/msvc_nmake.h @@ -54,17 +54,10 @@ protected: QString var(const ProKey &value) const override; QString precompH, precompObj, precompPch; QString precompObjC, precompPchC; - bool usePCH, usePCHC; - -public: - NmakeMakefileGenerator(); - ~NmakeMakefileGenerator(); - + bool usePCH = false; + bool usePCHC = false; }; -inline NmakeMakefileGenerator::~NmakeMakefileGenerator() -{ } - QT_END_NAMESPACE #endif // MSVC_NMAKE_H diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index cf0b96ec9f..45f23e52bd 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -34,6 +34,7 @@ #include <qscopedpointer.h> #include <qfileinfo.h> +#include <qregexp.h> using namespace QMakeInternal; @@ -1146,6 +1147,14 @@ bool VCCLCompilerTool::parseOption(const char* option) ShowIncludes = _True; break; } + if (strlen(option) > 8 && second == 't' && third == 'd') { + const QString version = option + 8; + static const QStringList knownVersions = { "14", "17", "latest" }; + if (knownVersions.contains(version)) { + LanguageStandard = "stdcpp" + version; + break; + } + } found = false; break; case 'u': if (!second) diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index 33a96bf85e..33eff0d914 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -526,6 +526,7 @@ public: triState ImproveFloatingPointConsistency; inlineExpansionOption InlineFunctionExpansion; triState KeepComments; + QString LanguageStandard; triState MinimalRebuild; QString ObjectFile; triState OmitDefaultLibName; @@ -922,7 +923,7 @@ struct VCFilterFile inline QDebug operator<<(QDebug dbg, const VCFilterFile &p) { dbg.nospace() << "VCFilterFile(file(" << p.file - << ") excludeFromBuild(" << p.excludeFromBuild << "))" << endl; + << ") excludeFromBuild(" << p.excludeFromBuild << "))" << Qt::endl; return dbg.space(); } #endif diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 16f9361d13..8e0c62e13f 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -40,10 +40,6 @@ QT_BEGIN_NAMESPACE -Win32MakefileGenerator::Win32MakefileGenerator() : MakefileGenerator() -{ -} - ProString Win32MakefileGenerator::fixLibFlag(const ProString &lib) { if (lib.startsWith("-l")) // Fallback for unresolved -l libs. @@ -320,11 +316,11 @@ void Win32MakefileGenerator::processRcFileVar() int rcCodePage = project->intValue("RC_CODEPAGE", 1200); // default: Unicode ts << "#include <windows.h>\n"; - ts << endl; + ts << Qt::endl; if (!rcIcons.isEmpty()) { for (int i = 0; i < rcIcons.size(); ++i) - ts << QString("IDI_ICON%1\tICON\tDISCARDABLE\t%2").arg(i + 1).arg(cQuoted(rcIcons[i])) << endl; - ts << endl; + ts << QString("IDI_ICON%1\tICON\tDISCARDABLE\t%2").arg(i + 1).arg(cQuoted(rcIcons[i])) << Qt::endl; + ts << Qt::endl; } if (!manifestFile.isEmpty()) { QString manifestResourceId; @@ -335,8 +331,8 @@ void Win32MakefileGenerator::processRcFileVar() ts << manifestResourceId << " RT_MANIFEST \"" << manifestFile << "\"\n"; } ts << "VS_VERSION_INFO VERSIONINFO\n"; - ts << "\tFILEVERSION " << QString(versionString).replace(".", ",") << endl; - ts << "\tPRODUCTVERSION " << QString(versionString).replace(".", ",") << endl; + ts << "\tFILEVERSION " << QString(versionString).replace(".", ",") << Qt::endl; + ts << "\tPRODUCTVERSION " << QString(versionString).replace(".", ",") << Qt::endl; ts << "\tFILEFLAGSMASK 0x3fL\n"; ts << "#ifdef _DEBUG\n"; ts << "\tFILEFLAGS VS_FF_DEBUG\n"; @@ -369,11 +365,11 @@ void Win32MakefileGenerator::processRcFileVar() ts << "\t\tBEGIN\n"; ts << "\t\t\tVALUE \"Translation\", " << QString("0x%1").arg(rcLang, 4, 16, QLatin1Char('0')) - << ", " << QString("%1").arg(rcCodePage, 4) << endl; + << ", " << QString("%1").arg(rcCodePage, 4) << Qt::endl; ts << "\t\tEND\n"; ts << "\tEND\n"; ts << "/* End of Version info */\n"; - ts << endl; + ts << Qt::endl; ts.flush(); @@ -470,7 +466,7 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t) } } } - t << endl << endl; + t << Qt::endl << Qt::endl; t << "distclean: clean " << depVar("DISTCLEAN_DEPS"); { @@ -503,9 +499,9 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t) { QString ofile = fileFixify(Option::output.fileName()); if(!ofile.isEmpty()) - t << "\t-$(DEL_FILE) " << escapeFilePath(ofile) << endl; + t << "\t-$(DEL_FILE) " << escapeFilePath(ofile) << Qt::endl; } - t << endl; + t << Qt::endl; } void Win32MakefileGenerator::writeIncPart(QTextStream &t) @@ -519,7 +515,7 @@ void Win32MakefileGenerator::writeIncPart(QTextStream &t) if(!inc.isEmpty()) t << "-I" << escapeFilePath(inc) << ' '; } - t << endl; + t << Qt::endl; } void Win32MakefileGenerator::writeStandardParts(QTextStream &t) @@ -527,51 +523,29 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) writeExportedVariables(t); t << "####### Compiler, tools and options\n\n"; - t << "CC = " << var("QMAKE_CC") << endl; - t << "CXX = " << var("QMAKE_CXX") << endl; + t << "CC = " << var("QMAKE_CC") << Qt::endl; + t << "CXX = " << var("QMAKE_CXX") << Qt::endl; t << "DEFINES = " << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") - << varGlue("DEFINES","-D"," -D","") << endl; + << varGlue("DEFINES","-D"," -D","") << Qt::endl; t << "CFLAGS = " << var("QMAKE_CFLAGS") << " $(DEFINES)\n"; t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)\n"; writeIncPart(t); writeLibsPart(t); - - t << "QMAKE = " << var("QMAKE_QMAKE") << endl; - t << "IDC = " << (project->isEmpty("QMAKE_IDC") ? QString("idc") : var("QMAKE_IDC")) - << endl; - t << "IDL = " << (project->isEmpty("QMAKE_IDL") ? QString("midl") : var("QMAKE_IDL")) - << endl; - t << "ZIP = " << var("QMAKE_ZIP") << endl; - t << "DEF_FILE = " << fileVar("DEF_FILE") << endl; - t << "RES_FILE = " << fileVar("RES_FILE") << endl; // Not on mingw, can't see why not though... - t << "COPY = " << var("QMAKE_COPY") << endl; - t << "SED = " << var("QMAKE_STREAM_EDITOR") << endl; - t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl; - t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; - t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; - t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; - t << "MOVE = " << var("QMAKE_MOVE") << endl; - t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; - t << "MKDIR = " << var("QMAKE_MKDIR") << endl; - t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << endl; - t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl; - t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; - t << "QINSTALL = " << var("QMAKE_QMAKE") << " -install qinstall" << endl; - t << "QINSTALL_PROGRAM = " << var("QMAKE_QMAKE") << " -install qinstall -exe" << endl; - t << endl; + writeDefaultVariables(t); + t << Qt::endl; t << "####### Output directory\n\n"; if(!project->values("OBJECTS_DIR").isEmpty()) - t << "OBJECTS_DIR = " << escapeFilePath(var("OBJECTS_DIR").remove(QRegExp("\\\\$"))) << endl; + t << "OBJECTS_DIR = " << escapeFilePath(var("OBJECTS_DIR").remove(QRegExp("\\\\$"))) << Qt::endl; else t << "OBJECTS_DIR = . \n"; - t << endl; + t << Qt::endl; t << "####### Files\n\n"; t << "SOURCES = " << valList(escapeFilePaths(project->values("SOURCES"))) - << " " << valList(escapeFilePaths(project->values("GENERATED_SOURCES"))) << endl; + << " " << valList(escapeFilePaths(project->values("GENERATED_SOURCES"))) << Qt::endl; // do this here so we can set DEST_TARGET to be the complete path to the final target if it is needed. QString orgDestDir = var("DESTDIR"); @@ -587,14 +561,14 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) writeExtraVariables(t); t << "DIST = " << fileVarList("DISTFILES") << ' ' - << fileVarList("HEADERS") << ' ' << fileVarList("SOURCES") << endl; - t << "QMAKE_TARGET = " << fileVar("QMAKE_ORIG_TARGET") << endl; // unused + << fileVarList("HEADERS") << ' ' << fileVarList("SOURCES") << Qt::endl; + t << "QMAKE_TARGET = " << fileVar("QMAKE_ORIG_TARGET") << Qt::endl; // unused // The comment is important to maintain variable compatibility with Unix // Makefiles, while not interpreting a trailing-slash as a linebreak t << "DESTDIR = " << escapeFilePath(destDir) << " #avoid trailing-slash linebreak\n"; - t << "TARGET = " << escapeFilePath(target) << endl; - t << "DESTDIR_TARGET = " << fileVar("DEST_TARGET") << endl; - t << endl; + t << "TARGET = " << escapeFilePath(target) << Qt::endl; + t << "DESTDIR_TARGET = " << fileVar("DEST_TARGET") << Qt::endl; + t << Qt::endl; writeImplicitRulesPart(t); @@ -606,10 +580,10 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) const ProStringList &dlldirs = project->values("DLLDESTDIR"); for (ProStringList::ConstIterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir) { t << "\t-$(COPY_FILE) $(DESTDIR_TARGET) " - << escapeFilePath(Option::fixPathToTargetOS((*dlldir).toQString(), false)) << endl; + << escapeFilePath(Option::fixPathToTargetOS((*dlldir).toQString(), false)) << Qt::endl; } } - t << endl; + t << Qt::endl; writeRcFilePart(t); } @@ -642,33 +616,33 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) } } } - t << endl << endl; + t << Qt::endl << Qt::endl; writeCleanParts(t); writeExtraTargets(t); writeExtraCompilerTargets(t); - t << endl << endl; + t << Qt::endl << Qt::endl; } void Win32MakefileGenerator::writeLibsPart(QTextStream &t) { if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { - t << "LIBAPP = " << var("QMAKE_LIB") << endl; - t << "LIBFLAGS = " << var("QMAKE_LIBFLAGS") << endl; + t << "LIBAPP = " << var("QMAKE_LIB") << Qt::endl; + t << "LIBFLAGS = " << var("QMAKE_LIBFLAGS") << Qt::endl; } else { - t << "LINKER = " << var("QMAKE_LINK") << endl; - t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; + t << "LINKER = " << var("QMAKE_LINK") << Qt::endl; + t << "LFLAGS = " << var("QMAKE_LFLAGS") << Qt::endl; t << "LIBS = " << fixLibFlags("LIBS").join(' ') << ' ' << fixLibFlags("LIBS_PRIVATE").join(' ') << ' ' << fixLibFlags("QMAKE_LIBS").join(' ') << ' ' - << fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << endl; + << fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << Qt::endl; } } void Win32MakefileGenerator::writeObjectsPart(QTextStream &t) { // Used in both deps and commands. - t << "OBJECTS = " << valList(escapeDependencyPaths(project->values("OBJECTS"))) << endl; + t << "OBJECTS = " << valList(escapeDependencyPaths(project->values("OBJECTS"))) << Qt::endl; } void Win32MakefileGenerator::writeImplicitRulesPart(QTextStream &t) @@ -710,7 +684,7 @@ void Win32MakefileGenerator::writeRcFilePart(QTextStream &t) << var("QMAKE_RC") << (project->isActiveConfig("debug") ? " -D_DEBUG" : "") << defines << incPathStr << " -fo " << escapeFilePath(res_file) << ' ' << escapeFilePath(rc_file); - t << endl << endl; + t << Qt::endl << Qt::endl; } } @@ -789,6 +763,20 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t) return ret; } +void Win32MakefileGenerator::writeDefaultVariables(QTextStream &t) +{ + MakefileGenerator::writeDefaultVariables(t); + t << "IDC = " << (project->isEmpty("QMAKE_IDC") ? QString("idc") : var("QMAKE_IDC")) + << Qt::endl; + t << "IDL = " << (project->isEmpty("QMAKE_IDL") ? QString("midl") : var("QMAKE_IDL")) + << Qt::endl; + t << "ZIP = " << var("QMAKE_ZIP") << Qt::endl; + t << "DEF_FILE = " << fileVar("DEF_FILE") << Qt::endl; + t << "RES_FILE = " << fileVar("RES_FILE") << Qt::endl; // Not on mingw, can't see why not though... + t << "SED = " << var("QMAKE_STREAM_EDITOR") << Qt::endl; + t << "MOVE = " << var("QMAKE_MOVE") << Qt::endl; +} + QString Win32MakefileGenerator::escapeFilePath(const QString &path) const { QString ret = path; diff --git a/qmake/generators/win32/winmakefile.h b/qmake/generators/win32/winmakefile.h index 4416951a09..8eb633fdfa 100644 --- a/qmake/generators/win32/winmakefile.h +++ b/qmake/generators/win32/winmakefile.h @@ -35,11 +35,9 @@ QT_BEGIN_NAMESPACE class Win32MakefileGenerator : public MakefileGenerator { -public: - Win32MakefileGenerator(); - ~Win32MakefileGenerator(); protected: QString defaultInstall(const QString &) override; + void writeDefaultVariables(QTextStream &t) override; virtual void writeCleanParts(QTextStream &t); virtual void writeStandardParts(QTextStream &t); virtual void writeIncPart(QTextStream &t); @@ -68,9 +66,6 @@ protected: virtual QString getManifestFileForRcFile() const; }; -inline Win32MakefileGenerator::~Win32MakefileGenerator() -{ } - QT_END_NAMESPACE #endif // WINMAKEFILE_H diff --git a/qmake/generators/xmloutput.cpp b/qmake/generators/xmloutput.cpp index e92749a126..2f48763550 100644 --- a/qmake/generators/xmloutput.cpp +++ b/qmake/generators/xmloutput.cpp @@ -237,7 +237,7 @@ void XmlOutput::newTagOpen(const QString &tag) closeOpen(); if (format == NewLine) - xmlFile << endl << currentIndent; + xmlFile << Qt::endl << currentIndent; xmlFile << '<' << doConversion(tag); currentState = Attribute; tagStack.append(tag); @@ -271,7 +271,7 @@ void XmlOutput::closeTag() case Tag: decreaseIndent(); // <--- Pre-decrease indent if (format == NewLine) - xmlFile << endl << currentIndent; + xmlFile << Qt::endl << currentIndent; xmlFile << "</" << doConversion(tagStack.last()) << '>'; tagStack.pop_back(); break; @@ -343,7 +343,7 @@ void XmlOutput::addAttribute(const QString &attribute, const QString &value) break; } if (format == NewLine) - xmlFile << endl; + xmlFile << Qt::endl; xmlFile << currentIndent << doConversion(attribute) << "=\"" << doConversion(value) << "\""; } diff --git a/qmake/library/ioutils.cpp b/qmake/library/ioutils.cpp index 3e49a99cd5..d2171274d8 100644 --- a/qmake/library/ioutils.cpp +++ b/qmake/library/ioutils.cpp @@ -30,6 +30,7 @@ #include <qdir.h> #include <qfile.h> +#include <qregexp.h> #ifdef Q_OS_WIN # include <windows.h> diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index 3c4e509fc6..866915bdfd 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -1457,15 +1457,15 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( } case T_EXPORT: { const ProKey &var = map(args.at(0)); - for (ProValueMapStack::Iterator vmi = m_valuemapStack.end(); + for (ProValueMapStack::iterator vmi = m_valuemapStack.end(); --vmi != m_valuemapStack.begin(); ) { ProValueMap::Iterator it = (*vmi).find(var); if (it != (*vmi).end()) { if (it->constBegin() == statics.fakeValue.constBegin()) { // This is stupid, but qmake doesn't propagate deletions - m_valuemapStack.first()[var] = ProStringList(); + m_valuemapStack.front()[var] = ProStringList(); } else { - m_valuemapStack.first()[var] = *it; + m_valuemapStack.front()[var] = *it; } (*vmi).erase(it); while (--vmi != m_valuemapStack.begin()) @@ -1476,7 +1476,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( return ReturnTrue; } case T_DISCARD_FROM: { - if (m_valuemapStack.count() != 1) { + if (m_valuemapStack.size() != 1) { evalError(fL1S("discard_from() cannot be called from functions.")); return ReturnFalse; } @@ -1486,7 +1486,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( int pro = m_vfs->idForFileName(fn, flags | QMakeVfs::VfsAccessedOnly); if (!pro) return ReturnFalse; - ProValueMap &vmap = m_valuemapStack.first(); + ProValueMap &vmap = m_valuemapStack.front(); for (auto vit = vmap.begin(); vit != vmap.end(); ) { if (!vit->isEmpty()) { auto isFrom = [pro](const ProString &s) { @@ -1514,7 +1514,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( else ++fit; } - ProStringList &iif = m_valuemapStack.first()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")]; + ProStringList &iif = m_valuemapStack.front()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")]; int idx = iif.indexOf(ProString(fn)); if (idx >= 0) iif.removeAt(idx); diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index ade8e15a39..c9dc7bd80b 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -601,14 +601,16 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProBlock( case TokBypassNesting: blockLen = getBlockLen(tokPtr); if ((m_cumulative || okey != or_op) && blockLen) { - ProValueMapStack savedValuemapStack = m_valuemapStack; + ProValueMapStack savedValuemapStack = std::move(m_valuemapStack); m_valuemapStack.clear(); - m_valuemapStack.append(savedValuemapStack.takeFirst()); + m_valuemapStack.splice(m_valuemapStack.end(), + savedValuemapStack, savedValuemapStack.begin()); traceMsg("visiting nesting-bypassing block"); ret = visitProBlock(tokPtr); traceMsg("visited nesting-bypassing block"); - savedValuemapStack.prepend(m_valuemapStack.first()); - m_valuemapStack = savedValuemapStack; + savedValuemapStack.splice(savedValuemapStack.begin(), + m_valuemapStack, m_valuemapStack.begin()); + m_valuemapStack = std::move(savedValuemapStack); } else { traceMsg("skipped nesting-bypassing block"); ret = ReturnTrue; @@ -1439,7 +1441,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile( for (ProValueMap::ConstIterator it = m_extraVars.constBegin(); it != m_extraVars.constEnd(); ++it) - m_valuemapStack.first().insert(it.key(), it.value()); + m_valuemapStack.front().insert(it.key(), it.value()); // In case default_pre needs to make decisions based on the current // build pass configuration. @@ -1707,7 +1709,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFunction( { VisitReturn vr; - if (m_valuemapStack.count() >= 100) { + if (m_valuemapStack.size() >= 100) { evalError(fL1S("Ran into infinite recursion (depth > 100).")); vr = ReturnFalse; } else { @@ -1859,7 +1861,7 @@ static bool isFunctParam(const ProKey &variableName) ProValueMap *QMakeEvaluator::findValues(const ProKey &variableName, ProValueMap::Iterator *rit) { - ProValueMapStack::Iterator vmi = m_valuemapStack.end(); + ProValueMapStack::iterator vmi = m_valuemapStack.end(); for (bool first = true; ; first = false) { --vmi; ProValueMap::Iterator it = (*vmi).find(variableName); @@ -1886,7 +1888,7 @@ ProStringList &QMakeEvaluator::valuesRef(const ProKey &variableName) return *it; } if (!isFunctParam(variableName)) { - ProValueMapStack::Iterator vmi = m_valuemapStack.end(); + ProValueMapStack::iterator vmi = m_valuemapStack.end(); if (--vmi != m_valuemapStack.begin()) { do { --vmi; @@ -1905,7 +1907,7 @@ ProStringList &QMakeEvaluator::valuesRef(const ProKey &variableName) ProStringList QMakeEvaluator::values(const ProKey &variableName) const { - ProValueMapStack::ConstIterator vmi = m_valuemapStack.constEnd(); + ProValueMapStack::const_iterator vmi = m_valuemapStack.cend(); for (bool first = true; ; first = false) { --vmi; ProValueMap::ConstIterator it = (*vmi).constFind(variableName); @@ -1914,7 +1916,7 @@ ProStringList QMakeEvaluator::values(const ProKey &variableName) const break; return *it; } - if (vmi == m_valuemapStack.constBegin()) + if (vmi == m_valuemapStack.cbegin()) break; if (first && isFunctParam(variableName)) break; @@ -1942,7 +1944,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFile( m_current = m_locationStack.pop(); pro->deref(); if (ok == ReturnTrue && !(flags & LoadHidden)) { - ProStringList &iif = m_valuemapStack.first()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")]; + ProStringList &iif = m_valuemapStack.front()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")]; ProString ifn(fileName); if (!iif.contains(ifn)) iif << ifn; @@ -2071,7 +2073,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFileInto( return ret; *values = visitor.m_valuemapStack.top(); ProKey qiif("QMAKE_INTERNAL_INCLUDED_FILES"); - ProStringList &iif = m_valuemapStack.first()[qiif]; + ProStringList &iif = m_valuemapStack.front()[qiif]; const auto ifns = values->value(qiif); for (const ProString &ifn : ifns) if (!iif.contains(ifn)) diff --git a/qmake/library/qmakeevaluator.h b/qmake/library/qmakeevaluator.h index f617681cbb..9f702b9182 100644 --- a/qmake/library/qmakeevaluator.h +++ b/qmake/library/qmakeevaluator.h @@ -38,7 +38,6 @@ #include "ioutils.h" #include <qlist.h> -#include <qlinkedlist.h> #include <qmap.h> #include <qset.h> #include <qstack.h> @@ -54,6 +53,8 @@ # include <qmutex.h> #endif +#include <list> + QT_BEGIN_NAMESPACE class QMakeGlobals; @@ -94,15 +95,15 @@ public: #endif }; -// We use a QLinkedList based stack instead of a QVector based one (QStack), so that +// We use a list-based stack instead of a vector-based one, so that // the addresses of value maps stay constant. The qmake generators rely on that. -class QMAKE_EXPORT ProValueMapStack : public QLinkedList<ProValueMap> +class QMAKE_EXPORT ProValueMapStack : public std::list<ProValueMap> { public: - inline void push(const ProValueMap &t) { append(t); } - inline ProValueMap pop() { return takeLast(); } - ProValueMap &top() { return last(); } - const ProValueMap &top() const { return last(); } + inline void push(const ProValueMap &t) { push_back(t); } + inline ProValueMap pop() { auto r = std::move(back()); pop_back(); return r; } + ProValueMap &top() { return back(); } + const ProValueMap &top() const { return back(); } }; namespace QMakeInternal { struct QMakeBuiltin; } diff --git a/qmake/library/qmakeevaluator_p.h b/qmake/library/qmakeevaluator_p.h index f888bc5765..da83ff0de2 100644 --- a/qmake/library/qmakeevaluator_p.h +++ b/qmake/library/qmakeevaluator_p.h @@ -31,8 +31,6 @@ #include "proitems.h" -#include <qregexp.h> - #define debugMsg if (!m_debugLevel) {} else debugMsgInternal #define traceMsg if (!m_debugLevel) {} else traceMsgInternal #ifdef PROEVALUATOR_DEBUG diff --git a/qmake/library/qmakeglobals.cpp b/qmake/library/qmakeglobals.cpp index daf4707779..1d76cecc45 100644 --- a/qmake/library/qmakeglobals.cpp +++ b/qmake/library/qmakeglobals.cpp @@ -38,7 +38,6 @@ #include <qfile.h> #include <qfileinfo.h> #include <qlist.h> -#include <qregexp.h> #include <qset.h> #include <qstack.h> #include <qstring.h> diff --git a/qmake/project.cpp b/qmake/project.cpp index 1bc9b352b5..931a337b71 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -143,15 +143,15 @@ ProString QMakeProject::expand(const QString &expr, const QString &where, int li bool QMakeProject::isEmpty(const ProKey &v) const { - ProValueMap::ConstIterator it = m_valuemapStack.first().constFind(v); - return it == m_valuemapStack.first().constEnd() || it->isEmpty(); + ProValueMap::ConstIterator it = m_valuemapStack.front().constFind(v); + return it == m_valuemapStack.front().constEnd() || it->isEmpty(); } void QMakeProject::dump() const { QStringList out; - for (ProValueMap::ConstIterator it = m_valuemapStack.first().begin(); - it != m_valuemapStack.first().end(); ++it) { + for (ProValueMap::ConstIterator it = m_valuemapStack.front().begin(); + it != m_valuemapStack.front().end(); ++it) { if (!it.key().startsWith('.')) { QString str = it.key() + " ="; for (const ProString &v : it.value()) diff --git a/qmake/project.h b/qmake/project.h index d7a5852bed..071b62424f 100644 --- a/qmake/project.h +++ b/qmake/project.h @@ -58,12 +58,12 @@ public: { m_current.clear(); return evaluateConditional(QStringRef(&v), file, line) == ReturnTrue; } bool test(const ProKey &func, const QList<ProStringList> &args); - bool isSet(const ProKey &v) const { return m_valuemapStack.first().contains(v); } + bool isSet(const ProKey &v) const { return m_valuemapStack.front().contains(v); } bool isEmpty(const ProKey &v) const; ProStringList &values(const ProKey &v) { return valuesRef(v); } int intValue(const ProKey &v, int defaultValue = 0) const; - const ProValueMap &variables() const { return m_valuemapStack.first(); } - ProValueMap &variables() { return m_valuemapStack.first(); } + const ProValueMap &variables() const { return m_valuemapStack.front(); } + ProValueMap &variables() { return m_valuemapStack.front(); } bool isActiveConfig(const QString &config, bool regex = false) { return QMakeEvaluator::isActiveConfig(QStringRef(&config), regex); } diff --git a/qmake/qmake.pro b/qmake/qmake.pro index 6a6116c8db..276c1237a9 100644 --- a/qmake/qmake.pro +++ b/qmake/qmake.pro @@ -136,7 +136,6 @@ SOURCES += \ qjsonparser.cpp \ qjsonvalue.cpp \ qlibraryinfo.cpp \ - qlinkedlist.cpp \ qlist.cpp \ qlocale.cpp \ qlocale_tools.cpp \ @@ -189,7 +188,6 @@ HEADERS += \ qjsonparser_p.h \ qjsonvalue.h \ qjsonwriter_p.h \ - qlinkedlist.h \ qlist.h \ qlocale.h \ qlocale_tools_p.h \ |