Differential D11136 Diff 29007 plugins/custom-definesandincludes/compilerprovider/compilerfactories.cpp
Changeset View
Changeset View
Standalone View
Standalone View
plugins/custom-definesandincludes/compilerprovider/compilerfactories.cpp
Show All 26 Lines | |||||
27 | #include "gcclikecompiler.h" | 27 | #include "gcclikecompiler.h" | ||
28 | #include "msvccompiler.h" | 28 | #include "msvccompiler.h" | ||
29 | 29 | | |||
30 | QString ClangFactory::name() const | 30 | QString ClangFactory::name() const | ||
31 | { | 31 | { | ||
32 | return QStringLiteral("Clang"); | 32 | return QStringLiteral("Clang"); | ||
33 | } | 33 | } | ||
34 | 34 | | |||
35 | bool ClangFactory::isSupported(const KDevelop::Path& path) const | ||||
36 | { | ||||
37 | return path.lastPathSegment().contains(QLatin1String("clang")); | ||||
38 | } | ||||
39 | | ||||
35 | CompilerPointer ClangFactory::createCompiler(const QString& name, const QString& path, bool editable ) const | 40 | CompilerPointer ClangFactory::createCompiler(const QString& name, const QString& path, bool editable ) const | ||
36 | { | 41 | { | ||
37 | return CompilerPointer(new GccLikeCompiler(name, path, editable, this->name())); | 42 | return CompilerPointer(new GccLikeCompiler(name, path, editable, this->name())); | ||
38 | } | 43 | } | ||
39 | 44 | | |||
40 | void ClangFactory::registerDefaultCompilers(CompilerProvider* provider) const | 45 | void ClangFactory::registerDefaultCompilers(CompilerProvider* provider) const | ||
41 | { | 46 | { | ||
42 | const QString clang = QStringLiteral("clang"); | 47 | const QString clang = QStringLiteral("clang"); | ||
43 | 48 | | |||
44 | auto compiler = createCompiler(name(), clang, false); | 49 | auto compiler = createCompiler(name(), clang, false); | ||
45 | provider->registerCompiler(compiler); | 50 | provider->registerCompiler(compiler); | ||
46 | } | 51 | } | ||
47 | 52 | | |||
48 | QString GccFactory::name() const | 53 | QString GccFactory::name() const | ||
49 | { | 54 | { | ||
50 | return QStringLiteral("GCC"); | 55 | return QStringLiteral("GCC"); | ||
51 | } | 56 | } | ||
52 | 57 | | |||
58 | bool GccFactory::isSupported(const KDevelop::Path& path) const | ||||
59 | { | ||||
60 | return path.lastPathSegment().contains(QLatin1String("gcc")) || path.lastPathSegment().contains(QLatin1String("g++")); | ||||
61 | } | ||||
62 | | ||||
53 | CompilerPointer GccFactory::createCompiler(const QString& name, const QString& path, bool editable ) const | 63 | CompilerPointer GccFactory::createCompiler(const QString& name, const QString& path, bool editable ) const | ||
54 | { | 64 | { | ||
55 | return CompilerPointer(new GccLikeCompiler(name, path, editable, this->name())); | 65 | return CompilerPointer(new GccLikeCompiler(name, path, editable, this->name())); | ||
56 | } | 66 | } | ||
57 | 67 | | |||
58 | void GccFactory::registerDefaultCompilers(CompilerProvider* provider) const | 68 | void GccFactory::registerDefaultCompilers(CompilerProvider* provider) const | ||
59 | { | 69 | { | ||
60 | const QString gcc = QStringLiteral("gcc"); | 70 | const QString gcc = QStringLiteral("gcc"); | ||
Show All 11 Lines | |||||
72 | { | 82 | { | ||
73 | return CompilerPointer(new MsvcCompiler(name, path, editable, this->name())); | 83 | return CompilerPointer(new MsvcCompiler(name, path, editable, this->name())); | ||
74 | } | 84 | } | ||
75 | 85 | | |||
76 | void MsvcFactory::registerDefaultCompilers(CompilerProvider* provider) const | 86 | void MsvcFactory::registerDefaultCompilers(CompilerProvider* provider) const | ||
77 | { | 87 | { | ||
78 | provider->registerCompiler(createCompiler(name(), QStringLiteral("cl.exe"), false)); | 88 | provider->registerCompiler(createCompiler(name(), QStringLiteral("cl.exe"), false)); | ||
79 | } | 89 | } | ||
90 | | ||||
91 | bool MsvcFactory::isSupported(const KDevelop::Path& path) const | ||||
92 | { | ||||
93 | return path.lastPathSegment() == QLatin1String("cl.exe"); | ||||
94 | } |