Diffstat (limited to 'qmake/generators/win32/msvc_vcproj.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.cpp | 712 |
1 files changed, 480 insertions, 232 deletions
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index d2cbc31..aa8fe16 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp | |||
@@ -1,785 +1,1026 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of VcprojGenerator class. | 4 | ** Implementation of VcprojGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | 35 | ||
38 | #include "msvc_vcproj.h" | 36 | #include "msvc_vcproj.h" |
39 | #include "option.h" | 37 | #include "option.h" |
38 | #include "qtmd5.h" // SG's MD5 addon | ||
40 | #include <qdir.h> | 39 | #include <qdir.h> |
41 | #include <qregexp.h> | 40 | #include <qregexp.h> |
42 | #include <qdict.h> | 41 | #include <qdict.h> |
43 | #include <quuid.h> | 42 | #include <quuid.h> |
44 | #include <stdlib.h> | 43 | #include <stdlib.h> |
44 | #include <qsettings.h> | ||
45 | |||
46 | //#define DEBUG_SOLUTION_GEN | ||
47 | //#define DEBUG_PROJECT_GEN | ||
48 | |||
49 | // Registry keys for .NET version detection ------------------------- | ||
50 | const char* _regNet2002 = "Microsoft\\VisualStudio\\7.0\\Setup\\VC\\ProductDir"; | ||
51 | const char* _regNet2003 = "Microsoft\\VisualStudio\\7.1\\Setup\\VC\\ProductDir"; | ||
45 | 52 | ||
46 | #if defined(Q_OS_WIN32) | 53 | bool use_net2003_version() |
47 | #include <objbase.h> | ||
48 | #ifndef GUID_DEFINED | ||
49 | #define GUID_DEFINED | ||
50 | typedef struct _GUID | ||
51 | { | 54 | { |
52 | ulong Data1; | 55 | #ifndef Q_OS_WIN32 |
53 | ushort Data2; | 56 | return FALSE; // Always generate 7.0 versions on other platforms |
54 | ushort Data3; | 57 | #else |
55 | uchar Data4[8]; | 58 | // Only search for the version once |
56 | } GUID; | 59 | static int current_version = -1; |
57 | #endif | 60 | if (current_version!=-1) |
61 | return (current_version==71); | ||
62 | |||
63 | // Fallback to .NET 2002 | ||
64 | current_version = 70; | ||
65 | |||
66 | // Get registry entries for both versions | ||
67 | bool ok = false; | ||
68 | QSettings setting; | ||
69 | QString path2002 = setting.readEntry(_regNet2002); | ||
70 | QString path2003 = setting.readEntry(_regNet2003); | ||
71 | |||
72 | if ( path2002.isNull() || path2003.isNull() ) { | ||
73 | // Only have one MSVC, so use that one | ||
74 | current_version = (path2003.isNull() ? 70 : 71); | ||
75 | } else { | ||
76 | // Have both, so figure out the current | ||
77 | QString paths = getenv("PATH"); | ||
78 | QStringList pathlist = QStringList::split(";", paths.lower()); | ||
79 | |||
80 | path2003 = path2003.lower(); | ||
81 | QStringList::iterator it; | ||
82 | for(it=pathlist.begin(); it!=pathlist.end(); ++it) { | ||
83 | if ((*it).contains(path2003)) { | ||
84 | current_version = 71; | ||
85 | } else if ((*it).contains(path2002) | ||
86 | && current_version == 71) { | ||
87 | fprintf( stderr, "Both .NET 2002 & .NET 2003 directories for VC found in you PATH variable!\nFallback to .NET 2002 project generation" ); | ||
88 | current_version = 70; | ||
89 | break; | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | return (current_version==71); | ||
58 | #endif | 94 | #endif |
95 | }; | ||
59 | 96 | ||
60 | // Flatfile Tags ---------------------------------------------------- | 97 | // Flatfile Tags ---------------------------------------------------- |
61 | const char* _snlHeader = "Microsoft Visual Studio Solution File, Format Version 7.00"; | 98 | const char* _slnHeader70= "Microsoft Visual Studio Solution File, Format Version 7.00"; |
99 | const char* _slnHeader71= "Microsoft Visual Studio Solution File, Format Version 8.00"; | ||
62 | // The following UUID _may_ change for later servicepacks... | 100 | // The following UUID _may_ change for later servicepacks... |
63 | // If so we need to search through the registry at | 101 | // If so we need to search through the registry at |
64 | // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\Projects | 102 | // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\Projects |
65 | // to find the subkey that contains a "PossibleProjectExtension" | 103 | // to find the subkey that contains a "PossibleProjectExtension" |
66 | // containing "vcproj"... | 104 | // containing "vcproj"... |
67 | // Use the hardcoded value for now so projects generated on other | 105 | // Use the hardcoded value for now so projects generated on other |
68 | // platforms are actually usable. | 106 | // platforms are actually usable. |
69 | const char* _snlMSVCvcprojGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"; | 107 | const char* _slnMSVCvcprojGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"; |
70 | const char* _snlProjectBeg= "\nProject(\""; | 108 | const char* _slnProjectBeg= "\nProject(\""; |
71 | const char* _snlProjectMid= "\") = "; | 109 | const char* _slnProjectMid= "\") = "; |
72 | const char* _snlProjectEnd= "\nEndProject"; | 110 | const char* _slnProjectEnd= "\nEndProject"; |
73 | const char* _snlGlobalBeg= "\nGlobal"; | 111 | const char* _slnGlobalBeg= "\nGlobal"; |
74 | const char* _snlGlobalEnd= "\nEndGlobal"; | 112 | const char* _slnGlobalEnd= "\nEndGlobal"; |
75 | const char* _snlSolutionConf= "\n\tGlobalSection(SolutionConfiguration) = preSolution" | 113 | const char* _slnSolutionConf= "\n\tGlobalSection(SolutionConfiguration) = preSolution" |
76 | "\n\t\tConfigName.0 = Release" | 114 | "\n\t\tConfigName.0 = Debug" |
115 | "\n\t\tConfigName.1 = Release" | ||
77 | "\n\tEndGlobalSection"; | 116 | "\n\tEndGlobalSection"; |
78 | const char* _snlProjDepBeg= "\n\tGlobalSection(ProjectDependencies) = postSolution"; | 117 | const char* _slnProjDepBeg= "\n\tGlobalSection(ProjectDependencies) = postSolution"; |
79 | const char* _snlProjDepEnd= "\n\tEndGlobalSection"; | 118 | const char* _slnProjDepEnd= "\n\tEndGlobalSection"; |
80 | const char* _snlProjConfBeg= "\n\tGlobalSection(ProjectConfiguration) = postSolution"; | 119 | const char* _slnProjConfBeg= "\n\tGlobalSection(ProjectConfiguration) = postSolution"; |
81 | const char* _snlProjConfTag1= ".Release.ActiveCfg = Release|Win32"; | 120 | const char* _slnProjRelConfTag1= ".Release.ActiveCfg = Release|Win32"; |
82 | const char* _snlProjConfTag2= ".Release.Build.0 = Release|Win32"; | 121 | const char* _slnProjRelConfTag2= ".Release.Build.0 = Release|Win32"; |
83 | const char* _snlProjConfEnd= "\n\tEndGlobalSection"; | 122 | const char* _slnProjDbgConfTag1= ".Debug.ActiveCfg = Debug|Win32"; |
84 | const char* _snlExtSections= "\n\tGlobalSection(ExtensibilityGlobals) = postSolution" | 123 | const char* _slnProjDbgConfTag2= ".Debug.Build.0 = Debug|Win32"; |
124 | const char* _slnProjConfEnd= "\n\tEndGlobalSection"; | ||
125 | const char* _slnExtSections= "\n\tGlobalSection(ExtensibilityGlobals) = postSolution" | ||
85 | "\n\tEndGlobalSection" | 126 | "\n\tEndGlobalSection" |
86 | "\n\tGlobalSection(ExtensibilityAddIns) = postSolution" | 127 | "\n\tGlobalSection(ExtensibilityAddIns) = postSolution" |
87 | "\n\tEndGlobalSection"; | 128 | "\n\tEndGlobalSection"; |
88 | // ------------------------------------------------------------------ | 129 | // ------------------------------------------------------------------ |
89 | 130 | ||
90 | VcprojGenerator::VcprojGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) | 131 | VcprojGenerator::VcprojGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) |
91 | { | 132 | { |
92 | } | 133 | } |
93 | 134 | ||
94 | /* \internal | 135 | /* \internal |
95 | Generates a project file for the given profile. | 136 | Generates a project file for the given profile. |
96 | Options are either a Visual Studio projectfiles, or | 137 | Options are either a Visual Studio projectfiles, or |
97 | solutionfiles by parsing recursive projectdirectories. | 138 | solutionfiles by parsing recursive projectdirectories. |
98 | */ | 139 | */ |
99 | bool VcprojGenerator::writeMakefile(QTextStream &t) | 140 | bool VcprojGenerator::writeMakefile(QTextStream &t) |
100 | { | 141 | { |
101 | // Check if all requirements are fullfilled | 142 | // Check if all requirements are fullfilled |
102 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 143 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
103 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", | 144 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", |
104 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); | 145 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); |
105 | return TRUE; | 146 | return TRUE; |
106 | } | 147 | } |
107 | 148 | ||
108 | // Generate project file | 149 | // Generate project file |
109 | if(project->first("TEMPLATE") == "vcapp" || | 150 | if(project->first("TEMPLATE") == "vcapp" || |
110 | project->first("TEMPLATE") == "vclib") { | 151 | project->first("TEMPLATE") == "vclib") { |
111 | debug_msg(1, "Generator: MSVC.NET: Writing project file" ); | 152 | debug_msg(1, "Generator: MSVC.NET: Writing project file" ); |
112 | t << vcProject; | 153 | t << vcProject; |
113 | return TRUE; | 154 | return TRUE; |
114 | } | 155 | } |
115 | // Generate solution file | 156 | // Generate solution file |
116 | else if(project->first("TEMPLATE") == "vcsubdirs") { | 157 | else if(project->first("TEMPLATE") == "vcsubdirs") { |
117 | debug_msg(1, "Generator: MSVC.NET: Writing solution file" ); | 158 | debug_msg(1, "Generator: MSVC.NET: Writing solution file" ); |
118 | writeSubDirs(t); | 159 | writeSubDirs(t); |
119 | return TRUE; | 160 | return TRUE; |
120 | } | 161 | } |
121 | return FALSE; | 162 | return FALSE; |
122 | 163 | ||
123 | } | 164 | } |
124 | 165 | ||
125 | struct VcsolutionDepend { | 166 | struct VcsolutionDepend { |
126 | QString uuid; | 167 | QString uuid; |
127 | QString vcprojFile, orig_target, target; | 168 | QString vcprojFile, orig_target, target; |
128 | ::target targetType; | 169 | ::target targetType; |
170 | bool debugBuild; | ||
129 | QStringList dependencies; | 171 | QStringList dependencies; |
130 | }; | 172 | }; |
131 | 173 | ||
174 | QUuid VcprojGenerator::getProjectUUID(const QString &filename) | ||
175 | { | ||
176 | bool validUUID = true; | ||
177 | |||
178 | // Read GUID from variable-space | ||
179 | QUuid uuid = project->first("GUID"); | ||
180 | |||
181 | // If none, create one based on the MD5 of absolute project path | ||
182 | if (uuid.isNull() || !filename.isNull()) { | ||
183 | QString abspath = filename.isNull()?project->first("QMAKE_MAKEFILE"):filename; | ||
184 | qtMD5(abspath.utf8(), (unsigned char*)(&uuid)); | ||
185 | validUUID = !uuid.isNull(); | ||
186 | uuid.data4[0] = (uuid.data4[0] & 0x3F) | 0x80; // UV_DCE variant | ||
187 | uuid.data3 = (uuid.data3 & 0x0FFF) | (QUuid::Name<<12); | ||
188 | } | ||
189 | |||
190 | // If still not valid, generate new one, and suggest adding to .pro | ||
191 | if (uuid.isNull() || !validUUID) { | ||
192 | uuid = QUuid::createUuid(); | ||
193 | fprintf(stderr, | ||
194 | "qmake couldn't create a GUID based on filepath, and we couldn't\nfind a valid GUID in the .pro file (Consider adding\n'GUID = %s' to the .pro file)\n", | ||
195 | uuid.toString().upper().latin1()); | ||
196 | } | ||
197 | |||
198 | // Store GUID in variable-space | ||
199 | project->values("GUID") = uuid.toString().upper(); | ||
200 | return uuid; | ||
201 | } | ||
202 | |||
132 | QUuid VcprojGenerator::increaseUUID( const QUuid &id ) | 203 | QUuid VcprojGenerator::increaseUUID( const QUuid &id ) |
133 | { | 204 | { |
134 | QUuid result( id ); | 205 | QUuid result( id ); |
135 | Q_LONG dataFirst = (result.data4[0] << 24) + | 206 | Q_LONG dataFirst = (result.data4[0] << 24) + |
136 | (result.data4[1] << 16) + | 207 | (result.data4[1] << 16) + |
137 | (result.data4[2] << 8) + | 208 | (result.data4[2] << 8) + |
138 | result.data4[3]; | 209 | result.data4[3]; |
139 | Q_LONG dataLast = (result.data4[4] << 24) + | 210 | Q_LONG dataLast = (result.data4[4] << 24) + |
140 | (result.data4[5] << 16) + | 211 | (result.data4[5] << 16) + |
141 | (result.data4[6] << 8) + | 212 | (result.data4[6] << 8) + |
142 | result.data4[7]; | 213 | result.data4[7]; |
143 | 214 | ||
144 | if ( !(dataLast++) ) | 215 | if ( !(dataLast++) ) |
145 | dataFirst++; | 216 | dataFirst++; |
146 | 217 | ||
147 | result.data4[0] = uchar((dataFirst >> 24) & 0xff); | 218 | result.data4[0] = uchar((dataFirst >> 24) & 0xff); |
148 | result.data4[1] = uchar((dataFirst >> 16) & 0xff); | 219 | result.data4[1] = uchar((dataFirst >> 16) & 0xff); |
149 | result.data4[2] = uchar((dataFirst >> 8) & 0xff); | 220 | result.data4[2] = uchar((dataFirst >> 8) & 0xff); |
150 | result.data4[3] = uchar( dataFirst & 0xff); | 221 | result.data4[3] = uchar( dataFirst & 0xff); |
151 | result.data4[4] = uchar((dataLast >> 24) & 0xff); | 222 | result.data4[4] = uchar((dataLast >> 24) & 0xff); |
152 | result.data4[5] = uchar((dataLast >> 16) & 0xff); | 223 | result.data4[5] = uchar((dataLast >> 16) & 0xff); |
153 | result.data4[6] = uchar((dataLast >> 8) & 0xff); | 224 | result.data4[6] = uchar((dataLast >> 8) & 0xff); |
154 | result.data4[7] = uchar( dataLast & 0xff); | 225 | result.data4[7] = uchar( dataLast & 0xff); |
155 | return result; | 226 | return result; |
156 | } | 227 | } |
157 | 228 | ||
158 | void VcprojGenerator::writeSubDirs(QTextStream &t) | 229 | void VcprojGenerator::writeSubDirs(QTextStream &t) |
159 | { | 230 | { |
160 | if(project->first("TEMPLATE") == "subdirs") { | 231 | if(project->first("TEMPLATE") == "subdirs") { |
161 | writeHeader(t); | 232 | writeHeader(t); |
162 | Win32MakefileGenerator::writeSubDirs(t); | 233 | Win32MakefileGenerator::writeSubDirs(t); |
163 | return; | 234 | return; |
164 | } | 235 | } |
165 | 236 | ||
166 | t << _snlHeader; | 237 | t << (use_net2003_version() ? _slnHeader71 : _slnHeader70); |
167 | QUuid solutionGUID; | ||
168 | #if defined(Q_WS_WIN32) | ||
169 | GUID guid; | ||
170 | HRESULT h = CoCreateGuid( &guid ); | ||
171 | if ( h == S_OK ) | ||
172 | solutionGUID = QUuid( guid ); | ||
173 | #else | ||
174 | // Qt doesn't support GUID on other platforms yet, | ||
175 | // so we use the all-zero uuid, and increase that. | ||
176 | #endif | ||
177 | |||
178 | 238 | ||
179 | QDict<VcsolutionDepend> solution_depends; | 239 | QDict<VcsolutionDepend> solution_depends; |
240 | |||
180 | QPtrList<VcsolutionDepend> solution_cleanup; | 241 | QPtrList<VcsolutionDepend> solution_cleanup; |
181 | solution_cleanup.setAutoDelete(TRUE); | 242 | solution_cleanup.setAutoDelete(TRUE); |
243 | |||
244 | |||
182 | QStringList subdirs = project->variables()["SUBDIRS"]; | 245 | QStringList subdirs = project->variables()["SUBDIRS"]; |
183 | QString oldpwd = QDir::currentDirPath(); | 246 | QString oldpwd = QDir::currentDirPath(); |
247 | |||
184 | for(QStringList::Iterator it = subdirs.begin(); it != subdirs.end(); ++it) { | 248 | for(QStringList::Iterator it = subdirs.begin(); it != subdirs.end(); ++it) { |
185 | QFileInfo fi(Option::fixPathToLocalOS((*it), TRUE)); | 249 | QFileInfo fi(Option::fixPathToLocalOS((*it), TRUE)); |
186 | if(fi.exists()) { | 250 | if(fi.exists()) { |
187 | if(fi.isDir()) { | 251 | if(fi.isDir()) { |
188 | QString profile = (*it); | 252 | QString profile = (*it); |
189 | if(!profile.endsWith(Option::dir_sep)) | 253 | if(!profile.endsWith(Option::dir_sep)) |
190 | profile += Option::dir_sep; | 254 | profile += Option::dir_sep; |
191 | profile += fi.baseName() + ".pro"; | 255 | profile += fi.baseName() + ".pro"; |
192 | subdirs.append(profile); | 256 | subdirs.append(profile); |
193 | } else { | 257 | } else { |
194 | QMakeProject tmp_proj; | 258 | QMakeProject tmp_proj; |
195 | QString dir = fi.dirPath(), fn = fi.fileName(); | 259 | QString dir = fi.dirPath(), fn = fi.fileName(); |
196 | if(!dir.isEmpty()) { | 260 | if(!dir.isEmpty()) { |
197 | if(!QDir::setCurrent(dir)) | 261 | if(!QDir::setCurrent(dir)) |
198 | fprintf(stderr, "Cannot find directory: %s\n", dir.latin1()); | 262 | fprintf(stderr, "Cannot find directory: %s\n", dir.latin1()); |
199 | } | 263 | } |
200 | if(tmp_proj.read(fn, oldpwd)) { | 264 | if(tmp_proj.read(fn, oldpwd)) { |
201 | if(tmp_proj.first("TEMPLATE") == "vcsubdirs") { | 265 | if(tmp_proj.first("TEMPLATE") == "vcsubdirs") { |
202 | QStringList tmp_subdirs = fileFixify(tmp_proj.variables()["SUBDIRS"]); | 266 | subdirs += fileFixify(tmp_proj.variables()["SUBDIRS"]); |
203 | subdirs += tmp_subdirs; | ||
204 | } else if(tmp_proj.first("TEMPLATE") == "vcapp" || tmp_proj.first("TEMPLATE") == "vclib") { | 267 | } else if(tmp_proj.first("TEMPLATE") == "vcapp" || tmp_proj.first("TEMPLATE") == "vclib") { |
205 | // Initialize a 'fake' project to get the correct variables | 268 | // Initialize a 'fake' project to get the correct variables |
206 | // and to be able to extract all the dependencies | 269 | // and to be able to extract all the dependencies |
207 | VcprojGenerator tmp_vcproj(&tmp_proj); | 270 | VcprojGenerator tmp_vcproj(&tmp_proj); |
208 | tmp_vcproj.setNoIO(TRUE); | 271 | tmp_vcproj.setNoIO(TRUE); |
209 | tmp_vcproj.init(); | 272 | tmp_vcproj.init(); |
210 | if(Option::debug_level) { | 273 | if(Option::debug_level) { |
211 | QMap<QString, QStringList> &vars = tmp_proj.variables(); | 274 | QMap<QString, QStringList> &vars = tmp_proj.variables(); |
212 | for(QMap<QString, QStringList>::Iterator it = vars.begin(); | 275 | for(QMap<QString, QStringList>::Iterator it = vars.begin(); |
213 | it != vars.end(); ++it) { | 276 | it != vars.end(); ++it) { |
214 | if(it.key().left(1) != "." && !it.data().isEmpty()) | 277 | if(it.key().left(1) != "." && !it.data().isEmpty()) |
215 | debug_msg(1, "%s: %s === %s", fn.latin1(), it.key().latin1(), | 278 | debug_msg(1, "%s: %s === %s", fn.latin1(), it.key().latin1(), |
216 | it.data().join(" :: ").latin1()); | 279 | it.data().join(" :: ").latin1()); |
217 | } | 280 | } |
218 | } | 281 | } |
219 | 282 | ||
220 | // We assume project filename is [QMAKE_ORIG_TARGET].vcproj | 283 | // We assume project filename is [QMAKE_ORIG_TARGET].vcproj |
221 | QString vcproj = fixFilename(tmp_vcproj.project->first("QMAKE_ORIG_TARGET")) + project->first("VCPROJ_EXTENSION"); | 284 | QString vcproj = fixFilename(tmp_vcproj.project->first("QMAKE_ORIG_TARGET")) + project->first("VCPROJ_EXTENSION"); |
222 | 285 | ||
223 | // If file doesn't exsist, then maybe the users configuration | 286 | // If file doesn't exsist, then maybe the users configuration |
224 | // doesn't allow it to be created. Skip to next... | 287 | // doesn't allow it to be created. Skip to next... |
225 | if(!QFile::exists(QDir::currentDirPath() + Option::dir_sep + vcproj)) { | 288 | if(!QFile::exists(QDir::currentDirPath() + Option::dir_sep + vcproj)) { |
226 | qDebug( "Ignored (not found) '%s'", QString(QDir::currentDirPath() + Option::dir_sep + vcproj).latin1() ); | 289 | warn_msg(WarnLogic, "Ignored (not found) '%s'", QString(QDir::currentDirPath() + Option::dir_sep + vcproj).latin1() ); |
227 | goto nextfile; // # Dirty! | 290 | goto nextfile; // # Dirty! |
228 | } | 291 | } |
229 | 292 | ||
230 | VcsolutionDepend *newDep = new VcsolutionDepend; | 293 | VcsolutionDepend *newDep = new VcsolutionDepend; |
231 | newDep->vcprojFile = fileFixify(vcproj); | 294 | newDep->vcprojFile = fileFixify(vcproj); |
232 | newDep->orig_target = tmp_proj.first("QMAKE_ORIG_TARGET"); | 295 | newDep->orig_target = tmp_proj.first("QMAKE_ORIG_TARGET"); |
233 | newDep->target = tmp_proj.first("TARGET").section(Option::dir_sep, -1); | 296 | newDep->target = tmp_proj.first("MSVCPROJ_TARGET").section(Option::dir_sep, -1); |
234 | newDep->targetType = tmp_vcproj.projectTarget; | 297 | newDep->targetType = tmp_vcproj.projectTarget; |
235 | { | 298 | newDep->debugBuild = tmp_proj.isActiveConfig("debug"); |
236 | static QUuid uuid = solutionGUID; | 299 | newDep->uuid = getProjectUUID(Option::fixPathToLocalOS(QDir::currentDirPath() + QDir::separator() + vcproj)).toString().upper(); |
237 | uuid = increaseUUID( uuid ); | 300 | |
238 | newDep->uuid = uuid.toString().upper(); | 301 | // We want to store it as the .lib name. |
239 | } | ||
240 | if(newDep->target.endsWith(".dll")) | 302 | if(newDep->target.endsWith(".dll")) |
241 | newDep->target = newDep->target.left(newDep->target.length()-3) + "lib"; | 303 | newDep->target = newDep->target.left(newDep->target.length()-3) + "lib"; |
304 | |||
305 | // All projects using Forms are dependent on uic.exe | ||
242 | if(!tmp_proj.isEmpty("FORMS")) | 306 | if(!tmp_proj.isEmpty("FORMS")) |
243 | newDep->dependencies << "uic.exe"; | 307 | newDep->dependencies << "uic.exe"; |
244 | { | 308 | |
245 | QStringList where("QMAKE_LIBS"); | 309 | // Add all unknown libs to the deps |
246 | if(!tmp_proj.isEmpty("QMAKE_INTERNAL_PRL_LIBS")) | 310 | QStringList where("QMAKE_LIBS"); |
247 | where = tmp_proj.variables()["QMAKE_INTERNAL_PRL_LIBS"]; | 311 | if(!tmp_proj.isEmpty("QMAKE_INTERNAL_PRL_LIBS")) |
248 | for(QStringList::iterator wit = where.begin(); | 312 | where = tmp_proj.variables()["QMAKE_INTERNAL_PRL_LIBS"]; |
249 | wit != where.end(); ++wit) { | 313 | for(QStringList::iterator wit = where.begin(); |
250 | QStringList &l = tmp_proj.variables()[(*wit)]; | 314 | wit != where.end(); ++wit) { |
251 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 315 | QStringList &l = tmp_proj.variables()[(*wit)]; |
252 | QString opt = (*it); | 316 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
253 | if(!opt.startsWith("/")) //Not a switch | 317 | QString opt = (*it); |
254 | newDep->dependencies << opt.section(Option::dir_sep, -1); | 318 | if(!opt.startsWith("/") && // Not a switch |
319 | opt != newDep->target && // Not self | ||
320 | opt != "opengl32.lib" && // We don't care about these libs | ||
321 | opt != "glu32.lib" && // to make depgen alittle faster | ||
322 | opt != "kernel32.lib" && | ||
323 | opt != "user32.lib" && | ||
324 | opt != "gdi32.lib" && | ||
325 | opt != "comdlg32.lib" && | ||
326 | opt != "advapi32.lib" && | ||
327 | opt != "shell32.lib" && | ||
328 | opt != "ole32.lib" && | ||
329 | opt != "oleaut32.lib" && | ||
330 | opt != "uuid.lib" && | ||
331 | opt != "imm32.lib" && | ||
332 | opt != "winmm.lib" && | ||
333 | opt != "wsock32.lib" && | ||
334 | opt != "winspool.lib" && | ||
335 | opt != "delayimp.lib" ) | ||
336 | { | ||
337 | newDep->dependencies << opt.section(Option::dir_sep, -1); | ||
255 | } | 338 | } |
256 | } | 339 | } |
257 | } | 340 | } |
341 | #ifdef DEBUG_SOLUTION_GEN | ||
342 | qDebug( "Deps for %20s: [%s]", newDep->target.latin1(), newDep->dependencies.join(" :: " ).latin1() ); | ||
343 | #endif | ||
258 | solution_cleanup.append(newDep); | 344 | solution_cleanup.append(newDep); |
259 | solution_depends.insert(newDep->target, newDep); | 345 | solution_depends.insert(newDep->target, newDep); |
260 | { | 346 | t << _slnProjectBeg << _slnMSVCvcprojGUID << _slnProjectMid |
261 | QRegExp libVersion("[0-9]{3,3}\\.lib$"); | ||
262 | if(libVersion.search(newDep->target) != -1) | ||
263 | solution_depends.insert(newDep->target.left(newDep->target.length() - | ||
264 | libVersion.matchedLength()) + ".lib", newDep); | ||
265 | } | ||
266 | t << _snlProjectBeg << _snlMSVCvcprojGUID << _snlProjectMid | ||
267 | << "\"" << newDep->orig_target << "\", \"" << newDep->vcprojFile | 347 | << "\"" << newDep->orig_target << "\", \"" << newDep->vcprojFile |
268 | << "\", \"" << newDep->uuid << "\""; | 348 | << "\", \"" << newDep->uuid << "\""; |
269 | t << _snlProjectEnd; | 349 | t << _slnProjectEnd; |
270 | } | 350 | } |
271 | } | 351 | } |
272 | nextfile: | 352 | nextfile: |
273 | QDir::setCurrent(oldpwd); | 353 | QDir::setCurrent(oldpwd); |
274 | } | 354 | } |
275 | } | 355 | } |
276 | } | 356 | } |
277 | t << _snlGlobalBeg; | 357 | t << _slnGlobalBeg; |
278 | t << _snlSolutionConf; | 358 | t << _slnSolutionConf; |
279 | t << _snlProjDepBeg; | 359 | t << _slnProjDepBeg; |
360 | |||
361 | // Figure out dependencies | ||
280 | for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) { | 362 | for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) { |
363 | if(solution_cleanup.current()->targetType == StaticLib) | ||
364 | continue; // Shortcut, Static libs are not dep. | ||
281 | int cnt = 0; | 365 | int cnt = 0; |
282 | for(QStringList::iterator dit = solution_cleanup.current()->dependencies.begin(); | 366 | for(QStringList::iterator dit = solution_cleanup.current()->dependencies.begin(); |
283 | dit != solution_cleanup.current()->dependencies.end(); | 367 | dit != solution_cleanup.current()->dependencies.end(); |
284 | ++dit) { | 368 | ++dit) |
285 | VcsolutionDepend *vc; | 369 | { |
286 | if((vc=solution_depends[*dit])) { | 370 | VcsolutionDepend *vc = solution_depends[*dit]; |
287 | if(solution_cleanup.current()->targetType != StaticLib || vc->targetType == Application) | 371 | if(vc) |
288 | t << "\n\t\t" << solution_cleanup.current()->uuid << "." << cnt++ << " = " << vc->uuid; | 372 | t << "\n\t\t" << solution_cleanup.current()->uuid << "." << cnt++ << " = " << vc->uuid; |
289 | } | ||
290 | } | 373 | } |
291 | } | 374 | } |
292 | t << _snlProjDepEnd; | 375 | t << _slnProjDepEnd; |
293 | t << _snlProjConfBeg; | 376 | t << _slnProjConfBeg; |
294 | for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) { | 377 | for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) { |
295 | t << "\n\t\t" << solution_cleanup.current()->uuid << _snlProjConfTag1; | 378 | t << "\n\t\t" << solution_cleanup.current()->uuid << _slnProjDbgConfTag1; |
296 | t << "\n\t\t" << solution_cleanup.current()->uuid << _snlProjConfTag2; | 379 | t << "\n\t\t" << solution_cleanup.current()->uuid << _slnProjDbgConfTag2; |
380 | t << "\n\t\t" << solution_cleanup.current()->uuid << _slnProjRelConfTag1; | ||
381 | t << "\n\t\t" << solution_cleanup.current()->uuid << _slnProjRelConfTag2; | ||
297 | } | 382 | } |
298 | t << _snlProjConfEnd; | 383 | t << _slnProjConfEnd; |
299 | t << _snlExtSections; | 384 | t << _slnExtSections; |
300 | t << _snlGlobalEnd; | 385 | t << _slnGlobalEnd; |
301 | } | 386 | } |
302 | 387 | ||
303 | // ------------------------------------------------------------------------------------------------ | 388 | // ------------------------------------------------------------------------------------------------ |
304 | // ------------------------------------------------------------------------------------------------ | 389 | // ------------------------------------------------------------------------------------------------ |
305 | 390 | ||
306 | void VcprojGenerator::init() | 391 | void VcprojGenerator::init() |
307 | { | 392 | { |
308 | if( init_flag ) | 393 | if( init_flag ) |
309 | return; | 394 | return; |
310 | if(project->first("TEMPLATE") == "vcsubdirs") { //too much work for subdirs | 395 | if(project->first("TEMPLATE") == "vcsubdirs") { //too much work for subdirs |
311 | init_flag = TRUE; | 396 | init_flag = TRUE; |
312 | return; | 397 | return; |
313 | } | 398 | } |
314 | 399 | ||
315 | debug_msg(1, "Generator: MSVC.NET: Initializing variables" ); | 400 | debug_msg(1, "Generator: MSVC.NET: Initializing variables" ); |
316 | 401 | ||
317 | /* | 402 | /* |
318 | // Once to be nice and clean code... | 403 | // Once to be nice and clean code... |
319 | // Wouldn't life be great? | 404 | // Wouldn't life be great? |
320 | 405 | ||
321 | // Are we building Qt? | 406 | // Are we building Qt? |
322 | bool is_qt = | 407 | bool is_qt = |
323 | ( project->first("TARGET") == "qt"QTDLL_POSTFIX || | 408 | ( project->first("TARGET") == "qt"QTDLL_POSTFIX || |
324 | project->first("TARGET") == "qt-mt"QTDLL_POSTFIX ); | 409 | project->first("TARGET") == "qt-mt"QTDLL_POSTFIX ); |
325 | 410 | ||
326 | // Are we using Qt? | 411 | // Are we using Qt? |
327 | bool isQtActive = project->isActiveConfig("qt"); | 412 | bool isQtActive = project->isActiveConfig("qt"); |
328 | 413 | ||
329 | if ( isQtActive ) { | 414 | if ( isQtActive ) { |
330 | project->variables()["CONFIG"] += "moc"; | 415 | project->variables()["CONFIG"] += "moc"; |
331 | project->variables()["CONFIG"] += "windows"; | 416 | project->variables()["CONFIG"] += "windows"; |
332 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"]; | 417 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"]; |
333 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; | 418 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; |
334 | 419 | ||
335 | if( projectTarget == SharedLib ) | 420 | if( projectTarget == SharedLib ) |
336 | project->variables()["DEFINES"] += "QT_DLL"; | 421 | project->variables()["DEFINES"] += "QT_DLL"; |
337 | 422 | ||
338 | if( project->isActiveConfig("accessibility" ) ) | 423 | if( project->isActiveConfig("accessibility" ) ) |
339 | project->variables()["DEFINES"] += "QT_ACCESSIBILITY_SUPPORT"; | 424 | project->variables()["DEFINES"] += "QT_ACCESSIBILITY_SUPPORT"; |
340 | 425 | ||
341 | if ( project->isActiveConfig("plugin")) { | 426 | if ( project->isActiveConfig("plugin")) { |
342 | project->variables()["DEFINES"] += "QT_PLUGIN"; | 427 | project->variables()["DEFINES"] += "QT_PLUGIN"; |
343 | project->variables()["CONFIG"] += "dll"; | 428 | project->variables()["CONFIG"] += "dll"; |
344 | } | 429 | } |
345 | 430 | ||
346 | if( project->isActiveConfig("thread") ) { | 431 | if( project->isActiveConfig("thread") ) { |
347 | project->variables()["DEFINES"] += "QT_THREAD_SUPPORT"; | 432 | project->variables()["DEFINES"] += "QT_THREAD_SUPPORT"; |
348 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | 433 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; |
349 | } else { | 434 | } else { |
350 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; | 435 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; |
351 | } | 436 | } |
352 | } | 437 | } |
353 | 438 | ||
354 | if ( project->isActiveConfig("opengl") ) { | 439 | if ( project->isActiveConfig("opengl") ) { |
355 | project->variables()["CONFIG"] += "windows"; // <-- Also in 'qt' above | 440 | project->variables()["CONFIG"] += "windows"; // <-- Also in 'qt' above |
356 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | 441 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; |
357 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; | 442 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; |
358 | 443 | ||
359 | } | 444 | } |
360 | */ | 445 | */ |
361 | initOld(); // Currently calling old DSP code to set variables. CLEAN UP! | 446 | initOld(); // Currently calling old DSP code to set variables. CLEAN UP! |
362 | 447 | ||
363 | // Figure out what we're trying to build | 448 | // Figure out what we're trying to build |
364 | if ( project->first("TEMPLATE") == "vcapp" ) { | 449 | if ( project->first("TEMPLATE") == "vcapp" ) { |
365 | projectTarget = Application; | 450 | projectTarget = Application; |
366 | } else if ( project->first("TEMPLATE") == "vclib") { | 451 | } else if ( project->first("TEMPLATE") == "vclib") { |
367 | if ( project->isActiveConfig( "staticlib" ) ) | 452 | if ( project->isActiveConfig( "staticlib" ) ) |
368 | projectTarget = StaticLib; | 453 | projectTarget = StaticLib; |
369 | else | 454 | else |
370 | projectTarget = SharedLib; | 455 | projectTarget = SharedLib; |
371 | } | 456 | } |
457 | |||
458 | // Setup PCH variables | ||
459 | precompH = project->first("PRECOMPILED_HEADER"); | ||
460 | usePCH = !precompH.isEmpty() && project->isActiveConfig("precompile_header"); | ||
461 | if (usePCH) { | ||
462 | precompHFilename = QFileInfo(precompH).fileName(); | ||
463 | // Created files | ||
464 | QString origTarget = project->first("QMAKE_ORIG_TARGET"); | ||
465 | precompObj = origTarget + Option::obj_ext; | ||
466 | precompPch = origTarget + ".pch"; | ||
467 | // Add PRECOMPILED_HEADER to HEADERS | ||
468 | if (!project->variables()["HEADERS"].contains(precompH)) | ||
469 | project->variables()["HEADERS"] += precompH; | ||
470 | // Return to variable pool | ||
471 | project->variables()["PRECOMPILED_OBJECT"] = precompObj; | ||
472 | project->variables()["PRECOMPILED_PCH"] = precompPch; | ||
473 | } | ||
474 | |||
372 | initProject(); // Fills the whole project with proper data | 475 | initProject(); // Fills the whole project with proper data |
373 | } | 476 | } |
374 | 477 | ||
375 | void VcprojGenerator::initProject() | 478 | void VcprojGenerator::initProject() |
376 | { | 479 | { |
377 | // Initialize XML sub elements | 480 | // Initialize XML sub elements |
378 | // - Do this first since project elements may need | 481 | // - Do this first since project elements may need |
379 | // - to know of certain configuration options | 482 | // - to know of certain configuration options |
380 | initConfiguration(); | 483 | initConfiguration(); |
381 | initSourceFiles(); | 484 | initSourceFiles(); |
382 | initHeaderFiles(); | 485 | initHeaderFiles(); |
383 | initMOCFiles(); | 486 | initMOCFiles(); |
384 | initUICFiles(); | 487 | initUICFiles(); |
385 | initFormsFiles(); | 488 | initFormsFiles(); |
386 | initTranslationFiles(); | 489 | initTranslationFiles(); |
387 | initLexYaccFiles(); | 490 | initLexYaccFiles(); |
388 | initResourceFiles(); | 491 | initResourceFiles(); |
389 | 492 | ||
390 | // Own elements ----------------------------- | 493 | // Own elements ----------------------------- |
391 | vcProject.Name = project->first("QMAKE_ORIG_TARGET"); | 494 | vcProject.Name = project->first("QMAKE_ORIG_TARGET"); |
392 | vcProject.Version = "7.00"; | 495 | vcProject.Version = use_net2003_version() ? "7.10" : "7.00"; |
393 | vcProject.PlatformName = ( vcProject.Configuration.idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" ); | 496 | vcProject.ProjectGUID = getProjectUUID().toString().upper(); |
497 | vcProject.PlatformName = ( vcProject.Configuration[0].idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" ); | ||
394 | // These are not used by Qt, but may be used by customers | 498 | // These are not used by Qt, but may be used by customers |
395 | vcProject.SccProjectName = project->first("SCCPROJECTNAME"); | 499 | vcProject.SccProjectName = project->first("SCCPROJECTNAME"); |
396 | vcProject.SccLocalPath = project->first("SCCLOCALPATH"); | 500 | vcProject.SccLocalPath = project->first("SCCLOCALPATH"); |
397 | } | 501 | } |
398 | 502 | ||
399 | void VcprojGenerator::initConfiguration() | 503 | void VcprojGenerator::initConfiguration() |
400 | { | 504 | { |
401 | // Initialize XML sub elements | 505 | // Initialize XML sub elements |
402 | // - Do this first since main configuration elements may need | 506 | // - Do this first since main configuration elements may need |
403 | // - to know of certain compiler/linker options | 507 | // - to know of certain compiler/linker options |
404 | initCompilerTool(); | 508 | initCompilerTool(); |
405 | if ( projectTarget == StaticLib ) | 509 | if ( projectTarget == StaticLib ) |
406 | initLibrarianTool(); | 510 | initLibrarianTool(); |
407 | else | 511 | else |
408 | initLinkerTool(); | 512 | initLinkerTool(); |
409 | initIDLTool(); | 513 | initIDLTool(); |
410 | 514 | ||
411 | // Own elements ----------------------------- | 515 | // Own elements ----------------------------- |
412 | QString temp = project->first("BuildBrowserInformation"); | 516 | QString temp = project->first("BuildBrowserInformation"); |
413 | switch ( projectTarget ) { | 517 | switch ( projectTarget ) { |
414 | case SharedLib: | 518 | case SharedLib: |
415 | vcProject.Configuration.ConfigurationType = typeDynamicLibrary; | 519 | vcProject.Configuration[0].ConfigurationType = typeDynamicLibrary; |
416 | break; | 520 | break; |
417 | case StaticLib: | 521 | case StaticLib: |
418 | vcProject.Configuration.ConfigurationType = typeStaticLibrary; | 522 | vcProject.Configuration[0].ConfigurationType = typeStaticLibrary; |
419 | break; | 523 | break; |
420 | case Application: | 524 | case Application: |
421 | default: | 525 | default: |
422 | vcProject.Configuration.ConfigurationType = typeApplication; | 526 | vcProject.Configuration[0].ConfigurationType = typeApplication; |
423 | break; | 527 | break; |
424 | } | 528 | } |
425 | vcProject.Configuration.Name = ( project->isActiveConfig( "debug" ) ? "Debug|" : "Release|" ); | 529 | |
426 | vcProject.Configuration.Name += ( vcProject.Configuration.idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" ); | 530 | // Release version of the Configuration --------------- |
427 | vcProject.Configuration.ATLMinimizesCRunTimeLibraryUsage = ( project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True ); | 531 | VCConfiguration &RConf = vcProject.Configuration[0]; |
428 | vcProject.Configuration.BuildBrowserInformation = triState( temp.isEmpty() ? (short)unset : temp.toShort() ); | 532 | RConf.Name = "Release"; |
533 | RConf.Name += ( RConf.idl.TargetEnvironment == midlTargetWin64 ? "|Win64" : "|Win32" ); | ||
534 | RConf.ATLMinimizesCRunTimeLibraryUsage = ( project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True ); | ||
535 | RConf.BuildBrowserInformation = triState( temp.isEmpty() ? (short)unset : temp.toShort() ); | ||
429 | temp = project->first("CharacterSet"); | 536 | temp = project->first("CharacterSet"); |
430 | vcProject.Configuration.CharacterSet = charSet( temp.isEmpty() ? (short)charSetNotSet : temp.toShort() ); | 537 | RConf.CharacterSet = charSet( temp.isEmpty() ? (short)charSetNotSet : temp.toShort() ); |
431 | vcProject.Configuration.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean"); | 538 | RConf.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean"); |
432 | vcProject.Configuration.ImportLibrary = vcProject.Configuration.linker.ImportLibrary; | 539 | RConf.ImportLibrary = RConf.linker.ImportLibrary; |
433 | vcProject.Configuration.IntermediateDirectory = project->first("OBJECTS_DIR"); | 540 | RConf.IntermediateDirectory = project->first("OBJECTS_DIR"); |
434 | // temp = (projectTarget == StaticLib) ? project->first("DESTDIR"):project->first("DLLDESTDIR"); | 541 | RConf.OutputDirectory = "."; |
435 | vcProject.Configuration.OutputDirectory = "."; //( temp.isEmpty() ? QString(".") : temp ); | 542 | RConf.PrimaryOutput = project->first("PrimaryOutput"); |
436 | vcProject.Configuration.PrimaryOutput = project->first("PrimaryOutput"); | 543 | RConf.WholeProgramOptimization = RConf.compiler.WholeProgramOptimization; |
437 | vcProject.Configuration.WholeProgramOptimization = vcProject.Configuration.compiler.WholeProgramOptimization; | ||
438 | temp = project->first("UseOfATL"); | 544 | temp = project->first("UseOfATL"); |
439 | if ( !temp.isEmpty() ) | 545 | if ( !temp.isEmpty() ) |
440 | vcProject.Configuration.UseOfATL = useOfATL( temp.toShort() ); | 546 | RConf.UseOfATL = useOfATL( temp.toShort() ); |
441 | temp = project->first("UseOfMfc"); | 547 | temp = project->first("UseOfMfc"); |
442 | if ( !temp.isEmpty() ) | 548 | if ( !temp.isEmpty() ) |
443 | vcProject.Configuration.UseOfMfc = useOfMfc( temp.toShort() ); | 549 | RConf.UseOfMfc = useOfMfc( temp.toShort() ); |
444 | 550 | ||
445 | // Configuration does not need parameters from | 551 | // Configuration does not need parameters from |
446 | // these sub XML items; | 552 | // these sub XML items; |
447 | initCustomBuildTool(); | 553 | initCustomBuildTool(); |
448 | initPreBuildEventTools(); | 554 | initPreBuildEventTools(); |
449 | initPostBuildEventTools(); | 555 | initPostBuildEventTools(); |
450 | initPreLinkEventTools(); | 556 | initPreLinkEventTools(); |
557 | |||
558 | // Debug version of the Configuration ----------------- | ||
559 | VCConfiguration DConf = vcProject.Configuration[0]; // Create copy configuration for debug | ||
560 | DConf.Name = "Debug"; | ||
561 | DConf.Name += ( DConf.idl.TargetEnvironment == midlTargetWin64 ? "|Win64" : "|Win32" ); | ||
562 | |||
563 | // Set definite values in both configurations | ||
564 | DConf.compiler.PreprocessorDefinitions.remove("NDEBUG"); | ||
565 | RConf.compiler.PreprocessorDefinitions += "NDEBUG"; | ||
566 | RConf.linker.GenerateDebugInformation = _False; | ||
567 | DConf.linker.GenerateDebugInformation = _True; | ||
568 | |||
569 | // Modify configurations, based on Qt build | ||
570 | if ( project->isActiveConfig("debug") ) { | ||
571 | RConf.IntermediateDirectory = | ||
572 | RConf.compiler.AssemblerListingLocation = | ||
573 | RConf.compiler.ObjectFile = "Release\\"; | ||
574 | RConf.librarian.OutputFile = | ||
575 | RConf.linker.OutputFile = RConf.IntermediateDirectory + "\\" + project->first("MSVCPROJ_TARGET"); | ||
576 | RConf.linker.parseOptions(project->variables()["QMAKE_LFLAGS_RELEASE"]); | ||
577 | RConf.compiler.parseOptions(project->variables()["QMAKE_CFLAGS_RELEASE"]); | ||
578 | } else { | ||
579 | DConf.IntermediateDirectory = | ||
580 | DConf.compiler.AssemblerListingLocation = | ||
581 | DConf.compiler.ObjectFile = "Debug\\"; | ||
582 | DConf.librarian.OutputFile = | ||
583 | DConf.linker.OutputFile = DConf.IntermediateDirectory + "\\" + project->first("MSVCPROJ_TARGET"); | ||
584 | DConf.linker.DelayLoadDLLs.clear(); | ||
585 | DConf.compiler.parseOptions(project->variables()["QMAKE_CFLAGS_DEBUG"]); | ||
586 | } | ||
587 | |||
588 | // Add Debug configuration to project | ||
589 | vcProject.Configuration += DConf; | ||
451 | } | 590 | } |
452 | 591 | ||
453 | void VcprojGenerator::initCompilerTool() | 592 | void VcprojGenerator::initCompilerTool() |
454 | { | 593 | { |
455 | QString placement = project->first("OBJECTS_DIR"); | 594 | QString placement = project->first("OBJECTS_DIR"); |
456 | if ( placement.isEmpty() ) | 595 | if ( placement.isEmpty() ) |
457 | placement = ".\\"; | 596 | placement = ".\\"; |
458 | 597 | ||
459 | vcProject.Configuration.compiler.AssemblerListingLocation = placement ; | 598 | VCConfiguration &RConf = vcProject.Configuration[0]; |
460 | vcProject.Configuration.compiler.ProgramDataBaseFileName = placement ; | 599 | RConf.compiler.AssemblerListingLocation = placement ; |
461 | vcProject.Configuration.compiler.ObjectFile = placement ; | 600 | RConf.compiler.ProgramDataBaseFileName = ".\\" ; |
462 | vcProject.Configuration.compiler.PrecompiledHeaderFile = placement + project->first("QMAKE_ORIG_TARGET") + ".pch"; | 601 | RConf.compiler.ObjectFile = placement ; |
602 | // PCH | ||
603 | if ( usePCH ) { | ||
604 | RConf.compiler.UsePrecompiledHeader = pchUseUsingSpecific; | ||
605 | RConf.compiler.PrecompiledHeaderFile = "$(IntDir)\\" + precompPch; | ||
606 | RConf.compiler.PrecompiledHeaderThrough = precompHFilename; | ||
607 | RConf.compiler.ForcedIncludeFiles = precompHFilename; | ||
608 | // Minimal build option triggers an Internal Compiler Error | ||
609 | // when used in conjunction with /FI and /Yu, so remove it | ||
610 | project->variables()["QMAKE_CFLAGS_DEBUG"].remove("-Gm"); | ||
611 | project->variables()["QMAKE_CFLAGS_DEBUG"].remove("/Gm"); | ||
612 | project->variables()["QMAKE_CXXFLAGS_DEBUG"].remove("-Gm"); | ||
613 | project->variables()["QMAKE_CXXFLAGS_DEBUG"].remove("/Gm"); | ||
614 | } | ||
463 | 615 | ||
464 | if ( project->isActiveConfig("debug") ){ | 616 | if ( project->isActiveConfig("debug") ){ |
465 | // Debug version | 617 | // Debug version |
466 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); | 618 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); |
467 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_DEBUG"] ); | 619 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_DEBUG"] ); |
468 | if ( project->isActiveConfig("thread") ) { | 620 | if ( project->isActiveConfig("thread") ) { |
469 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) | 621 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) |
470 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DBG"] ); | 622 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DBG"] ); |
471 | else | 623 | else |
472 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"] ); | 624 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"] ); |
473 | } else { | 625 | } else { |
474 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_ST_DBG"] ); | 626 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DBG"] ); |
475 | } | 627 | } |
476 | } else { | 628 | } else { |
477 | // Release version | 629 | // Release version |
478 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); | 630 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); |
479 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_RELEASE"] ); | 631 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_RELEASE"] ); |
480 | vcProject.Configuration.compiler.PreprocessorDefinitions += "QT_NO_DEBUG"; | 632 | RConf.compiler.PreprocessorDefinitions += "QT_NO_DEBUG"; |
481 | vcProject.Configuration.compiler.PreprocessorDefinitions += "NDEBUG"; | 633 | RConf.compiler.PreprocessorDefinitions += "NDEBUG"; |
482 | if ( project->isActiveConfig("thread") ) { | 634 | if ( project->isActiveConfig("thread") ) { |
483 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) | 635 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) |
484 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT"] ); | 636 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT"] ); |
485 | else | 637 | else |
486 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLL"] ); | 638 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLL"] ); |
487 | } else { | 639 | } else { |
488 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_ST"] ); | 640 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT"] ); |
489 | } | 641 | } |
490 | } | 642 | } |
491 | 643 | ||
492 | // Common for both release and debug | 644 | // Common for both release and debug |
493 | if ( project->isActiveConfig("warn_off") ) | 645 | if ( project->isActiveConfig("warn_off") ) |
494 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_OFF"] ); | 646 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_OFF"] ); |
495 | else if ( project->isActiveConfig("warn_on") ) | 647 | else if ( project->isActiveConfig("warn_on") ) |
496 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_ON"] ); | 648 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_ON"] ); |
497 | if ( project->isActiveConfig("windows") ) | 649 | if ( project->isActiveConfig("windows") ) |
498 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["MSVCPROJ_WINCONDEF"]; | 650 | RConf.compiler.PreprocessorDefinitions += project->variables()["MSVCPROJ_WINCONDEF"]; |
499 | 651 | ||
500 | // Can this be set for ALL configs? | 652 | // Can this be set for ALL configs? |
501 | // If so, use qmake.conf! | 653 | // If so, use qmake.conf! |
502 | if ( projectTarget == SharedLib ) | 654 | if ( projectTarget == SharedLib ) |
503 | vcProject.Configuration.compiler.PreprocessorDefinitions += "_WINDOWS"; | 655 | RConf.compiler.PreprocessorDefinitions += "_WINDOWS"; |
504 | 656 | ||
505 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["DEFINES"]; | 657 | RConf.compiler.PreprocessorDefinitions += project->variables()["DEFINES"]; |
506 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["PRL_EXPORT_DEFINES"]; | 658 | RConf.compiler.PreprocessorDefinitions += project->variables()["PRL_EXPORT_DEFINES"]; |
507 | vcProject.Configuration.compiler.parseOptions( project->variables()["MSVCPROJ_INCPATH"] ); | 659 | QStringList::iterator it; |
660 | for(it=RConf.compiler.PreprocessorDefinitions.begin(); | ||
661 | it!=RConf.compiler.PreprocessorDefinitions.end(); | ||
662 | ++it) | ||
663 | (*it).replace('\"', """); | ||
664 | |||
665 | RConf.compiler.parseOptions( project->variables()["MSVCPROJ_INCPATH"] ); | ||
508 | } | 666 | } |
509 | 667 | ||
510 | void VcprojGenerator::initLibrarianTool() | 668 | void VcprojGenerator::initLibrarianTool() |
511 | { | 669 | { |
512 | vcProject.Configuration.librarian.OutputFile = project->first( "DESTDIR" ); | 670 | VCConfiguration &RConf = vcProject.Configuration[0]; |
513 | if( vcProject.Configuration.librarian.OutputFile.isEmpty() ) | 671 | RConf.librarian.OutputFile = project->first( "DESTDIR" ); |
514 | vcProject.Configuration.librarian.OutputFile = ".\\"; | 672 | if( RConf.librarian.OutputFile.isEmpty() ) |
673 | RConf.librarian.OutputFile = ".\\"; | ||
515 | 674 | ||
516 | if( !vcProject.Configuration.librarian.OutputFile.endsWith("\\") ) | 675 | if( !RConf.librarian.OutputFile.endsWith("\\") ) |
517 | vcProject.Configuration.librarian.OutputFile += '\\'; | 676 | RConf.librarian.OutputFile += '\\'; |
518 | 677 | ||
519 | vcProject.Configuration.librarian.OutputFile += project->first("MSVCPROJ_TARGET"); | 678 | RConf.librarian.OutputFile += project->first("MSVCPROJ_TARGET"); |
520 | } | 679 | } |
521 | 680 | ||
522 | void VcprojGenerator::initLinkerTool() | 681 | void VcprojGenerator::initLinkerTool() |
523 | { | 682 | { |
524 | vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LFLAGS"] ); | 683 | VCConfiguration &RConf = vcProject.Configuration[0]; |
525 | vcProject.Configuration.linker.AdditionalDependencies += project->variables()["MSVCPROJ_LIBS"]; | 684 | RConf.linker.parseOptions( project->variables()["MSVCPROJ_LFLAGS"] ); |
685 | RConf.linker.AdditionalDependencies += project->variables()["MSVCPROJ_LIBS"]; | ||
526 | 686 | ||
527 | switch ( projectTarget ) { | 687 | switch ( projectTarget ) { |
528 | case Application: | 688 | case Application: |
529 | vcProject.Configuration.linker.OutputFile = project->first( "DESTDIR" ); | 689 | RConf.linker.OutputFile = project->first( "DESTDIR" ); |
530 | break; | 690 | break; |
531 | case SharedLib: | 691 | case SharedLib: |
532 | vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LIBOPTIONS"] ); | 692 | RConf.linker.parseOptions( project->variables()["MSVCPROJ_LIBOPTIONS"] ); |
533 | vcProject.Configuration.linker.OutputFile = project->first( "DLLDESTDIR" ); | 693 | RConf.linker.OutputFile = project->first( "DESTDIR" ); |
534 | break; | 694 | break; |
535 | case StaticLib: //unhandled - added to remove warnings.. | 695 | case StaticLib: //unhandled - added to remove warnings.. |
536 | break; | 696 | break; |
537 | } | 697 | } |
538 | 698 | ||
539 | if( vcProject.Configuration.linker.OutputFile.isEmpty() ) | 699 | if( RConf.linker.OutputFile.isEmpty() ) |
540 | vcProject.Configuration.linker.OutputFile = ".\\"; | 700 | RConf.linker.OutputFile = ".\\"; |
541 | 701 | ||
542 | if( !vcProject.Configuration.linker.OutputFile.endsWith("\\") ) | 702 | if( !RConf.linker.OutputFile.endsWith("\\") ) |
543 | vcProject.Configuration.linker.OutputFile += '\\'; | 703 | RConf.linker.OutputFile += '\\'; |
544 | 704 | ||
545 | vcProject.Configuration.linker.OutputFile += project->first("MSVCPROJ_TARGET"); | 705 | RConf.linker.OutputFile += project->first("MSVCPROJ_TARGET"); |
546 | vcProject.Configuration.linker.ProgramDatabaseFile = project->first("OBJECTS_DIR") + project->first("QMAKE_ORIG_TARGET") + ".pdb"; | ||
547 | 706 | ||
548 | if ( project->isActiveConfig("debug") ){ | 707 | if ( project->isActiveConfig("debug") ){ |
549 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_DEBUG"] ); | 708 | RConf.linker.parseOptions( project->variables()["QMAKE_LFLAGS_DEBUG"] ); |
550 | } else { | 709 | } else { |
551 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_RELEASE"] ); | 710 | RConf.linker.parseOptions( project->variables()["QMAKE_LFLAGS_RELEASE"] ); |
552 | } | 711 | } |
553 | 712 | ||
554 | if ( project->isActiveConfig("dll") ){ | 713 | if ( project->isActiveConfig("dll") ){ |
555 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_QT_DLL"] ); | 714 | RConf.linker.parseOptions( project->variables()["QMAKE_LFLAGS_QT_DLL"] ); |
556 | } | 715 | } |
557 | 716 | ||
558 | if ( project->isActiveConfig("console") ){ | 717 | if ( project->isActiveConfig("console") ){ |
559 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_CONSOLE"] ); | 718 | RConf.linker.parseOptions( project->variables()["QMAKE_LFLAGS_CONSOLE"] ); |
560 | } else { | 719 | } else { |
561 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_WINDOWS"] ); | 720 | RConf.linker.parseOptions( project->variables()["QMAKE_LFLAGS_WINDOWS"] ); |
562 | } | 721 | } |
563 | 722 | ||
564 | } | 723 | } |
565 | 724 | ||
566 | void VcprojGenerator::initIDLTool() | 725 | void VcprojGenerator::initIDLTool() |
567 | { | 726 | { |
568 | } | 727 | } |
569 | 728 | ||
570 | void VcprojGenerator::initCustomBuildTool() | 729 | void VcprojGenerator::initCustomBuildTool() |
571 | { | 730 | { |
572 | } | 731 | } |
573 | 732 | ||
574 | void VcprojGenerator::initPreBuildEventTools() | 733 | void VcprojGenerator::initPreBuildEventTools() |
575 | { | 734 | { |
576 | QString collectionName = project->first("QMAKE_IMAGE_COLLECTION"); | ||
577 | if( !collectionName.isEmpty() ) { | ||
578 | QStringList& list = project->variables()["IMAGES"]; | ||
579 | vcProject.Configuration.preBuild.Description = "Generate imagecollection"; | ||
580 | //vcProject.Configuration.preBuild.AdditionalDependencies += list; | ||
581 | |||
582 | QFile imgs( ".imgcol" ); | ||
583 | imgs.open( IO_WriteOnly ); | ||
584 | QTextStream s( &imgs ); | ||
585 | QStringList::ConstIterator it = list.begin(); | ||
586 | while( it!=list.end() ) { | ||
587 | s << *it << " "; | ||
588 | it++; | ||
589 | } | ||
590 | |||
591 | vcProject.Configuration.preBuild.CommandLine = project->first("QMAKE_UIC") + " -embed " + project->first("QMAKE_ORIG_TARGET") + " -f .imgcol -o " + collectionName; | ||
592 | //vcProject.Configuration.preBuild.Outputs = collectionName; | ||
593 | |||
594 | } | ||
595 | } | 735 | } |
596 | 736 | ||
597 | void VcprojGenerator::initPostBuildEventTools() | 737 | void VcprojGenerator::initPostBuildEventTools() |
598 | { | 738 | { |
739 | VCConfiguration &RConf = vcProject.Configuration[0]; | ||
599 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) { | 740 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) { |
600 | vcProject.Configuration.postBuild.Description = var("QMAKE_POST_LINK"); | 741 | RConf.postBuild.Description = var("QMAKE_POST_LINK"); |
601 | vcProject.Configuration.postBuild.CommandLine = var("QMAKE_POST_LINK"); | 742 | RConf.postBuild.CommandLine = var("QMAKE_POST_LINK"); |
743 | RConf.postBuild.Description.replace(" && ", " && "); | ||
744 | RConf.postBuild.CommandLine.replace(" && ", " && "); | ||
745 | } | ||
746 | if ( !project->variables()["MSVCPROJ_COPY_DLL"].isEmpty() ) { | ||
747 | if ( !RConf.postBuild.CommandLine.isEmpty() ) | ||
748 | RConf.postBuild.CommandLine += " && "; | ||
749 | RConf.postBuild.Description += var("MSVCPROJ_COPY_DLL_DESC"); | ||
750 | RConf.postBuild.CommandLine += var("MSVCPROJ_COPY_DLL"); | ||
602 | } | 751 | } |
603 | if( project->isActiveConfig( "activeqt" ) ) { | 752 | if( project->isActiveConfig( "activeqt" ) ) { |
604 | QString name = project->first( "QMAKE_ORIG_TARGET" ); | 753 | QString name = project->first( "QMAKE_ORIG_TARGET" ); |
605 | QString nameext = project->first( "TARGET" ); | 754 | QString nameext = project->first( "TARGET" ); |
606 | QString objdir = project->first( "OBJECTS_DIR" ); | 755 | QString objdir = project->first( "OBJECTS_DIR" ); |
607 | QString idc = project->first( "QMAKE_IDC" ); | 756 | QString idc = project->first( "QMAKE_IDC" ); |
608 | 757 | ||
609 | vcProject.Configuration.postBuild.Description = "Finalizing ActiveQt server..."; | 758 | RConf.postBuild.Description = "Finalizing ActiveQt server..."; |
610 | if ( !vcProject.Configuration.postBuild.CommandLine.isEmpty() ) | 759 | if ( !RConf.postBuild.CommandLine.isEmpty() ) |
611 | vcProject.Configuration.postBuild.CommandLine += " && "; | 760 | RConf.postBuild.CommandLine += " && "; |
612 | 761 | ||
613 | if( project->isActiveConfig( "dll" ) ) { // In process | 762 | if( project->isActiveConfig( "dll" ) ) { // In process |
614 | vcProject.Configuration.postBuild.CommandLine += | 763 | RConf.postBuild.CommandLine += |
615 | // call idc to generate .idl file from .dll | 764 | // call idc to generate .idl file from .dll |
616 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " -idl " + objdir + name + ".idl -version 1.0 && " + | 765 | idc + " "$(TargetPath)" -idl " + objdir + name + ".idl -version 1.0 && " + |
617 | // call midl to create implementations of the .idl file | 766 | // call midl to create implementations of the .idl file |
618 | project->first( "QMAKE_IDL" ) + " " + objdir + name + ".idl /nologo /o " + objdir + name + ".midl /tlb " + objdir + name + ".tlb /iid " + objdir + | 767 | project->first( "QMAKE_IDL" ) + " /nologo " + objdir + name + ".idl /tlb " + objdir + name + ".tlb && " + |
619 | "dump.midl /dlldata " + objdir + "dump.midl /cstub " + objdir + "dump.midl /header " + objdir + "dump.midl /proxy " + objdir + "dump.midl /sstub " + | ||
620 | objdir + "dump.midl && " + | ||
621 | // call idc to replace tlb... | 768 | // call idc to replace tlb... |
622 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /tlb " + objdir + name + ".tlb && " + | 769 | idc + " "$(TargetPath)" /tlb " + objdir + name + ".tlb && " + |
623 | // register server | 770 | // register server |
624 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /regserver"; | 771 | idc + " "$(TargetPath)" /regserver"; |
625 | } else { // out of process | 772 | } else { // out of process |
626 | vcProject.Configuration.postBuild.CommandLine = | 773 | RConf.postBuild.CommandLine = |
627 | // call application to dump idl | 774 | // call application to dump idl |
628 | vcProject.Configuration.OutputDirectory + "\\" + nameext + " -dumpidl " + objdir + name + ".idl -version 1.0 && " + | 775 | ""$(TargetPath)" -dumpidl " + objdir + name + ".idl -version 1.0 && " + |
629 | // call midl to create implementations of the .idl file | 776 | // call midl to create implementations of the .idl file |
630 | project->first( "QMAKE_IDL" ) + " " + objdir + name + ".idl /nologo /o " + objdir + name + ".midl /tlb " + objdir + name + ".tlb /iid " + objdir + | 777 | project->first( "QMAKE_IDL" ) + " /nologo " + objdir + name + ".idl /tlb " + objdir + name + ".tlb && " + |
631 | "dump.midl /dlldata " + objdir + "dump.midl /cstub " + objdir + "dump.midl /header " + objdir + "dump.midl /proxy " + objdir + "dump.midl /sstub " + | ||
632 | objdir + "dump.midl && " + | ||
633 | // call idc to replace tlb... | 778 | // call idc to replace tlb... |
634 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /tlb " + objdir + name + ".tlb && " + | 779 | idc + " "$(TargetPath)" /tlb " + objdir + name + ".tlb && " + |
635 | // call app to register | 780 | // call app to register |
636 | vcProject.Configuration.OutputDirectory + "\\" + nameext + " -regserver"; | 781 | ""$(TargetPath)" -regserver"; |
637 | } | 782 | } |
638 | } | 783 | } |
639 | } | 784 | } |
640 | 785 | ||
641 | void VcprojGenerator::initPreLinkEventTools() | 786 | void VcprojGenerator::initPreLinkEventTools() |
642 | { | 787 | { |
643 | } | 788 | } |
644 | 789 | ||
790 | |||
791 | // ------------------------------------------------------------------ | ||
792 | // Helper functions to do proper sorting of the | ||
793 | // qstringlists, for both flat and non-flat modes. | ||
794 | inline bool XLessThanY( QString &x, QString &y, bool flat_mode ) | ||
795 | { | ||
796 | if ( flat_mode ) { | ||
797 | QString subX = x.mid( x.findRev('\\')+1 ); | ||
798 | QString subY = y.mid( y.findRev('\\')+1 ); | ||
799 | return QString::compare(subX, subY) < 0; | ||
800 | } | ||
801 | |||
802 | int xPos = 0; | ||
803 | int yPos = 0; | ||
804 | int xSlashPos; | ||
805 | int ySlashPos; | ||
806 | for (;;) { | ||
807 | xSlashPos = x.find('\\', xPos); | ||
808 | ySlashPos = y.find('\\', yPos); | ||
809 | |||
810 | if (xSlashPos == -1 && ySlashPos != -1) { | ||
811 | return false; | ||
812 | } else if (xSlashPos != -1 && ySlashPos == -1) { | ||
813 | return true; | ||
814 | } else if (xSlashPos == -1 /* && yySlashPos == -1 */) { | ||
815 | QString subX = x.mid(xPos); | ||
816 | QString subY = y.mid(yPos); | ||
817 | return QString::compare(subX, subY) < 0; | ||
818 | } else { | ||
819 | QString subX = x.mid(xPos, xSlashPos - xPos); | ||
820 | QString subY = y.mid(yPos, ySlashPos - yPos); | ||
821 | int cmp = QString::compare(subX, subY); | ||
822 | if (cmp != 0) | ||
823 | return cmp < 0; | ||
824 | } | ||
825 | xPos = xSlashPos + 1; | ||
826 | yPos = ySlashPos + 1; | ||
827 | } | ||
828 | return false; | ||
829 | } | ||
830 | void nonflatDir_BubbleSort( QStringList& list, bool flat_mode ) | ||
831 | { | ||
832 | QStringList::Iterator b = list.begin(); | ||
833 | QStringList::Iterator e = list.end(); | ||
834 | QStringList::Iterator last = e; | ||
835 | --last; // goto last | ||
836 | if ( last == b )// shortcut | ||
837 | return; | ||
838 | while( b != last ) {// sort them | ||
839 | bool swapped = FALSE; | ||
840 | QStringList::Iterator swap_pos = b; | ||
841 | QStringList::Iterator x = e; | ||
842 | QStringList::Iterator y = x; | ||
843 | --y; | ||
844 | QString swap_str; | ||
845 | do { | ||
846 | --x; | ||
847 | --y; | ||
848 | if ( XLessThanY(*x,*y, flat_mode) ) { | ||
849 | swapped = TRUE; | ||
850 | swap_str = (*x); // Swap ------- | ||
851 | (*x) = (*y); | ||
852 | (*y) = swap_str; // ------------ | ||
853 | swap_pos = y; | ||
854 | } | ||
855 | } while( y != b ); | ||
856 | if ( !swapped ) | ||
857 | return; | ||
858 | b = swap_pos; | ||
859 | ++b; | ||
860 | } | ||
861 | } | ||
862 | // ------------------------------------------------------------------ | ||
863 | |||
645 | void VcprojGenerator::initSourceFiles() | 864 | void VcprojGenerator::initSourceFiles() |
646 | { | 865 | { |
866 | vcProject.SourceFiles.flat_files = project->isActiveConfig("flat"); | ||
647 | vcProject.SourceFiles.Name = "Source Files"; | 867 | vcProject.SourceFiles.Name = "Source Files"; |
648 | vcProject.SourceFiles.Filter = "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"; | 868 | vcProject.SourceFiles.Filter = "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"; |
649 | vcProject.SourceFiles.Files += project->variables()["SOURCES"]; | 869 | vcProject.SourceFiles.Files += project->variables()["SOURCES"]; |
650 | vcProject.SourceFiles.Files.sort(); | 870 | nonflatDir_BubbleSort( vcProject.SourceFiles.Files, |
871 | vcProject.SourceFiles.flat_files ); | ||
651 | vcProject.SourceFiles.Project = this; | 872 | vcProject.SourceFiles.Project = this; |
652 | vcProject.SourceFiles.Config = &(vcProject.Configuration); | 873 | vcProject.SourceFiles.Config = &(vcProject.Configuration); |
653 | vcProject.SourceFiles.CustomBuild = none; | 874 | vcProject.SourceFiles.CustomBuild = none; |
654 | } | 875 | } |
655 | 876 | ||
656 | void VcprojGenerator::initHeaderFiles() | 877 | void VcprojGenerator::initHeaderFiles() |
657 | { | 878 | { |
879 | vcProject.HeaderFiles.flat_files = project->isActiveConfig("flat"); | ||
658 | vcProject.HeaderFiles.Name = "Header Files"; | 880 | vcProject.HeaderFiles.Name = "Header Files"; |
659 | vcProject.HeaderFiles.Filter = "h;hpp;hxx;hm;inl"; | 881 | vcProject.HeaderFiles.Filter = "h;hpp;hxx;hm;inl"; |
660 | vcProject.HeaderFiles.Files += project->variables()["HEADERS"]; | 882 | vcProject.HeaderFiles.Files += project->variables()["HEADERS"]; |
661 | vcProject.HeaderFiles.Files.sort(); | 883 | if (usePCH) { // Generated PCH cpp file |
884 | if (!vcProject.HeaderFiles.Files.contains(precompH)) | ||
885 | vcProject.HeaderFiles.Files += precompH; | ||
886 | } | ||
887 | nonflatDir_BubbleSort( vcProject.HeaderFiles.Files, | ||
888 | vcProject.HeaderFiles.flat_files ); | ||
662 | vcProject.HeaderFiles.Project = this; | 889 | vcProject.HeaderFiles.Project = this; |
663 | vcProject.HeaderFiles.Config = &(vcProject.Configuration); | 890 | vcProject.HeaderFiles.Config = &(vcProject.Configuration); |
664 | vcProject.HeaderFiles.CustomBuild = moc; | 891 | vcProject.HeaderFiles.CustomBuild = moc; |
665 | } | 892 | } |
666 | 893 | ||
667 | void VcprojGenerator::initMOCFiles() | 894 | void VcprojGenerator::initMOCFiles() |
668 | { | 895 | { |
896 | vcProject.MOCFiles.flat_files = project->isActiveConfig("flat"); | ||
669 | vcProject.MOCFiles.Name = "Generated MOC Files"; | 897 | vcProject.MOCFiles.Name = "Generated MOC Files"; |
670 | vcProject.MOCFiles.Filter = "cpp;c;cxx;moc"; | 898 | vcProject.MOCFiles.Filter = "cpp;c;cxx;moc"; |
671 | vcProject.MOCFiles.Files += project->variables()["SRCMOC"]; | 899 | vcProject.MOCFiles.Files += project->variables()["SRCMOC"]; |
672 | vcProject.MOCFiles.Files.sort(); | 900 | nonflatDir_BubbleSort( vcProject.MOCFiles.Files, |
901 | vcProject.MOCFiles.flat_files ); | ||
673 | vcProject.MOCFiles.Project = this; | 902 | vcProject.MOCFiles.Project = this; |
674 | vcProject.MOCFiles.Config = &(vcProject.Configuration); | 903 | vcProject.MOCFiles.Config = &(vcProject.Configuration); |
675 | vcProject.MOCFiles.CustomBuild = moc; | 904 | vcProject.MOCFiles.CustomBuild = moc; |
676 | } | 905 | } |
677 | 906 | ||
678 | void VcprojGenerator::initUICFiles() | 907 | void VcprojGenerator::initUICFiles() |
679 | { | 908 | { |
680 | vcProject.UICFiles.Name = "Generated UI Files"; | 909 | vcProject.UICFiles.flat_files = project->isActiveConfig("flat"); |
910 | vcProject.UICFiles.Name = "Generated Form Files"; | ||
681 | vcProject.UICFiles.Filter = "cpp;c;cxx;h;hpp;hxx;"; | 911 | vcProject.UICFiles.Filter = "cpp;c;cxx;h;hpp;hxx;"; |
682 | vcProject.UICFiles.Project = this; | 912 | vcProject.UICFiles.Project = this; |
683 | vcProject.UICFiles.Files += project->variables()["UICDECLS"]; | 913 | vcProject.UICFiles.Files += project->variables()["UICDECLS"]; |
684 | vcProject.UICFiles.Files += project->variables()["UICIMPLS"]; | 914 | vcProject.UICFiles.Files += project->variables()["UICIMPLS"]; |
685 | vcProject.UICFiles.Files.sort(); | 915 | nonflatDir_BubbleSort( vcProject.UICFiles.Files, |
916 | vcProject.UICFiles.flat_files ); | ||
686 | vcProject.UICFiles.Config = &(vcProject.Configuration); | 917 | vcProject.UICFiles.Config = &(vcProject.Configuration); |
687 | vcProject.UICFiles.CustomBuild = none; | 918 | vcProject.UICFiles.CustomBuild = none; |
688 | } | 919 | } |
689 | 920 | ||
690 | void VcprojGenerator::initFormsFiles() | 921 | void VcprojGenerator::initFormsFiles() |
691 | { | 922 | { |
923 | vcProject.FormFiles.flat_files = project->isActiveConfig("flat"); | ||
692 | vcProject.FormFiles.Name = "Forms"; | 924 | vcProject.FormFiles.Name = "Forms"; |
693 | vcProject.FormFiles.ParseFiles = _False; | 925 | vcProject.FormFiles.ParseFiles = _False; |
694 | vcProject.FormFiles.Filter = "ui"; | 926 | vcProject.FormFiles.Filter = "ui"; |
695 | vcProject.FormFiles.Files += project->variables()["FORMS"]; | 927 | vcProject.FormFiles.Files += project->variables()["FORMS"]; |
696 | vcProject.FormFiles.Files.sort(); | 928 | nonflatDir_BubbleSort( vcProject.FormFiles.Files, |
929 | vcProject.FormFiles.flat_files ); | ||
697 | vcProject.FormFiles.Project = this; | 930 | vcProject.FormFiles.Project = this; |
698 | vcProject.FormFiles.Config = &(vcProject.Configuration); | 931 | vcProject.FormFiles.Config = &(vcProject.Configuration); |
699 | vcProject.FormFiles.CustomBuild = uic; | 932 | vcProject.FormFiles.CustomBuild = uic; |
700 | } | 933 | } |
701 | 934 | ||
702 | void VcprojGenerator::initTranslationFiles() | 935 | void VcprojGenerator::initTranslationFiles() |
703 | { | 936 | { |
937 | vcProject.TranslationFiles.flat_files = project->isActiveConfig("flat"); | ||
704 | vcProject.TranslationFiles.Name = "Translations Files"; | 938 | vcProject.TranslationFiles.Name = "Translations Files"; |
705 | vcProject.TranslationFiles.ParseFiles = _False; | 939 | vcProject.TranslationFiles.ParseFiles = _False; |
706 | vcProject.TranslationFiles.Filter = "ts"; | 940 | vcProject.TranslationFiles.Filter = "ts"; |
707 | vcProject.TranslationFiles.Files += project->variables()["TRANSLATIONS"]; | 941 | vcProject.TranslationFiles.Files += project->variables()["TRANSLATIONS"]; |
708 | vcProject.TranslationFiles.Files.sort(); | 942 | nonflatDir_BubbleSort( vcProject.TranslationFiles.Files, |
943 | vcProject.TranslationFiles.flat_files ); | ||
709 | vcProject.TranslationFiles.Project = this; | 944 | vcProject.TranslationFiles.Project = this; |
710 | vcProject.TranslationFiles.Config = &(vcProject.Configuration); | 945 | vcProject.TranslationFiles.Config = &(vcProject.Configuration); |
711 | vcProject.TranslationFiles.CustomBuild = none; | 946 | vcProject.TranslationFiles.CustomBuild = none; |
712 | } | 947 | } |
713 | 948 | ||
714 | void VcprojGenerator::initLexYaccFiles() | 949 | void VcprojGenerator::initLexYaccFiles() |
715 | { | 950 | { |
951 | vcProject.LexYaccFiles.flat_files = project->isActiveConfig("flat"); | ||
716 | vcProject.LexYaccFiles.Name = "Lex / Yacc Files"; | 952 | vcProject.LexYaccFiles.Name = "Lex / Yacc Files"; |
717 | vcProject.LexYaccFiles.ParseFiles = _False; | 953 | vcProject.LexYaccFiles.ParseFiles = _False; |
718 | vcProject.LexYaccFiles.Filter = "l;y"; | 954 | vcProject.LexYaccFiles.Filter = "l;y"; |
719 | vcProject.LexYaccFiles.Files += project->variables()["LEXSOURCES"]; | 955 | vcProject.LexYaccFiles.Files += project->variables()["LEXSOURCES"]; |
720 | vcProject.LexYaccFiles.Files += project->variables()["YACCSOURCES"]; | 956 | vcProject.LexYaccFiles.Files += project->variables()["YACCSOURCES"]; |
721 | vcProject.LexYaccFiles.Files.sort(); | 957 | nonflatDir_BubbleSort( vcProject.LexYaccFiles.Files, |
958 | vcProject.LexYaccFiles.flat_files ); | ||
722 | vcProject.LexYaccFiles.Project = this; | 959 | vcProject.LexYaccFiles.Project = this; |
960 | vcProject.LexYaccFiles.Config = &(vcProject.Configuration); | ||
723 | vcProject.LexYaccFiles.CustomBuild = lexyacc; | 961 | vcProject.LexYaccFiles.CustomBuild = lexyacc; |
724 | } | 962 | } |
725 | 963 | ||
726 | void VcprojGenerator::initResourceFiles() | 964 | void VcprojGenerator::initResourceFiles() |
727 | { | 965 | { |
966 | vcProject.ResourceFiles.flat_files = project->isActiveConfig("flat"); | ||
728 | vcProject.ResourceFiles.Name = "Resources"; | 967 | vcProject.ResourceFiles.Name = "Resources"; |
729 | vcProject.ResourceFiles.ParseFiles = _False; | 968 | vcProject.ResourceFiles.ParseFiles = _False; |
730 | vcProject.ResourceFiles.Filter = "cpp;ico;png;jpg;jpeg;gif;xpm;bmp;rc;ts"; | 969 | vcProject.ResourceFiles.Filter = "cpp;ico;png;jpg;jpeg;gif;xpm;bmp;rc;ts"; |
731 | vcProject.ResourceFiles.Files += project->variables()["RC_FILE"]; | 970 | vcProject.ResourceFiles.Files += project->variables()["RC_FILE"]; |
732 | vcProject.ResourceFiles.Files += project->variables()["QMAKE_IMAGE_COLLECTION"]; | 971 | vcProject.ResourceFiles.Files += project->variables()["QMAKE_IMAGE_COLLECTION"]; |
733 | vcProject.ResourceFiles.Files += project->variables()["IMAGES"]; | 972 | vcProject.ResourceFiles.Files += project->variables()["IMAGES"]; |
734 | vcProject.ResourceFiles.Files += project->variables()["IDLSOURCES"]; | 973 | vcProject.ResourceFiles.Files += project->variables()["IDLSOURCES"]; |
735 | vcProject.ResourceFiles.Files.sort(); | 974 | nonflatDir_BubbleSort( vcProject.ResourceFiles.Files, |
975 | vcProject.ResourceFiles.flat_files ); | ||
736 | vcProject.ResourceFiles.Project = this; | 976 | vcProject.ResourceFiles.Project = this; |
737 | vcProject.ResourceFiles.CustomBuild = none; | 977 | vcProject.ResourceFiles.Config = &(vcProject.Configuration); |
978 | vcProject.ResourceFiles.CustomBuild = resource; | ||
738 | } | 979 | } |
739 | 980 | ||
740 | /* \internal | 981 | /* \internal |
741 | Sets up all needed variables from the environment and all the different caches and .conf files | 982 | Sets up all needed variables from the environment and all the different caches and .conf files |
742 | */ | 983 | */ |
743 | 984 | ||
744 | void VcprojGenerator::initOld() | 985 | void VcprojGenerator::initOld() |
745 | { | 986 | { |
746 | if( init_flag ) | 987 | if( init_flag ) |
747 | return; | 988 | return; |
748 | 989 | ||
749 | init_flag = TRUE; | 990 | init_flag = TRUE; |
750 | QStringList::Iterator it; | 991 | QStringList::Iterator it; |
751 | 992 | ||
752 | if ( project->isActiveConfig("stl") ) { | 993 | if ( project->isActiveConfig("stl") ) { |
753 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"]; | 994 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"]; |
754 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"]; | 995 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"]; |
755 | } else { | 996 | } else { |
756 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"]; | 997 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"]; |
757 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"]; | 998 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"]; |
758 | } | 999 | } |
759 | if ( project->isActiveConfig("exceptions") ) { | 1000 | if ( project->isActiveConfig("exceptions") ) { |
760 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; | 1001 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; |
761 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; | 1002 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; |
762 | } else { | 1003 | } else { |
763 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; | 1004 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; |
764 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; | 1005 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; |
765 | } | 1006 | } |
766 | if ( project->isActiveConfig("rtti") ) { | 1007 | if ( project->isActiveConfig("rtti") ) { |
767 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; | 1008 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; |
768 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; | 1009 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; |
769 | } else { | 1010 | } else { |
770 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; | 1011 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; |
771 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; | 1012 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; |
772 | } | 1013 | } |
773 | 1014 | ||
774 | // this should probably not be here, but I'm using it to wrap the .t files | 1015 | // this should probably not be here, but I'm using it to wrap the .t files |
775 | if(project->first("TEMPLATE") == "vcapp" ) | 1016 | if(project->first("TEMPLATE") == "vcapp" ) |
776 | project->variables()["QMAKE_APP_FLAG"].append("1"); | 1017 | project->variables()["QMAKE_APP_FLAG"].append("1"); |
777 | else if(project->first("TEMPLATE") == "vclib") | 1018 | else if(project->first("TEMPLATE") == "vclib") |
778 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | 1019 | project->variables()["QMAKE_LIB_FLAG"].append("1"); |
779 | if ( project->variables()["QMAKESPEC"].isEmpty() ) | 1020 | if ( project->variables()["QMAKESPEC"].isEmpty() ) |
780 | project->variables()["QMAKESPEC"].append( getenv("QMAKESPEC") ); | 1021 | project->variables()["QMAKESPEC"].append( getenv("QMAKESPEC") ); |
781 | 1022 | ||
782 | bool is_qt = | 1023 | bool is_qt = |
783 | ( project->first("TARGET") == "qt"QTDLL_POSTFIX || | 1024 | ( project->first("TARGET") == "qt"QTDLL_POSTFIX || |
784 | project->first("TARGET") == "qt-mt"QTDLL_POSTFIX ); | 1025 | project->first("TARGET") == "qt-mt"QTDLL_POSTFIX ); |
785 | 1026 | ||
@@ -820,180 +1061,189 @@ void VcprojGenerator::initOld() | |||
820 | project->variables()["CONFIG"].append( "windows" ); | 1061 | project->variables()["CONFIG"].append( "windows" ); |
821 | } | 1062 | } |
822 | 1063 | ||
823 | // Decode version, and add it to $$MSVCPROJ_VERSION -------------- | 1064 | // Decode version, and add it to $$MSVCPROJ_VERSION -------------- |
824 | if ( !project->variables()["VERSION"].isEmpty() ) { | 1065 | if ( !project->variables()["VERSION"].isEmpty() ) { |
825 | QString version = project->variables()["VERSION"][0]; | 1066 | QString version = project->variables()["VERSION"][0]; |
826 | int firstDot = version.find( "." ); | 1067 | int firstDot = version.find( "." ); |
827 | QString major = version.left( firstDot ); | 1068 | QString major = version.left( firstDot ); |
828 | QString minor = version.right( version.length() - firstDot - 1 ); | 1069 | QString minor = version.right( version.length() - firstDot - 1 ); |
829 | minor.replace( QRegExp( "\\." ), "" ); | 1070 | minor.replace( QRegExp( "\\." ), "" ); |
830 | project->variables()["MSVCPROJ_VERSION"].append( "/VERSION:" + major + "." + minor ); | 1071 | project->variables()["MSVCPROJ_VERSION"].append( "/VERSION:" + major + "." + minor ); |
831 | } | 1072 | } |
832 | 1073 | ||
833 | // QT ------------------------------------------------------------ | 1074 | // QT ------------------------------------------------------------ |
834 | if ( project->isActiveConfig("qt") ) { | 1075 | if ( project->isActiveConfig("qt") ) { |
835 | project->variables()["CONFIG"].append("moc"); | 1076 | project->variables()["CONFIG"].append("moc"); |
836 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; | 1077 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; |
837 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; | 1078 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; |
838 | 1079 | ||
839 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | 1080 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { |
840 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 1081 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
841 | project->variables()["DEFINES"].append("QT_MAKEDLL"); | 1082 | project->variables()["DEFINES"].append("QT_MAKEDLL"); |
842 | project->variables()["QMAKE_LFLAGS"].append("/BASE:0x39D00000"); | 1083 | project->variables()["QMAKE_LFLAGS"].append("/BASE:0x39D00000"); |
843 | } | 1084 | } |
844 | } else { | 1085 | } else { |
845 | if(project->isActiveConfig("thread")) | 1086 | if(project->isActiveConfig("thread")) |
846 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | 1087 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; |
847 | else | 1088 | else |
848 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; | 1089 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; |
849 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 1090 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
850 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); | 1091 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); |
851 | if( hver==-1 ) { | 1092 | if( hver==-1 ) { |
852 | hver = findHighestVersion( project->first("QMAKE_LIBDIR_QT"), "qt-mt" ); | 1093 | hver = findHighestVersion( project->first("QMAKE_LIBDIR_QT"), "qt-mt" ); |
853 | } | 1094 | } |
854 | 1095 | ||
855 | if(hver != -1) { | 1096 | if(hver != -1) { |
856 | QString ver; | 1097 | QString ver; |
857 | ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "-mt" : ""), hver); | 1098 | ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "-mt" : ""), hver); |
858 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | 1099 | QStringList &libs = project->variables()["QMAKE_LIBS"]; |
859 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) | 1100 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) |
860 | (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); | 1101 | (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); |
861 | } | 1102 | } |
862 | } | 1103 | } |
863 | if ( project->isActiveConfig( "activeqt" ) ) { | 1104 | if ( project->isActiveConfig( "activeqt" ) ) { |
864 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); | 1105 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); |
865 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; | 1106 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; |
866 | if ( project->isActiveConfig( "dll" ) ) { | 1107 | if ( project->isActiveConfig( "dll" ) ) { |
867 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 1108 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
868 | project->variables()["MSVCPROJ_LFLAGS"].append("/DEF:"+project->first("DEF_FILE")); | ||
869 | } | 1109 | } |
870 | } | 1110 | } |
871 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { | 1111 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { |
872 | project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 1112 | project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
873 | } | 1113 | } |
874 | } | 1114 | } |
875 | } | 1115 | } |
876 | 1116 | ||
877 | // Set target directories ---------------------------------------- | 1117 | // Set target directories ---------------------------------------- |
878 | // if ( !project->first("OBJECTS_DIR").isEmpty() ) | 1118 | // if ( !project->first("OBJECTS_DIR").isEmpty() ) |
879 | //project->variables()["MSVCPROJ_OBJECTSDIR"] = project->first("OBJECTS_DIR"); | 1119 | //project->variables()["MSVCPROJ_OBJECTSDIR"] = project->first("OBJECTS_DIR"); |
880 | // else | 1120 | // else |
881 | //project->variables()["MSVCPROJ_OBJECTSDIR"] = project->isActiveConfig( "release" )?"Release":"Debug"; | 1121 | //project->variables()["MSVCPROJ_OBJECTSDIR"] = project->isActiveConfig( "release" )?"Release":"Debug"; |
882 | // if ( !project->first("DESTDIR").isEmpty() ) | 1122 | // if ( !project->first("DESTDIR").isEmpty() ) |
883 | //project->variables()["MSVCPROJ_TARGETDIR"] = project->first("DESTDIR"); | 1123 | //project->variables()["MSVCPROJ_TARGETDIR"] = project->first("DESTDIR"); |
884 | // else | 1124 | // else |
885 | //project->variables()["MSVCPROJ_TARGETDIR"] = project->isActiveConfig( "release" )?"Release":"Debug"; | 1125 | //project->variables()["MSVCPROJ_TARGETDIR"] = project->isActiveConfig( "release" )?"Release":"Debug"; |
886 | 1126 | ||
887 | // OPENGL -------------------------------------------------------- | 1127 | // OPENGL -------------------------------------------------------- |
888 | if ( project->isActiveConfig("opengl") ) { | 1128 | if ( project->isActiveConfig("opengl") ) { |
889 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | 1129 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; |
890 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; | 1130 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; |
891 | } | 1131 | } |
892 | 1132 | ||
893 | // THREAD -------------------------------------------------------- | 1133 | // THREAD -------------------------------------------------------- |
894 | if ( project->isActiveConfig("thread") ) { | 1134 | if ( project->isActiveConfig("thread") ) { |
895 | if(project->isActiveConfig("qt")) | 1135 | if(project->isActiveConfig("qt")) |
896 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT" ); | 1136 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT" ); |
897 | if ( !project->variables()["DEFINES"].contains("QT_DLL") && is_qt | 1137 | if ( !project->variables()["DEFINES"].contains("QT_DLL") && is_qt |
898 | && project->first("TARGET") != "qtmain" ) | 1138 | && project->first("TARGET") != "qtmain" ) |
899 | project->variables()["QMAKE_LFLAGS"].append("/NODEFAULTLIB:libc"); | 1139 | project->variables()["QMAKE_LFLAGS"].append("/NODEFAULTLIB:libc"); |
900 | } | 1140 | } |
901 | 1141 | ||
902 | // ACCESSIBILITY ------------------------------------------------- | 1142 | // ACCESSIBILITY ------------------------------------------------- |
903 | if(project->isActiveConfig("qt")) { | 1143 | if(project->isActiveConfig("qt")) { |
904 | if ( project->isActiveConfig("accessibility" ) ) | 1144 | if ( project->isActiveConfig("accessibility" ) ) |
905 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); | 1145 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); |
906 | if ( project->isActiveConfig("tablet") ) | 1146 | if ( project->isActiveConfig("tablet") ) |
907 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); | 1147 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); |
908 | } | 1148 | } |
909 | 1149 | ||
910 | // DLL ----------------------------------------------------------- | 1150 | // DLL ----------------------------------------------------------- |
911 | if ( project->isActiveConfig("dll") ) { | 1151 | if ( project->isActiveConfig("dll") ) { |
912 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | 1152 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { |
913 | QString ver_xyz(project->first("VERSION")); | 1153 | QString ver_xyz(project->first("VERSION")); |
914 | ver_xyz.replace(QRegExp("\\."), ""); | 1154 | ver_xyz.replace(QRegExp("\\."), ""); |
915 | project->variables()["TARGET_EXT"].append(ver_xyz + ".dll"); | 1155 | project->variables()["TARGET_EXT"].append(ver_xyz + ".dll"); |
916 | } else { | 1156 | } else { |
917 | project->variables()["TARGET_EXT"].append(".dll"); | 1157 | project->variables()["TARGET_EXT"].append(".dll"); |
918 | } | 1158 | } |
919 | } | 1159 | } |
920 | // EXE / LIB ----------------------------------------------------- | 1160 | // EXE / LIB ----------------------------------------------------- |
921 | else { | 1161 | else { |
922 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) | 1162 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) |
923 | project->variables()["TARGET_EXT"].append(".exe"); | 1163 | project->variables()["TARGET_EXT"].append(".exe"); |
924 | else | 1164 | else |
925 | project->variables()["TARGET_EXT"].append(".lib"); | 1165 | project->variables()["TARGET_EXT"].append(".lib"); |
926 | } | 1166 | } |
927 | 1167 | ||
928 | project->variables()["MSVCPROJ_VER"] = "7.00"; | 1168 | project->variables()["MSVCPROJ_VER"] = "7.00"; |
929 | project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /ZI"; | 1169 | project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /ZI"; |
930 | 1170 | ||
931 | // INCREMENTAL:NO ------------------------------------------------ | 1171 | // INCREMENTAL:NO ------------------------------------------------ |
932 | if(!project->isActiveConfig("incremental")) { | 1172 | if(!project->isActiveConfig("incremental")) { |
933 | project->variables()["QMAKE_LFLAGS"].append(QString("/INCREMENTAL:no")); | 1173 | project->variables()["QMAKE_LFLAGS"].append(QString("/INCREMENTAL:no")); |
934 | if ( is_qt ) | 1174 | if ( is_qt ) |
935 | project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /Zi"; | 1175 | project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /Zi"; |
936 | } | 1176 | } |
937 | 1177 | ||
938 | // MOC ----------------------------------------------------------- | 1178 | // MOC ----------------------------------------------------------- |
939 | if ( project->isActiveConfig("moc") ) | 1179 | if ( project->isActiveConfig("moc") ) |
940 | setMocAware(TRUE); | 1180 | setMocAware(TRUE); |
941 | 1181 | ||
1182 | // /VERSION:x.yz ------------------------------------------------- | ||
1183 | if ( !project->variables()["VERSION"].isEmpty() ) { | ||
1184 | QString version = project->variables()["VERSION"][0]; | ||
1185 | int firstDot = version.find( "." ); | ||
1186 | QString major = version.left( firstDot ); | ||
1187 | QString minor = version.right( version.length() - firstDot - 1 ); | ||
1188 | minor.replace( ".", "" ); | ||
1189 | project->variables()["QMAKE_LFLAGS"].append( "/VERSION:" + major + "." + minor ); | ||
1190 | } | ||
942 | 1191 | ||
943 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 1192 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
944 | // Update -lname to name.lib, and -Ldir to | 1193 | // Update -lname to name.lib, and -Ldir to |
945 | QStringList &libList = project->variables()["QMAKE_LIBS"]; | 1194 | QStringList &libList = project->variables()["QMAKE_LIBS"]; |
946 | for( it = libList.begin(); it != libList.end(); ) { | 1195 | for( it = libList.begin(); it != libList.end(); ) { |
947 | QString s = *it; | 1196 | QString s = *it; |
948 | if( s.startsWith( "-l" ) ) { | 1197 | if( s.startsWith( "-l" ) ) { |
949 | it = libList.remove( it ); | 1198 | it = libList.remove( it ); |
950 | it = libList.insert( it, s.mid( 2 ) + ".lib" ); | 1199 | it = libList.insert( it, s.mid( 2 ) + ".lib" ); |
951 | } else if( s.startsWith( "-L" ) ) { | 1200 | } else if( s.startsWith( "-L" ) ) { |
1201 | project->variables()["QMAKE_LIBDIR"] += (*it).mid(2); | ||
952 | it = libList.remove( it ); | 1202 | it = libList.remove( it ); |
953 | } else { | 1203 | } else { |
954 | it++; | 1204 | it++; |
955 | } | 1205 | } |
956 | } | 1206 | } |
957 | 1207 | ||
958 | // Run through all variables containing filepaths, and ----------- | 1208 | // Run through all variables containing filepaths, and ----------- |
959 | // slash-slosh them correctly depending on current OS ----------- | 1209 | // slash-slosh them correctly depending on current OS ----------- |
960 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); | 1210 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); |
961 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; | 1211 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; |
962 | for(it = l.begin(); it != l.end(); ++it) { | 1212 | for(it = l.begin(); it != l.end(); ++it) { |
963 | QStringList &gdmf = project->variables()[(*it)]; | 1213 | QStringList &gdmf = project->variables()[(*it)]; |
964 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) | 1214 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) |
965 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); | 1215 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); |
966 | } | 1216 | } |
967 | 1217 | ||
968 | // Get filename w/o extention ----------------------------------- | 1218 | // Get filename w/o extention ----------------------------------- |
969 | QString msvcproj_project = ""; | 1219 | QString msvcproj_project = ""; |
970 | QString targetfilename = ""; | 1220 | QString targetfilename = ""; |
971 | if ( project->variables()["TARGET"].count() ) { | 1221 | if ( project->variables()["TARGET"].count() ) { |
972 | msvcproj_project = project->variables()["TARGET"].first(); | 1222 | msvcproj_project = project->variables()["TARGET"].first(); |
973 | targetfilename = msvcproj_project; | 1223 | targetfilename = msvcproj_project; |
974 | } | 1224 | } |
975 | 1225 | ||
976 | // Save filename w/o extention in $$QMAKE_ORIG_TARGET ------------ | 1226 | // Save filename w/o extention in $$QMAKE_ORIG_TARGET ------------ |
977 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | 1227 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; |
978 | 1228 | ||
979 | // TARGET (add extention to $$TARGET) | 1229 | // TARGET (add extention to $$TARGET) |
980 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue(".first() += project->first("TARGET_EXT"); | 1230 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue(".first() += project->first("TARGET_EXT"); |
981 | 1231 | ||
982 | // Init base class too ------------------------------------------- | 1232 | // Init base class too ------------------------------------------- |
983 | MakefileGenerator::init(); | 1233 | MakefileGenerator::init(); |
984 | 1234 | ||
985 | 1235 | ||
986 | if ( msvcproj_project.isEmpty() ) | 1236 | if ( msvcproj_project.isEmpty() ) |
987 | msvcproj_project = Option::output.name(); | 1237 | msvcproj_project = Option::output.name(); |
988 | 1238 | ||
989 | msvcproj_project = msvcproj_project.right( msvcproj_project.length() - msvcproj_project.findRev( "\\" ) - 1 ); | 1239 | msvcproj_project = msvcproj_project.right( msvcproj_project.length() - msvcproj_project.findRev( "\\" ) - 1 ); |
990 | msvcproj_project = msvcproj_project.left( msvcproj_project.findRev( "." ) ); | 1240 | msvcproj_project = msvcproj_project.left( msvcproj_project.findRev( "." ) ); |
991 | msvcproj_project.replace(QRegExp("-"), ""); | 1241 | msvcproj_project.replace(QRegExp("-"), ""); |
992 | 1242 | ||
993 | project->variables()["MSVCPROJ_PROJECT"].append(msvcproj_project); | 1243 | project->variables()["MSVCPROJ_PROJECT"].append(msvcproj_project); |
994 | QStringList &proj = project->variables()["MSVCPROJ_PROJECT"]; | 1244 | QStringList &proj = project->variables()["MSVCPROJ_PROJECT"]; |
995 | 1245 | ||
996 | for(it = proj.begin(); it != proj.end(); ++it) | 1246 | for(it = proj.begin(); it != proj.end(); ++it) |
997 | (*it).replace(QRegExp("\\.[a-zA-Z0-9_]*$"), ""); | 1247 | (*it).replace(QRegExp("\\.[a-zA-Z0-9_]*$"), ""); |
998 | 1248 | ||
999 | // SUBSYSTEM ----------------------------------------------------- | 1249 | // SUBSYSTEM ----------------------------------------------------- |
@@ -1005,172 +1255,170 @@ void VcprojGenerator::initOld() | |||
1005 | project->variables()["MSVCPROJ_VCPROJTYPE"].append("0x0103"); | 1255 | project->variables()["MSVCPROJ_VCPROJTYPE"].append("0x0103"); |
1006 | project->variables()["MSVCPROJ_SUBSYSTEM"].append("CONSOLE"); | 1256 | project->variables()["MSVCPROJ_SUBSYSTEM"].append("CONSOLE"); |
1007 | } else { | 1257 | } else { |
1008 | project->variables()["MSVCPROJ_CONSOLE"].clear(); | 1258 | project->variables()["MSVCPROJ_CONSOLE"].clear(); |
1009 | project->variables()["MSVCPROJ_WINCONDEF"].append("_WINDOWS"); | 1259 | project->variables()["MSVCPROJ_WINCONDEF"].append("_WINDOWS"); |
1010 | project->variables()["MSVCPROJ_VCPROJTYPE"].append("0x0101"); | 1260 | project->variables()["MSVCPROJ_VCPROJTYPE"].append("0x0101"); |
1011 | project->variables()["MSVCPROJ_SUBSYSTEM"].append("WINDOWS"); | 1261 | project->variables()["MSVCPROJ_SUBSYSTEM"].append("WINDOWS"); |
1012 | } | 1262 | } |
1013 | } else { | 1263 | } else { |
1014 | if ( project->isActiveConfig("dll") ) { | 1264 | if ( project->isActiveConfig("dll") ) { |
1015 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32dll" + project->first( "VCPROJ_EXTENSION" ) ); | 1265 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32dll" + project->first( "VCPROJ_EXTENSION" ) ); |
1016 | } else { | 1266 | } else { |
1017 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32lib" + project->first( "VCPROJ_EXTENSION" ) ); | 1267 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32lib" + project->first( "VCPROJ_EXTENSION" ) ); |
1018 | } | 1268 | } |
1019 | } | 1269 | } |
1020 | 1270 | ||
1021 | // $$QMAKE.. -> $$MSVCPROJ.. ------------------------------------- | 1271 | // $$QMAKE.. -> $$MSVCPROJ.. ------------------------------------- |
1022 | project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS"]; | 1272 | project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS"]; |
1023 | project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | 1273 | project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; |
1024 | project->variables()["MSVCPROJ_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; | 1274 | project->variables()["MSVCPROJ_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; |
1025 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) { | 1275 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) { |
1026 | QStringList strl = project->variables()["QMAKE_LIBDIR"]; | 1276 | QStringList strl = project->variables()["QMAKE_LIBDIR"]; |
1027 | QStringList::iterator stri; | 1277 | QStringList::iterator stri; |
1028 | for ( stri = strl.begin(); stri != strl.end(); ++stri ) { | 1278 | for ( stri = strl.begin(); stri != strl.end(); ++stri ) { |
1029 | if ( !(*stri).startsWith("/LIBPATH:") ) | 1279 | if ( !(*stri).startsWith("/LIBPATH:") ) |
1030 | (*stri).prepend( "/LIBPATH:" ); | 1280 | (*stri).prepend( "/LIBPATH:" ); |
1031 | } | 1281 | } |
1032 | project->variables()["MSVCPROJ_LFLAGS"] += strl; | 1282 | project->variables()["MSVCPROJ_LFLAGS"] += strl; |
1033 | } | 1283 | } |
1034 | project->variables()["MSVCPROJ_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; | 1284 | project->variables()["MSVCPROJ_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; |
1035 | // We don't use this... Direct manipulation of compiler object | 1285 | // We don't use this... Direct manipulation of compiler object |
1036 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); | 1286 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); |
1037 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); | 1287 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); |
1038 | QStringList &incs = project->variables()["INCLUDEPATH"]; | 1288 | QStringList &incs = project->variables()["INCLUDEPATH"]; |
1039 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { | 1289 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { |
1040 | QString inc = (*incit); | 1290 | QString inc = (*incit); |
1041 | inc.replace(QRegExp("\""), ""); | 1291 | inc.replace(QRegExp("\""), ""); |
1042 | project->variables()["MSVCPROJ_INCPATH"].append("/I" + inc ); | 1292 | project->variables()["MSVCPROJ_INCPATH"].append("/I" + inc ); |
1043 | } | 1293 | } |
1044 | project->variables()["MSVCPROJ_INCPATH"].append("/I" + specdir()); | 1294 | project->variables()["MSVCPROJ_INCPATH"].append("/I" + specdir()); |
1045 | 1295 | ||
1046 | QString dest; | 1296 | QString dest; |
1047 | project->variables()["MSVCPROJ_TARGET"] = project->first("TARGET"); | 1297 | project->variables()["MSVCPROJ_TARGET"] = project->first("TARGET"); |
1048 | Option::fixPathToTargetOS(project->first("TARGET")); | 1298 | Option::fixPathToTargetOS(project->first("TARGET")); |
1049 | dest = project->first("TARGET") + project->first( "TARGET_EXT" ); | 1299 | dest = project->first("TARGET") + project->first( "TARGET_EXT" ); |
1050 | if ( project->first("TARGET").startsWith("$(QTDIR)") ) | 1300 | if ( project->first("TARGET").startsWith("$(QTDIR)") ) |
1051 | dest.replace( QRegExp("\\$\\(QTDIR\\)"), getenv("QTDIR") ); | 1301 | dest.replace( QRegExp("\\$\\(QTDIR\\)"), getenv("QTDIR") ); |
1052 | project->variables()["MSVCPROJ_TARGET"] = dest; | 1302 | project->variables()["MSVCPROJ_TARGET"] = dest; |
1053 | if ( project->isActiveConfig("dll") ) { | ||
1054 | QString imp = project->first( "DESTDIR" ); | ||
1055 | if( !imp.isNull() && !imp.endsWith( "\\" ) ) | ||
1056 | imp += "\\"; | ||
1057 | imp += dest; | ||
1058 | imp.replace(QRegExp("\\.dll"), ".lib"); | ||
1059 | project->variables()["MSVCPROJ_LIBOPTIONS"] += QString("/IMPLIB:") + imp; | ||
1060 | } | ||
1061 | 1303 | ||
1062 | // DLL COPY ------------------------------------------------------ | 1304 | // DLL COPY ------------------------------------------------------ |
1063 | if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) { | 1305 | if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) { |
1064 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; | 1306 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; |
1065 | QString copydll = "# Begin Special Build Tool\n" | 1307 | QString copydll(""); |
1066 | "TargetPath=" + dest + "\n" | 1308 | QStringList::Iterator dlldir; |
1067 | "SOURCE=$(InputPath)\n" | 1309 | for ( dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { |
1068 | "PostBuild_Desc=Copy DLL to " + project->first("DLLDESTDIR") + "\n" | 1310 | if ( !copydll.isEmpty() ) |
1069 | "PostBuild_Cmds="; | 1311 | copydll += " && "; |
1070 | 1312 | copydll += "copy "$(TargetPath)" "" + *dlldir + """; | |
1071 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { | ||
1072 | copydll += "copy \"" + dest + "\" \"" + *dlldir + "\"\t"; | ||
1073 | } | 1313 | } |
1074 | 1314 | ||
1075 | copydll += "\n# End Special Build Tool"; | 1315 | QString deststr( "Copy " + dest + " to " ); |
1076 | project->variables()["MSVCPROJ_COPY_DLL_REL"].append( copydll ); | 1316 | for ( dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ) { |
1077 | project->variables()["MSVCPROJ_COPY_DLL_DBG"].append( copydll ); | 1317 | deststr += *dlldir; |
1318 | ++dlldir; | ||
1319 | if ( dlldir != dlldirs.end() ) | ||
1320 | deststr += ", "; | ||
1321 | } | ||
1322 | |||
1323 | project->variables()["MSVCPROJ_COPY_DLL"].append( copydll ); | ||
1324 | project->variables()["MSVCPROJ_COPY_DLL_DESC"].append( deststr ); | ||
1078 | } | 1325 | } |
1079 | 1326 | ||
1080 | // ACTIVEQT ------------------------------------------------------ | 1327 | // ACTIVEQT ------------------------------------------------------ |
1081 | if ( project->isActiveConfig("activeqt") ) { | 1328 | if ( project->isActiveConfig("activeqt") ) { |
1082 | QString idl = project->variables()["QMAKE_IDL"].first(); | 1329 | QString idl = project->variables()["QMAKE_IDL"].first(); |
1083 | QString idc = project->variables()["QMAKE_IDC"].first(); | 1330 | QString idc = project->variables()["QMAKE_IDC"].first(); |
1084 | QString version = project->variables()["VERSION"].first(); | 1331 | QString version = project->variables()["VERSION"].first(); |
1085 | if ( version.isEmpty() ) | 1332 | if ( version.isEmpty() ) |
1086 | version = "1.0"; | 1333 | version = "1.0"; |
1087 | 1334 | ||
1088 | project->variables()["MSVCPROJ_IDLSOURCES"].append( "tmp\\" + targetfilename + ".idl" ); | 1335 | QString objdir = project->first( "OBJECTS_DIR" ); |
1089 | project->variables()["MSVCPROJ_IDLSOURCES"].append( "tmp\\" + targetfilename + ".tlb" ); | 1336 | project->variables()["MSVCPROJ_IDLSOURCES"].append( objdir + targetfilename + ".idl" ); |
1090 | project->variables()["MSVCPROJ_IDLSOURCES"].append( "tmp\\" + targetfilename + ".midl" ); | ||
1091 | if ( project->isActiveConfig( "dll" ) ) { | 1337 | if ( project->isActiveConfig( "dll" ) ) { |
1092 | QString regcmd = "# Begin Special Build Tool\n" | 1338 | QString regcmd = "# Begin Special Build Tool\n" |
1093 | "TargetPath=" + targetfilename + "\n" | 1339 | "TargetPath=" + targetfilename + "\n" |
1094 | "SOURCE=$(InputPath)\n" | 1340 | "SOURCE=$(InputPath)\n" |
1095 | "PostBuild_Desc=Finalizing ActiveQt server...\n" | 1341 | "PostBuild_Desc=Finalizing ActiveQt server...\n" |
1096 | "PostBuild_Cmds=" + | 1342 | "PostBuild_Cmds=" + |
1097 | idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version + | 1343 | idc + " %1 -idl " + objdir + targetfilename + ".idl -version " + version + |
1098 | "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl" | 1344 | "\t" + idl + " /nologo " + objdir + targetfilename + ".idl /tlb " + objdir + targetfilename + ".tlb" + |
1099 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" | 1345 | "\t" + idc + " %1 /tlb " + objdir + targetfilename + ".tlb" |
1100 | "\tregsvr32 /s %1\n" | 1346 | "\tregsvr32 /s %1\n" |
1101 | "# End Special Build Tool"; | 1347 | "# End Special Build Tool"; |
1102 | 1348 | ||
1103 | QString executable = project->variables()["MSVCPROJ_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); | 1349 | QString executable = project->variables()["MSVCPROJ_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); |
1104 | project->variables()["MSVCPROJ_COPY_DLL_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); | 1350 | project->variables()["MSVCPROJ_COPY_DLL_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); |
1105 | 1351 | ||
1106 | executable = project->variables()["MSVCPROJ_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); | 1352 | executable = project->variables()["MSVCPROJ_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); |
1107 | project->variables()["MSVCPROJ_COPY_DLL_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); | 1353 | project->variables()["MSVCPROJ_COPY_DLL_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); |
1108 | } else { | 1354 | } else { |
1109 | QString regcmd = "# Begin Special Build Tool\n" | 1355 | QString regcmd = "# Begin Special Build Tool\n" |
1110 | "TargetPath=" + targetfilename + "\n" | 1356 | "TargetPath=" + targetfilename + "\n" |
1111 | "SOURCE=$(InputPath)\n" | 1357 | "SOURCE=$(InputPath)\n" |
1112 | "PostBuild_Desc=Finalizing ActiveQt server...\n" | 1358 | "PostBuild_Desc=Finalizing ActiveQt server...\n" |
1113 | "PostBuild_Cmds=" | 1359 | "PostBuild_Cmds=" |
1114 | "%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version + | 1360 | "%1 -dumpidl " + objdir + targetfilename + ".idl -version " + version + |
1115 | "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl" | 1361 | "\t" + idl + " /nologo " + objdir + targetfilename + ".idl /tlb " + objdir + targetfilename + ".tlb" |
1116 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" | 1362 | "\t" + idc + " %1 /tlb " + objdir + targetfilename + ".tlb" |
1117 | "\t%1 -regserver\n" | 1363 | "\t%1 -regserver\n" |
1118 | "# End Special Build Tool"; | 1364 | "# End Special Build Tool"; |
1119 | 1365 | ||
1120 | QString executable = project->variables()["MSVCPROJ_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); | 1366 | QString executable = project->variables()["MSVCPROJ_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); |
1121 | project->variables()["MSVCPROJ_REGSVR_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); | 1367 | project->variables()["MSVCPROJ_REGSVR_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); |
1122 | 1368 | ||
1123 | executable = project->variables()["MSVCPROJ_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); | 1369 | executable = project->variables()["MSVCPROJ_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); |
1124 | project->variables()["MSVCPROJ_REGSVR_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); | 1370 | project->variables()["MSVCPROJ_REGSVR_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); |
1125 | } | 1371 | } |
1126 | |||
1127 | } | 1372 | } |
1128 | 1373 | ||
1374 | if ( !project->variables()["DEF_FILE"].isEmpty() ) | ||
1375 | project->variables()["MSVCPROJ_LFLAGS"].append("/DEF:"+project->first("DEF_FILE")); | ||
1376 | |||
1129 | // FORMS --------------------------------------------------------- | 1377 | // FORMS --------------------------------------------------------- |
1130 | QStringList &list = project->variables()["FORMS"]; | 1378 | QStringList &list = project->variables()["FORMS"]; |
1131 | for( it = list.begin(); it != list.end(); ++it ) { | 1379 | for( it = list.begin(); it != list.end(); ++it ) { |
1132 | if ( QFile::exists( *it + ".h" ) ) | 1380 | if ( QFile::exists( *it + ".h" ) ) |
1133 | project->variables()["SOURCES"].append( *it + ".h" ); | 1381 | project->variables()["SOURCES"].append( *it + ".h" ); |
1134 | } | 1382 | } |
1135 | 1383 | ||
1136 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCPROJ_LFLAGS" << "MSVCPROJ_LIBS"; | 1384 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCPROJ_LFLAGS" << "MSVCPROJ_LIBS"; |
1137 | 1385 | ||
1138 | // Verbose output if "-d -d"... | 1386 | // Verbose output if "-d -d"... |
1139 | outputVariables(); | 1387 | outputVariables(); |
1140 | } | 1388 | } |
1141 | 1389 | ||
1142 | // ------------------------------------------------------------------------------------------------ | 1390 | // ------------------------------------------------------------------------------------------------ |
1143 | // ------------------------------------------------------------------------------------------------ | 1391 | // ------------------------------------------------------------------------------------------------ |
1144 | 1392 | ||
1145 | bool VcprojGenerator::openOutput(QFile &file) const | 1393 | bool VcprojGenerator::openOutput(QFile &file) const |
1146 | { | 1394 | { |
1147 | QString outdir; | 1395 | QString outdir; |
1148 | if(!file.name().isEmpty()) { | 1396 | if(!file.name().isEmpty()) { |
1149 | QFileInfo fi(file); | 1397 | QFileInfo fi(file); |
1150 | if(fi.isDir()) | 1398 | if(fi.isDir()) |
1151 | outdir = file.name() + QDir::separator(); | 1399 | outdir = file.name() + QDir::separator(); |
1152 | } | 1400 | } |
1153 | if(!outdir.isEmpty() || file.name().isEmpty()) { | 1401 | if(!outdir.isEmpty() || file.name().isEmpty()) { |
1154 | QString ext = project->first("VCPROJ_EXTENSION"); | 1402 | QString ext = project->first("VCPROJ_EXTENSION"); |
1155 | if(project->first("TEMPLATE") == "vcsubdirs") | 1403 | if(project->first("TEMPLATE") == "vcsubdirs") |
1156 | ext = project->first("VCSOLUTION_EXTENSION"); | 1404 | ext = project->first("VCSOLUTION_EXTENSION"); |
1157 | file.setName(outdir + project->first("TARGET") + ext); | 1405 | file.setName(outdir + project->first("TARGET") + ext); |
1158 | } | 1406 | } |
1159 | if(QDir::isRelativePath(file.name())) { | 1407 | if(QDir::isRelativePath(file.name())) { |
1160 | file.setName( Option::fixPathToLocalOS(QDir::currentDirPath() + Option::dir_sep + fixFilename(file.name())) ); | 1408 | file.setName( Option::fixPathToLocalOS(QDir::currentDirPath() + Option::dir_sep + fixFilename(file.name())) ); |
1161 | } | 1409 | } |
1162 | return Win32MakefileGenerator::openOutput(file); | 1410 | return Win32MakefileGenerator::openOutput(file); |
1163 | } | 1411 | } |
1164 | 1412 | ||
1165 | QString VcprojGenerator::fixFilename(QString ofile) const | 1413 | QString VcprojGenerator::fixFilename(QString ofile) const |
1166 | { | 1414 | { |
1167 | int slashfind = ofile.findRev('\\'); | 1415 | int slashfind = ofile.findRev('\\'); |
1168 | if (slashfind == -1) { | 1416 | if (slashfind == -1) { |
1169 | ofile = ofile.replace('-', '_'); | 1417 | ofile = ofile.replace('-', '_'); |
1170 | } else { | 1418 | } else { |
1171 | int hypenfind = ofile.find('-', slashfind); | 1419 | int hypenfind = ofile.find('-', slashfind); |
1172 | while (hypenfind != -1 && slashfind < hypenfind) { | 1420 | while (hypenfind != -1 && slashfind < hypenfind) { |
1173 | ofile = ofile.replace(hypenfind, 1, '_'); | 1421 | ofile = ofile.replace(hypenfind, 1, '_'); |
1174 | hypenfind = ofile.find('-', hypenfind + 1); | 1422 | hypenfind = ofile.find('-', hypenfind + 1); |
1175 | } | 1423 | } |
1176 | } | 1424 | } |