| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** Contact: Qt Software Information ([email protected])
|
|---|
| 5 | **
|
|---|
| 6 | ** This file is part of the qmake application of the Qt Toolkit.
|
|---|
| 7 | **
|
|---|
| 8 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 9 | ** Commercial Usage
|
|---|
| 10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 11 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 12 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 13 | ** a written agreement between you and Nokia.
|
|---|
| 14 | **
|
|---|
| 15 | ** GNU Lesser General Public License Usage
|
|---|
| 16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 17 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 19 | ** packaging of this file. Please review the following information to
|
|---|
| 20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 22 | **
|
|---|
| 23 | ** In addition, as a special exception, Nokia gives you certain
|
|---|
| 24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
|---|
| 25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
|---|
| 26 | ** package.
|
|---|
| 27 | **
|
|---|
| 28 | ** GNU General Public License Usage
|
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ** packaging of this file. Please review the following information to
|
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | **
|
|---|
| 36 | ** If you are unsure which license is appropriate for your use, please
|
|---|
| 37 | ** contact the sales department at [email protected].
|
|---|
| 38 | ** $QT_END_LICENSE$
|
|---|
| 39 | **
|
|---|
| 40 | ****************************************************************************/
|
|---|
| 41 |
|
|---|
| 42 | #ifndef MSVC_VCPROJ_H
|
|---|
| 43 | #define MSVC_VCPROJ_H
|
|---|
| 44 |
|
|---|
| 45 | #include "winmakefile.h"
|
|---|
| 46 | #include "msvc_objectmodel.h"
|
|---|
| 47 |
|
|---|
| 48 | QT_BEGIN_NAMESPACE
|
|---|
| 49 |
|
|---|
| 50 | enum Target {
|
|---|
| 51 | Application,
|
|---|
| 52 | SharedLib,
|
|---|
| 53 | StaticLib
|
|---|
| 54 | };
|
|---|
| 55 |
|
|---|
| 56 | struct QUuid;
|
|---|
| 57 | class VcprojGenerator : public Win32MakefileGenerator
|
|---|
| 58 | {
|
|---|
| 59 | bool init_flag;
|
|---|
| 60 | bool writeVcprojParts(QTextStream &);
|
|---|
| 61 |
|
|---|
| 62 | bool writeMakefile(QTextStream &);
|
|---|
| 63 | bool writeProjectMakefile();
|
|---|
| 64 | void writeSubDirs(QTextStream &t);
|
|---|
| 65 |
|
|---|
| 66 | QString findTemplate(QString file);
|
|---|
| 67 | void init();
|
|---|
| 68 |
|
|---|
| 69 | public:
|
|---|
| 70 | VcprojGenerator();
|
|---|
| 71 | ~VcprojGenerator();
|
|---|
| 72 |
|
|---|
| 73 | QString defaultMakefile() const;
|
|---|
| 74 | QString precompH, precompHFilename, precompCPP,
|
|---|
| 75 | precompObj, precompPch;
|
|---|
| 76 | bool autogenPrecompCPP;
|
|---|
| 77 | static bool hasBuiltinCompiler(const QString &file);
|
|---|
| 78 |
|
|---|
| 79 | QMap<QString, QStringList> extraCompilerSources;
|
|---|
| 80 | QMap<QString, QStringList> extraCompilerOutputs;
|
|---|
| 81 | bool usePCH;
|
|---|
| 82 |
|
|---|
| 83 | protected:
|
|---|
| 84 | virtual bool doDepends() const { return false; } //never necesary
|
|---|
| 85 | virtual void processSources() { filterIncludedFiles("SOURCES"); filterIncludedFiles("GENERATED_SOURCES"); }
|
|---|
| 86 | virtual QString replaceExtraCompilerVariables(const QString &, const QStringList &, const QStringList &);
|
|---|
| 87 | inline QString replaceExtraCompilerVariables(const QString &val, const QString &in, const QString &out)
|
|---|
| 88 | { return MakefileGenerator::replaceExtraCompilerVariables(val, in, out); }
|
|---|
| 89 | virtual bool supportsMetaBuild() { return true; }
|
|---|
| 90 | virtual bool supportsMergedBuilds() { return true; }
|
|---|
| 91 | virtual bool mergeBuildProject(MakefileGenerator *other);
|
|---|
| 92 |
|
|---|
| 93 | virtual bool openOutput(QFile &file, const QString &build) const;
|
|---|
| 94 | virtual void processPrlVariable(const QString &, const QStringList &);
|
|---|
| 95 | virtual bool findLibraries();
|
|---|
| 96 | virtual void outputVariables();
|
|---|
| 97 | QString fixFilename(QString ofile) const;
|
|---|
| 98 |
|
|---|
| 99 | void initOld();
|
|---|
| 100 | virtual void initProject();
|
|---|
| 101 | void initConfiguration();
|
|---|
| 102 | void initCompilerTool();
|
|---|
| 103 | void initLinkerTool();
|
|---|
| 104 | void initLibrarianTool();
|
|---|
| 105 | void initResourceTool();
|
|---|
| 106 | void initIDLTool();
|
|---|
| 107 | void initCustomBuildTool();
|
|---|
| 108 | void initPreBuildEventTools();
|
|---|
| 109 | void initPostBuildEventTools();
|
|---|
| 110 | void initDeploymentTool();
|
|---|
| 111 | void initPreLinkEventTools();
|
|---|
| 112 | void initRootFiles();
|
|---|
| 113 | void initSourceFiles();
|
|---|
| 114 | void initHeaderFiles();
|
|---|
| 115 | void initGeneratedFiles();
|
|---|
| 116 | void initTranslationFiles();
|
|---|
| 117 | void initFormFiles();
|
|---|
| 118 | void initResourceFiles();
|
|---|
| 119 | void initLexYaccFiles();
|
|---|
| 120 | void initExtraCompilerOutputs();
|
|---|
| 121 |
|
|---|
| 122 | Target projectTarget;
|
|---|
| 123 |
|
|---|
| 124 | // Used for single project
|
|---|
| 125 | VCProjectSingleConfig vcProject;
|
|---|
| 126 |
|
|---|
| 127 | // Holds all configurations for glue (merged) project
|
|---|
| 128 | QList<VcprojGenerator*> mergedProjects;
|
|---|
| 129 |
|
|---|
| 130 | private:
|
|---|
| 131 | QString fixCommandLine(DotNET version, const QString &input) const;
|
|---|
| 132 | QUuid getProjectUUID(const QString &filename=QString());
|
|---|
| 133 | QUuid increaseUUID(const QUuid &id);
|
|---|
| 134 | friend class VCFilter;
|
|---|
| 135 | };
|
|---|
| 136 |
|
|---|
| 137 | inline VcprojGenerator::~VcprojGenerator()
|
|---|
| 138 | { }
|
|---|
| 139 |
|
|---|
| 140 | inline QString VcprojGenerator::defaultMakefile() const
|
|---|
| 141 | {
|
|---|
| 142 | return project->first("TARGET") + project->first("VCPROJ_EXTENSION");
|
|---|
| 143 | }
|
|---|
| 144 |
|
|---|
| 145 | inline bool VcprojGenerator::findLibraries()
|
|---|
| 146 | {
|
|---|
| 147 | return Win32MakefileGenerator::findLibraries("MSVCPROJ_LIBS");
|
|---|
| 148 | }
|
|---|
| 149 |
|
|---|
| 150 | QT_END_NAMESPACE
|
|---|
| 151 |
|
|---|
| 152 | #endif // MSVC_VCPROJ_H
|
|---|