diff options
Diffstat (limited to 'qmake/generators/win32')
-rw-r--r-- | qmake/generators/win32/cesdkhandler.cpp | 14 | ||||
-rw-r--r-- | qmake/generators/win32/cesdkhandler.h | 14 | ||||
-rw-r--r-- | qmake/generators/win32/mingw_make.cpp | 108 | ||||
-rw-r--r-- | qmake/generators/win32/mingw_make.h | 19 | ||||
-rw-r--r-- | qmake/generators/win32/msbuild_objectmodel.cpp | 72 | ||||
-rw-r--r-- | qmake/generators/win32/msbuild_objectmodel.h | 14 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_nmake.cpp | 173 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_nmake.h | 16 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.cpp | 56 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.h | 17 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.cpp | 270 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.h | 27 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcxproj.cpp | 14 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcxproj.h | 14 | ||||
-rw-r--r-- | qmake/generators/win32/winmakefile.cpp | 227 | ||||
-rw-r--r-- | qmake/generators/win32/winmakefile.h | 17 |
16 files changed, 485 insertions, 587 deletions
diff --git a/qmake/generators/win32/cesdkhandler.cpp b/qmake/generators/win32/cesdkhandler.cpp index f2e6758704..3afed2b8c1 100644 --- a/qmake/generators/win32/cesdkhandler.cpp +++ b/qmake/generators/win32/cesdkhandler.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/qmake/generators/win32/cesdkhandler.h b/qmake/generators/win32/cesdkhandler.h index d3894087b2..42c0121720 100644 --- a/qmake/generators/win32/cesdkhandler.h +++ b/qmake/generators/win32/cesdkhandler.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index f2d6678cdf..c19e17bc0e 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the qmake application of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -44,19 +44,14 @@ QT_BEGIN_NAMESPACE -MingwMakefileGenerator::MingwMakefileGenerator() : Win32MakefileGenerator(), init_flag(false) +MingwMakefileGenerator::MingwMakefileGenerator() : Win32MakefileGenerator() { - if (isWindowsShell()) - quote = "\""; - else - quote = "'"; } QString MingwMakefileGenerator::escapeDependencyPath(const QString &path) const { QString ret = path; - ret.remove('\"'); - ret.replace('\\', "/"); + ret.replace('\\', "/"); // ### this shouldn't be here ret.replace(' ', "\\ "); return ret; } @@ -66,6 +61,18 @@ QString MingwMakefileGenerator::getLibTarget() return QString("lib" + project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".a"); } +QString MingwMakefileGenerator::getManifestFileForRcFile() const +{ + return project->first("QMAKE_MANIFEST").toQString(); +} + +ProString MingwMakefileGenerator::fixLibFlag(const ProString &lib) +{ + if (lib.startsWith("lib")) + return QStringLiteral("-l") + escapeFilePath(lib.mid(3)); + return escapeFilePath(lib); +} + bool MingwMakefileGenerator::findLibraries() { QList<QMakeLocalFileName> dirs; @@ -84,9 +91,9 @@ bool MingwMakefileGenerator::findLibraries() if (ver > 0) extension += QString::number(ver); extension += suffix; - if(QMakeMetaInfo::libExists((*dir_it).local() + Option::dir_sep + steam) || - exists((*dir_it).local() + Option::dir_sep + steam + extension + ".a") || - exists((*dir_it).local() + Option::dir_sep + steam + extension + ".dll.a")) { + if (QMakeMetaInfo::libExists((*dir_it).local() + '/' + steam) + || exists((*dir_it).local() + '/' + steam + extension + ".a") + || exists((*dir_it).local() + '/' + steam + extension + ".dll.a")) { out = *it + extension; break; } @@ -94,7 +101,9 @@ bool MingwMakefileGenerator::findLibraries() if (!out.isEmpty()) // We assume if it never finds it that its correct (*it) = out; } else if ((*it).startsWith("-L")) { - dirs.append(QMakeLocalFileName((*it).mid(2).toQString())); + QMakeLocalFileName f((*it).mid(2).toQString()); + dirs.append(f); + *it = "-L" + f.real(); } ++it; @@ -119,7 +128,7 @@ bool MingwMakefileGenerator::writeMakefile(QTextStream &t) t << "QMAKE = " << var("QMAKE_QMAKE") << endl; const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) - t << *it << " "; + t << escapeDependencyPath(*it) << ' '; t << "first all clean install distclean uninstall: qmake\n" << "qmake_all:\n"; writeMakeQmake(t); @@ -145,6 +154,7 @@ void createLdObjectScriptFile(const QString &fileName, const ProStringList &objL t << "INPUT(\n"; for (ProStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) { QString path = (*it).toQString(); + // ### quoting? if (QDir::isRelativePath(path)) t << "./" << path << endl; else @@ -162,6 +172,7 @@ void createArObjectScriptFile(const QString &fileName, const QString &target, co QFile file(filePath); if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream t(&file); + // ### quoting? t << "CREATE " << target << endl; for (ProStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) { t << "ADDMOD " << *it << endl; @@ -180,6 +191,7 @@ void createRvctObjectScriptFile(const QString &fileName, const ProStringList &ob QTextStream t(&file); for (ProStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) { QString path = (*it).toQString(); + // ### quoting? if (QDir::isRelativePath(path)) t << "./" << path << endl; else @@ -200,23 +212,19 @@ void MingwMakefileGenerator::writeMingwParts(QTextStream &t) t << escapeDependencyPath(cHeader) << ": " << escapeDependencyPath(header) << " " << escapeDependencyPaths(findDependencies(header)).join(" \\\n\t\t") << "\n\t" << mkdir_p_asstring(preCompHeaderOut) - << "\n\t$(CC) -x c-header -c $(CFLAGS) $(INCPATH) -o " << cHeader << " " << header - << endl << endl; + << "\n\t$(CC) -x c-header -c $(CFLAGS) $(INCPATH) -o " << escapeFilePath(cHeader) + << ' ' << escapeFilePath(header) << endl << endl; QString cppHeader = preCompHeaderOut + Option::dir_sep + "c++"; t << escapeDependencyPath(cppHeader) << ": " << escapeDependencyPath(header) << " " << escapeDependencyPaths(findDependencies(header)).join(" \\\n\t\t") << "\n\t" << mkdir_p_asstring(preCompHeaderOut) - << "\n\t$(CXX) -x c++-header -c $(CXXFLAGS) $(INCPATH) -o " << cppHeader << " " << header - << endl << endl; + << "\n\t$(CXX) -x c++-header -c $(CXXFLAGS) $(INCPATH) -o " << escapeFilePath(cppHeader) + << ' ' << escapeFilePath(header) << endl << endl; } } void MingwMakefileGenerator::init() { - if(init_flag) - return; - init_flag = true; - /* this should probably not be here, but I'm using it to wrap the .t files */ if(project->first("TEMPLATE") == "app") project->values("QMAKE_APP_FLAG").append("1"); @@ -224,16 +232,6 @@ void MingwMakefileGenerator::init() project->values("QMAKE_LIB_FLAG").append("1"); else if(project->first("TEMPLATE") == "subdirs") { MakefileGenerator::init(); - if(project->isEmpty("QMAKE_COPY_FILE")) - project->values("QMAKE_COPY_FILE").append("$(COPY)"); - if(project->isEmpty("QMAKE_COPY_DIR")) - project->values("QMAKE_COPY_DIR").append("xcopy /s /q /y /i"); - if(project->isEmpty("QMAKE_INSTALL_FILE")) - project->values("QMAKE_INSTALL_FILE").append("$(COPY_FILE)"); - if(project->isEmpty("QMAKE_INSTALL_PROGRAM")) - project->values("QMAKE_INSTALL_PROGRAM").append("$(COPY_FILE)"); - if(project->isEmpty("QMAKE_INSTALL_DIR")) - project->values("QMAKE_INSTALL_DIR").append("$(COPY_DIR)"); if(project->values("MAKEFILE").isEmpty()) project->values("MAKEFILE").append("Makefile"); return; @@ -245,15 +243,7 @@ void MingwMakefileGenerator::init() processVars(); - if (!project->values("RES_FILE").isEmpty()) { - project->values("QMAKE_LIBS") += escapeFilePaths(project->values("RES_FILE")); - } - - ProStringList &configs = project->values("CONFIG"); - - if(project->isActiveConfig("qt_dll")) - if(configs.indexOf("qt") == -1) - configs.append("qt"); + project->values("QMAKE_LIBS") += project->values("RES_FILE"); if (project->isActiveConfig("dll")) { QString destDir = ""; @@ -261,7 +251,7 @@ void MingwMakefileGenerator::init() destDir = Option::fixPathToTargetOS(project->first("DESTDIR") + Option::dir_sep, false, false); project->values("MINGW_IMPORT_LIB").prepend(destDir + "lib" + project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".a"); - project->values("QMAKE_LFLAGS").append(QString("-Wl,--out-implib,") + project->first("MINGW_IMPORT_LIB")); + project->values("QMAKE_LFLAGS").append(QString("-Wl,--out-implib,") + fileVar("MINGW_IMPORT_LIB")); } if (!project->values("DEF_FILE").isEmpty()) { @@ -283,6 +273,7 @@ void MingwMakefileGenerator::init() project->values("QMAKE_CLEAN").append(preCompHeaderOut + Option::dir_sep + "c"); project->values("QMAKE_CLEAN").append(preCompHeaderOut + Option::dir_sep + "c++"); + preCompHeader = escapeFilePath(preCompHeader); project->values("QMAKE_RUN_CC").clear(); project->values("QMAKE_RUN_CC").append("$(CC) -c -include " + preCompHeader + " $(CFLAGS) $(INCPATH) " + var("QMAKE_CC_O_FLAG") + "$obj $src"); @@ -311,13 +302,12 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t) for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) { QString inc = (*incit).toQString(); inc.replace(QRegExp("\\\\$"), ""); - inc.replace(QRegExp("\""), ""); if (!isystem.isEmpty() && isSystemInclude(inc)) t << isystem << ' '; else t << "-I"; - t << quote << inc << quote << " "; + t << escapeFilePath(inc) << ' '; } t << endl; } @@ -330,8 +320,8 @@ void MingwMakefileGenerator::writeLibsPart(QTextStream &t) t << "LINKER = " << var("QMAKE_LINK") << endl; t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; t << "LIBS = " - << var("QMAKE_LIBS").replace(QRegExp("(\\slib|^lib)")," -l") << ' ' - << var("QMAKE_LIBS_PRIVATE").replace(QRegExp("(\\slib|^lib)")," -l") << endl; + << fixLibFlags("QMAKE_LIBS").join(' ') << ' ' + << fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << endl; } } @@ -350,7 +340,7 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t) QString ar_cmd = project->values("QMAKE_LIB").join(' '); if (ar_cmd.isEmpty()) ar_cmd = "armar --create"; - objectsLinkLine = ar_cmd + " " + var("DEST_TARGET") + " --via " + escapeFilePath(ar_script_file); + objectsLinkLine = ar_cmd + ' ' + fileVar("DEST_TARGET") + " --via " + escapeFilePath(ar_script_file); } else { // Strip off any options since the ar commands will be read from file. QString ar_cmd = var("QMAKE_LIB").section(" ", 0, 0);; @@ -378,8 +368,9 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t) void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t) { t << "first: all\n"; - t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS"))," "," "," ") << " $(DESTDIR_TARGET)\n\n"; - t << "$(DESTDIR_TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) " << var("POST_TARGETDEPS"); + t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) + << ' ' << depVar("ALL_DEPS") << " $(DESTDIR_TARGET)\n\n"; + t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS"); if(!project->isEmpty("QMAKE_PRE_LINK")) t << "\n\t" <<var("QMAKE_PRE_LINK"); if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { @@ -414,8 +405,8 @@ void MingwMakefileGenerator::writeRcFilePart(QTextStream &t) } if (!rc_file.isEmpty()) { - t << escapeDependencyPath(var("RES_FILE")) << ": " << rc_file << "\n\t" - << var("QMAKE_RC") << " -i " << rc_file << " -o " << var("RES_FILE") + t << escapeDependencyPath(var("RES_FILE")) << ": " << escapeDependencyPath(rc_file) << "\n\t" + << var("QMAKE_RC") << " -i " << escapeFilePath(rc_file) << " -o " << fileVar("RES_FILE") << incPathStr << " $(DEFINES)\n\n"; } } @@ -423,10 +414,7 @@ void MingwMakefileGenerator::writeRcFilePart(QTextStream &t) QStringList &MingwMakefileGenerator::findDependencies(const QString &file) { QStringList &aList = MakefileGenerator::findDependencies(file); - // Note: The QMAKE_IMAGE_COLLECTION file have all images - // as dependency, so don't add precompiled header then - if (file == project->first("QMAKE_IMAGE_COLLECTION") - || preCompHeaderOut.isEmpty()) + if (preCompHeaderOut.isEmpty()) return aList; for (QStringList::Iterator it = Option::c_ext.begin(); it != Option::c_ext.end(); ++it) { if (file.endsWith(*it)) { diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h index 2442ea852b..e76391080c 100644 --- a/qmake/generators/win32/mingw_make.h +++ b/qmake/generators/win32/mingw_make.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the qmake application of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -45,7 +45,10 @@ public: ~MingwMakefileGenerator(); protected: QString escapeDependencyPath(const QString &path) const; + ProString escapeDependencyPath(const ProString &path) const { return MakefileGenerator::escapeDependencyPath(path); } + virtual ProString fixLibFlag(const ProString &lib); QString getLibTarget(); + virtual QString getManifestFileForRcFile() const; bool writeMakefile(QTextStream &); void init(); private: @@ -62,9 +65,7 @@ private: virtual bool findLibraries(); - bool init_flag; QString objectsLinkLine; - QString quote; }; inline MingwMakefileGenerator::~MingwMakefileGenerator() diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index 2f98eae075..6c2d2c6206 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the qmake application of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -571,6 +571,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) addFilters(tempProj, xmlFilter, "Source Files"); addFilters(tempProj, xmlFilter, "Translation Files"); addFilters(tempProj, xmlFilter, "Deployment Files"); + addFilters(tempProj, xmlFilter, "Distribution Files"); for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) addFilters(tempProj, xmlFilter, tempProj.ExtraCompilers.at(x)); @@ -585,6 +586,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) outputFilter(tempProj, xml, xmlFilter, "Form Files"); outputFilter(tempProj, xml, xmlFilter, "Resource Files"); outputFilter(tempProj, xml, xmlFilter, "Deployment Files"); + outputFilter(tempProj, xml, xmlFilter, "Distribution Files"); for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) { outputFilter(tempProj, xml, xmlFilter, tempProj.ExtraCompilers.at(x)); @@ -616,7 +618,6 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) bool isWinRT = false; bool isWinPhone = false; - bool isWinPhone80 = false; // ### Windows Phone 8.0, remove in Qt 5.4 for (int i = 0; i < tool.SingleProjects.count(); ++i) { xml << tag("ProjectConfiguration") << attrTag("Include" , tool.SingleProjects.at(i).Configuration.Name) @@ -625,7 +626,6 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) << closetag(); isWinRT = isWinRT || tool.SingleProjects.at(i).Configuration.WinRT; isWinPhone = isWinPhone = tool.SingleProjects.at(i).Configuration.WinPhone; - isWinPhone80 = isWinPhone80 || tool.SingleProjects.at(i).Configuration.WinPhone80; } xml << closetag() @@ -637,18 +637,10 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) if (isWinRT) { xml << tagValue("MinimumVisualStudioVersion", tool.Version) - << tagValue("DefaultLanguage", "en"); - if (isWinPhone80) { - xml << tagValue("WinMDAssembly", "true"); - if (tool.SingleProjects.at(0).Configuration.ConfigurationType == typeApplication) { - xml << tagValue("XapOutputs", "true"); - xml << tagValue("XapFilename", "$(RootNamespace)_$(Configuration)_$(Platform).xap"); - } - } else { - xml << tagValue("AppContainerApplication", "true") - << tagValue("ApplicationType", isWinPhone ? "Windows Phone" : "Windows Store") - << tagValue("ApplicationTypeRevision", tool.SdkVersion); - } + << tagValue("DefaultLanguage", "en") + << tagValue("AppContainerApplication", "true") + << tagValue("ApplicationType", isWinPhone ? "Windows Phone" : "Windows Store") + << tagValue("ApplicationTypeRevision", tool.SdkVersion); } xml << closetag(); @@ -814,6 +806,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) addFilters(tool, xmlFilter, "Source Files"); addFilters(tool, xmlFilter, "Translation Files"); addFilters(tool, xmlFilter, "Deployment Files"); + addFilters(tool, xmlFilter, "Distribution Files"); for (int x = 0; x < tool.ExtraCompilers.count(); ++x) addFilters(tool, xmlFilter, tool.ExtraCompilers.at(x)); @@ -828,24 +821,15 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) outputFilter(tool, xml, xmlFilter, "Form Files"); outputFilter(tool, xml, xmlFilter, "Resource Files"); outputFilter(tool, xml, xmlFilter, "Deployment Files"); + outputFilter(tool, xml, xmlFilter, "Distribution Files"); for (int x = 0; x < tool.ExtraCompilers.count(); ++x) { outputFilter(tool, xml, xmlFilter, tool.ExtraCompilers.at(x)); } outputFilter(tool, xml, xmlFilter, "Root Files"); - if (isWinPhone80) { - xml << tag("ItemGroup") - << tag("Reference") - << attrTag("Include", "platform") - << attrTagS("IsWinMDFile", "true") - << attrTagS("Private", "false") - << closetag() - << closetag(); - } - // App manifest if (isWinRT) { - QString manifest = isWinPhone80 ? QStringLiteral("WMAppManifest.xml") : QStringLiteral("Package.appxmanifest"); + const QString manifest = QStringLiteral("Package.appxmanifest"); // Find all icons referenced in the manifest QSet<QString> icons; @@ -866,7 +850,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) // Write out manifest + icons as content items xml << tag(_ItemGroup) - << tag(isWinPhone80 ? "Xml" : "AppxManifest") + << tag("AppxManifest") << attrTag("Include", manifest) << closetag(); foreach (const QString &icon, icons) { @@ -877,12 +861,8 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) xml << closetag(); } - xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets"); - - if (isWinPhone80) - xml << import("Project", "$(MSBuildExtensionsPath)\\Microsoft\\WindowsPhone\\v8.0\\Microsoft.Cpp.WindowsPhone.8.0.targets"); - - xml << tag("ImportGroup") + xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets") + << tag("ImportGroup") << attrTag("Label", "ExtensionTargets") << closetag(); } @@ -1935,11 +1915,11 @@ bool VCXProjectWriter::outputFileConfig(OutputFilterData *d, XmlOutput &xml, Xml fileAdded = true; xmlFilter << tag("CustomBuild") - << attrTag("Include",Option::fixPathToLocalOS(filename)) + << attrTag("Include", Option::fixPathToTargetOS(filename)) << attrTagS("Filter", fullFilterName); xml << tag("CustomBuild") - << attrTag("Include",Option::fixPathToLocalOS(filename)); + << attrTag("Include", Option::fixPathToTargetOS(filename)); if (filter.Name.startsWith("Form Files") || filter.Name.startsWith("Generated Files") @@ -1979,11 +1959,13 @@ bool VCXProjectWriter::outputFileConfig(OutputFilterData *d, XmlOutput &xml, Xml } if ( !filter.CompilerTool.PrecompiledHeaderThrough.isEmpty() ) { - xml << tag("PrecompiledHeaderFile") << attrTag("Condition", condition) - << valueTag(filter.CompilerTool.PrecompiledHeaderThrough) - << tag("PrecompiledHeader") + << valueTag(filter.CompilerTool.PrecompiledHeaderThrough); + } + + if (filter.CompilerTool.UsePrecompiledHeader != pchUnset) { + xml << tag("PrecompiledHeader") << attrTag("Condition", condition) << valueTag(toString(filter.CompilerTool.UsePrecompiledHeader)); } @@ -1996,7 +1978,7 @@ bool VCXProjectWriter::outputFileConfig(OutputFilterData *d, XmlOutput &xml, Xml void VCXProjectWriter::outputFileConfig(XmlOutput &xml, XmlOutput &xmlFilter, const QString &filePath, const QString &filterName) { - const QString nativeFilePath = Option::fixPathToLocalOS(filePath); + const QString nativeFilePath = Option::fixPathToTargetOS(filePath); if (filterName.startsWith("Source Files")) { xmlFilter << tag("ClCompile") << attrTag("Include", nativeFilePath) diff --git a/qmake/generators/win32/msbuild_objectmodel.h b/qmake/generators/win32/msbuild_objectmodel.h index 68ba0eea83..1b7ce2d716 100644 --- a/qmake/generators/win32/msbuild_objectmodel.h +++ b/qmake/generators/win32/msbuild_objectmodel.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the qmake application of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 758db337ea..740c8c4d13 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the qmake application of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -36,8 +36,9 @@ #include "cesdkhandler.h" #include <qregexp.h> -#include <qhash.h> #include <qdir.h> +#include <qdiriterator.h> +#include <qset.h> #include <windows/registry_p.h> @@ -55,7 +56,7 @@ static QString nmakePathList(const QStringList &list) .replace('#', QStringLiteral("^#")).replace('$', QStringLiteral("$$")); } -NmakeMakefileGenerator::NmakeMakefileGenerator() : Win32MakefileGenerator(), init_flag(false), usePCH(false) +NmakeMakefileGenerator::NmakeMakefileGenerator() : Win32MakefileGenerator(), usePCH(false) { } @@ -160,10 +161,7 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) QString windowsPath; if (isPhone) { - if (targetVer == "WP80") // ### Windows Phone 8.0, remove in Qt 5.4 - windowsPath = "Microsoft\\Microsoft SDKs\\WindowsPhone\\v"; - else - windowsPath = "Microsoft\\Microsoft SDKs\\WindowsPhoneApp\\v"; + windowsPath = "Microsoft\\Microsoft SDKs\\WindowsPhoneApp\\v"; } else { windowsPath = "Microsoft\\Microsoft SDKs\\Windows\\v"; } @@ -184,8 +182,6 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) QStringList binDirs; if (isPhone) { QString sdkDir = vcInstallDir; - if (targetVer == "WP80") - sdkDir += QStringLiteral("/WPSDK/") + targetVer; if (!QDir(sdkDir).exists()) { fprintf(stderr, "Failed to find the Windows Phone SDK in %s.\n" "Check that it is properly installed.\n", @@ -256,23 +252,21 @@ QString NmakeMakefileGenerator::defaultInstall(const QString &t) const QString root = "$(INSTALL_ROOT)"; ProStringList &uninst = project->values(ProKey(t + ".uninstall")); - QString targetdir = Option::fixPathToTargetOS(project->first(ProKey(t + ".path")).toQString(), false); - targetdir = fileFixify(targetdir, FileFixifyAbsolute); + QString targetdir = fileFixify(project->first(ProKey(t + ".path")).toQString(), FileFixifyAbsolute); if(targetdir.right(1) != Option::dir_sep) targetdir += Option::dir_sep; if (project->isActiveConfig("debug_info")) { if (t == "dlltarget" || project->values(ProKey(t + ".CONFIG")).indexOf("no_dll") == -1) { QString pdb_target = getPdbTarget(); - pdb_target.remove('"'); QString src_targ = (project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR")) + pdb_target; QString dst_targ = filePrefixRoot(root, fileFixify(targetdir + pdb_target, FileFixifyAbsolute)); if(!ret.isEmpty()) ret += "\n\t"; - ret += QString("-$(INSTALL_FILE)") + " \"" + src_targ + "\" \"" + dst_targ + "\""; + ret += QString("-$(INSTALL_FILE) ") + escapeFilePath(src_targ) + ' ' + escapeFilePath(dst_targ); if(!uninst.isEmpty()) uninst.append("\n\t"); - uninst.append("-$(DEL_FILE) \"" + dst_targ + "\""); + uninst.append("-$(DEL_FILE) " + escapeFilePath(dst_targ)); } } @@ -282,10 +276,6 @@ QString NmakeMakefileGenerator::defaultInstall(const QString &t) QStringList &NmakeMakefileGenerator::findDependencies(const QString &file) { QStringList &aList = MakefileGenerator::findDependencies(file); - // Note: The QMAKE_IMAGE_COLLECTION file have all images - // as dependency, so don't add precompiled header then - if (file == project->first("QMAKE_IMAGE_COLLECTION")) - return aList; for(QStringList::Iterator it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) { if(file.endsWith(*it)) { if(!precompObj.isEmpty() && !aList.contains(precompObj)) @@ -302,9 +292,12 @@ void NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) // precompiled header if(usePCH) { - QString precompRule = QString("-c -Yc -Fp%1 -Fo%2").arg(precompPch).arg(precompObj); - t << precompObj << ": " << precompH << " " << escapeDependencyPaths(findDependencies(precompH)).join(" \\\n\t\t") - << "\n\t$(CXX) " + precompRule +" $(CXXFLAGS) $(INCPATH) -TP " << precompH << endl << endl; + QString precompRule = QString("-c -Yc -Fp%1 -Fo%2") + .arg(escapeFilePath(precompPch), escapeFilePath(precompObj)); + t << escapeDependencyPath(precompObj) << ": " << escapeDependencyPath(precompH) << ' ' + << escapeDependencyPaths(findDependencies(precompH)).join(" \\\n\t\t") + << "\n\t$(CXX) " + precompRule +" $(CXXFLAGS) $(INCPATH) -TP " + << escapeFilePath(precompH) << endl << endl; } } @@ -315,10 +308,9 @@ QString NmakeMakefileGenerator::var(const ProKey &value) const || value == "QMAKE_RUN_CXX_IMP" || value == "QMAKE_RUN_CXX")) { QFileInfo precompHInfo(fileInfo(precompH)); + QString precompH_f = escapeFilePath(precompHInfo.fileName()); QString precompRule = QString("-c -FI%1 -Yu%2 -Fp%3") - .arg(precompHInfo.fileName()) - .arg(precompHInfo.fileName()) - .arg(precompPch); + .arg(precompH_f, precompH_f, escapeFilePath(precompPch)); QString p = MakefileGenerator::var(value); p.replace("-c", precompRule); // Cannot use -Gm with -FI & -Yu, as this gives an @@ -339,10 +331,6 @@ QString NmakeMakefileGenerator::var(const ProKey &value) const void NmakeMakefileGenerator::init() { - if(init_flag) - return; - init_flag = true; - /* this should probably not be here, but I'm using it to wrap the .t files */ if(project->first("TEMPLATE") == "app") project->values("QMAKE_APP_FLAG").append("1"); @@ -352,16 +340,6 @@ void NmakeMakefileGenerator::init() MakefileGenerator::init(); if(project->values("MAKEFILE").isEmpty()) project->values("MAKEFILE").append("Makefile"); - if(project->isEmpty("QMAKE_COPY_FILE")) - project->values("QMAKE_COPY_FILE").append("$(COPY)"); - if(project->isEmpty("QMAKE_COPY_DIR")) - project->values("QMAKE_COPY_DIR").append("xcopy /s /q /y /i"); - if(project->isEmpty("QMAKE_INSTALL_FILE")) - project->values("QMAKE_INSTALL_FILE").append("$(COPY_FILE)"); - if(project->isEmpty("QMAKE_INSTALL_PROGRAM")) - project->values("QMAKE_INSTALL_PROGRAM").append("$(COPY_FILE)"); - if(project->isEmpty("QMAKE_INSTALL_DIR")) - project->values("QMAKE_INSTALL_DIR").append("$(COPY_DIR)"); return; } @@ -369,9 +347,7 @@ void NmakeMakefileGenerator::init() processVars(); - if (!project->values("RES_FILE").isEmpty()) { - project->values("QMAKE_LIBS") += escapeFilePaths(project->values("RES_FILE")); - } + project->values("QMAKE_LIBS") += project->values("RES_FILE"); if (!project->values("DEF_FILE").isEmpty()) { QString defFileName = fileFixify(project->first("DEF_FILE").toQString()); @@ -412,6 +388,7 @@ void NmakeMakefileGenerator::init() ProString version = project->first("TARGET_VERSION_EXT"); if(project->isActiveConfig("shared")) { project->values("QMAKE_CLEAN").append(project->first("DESTDIR") + project->first("TARGET") + version + ".exp"); + project->values("QMAKE_DISTCLEAN").append(project->first("DESTDIR") + project->first("TARGET") + version + ".lib"); } if (project->isActiveConfig("debug_info")) { QString pdbfile = project->first("DESTDIR") + project->first("TARGET") + version + ".pdb"; @@ -430,6 +407,17 @@ void NmakeMakefileGenerator::init() } } +QStringList NmakeMakefileGenerator::sourceFilesForImplicitRulesFilter() +{ + QStringList filter; + const QChar wildcard = QLatin1Char('*'); + foreach (const QString &ext, Option::c_ext) + filter << wildcard + ext; + foreach (const QString &ext, Option::cpp_ext) + filter << wildcard + ext; + return filter; +} + void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) { t << ".SUFFIXES:"; @@ -439,20 +427,17 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) t << " " << (*cppit); t << endl << endl; - if(!project->isActiveConfig("no_batch")) { - // Batchmode doesn't use the non implicit rules QMAKE_RUN_CXX & QMAKE_RUN_CC - project->variables().remove("QMAKE_RUN_CXX"); - project->variables().remove("QMAKE_RUN_CC"); - - QHash<QString, void*> source_directories; - source_directories.insert(".", (void*)1); + bool useInferenceRules = !project->isActiveConfig("no_batch"); + QSet<QString> source_directories; + if (useInferenceRules) { + source_directories.insert("."); static const char * const directories[] = { "UI_SOURCES_DIR", "UI_DIR", 0 }; for (int y = 0; directories[y]; y++) { QString dirTemp = project->first(directories[y]).toQString(); if (dirTemp.endsWith("\\")) dirTemp.truncate(dirTemp.length()-1); if(!dirTemp.isEmpty()) - source_directories.insert(dirTemp, (void*)1); + source_directories.insert(dirTemp); } static const char * const srcs[] = { "SOURCES", "GENERATED_SOURCES", 0 }; for (int x = 0; srcs[x]; x++) { @@ -462,23 +447,59 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) if((*sit).indexOf(sep) == -1) sep = "/"; QString dir = (*sit).toQString().section(sep, 0, -2); - if(!dir.isEmpty() && !source_directories[dir]) - source_directories.insert(dir, (void*)1); + if (!dir.isEmpty()) + source_directories.insert(dir); } } - for(QHash<QString, void*>::Iterator it(source_directories.begin()); it != source_directories.end(); ++it) { - if(it.key().isEmpty()) + // nmake's inference rules might pick up the wrong files when encountering source files with + // the same name in different directories. In this situation, turn inference rules off. + QHash<QString, QString> fileNames; + bool duplicatesFound = false; + const QStringList sourceFilesFilter = sourceFilesForImplicitRulesFilter(); + QStringList fixifiedSourceDirs = fileFixify(source_directories.toList(), FileFixifyAbsolute); + fixifiedSourceDirs.removeDuplicates(); + foreach (const QString &sourceDir, fixifiedSourceDirs) { + QDirIterator dit(sourceDir, sourceFilesFilter, QDir::Files | QDir::NoDotAndDotDot); + while (dit.hasNext()) { + dit.next(); + QString &duplicate = fileNames[dit.fileName()]; + if (duplicate.isNull()) { + duplicate = dit.filePath(); + } else { + warn_msg(WarnLogic, "%s conflicts with %s", qPrintable(duplicate), + qPrintable(dit.filePath())); + duplicatesFound = true; + } + } + } + if (duplicatesFound) { + useInferenceRules = false; + warn_msg(WarnLogic, "Automatically turning off nmake's inference rules. (CONFIG += no_batch)"); + } + } + + if (useInferenceRules) { + // Batchmode doesn't use the non implicit rules QMAKE_RUN_CXX & QMAKE_RUN_CC + project->variables().remove("QMAKE_RUN_CXX"); + project->variables().remove("QMAKE_RUN_CC"); + + foreach (const QString &sourceDir, source_directories) { + if (sourceDir.isEmpty()) continue; QString objDir = var("OBJECTS_DIR"); if (objDir == ".\\") objDir = ""; for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) - t << "{" << it.key() << "}" << (*cppit) << "{" << objDir << "}" << Option::obj_ext << "::\n\t" - << var("QMAKE_RUN_CXX_IMP_BATCH").replace(QRegExp("\\$@"), var("OBJECTS_DIR")) << endl << "\t$<\n<<\n\n"; + t << '{' << escapeDependencyPath(sourceDir) << '}' << (*cppit) + << '{' << escapeDependencyPath(objDir) << '}' << Option::obj_ext << "::\n\t" + << var("QMAKE_RUN_CXX_IMP_BATCH").replace(QRegExp("\\$@"), fileVar("OBJECTS_DIR")) + << "\n\t$<\n<<\n\n"; for(QStringList::Iterator cit = Option::c_ext.begin(); cit != Option::c_ext.end(); ++cit) - t << "{" << it.key() << "}" << (*cit) << "{" << objDir << "}" << Option::obj_ext << "::\n\t" - << var("QMAKE_RUN_CC_IMP_BATCH").replace(QRegExp("\\$@"), var("OBJECTS_DIR")) << endl << "\t$<\n<<\n\n"; + t << '{' << escapeDependencyPath(sourceDir) << '}' << (*cit) + << '{' << escapeDependencyPath(objDir) << '}' << Option::obj_ext << "::\n\t" + << var("QMAKE_RUN_CC_IMP_BATCH").replace(QRegExp("\\$@"), fileVar("OBJECTS_DIR")) + << "\n\t$<\n<<\n\n"; } } else { for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) @@ -494,8 +515,9 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) const ProString templateName = project->first("TEMPLATE"); t << "first: all\n"; - t << "all: " << fileFixify(Option::output.fileName()) << " " << varGlue("ALL_DEPS"," "," "," ") << "$(DESTDIR_TARGET)\n\n"; - t << "$(DESTDIR_TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) " << var("POST_TARGETDEPS"); + t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) + << ' ' << depVar("ALL_DEPS") << " $(DESTDIR_TARGET)\n\n"; + t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS"); if(!project->isEmpty("QMAKE_PRE_LINK")) t << "\n\t" <<var("QMAKE_PRE_LINK"); @@ -519,12 +541,12 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) if (linkerSupportsEmbedding) { extraLFlags = "/MANIFEST:embed"; } else { - manifest = escapeFilePath(target + ".embed.manifest"); - extraLFlags += "/MANIFEST /MANIFESTFILE:" + manifest; + manifest = target + ".embed.manifest"; + extraLFlags += "/MANIFEST /MANIFESTFILE:" + escapeFilePath(manifest); project->values("QMAKE_CLEAN") << manifest; } } else { - manifest = escapeFilePath(fileFixify(manifest)); + manifest = fileFixify(manifest); } const QString resourceId = (templateName == "app") ? "1" : "2"; @@ -532,16 +554,19 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) if (incrementalLinking && !linkerSupportsEmbedding) { // Link a resource that contains the manifest without modifying the exe/dll after linking. - QString manifest_rc = escapeFilePath(target + "_manifest.rc"); - QString manifest_res = escapeFilePath(target + "_manifest.res"); - QString manifest_bak = escapeFilePath(target + "_manifest.bak"); + QString manifest_rc = target + "_manifest.rc"; + QString manifest_res = target + "_manifest.res"; project->values("QMAKE_CLEAN") << manifest_rc << manifest_res; + manifest_rc = escapeFilePath(manifest_rc); + manifest_res = escapeFilePath(manifest_res); t << "\n\techo " << resourceId << " /* CREATEPROCESS_MANIFEST_RESOURCE_ID */ 24 /* RT_MANIFEST */ " - << cQuoted(unescapeFilePath(manifest)) << ">" << manifest_rc; + << cQuoted(manifest) << '>' << manifest_rc; if (generateManifest) { + manifest = escapeFilePath(manifest); + QString manifest_bak = escapeFilePath(target + "_manifest.bak"); t << "\n\tif not exist $(DESTDIR_TARGET) if exist " << manifest << " del " << manifest; t << "\n\tif exist " << manifest << " copy /Y " << manifest << ' ' << manifest_bak; @@ -563,7 +588,7 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) t << "\n\t"; writeLinkCommand(t, extraLFlags); if (!linkerSupportsEmbedding) { - t << "\n\tmt.exe /nologo /manifest " << manifest + t << "\n\tmt.exe /nologo /manifest " << escapeFilePath(manifest) << " /outputresource:$(DESTDIR_TARGET);" << resourceId; } } @@ -576,7 +601,7 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) bool useSignature = !signature.isEmpty() && !project->isActiveConfig("staticlib") && !project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH"); if(useSignature) { - t << "\n\tsigntool sign /F " << signature << " $(DESTDIR_TARGET)"; + t << "\n\tsigntool sign /F " << escapeFilePath(signature) << " $(DESTDIR_TARGET)"; } if(!project->isEmpty("QMAKE_POST_LINK")) { t << "\n\t" << var("QMAKE_POST_LINK"); diff --git a/qmake/generators/win32/msvc_nmake.h b/qmake/generators/win32/msvc_nmake.h index 753223b98e..83ce96c8b7 100644 --- a/qmake/generators/win32/msvc_nmake.h +++ b/qmake/generators/win32/msvc_nmake.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the qmake application of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -40,7 +40,6 @@ QT_BEGIN_NAMESPACE class NmakeMakefileGenerator : public Win32MakefileGenerator { - bool init_flag; void writeNmakeParts(QTextStream &); bool writeMakefile(QTextStream &); void writeImplicitRulesPart(QTextStream &t); @@ -48,6 +47,7 @@ class NmakeMakefileGenerator : public Win32MakefileGenerator void writeLinkCommand(QTextStream &t, const QString &extraFlags = QString(), const QString &extraInlineFileContent = QString()); int msvcVersion() const; void init(); + static QStringList sourceFilesForImplicitRulesFilter(); protected: virtual void writeSubMakeCall(QTextStream &t, const QString &callPrefix, diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 74a0a20ea2..917f4467a0 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the qmake application of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -2137,7 +2137,6 @@ VCPreLinkEventTool::VCPreLinkEventTool() VCConfiguration::VCConfiguration() : WinRT(false), WinPhone(false), - WinPhone80(false), ATLMinimizesCRunTimeLibraryUsage(unset), BuildBrowserInformation(unset), CharacterSet(charSetNotSet), @@ -2237,7 +2236,8 @@ void VCFilter::modifyPCHstage(QString str) useCompilerTool = true; // Setup PCH options CompilerTool.UsePrecompiledHeader = (isCFile ? pchNone : pchCreateUsingSpecific); - CompilerTool.PrecompiledHeaderThrough = (isCPPFile ? Project->precompHFilename : QString("$(NOINHERIT)")); + if (isCFile) + CompilerTool.PrecompiledHeaderThrough = QLatin1String("$(NOINHERIT)"); CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)"); } @@ -2295,9 +2295,8 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) QString cmd, cmd_name, out; QStringList deps, inputs; // Variabel replacement of output name - out = Option::fixPathToTargetOS( - Project->replaceExtraCompilerVariables(tmp_out, inFile, QString()), - false); + out = Option::fixPathToTargetOS(Project->replaceExtraCompilerVariables( + tmp_out, inFile, QString(), MakefileGenerator::NoShell), false); // If file has built-in compiler, we've swapped the input and output of // the command, as we in Visual Studio cannot have a Custom Buildstep on @@ -2318,9 +2317,8 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) if (!tmp_dep_cmd.isEmpty()) { // Execute dependency command, and add every line as a dep char buff[256]; - QString dep_cmd = Project->replaceExtraCompilerVariables(tmp_dep_cmd, - Option::fixPathToLocalOS(inFile, true, false), - out); + QString dep_cmd = Project->replaceExtraCompilerVariables( + tmp_dep_cmd, inFile, out, MakefileGenerator::LocalShell); if(Project->canExecute(dep_cmd)) { dep_cmd.prepend(QLatin1String("cd ") + Project->escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) @@ -2347,8 +2345,9 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) } for (int i = 0; i < deps.count(); ++i) deps[i] = Option::fixPathToTargetOS( - Project->replaceExtraCompilerVariables(deps.at(i), inFile, out), - false).trimmed(); + Project->replaceExtraCompilerVariables( + deps.at(i), inFile, out, MakefileGenerator::NoShell), + false); // Command for file if (combined) { // Add dependencies for each file @@ -2364,28 +2363,27 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) deps = inputs + deps; // input files themselves too.. // Replace variables for command w/all input files - // ### join gives path issues with directories containing spaces! cmd = Project->replaceExtraCompilerVariables(tmp_cmd, - inputs.join(' '), - out); + inputs, + QStringList(out), + MakefileGenerator::TargetShell); } else { deps.prepend(inFile); // input file itself too.. cmd = Project->replaceExtraCompilerVariables(tmp_cmd, inFile, - out); + out, + MakefileGenerator::TargetShell); } // Name for command if (!tmp_cmd_name.isEmpty()) { - cmd_name = Project->replaceExtraCompilerVariables(tmp_cmd_name, inFile, out); + cmd_name = Project->replaceExtraCompilerVariables( + tmp_cmd_name, inFile, out, MakefileGenerator::NoShell); } else { int space = cmd.indexOf(' '); if (space != -1) cmd_name = cmd.left(space); else cmd_name = cmd; - if ((cmd_name[0] == '\'' || cmd_name[0] == '"') && - cmd_name[0] == cmd_name[cmd_name.length()-1]) - cmd_name = cmd_name.mid(1,cmd_name.length()-2); } // Fixify paths @@ -2451,6 +2449,8 @@ const VCFilter &VCProjectSingleConfig::filterByName(const QString &name) const return ResourceFiles; if (name == "Deployment Files") return DeploymentFiles; + if (name == "Distribution Files") + return DistributionFiles; return filterForExtraCompiler(name); } @@ -2533,6 +2533,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) outputFilter(tempProj, xml, "Form Files"); outputFilter(tempProj, xml, "Resource Files"); outputFilter(tempProj, xml, "Deployment Files"); + outputFilter(tempProj, xml, "Distribution Files"); QSet<QString> extraCompilersInProject; for (int i = 0; i < tool.ExtraCompilersFiles.count(); ++i) { @@ -2586,6 +2587,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProject &tool) outputFilter(tool, xml, "Form Files"); outputFilter(tool, xml, "Resource Files"); outputFilter(tool, xml, "Deployment Files"); + outputFilter(tool, xml, "Distribution Files"); for (int x = 0; x < tool.ExtraCompilers.count(); ++x) { outputFilter(tool, xml, tool.ExtraCompilers.at(x)); } @@ -2903,7 +2905,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCFilter &tool) for (int i = 0; i < tool.Files.count(); ++i) { const VCFilterFile &info = tool.Files.at(i); xml << tag(q_File) - << attrS(_RelativePath, Option::fixPathToLocalOS(info.file)) + << attrS(_RelativePath, Option::fixPathToTargetOS(info.file)) << data(); // In case no custom builds, to avoid "/>" endings outputFileConfig(tool, xml, tool.Files.at(i).file); xml << closetag(q_File); @@ -2962,7 +2964,7 @@ void VCProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, const QSt void VCProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, const VCFilterFile &info, const QString &filtername) { xml << tag(q_File) - << attrS(_RelativePath, Option::fixPathToLocalOS(info.file)); + << attrS(_RelativePath, Option::fixPathToTargetOS(info.file)); for (int i = 0; i < project.SingleProjects.count(); ++i) { VCFilter filter = project.SingleProjects.at(i).filterByName(filtername); if (filter.Config) // only if the filter is not empty diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index 4b70ca3d71..59136b16c8 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the qmake application of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -873,7 +873,7 @@ public: bool suppressUnknownOptionWarnings; DotNET CompilerVersion; - bool WinRT, WinPhone, WinPhone80; + bool WinRT, WinPhone; // Variables triState ATLMinimizesCRunTimeLibraryUsage; @@ -1010,6 +1010,7 @@ public: VCFilter FormFiles; VCFilter ResourceFiles; VCFilter DeploymentFiles; + VCFilter DistributionFiles; VCFilterList ExtraCompilersFiles; bool flat_files; diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index e3031d559c..4822bcf22a 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the qmake application of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -56,6 +56,7 @@ const char _GUIDTranslationFiles[] = "{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} const char _GUIDFormFiles[] = "{99349809-55BA-4b9d-BF79-8FDBB0286EB3}"; const char _GUIDExtraCompilerFiles[] = "{E0D8C965-CC5F-43d7-AD63-FAEF0BBC0F85}"; const char _GUIDDeploymentFiles[] = "{D9D6E243-F8AF-46E4-B9FD-80ECBC20BA3E}"; +const char _GUIDDistributionFiles[] = "{B83CAF91-C7BF-462F-B76C-EA11631F866C}"; QT_END_NAMESPACE #ifdef Q_OS_WIN32 @@ -208,7 +209,6 @@ const char _slnExtSections[] = "\n\tGlobalSection(ExtensibilityGlobals) = pos VcprojGenerator::VcprojGenerator() : Win32MakefileGenerator(), - init_flag(false), is64Bit(false), projectWriter(0) { @@ -325,7 +325,8 @@ QUuid VcprojGenerator::getProjectUUID(const QString &filename) // If none, create one based on the MD5 of absolute project path if(uuid.isNull() || !filename.isEmpty()) { - QString abspath = Option::fixPathToLocalOS(filename.isEmpty()?project->first("QMAKE_MAKEFILE").toQString():filename); + QString abspath = Option::fixPathToTargetOS( + filename.isEmpty() ? project->first("QMAKE_MAKEFILE").toQString() : filename); QByteArray digest = QCryptographicHash::hash(abspath.toUtf8(), QCryptographicHash::Sha1); memcpy((unsigned char*)(&uuid), digest.constData(), sizeof(QUuid)); validUUID = !uuid.isNull(); @@ -458,14 +459,14 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt while (collectedIt.hasNext()) { QPair<QString, ProStringList> subdir = collectedIt.next(); QString profile = subdir.first; - QFileInfo fi(fileInfo(Option::fixPathToLocalOS(profile, true))); + QFileInfo fi(fileInfo(Option::normalizePath(profile))); if (fi.exists()) { if (fi.isDir()) { if (!profile.endsWith(Option::dir_sep)) profile += Option::dir_sep; profile += fi.baseName() + Option::pro_ext; QString profileKey = fi.absoluteFilePath(); - fi = QFileInfo(fileInfo(Option::fixPathToLocalOS(profile, true))); + fi = QFileInfo(fileInfo(Option::normalizePath(profile))); if (!fi.exists()) continue; projLookup.insert(profileKey, fi.absoluteFilePath()); @@ -506,7 +507,7 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt Option::qmake_mode = old_mode; // We assume project filename is [QMAKE_PROJECT_NAME].vcproj - QString vcproj = unescapeFilePath(tmp_vcproj.project->first("QMAKE_PROJECT_NAME") + project->first("VCPROJ_EXTENSION")); + QString vcproj = tmp_vcproj.project->first("QMAKE_PROJECT_NAME") + project->first("VCPROJ_EXTENSION"); QString vcprojDir = qmake_getpwd(); // If file doesn't exsist, then maybe the users configuration @@ -536,7 +537,7 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt VcsolutionDepend *newDep = new VcsolutionDepend; newDep->vcprojFile = vcprojDir + Option::dir_sep + vcproj; - newDep->orig_target = unescapeFilePath(tmp_proj.first("QMAKE_ORIG_TARGET")).toQString(); + newDep->orig_target = tmp_proj.first("QMAKE_ORIG_TARGET").toQString(); newDep->target = tmp_proj.first("MSVCPROJ_TARGET").toQString().section(Option::dir_sep, -1); newDep->targetType = tmp_vcproj.projectTarget; newDep->uuid = tmp_proj.isEmpty("QMAKE_UUID") ? getProjectUUID(Option::fixPathToLocalOS(vcprojDir + QDir::separator() + vcproj)).toString().toUpper(): tmp_proj.first("QMAKE_UUID").toQString(); @@ -672,6 +673,7 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) // write out projects for (QList<VcsolutionDepend*>::Iterator it = solution_cleanup.begin(); it != solution_cleanup.end(); ++it) { + // ### quoting rules? t << _slnProjectBeg << _slnMSVCvcprojGUID << _slnProjectMid << "\"" << (*it)->orig_target << "\", \"" << (*it)->vcprojFile << "\", \"" << (*it)->uuid << "\""; @@ -767,9 +769,6 @@ bool VcprojGenerator::hasBuiltinCompiler(const QString &file) void VcprojGenerator::init() { - if (init_flag) - return; - init_flag = true; is64Bit = (project->first("QMAKE_TARGET.arch") == "x86_64"); projectWriter = createProjectWriter(); @@ -798,15 +797,53 @@ void VcprojGenerator::init() } MakefileGenerator::init(); - initOld(); // Currently calling old DSP code to set variables. CLEAN UP! + + // $$QMAKE.. -> $$MSVCPROJ.. ------------------------------------- + const ProStringList &incs = project->values("INCLUDEPATH"); + for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) { + QString inc = (*incit).toQString(); + project->values("MSVCPROJ_INCPATH").append("-I" + escapeFilePath(inc)); + } + + QString dest = Option::fixPathToTargetOS(project->first("TARGET").toQString()) + project->first("TARGET_EXT"); + project->values("MSVCPROJ_TARGET") = ProStringList(dest); + + // DLL COPY ------------------------------------------------------ + if (project->isActiveConfig("dll") && !project->values("DLLDESTDIR").isEmpty()) { + const ProStringList &dlldirs = project->values("DLLDESTDIR"); + QString copydll(""); + ProStringList::ConstIterator dlldir; + for (dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir) { + if (!copydll.isEmpty()) + copydll += " && "; + copydll += "copy \"$(TargetPath)\" " + escapeFilePath(*dlldir); + } + + QString deststr("Copy " + dest + " to "); + for (dlldir = dlldirs.begin(); dlldir != dlldirs.end();) { + deststr += *dlldir; + ++dlldir; + if (dlldir != dlldirs.end()) + deststr += ", "; + } + + project->values("MSVCPROJ_COPY_DLL").append(copydll); + project->values("MSVCPROJ_COPY_DLL_DESC").append(deststr); + } + +#if 0 + // Verbose output if "-d -d"... + qDebug("Generator: MSVC.NET: List of current variables:"); + for (ProValueMap::ConstIterator it = project->variables().begin(); it != project->variables().end(); ++it) + qDebug("Generator: MSVC.NET: %s => %s", qPrintable(it.key().toQString()), qPrintable(it.value().join(" | "))); +#endif // Figure out what we're trying to build if(project->first("TEMPLATE") == "vcapp") { projectTarget = Application; } else if(project->first("TEMPLATE") == "vclib") { if(project->isActiveConfig("staticlib")) { - if (!project->values("RES_FILE").isEmpty()) - project->values("QMAKE_LIBS") += escapeFilePaths(project->values("RES_FILE")); + project->values("QMAKE_LIBS") += project->values("RES_FILE"); projectTarget = StaticLib; } else projectTarget = SharedLib; @@ -819,7 +856,7 @@ void VcprojGenerator::init() if (usePCH) { precompHFilename = fileInfo(precompH).fileName(); // Created files - QString origTarget = unescapeFilePath(project->first("QMAKE_ORIG_TARGET").toQString()); + QString origTarget = project->first("QMAKE_ORIG_TARGET").toQString(); precompObj = origTarget + Option::obj_ext; precompPch = origTarget + ".pch"; // Add PRECOMPILED_HEADER to HEADERS @@ -856,7 +893,7 @@ void VcprojGenerator::init() extraCompilerSources[file] += quc.toQString(); } else { QString out = Option::fixPathToTargetOS(replaceExtraCompilerVariables( - compiler_out, file, QString()), false); + compiler_out, file, QString(), NoShell), false); extraCompilerSources[out] += quc.toQString(); extraCompilerOutputs[out] = QStringList(file); // Can only have one } @@ -907,15 +944,11 @@ void VcprojGenerator::initProject() initTranslationFiles(); initFormFiles(); initResourceFiles(); + initDistributionFiles(); initExtraCompilerOutputs(); - if (vcProject.Configuration.WinRT) { - if (vcProject.Configuration.WinPhone80 - && vcProject.Configuration.ConfigurationType == typeApplication) - initWMAppManifest(); - } // Own elements ----------------------------- - vcProject.Name = unescapeFilePath(project->first("QMAKE_ORIG_TARGET").toQString()); + vcProject.Name = project->first("QMAKE_ORIG_TARGET").toQString(); switch (which_dotnet_version(project->first("MSVC_VER").toLatin1())) { case NET2013: vcProject.Version = "12.00"; @@ -1020,7 +1053,6 @@ void VcprojGenerator::initConfiguration() conf.WinRT = project->isActiveConfig("winrt"); if (conf.WinRT) { conf.WinPhone = project->isActiveConfig("winphone"); - conf.WinPhone80 = project->first("WINTARGET_VER") == "WP80"; // Saner defaults conf.compiler.UsePrecompiledHeader = pchNone; conf.compiler.CompileAsWinRT = _False; @@ -1148,7 +1180,7 @@ void VcprojGenerator::initLinkerTool() ProStringList l = ProStringList(libs); conf.linker.parseOptions(l); } else { - conf.linker.AdditionalDependencies += libs.toQString(); + conf.linker.AdditionalDependencies << escapeFilePath(libs.toQString()); } } @@ -1208,7 +1240,7 @@ void VcprojGenerator::initPostBuildEventTools() !project->isHostBuild() && !project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH"); if (useSignature) { conf.postBuild.CommandLine.prepend( - QLatin1String("signtool sign /F ") + signature + QLatin1String(" \"$(TargetPath)\"")); + QLatin1String("signtool sign /F ") + escapeFilePath(signature) + QLatin1String(" \"$(TargetPath)\"")); conf.postBuild.ExcludedFromBuild = _False; } @@ -1239,8 +1271,7 @@ void VcprojGenerator::initDeploymentTool() // Only deploy Qt libs for shared build if (!project->values("QMAKE_QT_DLL").isEmpty()) { // FIXME: This code should actually resolve the libraries from all Qt modules. - const QString &qtdir = QLibraryInfo::rawLocation(QLibraryInfo::LibrariesPath, - QLibraryInfo::EffectivePaths); + const QString &qtdir = project->propertyValue(ProKey("QT_INSTALL_LIBS/get")).toQString(); ProStringList arg = project->values("QMAKE_LIBS") + project->values("QMAKE_LIBS_PRIVATE"); for (ProStringList::ConstIterator it = arg.constBegin(); it != arg.constEnd(); ++it) { if (it->contains(qtdir)) { @@ -1316,13 +1347,13 @@ void VcprojGenerator::initDeploymentTool() || devicePath.at(0) == QLatin1Char('\\') || devicePath.at(0) == QLatin1Char('%'))) { // create output path - devicePath = Option::fixPathToLocalOS(QDir::cleanPath(targetPath + QLatin1Char('\\') + devicePath)); + devicePath = Option::fixPathToTargetOS(targetPath + QLatin1Char('\\') + devicePath); } } // foreach d in item.files foreach (const ProString &src, project->values(ProKey(item + ".files"))) { QString itemDevicePath = devicePath; - QString source = Option::fixPathToLocalOS(src.toQString()); + QString source = Option::normalizePath(src.toQString()); QString nameFilter; QFileInfo info(source); QString searchPath; @@ -1331,7 +1362,7 @@ void VcprojGenerator::initDeploymentTool() itemDevicePath += "\\" + info.fileName(); searchPath = info.absoluteFilePath(); } else { - nameFilter = source.split('\\').last(); + nameFilter = info.fileName(); searchPath = info.absolutePath(); } @@ -1343,10 +1374,10 @@ void VcprojGenerator::initDeploymentTool() while(iterator.hasNext()) { iterator.next(); if (conf.WinRT) { - QString absoluteItemFilePath = Option::fixPathToLocalOS(QFileInfo(iterator.filePath()).absoluteFilePath()); + QString absoluteItemFilePath = Option::fixPathToTargetOS(QFileInfo(iterator.filePath()).absoluteFilePath()); vcProject.DeploymentFiles.addFile(absoluteItemFilePath); } else { - QString absoluteItemPath = Option::fixPathToLocalOS(QFileInfo(iterator.filePath()).absolutePath()); + QString absoluteItemPath = Option::fixPathToTargetOS(QFileInfo(iterator.filePath()).absolutePath()); // Identify if it is just another subdir int diffSize = absoluteItemPath.size() - pathSize; // write out rules @@ -1441,7 +1472,6 @@ void VcprojGenerator::initGeneratedFiles() vcProject.GeneratedFiles.addFiles(project->values("IDLSOURCES")); if (project->values("RC_FILE").isEmpty()) vcProject.GeneratedFiles.addFiles(project->values("RES_FILE")); - vcProject.GeneratedFiles.addFiles(project->values("QMAKE_IMAGE_COLLECTION")); // compat if(!extraCompilerOutputs.isEmpty()) vcProject.GeneratedFiles.addFiles(extraCompilerOutputs.keys()); @@ -1503,7 +1533,8 @@ void VcprojGenerator::initResourceFiles() if(!qrc_files.isEmpty()) { for (int i = 0; i < qrc_files.count(); ++i) { char buff[256]; - QString dep_cmd = replaceExtraCompilerVariables(rcc_dep_cmd, qrc_files.at(i).toQString(), ""); + QString dep_cmd = replaceExtraCompilerVariables( + rcc_dep_cmd, qrc_files.at(i).toQString(), QString(), LocalShell); dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false); if(canExecute(dep_cmd)) { @@ -1531,12 +1562,22 @@ void VcprojGenerator::initResourceFiles() // You may look again -------------------------------------------- vcProject.ResourceFiles.addFiles(project->values("RESOURCES")); - vcProject.ResourceFiles.addFiles(project->values("IMAGES")); vcProject.ResourceFiles.Project = this; vcProject.ResourceFiles.Config = &(vcProject.Configuration); } +void VcprojGenerator::initDistributionFiles() +{ + vcProject.DistributionFiles.Name = "Distribution Files"; + vcProject.DistributionFiles.ParseFiles = _False; + vcProject.DistributionFiles.Filter = "*"; + vcProject.DistributionFiles.Guid = _GUIDDistributionFiles; + vcProject.DistributionFiles.addFiles(project->values("DISTFILES")); + vcProject.DistributionFiles.Project = this; + vcProject.DistributionFiles.Config = &(vcProject.Configuration); +} + void VcprojGenerator::initExtraCompilerOutputs() { ProStringList otherFilters; @@ -1545,9 +1586,7 @@ void VcprojGenerator::initExtraCompilerOutputs() << "GENERATED_SOURCES" << "HEADERS" << "IDLSOURCES" - << "IMAGES" << "LEXSOURCES" - << "QMAKE_IMAGE_COLLECTION" << "RC_FILE" << "RESOURCES" << "RES_FILE" @@ -1579,16 +1618,16 @@ void VcprojGenerator::initExtraCompilerOutputs() QString tmp_out = project->first(ProKey(*it + ".output")).toQString(); if (project->values(ProKey(*it + ".CONFIG")).indexOf("combine") != -1) { // Combined output, only one file result - extraCompile.addFile( - Option::fixPathToTargetOS(replaceExtraCompilerVariables(tmp_out, QString(), QString()), false)); + extraCompile.addFile(Option::fixPathToTargetOS( + replaceExtraCompilerVariables(tmp_out, QString(), QString(), NoShell), false)); } else { // One output file per input const ProStringList &tmp_in = project->values(project->first(ProKey(*it + ".input")).toKey()); for (int i = 0; i < tmp_in.count(); ++i) { const QString &filename = tmp_in.at(i).toQString(); if (extraCompilerSources.contains(filename)) - extraCompile.addFile( - Option::fixPathToTargetOS(replaceExtraCompilerVariables(filename, tmp_out, QString()), false)); + extraCompile.addFile(Option::fixPathToTargetOS( + replaceExtraCompilerVariables(filename, tmp_out, QString(), NoShell), false)); } } } else { @@ -1603,8 +1642,8 @@ void VcprojGenerator::initExtraCompilerOutputs() for (int i = 0; i < tmp_in.count(); ++i) { const QString &filename = tmp_in.at(i).toQString(); if (extraCompilerSources.contains(filename)) - extraCompile.addFile( - Option::fixPathToTargetOS(replaceExtraCompilerVariables(filename, QString(), QString()), false)); + extraCompile.addFile(Option::fixPathToTargetOS( + replaceExtraCompilerVariables(filename, QString(), QString(), NoShell), false)); } } } @@ -1616,109 +1655,6 @@ void VcprojGenerator::initExtraCompilerOutputs() } } -void VcprojGenerator::initWMAppManifest() -{ - if (!project->isActiveConfig("autogen_wmappmanifest")) - return; - - // autogen_wmappmanifest - QFile file(Option::output_dir + "\\WMAppManifest.xml"); - if (!file.open(QFile::WriteOnly)) - return; - - QTextStream stream(&file); - - QString productID = project->first("PRODUCTID").toQString(); - QString target = project->first("TARGET").toQString(); - QString author = project->first("AUTHOR").toQString(); - QString publisher = project->first("PUBLISHER").toQString(); - QString publisherID = project->first("PUBLISHERID").toQString(); - QString description = project->first("DESCRIPTION").toQString(); - - if (author.isEmpty()) - author = "Qt"; - if (publisher.isEmpty()) - publisher = "Qt"; - if (productID.isEmpty()) - productID = QUuid::createUuid().toString(); - if (publisherID.isEmpty()) - publisherID = QUuid::createUuid().toString(); - - stream << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" - << "<Deployment xmlns=\"http://schemas.microsoft.com/windowsphone/2012/deployment\" AppPlatformVersion=\"8.0\">\n" - << " <DefaultLanguage xmlns=\"\" code=\"en-US\"/>\n" - << " <App xmlns=\"\" ProductID=\"" << productID << "\" Title=\"" << target - << "\" RuntimeType=\"Modern Native\" Version=\"1.0.0.0\"" - << " Genre=\"apps.normal\" Author=\"" << author - << "\" Description=\"" << description << "\" Publisher=\"" << publisher - << "\" PublisherID=\"" << publisherID << "\">\n" - << " <IconPath IsRelative=\"true\" IsResource=\"false\">ApplicationIcon.png</IconPath>\n" - << " <Capabilities>\n" - << " <Capability Name=\"ID_CAP_NETWORKING\" />\n" - << " <Capability Name=\"ID_CAP_MEDIALIB_AUDIO\" />\n" - << " <Capability Name=\"ID_CAP_MEDIALIB_PLAYBACK\" />\n" - << " </Capabilities>\n" - << " <Tasks>\n" - << " <DefaultTask Name=\"_default\" ImagePath=\"" << target << ".exe\" ImageParams=\"\" />\n" - << " </Tasks>\n" - << " <Tokens>\n" - << " <PrimaryToken TokenID=\"" << target << "Token\" TaskName=\"_default\">\n" - << " <TemplateType5>\n" - << " <Count>0</Count>\n" - << " <Title>" << target << "</Title>\n" - << " </TemplateType5>\n" - << " </PrimaryToken>\n" - << " </Tokens>\n" - << " <ScreenResolutions>\n" - << " <ScreenResolution Name=\"ID_RESOLUTION_WVGA\" />\n" - << " <ScreenResolution Name=\"ID_RESOLUTION_WXGA\" />\n" - << " <ScreenResolution Name=\"ID_RESOLUTION_HD720P\" />\n" - << " </ScreenResolutions>\n" - << " </App>\n" - << "</Deployment>\n"; -} - -void VcprojGenerator::initOld() -{ - // $$QMAKE.. -> $$MSVCPROJ.. ------------------------------------- - const ProStringList &incs = project->values("INCLUDEPATH"); - for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) { - QString inc = (*incit).toQString(); - if (!inc.startsWith('"') && !inc.endsWith('"')) - inc = QString("\"%1\"").arg(inc); // Quote all paths if not quoted already - project->values("MSVCPROJ_INCPATH").append("-I" + inc); - } - - QString dest = Option::fixPathToTargetOS(project->first("TARGET").toQString()) + project->first("TARGET_EXT"); - project->values("MSVCPROJ_TARGET") = ProStringList(dest); - - // DLL COPY ------------------------------------------------------ - if(project->isActiveConfig("dll") && !project->values("DLLDESTDIR").isEmpty()) { - const ProStringList &dlldirs = project->values("DLLDESTDIR"); - QString copydll(""); - ProStringList::ConstIterator dlldir; - for(dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir) { - if(!copydll.isEmpty()) - copydll += " && "; - copydll += "copy \"$(TargetPath)\" \"" + *dlldir + "\""; - } - - QString deststr("Copy " + dest + " to "); - for(dlldir = dlldirs.begin(); dlldir != dlldirs.end();) { - deststr += *dlldir; - ++dlldir; - if(dlldir != dlldirs.end()) - deststr += ", "; - } - - project->values("MSVCPROJ_COPY_DLL").append(copydll); - project->values("MSVCPROJ_COPY_DLL_DESC").append(deststr); - } - - // Verbose output if "-d -d"... - outputVariables(); -} - // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -1727,9 +1663,10 @@ VCProjectWriter *VcprojGenerator::createProjectWriter() return new VCProjectWriter; } -QString VcprojGenerator::replaceExtraCompilerVariables(const QString &var, const QStringList &in, const QStringList &out) +QString VcprojGenerator::replaceExtraCompilerVariables( + const QString &var, const QStringList &in, const QStringList &out, ReplaceFor forShell) { - QString ret = MakefileGenerator::replaceExtraCompilerVariables(var, in, out); + QString ret = MakefileGenerator::replaceExtraCompilerVariables(var, in, out, forShell); ProStringList &defines = project->values("VCPROJ_MAKEFILE_DEFINES"); if(defines.isEmpty()) @@ -1757,7 +1694,7 @@ bool VcprojGenerator::openOutput(QFile &file, const QString &/*build*/) const ProString ext = project->first("VCPROJ_EXTENSION"); if(project->first("TEMPLATE") == "vcsubdirs") ext = project->first("VCSOLUTION_EXTENSION"); - ProString outputName = unescapeFilePath(project->first("TARGET")); + ProString outputName = project->first("TARGET"); if (!project->first("MAKEFILE").isEmpty()) outputName = project->first("MAKEFILE"); file.setFileName(outdir + outputName + ext); @@ -1765,29 +1702,4 @@ bool VcprojGenerator::openOutput(QFile &file, const QString &/*build*/) const return Win32MakefileGenerator::openOutput(file, QString()); } -QString VcprojGenerator::fixFilename(QString ofile) const -{ - ofile = Option::fixPathToLocalOS(ofile); - int slashfind = ofile.lastIndexOf(Option::dir_sep); - if(slashfind == -1) { - ofile = ofile.replace('-', '_'); - } else { - int hyphenfind = ofile.indexOf('-', slashfind); - while (hyphenfind != -1 && slashfind < hyphenfind) { - ofile = ofile.replace(hyphenfind, 1, '_'); - hyphenfind = ofile.indexOf('-', hyphenfind + 1); - } - } - return ofile; -} - -void VcprojGenerator::outputVariables() -{ -#if 0 - qDebug("Generator: MSVC.NET: List of current variables:"); - for (ProValueMap::ConstIterator it = project->variables().begin(); it != project->variables().end(); ++it) - qDebug("Generator: MSVC.NET: %s => %s", qPrintable(it.key().toQString()), qPrintable(it.value().join(" | "))); -#endif -} - QT_END_NAMESPACE diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h index f436b6da20..3396ea4986 100644 --- a/qmake/generators/win32/msvc_vcproj.h +++ b/qmake/generators/win32/msvc_vcproj.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the qmake application of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -49,7 +49,6 @@ class QUuid; struct VcsolutionDepend; class VcprojGenerator : public Win32MakefileGenerator { - bool init_flag; bool is64Bit; bool writeVcprojParts(QTextStream &); @@ -77,18 +76,16 @@ protected: virtual VCProjectWriter *createProjectWriter(); virtual bool doDepends() const { return false; } //never necesary virtual void processSources() { filterIncludedFiles("SOURCES"); filterIncludedFiles("GENERATED_SOURCES"); } - virtual QString replaceExtraCompilerVariables(const QString &, const QStringList &, const QStringList &); - inline QString replaceExtraCompilerVariables(const QString &val, const QString &in, const QString &out) - { return MakefileGenerator::replaceExtraCompilerVariables(val, in, out); } + using MakefileGenerator::ReplaceFor; + virtual QString replaceExtraCompilerVariables(const QString &, const QStringList &, const QStringList &, ReplaceFor); + inline QString replaceExtraCompilerVariables(const QString &val, const QString &in, const QString &out, ReplaceFor forShell) + { return MakefileGenerator::replaceExtraCompilerVariables(val, in, out, forShell); } virtual bool supportsMetaBuild() { return true; } virtual bool supportsMergedBuilds() { return true; } virtual bool mergeBuildProject(MakefileGenerator *other); virtual bool openOutput(QFile &file, const QString &build) const; - virtual void outputVariables(); - QString fixFilename(QString ofile) const; - void initOld(); virtual void initProject(); void initConfiguration(); void initCompilerTool(); @@ -111,9 +108,9 @@ protected: void initFormFiles(); void initResourceFiles(); void initDeploymentFiles(); + void initDistributionFiles(); void initLexYaccFiles(); void initExtraCompilerOutputs(); - void initWMAppManifest(); void writeSubDirs(QTextStream &t); // Called from VCXProj backend QUuid getProjectUUID(const QString &filename=QString()); // Called from VCXProj backend diff --git a/qmake/generators/win32/msvc_vcxproj.cpp b/qmake/generators/win32/msvc_vcxproj.cpp index 97439115b6..5282989369 100644 --- a/qmake/generators/win32/msvc_vcxproj.cpp +++ b/qmake/generators/win32/msvc_vcxproj.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the qmake application of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/qmake/generators/win32/msvc_vcxproj.h b/qmake/generators/win32/msvc_vcxproj.h index 4ff7403e13..0ffe5f3aff 100644 --- a/qmake/generators/win32/msvc_vcxproj.h +++ b/qmake/generators/win32/msvc_vcxproj.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the qmake application of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 3a2e146a33..6ea129f82c 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the qmake application of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -52,12 +52,12 @@ Win32MakefileGenerator::Win32MakefileGenerator() : MakefileGenerator() int Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem, const QString &ext) { - QString bd = Option::fixPathToLocalOS(d, true); + QString bd = Option::normalizePath(d); if(!exists(bd)) return -1; QMakeMetaInfo libinfo(project); - bool libInfoRead = libinfo.readLib(bd + Option::dir_sep + stem); + bool libInfoRead = libinfo.readLib(bd + '/' + stem); // If the library, for which we're trying to find the highest version // number, is a static library @@ -96,6 +96,16 @@ Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem return biggest; } +ProString Win32MakefileGenerator::fixLibFlag(const ProString &lib) +{ + if (lib.startsWith('/')) { + if (lib.startsWith("/LIBPATH:")) + return QStringLiteral("/LIBPATH:") + escapeFilePath(lib.mid(9)); + return lib; + } + return escapeFilePath(lib); +} + bool Win32MakefileGenerator::findLibraries() { @@ -104,26 +114,23 @@ Win32MakefileGenerator::findLibraries() for (int i = 0; lflags[i]; i++) { ProStringList &l = project->values(lflags[i]); for (ProStringList::Iterator it = l.begin(); it != l.end();) { - QChar quote; - bool modified_opt = false, remove = false; + bool remove = false; QString opt = (*it).trimmed().toQString(); - if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0]) { - quote = opt[0]; - opt = opt.mid(1, opt.length()-2); - } if(opt.startsWith("/LIBPATH:")) { - dirs.append(QMakeLocalFileName(opt.mid(9))); + QString libpath = opt.mid(9); + QMakeLocalFileName l(libpath); + if (!dirs.contains(l)) { + dirs.append(l); + (*it) = "/LIBPATH:" + l.real(); + } else { + remove = true; + } } else if(opt.startsWith("-L") || opt.startsWith("/L")) { QString libpath = Option::fixPathToTargetOS(opt.mid(2), false, false); QMakeLocalFileName l(libpath); if(!dirs.contains(l)) { dirs.append(l); - modified_opt = true; - if (!quote.isNull()) { - libpath = quote + libpath + quote; - quote = QChar(); - } - (*it) = "/LIBPATH:" + libpath; + (*it) = "/LIBPATH:" + l.real(); } else { remove = true; } @@ -139,24 +146,19 @@ Win32MakefileGenerator::findLibraries() extension += QString::number(ver); extension += suffix; extension += ".lib"; - if(QMakeMetaInfo::libExists((*it).local() + Option::dir_sep + lib) || - exists((*it).local() + Option::dir_sep + lib + extension)) { + if (QMakeMetaInfo::libExists((*it).local() + '/' + lib) + || exists((*it).local() + '/' + lib + extension)) { out = (*it).real() + Option::dir_sep + lib + extension; - if (out.contains(QLatin1Char(' '))) { - out.prepend(QLatin1Char('\"')); - out.append(QLatin1Char('\"')); - } break; } } } if(out.isEmpty()) out = lib + ".lib"; - modified_opt = true; (*it) = out; - } else if(!exists(Option::fixPathToLocalOS(opt))) { + } else if (!exists(Option::normalizePath(opt))) { QList<QMakeLocalFileName> lib_dirs; - QString file = opt; + QString file = Option::fixPathToTargetOS(opt); int slsh = file.lastIndexOf(Option::dir_sep); if(slsh != -1) { lib_dirs.append(QMakeLocalFileName(file.left(slsh+1))); @@ -167,7 +169,7 @@ Win32MakefileGenerator::findLibraries() if(file.endsWith(".lib")) { file = file.left(file.length() - 4); if(!file.at(file.length()-1).isNumber()) { - ProString suffix = project->first(ProKey("QMAKE_" + file.section(Option::dir_sep, -1).toUpper() + "_SUFFIX")); + ProString suffix = project->first(ProKey("QMAKE_" + file.toUpper() + "_SUFFIX")); for(QList<QMakeLocalFileName>::Iterator dep_it = lib_dirs.begin(); dep_it != lib_dirs.end(); ++dep_it) { QString lib_tmpl(file + "%1" + suffix + ".lib"); int ver = findHighestVersion((*dep_it).local(), file); @@ -182,7 +184,6 @@ Win32MakefileGenerator::findLibraries() dir += Option::dir_sep; lib_tmpl.prepend(dir); } - modified_opt = true; (*it) = lib_tmpl; break; } @@ -193,8 +194,6 @@ Win32MakefileGenerator::findLibraries() if(remove) { it = l.erase(it); } else { - if(!quote.isNull() && modified_opt) - (*it) = quote + (*it) + quote; ++it; } } @@ -212,8 +211,6 @@ Win32MakefileGenerator::processPrlFiles() ProStringList &l = project->values(lflags[i]); for (int lit = 0; lit < l.size(); ++lit) { QString opt = l.at(lit).trimmed().toQString(); - if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0]) - opt = opt.mid(1, opt.length()-2); if (opt.startsWith(libArg)) { QMakeLocalFileName l(opt.mid(libArg.length())); if (!libdirs.contains(l)) @@ -226,21 +223,15 @@ Win32MakefileGenerator::processPrlFiles() else tmp = opt; for(QList<QMakeLocalFileName>::Iterator it = libdirs.begin(); it != libdirs.end(); ++it) { - QString prl = (*it).local() + Option::dir_sep + tmp; + QString prl = (*it).local() + '/' + tmp; if (processPrlFile(prl)) break; } } } ProStringList &prl_libs = project->values("QMAKE_CURRENT_PRL_LIBS"); - for (int prl = 0; prl < prl_libs.size(); ++prl) { - ProString arg = prl_libs.at(prl); - if (arg.startsWith(libArg)) - arg = arg.left(libArg.length()) + escapeFilePath(arg.mid(libArg.length()).toQString()); - else if (!arg.startsWith('/')) - arg = escapeFilePath(arg.toQString()); - l.insert(lit + prl + 1, arg); - } + for (int prl = 0; prl < prl_libs.size(); ++prl) + l.insert(lit + prl + 1, prl_libs.at(prl)); prl_libs.clear(); } @@ -287,43 +278,24 @@ void Win32MakefileGenerator::processVars() if (!project->isActiveConfig("skip_target_version_ext") && project->values("TARGET_VERSION_EXT").isEmpty() && !project->values("VER_MAJ").isEmpty()) - project->values("TARGET_VERSION_EXT").append(project->values("VER_MAJ").first()); - - if(project->isEmpty("QMAKE_COPY_FILE")) - project->values("QMAKE_COPY_FILE").append("$(COPY)"); - if(project->isEmpty("QMAKE_COPY_DIR")) - project->values("QMAKE_COPY_DIR").append("xcopy /s /q /y /i"); - if (project->isEmpty("QMAKE_STREAM_EDITOR")) - project->values("QMAKE_STREAM_EDITOR").append("$(QMAKE) -install sed"); - if(project->isEmpty("QMAKE_INSTALL_FILE")) - project->values("QMAKE_INSTALL_FILE").append("$(COPY_FILE)"); - if(project->isEmpty("QMAKE_INSTALL_PROGRAM")) - project->values("QMAKE_INSTALL_PROGRAM").append("$(COPY_FILE)"); - if(project->isEmpty("QMAKE_INSTALL_DIR")) - project->values("QMAKE_INSTALL_DIR").append("$(COPY_DIR)"); + project->values("TARGET_VERSION_EXT").append(project->first("VER_MAJ")); fixTargetExt(); processRcFileVar(); - ProStringList &incDir = project->values("INCLUDEPATH"); - for (ProStringList::Iterator incDir_it = incDir.begin(); incDir_it != incDir.end(); ++incDir_it) - if (!(*incDir_it).isEmpty()) - (*incDir_it) = Option::fixPathToTargetOS((*incDir_it).toQString(), false, false); - ProString libArg = project->first("QMAKE_L_FLAG"); ProStringList libs; ProStringList &libDir = project->values("QMAKE_LIBDIR"); for (ProStringList::Iterator libDir_it = libDir.begin(); libDir_it != libDir.end(); ++libDir_it) { QString lib = (*libDir_it).toQString(); if (!lib.isEmpty()) { - lib.remove('"'); if (lib.endsWith('\\')) lib.chop(1); - libs << libArg + escapeFilePath(Option::fixPathToTargetOS(lib, false, false)); + libs << libArg + Option::fixPathToTargetOS(lib, false, false); } } - project->values("QMAKE_LIBS") += libs + escapeFilePaths(project->values("LIBS")); - project->values("QMAKE_LIBS_PRIVATE") += escapeFilePaths(project->values("LIBS_PRIVATE")); + project->values("QMAKE_LIBS") += libs + project->values("LIBS"); + project->values("QMAKE_LIBS_PRIVATE") += project->values("LIBS_PRIVATE"); if (project->values("TEMPLATE").contains("app")) { project->values("QMAKE_CFLAGS") += project->values("QMAKE_CFLAGS_APP"); @@ -368,7 +340,8 @@ void Win32MakefileGenerator::processRcFileVar() if (Option::qmake_mode == Option::QMAKE_GENERATE_NOTHING) return; - if (((!project->values("VERSION").isEmpty() || !project->values("RC_ICONS").isEmpty()) + const QString manifestFile = getManifestFileForRcFile(); + if (((!project->values("VERSION").isEmpty() || !project->values("RC_ICONS").isEmpty() || !manifestFile.isEmpty()) && project->values("RC_FILE").isEmpty() && project->values("RES_FILE").isEmpty() && !project->isActiveConfig("no_generated_target_info") @@ -405,14 +378,14 @@ void Win32MakefileGenerator::processRcFileVar() else productName = project->first("TARGET").toQString(); - QString originalName = project->values("TARGET").first() + project->values("TARGET_EXT").first(); + QString originalName = project->first("TARGET") + project->first("TARGET_EXT"); int rcLang = project->intValue("RC_LANG", 1033); // default: English(USA) int rcCodePage = project->intValue("RC_CODEPAGE", 1200); // default: Unicode ts << "# if defined(UNDER_CE)\n"; ts << "# include <winbase.h>\n"; ts << "# else\n"; - ts << "# include <winver.h>\n"; + ts << "# include <windows.h>\n"; ts << "# endif\n"; ts << endl; if (!rcIcons.isEmpty()) { @@ -420,6 +393,14 @@ void Win32MakefileGenerator::processRcFileVar() ts << QString("IDI_ICON%1\tICON\tDISCARDABLE\t%2").arg(i + 1).arg(cQuoted(rcIcons[i])) << endl; ts << endl; } + if (!manifestFile.isEmpty()) { + QString manifestResourceId; + if (project->first("TEMPLATE") == "lib") + manifestResourceId = QStringLiteral("ISOLATIONAWARE_MANIFEST_RESOURCE_ID"); + else + manifestResourceId = QStringLiteral("CREATEPROCESS_MANIFEST_RESOURCE_ID"); + ts << manifestResourceId << " RT_MANIFEST \"" << manifestFile << "\"\n"; + } ts << "VS_VERSION_INFO VERSIONINFO\n"; ts << "\tFILEVERSION " << QString(versionString).replace(".", ",") << endl; ts << "\tPRODUCTVERSION " << QString(versionString).replace(".", ",") << endl; @@ -464,9 +445,9 @@ void Win32MakefileGenerator::processRcFileVar() ts.flush(); - QString rcFilename = project->values("OUT_PWD").first() + QString rcFilename = project->first("OUT_PWD") + "/" - + project->values("TARGET").first() + + project->first("TARGET") + "_resource" + ".rc"; QFile rcFile(QDir::cleanPath(rcFilename)); @@ -511,17 +492,17 @@ void Win32MakefileGenerator::processRcFileVar() resFile.replace(".rc", Option::res_ext); project->values("RES_FILE").prepend(fileInfo(resFile).fileName()); - if (!project->values("OBJECTS_DIR").isEmpty()) { - QString resDestDir; - if (project->isActiveConfig("staticlib")) - resDestDir = fileInfo(project->first("DESTDIR").toQString()).absoluteFilePath(); - else - resDestDir = project->first("OBJECTS_DIR").toQString(); + QString resDestDir; + if (project->isActiveConfig("staticlib")) + resDestDir = project->first("DESTDIR").toQString(); + else + resDestDir = project->first("OBJECTS_DIR").toQString(); + if (!resDestDir.isEmpty()) { resDestDir.append(Option::dir_sep); project->values("RES_FILE").first().prepend(resDestDir); } project->values("RES_FILE").first() = Option::fixPathToTargetOS( - project->values("RES_FILE").first().toQString(), false, false); + project->first("RES_FILE").toQString(), false); project->values("POST_TARGETDEPS") += project->values("RES_FILE"); project->values("CLEAN_FILES") += project->values("RES_FILE"); } @@ -529,7 +510,7 @@ void Win32MakefileGenerator::processRcFileVar() void Win32MakefileGenerator::writeCleanParts(QTextStream &t) { - t << "clean: compiler_clean " << var("CLEAN_DEPS"); + t << "clean: compiler_clean " << depVar("CLEAN_DEPS"); { const char *clean_targets[] = { "OBJECTS", "QMAKE_CLEAN", "CLEAN_FILES", 0 }; for(int i = 0; clean_targets[i]; ++i) { @@ -558,7 +539,7 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t) } t << endl << endl; - t << "distclean: clean " << var("DISTCLEAN_DEPS"); + t << "distclean: clean " << depVar("DISTCLEAN_DEPS"); { const char *clean_targets[] = { "QMAKE_DISTCLEAN", 0 }; for(int i = 0; clean_targets[i]; ++i) { @@ -587,9 +568,9 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t) } t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET)\n"; { - QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.fileName())); + QString ofile = fileFixify(Option::output.fileName()); if(!ofile.isEmpty()) - t << "\t-$(DEL_FILE) " << ofile << endl; + t << "\t-$(DEL_FILE) " << escapeFilePath(ofile) << endl; } t << endl; } @@ -602,9 +583,8 @@ void Win32MakefileGenerator::writeIncPart(QTextStream &t) for(int i = 0; i < incs.size(); ++i) { QString inc = incs.at(i).toQString(); inc.replace(QRegExp("\\\\$"), ""); - inc.replace(QRegExp("\""), ""); if(!inc.isEmpty()) - t << "-I\"" << inc << "\" "; + t << "-I" << escapeFilePath(inc) << ' '; } t << endl; } @@ -624,13 +604,13 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) writeLibsPart(t); t << "QMAKE = " << var("QMAKE_QMAKE") << endl; - t << "IDC = " << (project->isEmpty("QMAKE_IDC") ? QString("idc") : - Option::fixPathToTargetOS(var("QMAKE_IDC"), false)) << endl; - t << "IDL = " << (project->isEmpty("QMAKE_IDL") ? QString("midl") : - Option::fixPathToTargetOS(var("QMAKE_IDL"), false)) << 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 = " << varList("DEF_FILE") << endl; - t << "RES_FILE = " << varList("RES_FILE") << endl; // Not on mingw, can't see why not though... + 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; @@ -647,7 +627,7 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) t << "####### Output directory\n\n"; if(!project->values("OBJECTS_DIR").isEmpty()) - t << "OBJECTS_DIR = " << var("OBJECTS_DIR").replace(QRegExp("\\\\$"),"") << endl; + t << "OBJECTS_DIR = " << escapeFilePath(var("OBJECTS_DIR").remove(QRegExp("\\\\$"))) << endl; else t << "OBJECTS_DIR = . \n"; t << endl; @@ -662,7 +642,6 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) if (!destDir.isEmpty() && (orgDestDir.endsWith('/') || orgDestDir.endsWith(Option::dir_sep))) destDir += Option::dir_sep; QString target = QString(project->first("TARGET")+project->first("TARGET_EXT")); - target.remove("\""); project->values("DEST_TARGET").prepend(destDir + target); writeObjectsPart(t); @@ -670,15 +649,14 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) writeExtraCompilerVariables(t); writeExtraVariables(t); - t << "DIST = " << varList("DISTFILES") << " " - << varList("HEADERS") << " " - << varList("SOURCES") << endl; - t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; + t << "DIST = " << fileVarList("DISTFILES") << ' ' + << fileVarList("HEADERS") << ' ' << fileVarList("SOURCES") << endl; + t << "QMAKE_TARGET = " << fileVar("QMAKE_ORIG_TARGET") << endl; // 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 = " << escapeFilePath(var("DEST_TARGET")) << endl; + t << "DESTDIR_TARGET = " << fileVar("DEST_TARGET") << endl; t << endl; t << "####### Implicit rules\n\n"; @@ -690,8 +668,8 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) if(project->isActiveConfig("shared") && !project->values("DLLDESTDIR").isEmpty()) { const ProStringList &dlldirs = project->values("DLLDESTDIR"); for (ProStringList::ConstIterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir) { - t << "\t-$(COPY_FILE) \"$(DESTDIR_TARGET)\" " - << Option::fixPathToTargetOS((*dlldir).toQString(), false) << endl; + t << "\t-$(COPY_FILE) $(DESTDIR_TARGET) " + << escapeFilePath(Option::fixPathToTargetOS((*dlldir).toQString(), false)) << endl; } } t << endl; @@ -715,13 +693,13 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) } t << "dist:\n\t" << "$(ZIP) " << var("QMAKE_ORIG_TARGET") << ".zip $(SOURCES) $(DIST) " - << dist_files.join(' ') << " " << var("TRANSLATIONS") << " "; + << escapeFilePaths(dist_files).join(' ') << ' ' << fileVar("TRANSLATIONS") << ' '; if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) { const ProStringList &quc = project->values("QMAKE_EXTRA_COMPILERS"); for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { const ProStringList &inputs = project->values(ProKey(*it + ".input")); for (ProStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) - t << (*input) << " "; + t << escapeFilePath(*input) << ' '; } } t << endl << endl; @@ -740,12 +718,14 @@ void Win32MakefileGenerator::writeLibsPart(QTextStream &t) } else { t << "LINKER = " << var("QMAKE_LINK") << endl; t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; - t << "LIBS = " << var("QMAKE_LIBS") << " " << var("QMAKE_LIBS_PRIVATE") << endl; + t << "LIBS = " << fixLibFlags("QMAKE_LIBS").join(' ') << ' ' + << fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << endl; } } void Win32MakefileGenerator::writeObjectsPart(QTextStream &t) { + // Used in both deps and commands. t << "OBJECTS = " << valList(escapeDependencyPaths(project->values("OBJECTS"))) << endl; } @@ -787,9 +767,10 @@ void Win32MakefileGenerator::writeRcFilePart(QTextStream &t) incPathStr += escapeFilePath(path); } - t << res_file << ": " << rc_file << "\n\t" + t << escapeDependencyPath(res_file) << ": " << escapeDependencyPath(rc_file) << "\n\t" << var("QMAKE_RC") << (project->isActiveConfig("debug") ? " -D_DEBUG" : "") - << " $(DEFINES)" << incPathStr << " -fo " << res_file << " " << rc_file; + << " $(DEFINES)" << incPathStr << " -fo " << escapeFilePath(res_file) + << ' ' << escapeFilePath(rc_file); t << endl << endl; } } @@ -809,8 +790,7 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t) const QString root = "$(INSTALL_ROOT)"; ProStringList &uninst = project->values(ProKey(t + ".uninstall")); QString ret; - QString targetdir = Option::fixPathToTargetOS(project->first(ProKey(t + ".path")).toQString(), false); - targetdir = fileFixify(targetdir, FileFixifyAbsolute); + QString targetdir = fileFixify(project->first(ProKey(t + ".path")).toQString(), FileFixifyAbsolute); if(targetdir.right(1) != Option::dir_sep) targetdir += Option::dir_sep; @@ -825,7 +805,7 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t) ret += installMetaFile(ProKey("QMAKE_PRL_INSTALL_REPLACE"), project->first("QMAKE_INTERNAL_PRL_FILE").toQString(), dst_prl); if(!uninst.isEmpty()) uninst.append("\n\t"); - uninst.append("-$(DEL_FILE) \"" + dst_prl + "\""); + uninst.append("-$(DEL_FILE) " + escapeFilePath(dst_prl)); } if(project->isActiveConfig("create_pc")) { QString dst_pc = pkgConfigFileName(false); @@ -842,32 +822,35 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t) ret += installMetaFile(ProKey("QMAKE_PKGCONFIG_INSTALL_REPLACE"), pkgConfigFileName(true), dst_pc); if(!uninst.isEmpty()) uninst.append("\n\t"); - uninst.append("-$(DEL_FILE) \"" + dst_pc + "\""); + uninst.append("-$(DEL_FILE) " + escapeFilePath(dst_pc)); } } if(project->isActiveConfig("shared") && !project->isActiveConfig("plugin")) { QString lib_target = getLibTarget(); - lib_target.remove('"'); - QString src_targ = (project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR")) + lib_target; - QString dst_targ = filePrefixRoot(root, fileFixify(targetdir + lib_target, FileFixifyAbsolute)); + QString src_targ = escapeFilePath( + (project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR")) + + lib_target); + QString dst_targ = escapeFilePath( + filePrefixRoot(root, fileFixify(targetdir + lib_target, FileFixifyAbsolute))); if(!ret.isEmpty()) ret += "\n\t"; - ret += QString("-$(INSTALL_FILE)") + " \"" + src_targ + "\" \"" + dst_targ + "\""; + ret += QString("-$(INSTALL_FILE) ") + src_targ + ' ' + dst_targ; if(!uninst.isEmpty()) uninst.append("\n\t"); - uninst.append("-$(DEL_FILE) \"" + dst_targ + "\""); + uninst.append("-$(DEL_FILE) " + dst_targ); } } if (t == "dlltarget" || project->values(ProKey(t + ".CONFIG")).indexOf("no_dll") == -1) { QString src_targ = "$(DESTDIR_TARGET)"; - QString dst_targ = filePrefixRoot(root, fileFixify(targetdir + "$(TARGET)", FileFixifyAbsolute)); + QString dst_targ = escapeFilePath( + filePrefixRoot(root, fileFixify(targetdir + "$(TARGET)", FileFixifyAbsolute))); if(!ret.isEmpty()) ret += "\n\t"; - ret += QString("-$(INSTALL_FILE)") + " \"" + src_targ + "\" \"" + dst_targ + "\""; + ret += QString("-$(INSTALL_FILE) ") + src_targ + ' ' + dst_targ; if(!uninst.isEmpty()) uninst.append("\n\t"); - uninst.append("-$(DEL_FILE) \"" + dst_targ + "\""); + uninst.append("-$(DEL_FILE) " + dst_targ); } return ret; } @@ -876,7 +859,6 @@ QString Win32MakefileGenerator::escapeFilePath(const QString &path) const { QString ret = path; if(!ret.isEmpty()) { - ret = unescapeFilePath(ret); if (ret.contains(' ') || ret.contains('\t')) ret = "\"" + ret + "\""; debug_msg(2, "EscapeFilePath: %s -> %s", path.toLatin1().constData(), ret.toLatin1().constData()); @@ -894,4 +876,9 @@ QString Win32MakefileGenerator::cQuoted(const QString &str) return ret; } +QString Win32MakefileGenerator::getManifestFileForRcFile() const +{ + return QString(); +} + QT_END_NAMESPACE diff --git a/qmake/generators/win32/winmakefile.h b/qmake/generators/win32/winmakefile.h index 3016bad5b4..ea763c3175 100644 --- a/qmake/generators/win32/winmakefile.h +++ b/qmake/generators/win32/winmakefile.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the qmake application of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -60,12 +60,15 @@ protected: int findHighestVersion(const QString &dir, const QString &stem, const QString &ext = QLatin1String("lib")); virtual bool findLibraries(); + virtual ProString fixLibFlag(const ProString &lib); + virtual void processPrlFiles(); void processVars(); void fixTargetExt(); void processRcFileVar(); virtual QString getLibTarget(); static QString cQuoted(const QString &str); + virtual QString getManifestFileForRcFile() const; }; inline Win32MakefileGenerator::~Win32MakefileGenerator() |