BuildOutputParser: Make MSVC parser available on non-Windows platforms

Change-Id: If48e4fa361f3c306edf5dbfa129cc8a2e38abf53
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Andre Hartmann
2018-03-07 18:21:34 +01:00
committed by André Hartmann
parent 28a1ef8bab
commit 10b5e8dc52
5 changed files with 4 additions and 22 deletions

View File

@@ -6,8 +6,6 @@ include(../../qtcreatortool.pri)
TARGET = buildoutputparser TARGET = buildoutputparser
win32|equals(TEST, 1):DEFINES += HAS_MSVC_PARSER
SOURCES = \ SOURCES = \
main.cpp \ main.cpp \
outputprocessor.cpp outputprocessor.cpp

View File

@@ -15,6 +15,4 @@ QtcTool {
condition: qbs.targetOS.contains("unix") && !qbs.targetOS.contains("darwin") condition: qbs.targetOS.contains("unix") && !qbs.targetOS.contains("darwin")
cpp.rpaths: base.concat(["$ORIGIN/../" + qtc.ide_plugin_path]) cpp.rpaths: base.concat(["$ORIGIN/../" + qtc.ide_plugin_path])
} }
cpp.defines: base.concat(qbs.targetOS.contains("windows") || qtc.testsEnabled
? ["HAS_MSVC_PARSER"] : [])
} }

View File

@@ -52,13 +52,7 @@ static void printUsage()
{ {
fprintf(stderr, "Usage: %s [--type <compiler type>] <file>\n", fprintf(stderr, "Usage: %s [--type <compiler type>] <file>\n",
qPrintable(QFileInfo(QCoreApplication::applicationFilePath()).fileName())); qPrintable(QFileInfo(QCoreApplication::applicationFilePath()).fileName()));
fprintf(stderr, "Possible compiler types: gcc, clang%s. Default is gcc.\n", fprintf(stderr, "Possible compiler types: gcc, clang, msvc. Default is gcc.\n");
#ifdef HAS_MSVC_PARSER
", msvc"
#else
""
#endif
);
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@@ -83,10 +77,8 @@ int main(int argc, char *argv[])
compilerType = CompilerTypeGcc; compilerType = CompilerTypeGcc;
} else if (typeString == QLatin1String("clang")) { } else if (typeString == QLatin1String("clang")) {
compilerType = CompilerTypeClang; compilerType = CompilerTypeClang;
#ifdef HAS_MSVC_PARSER
} else if (typeString == QLatin1String("msvc")) { } else if (typeString == QLatin1String("msvc")) {
compilerType = CompilerTypeMsvc; compilerType = CompilerTypeMsvc;
#endif
} else { } else {
fprintf(stderr, "Invalid compiler type '%s'.\n", qPrintable(typeString)); fprintf(stderr, "Invalid compiler type '%s'.\n", qPrintable(typeString));
printUsage(); printUsage();

View File

@@ -28,14 +28,12 @@
#include <projectexplorer/clangparser.h> #include <projectexplorer/clangparser.h>
#include <projectexplorer/gccparser.h> #include <projectexplorer/gccparser.h>
#include <projectexplorer/gnumakeparser.h> #include <projectexplorer/gnumakeparser.h>
#include <projectexplorer/msvcparser.h>
#include <projectexplorer/osparser.h> #include <projectexplorer/osparser.h>
#include <qmakeprojectmanager/qmakeparser.h> #include <qmakeprojectmanager/qmakeparser.h>
#include <qtsupport/qtparser.h> #include <qtsupport/qtparser.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#ifdef HAS_MSVC_PARSER
#include <projectexplorer/msvcparser.h>
#endif
#include <QIODevice> #include <QIODevice>
#include <QTextStream> #include <QTextStream>
@@ -67,11 +65,9 @@ void CompilerOutputProcessor::start()
case CompilerTypeClang: case CompilerTypeClang:
parser.appendOutputParser(new ProjectExplorer::ClangParser); parser.appendOutputParser(new ProjectExplorer::ClangParser);
break; break;
#ifdef HAS_MSVC_PARSER
case CompilerTypeMsvc: case CompilerTypeMsvc:
parser.appendOutputParser(new ProjectExplorer::MsvcParser); parser.appendOutputParser(new ProjectExplorer::MsvcParser);
break; break;
#endif
} }
connect(&parser, &ProjectExplorer::IOutputParser::addTask, connect(&parser, &ProjectExplorer::IOutputParser::addTask,

View File

@@ -34,10 +34,8 @@ namespace ProjectExplorer { class Task; }
enum CompilerType { enum CompilerType {
CompilerTypeGcc, CompilerTypeGcc,
CompilerTypeClang CompilerTypeClang,
#ifdef HAS_MSVC_PARSER CompilerTypeMsvc
, CompilerTypeMsvc
#endif
}; };
class CompilerOutputProcessor : public QObject class CompilerOutputProcessor : public QObject