From e3051e6591ca50c6f3fa7cbc5eba935ce6f04ad9 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Tue, 14 Jun 2016 17:16:42 +0200 Subject: Doc: Fix example code in qmake Manual Should be: system("ls /bin"): HAS_BIN = TRUE Task-number: QTBUG-53764 Change-Id: I3040fc066d8aa1748582e2c059fea64907233086 Reviewed-by: Oswald Buddenhagen --- qmake/doc/snippets/code/doc_src_qmake-manual.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qmake') diff --git a/qmake/doc/snippets/code/doc_src_qmake-manual.pro b/qmake/doc/snippets/code/doc_src_qmake-manual.pro index 6fa3ca085d..18078464f7 100644 --- a/qmake/doc/snippets/code/doc_src_qmake-manual.pro +++ b/qmake/doc/snippets/code/doc_src_qmake-manual.pro @@ -411,7 +411,7 @@ This is a test. #! [71] -system(ls /bin):HAS_BIN=FALSE +system("ls /bin"): HAS_BIN = TRUE #! [71] -- cgit v1.2.3 From 3d3d65f538fa22eb8c5d9c8a4bad53bf79515848 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 7 Jun 2016 16:18:49 +0200 Subject: Use separate PDB files for compiling and linking in MSVC builds The two PDB files that the MSVC compiler and linker create are supposed to be handled differently and should not share the same file path. Using the same file path for both can result in corrupted PDB files and longer build times. Use $${TARGET}.vc.pdb in the OBJECTS_DIR for the compiler and $${TARGET}.pdb (the default) for the linker. Task-number: QTBUG-53895 Change-Id: I31f06d4a674a3aa2afe5b30499bae820e5caf2c4 Reviewed-by: Oswald Buddenhagen --- qmake/generators/win32/msvc_nmake.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index f7a5019f8b..31abed57ef 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -409,11 +409,14 @@ void NmakeMakefileGenerator::init() project->values("QMAKE_DISTCLEAN").append(tgt + ".lib"); } if (project->isActiveConfig("debug_info")) { - QString pdbfile = tgt + ".pdb"; + // Add the compiler's PDB file. + QString pdbfile = var("OBJECTS_DIR") + project->first("TARGET") + ".vc.pdb"; QString escapedPdbFile = escapeFilePath(pdbfile); project->values("QMAKE_CFLAGS").append("/Fd" + escapedPdbFile); project->values("QMAKE_CXXFLAGS").append("/Fd" + escapedPdbFile); - project->values("QMAKE_DISTCLEAN").append(pdbfile); + project->values("QMAKE_CLEAN").append(pdbfile); + // Add the linker's PDB file to the distclean target. + project->values("QMAKE_DISTCLEAN").append(tgt + ".pdb"); } if (project->isActiveConfig("debug")) { project->values("QMAKE_CLEAN").append(tgt + ".ilk"); -- cgit v1.2.3 From 05bd88bdd86b8204623ef4719cbe244d391edeac Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Fri, 10 Jun 2016 20:15:12 -0700 Subject: Fix an issue causing qmake to generate corrupt Makefiles. This resolves an issue where qmake would generate a Makefile with an install command immediately followed by a test command, with no intermediary newline and tab to separate them. Task-number: QTBUG-54035 Change-Id: I7f9226f25e92b49ce689d252e9c4a58b877f2972 Reviewed-by: Oswald Buddenhagen --- qmake/generators/unix/unixmake.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index d2483459d8..122ecb0caa 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -606,8 +606,11 @@ UnixMakefileGenerator::defaultInstall(const QString &t) } else if (project->first("TEMPLATE") == "lib" && project->isActiveConfig("staticlib")) { copy_cmd += "-$(INSTALL_FILE) " + src_targ + ' ' + dst_targ; } else if (!isAux) { - if (bundle == SlicedBundle) - ret += mkdir_p_asstring("\"`dirname " + dst_targ + "`\"", false) + "\n\t"; + if (bundle == SlicedBundle) { + if (!ret.isEmpty()) + ret += "\n\t"; + ret += mkdir_p_asstring("\"`dirname " + dst_targ + "`\"", false); + } copy_cmd += "-$(INSTALL_PROGRAM) " + src_targ + ' ' + dst_targ; } if(project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") -- cgit v1.2.3 From 23bce6b169ca14ff72b672965ed5f89424c2d8fe Mon Sep 17 00:00:00 2001 From: Mat Sutcliffe Date: Thu, 16 Jun 2016 14:38:22 +0100 Subject: qmake: Fix missing newlines in generated vcxproj files A bug in the Windows C Runtime causes text mode pipes to drop newlines sometimes. This bug was hidden because of another bug in rcc which caused newlines to be redundantly duplicated. When the latter bug was fixed (commit 53d5811b) the former bug was exposed, causing invalid vcxproj files to be generated. The Windows bug is described here: https://connect.microsoft.com/VisualStudio/feedback/details/1902345 The workaround is to avoid text mode, and do the conversion of "\r\n" to "\n" ourselves (which we were already doing anyway). Change-Id: I792599a4cd7822f109fa921f02207fb1b144b1d1 Reviewed-by: Oswald Buddenhagen --- qmake/generators/makefile.cpp | 4 ++-- qmake/generators/makefile.h | 2 ++ qmake/generators/win32/msvc_objectmodel.cpp | 2 +- qmake/generators/win32/msvc_vcproj.cpp | 2 +- qmake/library/qmakebuiltins.cpp | 7 ++++++- qmake/library/qmakeglobals.cpp | 4 +++- 6 files changed, 15 insertions(+), 6 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index a596474669..d896d04e9d 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1952,7 +1952,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) char buff[256]; QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, tmp_out, LocalShell); dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd); - if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { + if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) { QString indeps; while(!feof(proc)) { int read_in = (int)fread(buff, 1, 255, proc); @@ -2044,7 +2044,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) char buff[256]; QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, out, LocalShell); dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd); - if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { + if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) { QString indeps; while(!feof(proc)) { int read_in = (int)fread(buff, 1, 255, proc); diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 19ff5d57a3..e121f4fb14 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -46,9 +46,11 @@ QT_BEGIN_NAMESPACE #ifdef Q_OS_WIN32 #define QT_POPEN _popen +#define QT_POPEN_READ "rb" #define QT_PCLOSE _pclose #else #define QT_POPEN popen +#define QT_POPEN_READ "r" #define QT_PCLOSE pclose #endif diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index f26dbbc40b..7fd748e39c 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -2327,7 +2327,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) dep_cmd.prepend(QLatin1String("cd ") + Project->escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + QLatin1String(" && ")); - if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { + if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) { QString indeps; while(!feof(proc)) { int read_in = (int)fread(buff, 1, 255, proc); diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index d1fa6efbfb..5e3e11fd5c 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1618,7 +1618,7 @@ void VcprojGenerator::initResourceFiles() dep_cmd.prepend(QLatin1String("cd ") + escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + QLatin1String(" && ")); - if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { + if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) { QString indeps; while(!feof(proc)) { int read_in = (int)fread(buff, 1, 255, proc); diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index 02cd8a2760..e200c7c551 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -72,9 +72,11 @@ #ifdef Q_OS_WIN32 #define QT_POPEN _popen +#define QT_POPEN_READ "rb" #define QT_PCLOSE _pclose #else #define QT_POPEN popen +#define QT_POPEN_READ "r" #define QT_PCLOSE pclose #endif @@ -413,7 +415,7 @@ QByteArray QMakeEvaluator::getCommandOutput(const QString &args) const #else if (FILE *proc = QT_POPEN(QString(QLatin1String("cd ") + IoUtils::shellQuote(QDir::toNativeSeparators(currentDirectory())) - + QLatin1String(" && ") + args).toLocal8Bit().constData(), "r")) { + + QLatin1String(" && ") + args).toLocal8Bit().constData(), QT_POPEN_READ)) { while (!feof(proc)) { char buff[10 * 1024]; int read_in = int(fread(buff, 1, sizeof(buff), proc)); @@ -423,6 +425,9 @@ QByteArray QMakeEvaluator::getCommandOutput(const QString &args) const } QT_PCLOSE(proc); } +# ifdef Q_OS_WIN + out.replace("\r\n", "\n"); +# endif #endif return out; } diff --git a/qmake/library/qmakeglobals.cpp b/qmake/library/qmakeglobals.cpp index 8bb5199519..9d5d5fbac5 100644 --- a/qmake/library/qmakeglobals.cpp +++ b/qmake/library/qmakeglobals.cpp @@ -64,9 +64,11 @@ #ifdef Q_OS_WIN32 #define QT_POPEN _popen +#define QT_POPEN_READ "rb" #define QT_PCLOSE _pclose #else #define QT_POPEN popen +#define QT_POPEN_READ "r" #define QT_PCLOSE pclose #endif @@ -307,7 +309,7 @@ bool QMakeGlobals::initProperties() data = proc.readAll(); #else if (FILE *proc = QT_POPEN(QString(QMakeInternal::IoUtils::shellQuote(qmake_abslocation) - + QLatin1String(" -query")).toLocal8Bit(), "r")) { + + QLatin1String(" -query")).toLocal8Bit(), QT_POPEN_READ)) { char buff[1024]; while (!feof(proc)) data.append(buff, int(fread(buff, 1, 1023, proc))); -- cgit v1.2.3