Diffstat (limited to 'qmake/generators/win32/msvc_vcproj.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.cpp | 412 |
1 files changed, 288 insertions, 124 deletions
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index a2bb6e9..d2cbc31 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp | |||
@@ -1,232 +1,348 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of VcprojGenerator class. | 4 | ** Definition of VcprojGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Created : 970521 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 10 | ** This file is part of the network module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** 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 | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** 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 | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 22 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 23 | ** with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** 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. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #include "msvc_vcproj.h" | 38 | #include "msvc_vcproj.h" |
39 | #include "option.h" | 39 | #include "option.h" |
40 | #include <qdir.h> | 40 | #include <qdir.h> |
41 | #include <stdlib.h> | ||
42 | #include <qregexp.h> | 41 | #include <qregexp.h> |
42 | #include <qdict.h> | ||
43 | #include <quuid.h> | ||
44 | #include <stdlib.h> | ||
43 | 45 | ||
44 | #if defined(Q_OS_WIN32) | 46 | #if defined(Q_OS_WIN32) |
45 | #include <objbase.h> | 47 | #include <objbase.h> |
48 | #ifndef GUID_DEFINED | ||
49 | #define GUID_DEFINED | ||
50 | typedef struct _GUID | ||
51 | { | ||
52 | ulong Data1; | ||
53 | ushort Data2; | ||
54 | ushort Data3; | ||
55 | uchar Data4[8]; | ||
56 | } GUID; | ||
57 | #endif | ||
46 | #endif | 58 | #endif |
47 | 59 | ||
60 | // Flatfile Tags ---------------------------------------------------- | ||
61 | const char* _snlHeader = "Microsoft Visual Studio Solution File, Format Version 7.00"; | ||
62 | // The following UUID _may_ change for later servicepacks... | ||
63 | // If so we need to search through the registry at | ||
64 | // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\Projects | ||
65 | // to find the subkey that contains a "PossibleProjectExtension" | ||
66 | // containing "vcproj"... | ||
67 | // Use the hardcoded value for now so projects generated on other | ||
68 | // platforms are actually usable. | ||
69 | const char* _snlMSVCvcprojGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"; | ||
70 | const char* _snlProjectBeg= "\nProject(\""; | ||
71 | const char* _snlProjectMid= "\") = "; | ||
72 | const char* _snlProjectEnd= "\nEndProject"; | ||
73 | const char* _snlGlobalBeg= "\nGlobal"; | ||
74 | const char* _snlGlobalEnd= "\nEndGlobal"; | ||
75 | const char* _snlSolutionConf= "\n\tGlobalSection(SolutionConfiguration) = preSolution" | ||
76 | "\n\t\tConfigName.0 = Release" | ||
77 | "\n\tEndGlobalSection"; | ||
78 | const char* _snlProjDepBeg= "\n\tGlobalSection(ProjectDependencies) = postSolution"; | ||
79 | const char* _snlProjDepEnd= "\n\tEndGlobalSection"; | ||
80 | const char* _snlProjConfBeg= "\n\tGlobalSection(ProjectConfiguration) = postSolution"; | ||
81 | const char* _snlProjConfTag1= ".Release.ActiveCfg = Release|Win32"; | ||
82 | const char* _snlProjConfTag2= ".Release.Build.0 = Release|Win32"; | ||
83 | const char* _snlProjConfEnd= "\n\tEndGlobalSection"; | ||
84 | const char* _snlExtSections= "\n\tGlobalSection(ExtensibilityGlobals) = postSolution" | ||
85 | "\n\tEndGlobalSection" | ||
86 | "\n\tGlobalSection(ExtensibilityAddIns) = postSolution" | ||
87 | "\n\tEndGlobalSection"; | ||
88 | // ------------------------------------------------------------------ | ||
89 | |||
48 | VcprojGenerator::VcprojGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) | 90 | VcprojGenerator::VcprojGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) |
49 | { | 91 | { |
50 | } | 92 | } |
51 | 93 | ||
52 | /* \internal | 94 | /* \internal |
53 | Generates a project file for the given profile. | 95 | Generates a project file for the given profile. |
54 | Options are either a Visual Studio projectfiles, or | 96 | Options are either a Visual Studio projectfiles, or |
55 | recursive projectfiles.. Maybe we can make .sln files | 97 | solutionfiles by parsing recursive projectdirectories. |
56 | someday? | ||
57 | */ | 98 | */ |
58 | bool VcprojGenerator::writeMakefile(QTextStream &t) | 99 | bool VcprojGenerator::writeMakefile(QTextStream &t) |
59 | { | 100 | { |
60 | // Check if all requirements are fullfilled | 101 | // Check if all requirements are fullfilled |
61 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 102 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
62 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", | 103 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", |
63 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); | 104 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); |
64 | return TRUE; | 105 | return TRUE; |
65 | } | 106 | } |
66 | 107 | ||
67 | // Generate full project file | 108 | // Generate project file |
68 | if(project->first("TEMPLATE") == "vcapp" || | 109 | if(project->first("TEMPLATE") == "vcapp" || |
69 | project->first("TEMPLATE") == "vclib") { | 110 | project->first("TEMPLATE") == "vclib") { |
70 | debug_msg(1, "Generator: MSVC.NET: Writing project file" ); | 111 | debug_msg(1, "Generator: MSVC.NET: Writing project file" ); |
71 | t << vcProject; | 112 | t << vcProject; |
72 | return TRUE; | 113 | return TRUE; |
73 | } else if(project->first("TEMPLATE") == "vcsubdirs") { // Generate recursive project | 114 | } |
115 | // Generate solution file | ||
116 | else if(project->first("TEMPLATE") == "vcsubdirs") { | ||
74 | debug_msg(1, "Generator: MSVC.NET: Writing solution file" ); | 117 | debug_msg(1, "Generator: MSVC.NET: Writing solution file" ); |
75 | writeSubDirs(t); | 118 | writeSubDirs(t); |
76 | return TRUE; | 119 | return TRUE; |
77 | } | 120 | } |
78 | return FALSE; | 121 | return FALSE; |
79 | 122 | ||
80 | } | 123 | } |
81 | 124 | ||
82 | struct VcsolutionDepend { | 125 | struct VcsolutionDepend { |
126 | QString uuid; | ||
83 | QString vcprojFile, orig_target, target; | 127 | QString vcprojFile, orig_target, target; |
128 | ::target targetType; | ||
84 | QStringList dependencies; | 129 | QStringList dependencies; |
85 | }; | 130 | }; |
86 | 131 | ||
132 | QUuid VcprojGenerator::increaseUUID( const QUuid &id ) | ||
133 | { | ||
134 | QUuid result( id ); | ||
135 | Q_LONG dataFirst = (result.data4[0] << 24) + | ||
136 | (result.data4[1] << 16) + | ||
137 | (result.data4[2] << 8) + | ||
138 | result.data4[3]; | ||
139 | Q_LONG dataLast = (result.data4[4] << 24) + | ||
140 | (result.data4[5] << 16) + | ||
141 | (result.data4[6] << 8) + | ||
142 | result.data4[7]; | ||
143 | |||
144 | if ( !(dataLast++) ) | ||
145 | dataFirst++; | ||
146 | |||
147 | result.data4[0] = uchar((dataFirst >> 24) & 0xff); | ||
148 | result.data4[1] = uchar((dataFirst >> 16) & 0xff); | ||
149 | result.data4[2] = uchar((dataFirst >> 8) & 0xff); | ||
150 | result.data4[3] = uchar( dataFirst & 0xff); | ||
151 | result.data4[4] = uchar((dataLast >> 24) & 0xff); | ||
152 | result.data4[5] = uchar((dataLast >> 16) & 0xff); | ||
153 | result.data4[6] = uchar((dataLast >> 8) & 0xff); | ||
154 | result.data4[7] = uchar( dataLast & 0xff); | ||
155 | return result; | ||
156 | } | ||
157 | |||
87 | void VcprojGenerator::writeSubDirs(QTextStream &t) | 158 | void VcprojGenerator::writeSubDirs(QTextStream &t) |
88 | { | 159 | { |
89 | if(project->first("TEMPLATE") == "subdirs") { | 160 | if(project->first("TEMPLATE") == "subdirs") { |
90 | writeHeader(t); | 161 | writeHeader(t); |
91 | Win32MakefileGenerator::writeSubDirs(t); | 162 | Win32MakefileGenerator::writeSubDirs(t); |
92 | return; | 163 | return; |
93 | } | 164 | } |
94 | 165 | ||
95 | QPtrList<VcsolutionDepend> solution_depends; | 166 | t << _snlHeader; |
96 | solution_depends.setAutoDelete(TRUE); | 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 | |||
179 | QDict<VcsolutionDepend> solution_depends; | ||
180 | QPtrList<VcsolutionDepend> solution_cleanup; | ||
181 | solution_cleanup.setAutoDelete(TRUE); | ||
97 | QStringList subdirs = project->variables()["SUBDIRS"]; | 182 | QStringList subdirs = project->variables()["SUBDIRS"]; |
98 | QString oldpwd = QDir::currentDirPath(); | 183 | QString oldpwd = QDir::currentDirPath(); |
99 | for(QStringList::Iterator it = subdirs.begin(); it != subdirs.end(); ++it) { | 184 | for(QStringList::Iterator it = subdirs.begin(); it != subdirs.end(); ++it) { |
100 | QFileInfo fi(Option::fixPathToLocalOS((*it), TRUE)); | 185 | QFileInfo fi(Option::fixPathToLocalOS((*it), TRUE)); |
101 | if(fi.exists()) { | 186 | if(fi.exists()) { |
102 | if(fi.isDir()) { | 187 | if(fi.isDir()) { |
103 | QString profile = (*it); | 188 | QString profile = (*it); |
104 | if(!profile.endsWith(Option::dir_sep)) | 189 | if(!profile.endsWith(Option::dir_sep)) |
105 | profile += Option::dir_sep; | 190 | profile += Option::dir_sep; |
106 | profile += fi.baseName() + ".pro"; | 191 | profile += fi.baseName() + ".pro"; |
107 | subdirs.append(profile); | 192 | subdirs.append(profile); |
108 | } else { | 193 | } else { |
109 | QMakeProject tmp_proj; | 194 | QMakeProject tmp_proj; |
110 | QString dir = fi.dirPath(), fn = fi.fileName(); | 195 | QString dir = fi.dirPath(), fn = fi.fileName(); |
111 | if(!dir.isEmpty()) { | 196 | if(!dir.isEmpty()) { |
112 | if(!QDir::setCurrent(dir)) | 197 | if(!QDir::setCurrent(dir)) |
113 | fprintf(stderr, "Cannot find directory: %s\n", dir.latin1()); | 198 | fprintf(stderr, "Cannot find directory: %s\n", dir.latin1()); |
114 | } | 199 | } |
115 | if(tmp_proj.read(fn, oldpwd)) { | 200 | if(tmp_proj.read(fn, oldpwd)) { |
116 | if(tmp_proj.first("TEMPLATE") == "vcsubdirs") { | 201 | if(tmp_proj.first("TEMPLATE") == "vcsubdirs") { |
117 | QStringList tmp_subdirs = fileFixify(tmp_proj.variables()["SUBDIRS"]); | 202 | QStringList tmp_subdirs = fileFixify(tmp_proj.variables()["SUBDIRS"]); |
118 | subdirs += tmp_subdirs; | 203 | subdirs += tmp_subdirs; |
119 | } else if(tmp_proj.first("TEMPLATE") == "vcapp" || | 204 | } else if(tmp_proj.first("TEMPLATE") == "vcapp" || tmp_proj.first("TEMPLATE") == "vclib") { |
120 | tmp_proj.first("TEMPLATE") == "vclib") { | 205 | // Initialize a 'fake' project to get the correct variables |
121 | QString vcproj = fi.baseName() + project->first("VCPROJ_EXTENSION"); | 206 | // and to be able to extract all the dependencies |
122 | if(QFile::exists(vcproj) || 1) { | 207 | VcprojGenerator tmp_vcproj(&tmp_proj); |
123 | VcprojGenerator tmp_dsp(&tmp_proj); | 208 | tmp_vcproj.setNoIO(TRUE); |
124 | tmp_dsp.setNoIO(TRUE); | 209 | tmp_vcproj.init(); |
125 | tmp_dsp.init(); | 210 | if(Option::debug_level) { |
126 | if(Option::debug_level) { | 211 | QMap<QString, QStringList> &vars = tmp_proj.variables(); |
127 | QMap<QString, QStringList> &vars = tmp_proj.variables(); | 212 | for(QMap<QString, QStringList>::Iterator it = vars.begin(); |
128 | for(QMap<QString, QStringList>::Iterator it = vars.begin(); | 213 | it != vars.end(); ++it) { |
129 | it != vars.end(); ++it) { | 214 | if(it.key().left(1) != "." && !it.data().isEmpty()) |
130 | if(it.key().left(1) != "." && !it.data().isEmpty()) | 215 | debug_msg(1, "%s: %s === %s", fn.latin1(), it.key().latin1(), |
131 | debug_msg(1, "%s: %s === %s", fn.latin1(), it.key().latin1(), | 216 | it.data().join(" :: ").latin1()); |
132 | it.data().join(" :: ").latin1()); | ||
133 | } | ||
134 | } | 217 | } |
135 | VcsolutionDepend *newDep = new VcsolutionDepend; | 218 | } |
136 | newDep->vcprojFile = fileFixify(vcproj); | 219 | |
137 | newDep->orig_target = tmp_proj.first("QMAKE_ORIG_TARGET"); | 220 | // We assume project filename is [QMAKE_ORIG_TARGET].vcproj |
138 | newDep->target = tmp_proj.first("TARGET").section(Option::dir_sep, -1); | 221 | QString vcproj = fixFilename(tmp_vcproj.project->first("QMAKE_ORIG_TARGET")) + project->first("VCPROJ_EXTENSION"); |
139 | if(newDep->target.endsWith(".dll")) | 222 | |
140 | newDep->target = newDep->target.left(newDep->target.length()-3) + "lib"; | 223 | // If file doesn't exsist, then maybe the users configuration |
141 | if(!tmp_proj.isEmpty("FORMS")) | 224 | // doesn't allow it to be created. Skip to next... |
142 | newDep->dependencies << "uic.exe"; | 225 | if(!QFile::exists(QDir::currentDirPath() + Option::dir_sep + vcproj)) { |
143 | { | 226 | qDebug( "Ignored (not found) '%s'", QString(QDir::currentDirPath() + Option::dir_sep + vcproj).latin1() ); |
144 | QStringList where("QMAKE_LIBS"); | 227 | goto nextfile; // # Dirty! |
145 | if(!tmp_proj.isEmpty("QMAKE_INTERNAL_PRL_LIBS")) | 228 | } |
146 | where = tmp_proj.variables()["QMAKE_INTERNAL_PRL_LIBS"]; | 229 | |
147 | for(QStringList::iterator wit = where.begin(); | 230 | VcsolutionDepend *newDep = new VcsolutionDepend; |
148 | wit != where.end(); ++wit) { | 231 | newDep->vcprojFile = fileFixify(vcproj); |
149 | QStringList &l = tmp_proj.variables()[(*wit)]; | 232 | newDep->orig_target = tmp_proj.first("QMAKE_ORIG_TARGET"); |
150 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 233 | newDep->target = tmp_proj.first("TARGET").section(Option::dir_sep, -1); |
151 | QString opt = (*it); | 234 | newDep->targetType = tmp_vcproj.projectTarget; |
152 | if(!opt.startsWith("/")) //Not a switch | 235 | { |
153 | newDep->dependencies << opt.section(Option::dir_sep, -1); | 236 | static QUuid uuid = solutionGUID; |
154 | } | 237 | uuid = increaseUUID( uuid ); |
238 | newDep->uuid = uuid.toString().upper(); | ||
239 | } | ||
240 | if(newDep->target.endsWith(".dll")) | ||
241 | newDep->target = newDep->target.left(newDep->target.length()-3) + "lib"; | ||
242 | if(!tmp_proj.isEmpty("FORMS")) | ||
243 | newDep->dependencies << "uic.exe"; | ||
244 | { | ||
245 | QStringList where("QMAKE_LIBS"); | ||
246 | if(!tmp_proj.isEmpty("QMAKE_INTERNAL_PRL_LIBS")) | ||
247 | where = tmp_proj.variables()["QMAKE_INTERNAL_PRL_LIBS"]; | ||
248 | for(QStringList::iterator wit = where.begin(); | ||
249 | wit != where.end(); ++wit) { | ||
250 | QStringList &l = tmp_proj.variables()[(*wit)]; | ||
251 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | ||
252 | QString opt = (*it); | ||
253 | if(!opt.startsWith("/")) //Not a switch | ||
254 | newDep->dependencies << opt.section(Option::dir_sep, -1); | ||
155 | } | 255 | } |
156 | } | 256 | } |
157 | solution_depends.append(newDep); | ||
158 | } | 257 | } |
258 | solution_cleanup.append(newDep); | ||
259 | solution_depends.insert(newDep->target, newDep); | ||
260 | { | ||
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 | ||
268 | << "\", \"" << newDep->uuid << "\""; | ||
269 | t << _snlProjectEnd; | ||
159 | } | 270 | } |
160 | } | 271 | } |
272 | nextfile: | ||
161 | QDir::setCurrent(oldpwd); | 273 | QDir::setCurrent(oldpwd); |
162 | } | 274 | } |
163 | } | 275 | } |
164 | } | 276 | } |
165 | 277 | t << _snlGlobalBeg; | |
166 | VcsolutionDepend *vc; | 278 | t << _snlSolutionConf; |
167 | QMap<QString, int> uuids; | 279 | t << _snlProjDepBeg; |
168 | QRegExp libVersion("[0-9]{3,3}\\.lib$"); | 280 | for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) { |
169 | for(vc = solution_depends.first(); vc; vc = solution_depends.next()) { | 281 | int cnt = 0; |
170 | static int uuid = 666; | 282 | for(QStringList::iterator dit = solution_cleanup.current()->dependencies.begin(); |
171 | uuids.insert(vc->target, uuid); | 283 | dit != solution_cleanup.current()->dependencies.end(); |
172 | if(libVersion.match(vc->target) != -1) | 284 | ++dit) { |
173 | uuids.insert(vc->target.left(vc->target.length() - libVersion.matchedLength()) + ".lib", | 285 | VcsolutionDepend *vc; |
174 | uuid); | 286 | if((vc=solution_depends[*dit])) { |
175 | t << "\"" << vc->orig_target << "\" \"" << vc->vcprojFile << "\" { " << uuid << " }" << endl; | 287 | if(solution_cleanup.current()->targetType != StaticLib || vc->targetType == Application) |
176 | uuid++; | 288 | t << "\n\t\t" << solution_cleanup.current()->uuid << "." << cnt++ << " = " << vc->uuid; |
177 | } | 289 | } |
178 | for(vc = solution_depends.first(); vc; vc = solution_depends.next()) { | ||
179 | int uuid = uuids[vc->target], cnt = 0; | ||
180 | for(QStringList::iterator dit = vc->dependencies.begin(); dit != vc->dependencies.end(); ++dit) { | ||
181 | if(uuids.contains((*dit))) | ||
182 | t << uuid << "." << cnt++ << " = " << uuids[(*dit)] << endl; | ||
183 | } | 290 | } |
184 | } | 291 | } |
292 | t << _snlProjDepEnd; | ||
293 | t << _snlProjConfBeg; | ||
294 | for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) { | ||
295 | t << "\n\t\t" << solution_cleanup.current()->uuid << _snlProjConfTag1; | ||
296 | t << "\n\t\t" << solution_cleanup.current()->uuid << _snlProjConfTag2; | ||
297 | } | ||
298 | t << _snlProjConfEnd; | ||
299 | t << _snlExtSections; | ||
300 | t << _snlGlobalEnd; | ||
185 | } | 301 | } |
186 | 302 | ||
187 | // ------------------------------------------------------------------------------------------------ | 303 | // ------------------------------------------------------------------------------------------------ |
188 | // ------------------------------------------------------------------------------------------------ | 304 | // ------------------------------------------------------------------------------------------------ |
189 | 305 | ||
190 | void VcprojGenerator::init() | 306 | void VcprojGenerator::init() |
191 | { | 307 | { |
192 | if( init_flag ) | 308 | if( init_flag ) |
193 | return; | 309 | return; |
194 | if(project->first("TEMPLATE") == "vcsubdirs") { //too much work for subdirs | 310 | if(project->first("TEMPLATE") == "vcsubdirs") { //too much work for subdirs |
195 | init_flag = TRUE; | 311 | init_flag = TRUE; |
196 | return; | 312 | return; |
197 | } | 313 | } |
198 | 314 | ||
199 | debug_msg(1, "Generator: MSVC.NET: Initializing variables" ); | 315 | debug_msg(1, "Generator: MSVC.NET: Initializing variables" ); |
200 | 316 | ||
201 | /* | 317 | /* |
202 | // Once to be nice and clean code... | 318 | // Once to be nice and clean code... |
203 | // Wouldn't life be great? | 319 | // Wouldn't life be great? |
204 | 320 | ||
205 | // Are we building Qt? | 321 | // Are we building Qt? |
206 | bool is_qt = | 322 | bool is_qt = |
207 | ( project->first("TARGET") == "qt"QTDLL_POSTFIX || | 323 | ( project->first("TARGET") == "qt"QTDLL_POSTFIX || |
208 | project->first("TARGET") == "qt-mt"QTDLL_POSTFIX ); | 324 | project->first("TARGET") == "qt-mt"QTDLL_POSTFIX ); |
209 | 325 | ||
210 | // Are we using Qt? | 326 | // Are we using Qt? |
211 | bool isQtActive = project->isActiveConfig("qt"); | 327 | bool isQtActive = project->isActiveConfig("qt"); |
212 | 328 | ||
213 | if ( isQtActive ) { | 329 | if ( isQtActive ) { |
214 | project->variables()["CONFIG"] += "moc"; | 330 | project->variables()["CONFIG"] += "moc"; |
215 | project->variables()["CONFIG"] += "windows"; | 331 | project->variables()["CONFIG"] += "windows"; |
216 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"]; | 332 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"]; |
217 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; | 333 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; |
218 | 334 | ||
219 | if( projectTarget == SharedLib ) | 335 | if( projectTarget == SharedLib ) |
220 | project->variables()["DEFINES"] += "QT_DLL"; | 336 | project->variables()["DEFINES"] += "QT_DLL"; |
221 | 337 | ||
222 | if( project->isActiveConfig("accessibility" ) ) | 338 | if( project->isActiveConfig("accessibility" ) ) |
223 | project->variables()["DEFINES"] += "QT_ACCESSIBILITY_SUPPORT"; | 339 | project->variables()["DEFINES"] += "QT_ACCESSIBILITY_SUPPORT"; |
224 | 340 | ||
225 | if ( project->isActiveConfig("plugin")) { | 341 | if ( project->isActiveConfig("plugin")) { |
226 | project->variables()["DEFINES"] += "QT_PLUGIN"; | 342 | project->variables()["DEFINES"] += "QT_PLUGIN"; |
227 | project->variables()["CONFIG"] += "dll"; | 343 | project->variables()["CONFIG"] += "dll"; |
228 | } | 344 | } |
229 | 345 | ||
230 | if( project->isActiveConfig("thread") ) { | 346 | if( project->isActiveConfig("thread") ) { |
231 | project->variables()["DEFINES"] += "QT_THREAD_SUPPORT"; | 347 | project->variables()["DEFINES"] += "QT_THREAD_SUPPORT"; |
232 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | 348 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; |
@@ -261,267 +377,286 @@ void VcprojGenerator::initProject() | |||
261 | // Initialize XML sub elements | 377 | // Initialize XML sub elements |
262 | // - Do this first since project elements may need | 378 | // - Do this first since project elements may need |
263 | // - to know of certain configuration options | 379 | // - to know of certain configuration options |
264 | initConfiguration(); | 380 | initConfiguration(); |
265 | initSourceFiles(); | 381 | initSourceFiles(); |
266 | initHeaderFiles(); | 382 | initHeaderFiles(); |
267 | initMOCFiles(); | 383 | initMOCFiles(); |
268 | initUICFiles(); | 384 | initUICFiles(); |
269 | initFormsFiles(); | 385 | initFormsFiles(); |
270 | initTranslationFiles(); | 386 | initTranslationFiles(); |
271 | initLexYaccFiles(); | 387 | initLexYaccFiles(); |
272 | initResourceFiles(); | 388 | initResourceFiles(); |
273 | 389 | ||
274 | // Own elements ----------------------------- | 390 | // Own elements ----------------------------- |
275 | vcProject.Name = project->first("QMAKE_ORIG_TARGET"); | 391 | vcProject.Name = project->first("QMAKE_ORIG_TARGET"); |
276 | vcProject.Version = "7.00"; | 392 | vcProject.Version = "7.00"; |
277 | vcProject.PlatformName = ( vcProject.Configuration.idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" ); | 393 | vcProject.PlatformName = ( vcProject.Configuration.idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" ); |
278 | // These are not used by Qt, but may be used by customers | 394 | // These are not used by Qt, but may be used by customers |
279 | vcProject.SccProjectName = project->first("SCCPROJECTNAME"); | 395 | vcProject.SccProjectName = project->first("SCCPROJECTNAME"); |
280 | vcProject.SccLocalPath = project->first("SCCLOCALPATH"); | 396 | vcProject.SccLocalPath = project->first("SCCLOCALPATH"); |
281 | } | 397 | } |
282 | 398 | ||
283 | void VcprojGenerator::initConfiguration() | 399 | void VcprojGenerator::initConfiguration() |
284 | { | 400 | { |
285 | // Initialize XML sub elements | 401 | // Initialize XML sub elements |
286 | // - Do this first since main configuration elements may need | 402 | // - Do this first since main configuration elements may need |
287 | // - to know of certain compiler/linker options | 403 | // - to know of certain compiler/linker options |
288 | initCompilerTool(); | 404 | initCompilerTool(); |
289 | if ( projectTarget == StaticLib ) | 405 | if ( projectTarget == StaticLib ) |
290 | initLibrarianTool(); | 406 | initLibrarianTool(); |
291 | else | 407 | else |
292 | initLinkerTool(); | 408 | initLinkerTool(); |
293 | initIDLTool(); | 409 | initIDLTool(); |
294 | 410 | ||
295 | // Own elements ----------------------------- | 411 | // Own elements ----------------------------- |
296 | QString temp = project->first("BuildBrowserInformation"); | 412 | QString temp = project->first("BuildBrowserInformation"); |
297 | switch ( projectTarget ) { | 413 | switch ( projectTarget ) { |
298 | case SharedLib: | 414 | case SharedLib: |
299 | vcProject.Configuration.ConfigurationType = typeDynamicLibrary; | 415 | vcProject.Configuration.ConfigurationType = typeDynamicLibrary; |
300 | break; | 416 | break; |
301 | case StaticLib: | 417 | case StaticLib: |
302 | vcProject.Configuration.ConfigurationType = typeStaticLibrary; | 418 | vcProject.Configuration.ConfigurationType = typeStaticLibrary; |
303 | break; | 419 | break; |
304 | case Application: | 420 | case Application: |
305 | default: | 421 | default: |
306 | vcProject.Configuration.ConfigurationType = typeApplication; | 422 | vcProject.Configuration.ConfigurationType = typeApplication; |
307 | break; | 423 | break; |
308 | } | 424 | } |
309 | vcProject.Configuration.Name = ( project->isActiveConfig( "release" ) ? "Release|" : "Debug|" ); | 425 | vcProject.Configuration.Name = ( project->isActiveConfig( "debug" ) ? "Debug|" : "Release|" ); |
310 | vcProject.Configuration.Name += ( vcProject.Configuration.idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" ); | 426 | vcProject.Configuration.Name += ( vcProject.Configuration.idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" ); |
311 | vcProject.Configuration.ATLMinimizesCRunTimeLibraryUsage = ( project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True ); | 427 | vcProject.Configuration.ATLMinimizesCRunTimeLibraryUsage = ( project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True ); |
312 | vcProject.Configuration.BuildBrowserInformation = triState( temp.isEmpty() ? unset : temp.toShort() ); | 428 | vcProject.Configuration.BuildBrowserInformation = triState( temp.isEmpty() ? (short)unset : temp.toShort() ); |
313 | temp = project->first("CharacterSet"); | 429 | temp = project->first("CharacterSet"); |
314 | vcProject.Configuration.CharacterSet = charSet( temp.isEmpty() ? charSetNotSet : temp.toShort() ); | 430 | vcProject.Configuration.CharacterSet = charSet( temp.isEmpty() ? (short)charSetNotSet : temp.toShort() ); |
315 | vcProject.Configuration.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean"); | 431 | vcProject.Configuration.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean"); |
316 | vcProject.Configuration.ImportLibrary = vcProject.Configuration.linker.ImportLibrary; | 432 | vcProject.Configuration.ImportLibrary = vcProject.Configuration.linker.ImportLibrary; |
317 | vcProject.Configuration.IntermediateDirectory = project->first("OBJECTS_DIR"); | 433 | vcProject.Configuration.IntermediateDirectory = project->first("OBJECTS_DIR"); |
318 | // temp = (projectTarget == StaticLib) ? project->first("DESTDIR"):project->first("DLLDESTDIR"); | 434 | // temp = (projectTarget == StaticLib) ? project->first("DESTDIR"):project->first("DLLDESTDIR"); |
319 | vcProject.Configuration.OutputDirectory = "."; //( temp.isEmpty() ? QString(".") : temp ); | 435 | vcProject.Configuration.OutputDirectory = "."; //( temp.isEmpty() ? QString(".") : temp ); |
320 | vcProject.Configuration.PrimaryOutput = project->first("PrimaryOutput"); | 436 | vcProject.Configuration.PrimaryOutput = project->first("PrimaryOutput"); |
321 | vcProject.Configuration.WholeProgramOptimization = vcProject.Configuration.compiler.WholeProgramOptimization; | 437 | vcProject.Configuration.WholeProgramOptimization = vcProject.Configuration.compiler.WholeProgramOptimization; |
322 | temp = project->first("UseOfATL"); | 438 | temp = project->first("UseOfATL"); |
323 | if ( !temp.isEmpty() ) | 439 | if ( !temp.isEmpty() ) |
324 | vcProject.Configuration.UseOfATL = useOfATL( temp.toShort() ); | 440 | vcProject.Configuration.UseOfATL = useOfATL( temp.toShort() ); |
325 | temp = project->first("UseOfMfc"); | 441 | temp = project->first("UseOfMfc"); |
326 | if ( !temp.isEmpty() ) | 442 | if ( !temp.isEmpty() ) |
327 | vcProject.Configuration.UseOfMfc = useOfMfc( temp.toShort() ); | 443 | vcProject.Configuration.UseOfMfc = useOfMfc( temp.toShort() ); |
328 | 444 | ||
329 | // Configuration does not need parameters from | 445 | // Configuration does not need parameters from |
330 | // these sub XML items; | 446 | // these sub XML items; |
331 | initCustomBuildTool(); | 447 | initCustomBuildTool(); |
332 | initPreBuildEventTools(); | 448 | initPreBuildEventTools(); |
333 | initPostBuildEventTools(); | 449 | initPostBuildEventTools(); |
334 | initPreLinkEventTools(); | 450 | initPreLinkEventTools(); |
335 | } | 451 | } |
336 | 452 | ||
337 | void VcprojGenerator::initCompilerTool() | 453 | void VcprojGenerator::initCompilerTool() |
338 | { | 454 | { |
339 | QString placement = project->first("OBJECTS_DIR"); | 455 | QString placement = project->first("OBJECTS_DIR"); |
340 | if ( placement.isEmpty() ) | 456 | if ( placement.isEmpty() ) |
341 | placement = project->isActiveConfig( "release" )? ".\\Release\\":".\\Debug\\"; | 457 | placement = ".\\"; |
342 | 458 | ||
343 | vcProject.Configuration.compiler.AssemblerListingLocation = placement ; | 459 | vcProject.Configuration.compiler.AssemblerListingLocation = placement ; |
344 | vcProject.Configuration.compiler.ProgramDataBaseFileName = placement ; | 460 | vcProject.Configuration.compiler.ProgramDataBaseFileName = placement ; |
345 | vcProject.Configuration.compiler.ObjectFile = placement ; | 461 | vcProject.Configuration.compiler.ObjectFile = placement ; |
346 | vcProject.Configuration.compiler.PrecompiledHeaderFile = placement + project->first("QMAKE_ORIG_TARGET") + ".pch"; | 462 | vcProject.Configuration.compiler.PrecompiledHeaderFile = placement + project->first("QMAKE_ORIG_TARGET") + ".pch"; |
347 | 463 | ||
348 | if ( project->isActiveConfig("debug") ){ | 464 | if ( project->isActiveConfig("debug") ){ |
349 | // Debug version | 465 | // Debug version |
350 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); | 466 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); |
351 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_DEBUG"] ); | 467 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_DEBUG"] ); |
352 | if ( project->isActiveConfig("thread") ) { | 468 | if ( project->isActiveConfig("thread") ) { |
353 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) | 469 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) |
354 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DBG"] ); | 470 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DBG"] ); |
355 | else | 471 | else |
356 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"] ); | 472 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"] ); |
357 | } else { | 473 | } else { |
358 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_ST_DBG"] ); | 474 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_ST_DBG"] ); |
359 | } | 475 | } |
360 | } else { | 476 | } else { |
361 | // Release version | 477 | // Release version |
362 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); | 478 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); |
363 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_RELEASE"] ); | 479 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_RELEASE"] ); |
364 | vcProject.Configuration.compiler.PreprocessorDefinitions += "QT_NO_DEBUG"; | 480 | vcProject.Configuration.compiler.PreprocessorDefinitions += "QT_NO_DEBUG"; |
481 | vcProject.Configuration.compiler.PreprocessorDefinitions += "NDEBUG"; | ||
365 | if ( project->isActiveConfig("thread") ) { | 482 | if ( project->isActiveConfig("thread") ) { |
366 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) | 483 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) |
367 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT"] ); | 484 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT"] ); |
368 | else | 485 | else |
369 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLL"] ); | 486 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLL"] ); |
370 | } else { | 487 | } else { |
371 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_ST"] ); | 488 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_ST"] ); |
372 | } | 489 | } |
373 | } | 490 | } |
374 | 491 | ||
375 | // Common for both release and debug | 492 | // Common for both release and debug |
376 | if ( project->isActiveConfig("warn_off") ) | 493 | if ( project->isActiveConfig("warn_off") ) |
377 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_OFF"] ); | 494 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_OFF"] ); |
378 | else | 495 | else if ( project->isActiveConfig("warn_on") ) |
379 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_ON"] ); | 496 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_ON"] ); |
380 | if ( project->isActiveConfig("windows") ) | 497 | if ( project->isActiveConfig("windows") ) |
381 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["MSVCPROJ_WINCONDEF"]; | 498 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["MSVCPROJ_WINCONDEF"]; |
382 | 499 | ||
383 | // Can this be set for ALL configs? | 500 | // Can this be set for ALL configs? |
384 | // If so, use qmake.conf! | 501 | // If so, use qmake.conf! |
385 | if ( projectTarget == SharedLib ) | 502 | if ( projectTarget == SharedLib ) |
386 | vcProject.Configuration.compiler.PreprocessorDefinitions += "_WINDOWS"; | 503 | vcProject.Configuration.compiler.PreprocessorDefinitions += "_WINDOWS"; |
387 | 504 | ||
388 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["DEFINES"]; | 505 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["DEFINES"]; |
389 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["PRL_EXPORT_DEFINES"]; | 506 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["PRL_EXPORT_DEFINES"]; |
390 | vcProject.Configuration.compiler.parseOptions( project->variables()["MSVCPROJ_INCPATH"] ); | 507 | vcProject.Configuration.compiler.parseOptions( project->variables()["MSVCPROJ_INCPATH"] ); |
391 | } | 508 | } |
392 | 509 | ||
393 | void VcprojGenerator::initLibrarianTool() | 510 | void VcprojGenerator::initLibrarianTool() |
394 | { | 511 | { |
395 | vcProject.Configuration.librarian.OutputFile = project->first( "DESTDIR" ); | 512 | vcProject.Configuration.librarian.OutputFile = project->first( "DESTDIR" ); |
396 | if( vcProject.Configuration.librarian.OutputFile.isEmpty() ) | 513 | if( vcProject.Configuration.librarian.OutputFile.isEmpty() ) |
397 | vcProject.Configuration.librarian.OutputFile = ".\\"; | 514 | vcProject.Configuration.librarian.OutputFile = ".\\"; |
398 | 515 | ||
399 | if( !vcProject.Configuration.librarian.OutputFile.endsWith("\\") ) | 516 | if( !vcProject.Configuration.librarian.OutputFile.endsWith("\\") ) |
400 | vcProject.Configuration.librarian.OutputFile += '\\'; | 517 | vcProject.Configuration.librarian.OutputFile += '\\'; |
401 | 518 | ||
402 | vcProject.Configuration.librarian.OutputFile += project->first("MSVCPROJ_TARGET"); | 519 | vcProject.Configuration.librarian.OutputFile += project->first("MSVCPROJ_TARGET"); |
403 | } | 520 | } |
404 | 521 | ||
405 | void VcprojGenerator::initLinkerTool() | 522 | void VcprojGenerator::initLinkerTool() |
406 | { | 523 | { |
407 | vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LFLAGS"] ); | 524 | vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LFLAGS"] ); |
408 | vcProject.Configuration.linker.AdditionalDependencies += project->variables()["MSVCPROJ_LIBS"]; | 525 | vcProject.Configuration.linker.AdditionalDependencies += project->variables()["MSVCPROJ_LIBS"]; |
409 | 526 | ||
410 | switch ( projectTarget ) { | 527 | switch ( projectTarget ) { |
411 | case Application: | 528 | case Application: |
412 | vcProject.Configuration.linker.OutputFile = project->first( "DESTDIR" ); | 529 | vcProject.Configuration.linker.OutputFile = project->first( "DESTDIR" ); |
413 | break; | 530 | break; |
414 | case SharedLib: | 531 | case SharedLib: |
415 | vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LIBOPTIONS"] ); | 532 | vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LIBOPTIONS"] ); |
416 | vcProject.Configuration.linker.OutputFile = project->first( "DLLDESTDIR" ); | 533 | vcProject.Configuration.linker.OutputFile = project->first( "DLLDESTDIR" ); |
417 | break; | 534 | break; |
535 | case StaticLib: //unhandled - added to remove warnings.. | ||
536 | break; | ||
418 | } | 537 | } |
419 | 538 | ||
420 | if( vcProject.Configuration.linker.OutputFile.isEmpty() ) | 539 | if( vcProject.Configuration.linker.OutputFile.isEmpty() ) |
421 | vcProject.Configuration.linker.OutputFile = ".\\"; | 540 | vcProject.Configuration.linker.OutputFile = ".\\"; |
422 | 541 | ||
423 | if( !vcProject.Configuration.linker.OutputFile.endsWith("\\") ) | 542 | if( !vcProject.Configuration.linker.OutputFile.endsWith("\\") ) |
424 | vcProject.Configuration.linker.OutputFile += '\\'; | 543 | vcProject.Configuration.linker.OutputFile += '\\'; |
425 | 544 | ||
426 | vcProject.Configuration.linker.OutputFile += project->first("MSVCPROJ_TARGET"); | 545 | vcProject.Configuration.linker.OutputFile += project->first("MSVCPROJ_TARGET"); |
427 | vcProject.Configuration.linker.ProgramDatabaseFile = project->first("OBJECTS_DIR") + project->first("QMAKE_ORIG_TARGET") + ".pdb"; | 546 | vcProject.Configuration.linker.ProgramDatabaseFile = project->first("OBJECTS_DIR") + project->first("QMAKE_ORIG_TARGET") + ".pdb"; |
428 | 547 | ||
429 | if ( project->isActiveConfig("debug") ){ | 548 | if ( project->isActiveConfig("debug") ){ |
430 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_DEBUG"] ); | 549 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_DEBUG"] ); |
431 | } else { | 550 | } else { |
432 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_RELEASE"] ); | 551 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_RELEASE"] ); |
433 | } | 552 | } |
434 | 553 | ||
435 | if ( project->isActiveConfig("dll") ){ | 554 | if ( project->isActiveConfig("dll") ){ |
436 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_QT_DLL"] ); | 555 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_QT_DLL"] ); |
437 | } | 556 | } |
438 | 557 | ||
439 | if ( project->isActiveConfig("console") ){ | 558 | if ( project->isActiveConfig("console") ){ |
440 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_CONSOLE"] ); | 559 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_CONSOLE"] ); |
441 | } else { | 560 | } else { |
442 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_WINDOWS"] ); | 561 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_WINDOWS"] ); |
443 | } | 562 | } |
444 | 563 | ||
445 | } | 564 | } |
446 | 565 | ||
447 | void VcprojGenerator::initIDLTool() | 566 | void VcprojGenerator::initIDLTool() |
448 | { | 567 | { |
449 | } | 568 | } |
450 | 569 | ||
451 | void VcprojGenerator::initCustomBuildTool() | 570 | void VcprojGenerator::initCustomBuildTool() |
452 | { | 571 | { |
453 | } | 572 | } |
454 | 573 | ||
455 | void VcprojGenerator::initPreBuildEventTools() | 574 | void VcprojGenerator::initPreBuildEventTools() |
456 | { | 575 | { |
457 | QString collectionName = project->first("QMAKE_IMAGE_COLLECTION"); | 576 | QString collectionName = project->first("QMAKE_IMAGE_COLLECTION"); |
458 | if( !collectionName.isEmpty() ) { | 577 | if( !collectionName.isEmpty() ) { |
459 | QStringList& list = project->variables()["IMAGES"]; | 578 | QStringList& list = project->variables()["IMAGES"]; |
460 | vcProject.Configuration.preBuild.Description = "Generate imagecollection"; | 579 | vcProject.Configuration.preBuild.Description = "Generate imagecollection"; |
461 | //vcProject.Configuration.preBuild.AdditionalDependencies += list; | 580 | //vcProject.Configuration.preBuild.AdditionalDependencies += list; |
462 | vcProject.Configuration.preBuild.CommandLine = project->first("QMAKE_UIC") + " -embed " + project->first("QMAKE_ORIG_TARGET") + " " + list.join(" ") + " -o " + collectionName; | 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; | ||
463 | //vcProject.Configuration.preBuild.Outputs = collectionName; | 592 | //vcProject.Configuration.preBuild.Outputs = collectionName; |
464 | 593 | ||
465 | } | 594 | } |
466 | } | 595 | } |
467 | 596 | ||
468 | void VcprojGenerator::initPostBuildEventTools() | 597 | void VcprojGenerator::initPostBuildEventTools() |
469 | { | 598 | { |
599 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) { | ||
600 | vcProject.Configuration.postBuild.Description = var("QMAKE_POST_LINK"); | ||
601 | vcProject.Configuration.postBuild.CommandLine = var("QMAKE_POST_LINK"); | ||
602 | } | ||
470 | if( project->isActiveConfig( "activeqt" ) ) { | 603 | if( project->isActiveConfig( "activeqt" ) ) { |
471 | QString name = project->first( "QMAKE_ORIG_TARGET" ); | 604 | QString name = project->first( "QMAKE_ORIG_TARGET" ); |
472 | QString nameext = project->first( "TARGET" ); | 605 | QString nameext = project->first( "TARGET" ); |
473 | QString objdir = project->first( "OBJECTS_DIR" ); | 606 | QString objdir = project->first( "OBJECTS_DIR" ); |
474 | QString idc = project->first( "QMAKE_IDC" ); | 607 | QString idc = project->first( "QMAKE_IDC" ); |
475 | 608 | ||
476 | vcProject.Configuration.postBuild.Description = "Finalizing ActiveQt server..."; | 609 | vcProject.Configuration.postBuild.Description = "Finalizing ActiveQt server..."; |
610 | if ( !vcProject.Configuration.postBuild.CommandLine.isEmpty() ) | ||
611 | vcProject.Configuration.postBuild.CommandLine += " && "; | ||
477 | 612 | ||
478 | if( project->isActiveConfig( "dll" ) ) { // In process | 613 | if( project->isActiveConfig( "dll" ) ) { // In process |
479 | vcProject.Configuration.postBuild.CommandLine = | 614 | vcProject.Configuration.postBuild.CommandLine += |
480 | // call idc to generate .idl file from .dll | 615 | // call idc to generate .idl file from .dll |
481 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " -idl " + objdir + name + ".idl -version 1.0 && " + | 616 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " -idl " + objdir + name + ".idl -version 1.0 && " + |
482 | // call midl to create implementations of the .idl file | 617 | // call midl to create implementations of the .idl file |
483 | project->first( "QMAKE_IDL" ) + " " + objdir + name + ".idl /nologo /o " + objdir + name + ".midl /tlb " + objdir + name + ".tlb /iid " + objdir + | 618 | project->first( "QMAKE_IDL" ) + " " + objdir + name + ".idl /nologo /o " + objdir + name + ".midl /tlb " + objdir + name + ".tlb /iid " + objdir + |
484 | "dump.midl /dlldata " + objdir + "dump.midl /cstub " + objdir + "dump.midl /header " + objdir + "dump.midl /proxy " + objdir + "dump.midl /sstub " + | 619 | "dump.midl /dlldata " + objdir + "dump.midl /cstub " + objdir + "dump.midl /header " + objdir + "dump.midl /proxy " + objdir + "dump.midl /sstub " + |
485 | objdir + "dump.midl && " + | 620 | objdir + "dump.midl && " + |
486 | // call idc to replace tlb... | 621 | // call idc to replace tlb... |
487 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /tlb " + objdir + name + ".tlb && " + | 622 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /tlb " + objdir + name + ".tlb && " + |
488 | // register server | 623 | // register server |
489 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /regserver"; | 624 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /regserver"; |
490 | } else { // out of process | 625 | } else { // out of process |
491 | vcProject.Configuration.postBuild.CommandLine = | 626 | vcProject.Configuration.postBuild.CommandLine = |
492 | // call application to dump idl | 627 | // call application to dump idl |
493 | vcProject.Configuration.OutputDirectory + "\\" + nameext + " -dumpidl " + objdir + name + ".idl -version 1.0 && " + | 628 | vcProject.Configuration.OutputDirectory + "\\" + nameext + " -dumpidl " + objdir + name + ".idl -version 1.0 && " + |
494 | // call midl to create implementations of the .idl file | 629 | // call midl to create implementations of the .idl file |
495 | project->first( "QMAKE_IDL" ) + " " + objdir + name + ".idl /nologo /o " + objdir + name + ".midl /tlb " + objdir + name + ".tlb /iid " + objdir + | 630 | project->first( "QMAKE_IDL" ) + " " + objdir + name + ".idl /nologo /o " + objdir + name + ".midl /tlb " + objdir + name + ".tlb /iid " + objdir + |
496 | "dump.midl /dlldata " + objdir + "dump.midl /cstub " + objdir + "dump.midl /header " + objdir + "dump.midl /proxy " + objdir + "dump.midl /sstub " + | 631 | "dump.midl /dlldata " + objdir + "dump.midl /cstub " + objdir + "dump.midl /header " + objdir + "dump.midl /proxy " + objdir + "dump.midl /sstub " + |
497 | objdir + "dump.midl && " + | 632 | objdir + "dump.midl && " + |
498 | // call idc to replace tlb... | 633 | // call idc to replace tlb... |
499 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /tlb " + objdir + name + ".tlb && " + | 634 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /tlb " + objdir + name + ".tlb && " + |
500 | // call app to register | 635 | // call app to register |
501 | vcProject.Configuration.OutputDirectory + "\\" + nameext + " -regserver"; | 636 | vcProject.Configuration.OutputDirectory + "\\" + nameext + " -regserver"; |
502 | } | 637 | } |
503 | } | 638 | } |
504 | } | 639 | } |
505 | 640 | ||
506 | void VcprojGenerator::initPreLinkEventTools() | 641 | void VcprojGenerator::initPreLinkEventTools() |
507 | { | 642 | { |
508 | } | 643 | } |
509 | 644 | ||
510 | void VcprojGenerator::initSourceFiles() | 645 | void VcprojGenerator::initSourceFiles() |
511 | { | 646 | { |
512 | vcProject.SourceFiles.Name = "Source Files"; | 647 | vcProject.SourceFiles.Name = "Source Files"; |
513 | vcProject.SourceFiles.Filter = "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"; | 648 | vcProject.SourceFiles.Filter = "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"; |
514 | vcProject.SourceFiles.Files += project->variables()["SOURCES"]; | 649 | vcProject.SourceFiles.Files += project->variables()["SOURCES"]; |
515 | vcProject.SourceFiles.Files.sort(); | 650 | vcProject.SourceFiles.Files.sort(); |
516 | vcProject.SourceFiles.Project = this; | 651 | vcProject.SourceFiles.Project = this; |
517 | vcProject.SourceFiles.Config = &(vcProject.Configuration); | 652 | vcProject.SourceFiles.Config = &(vcProject.Configuration); |
518 | vcProject.SourceFiles.CustomBuild = none; | 653 | vcProject.SourceFiles.CustomBuild = none; |
519 | } | 654 | } |
520 | 655 | ||
521 | void VcprojGenerator::initHeaderFiles() | 656 | void VcprojGenerator::initHeaderFiles() |
522 | { | 657 | { |
523 | vcProject.HeaderFiles.Name = "Header Files"; | 658 | vcProject.HeaderFiles.Name = "Header Files"; |
524 | vcProject.HeaderFiles.Filter = "h;hpp;hxx;hm;inl"; | 659 | vcProject.HeaderFiles.Filter = "h;hpp;hxx;hm;inl"; |
525 | vcProject.HeaderFiles.Files += project->variables()["HEADERS"]; | 660 | vcProject.HeaderFiles.Files += project->variables()["HEADERS"]; |
526 | vcProject.HeaderFiles.Files.sort(); | 661 | vcProject.HeaderFiles.Files.sort(); |
527 | vcProject.HeaderFiles.Project = this; | 662 | vcProject.HeaderFiles.Project = this; |
@@ -557,123 +692,130 @@ void VcprojGenerator::initFormsFiles() | |||
557 | vcProject.FormFiles.Name = "Forms"; | 692 | vcProject.FormFiles.Name = "Forms"; |
558 | vcProject.FormFiles.ParseFiles = _False; | 693 | vcProject.FormFiles.ParseFiles = _False; |
559 | vcProject.FormFiles.Filter = "ui"; | 694 | vcProject.FormFiles.Filter = "ui"; |
560 | vcProject.FormFiles.Files += project->variables()["FORMS"]; | 695 | vcProject.FormFiles.Files += project->variables()["FORMS"]; |
561 | vcProject.FormFiles.Files.sort(); | 696 | vcProject.FormFiles.Files.sort(); |
562 | vcProject.FormFiles.Project = this; | 697 | vcProject.FormFiles.Project = this; |
563 | vcProject.FormFiles.Config = &(vcProject.Configuration); | 698 | vcProject.FormFiles.Config = &(vcProject.Configuration); |
564 | vcProject.FormFiles.CustomBuild = uic; | 699 | vcProject.FormFiles.CustomBuild = uic; |
565 | } | 700 | } |
566 | 701 | ||
567 | void VcprojGenerator::initTranslationFiles() | 702 | void VcprojGenerator::initTranslationFiles() |
568 | { | 703 | { |
569 | vcProject.TranslationFiles.Name = "Translations Files"; | 704 | vcProject.TranslationFiles.Name = "Translations Files"; |
570 | vcProject.TranslationFiles.ParseFiles = _False; | 705 | vcProject.TranslationFiles.ParseFiles = _False; |
571 | vcProject.TranslationFiles.Filter = "ts"; | 706 | vcProject.TranslationFiles.Filter = "ts"; |
572 | vcProject.TranslationFiles.Files += project->variables()["TRANSLATIONS"]; | 707 | vcProject.TranslationFiles.Files += project->variables()["TRANSLATIONS"]; |
573 | vcProject.TranslationFiles.Files.sort(); | 708 | vcProject.TranslationFiles.Files.sort(); |
574 | vcProject.TranslationFiles.Project = this; | 709 | vcProject.TranslationFiles.Project = this; |
575 | vcProject.TranslationFiles.Config = &(vcProject.Configuration); | 710 | vcProject.TranslationFiles.Config = &(vcProject.Configuration); |
576 | vcProject.TranslationFiles.CustomBuild = none; | 711 | vcProject.TranslationFiles.CustomBuild = none; |
577 | } | 712 | } |
578 | 713 | ||
579 | void VcprojGenerator::initLexYaccFiles() | 714 | void VcprojGenerator::initLexYaccFiles() |
580 | { | 715 | { |
581 | vcProject.LexYaccFiles.Name = "Lex / Yacc Files"; | 716 | vcProject.LexYaccFiles.Name = "Lex / Yacc Files"; |
582 | vcProject.LexYaccFiles.ParseFiles = _False; | 717 | vcProject.LexYaccFiles.ParseFiles = _False; |
583 | vcProject.LexYaccFiles.Filter = "l;y"; | 718 | vcProject.LexYaccFiles.Filter = "l;y"; |
584 | vcProject.LexYaccFiles.Files += project->variables()["LEXSOURCES"]; | 719 | vcProject.LexYaccFiles.Files += project->variables()["LEXSOURCES"]; |
585 | vcProject.LexYaccFiles.Files += project->variables()["YACCSOURCES"]; | 720 | vcProject.LexYaccFiles.Files += project->variables()["YACCSOURCES"]; |
586 | vcProject.LexYaccFiles.Files.sort(); | 721 | vcProject.LexYaccFiles.Files.sort(); |
587 | vcProject.LexYaccFiles.Project = this; | 722 | vcProject.LexYaccFiles.Project = this; |
588 | vcProject.LexYaccFiles.CustomBuild = lexyacc; | 723 | vcProject.LexYaccFiles.CustomBuild = lexyacc; |
589 | } | 724 | } |
590 | 725 | ||
591 | void VcprojGenerator::initResourceFiles() | 726 | void VcprojGenerator::initResourceFiles() |
592 | { | 727 | { |
593 | vcProject.ResourceFiles.Name = "Resources"; | 728 | vcProject.ResourceFiles.Name = "Resources"; |
594 | vcProject.ResourceFiles.ParseFiles = _False; | 729 | vcProject.ResourceFiles.ParseFiles = _False; |
595 | vcProject.ResourceFiles.Filter = "cpp;ico;png;jpg;jpeg;gif;xpm;bmp;rc;ts"; | 730 | vcProject.ResourceFiles.Filter = "cpp;ico;png;jpg;jpeg;gif;xpm;bmp;rc;ts"; |
596 | vcProject.ResourceFiles.Files += project->variables()["RC_FILE"]; | 731 | vcProject.ResourceFiles.Files += project->variables()["RC_FILE"]; |
597 | vcProject.ResourceFiles.Files += project->variables()["QMAKE_IMAGE_COLLECTION"]; | 732 | vcProject.ResourceFiles.Files += project->variables()["QMAKE_IMAGE_COLLECTION"]; |
598 | vcProject.ResourceFiles.Files += project->variables()["IMAGES"]; | 733 | vcProject.ResourceFiles.Files += project->variables()["IMAGES"]; |
599 | vcProject.ResourceFiles.Files += project->variables()["IDLSOURCES"]; | 734 | vcProject.ResourceFiles.Files += project->variables()["IDLSOURCES"]; |
600 | vcProject.ResourceFiles.Files.sort(); | 735 | vcProject.ResourceFiles.Files.sort(); |
601 | vcProject.ResourceFiles.Project = this; | 736 | vcProject.ResourceFiles.Project = this; |
602 | vcProject.ResourceFiles.CustomBuild = none; | 737 | vcProject.ResourceFiles.CustomBuild = none; |
603 | } | 738 | } |
604 | 739 | ||
605 | /* | ||
606 | // $$MSVCPROJ_IDLSOURCES --------------------------------------------- | ||
607 | void VcprojGenerator::writeIDLs( QTextStream &t ) | ||
608 | { | ||
609 | QStringList &l = project->variables()["MSVCPROJ_IDLSOURCES"]; | ||
610 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | ||
611 | t << "# Begin Source File" << endl << endl; | ||
612 | t << "SOURCE=" << (*it) << endl; | ||
613 | t << "# PROP Exclude_From_Build 1" << endl; | ||
614 | t << "# End Source File" << endl << endl; | ||
615 | } | ||
616 | debug_msg(3, "Generator: MSVC.NET: Added IDLs" ); | ||
617 | } | ||
618 | */ | ||
619 | |||
620 | /* \internal | 740 | /* \internal |
621 | Sets up all needed variables from the environment and all the different caches and .conf files | 741 | Sets up all needed variables from the environment and all the different caches and .conf files |
622 | */ | 742 | */ |
623 | 743 | ||
624 | void VcprojGenerator::initOld() | 744 | void VcprojGenerator::initOld() |
625 | { | 745 | { |
626 | if( init_flag ) | 746 | if( init_flag ) |
627 | return; | 747 | return; |
628 | 748 | ||
629 | init_flag = TRUE; | 749 | init_flag = TRUE; |
630 | QStringList::Iterator it; | 750 | QStringList::Iterator it; |
631 | 751 | ||
752 | if ( project->isActiveConfig("stl") ) { | ||
753 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"]; | ||
754 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"]; | ||
755 | } else { | ||
756 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"]; | ||
757 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"]; | ||
758 | } | ||
759 | if ( project->isActiveConfig("exceptions") ) { | ||
760 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; | ||
761 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; | ||
762 | } else { | ||
763 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; | ||
764 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; | ||
765 | } | ||
766 | if ( project->isActiveConfig("rtti") ) { | ||
767 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; | ||
768 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; | ||
769 | } else { | ||
770 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; | ||
771 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; | ||
772 | } | ||
773 | |||
632 | // this should probably not be here, but I'm using it to wrap the .t files | 774 | // this should probably not be here, but I'm using it to wrap the .t files |
633 | if(project->first("TEMPLATE") == "vcapp" ) | 775 | if(project->first("TEMPLATE") == "vcapp" ) |
634 | project->variables()["QMAKE_APP_FLAG"].append("1"); | 776 | project->variables()["QMAKE_APP_FLAG"].append("1"); |
635 | else if(project->first("TEMPLATE") == "vclib") | 777 | else if(project->first("TEMPLATE") == "vclib") |
636 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | 778 | project->variables()["QMAKE_LIB_FLAG"].append("1"); |
637 | if ( project->variables()["QMAKESPEC"].isEmpty() ) | 779 | if ( project->variables()["QMAKESPEC"].isEmpty() ) |
638 | project->variables()["QMAKESPEC"].append( getenv("QMAKESPEC") ); | 780 | project->variables()["QMAKESPEC"].append( getenv("QMAKESPEC") ); |
639 | 781 | ||
640 | bool is_qt = | 782 | bool is_qt = |
641 | ( project->first("TARGET") == "qt"QTDLL_POSTFIX || | 783 | ( project->first("TARGET") == "qt"QTDLL_POSTFIX || |
642 | project->first("TARGET") == "qt-mt"QTDLL_POSTFIX ); | 784 | project->first("TARGET") == "qt-mt"QTDLL_POSTFIX ); |
643 | 785 | ||
644 | QStringList &configs = project->variables()["CONFIG"]; | 786 | QStringList &configs = project->variables()["CONFIG"]; |
645 | 787 | ||
646 | if ( project->isActiveConfig( "shared" ) ) | 788 | if ( project->isActiveConfig( "shared" ) ) |
647 | project->variables()["DEFINES"].append( "QT_DLL" ); | 789 | project->variables()["DEFINES"].append( "QT_DLL" ); |
648 | 790 | ||
649 | if ( project->isActiveConfig( "qt_dll" ) && | 791 | if ( project->isActiveConfig( "qt_dll" ) && |
650 | configs.findIndex("qt") == -1 ) | 792 | configs.findIndex("qt") == -1 ) |
651 | configs.append("qt"); | 793 | configs.append("qt"); |
652 | 794 | ||
653 | if ( project->isActiveConfig( "qt" ) ) { | 795 | if ( project->isActiveConfig( "qt" ) ) { |
654 | if ( project->isActiveConfig( "plugin" ) ) { | 796 | if ( project->isActiveConfig( "plugin" ) ) { |
655 | project->variables()["CONFIG"].append( "dll" ); | 797 | project->variables()["CONFIG"].append( "dll" ); |
656 | project->variables()["DEFINES"].append( "QT_PLUGIN" ); | 798 | project->variables()["DEFINES"].append( "QT_PLUGIN" ); |
657 | } | 799 | } |
658 | if ( ( project->variables()["DEFINES"].findIndex( "QT_NODLL" ) == -1 ) && | 800 | if ( ( project->variables()["DEFINES"].findIndex( "QT_NODLL" ) == -1 ) && |
659 | (( project->variables()["DEFINES"].findIndex( "QT_MAKEDLL" ) != -1 || | 801 | (( project->variables()["DEFINES"].findIndex( "QT_MAKEDLL" ) != -1 || |
660 | project->variables()["DEFINES"].findIndex( "QT_DLL" ) != -1 ) || | 802 | project->variables()["DEFINES"].findIndex( "QT_DLL" ) != -1 ) || |
661 | ( getenv( "QT_DLL" ) && !getenv( "QT_NODLL" ))) ) { | 803 | ( getenv( "QT_DLL" ) && !getenv( "QT_NODLL" ))) ) { |
662 | project->variables()["QMAKE_QT_DLL"].append( "1" ); | 804 | project->variables()["QMAKE_QT_DLL"].append( "1" ); |
663 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) | 805 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) |
664 | project->variables()["CONFIG"].append( "dll" ); | 806 | project->variables()["CONFIG"].append( "dll" ); |
665 | } | 807 | } |
666 | } | 808 | } |
667 | 809 | ||
668 | // If we are a dll, then we cannot be a staticlib at the same time... | 810 | // If we are a dll, then we cannot be a staticlib at the same time... |
669 | if ( project->isActiveConfig( "dll" ) || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 811 | if ( project->isActiveConfig( "dll" ) || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
670 | project->variables()["CONFIG"].remove( "staticlib" ); | 812 | project->variables()["CONFIG"].remove( "staticlib" ); |
671 | project->variables()["QMAKE_APP_OR_DLL"].append( "1" ); | 813 | project->variables()["QMAKE_APP_OR_DLL"].append( "1" ); |
672 | } else { | 814 | } else { |
673 | project->variables()["CONFIG"].append( "staticlib" ); | 815 | project->variables()["CONFIG"].append( "staticlib" ); |
674 | } | 816 | } |
675 | 817 | ||
676 | // If we need 'qt' and/or 'opengl', then we need windows and not console | 818 | // If we need 'qt' and/or 'opengl', then we need windows and not console |
677 | if ( project->isActiveConfig( "qt" ) || project->isActiveConfig( "opengl" ) ) { | 819 | if ( project->isActiveConfig( "qt" ) || project->isActiveConfig( "opengl" ) ) { |
678 | project->variables()["CONFIG"].append( "windows" ); | 820 | project->variables()["CONFIG"].append( "windows" ); |
679 | } | 821 | } |
@@ -743,204 +885,223 @@ void VcprojGenerator::initOld() | |||
743 | //project->variables()["MSVCPROJ_TARGETDIR"] = project->isActiveConfig( "release" )?"Release":"Debug"; | 885 | //project->variables()["MSVCPROJ_TARGETDIR"] = project->isActiveConfig( "release" )?"Release":"Debug"; |
744 | 886 | ||
745 | // OPENGL -------------------------------------------------------- | 887 | // OPENGL -------------------------------------------------------- |
746 | if ( project->isActiveConfig("opengl") ) { | 888 | if ( project->isActiveConfig("opengl") ) { |
747 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | 889 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; |
748 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; | 890 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; |
749 | } | 891 | } |
750 | 892 | ||
751 | // THREAD -------------------------------------------------------- | 893 | // THREAD -------------------------------------------------------- |
752 | if ( project->isActiveConfig("thread") ) { | 894 | if ( project->isActiveConfig("thread") ) { |
753 | if(project->isActiveConfig("qt")) | 895 | if(project->isActiveConfig("qt")) |
754 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT" ); | 896 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT" ); |
755 | if ( !project->variables()["DEFINES"].contains("QT_DLL") && is_qt | 897 | if ( !project->variables()["DEFINES"].contains("QT_DLL") && is_qt |
756 | && project->first("TARGET") != "qtmain" ) | 898 | && project->first("TARGET") != "qtmain" ) |
757 | project->variables()["QMAKE_LFLAGS"].append("/NODEFAULTLIB:libc"); | 899 | project->variables()["QMAKE_LFLAGS"].append("/NODEFAULTLIB:libc"); |
758 | } | 900 | } |
759 | 901 | ||
760 | // ACCESSIBILITY ------------------------------------------------- | 902 | // ACCESSIBILITY ------------------------------------------------- |
761 | if(project->isActiveConfig("qt")) { | 903 | if(project->isActiveConfig("qt")) { |
762 | if ( project->isActiveConfig("accessibility" ) ) | 904 | if ( project->isActiveConfig("accessibility" ) ) |
763 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); | 905 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); |
764 | if ( project->isActiveConfig("tablet") ) | 906 | if ( project->isActiveConfig("tablet") ) |
765 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); | 907 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); |
766 | } | 908 | } |
767 | 909 | ||
768 | // DLL ----------------------------------------------------------- | 910 | // DLL ----------------------------------------------------------- |
769 | if ( project->isActiveConfig("dll") ) { | 911 | if ( project->isActiveConfig("dll") ) { |
770 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | 912 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { |
771 | QString ver_xyz(project->first("VERSION")); | 913 | QString ver_xyz(project->first("VERSION")); |
772 | ver_xyz.replace(QRegExp("\\."), ""); | 914 | ver_xyz.replace(QRegExp("\\."), ""); |
773 | project->variables()["TARGET_EXT"].append(ver_xyz + ".dll"); | 915 | project->variables()["TARGET_EXT"].append(ver_xyz + ".dll"); |
774 | } else { | 916 | } else { |
775 | project->variables()["TARGET_EXT"].append(".dll"); | 917 | project->variables()["TARGET_EXT"].append(".dll"); |
776 | } | 918 | } |
777 | } | 919 | } |
778 | // EXE / LIB ----------------------------------------------------- | 920 | // EXE / LIB ----------------------------------------------------- |
779 | else { | 921 | else { |
780 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) | 922 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) |
781 | project->variables()["TARGET_EXT"].append(".exe"); | 923 | project->variables()["TARGET_EXT"].append(".exe"); |
782 | else | 924 | else |
783 | project->variables()["TARGET_EXT"].append(".lib"); | 925 | project->variables()["TARGET_EXT"].append(".lib"); |
784 | } | 926 | } |
785 | 927 | ||
786 | project->variables()["MSVCPROJ_VER"] = "7.00"; | 928 | project->variables()["MSVCPROJ_VER"] = "7.00"; |
787 | project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /ZI"; | 929 | project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /ZI"; |
788 | 930 | ||
789 | // INCREMENTAL:NO ------------------------------------------------ | 931 | // INCREMENTAL:NO ------------------------------------------------ |
790 | if(!project->isActiveConfig("incremental")) { | 932 | if(!project->isActiveConfig("incremental")) { |
791 | project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no")); | 933 | project->variables()["QMAKE_LFLAGS"].append(QString("/INCREMENTAL:no")); |
792 | if ( is_qt ) | 934 | if ( is_qt ) |
793 | project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /Zi"; | 935 | project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /Zi"; |
794 | } | 936 | } |
795 | 937 | ||
796 | // MOC ----------------------------------------------------------- | 938 | // MOC ----------------------------------------------------------- |
797 | if ( project->isActiveConfig("moc") ) | 939 | if ( project->isActiveConfig("moc") ) |
798 | setMocAware(TRUE); | 940 | setMocAware(TRUE); |
799 | 941 | ||
800 | 942 | ||
801 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 943 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
944 | // Update -lname to name.lib, and -Ldir to | ||
945 | QStringList &libList = project->variables()["QMAKE_LIBS"]; | ||
946 | for( it = libList.begin(); it != libList.end(); ) { | ||
947 | QString s = *it; | ||
948 | if( s.startsWith( "-l" ) ) { | ||
949 | it = libList.remove( it ); | ||
950 | it = libList.insert( it, s.mid( 2 ) + ".lib" ); | ||
951 | } else if( s.startsWith( "-L" ) ) { | ||
952 | it = libList.remove( it ); | ||
953 | } else { | ||
954 | it++; | ||
955 | } | ||
956 | } | ||
802 | 957 | ||
803 | // Run through all variables containing filepaths, and ----------- | 958 | // Run through all variables containing filepaths, and ----------- |
804 | // slash-slosh them correctly depending on current OS ----------- | 959 | // slash-slosh them correctly depending on current OS ----------- |
805 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); | 960 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); |
806 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; | 961 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; |
807 | for(it = l.begin(); it != l.end(); ++it) { | 962 | for(it = l.begin(); it != l.end(); ++it) { |
808 | QStringList &gdmf = project->variables()[(*it)]; | 963 | QStringList &gdmf = project->variables()[(*it)]; |
809 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) | 964 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) |
810 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); | 965 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); |
811 | } | 966 | } |
812 | 967 | ||
813 | // Get filename w/o extention ----------------------------------- | 968 | // Get filename w/o extention ----------------------------------- |
814 | QString msvcproj_project = ""; | 969 | QString msvcproj_project = ""; |
815 | QString targetfilename = ""; | 970 | QString targetfilename = ""; |
816 | if ( project->variables()["TARGET"].count() ) { | 971 | if ( project->variables()["TARGET"].count() ) { |
817 | msvcproj_project = project->variables()["TARGET"].first(); | 972 | msvcproj_project = project->variables()["TARGET"].first(); |
818 | targetfilename = msvcproj_project; | 973 | targetfilename = msvcproj_project; |
819 | } | 974 | } |
820 | 975 | ||
821 | // Save filename w/o extention in $$QMAKE_ORIG_TARGET ------------ | 976 | // Save filename w/o extention in $$QMAKE_ORIG_TARGET ------------ |
822 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | 977 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; |
823 | 978 | ||
824 | // TARGET (add extention to $$TARGET) ---------------------------- | 979 | // TARGET (add extention to $$TARGET) |
825 | project->variables()["TARGET"].first() += project->first("TARGET_EXT"); | 980 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue(".first() += project->first("TARGET_EXT"); |
826 | 981 | ||
827 | // Init base class too ------------------------------------------- | 982 | // Init base class too ------------------------------------------- |
828 | MakefileGenerator::init(); | 983 | MakefileGenerator::init(); |
829 | 984 | ||
830 | 985 | ||
831 | if ( msvcproj_project.isEmpty() ) | 986 | if ( msvcproj_project.isEmpty() ) |
832 | msvcproj_project = Option::output.name(); | 987 | msvcproj_project = Option::output.name(); |
833 | 988 | ||
834 | msvcproj_project = msvcproj_project.right( msvcproj_project.length() - msvcproj_project.findRev( "\\" ) - 1 ); | 989 | msvcproj_project = msvcproj_project.right( msvcproj_project.length() - msvcproj_project.findRev( "\\" ) - 1 ); |
835 | msvcproj_project = msvcproj_project.left( msvcproj_project.findRev( "." ) ); | 990 | msvcproj_project = msvcproj_project.left( msvcproj_project.findRev( "." ) ); |
836 | msvcproj_project.replace(QRegExp("-"), ""); | 991 | msvcproj_project.replace(QRegExp("-"), ""); |
837 | 992 | ||
838 | project->variables()["MSVCPROJ_PROJECT"].append(msvcproj_project); | 993 | project->variables()["MSVCPROJ_PROJECT"].append(msvcproj_project); |
839 | QStringList &proj = project->variables()["MSVCPROJ_PROJECT"]; | 994 | QStringList &proj = project->variables()["MSVCPROJ_PROJECT"]; |
840 | 995 | ||
841 | for(it = proj.begin(); it != proj.end(); ++it) | 996 | for(it = proj.begin(); it != proj.end(); ++it) |
842 | (*it).replace(QRegExp("\\.[a-zA-Z0-9_]*$"), ""); | 997 | (*it).replace(QRegExp("\\.[a-zA-Z0-9_]*$"), ""); |
843 | 998 | ||
844 | // SUBSYSTEM ----------------------------------------------------- | 999 | // SUBSYSTEM ----------------------------------------------------- |
845 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 1000 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
846 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32app" + project->first( "VCPROJ_EXTENSION" ) ); | 1001 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32app" + project->first( "VCPROJ_EXTENSION" ) ); |
847 | if ( project->isActiveConfig("console") ) { | 1002 | if ( project->isActiveConfig("console") ) { |
848 | project->variables()["MSVCPROJ_CONSOLE"].append("CONSOLE"); | 1003 | project->variables()["MSVCPROJ_CONSOLE"].append("CONSOLE"); |
849 | project->variables()["MSVCPROJ_WINCONDEF"].append("_CONSOLE"); | 1004 | project->variables()["MSVCPROJ_WINCONDEF"].append("_CONSOLE"); |
850 | project->variables()["MSVCPROJ_VCPROJTYPE"].append("0x0103"); | 1005 | project->variables()["MSVCPROJ_VCPROJTYPE"].append("0x0103"); |
851 | project->variables()["MSVCPROJ_SUBSYSTEM"].append("CONSOLE"); | 1006 | project->variables()["MSVCPROJ_SUBSYSTEM"].append("CONSOLE"); |
852 | } else { | 1007 | } else { |
853 | project->variables()["MSVCPROJ_CONSOLE"].clear(); | 1008 | project->variables()["MSVCPROJ_CONSOLE"].clear(); |
854 | project->variables()["MSVCPROJ_WINCONDEF"].append("_WINDOWS"); | 1009 | project->variables()["MSVCPROJ_WINCONDEF"].append("_WINDOWS"); |
855 | project->variables()["MSVCPROJ_VCPROJTYPE"].append("0x0101"); | 1010 | project->variables()["MSVCPROJ_VCPROJTYPE"].append("0x0101"); |
856 | project->variables()["MSVCPROJ_SUBSYSTEM"].append("WINDOWS"); | 1011 | project->variables()["MSVCPROJ_SUBSYSTEM"].append("WINDOWS"); |
857 | } | 1012 | } |
858 | } else { | 1013 | } else { |
859 | if ( project->isActiveConfig("dll") ) { | 1014 | if ( project->isActiveConfig("dll") ) { |
860 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32dll" + project->first( "VCPROJ_EXTENSION" ) ); | 1015 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32dll" + project->first( "VCPROJ_EXTENSION" ) ); |
861 | } else { | 1016 | } else { |
862 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32lib" + project->first( "VCPROJ_EXTENSION" ) ); | 1017 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32lib" + project->first( "VCPROJ_EXTENSION" ) ); |
863 | } | 1018 | } |
864 | } | 1019 | } |
865 | 1020 | ||
866 | // $$QMAKE.. -> $$MSVCPROJ.. ------------------------------------- | 1021 | // $$QMAKE.. -> $$MSVCPROJ.. ------------------------------------- |
867 | project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS"]; | 1022 | project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS"]; |
868 | project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | 1023 | project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; |
869 | project->variables()["MSVCPROJ_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; | 1024 | project->variables()["MSVCPROJ_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; |
870 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) | 1025 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) { |
871 | project->variables()["MSVCPROJ_LFLAGS" ].append(varGlue("QMAKE_LIBDIR","/LIBPATH:"," /LIBPATH:","")); | 1026 | QStringList strl = project->variables()["QMAKE_LIBDIR"]; |
1027 | QStringList::iterator stri; | ||
1028 | for ( stri = strl.begin(); stri != strl.end(); ++stri ) { | ||
1029 | if ( !(*stri).startsWith("/LIBPATH:") ) | ||
1030 | (*stri).prepend( "/LIBPATH:" ); | ||
1031 | } | ||
1032 | project->variables()["MSVCPROJ_LFLAGS"] += strl; | ||
1033 | } | ||
872 | project->variables()["MSVCPROJ_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; | 1034 | project->variables()["MSVCPROJ_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; |
873 | // We don't use this... Direct manipulation of compiler object | 1035 | // We don't use this... Direct manipulation of compiler object |
874 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); | 1036 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); |
875 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); | 1037 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); |
876 | QStringList &incs = project->variables()["INCLUDEPATH"]; | 1038 | QStringList &incs = project->variables()["INCLUDEPATH"]; |
877 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { | 1039 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { |
878 | QString inc = (*incit); | 1040 | QString inc = (*incit); |
879 | inc.replace(QRegExp("\""), ""); | 1041 | inc.replace(QRegExp("\""), ""); |
880 | project->variables()["MSVCPROJ_INCPATH"].append("/I" + inc ); | 1042 | project->variables()["MSVCPROJ_INCPATH"].append("/I" + inc ); |
881 | } | 1043 | } |
882 | project->variables()["MSVCPROJ_INCPATH"].append("/I" + specdir()); | 1044 | project->variables()["MSVCPROJ_INCPATH"].append("/I" + specdir()); |
883 | 1045 | ||
884 | QString dest; | 1046 | QString dest; |
885 | project->variables()["MSVCPROJ_TARGET"] = project->first("TARGET"); | 1047 | project->variables()["MSVCPROJ_TARGET"] = project->first("TARGET"); |
886 | if ( !project->variables()["DESTDIR"].isEmpty() ) { | 1048 | Option::fixPathToTargetOS(project->first("TARGET")); |
887 | project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); | 1049 | dest = project->first("TARGET") + project->first( "TARGET_EXT" ); |
888 | Option::fixPathToTargetOS(project->first("TARGET")); | 1050 | if ( project->first("TARGET").startsWith("$(QTDIR)") ) |
889 | dest = project->first("TARGET"); | 1051 | dest.replace( QRegExp("\\$\\(QTDIR\\)"), getenv("QTDIR") ); |
890 | if ( project->first("TARGET").startsWith("$(QTDIR)") ) | 1052 | project->variables()["MSVCPROJ_TARGET"] = dest; |
891 | dest.replace( QRegExp("\\$\\(QTDIR\\)"), getenv("QTDIR") ); | 1053 | if ( project->isActiveConfig("dll") ) { |
892 | project->variables()["MSVCPROJ_TARGET"].append( | 1054 | QString imp = project->first( "DESTDIR" ); |
893 | QString("/OUT:") + dest ); | 1055 | if( !imp.isNull() && !imp.endsWith( "\\" ) ) |
894 | if ( project->isActiveConfig("dll") ) { | 1056 | imp += "\\"; |
895 | QString imp = dest; | 1057 | imp += dest; |
896 | imp.replace(QRegExp("\\.dll"), ".lib"); | 1058 | imp.replace(QRegExp("\\.dll"), ".lib"); |
897 | project->variables()["MSVCPROJ_LIBOPTIONS"] += (QString("/IMPLIB:") + imp ); | 1059 | project->variables()["MSVCPROJ_LIBOPTIONS"] += QString("/IMPLIB:") + imp; |
898 | } | ||
899 | } | 1060 | } |
900 | 1061 | ||
901 | // DLL COPY ------------------------------------------------------ | 1062 | // DLL COPY ------------------------------------------------------ |
902 | if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) { | 1063 | if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) { |
903 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; | 1064 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; |
904 | QString copydll = "# Begin Special Build Tool\n" | 1065 | QString copydll = "# Begin Special Build Tool\n" |
905 | "TargetPath=" + dest + "\n" | 1066 | "TargetPath=" + dest + "\n" |
906 | "SOURCE=$(InputPath)\n" | 1067 | "SOURCE=$(InputPath)\n" |
907 | "PostBuild_Desc=Copy DLL to " + project->first("DLLDESTDIR") + "\n" | 1068 | "PostBuild_Desc=Copy DLL to " + project->first("DLLDESTDIR") + "\n" |
908 | "PostBuild_Cmds="; | 1069 | "PostBuild_Cmds="; |
909 | 1070 | ||
910 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { | 1071 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { |
911 | copydll += "copy \"" + dest + "\" \"" + *dlldir + "\"\t"; | 1072 | copydll += "copy \"" + dest + "\" \"" + *dlldir + "\"\t"; |
912 | } | 1073 | } |
913 | 1074 | ||
914 | copydll += "\n# End Special Build Tool"; | 1075 | copydll += "\n# End Special Build Tool"; |
915 | project->variables()["MSVCPROJ_COPY_DLL_REL"].append( copydll ); | 1076 | project->variables()["MSVCPROJ_COPY_DLL_REL"].append( copydll ); |
916 | project->variables()["MSVCPROJ_COPY_DLL_DBG"].append( copydll ); | 1077 | project->variables()["MSVCPROJ_COPY_DLL_DBG"].append( copydll ); |
917 | } | 1078 | } |
918 | 1079 | ||
919 | // ACTIVEQT ------------------------------------------------------ | 1080 | // ACTIVEQT ------------------------------------------------------ |
920 | if ( project->isActiveConfig("activeqt") ) { | 1081 | if ( project->isActiveConfig("activeqt") ) { |
921 | QString idl = project->variables()["QMAKE_IDL"].first(); | 1082 | QString idl = project->variables()["QMAKE_IDL"].first(); |
922 | QString idc = project->variables()["QMAKE_IDC"].first(); | 1083 | QString idc = project->variables()["QMAKE_IDC"].first(); |
923 | QString version = project->variables()["VERSION"].first(); | 1084 | QString version = project->variables()["VERSION"].first(); |
924 | if ( version.isEmpty() ) | 1085 | if ( version.isEmpty() ) |
925 | version = "1.0"; | 1086 | version = "1.0"; |
926 | 1087 | ||
927 | project->variables()["MSVCPROJ_IDLSOURCES"].append( "tmp\\" + targetfilename + ".idl" ); | 1088 | project->variables()["MSVCPROJ_IDLSOURCES"].append( "tmp\\" + targetfilename + ".idl" ); |
928 | project->variables()["MSVCPROJ_IDLSOURCES"].append( "tmp\\" + targetfilename + ".tlb" ); | 1089 | project->variables()["MSVCPROJ_IDLSOURCES"].append( "tmp\\" + targetfilename + ".tlb" ); |
929 | project->variables()["MSVCPROJ_IDLSOURCES"].append( "tmp\\" + targetfilename + ".midl" ); | 1090 | project->variables()["MSVCPROJ_IDLSOURCES"].append( "tmp\\" + targetfilename + ".midl" ); |
930 | if ( project->isActiveConfig( "dll" ) ) { | 1091 | if ( project->isActiveConfig( "dll" ) ) { |
931 | QString regcmd = "# Begin Special Build Tool\n" | 1092 | QString regcmd = "# Begin Special Build Tool\n" |
932 | "TargetPath=" + targetfilename + "\n" | 1093 | "TargetPath=" + targetfilename + "\n" |
933 | "SOURCE=$(InputPath)\n" | 1094 | "SOURCE=$(InputPath)\n" |
934 | "PostBuild_Desc=Finalizing ActiveQt server...\n" | 1095 | "PostBuild_Desc=Finalizing ActiveQt server...\n" |
935 | "PostBuild_Cmds=" + | 1096 | "PostBuild_Cmds=" + |
936 | idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version + | 1097 | idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version + |
937 | "\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" | 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" |
938 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" | 1099 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" |
939 | "\tregsvr32 /s %1\n" | 1100 | "\tregsvr32 /s %1\n" |
940 | "# End Special Build Tool"; | 1101 | "# End Special Build Tool"; |
941 | 1102 | ||
942 | QString executable = project->variables()["MSVCPROJ_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); | 1103 | QString executable = project->variables()["MSVCPROJ_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); |
943 | project->variables()["MSVCPROJ_COPY_DLL_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); | 1104 | project->variables()["MSVCPROJ_COPY_DLL_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); |
944 | 1105 | ||
945 | executable = project->variables()["MSVCPROJ_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); | 1106 | executable = project->variables()["MSVCPROJ_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); |
946 | project->variables()["MSVCPROJ_COPY_DLL_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); | 1107 | project->variables()["MSVCPROJ_COPY_DLL_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); |
@@ -951,100 +1112,103 @@ void VcprojGenerator::initOld() | |||
951 | "PostBuild_Desc=Finalizing ActiveQt server...\n" | 1112 | "PostBuild_Desc=Finalizing ActiveQt server...\n" |
952 | "PostBuild_Cmds=" | 1113 | "PostBuild_Cmds=" |
953 | "%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version + | 1114 | "%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version + |
954 | "\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" | 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" |
955 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" | 1116 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" |
956 | "\t%1 -regserver\n" | 1117 | "\t%1 -regserver\n" |
957 | "# End Special Build Tool"; | 1118 | "# End Special Build Tool"; |
958 | 1119 | ||
959 | QString executable = project->variables()["MSVCPROJ_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); | 1120 | QString executable = project->variables()["MSVCPROJ_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); |
960 | project->variables()["MSVCPROJ_REGSVR_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); | 1121 | project->variables()["MSVCPROJ_REGSVR_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); |
961 | 1122 | ||
962 | executable = project->variables()["MSVCPROJ_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); | 1123 | executable = project->variables()["MSVCPROJ_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); |
963 | project->variables()["MSVCPROJ_REGSVR_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); | 1124 | project->variables()["MSVCPROJ_REGSVR_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); |
964 | } | 1125 | } |
965 | 1126 | ||
966 | } | 1127 | } |
967 | 1128 | ||
968 | // FORMS --------------------------------------------------------- | 1129 | // FORMS --------------------------------------------------------- |
969 | QStringList &list = project->variables()["FORMS"]; | 1130 | QStringList &list = project->variables()["FORMS"]; |
970 | for( it = list.begin(); it != list.end(); ++it ) { | 1131 | for( it = list.begin(); it != list.end(); ++it ) { |
971 | if ( QFile::exists( *it + ".h" ) ) | 1132 | if ( QFile::exists( *it + ".h" ) ) |
972 | project->variables()["SOURCES"].append( *it + ".h" ); | 1133 | project->variables()["SOURCES"].append( *it + ".h" ); |
973 | } | 1134 | } |
974 | 1135 | ||
975 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCPROJ_LFLAGS" << "MSVCPROJ_LIBS"; | 1136 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCPROJ_LFLAGS" << "MSVCPROJ_LIBS"; |
976 | 1137 | ||
977 | // Verbose output if "-d -d"... | 1138 | // Verbose output if "-d -d"... |
978 | outputVariables(); | 1139 | outputVariables(); |
979 | } | 1140 | } |
980 | 1141 | ||
981 | // ------------------------------------------------------------------------------------------------ | 1142 | // ------------------------------------------------------------------------------------------------ |
982 | // ------------------------------------------------------------------------------------------------ | 1143 | // ------------------------------------------------------------------------------------------------ |
983 | 1144 | ||
984 | bool VcprojGenerator::openOutput(QFile &file) const | 1145 | bool VcprojGenerator::openOutput(QFile &file) const |
985 | { | 1146 | { |
986 | QString outdir; | 1147 | QString outdir; |
987 | if(!file.name().isEmpty()) { | 1148 | if(!file.name().isEmpty()) { |
988 | QFileInfo fi(file); | 1149 | QFileInfo fi(file); |
989 | if(fi.isDir()) | 1150 | if(fi.isDir()) |
990 | outdir = file.name() + QDir::separator(); | 1151 | outdir = file.name() + QDir::separator(); |
991 | } | 1152 | } |
992 | if(!outdir.isEmpty() || file.name().isEmpty()) { | 1153 | if(!outdir.isEmpty() || file.name().isEmpty()) { |
993 | QString ext = project->first("VCPROJ_EXTENSION"); | 1154 | QString ext = project->first("VCPROJ_EXTENSION"); |
994 | if(project->first("TEMPLATE") == "vcsubdirs") | 1155 | if(project->first("TEMPLATE") == "vcsubdirs") |
995 | ext = project->first("VCSOLUTION_EXTENSION"); | 1156 | ext = project->first("VCSOLUTION_EXTENSION"); |
996 | file.setName(outdir + project->first("TARGET") + ext); | 1157 | file.setName(outdir + project->first("TARGET") + ext); |
997 | } | 1158 | } |
998 | if(QDir::isRelativePath(file.name())) { | 1159 | if(QDir::isRelativePath(file.name())) { |
999 | QString ofile; | 1160 | file.setName( Option::fixPathToLocalOS(QDir::currentDirPath() + Option::dir_sep + fixFilename(file.name())) ); |
1000 | ofile = file.name(); | ||
1001 | int slashfind = ofile.findRev('\\'); | ||
1002 | if (slashfind == -1) { | ||
1003 | ofile = ofile.replace("-", "_"); | ||
1004 | } else { | ||
1005 | int hypenfind = ofile.find('-', slashfind); | ||
1006 | while (hypenfind != -1 && slashfind < hypenfind) { | ||
1007 | ofile = ofile.replace(hypenfind, 1, "_"); | ||
1008 | hypenfind = ofile.find('-', hypenfind + 1); | ||
1009 | } | ||
1010 | } | ||
1011 | file.setName(Option::fixPathToLocalOS(QDir::currentDirPath() + Option::dir_sep + ofile)); | ||
1012 | } | 1161 | } |
1013 | return Win32MakefileGenerator::openOutput(file); | 1162 | return Win32MakefileGenerator::openOutput(file); |
1014 | } | 1163 | } |
1015 | 1164 | ||
1165 | QString VcprojGenerator::fixFilename(QString ofile) const | ||
1166 | { | ||
1167 | int slashfind = ofile.findRev('\\'); | ||
1168 | if (slashfind == -1) { | ||
1169 | ofile = ofile.replace('-', '_'); | ||
1170 | } else { | ||
1171 | int hypenfind = ofile.find('-', slashfind); | ||
1172 | while (hypenfind != -1 && slashfind < hypenfind) { | ||
1173 | ofile = ofile.replace(hypenfind, 1, '_'); | ||
1174 | hypenfind = ofile.find('-', hypenfind + 1); | ||
1175 | } | ||
1176 | } | ||
1177 | return ofile; | ||
1178 | } | ||
1179 | |||
1016 | QString VcprojGenerator::findTemplate(QString file) | 1180 | QString VcprojGenerator::findTemplate(QString file) |
1017 | { | 1181 | { |
1018 | QString ret; | 1182 | QString ret; |
1019 | if(!QFile::exists((ret = file)) && | 1183 | if(!QFile::exists((ret = file)) && |
1020 | !QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) && | 1184 | !QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) && |
1021 | !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc.net/" + file)) && | 1185 | !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc.net/" + file)) && |
1022 | !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) | 1186 | !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) |
1023 | return ""; | 1187 | return ""; |
1024 | debug_msg(1, "Generator: MSVC.NET: Found template \'%s\'", ret.latin1() ); | 1188 | debug_msg(1, "Generator: MSVC.NET: Found template \'%s\'", ret.latin1() ); |
1025 | return ret; | 1189 | return ret; |
1026 | } | 1190 | } |
1027 | 1191 | ||
1028 | 1192 | ||
1029 | void VcprojGenerator::processPrlVariable(const QString &var, const QStringList &l) | 1193 | void VcprojGenerator::processPrlVariable(const QString &var, const QStringList &l) |
1030 | { | 1194 | { |
1031 | if(var == "QMAKE_PRL_DEFINES") { | 1195 | if(var == "QMAKE_PRL_DEFINES") { |
1032 | QStringList &out = project->variables()["MSVCPROJ_DEFINES"]; | 1196 | QStringList &out = project->variables()["MSVCPROJ_DEFINES"]; |
1033 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { | 1197 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { |
1034 | if(out.findIndex((*it)) == -1) | 1198 | if(out.findIndex((*it)) == -1) |
1035 | out.append((" /D " + *it )); | 1199 | out.append((" /D " + *it )); |
1036 | } | 1200 | } |
1037 | } else { | 1201 | } else { |
1038 | MakefileGenerator::processPrlVariable(var, l); | 1202 | MakefileGenerator::processPrlVariable(var, l); |
1039 | } | 1203 | } |
1040 | } | 1204 | } |
1041 | 1205 | ||
1042 | void VcprojGenerator::outputVariables() | 1206 | void VcprojGenerator::outputVariables() |
1043 | { | 1207 | { |
1044 | #if 0 | 1208 | #if 0 |
1045 | debug_msg(3, "Generator: MSVC.NET: List of current variables:" ); | 1209 | qDebug( "Generator: MSVC.NET: List of current variables:" ); |
1046 | for ( QMap<QString, QStringList>::ConstIterator it = project->variables().begin(); it != project->variables().end(); ++it) { | 1210 | for ( QMap<QString, QStringList>::ConstIterator it = project->variables().begin(); it != project->variables().end(); ++it) { |
1047 | debug_msg(3, "Generator: MSVC.NET: %s => %s", it.key().latin1(), it.data().join(" | ").latin1() ); | 1211 | qDebug( "Generator: MSVC.NET: %s => %s", it.key().latin1(), it.data().join(" | ").latin1() ); |
1048 | } | 1212 | } |
1049 | #endif | 1213 | #endif |
1050 | } | 1214 | } |