| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
| 3 | |
| 4 | #ifndef MSVC_VCPROJ_H |
| 5 | #define MSVC_VCPROJ_H |
| 6 | |
| 7 | #include "winmakefile.h" |
| 8 | #include "msvc_objectmodel.h" |
| 9 | |
| 10 | QT_BEGIN_NAMESPACE |
| 11 | |
| 12 | enum Target { |
| 13 | Application, |
| 14 | SharedLib, |
| 15 | StaticLib |
| 16 | }; |
| 17 | |
| 18 | class QUuid; |
| 19 | struct VcsolutionDepend; |
| 20 | class VcprojGenerator : public Win32MakefileGenerator |
| 21 | { |
| 22 | bool is64Bit; |
| 23 | bool writeVcprojParts(QTextStream &); |
| 24 | |
| 25 | bool writeMakefile(QTextStream &) override; |
| 26 | bool writeProjectMakefile() override; |
| 27 | |
| 28 | void init() override; |
| 29 | |
| 30 | public: |
| 31 | VcprojGenerator(); |
| 32 | ~VcprojGenerator(); |
| 33 | |
| 34 | QString defaultMakefile() const; |
| 35 | QString precompH, precompHFilename, precompSource, |
| 36 | precompObj, precompPch; |
| 37 | bool autogenPrecompSource; |
| 38 | static bool hasBuiltinCompiler(const QString &file); |
| 39 | |
| 40 | QHash<QString, QStringList> ; |
| 41 | QHash<QString, QString> ; |
| 42 | const QString customBuildToolFilterFileSuffix; |
| 43 | bool usePCH; |
| 44 | bool pchIsCFile = false; |
| 45 | VCProjectWriter *projectWriter; |
| 46 | |
| 47 | using Win32MakefileGenerator::callExtraCompilerDependCommand; |
| 48 | |
| 49 | protected: |
| 50 | virtual VCProjectWriter *createProjectWriter(); |
| 51 | bool doDepends() const override { return false; } // Never necessary |
| 52 | using Win32MakefileGenerator::replaceExtraCompilerVariables; |
| 53 | QString (const QString &, const QStringList &, const QStringList &, ReplaceFor) override; |
| 54 | QString (const ProString &, const QStringList &inputs, |
| 55 | const QStringList &outputs); |
| 56 | bool supportsMetaBuild() override { return true; } |
| 57 | bool supportsMergedBuilds() override { return true; } |
| 58 | bool mergeBuildProject(MakefileGenerator *other) override; |
| 59 | |
| 60 | bool openOutput(QFile &file, const QString &build) const override; |
| 61 | |
| 62 | virtual void initProject(); |
| 63 | void initConfiguration(); |
| 64 | void initCompilerTool(); |
| 65 | void initLinkerTool(); |
| 66 | void initLibrarianTool(); |
| 67 | void initManifestTool(); |
| 68 | void initResourceTool(); |
| 69 | void initIDLTool(); |
| 70 | void initCustomBuildTool(); |
| 71 | void initPreBuildEventTools(); |
| 72 | void initPostBuildEventTools(); |
| 73 | void initDeploymentTool(); |
| 74 | void initWinDeployQtTool(); |
| 75 | void initPreLinkEventTools(); |
| 76 | void initRootFiles(); |
| 77 | void initSourceFiles(); |
| 78 | void (); |
| 79 | void initGeneratedFiles(); |
| 80 | void initTranslationFiles(); |
| 81 | void initFormFiles(); |
| 82 | void initResourceFiles(); |
| 83 | void initDeploymentFiles(); |
| 84 | void initDistributionFiles(); |
| 85 | void initLexYaccFiles(); |
| 86 | void (); |
| 87 | |
| 88 | void writeSubDirs(QTextStream &t); // Called from VCXProj backend |
| 89 | QUuid getProjectUUID(const QString &filename=QString()); // Called from VCXProj backend |
| 90 | |
| 91 | Target projectTarget; |
| 92 | |
| 93 | // Used for single project |
| 94 | VCProjectSingleConfig vcProject; |
| 95 | |
| 96 | // Holds all configurations for glue (merged) project |
| 97 | QList<VcprojGenerator*> mergedProjects; |
| 98 | |
| 99 | private: |
| 100 | ProStringList collectDependencies(QMakeProject *proj, QHash<QString, QString> &projLookup, |
| 101 | QHash<QString, QString> &projGuids, |
| 102 | QHash<VcsolutionDepend *, QStringList> &, |
| 103 | QHash<QString, VcsolutionDepend*> &solution_depends, |
| 104 | QList<VcsolutionDepend*> &solution_cleanup, |
| 105 | QTextStream &t, |
| 106 | QHash<QString, ProStringList> &subdirProjectLookup, |
| 107 | const ProStringList &allDependencies = ProStringList()); |
| 108 | QUuid increaseUUID(const QUuid &id); |
| 109 | QString retrievePlatformToolSet() const; |
| 110 | bool isStandardSuffix(const QString &suffix) const; |
| 111 | ProString firstInputFileName(const ProString &) const; |
| 112 | QString firstExpandedOutputFileName(const ProString &); |
| 113 | void createCustomBuildToolFakeFile(const QString &cbtFilePath, const QString &realOutFilePath); |
| 114 | bool otherFiltersContain(const QString &fileName) const; |
| 115 | friend class VCFilter; |
| 116 | }; |
| 117 | |
| 118 | inline QString VcprojGenerator::defaultMakefile() const |
| 119 | { |
| 120 | return project->first(variableName: "TARGET" ) + project->first(variableName: "VCPROJ_EXTENSION" ); |
| 121 | } |
| 122 | |
| 123 | QT_END_NAMESPACE |
| 124 | |
| 125 | #endif // MSVC_VCPROJ_H |
| 126 | |