diff options
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/Makefile.unix | 8 | ||||
-rw-r--r-- | qmake/Makefile.win32 | 1 | ||||
-rw-r--r-- | qmake/doc/src/qmake-manual.qdoc | 94 | ||||
-rw-r--r-- | qmake/generators/mac/pbuilder_pbx.cpp | 115 | ||||
-rw-r--r-- | qmake/generators/mac/pbuilder_pbx.h | 2 | ||||
-rw-r--r-- | qmake/generators/makefile.cpp | 10 | ||||
-rw-r--r-- | qmake/generators/makefile.h | 3 | ||||
-rw-r--r-- | qmake/generators/metamakefile.cpp | 7 | ||||
-rw-r--r-- | qmake/generators/projectgenerator.cpp | 2 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake.cpp | 27 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 11 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_nmake.cpp | 4 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.cpp | 16 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.cpp | 3 | ||||
-rw-r--r-- | qmake/generators/win32/winmakefile.cpp | 42 | ||||
-rw-r--r-- | qmake/main.cpp | 42 | ||||
-rw-r--r-- | qmake/option.cpp | 14 | ||||
-rw-r--r-- | qmake/property.cpp | 1 |
18 files changed, 268 insertions, 134 deletions
diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index e895feaef4..4d4f05e78a 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -27,7 +27,7 @@ QOBJS = \ qjsonarray.o qjson.o qjsondocument.o qjsonobject.o qjsonparser.o qjsonvalue.o \ qmetatype.o qsystemerror.o qvariant.o \ quuid.o \ - qarraydata.o qbitarray.o qbytearray.o qbytearraymatcher.o \ + qarraydata.o qbitarray.o qbytearray.o qbytearraylist.o qbytearraymatcher.o \ qcalendar.o qgregoriancalendar.o qromancalendar.o \ qcryptographichash.o qdatetime.o qhash.o qlist.o \ qlocale.o qlocale_tools.o qmap.o qregexp.o qringbuffer.o \ @@ -106,7 +106,8 @@ DEPEND_SRC = \ $(SOURCE_PATH)/src/corelib/serialization/qtextstream.cpp \ $(SOURCE_PATH)/src/corelib/serialization/qxmlstream.cpp \ $(SOURCE_PATH)/src/corelib/serialization/qxmlutils.cpp \ - $(SOURCE_PATH)/src/corelib/text/qbytearray.cpp\ + $(SOURCE_PATH)/src/corelib/text/qbytearray.cpp \ + $(SOURCE_PATH)/src/corelib/text/qbytearraylist.cpp \ $(SOURCE_PATH)/src/corelib/text/qbytearraymatcher.cpp \ $(SOURCE_PATH)/src/corelib/text/qlocale.cpp \ $(SOURCE_PATH)/src/corelib/text/qlocale_tools.cpp \ @@ -309,6 +310,9 @@ qarraydata.o: $(SOURCE_PATH)/src/corelib/tools/qarraydata.cpp qbytearray.o: $(SOURCE_PATH)/src/corelib/text/qbytearray.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< +qbytearraylist.o: $(SOURCE_PATH)/src/corelib/text/qbytearraylist.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $< + qvsnprintf.o: $(SOURCE_PATH)/src/corelib/text/qvsnprintf.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 672df47953..7324817af2 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -69,6 +69,7 @@ QTOBJS= \ qfsfileengine_iterator.obj \ qarraydata.obj \ qbytearray.obj \ + qbytearraylist.obj \ qvsnprintf.obj \ qbytearraymatcher.obj \ qcalendar.obj \ diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index 3495f97b2c..da3aa6b248 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -992,6 +992,22 @@ \row \li embed_translations \li Embed the generated translations from \c lrelease in the executable, under \l{QM_FILES_RESOURCE_PREFIX}. Requires \c lrelease to be set, too. Not set by default. + \row \li create_libtool \li Create a libtool .la file for the currently + built library. + \row \li create_pc \li Create a pkg-config .pc file for the currently built + library. + \row \li no_batch \li NMake only: Turn off generation of NMake batch rules + or inference rules. + \row \li skip_target_version_ext \li Suppress the automatic version number + appended to the DLL file name on Windows. + \row \li suppress_vcproj_warnings \li Suppress warnings of the VS project + generator. + \row \li windeployqt \li Automatically invoke windeployqt after linking, + and add the output as deployment items. + \row \li dont_recurse \li Suppress qmake recursion for the current + subproject. + \row \li no_include_pwd \li Do not add the current directory to + INCLUDEPATHS. \endtable When you use the \c debug_and_release option (which is the default under @@ -1039,6 +1055,8 @@ qmake will process all libraries linked to by the application and find their meta-information (see \l{LibDepend}{Library Dependencies} for more info). + \row \li no_install_prl \li This option disables the generation of + installation rules for generated .prl files. \endtable \note The \c create_prl option is required when \e {building} a @@ -1144,6 +1162,26 @@ \snippet code/doc_src_qmake-manual.pro 27 + \target DEFINES_DEBUG + \section1 DEFINES_DEBUG + + Specifies preprocessor defines for the debug configuration. The values of + this variable get added to \l{DEFINES} before the project is loaded. This + variable is typically set in \l{#QMAKESPEC}{qmake.conf} and rarely needs + to be modified. + + This variable was introduced in Qt 5.13.2. + + \target DEFINES_RELEASE + \section1 DEFINES_RELEASE + + Specifies preprocessor defines for the release configuration. The values of + this variable get added to \l{DEFINES} before the project is loaded. This + variable is typically set in \l{#QMAKESPEC}{qmake.conf} and rarely needs + to be modified. + + This variable was introduced in Qt 5.13.2. + \target DEF_FILE \section1 DEF_FILE @@ -2871,8 +2909,8 @@ On desktop Windows, the default value is the value of the environment variable \c{WindowsSDKVersion}. - On WinRT, the default value is the value of the environment variable - \c{UCRTVERSION}. + On Universal Windows Platform (UWP), the default value is the value of the + environment variable \c{UCRTVERSION}. \target WINDOWS_TARGET_PLATFORM_MIN_VERSION \section1 WINDOWS_TARGET_PLATFORM_MIN_VERSION @@ -2885,8 +2923,8 @@ \target WINRT_MANIFEST \section1 WINRT_MANIFEST - Specifies parameters to be passed to the application manifest on \l{Qt for WinRT}{Windows - Runtime}. The allowed values are: + Specifies parameters to be passed to the application manifest on + \l{Qt for UWP}{UWP}. The allowed values are: \table \header @@ -2921,7 +2959,6 @@ \row \li foreground \li Tile foreground (text) color. Defaults to \c{light}. - This option is only available for Windows Store apps on Windows 8 and Windows RT. \row \li iconic_tile_icon \li Image file for the \c{iconic} tile template icon. Default provided by @@ -2936,16 +2973,16 @@ manifest's UUID, or generates a new UUID if none is present. \row \li logo_30x30 - \li Logo image file of size 30x30 pixels. This is not supported on Windows Phone. + \li Logo image file of size 30x30 pixels. \row \li logo_41x41 - \li Logo image file of size 41x41 pixels. This is only supported on Windows Phone. + \li Logo image file of size 41x41 pixels. This parameter is obsolete. \row \li logo_70x70 - \li Logo image file of size 70x70 pixels. This is not supported on Windows Phone. + \li Logo image file of size 70x70 pixels. \row \li logo_71x71 - \li Logo image file of size 71x71 pixels. This is only supported on Windows Phone. + \li Logo image file of size 71x71 pixels. This parameter is obsolete. \row \li logo_150x150 \li Logo image file of size 150x150 pixels. This is supported on all Windows @@ -2960,31 +2997,27 @@ Store App platforms. \row \li logo_620x300 - \li Splash screen image file of size 620x300 pixels. This is not supported on - Windows Phone. + \li Splash screen image file of size 620x300 pixels. \row \li logo_480x800 - \li Splash screen image file of size 480x800 pixels. This is only supported on - Windows Phone. + \li Splash screen image file of size 480x800 pixels. + This parameter is obsolete. \row \li logo_large \li Large logo image file. This has to be 150x150 pixels. Supported on all Windows Store App platforms. Default provided by the mkspec. \row \li logo_medium - \li Medium logo image file. For Windows Phone the image must have a pixel size - of 71x71, for other Windows Store App platforms 70x70. Default provided by - the mkspec. + \li Medium logo image file. The image must have a pixel size of 70x70. + Default provided by the mkspec. \row \li logo_small - \li Small logo image file. For Windows Phone the image must have a pixel size - of 44x44, for other Windows Store App platforms 30x30. Default provided by - the mkspec. + \li Small logo image file. The image must have a pixel size of 30x30. + Default provided by the mkspec. \row \li logo_splash - \li Splash screen image file. For Windows Phone the image must have a pixel size - of 480x800, for other Windows Store App platforms 620x300. Default provided - by the mkspec. + \li Splash screen image file. The image must have a pixel size of + 620x300. Default provided by the mkspec. \row \li logo_store \li Logo image file for Windows Store. Default provided by the mkspec. @@ -2997,10 +3030,12 @@ \li The name of the package as displayed to the user. Defaults to TARGET. \row \li phone_product_id - \li The GUID of the product. Defaults to the value of WINRT_MANIFEST.identity. (Windows Phone only) + \li The GUID of the product. + This parameter is obsolete. \row \li phone_publisher_id - \li The GUID of the publisher. Defaults to an invalid GUID. (Windows Phone only) + \li The GUID of the publisher. + This parameter is obsolete. \row \li publisher \li Display name of the publisher. Defaults to \c{Default publisher display name}. @@ -3051,10 +3086,6 @@ WINRT_MANIFEST.CONFIG += verbatim \endcode - \note The required image sizes of \e logo_small, \e logo_medium, and \e logo_large - depend on the target platform. The general descriptions are overwritten if a - description that specifies the size is provided. - \target YACCSOURCES \section1 YACCSOURCES @@ -4796,6 +4827,11 @@ \li The dependencies for the output only get generated from the depends member and from nowhere else. \row + \li dep_existing_only + \li Every dependency that is a result of .depend_command is checked for + existence. Non-existing dependencies are ignored. + This value was introduced in Qt 5.13.2. + \row \li dep_lines \li The output from the .depend_command is interpreted to be one file per line. The default is to split on whitespace and is maintained diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 28cf02344d..24e69444c9 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -509,6 +509,56 @@ static QList<QVariantMap> provisioningTeams() return flatTeams; } +bool ProjectBuilderMakefileGenerator::replaceLibrarySuffix(const QString &lib_file, + const ProString &opt, + QString &name, QString &library) +{ + /* This isn't real nice, but it is real useful. This looks in a prl + for what the library will ultimately be called so we can stick it + in the ProjectFile. If the prl format ever changes (not likely) then + this will not really work. However, more concerning is that it will + encode the version number in the Project file which might be a bad + things in days to come? --Sam + */ + if (lib_file.isEmpty()) + return false; + + QMakeMetaInfo libinfo; + if (!libinfo.readLib(lib_file) || libinfo.isEmpty("QMAKE_PRL_TARGET")) + return false; + + const QString libDir = fileInfo(lib_file).absolutePath(); + library = libDir + Option::dir_sep + libinfo.first("QMAKE_PRL_TARGET"); + + debug_msg(1, "pbuilder: Found library (%s) via PRL %s (%s)", + opt.toLatin1().constData(), lib_file.toLatin1().constData(), library.toLatin1().constData()); + + if (project->isActiveConfig("xcode_dynamic_library_suffix")) { + QString suffixSetting = project->first("QMAKE_XCODE_LIBRARY_SUFFIX_SETTING").toQString(); + if (!suffixSetting.isEmpty()) { + QString librarySuffix = project->first("QMAKE_XCODE_LIBRARY_SUFFIX").toQString(); + suffixSetting = "$(" + suffixSetting + ")"; + if (!librarySuffix.isEmpty()) { + int pos = library.lastIndexOf(librarySuffix + '.'); + if (pos == -1) { + warn_msg(WarnLogic, "Failed to find expected suffix '%s' for library '%s'.", + qPrintable(librarySuffix), qPrintable(library)); + } else { + library.replace(pos, librarySuffix.length(), suffixSetting); + if (name.endsWith(librarySuffix)) + name.chop(librarySuffix.length()); + } + } else { + int pos = library.lastIndexOf(name); + if (pos != -1) + library.insert(pos + name.length(), suffixSetting); + } + } + } + + return true; +} + bool ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) { @@ -820,6 +870,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } if(!project->isActiveConfig("staticlib")) { //DUMP LIBRARIES + const ProStringList defaultLibDirs = project->values("QMAKE_DEFAULT_LIBDIRS"); ProStringList &libdirs = project->values("QMAKE_PBX_LIBPATHS"), &frameworkdirs = project->values("QMAKE_FRAMEWORKPATH"); static const char * const libs[] = { "LIBS", "LIBS_PRIVATE", @@ -827,6 +878,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) for (int i = 0; libs[i]; i++) { tmp = project->values(libs[i]); for(int x = 0; x < tmp.count();) { + bool libSuffixReplaced = false; bool remove = false; QString library, name; ProString opt = tmp[x]; @@ -839,49 +891,12 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) QString lib("lib" + name); for (ProStringList::Iterator lit = libdirs.begin(); lit != libdirs.end(); ++lit) { if(project->isActiveConfig("link_prl")) { - /* This isn't real nice, but it is real useful. This looks in a prl - for what the library will ultimately be called so we can stick it - in the ProjectFile. If the prl format ever changes (not likely) then - this will not really work. However, more concerning is that it will - encode the version number in the Project file which might be a bad - things in days to come? --Sam - */ - QString lib_file = QMakeMetaInfo::checkLib(Option::normalizePath( - (*lit) + Option::dir_sep + lib + Option::prl_ext)); - if (!lib_file.isEmpty()) { - QMakeMetaInfo libinfo; - if(libinfo.readLib(lib_file)) { - if(!libinfo.isEmpty("QMAKE_PRL_TARGET")) { - library = (*lit) + Option::dir_sep + libinfo.first("QMAKE_PRL_TARGET"); - debug_msg(1, "pbuilder: Found library (%s) via PRL %s (%s)", - opt.toLatin1().constData(), lib_file.toLatin1().constData(), library.toLatin1().constData()); - remove = true; - - if (project->isActiveConfig("xcode_dynamic_library_suffix")) { - QString suffixSetting = project->first("QMAKE_XCODE_LIBRARY_SUFFIX_SETTING").toQString(); - if (!suffixSetting.isEmpty()) { - QString librarySuffix = project->first("QMAKE_XCODE_LIBRARY_SUFFIX").toQString(); - suffixSetting = "$(" + suffixSetting + ")"; - if (!librarySuffix.isEmpty()) { - int pos = library.lastIndexOf(librarySuffix + '.'); - if (pos == -1) { - warn_msg(WarnLogic, "Failed to find expected suffix '%s' for library '%s'.", - qPrintable(librarySuffix), qPrintable(library)); - } else { - library.replace(pos, librarySuffix.length(), suffixSetting); - if (name.endsWith(librarySuffix)) - name.chop(librarySuffix.length()); - } - } else { - int pos = library.lastIndexOf(name); - if (pos != -1) - library.insert(pos + name.length(), suffixSetting); - } - } - } - } - } - } + const QString prlFilePath = QMakeMetaInfo::checkLib( + Option::normalizePath((*lit) + Option::dir_sep + lib + + Option::prl_ext)); + if (replaceLibrarySuffix(prlFilePath, opt, name, library)) + remove = true; + libSuffixReplaced = true; } if(!remove) { QString extns[] = { ".dylib", ".so", ".a", QString() }; @@ -931,6 +946,16 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } } if(!library.isEmpty()) { + if (!libSuffixReplaced) { + const QFileInfo fi = fileInfo(library); + const QString prlFilePath = QMakeMetaInfo::checkLib( + Option::normalizePath(fi.absolutePath() + '/' + fi.completeBaseName() + + Option::prl_ext)); + if (!prlFilePath.isEmpty()) { + name = fi.completeBaseName().mid(3); + replaceLibrarySuffix(prlFilePath, opt, name, library); + } + } const int slsh = library.lastIndexOf(Option::dir_sep); if(name.isEmpty()) { if(slsh != -1) @@ -938,8 +963,10 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } if(slsh != -1) { const QString path = QFileInfo(library.left(slsh)).absoluteFilePath(); - if(!path.isEmpty() && !libdirs.contains(path)) + if (!path.isEmpty() && !libdirs.contains(path) + && !defaultLibDirs.contains(path)) { libdirs += path; + } } library = fileFixify(library, FileFixifyFromOutdir | FileFixifyAbsolute); QString key = keyFor(library); diff --git a/qmake/generators/mac/pbuilder_pbx.h b/qmake/generators/mac/pbuilder_pbx.h index ac0d63606d..1b90a3bbeb 100644 --- a/qmake/generators/mac/pbuilder_pbx.h +++ b/qmake/generators/mac/pbuilder_pbx.h @@ -41,6 +41,8 @@ class ProjectBuilderMakefileGenerator : public UnixMakefileGenerator bool writeSubDirs(QTextStream &); bool writeMakeParts(QTextStream &); bool writeMakefile(QTextStream &) override; + bool replaceLibrarySuffix(const QString &lib_file, const ProString &opt, QString &name, + QString &library); QString pbxbuild(); QHash<QString, QString> keys; diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 94e9259c68..c5868adf27 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1856,7 +1856,8 @@ void MakefileGenerator::callExtraCompilerDependCommand(const ProString &extraCom const QString &inpf, const QString &tmp_out, bool dep_lines, - QStringList *deps) + QStringList *deps, + bool existingDepsOnly) { char buff[256]; QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, tmp_out, LocalShell); @@ -1885,6 +1886,8 @@ void MakefileGenerator::callExtraCompilerDependCommand(const ProString &extraCom warn_msg(WarnDeprecated, ".depend_command for extra compiler %s" " prints paths relative to source directory", extraCompiler.toLatin1().constData()); + } else if (existingDepsOnly) { + file.clear(); } else { file = absFile; // fallback for generated resources } @@ -2013,6 +2016,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) } t << Qt::endl; } + const bool existingDepsOnly = config.contains("dep_existing_only"); QStringList tmp_dep = project->values(ProKey(*it + ".depends")).toQStringList(); if (config.indexOf("combine") != -1) { if (tmp_out.contains(QRegExp("(^|[^$])\\$\\{QMAKE_(?!VAR_)"))) { @@ -2029,7 +2033,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) inputs += Option::fixPathToTargetOS(inpf, false); if(!tmp_dep_cmd.isEmpty() && doDepends()) { callExtraCompilerDependCommand(*it, dep_cd_cmd, tmp_dep_cmd, inpf, - tmp_out, dep_lines, &deps); + tmp_out, dep_lines, &deps, existingDepsOnly); } } for(int i = 0; i < inputs.size(); ) { @@ -2078,7 +2082,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")"); if(!tmp_dep_cmd.isEmpty() && doDepends()) { callExtraCompilerDependCommand(*it, dep_cd_cmd, tmp_dep_cmd, inpf, - tmp_out, dep_lines, &deps); + tmp_out, dep_lines, &deps, existingDepsOnly); //use the depend system to find includes of these included files QStringList inc_deps; for(int i = 0; i < deps.size(); ++i) { diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 45250a6aa2..18c27a4385 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -86,7 +86,8 @@ protected: QString resolveDependency(const QDir &outDir, const QString &file); void callExtraCompilerDependCommand(const ProString &extraCompiler, const QString &dep_cd_cmd, const QString &tmp_dep_cmd, const QString &inpf, - const QString &tmp_out, bool dep_lines, QStringList *deps); + const QString &tmp_out, bool dep_lines, QStringList *deps, + bool existingDepsOnly); void writeExtraCompilerTargets(QTextStream &t); void writeExtraCompilerVariables(QTextStream &t); bool writeDummyMakefile(QTextStream &t); diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 22a72100f7..7776d77008 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -141,7 +141,8 @@ bool BuildsMetaMakefileGenerator::write() { Build *glue = nullptr; - if(!makefiles.isEmpty() && !makefiles.first()->build.isNull()) { + if(!makefiles.isEmpty() && !makefiles.first()->build.isNull() + && Option::qmake_mode != Option::QMAKE_GENERATE_PRL) { glue = new Build; glue->name = name; glue->makefile = createMakefileGenerator(project, true); @@ -252,6 +253,10 @@ void BuildsMetaMakefileGenerator::checkForConflictingTargets() const // and the last entry in makefiles is the "glue" Build. return; } + if (!project->isActiveConfig("build_all")) { + // Only complain if we're about to build all configurations. + return; + } using TargetInfo = std::pair<Build *, ProString>; QVector<TargetInfo> targets; const int last = makefiles.count() - 1; diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp index c43f6b4e4a..613c97fb85 100644 --- a/qmake/generators/projectgenerator.cpp +++ b/qmake/generators/projectgenerator.cpp @@ -36,7 +36,7 @@ QT_BEGIN_NAMESPACE -QString project_builtin_regx() //calculate the builtin regular expression.. +static QString project_builtin_regx() //calculate the builtin regular expression.. { QString ret; QStringList builtin_exts; diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 664c81296c..f4bc0e47ea 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -433,12 +433,9 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) QMakeLocalFileName f(opt.mid(2)); if (!frameworkdirs.contains(f)) frameworkdirs.insert(fwidx++, f); - } else if (target_mode == TARG_MAC_MODE && opt.startsWith("-framework")) { + } else if (target_mode == TARG_MAC_MODE && opt == "-framework") { if (linkPrl) { - if (opt.length() == 10) - opt = (*++it).toQString(); - else - opt = opt.mid(10).trimmed(); + opt = (*++it).toQString(); static const QChar suffixMarker = ','; const int suffixPosition = opt.indexOf(suffixMarker); const bool hasSuffix = suffixPosition >= 0; @@ -448,15 +445,21 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) opt.remove(suffixMarker); // Apply suffix by removing marker } for (const QMakeLocalFileName &dir : qAsConst(frameworkdirs)) { + auto processPrlIfFound = [&](QString directory) { + QString suffixedPrl = directory + opt; + if (processPrlFile(suffixedPrl, true)) + return true; + if (hasSuffix) { + QString unsuffixedPrl = directory + frameworkName; + if (processPrlFile(unsuffixedPrl, true)) + return true; + } + return false; + }; QString frameworkDirectory = dir.local() + "/" + frameworkName + + ".framework/"; - QString suffixedPrl = frameworkDirectory + opt; - if (processPrlFile(suffixedPrl, true)) + if (processPrlIfFound(frameworkDirectory + "Resources/") + || processPrlIfFound(frameworkDirectory)) break; - if (hasSuffix) { - QString unsuffixedPrl = frameworkDirectory + frameworkName; - if (processPrlFile(unsuffixedPrl, true)) - break; - } } } else { if (opt.length() == 10) diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 8b4f2bf58f..79d19cae8c 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -1199,8 +1199,10 @@ void UnixMakefileGenerator::init2() project->values("QMAKE_FRAMEWORK_VERSION").append(project->first("VER_MAJ")); if (project->first("TEMPLATE") == "aux") { - project->values("PRL_TARGET") = - project->values("TARGET").first().prepend(project->first("QMAKE_PREFIX_STATICLIB")); + project->values("PRL_TARGET") = { + project->first("QMAKE_PREFIX_STATICLIB") + + project->first("TARGET") + }; } else if (!project->values("QMAKE_APP_FLAG").isEmpty()) { if(!project->isEmpty("QMAKE_BUNDLE")) { ProString bundle_loc = project->first("QMAKE_BUNDLE_LOCATION"); @@ -1228,8 +1230,9 @@ void UnixMakefileGenerator::init2() else ar_cmd.append("$(AR) $(TARGETA) $(OBJECTS)"); if (!project->isEmpty("QMAKE_BUNDLE")) { - project->values("PRL_TARGET").prepend( - project->first("QMAKE_BUNDLE") + Option::dir_sep + project->first("TARGET")); + project->values("PRL_TARGET").prepend(project->first("QMAKE_BUNDLE") + + "/Versions/" + project->first("QMAKE_FRAMEWORK_VERSION") + + "/Resources/" + project->first("TARGET")); ProString bundle_loc = project->first("QMAKE_BUNDLE_LOCATION"); if(!bundle_loc.isEmpty() && !bundle_loc.startsWith("/")) bundle_loc.prepend("/"); diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 67b478ae28..2fb24201bd 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -272,10 +272,6 @@ void NmakeMakefileGenerator::init() if (project->isActiveConfig("debug")) { project->values("QMAKE_CLEAN").append(targetBase + ".ilk"); project->values("QMAKE_CLEAN").append(targetBase + ".idb"); - } else { - ProStringList &defines = project->values("DEFINES"); - if (!defines.contains("NDEBUG")) - defines.append("NDEBUG"); } if (project->values("QMAKE_APP_FLAG").isEmpty() && project->isActiveConfig("dll")) { diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index b6fe683d2c..5396eba72e 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -1568,21 +1568,12 @@ bool VCLinkerTool::parseOption(const char* option) const char* str = option+6; if (*str == 'S') ShowProgress = linkProgressAll; -#ifndef Q_OS_WIN - else if (strncasecmp(str, "pginstrument", 12)) + else if (qstricmp(str, "pginstrument") == 0) LinkTimeCodeGeneration = optLTCGInstrument; - else if (strncasecmp(str, "pgoptimize", 10)) + else if (qstricmp(str, "pgoptimize") == 0) LinkTimeCodeGeneration = optLTCGOptimize; - else if (strncasecmp(str, "pgupdate", 8 )) + else if (qstricmp(str, "pgupdate") == 0) LinkTimeCodeGeneration = optLTCGUpdate; -#else - else if (_stricmp(str, "pginstrument")) - LinkTimeCodeGeneration = optLTCGInstrument; - else if (_stricmp(str, "pgoptimize")) - LinkTimeCodeGeneration = optLTCGOptimize; - else if (_stricmp(str, "pgupdate")) - LinkTimeCodeGeneration = optLTCGUpdate; -#endif } } else { AdditionalOptions.append(option); @@ -2135,7 +2126,6 @@ VCResourceCompilerTool::VCResourceCompilerTool() ShowProgress(linkProgressNotSet), SuppressStartupBanner(unset) { - PreprocessorDefinitions = QStringList("NDEBUG"); } // VCDeploymentTool -------------------------------------------- diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index b74448ce94..e45beca459 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1050,9 +1050,6 @@ void VcprojGenerator::initConfiguration() initDeploymentTool(); initWinDeployQtTool(); initPreLinkEventTools(); - - if (!isDebug) - conf.compiler.PreprocessorDefinitions += "NDEBUG"; } void VcprojGenerator::initCompilerTool() diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 27d2a7c0a5..86d10c213c 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -38,6 +38,8 @@ #include <qdir.h> #include <stdlib.h> +#include <algorithm> + QT_BEGIN_NAMESPACE ProString Win32MakefileGenerator::fixLibFlag(const ProString &lib) @@ -73,16 +75,37 @@ Win32MakefileGenerator::parseLibFlag(const ProString &flag, ProString *arg) return LibFlagFile; } +class LibrarySearchPath : public QMakeLocalFileName +{ +public: + LibrarySearchPath() = default; + + LibrarySearchPath(const QString &s) + : QMakeLocalFileName(s) + { + } + + LibrarySearchPath(QString &&s, bool isDefault = false) + : QMakeLocalFileName(std::move(s)), _default(isDefault) + { + } + + bool isDefault() const { return _default; } + +private: + bool _default = false; +}; + bool Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) { ProStringList impexts = project->values("QMAKE_LIB_EXTENSIONS"); if (impexts.isEmpty()) impexts = project->values("QMAKE_EXTENSION_STATICLIB"); - QVector<QMakeLocalFileName> dirs; + QVector<LibrarySearchPath> dirs; int libidx = 0; for (const ProString &dlib : project->values("QMAKE_DEFAULT_LIBDIRS")) - dirs.append(QMakeLocalFileName(dlib.toQString())); + dirs.append(LibrarySearchPath(dlib.toQString(), true)); static const char * const lflags[] = { "LIBS", "LIBS_PRIVATE", "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr }; for (int i = 0; lflags[i]; i++) { @@ -92,12 +115,20 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) ProString arg; LibFlagType type = parseLibFlag(opt, &arg); if (type == LibFlagPath) { - QMakeLocalFileName lp(arg.toQString()); - int idx = dirs.indexOf(lp); + const QString argqstr = arg.toQString(); + auto dit = std::find_if(dirs.cbegin(), dirs.cend(), + [&argqstr](const LibrarySearchPath &p) + { + return p.real() == argqstr; + }); + int idx = dit == dirs.cend() + ? -1 + : std::distance(dirs.cbegin(), dit); if (idx >= 0 && idx < libidx) { it = l.erase(it); continue; } + const LibrarySearchPath lp(argqstr); dirs.insert(libidx++, lp); (*it) = "-L" + lp.real(); } else if (type == LibFlagLib) { @@ -114,7 +145,8 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) for (ProStringList::ConstIterator extit = impexts.cbegin(); extit != impexts.cend(); ++extit) { if (exists(libBase + '.' + *extit)) { - (*it) = cand + verovr + '.' + *extit; + *it = (dir_it->isDefault() ? lib : cand) + + verovr + '.' + *extit; goto found; } } diff --git a/qmake/main.cpp b/qmake/main.cpp index a598296898..dd1cca9633 100644 --- a/qmake/main.cpp +++ b/qmake/main.cpp @@ -242,6 +242,39 @@ static int doLink(int argc, char **argv) #endif +static bool setFilePermissions(QFile &file, QFileDevice::Permissions permissions) +{ + if (file.setPermissions(permissions)) + return true; + fprintf(stderr, "Error setting permissions on %s: %s\n", + qPrintable(file.fileName()), qPrintable(file.errorString())); + return false; +} + +static bool copyFileTimes(QFile &targetFile, const QString &sourceFilePath, + bool mustEnsureWritability, QString *errorString) +{ +#ifdef Q_OS_WIN + bool mustRestorePermissions = false; + QFileDevice::Permissions targetPermissions; + if (mustEnsureWritability) { + targetPermissions = targetFile.permissions(); + if (!targetPermissions.testFlag(QFileDevice::WriteUser)) { + mustRestorePermissions = true; + if (!setFilePermissions(targetFile, targetPermissions | QFileDevice::WriteUser)) + return false; + } + } +#endif + if (!IoUtils::touchFile(targetFile.fileName(), sourceFilePath, errorString)) + return false; +#ifdef Q_OS_WIN + if (mustRestorePermissions && !setFilePermissions(targetFile, targetPermissions)) + return false; +#endif + return true; +} + static int installFile(const QString &source, const QString &target, bool exe = false, bool preservePermissions = false) { @@ -270,18 +303,15 @@ static int installFile(const QString &source, const QString &target, bool exe = targetPermissions |= QFileDevice::ExeOwner | QFileDevice::ExeUser | QFileDevice::ExeGroup | QFileDevice::ExeOther; } - if (!targetFile.setPermissions(targetPermissions)) { - fprintf(stderr, "Error setting permissions on %s: %s\n", - qPrintable(target), qPrintable(targetFile.errorString())); + if (!setFilePermissions(targetFile, targetPermissions)) return 3; - } - // Copy file times QString error; - if (!IoUtils::touchFile(target, sourceFile.fileName(), &error)) { + if (!copyFileTimes(targetFile, sourceFile.fileName(), preservePermissions, &error)) { fprintf(stderr, "%s", qPrintable(error)); return 3; } + return 0; } diff --git a/qmake/option.cpp b/qmake/option.cpp index 1e31ecd6b7..9ec2fe6411 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -121,7 +121,6 @@ static QString detectProjectFile(const QString &path) return ret; } -QString project_builtin_regx(); bool usage(const char *a0) { fprintf(stdout, "Usage: %s [mode] [options] [files]\n" @@ -133,9 +132,9 @@ bool usage(const char *a0) "\n" "Mode:\n" " -project Put qmake into project file generation mode%s\n" - " In this mode qmake interprets files as files to\n" - " be built,\n" - " defaults to %s\n" + " In this mode qmake interprets [files] as files to\n" + " be added to the .pro file. By default, all files with\n" + " known source extensions are added.\n" " Note: The created .pro file probably will \n" " need to be edited. For example add the QT variable to \n" " specify what modules are required.\n" @@ -183,7 +182,7 @@ bool usage(const char *a0) " -nomoc Don't generate moc targets [makefile mode only]\n" " -nopwd Don't look for files in pwd [project mode only]\n" ,a0, - default_mode(a0) == Option::QMAKE_GENERATE_PROJECT ? " (default)" : "", project_builtin_regx().toLatin1().constData(), + default_mode(a0) == Option::QMAKE_GENERATE_PROJECT ? " (default)" : "", default_mode(a0) == Option::QMAKE_GENERATE_MAKEFILE ? " (default)" : "" ); return false; @@ -659,4 +658,9 @@ QString qmake_libraryInfoFile() return QString(); } +QString qmake_abslocation() +{ + return Option::globals->qmake_abslocation; +} + QT_END_NAMESPACE diff --git a/qmake/property.cpp b/qmake/property.cpp index 432ff55664..31d6cdc9d6 100644 --- a/qmake/property.cpp +++ b/qmake/property.cpp @@ -54,7 +54,6 @@ static const struct { { "QT_INSTALL_BINS", QLibraryInfo::BinariesPath, false, false }, { "QT_INSTALL_TESTS", QLibraryInfo::TestsPath, false, false }, { "QT_INSTALL_PLUGINS", QLibraryInfo::PluginsPath, false, false }, - { "QT_INSTALL_IMPORTS", QLibraryInfo::ImportsPath, false, false }, { "QT_INSTALL_QML", QLibraryInfo::Qml2ImportsPath, false, false }, { "QT_INSTALL_TRANSLATIONS", QLibraryInfo::TranslationsPath, false, false }, { "QT_INSTALL_CONFIGURATION", QLibraryInfo::SettingsPath, false, false }, |