Diffstat (limited to 'qmake/generators/win32/msvc_dsp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/generators/win32/msvc_dsp.cpp | 244 |
1 files changed, 191 insertions, 53 deletions
diff --git a/qmake/generators/win32/msvc_dsp.cpp b/qmake/generators/win32/msvc_dsp.cpp index 3fa0496..d2abac6 100644 --- a/qmake/generators/win32/msvc_dsp.cpp +++ b/qmake/generators/win32/msvc_dsp.cpp | |||
@@ -1,42 +1,40 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of DspMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | 35 | ||
38 | #include "msvc_dsp.h" | 36 | #include "msvc_dsp.h" |
39 | #include "option.h" | 37 | #include "option.h" |
40 | #include <qdir.h> | 38 | #include <qdir.h> |
41 | #include <qregexp.h> | 39 | #include <qregexp.h> |
42 | #include <stdlib.h> | 40 | #include <stdlib.h> |
@@ -49,151 +47,231 @@ DspMakefileGenerator::DspMakefileGenerator(QMakeProject *p) : Win32MakefileGener | |||
49 | 47 | ||
50 | bool | 48 | bool |
51 | DspMakefileGenerator::writeMakefile(QTextStream &t) | 49 | DspMakefileGenerator::writeMakefile(QTextStream &t) |
52 | { | 50 | { |
53 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 51 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
54 | /* for now just dump, I need to generated an empty dsp or something.. */ | 52 | /* for now just dump, I need to generated an empty dsp or something.. */ |
55 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", | 53 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", |
56 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); | 54 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); |
57 | return TRUE; | 55 | return TRUE; |
58 | } | 56 | } |
59 | 57 | ||
60 | if(project->first("TEMPLATE") == "vcapp" || | 58 | if(project->first("TEMPLATE") == "vcapp" || |
61 | project->first("TEMPLATE") == "vclib") { | 59 | project->first("TEMPLATE") == "vclib") { |
62 | return writeDspParts(t); | 60 | return writeDspParts(t); |
63 | } | 61 | } |
64 | else if(project->first("TEMPLATE") == "subdirs") { | 62 | else if(project->first("TEMPLATE") == "subdirs") { |
65 | writeHeader(t); | 63 | writeHeader(t); |
66 | writeSubDirs(t); | 64 | writeSubDirs(t); |
67 | return TRUE; | 65 | return TRUE; |
68 | } | 66 | } |
69 | return FALSE; | 67 | return FALSE; |
70 | } | 68 | } |
71 | 69 | ||
72 | bool | 70 | bool |
73 | DspMakefileGenerator::writeDspParts(QTextStream &t) | 71 | DspMakefileGenerator::writeDspParts(QTextStream &t) |
74 | { | 72 | { |
75 | QString dspfile; | 73 | QString dspfile; |
76 | if ( !project->variables()["DSP_TEMPLATE"].isEmpty() ) { | 74 | if ( !project->variables()["DSP_TEMPLATE"].isEmpty() ) { |
77 | dspfile = project->first("DSP_TEMPLATE"); | 75 | dspfile = project->first("DSP_TEMPLATE"); |
78 | } else { | 76 | } else { |
79 | dspfile = project->first("MSVCDSP_TEMPLATE"); | 77 | dspfile = project->first("MSVCDSP_TEMPLATE"); |
80 | } | 78 | } |
79 | if (dspfile.startsWith("\"") && dspfile.endsWith("\"")) | ||
80 | dspfile = dspfile.mid(1, dspfile.length() - 2); | ||
81 | QString dspfile_loc = findTemplate(dspfile); | 81 | QString dspfile_loc = findTemplate(dspfile); |
82 | 82 | ||
83 | QFile file(dspfile_loc); | 83 | QFile file(dspfile_loc); |
84 | if(!file.open(IO_ReadOnly)) { | 84 | if(!file.open(IO_ReadOnly)) { |
85 | fprintf(stderr, "Cannot open dsp file: %s\n", dspfile.latin1()); | 85 | fprintf(stderr, "Cannot open dsp file: %s\n", dspfile.latin1()); |
86 | return FALSE; | 86 | return FALSE; |
87 | } | 87 | } |
88 | QTextStream dsp(&file); | 88 | QTextStream dsp(&file); |
89 | 89 | ||
90 | QString platform = "Win32"; | ||
91 | if ( !project->variables()["QMAKE_PLATFORM"].isEmpty() ) | ||
92 | platform = varGlue("QMAKE_PLATFORM", "", " ", ""); | ||
93 | |||
94 | // Setup PCH variables | ||
95 | precompH = project->first("PRECOMPILED_HEADER"); | ||
96 | QString namePCH = QFileInfo(precompH).fileName(); | ||
97 | usePCH = !precompH.isEmpty() && project->isActiveConfig("precompile_header"); | ||
98 | if (usePCH) { | ||
99 | // Created files | ||
100 | QString origTarget = project->first("QMAKE_ORIG_TARGET"); | ||
101 | origTarget.replace(QRegExp("-"), "_"); | ||
102 | precompObj = "\"$(IntDir)\\" + origTarget + Option::obj_ext + "\""; | ||
103 | precompPch = "\"$(IntDir)\\" + origTarget + ".pch\""; | ||
104 | // Add PRECOMPILED_HEADER to HEADERS | ||
105 | if (!project->variables()["HEADERS"].contains(precompH)) | ||
106 | project->variables()["HEADERS"] += precompH; | ||
107 | // Add precompile compiler options | ||
108 | project->variables()["PRECOMPILED_FLAGS_REL"] = "/Yu\"" + namePCH + "\" /FI\"" + namePCH + "\" "; | ||
109 | project->variables()["PRECOMPILED_FLAGS_DEB"] = "/Yu\"" + namePCH + "\" /FI\"" + namePCH + "\" "; | ||
110 | // Return to variable pool | ||
111 | project->variables()["PRECOMPILED_OBJECT"] = precompObj; | ||
112 | project->variables()["PRECOMPILED_PCH"] = precompPch; | ||
113 | } | ||
90 | int rep; | 114 | int rep; |
91 | QString line; | 115 | QString line; |
92 | while ( !dsp.eof() ) { | 116 | while ( !dsp.eof() ) { |
93 | line = dsp.readLine(); | 117 | line = dsp.readLine(); |
94 | while((rep = line.find(QRegExp("\\$\\$[a-zA-Z0-9_-]*"))) != -1) { | 118 | while((rep = line.find(QRegExp("\\$\\$[a-zA-Z0-9_-]*"))) != -1) { |
95 | QString torep = line.mid(rep, line.find(QRegExp("[^\\$a-zA-Z0-9_-]"), rep) - rep); | 119 | QString torep = line.mid(rep, line.find(QRegExp("[^\\$a-zA-Z0-9_-]"), rep) - rep); |
96 | QString variable = torep.right(torep.length()-2); | 120 | QString variable = torep.right(torep.length()-2); |
97 | 121 | ||
98 | t << line.left(rep); //output the left side | 122 | t << line.left(rep); //output the left side |
99 | line = line.right(line.length() - (rep + torep.length())); //now past the variable | 123 | line = line.right(line.length() - (rep + torep.length())); //now past the variable |
100 | if(variable == "MSVCDSP_SOURCES") { | 124 | if(variable == "MSVCDSP_SOURCES") { |
101 | if(project->variables()["SOURCES"].isEmpty()) | 125 | if(project->variables()["SOURCES"].isEmpty()) |
102 | continue; | 126 | continue; |
103 | 127 | ||
104 | QString mocpath = var( "QMAKE_MOC" ); | 128 | QString mocpath = var( "QMAKE_MOC" ); |
105 | mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; | 129 | mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; |
106 | 130 | ||
107 | QStringList list = project->variables()["SOURCES"] + project->variables()["DEF_FILE"]; | 131 | QStringList list = project->variables()["SOURCES"] + project->variables()["DEF_FILE"]; |
108 | if(!project->isActiveConfig("flat")) | 132 | if(!project->isActiveConfig("flat")) |
109 | list.sort(); | 133 | list.sort(); |
110 | QStringList::Iterator it; | 134 | QStringList::Iterator it; |
111 | for( it = list.begin(); it != list.end(); ++it) { | 135 | for( it = list.begin(); it != list.end(); ++it) { |
112 | beginGroupForFile((*it), t); | 136 | beginGroupForFile((*it), t); |
113 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; | 137 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; |
114 | if ( project->isActiveConfig("moc") && (*it).endsWith(Option::moc_ext)) { | 138 | if (usePCH && (*it).endsWith(".c")) |
139 | t << "# SUBTRACT CPP /FI\"" << namePCH << "\" /Yu\"" << namePCH << "\" /Fp" << endl; | ||
140 | if ( project->isActiveConfig("moc") && (*it).endsWith(Option::cpp_moc_ext)) { | ||
115 | QString base = (*it); | 141 | QString base = (*it); |
116 | base.replace(QRegExp("\\..*$"), "").upper(); | 142 | base.replace(QRegExp("\\..*$"), "").upper(); |
117 | base.replace(QRegExp("[^a-zA-Z]"), "_"); | 143 | base.replace(QRegExp("[^a-zA-Z]"), "_"); |
118 | 144 | ||
119 | QString build = "\n\n# Begin Custom Build - Moc'ing " + findMocSource((*it)) + | 145 | QString build = "\n\n# Begin Custom Build - Moc'ing " + findMocSource((*it)) + |
120 | "...\n" "InputPath=.\\" + (*it) + "\n\n" "\"" + (*it) + "\"" | 146 | "...\n" "InputPath=.\\" + (*it) + "\n\n" "\"" + (*it) + "\"" |
121 | " : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n" | 147 | " : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n" |
122 | "\t" + mocpath + findMocSource((*it)) + " -o " + | 148 | "\t" + mocpath + findMocSource((*it)) + " -o " + |
123 | (*it) + "\n\n" "# End Custom Build\n\n"; | 149 | (*it) + "\n\n" "# End Custom Build\n\n"; |
124 | 150 | ||
125 | t << "USERDEP_" << base << "=\".\\" << findMocSource((*it)) << "\" \"$(QTDIR)\\bin\\moc.exe\"" << endl << endl; | 151 | t << "USERDEP_" << base << "=\".\\" << findMocSource((*it)) << "\" \"$(QTDIR)\\bin\\moc.exe\"" << endl << endl; |
126 | 152 | ||
127 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 153 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
128 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" | 154 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" |
129 | << build << "!ENDIF " << endl << endl; | 155 | << build << "!ENDIF " << endl << endl; |
130 | } | 156 | } |
131 | t << "# End Source File" << endl; | 157 | t << "# End Source File" << endl; |
132 | } | 158 | } |
133 | endGroups(t); | 159 | endGroups(t); |
134 | } else if(variable == "MSVCDSP_IMAGES") { | 160 | } else if(variable == "MSVCDSP_IMAGES") { |
135 | if(project->variables()["IMAGES"].isEmpty()) | 161 | if(project->variables()["IMAGES"].isEmpty()) |
136 | continue; | 162 | continue; |
137 | t << "# Begin Source File\n\nSOURCE=" << project->first("QMAKE_IMAGE_COLLECTION") << endl; | 163 | t << "# Begin Source File\n\nSOURCE=" << project->first("QMAKE_IMAGE_COLLECTION") << endl; |
138 | t << "# End Source File" << endl; | 164 | t << "# End Source File" << endl; |
139 | } else if(variable == "MSVCDSP_HEADERS") { | 165 | } else if(variable == "MSVCDSP_HEADERS") { |
140 | if(project->variables()["HEADERS"].isEmpty()) | 166 | if(project->variables()["HEADERS"].isEmpty()) |
141 | continue; | 167 | continue; |
142 | 168 | ||
143 | QStringList list = project->variables()["HEADERS"]; | 169 | QStringList list = project->variables()["HEADERS"]; |
144 | if(!project->isActiveConfig("flat")) | 170 | if(!project->isActiveConfig("flat")) |
145 | list.sort(); | 171 | list.sort(); |
146 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { | 172 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { |
147 | // beginGroupForFile((*it), t); | 173 | // beginGroupForFile((*it), t); |
148 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl << endl; | 174 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl << endl; |
149 | if ( project->isActiveConfig("moc") && !findMocDestination((*it)).isEmpty()) { | 175 | QString compilePCH; |
150 | QString base = (*it); | 176 | QStringList customDependencies; |
177 | QString createMOC; | ||
178 | QString buildCmdsR, buildCmdsD; | ||
179 | QString buildCmds = "\nBuildCmds= \\\n"; | ||
180 | // Create unique baseID | ||
181 | QString base = (*it); | ||
182 | { | ||
151 | base.replace(QRegExp("\\..*$"), "").upper(); | 183 | base.replace(QRegExp("\\..*$"), "").upper(); |
152 | base.replace(QRegExp("[^a-zA-Z]"), "_"); | 184 | base.replace(QRegExp("[^a-zA-Z]"), "_"); |
185 | } | ||
186 | if (usePCH && precompH.endsWith(*it)) { | ||
187 | QString basicBuildCmd = QString("\tcl.exe /TP /W3 /FD /c /D \"WIN32\" /Yc /Fp\"%1\" /Fo\"%2\" %3 %4 %5 %6 %7 %8 %9 /D \"") | ||
188 | .arg(precompPch) | ||
189 | .arg(precompObj) | ||
190 | .arg(var("MSVCDSP_INCPATH")) | ||
191 | .arg(var("MSVCDSP_DEFINES")) | ||
192 | .arg(var("MSVCDSP_CXXFLAGS")); | ||
193 | buildCmdsR = basicBuildCmd | ||
194 | .arg("/D \"NDEBUG\"") | ||
195 | .arg(var("QMAKE_CXXFLAGS_RELEASE")) | ||
196 | .arg(var("MSVCDSP_MTDEF")) | ||
197 | .arg(var("MSVCDSP_RELDEFS")); | ||
198 | buildCmdsD = basicBuildCmd | ||
199 | .arg("/D \"_DEBUG\" /Od") | ||
200 | .arg(var("QMAKE_CXXFLAGS_DEBUG")) | ||
201 | .arg(var("MSVCDSP_MTDEFD")) | ||
202 | .arg(var("MSVCDSP_DEBUG_OPT")); | ||
203 | if (project->first("TEMPLATE") == "vcapp") {// App | ||
204 | buildCmdsR += var("MSVCDSP_WINCONDEF"); | ||
205 | buildCmdsD += var("MSVCDSP_WINCONDEF"); | ||
206 | } else if (project->isActiveConfig("dll")) {// Dll | ||
207 | buildCmdsR += "_WINDOWS\" /D \"_USRDLL"; | ||
208 | buildCmdsD += "_WINDOWS\" /D \"_USRDLL"; | ||
209 | } else { // Lib | ||
210 | buildCmdsR += "_LIB"; | ||
211 | buildCmdsD += "_LIB"; | ||
212 | } | ||
213 | buildCmdsR += "\" /Fd\"$(IntDir)\\\\\" " + (*it) + " \\\n"; | ||
214 | buildCmdsD += "\" /Fd\"$(IntDir)\\\\\" " + (*it) + " \\\n"; | ||
215 | |||
216 | compilePCH = precompPch + " : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n $(BuildCmds)\n\n"; | ||
153 | 217 | ||
218 | QStringList &tmp = findDependencies(precompH); | ||
219 | if(!tmp.isEmpty()) // Got Deps for PCH | ||
220 | customDependencies += tmp; | ||
221 | } | ||
222 | if (project->isActiveConfig("moc") && !findMocDestination((*it)).isEmpty()) { | ||
154 | QString mocpath = var( "QMAKE_MOC" ); | 223 | QString mocpath = var( "QMAKE_MOC" ); |
155 | mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; | 224 | mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; |
156 | 225 | buildCmds += "\t" + mocpath + (*it) + " -o " + findMocDestination((*it)) + " \\\n"; | |
157 | QString build = "\n\n# Begin Custom Build - Moc'ing " + (*it) + | 226 | createMOC = "\"" + findMocDestination((*it)) +"\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n $(BuildCmds)\n\n"; |
158 | "...\n" "InputPath=.\\" + (*it) + "\n\n" "\"" + findMocDestination((*it)) + | 227 | customDependencies += "\"$(QTDIR)\\bin\\moc.exe\""; |
159 | "\"" " : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n" | 228 | } |
160 | "\t" + mocpath + (*it) + " -o " + | 229 | if (!createMOC.isEmpty() || !compilePCH.isEmpty()) { |
161 | findMocDestination((*it)) + "\n\n" "# End Custom Build\n\n"; | 230 | bool doMOC = !createMOC.isEmpty(); |
162 | 231 | bool doPCH = !compilePCH.isEmpty(); | |
163 | t << "USERDEP_" << base << "=\"$(QTDIR)\\bin\\moc.exe\"" << endl << endl; | 232 | QString build = "\n\n# Begin Custom Build - "+ |
164 | 233 | QString(doMOC?"Moc'ing ":"") + | |
165 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 234 | QString((doMOC&&doPCH)?" and ":"") + |
166 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" | 235 | QString(doPCH?"Creating PCH cpp from ":"") + |
167 | << build << "!ENDIF " << endl << endl; | 236 | (*it) + "...\nInputPath=.\\" + (*it) + "\n\n" + |
237 | buildCmds + "%1\n" + | ||
238 | createMOC + | ||
239 | compilePCH + | ||
240 | "# End Custom Build\n\n"; | ||
241 | |||
242 | t << "USERDEP_" << base << "=" << valGlue(customDependencies, "\"", "\" \"", "\"") << endl << endl; | ||
243 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build.arg(buildCmdsR) | ||
244 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build.arg(buildCmdsD) | ||
245 | << "!ENDIF " << endl << endl; | ||
168 | } | 246 | } |
169 | t << "# End Source File" << endl; | 247 | t << "# End Source File" << endl; |
170 | } | 248 | } |
171 | // endGroups(t); | 249 | // endGroups(t); |
172 | } else if(variable == "MSVCDSP_FORMSOURCES" || variable == "MSVCDSP_FORMHEADERS") { | 250 | } else if(variable == "MSVCDSP_FORMSOURCES" || variable == "MSVCDSP_FORMHEADERS") { |
173 | if(project->variables()["FORMS"].isEmpty()) | 251 | if(project->variables()["FORMS"].isEmpty()) |
174 | continue; | 252 | continue; |
175 | 253 | ||
176 | QString uiSourcesDir; | 254 | QString uiSourcesDir; |
177 | QString uiHeadersDir; | 255 | QString uiHeadersDir; |
178 | if(!project->variables()["UI_DIR"].isEmpty()) { | 256 | if(!project->variables()["UI_DIR"].isEmpty()) { |
179 | uiSourcesDir = project->first("UI_DIR"); | 257 | uiSourcesDir = project->first("UI_DIR"); |
180 | uiHeadersDir = project->first("UI_DIR"); | 258 | uiHeadersDir = project->first("UI_DIR"); |
181 | } else { | 259 | } else { |
182 | if ( !project->variables()["UI_SOURCES_DIR"].isEmpty() ) | 260 | if ( !project->variables()["UI_SOURCES_DIR"].isEmpty() ) |
183 | uiSourcesDir = project->first("UI_SOURCES_DIR"); | 261 | uiSourcesDir = project->first("UI_SOURCES_DIR"); |
184 | else | 262 | else |
185 | uiSourcesDir = ""; | 263 | uiSourcesDir = ""; |
186 | if ( !project->variables()["UI_HEADERS_DIR"].isEmpty() ) | 264 | if ( !project->variables()["UI_HEADERS_DIR"].isEmpty() ) |
187 | uiHeadersDir = project->first("UI_HEADERS_DIR"); | 265 | uiHeadersDir = project->first("UI_HEADERS_DIR"); |
188 | else | 266 | else |
189 | uiHeadersDir = ""; | 267 | uiHeadersDir = ""; |
190 | } | 268 | } |
191 | 269 | ||
192 | QStringList list = project->variables()["FORMS"]; | 270 | QStringList list = project->variables()["FORMS"]; |
193 | if(!project->isActiveConfig("flat")) | 271 | if(!project->isActiveConfig("flat")) |
194 | list.sort(); | 272 | list.sort(); |
195 | QString ext = variable == "MSVCDSP_FORMSOURCES" ? ".cpp" : ".h"; | 273 | QString ext = variable == "MSVCDSP_FORMSOURCES" ? ".cpp" : ".h"; |
196 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { | 274 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { |
197 | QString base = (*it); | 275 | QString base = (*it); |
198 | int dot = base.findRev("."); | 276 | int dot = base.findRev("."); |
199 | base.replace( dot, base.length() - dot, ext ); | 277 | base.replace( dot, base.length() - dot, ext ); |
@@ -223,79 +301,79 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
223 | t << "# Begin Group \"Translations\"\n"; | 301 | t << "# Begin Group \"Translations\"\n"; |
224 | t << "# Prop Default_Filter \"ts\"\n"; | 302 | t << "# Prop Default_Filter \"ts\"\n"; |
225 | 303 | ||
226 | QStringList list = project->variables()["TRANSLATIONS"]; | 304 | QStringList list = project->variables()["TRANSLATIONS"]; |
227 | if(!project->isActiveConfig("flat")) | 305 | if(!project->isActiveConfig("flat")) |
228 | list.sort(); | 306 | list.sort(); |
229 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { | 307 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { |
230 | QString sify = *it; | 308 | QString sify = *it; |
231 | sify.replace('/', '\\' ); | 309 | sify.replace('/', '\\' ); |
232 | QString base = (*it); | 310 | QString base = (*it); |
233 | base.replace(QRegExp("\\..*$"), "").upper(); | 311 | base.replace(QRegExp("\\..*$"), "").upper(); |
234 | base.replace(QRegExp("[^a-zA-Z]"), "_"); | 312 | base.replace(QRegExp("[^a-zA-Z]"), "_"); |
235 | 313 | ||
236 | // beginGroupForFile(sify, t); | 314 | // beginGroupForFile(sify, t); |
237 | t << "# Begin Source File\n\nSOURCE=" << sify << endl; | 315 | t << "# Begin Source File\n\nSOURCE=" << sify << endl; |
238 | t << "\n# End Source File" << endl; | 316 | t << "\n# End Source File" << endl; |
239 | } | 317 | } |
240 | // endGroups(t); | 318 | // endGroups(t); |
241 | t << "\n# End Group\n"; | 319 | t << "\n# End Group\n"; |
242 | } else if (variable == "MSVCDSP_MOCSOURCES" && project->isActiveConfig("moc")) { | 320 | } else if (variable == "MSVCDSP_MOCSOURCES" && project->isActiveConfig("moc")) { |
243 | if ( project->variables()["SRCMOC"].isEmpty()) | 321 | if ( project->variables()["SRCMOC"].isEmpty()) |
244 | continue; | 322 | continue; |
245 | 323 | ||
246 | QString mocpath = var( "QMAKE_MOC" ); | 324 | QString mocpath = var( "QMAKE_MOC" ); |
247 | mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; | 325 | mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; |
248 | 326 | ||
249 | QStringList list = project->variables()["SRCMOC"]; | 327 | QStringList list = project->variables()["SRCMOC"]; |
250 | if(!project->isActiveConfig("flat")) | 328 | if(!project->isActiveConfig("flat")) |
251 | list.sort(); | 329 | list.sort(); |
252 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { | 330 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { |
253 | // beginGroupForFile((*it), t); | 331 | // beginGroupForFile((*it), t); |
254 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; | 332 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; |
255 | if ( project->isActiveConfig("moc") && (*it).endsWith(Option::moc_ext)) { | 333 | if ( project->isActiveConfig("moc") && (*it).endsWith(Option::cpp_moc_ext)) { |
256 | QString base = (*it); | 334 | QString base = (*it); |
257 | base.replace(QRegExp("\\..*$"), "").upper(); | 335 | base.replace(QRegExp("\\..*$"), "").upper(); |
258 | base.replace(QRegExp("[^a-zA-Z]"), "_"); | 336 | base.replace(QRegExp("[^a-zA-Z]"), "_"); |
259 | 337 | ||
260 | QString build = "\n\n# Begin Custom Build - Moc'ing " + findMocSource((*it)) + | 338 | QString build = "\n\n# Begin Custom Build - Moc'ing " + findMocSource((*it)) + |
261 | "...\n" "InputPath=.\\" + (*it) + "\n\n" "\"" + (*it) + "\"" | 339 | "...\n" "InputPath=.\\" + (*it) + "\n\n" "\"" + (*it) + "\"" |
262 | " : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n" | 340 | " : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n" |
263 | "\t" + mocpath + findMocSource((*it)) + " -o " + | 341 | "\t" + mocpath + findMocSource((*it)) + " -o " + |
264 | (*it) + "\n\n" "# End Custom Build\n\n"; | 342 | (*it) + "\n\n" "# End Custom Build\n\n"; |
265 | 343 | ||
266 | t << "USERDEP_" << base << "=\".\\" << findMocSource((*it)) << "\" \"$(QTDIR)\\bin\\moc.exe\"" << endl << endl; | 344 | t << "USERDEP_" << base << "=\".\\" << findMocSource((*it)) << "\" \"$(QTDIR)\\bin\\moc.exe\"" << endl << endl; |
267 | 345 | ||
268 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 346 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
269 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" | 347 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" |
270 | << build << "!ENDIF " << endl << endl; | 348 | << build << "!ENDIF " << endl << endl; |
271 | } | 349 | } |
272 | t << "# End Source File" << endl; | 350 | t << "# End Source File" << endl; |
273 | } | 351 | } |
274 | // endGroups(t); | 352 | // endGroups(t); |
275 | } else if(variable == "MSVCDSP_PICTURES") { | 353 | } else if(variable == "MSVCDSP_PICTURES") { |
276 | if(project->variables()["IMAGES"].isEmpty()) | 354 | if(project->variables()["IMAGES"].isEmpty()) |
277 | continue; | 355 | continue; |
278 | 356 | ||
279 | t << "# Begin Group \"Images\"\n" | 357 | t << "# Begin Group \"Images\"\n" |
280 | << "# Prop Default_Filter \"png jpeg bmp xpm\"\n"; | 358 | << "# Prop Default_Filter \"png jpeg bmp xpm\"\n"; |
281 | 359 | ||
282 | QStringList list = project->variables()["IMAGES"]; | 360 | QStringList list = project->variables()["IMAGES"]; |
283 | if(!project->isActiveConfig("flat")) | 361 | if(!project->isActiveConfig("flat")) |
284 | list.sort(); | 362 | list.sort(); |
285 | QStringList::Iterator it; | 363 | QStringList::Iterator it; |
286 | 364 | ||
287 | // dump the image list to a file UIC can read. | 365 | // dump the image list to a file UIC can read. |
288 | QFile f( "images.tmp" ); | 366 | QFile f( "images.tmp" ); |
289 | f.open( IO_WriteOnly ); | 367 | f.open( IO_WriteOnly ); |
290 | QTextStream ts( &f ); | 368 | QTextStream ts( &f ); |
291 | for( it = list.begin(); it != list.end(); ++it ) | 369 | for( it = list.begin(); it != list.end(); ++it ) |
292 | ts << " " << *it; | 370 | ts << " " << *it; |
293 | f.close(); | 371 | f.close(); |
294 | 372 | ||
295 | // create an output step for images not more than once | 373 | // create an output step for images not more than once |
296 | bool imagesBuildDone = FALSE; | 374 | bool imagesBuildDone = FALSE; |
297 | for( it = list.begin(); it != list.end(); ++it ) { | 375 | for( it = list.begin(); it != list.end(); ++it ) { |
298 | // beginGroupForFile((*it), t); | 376 | // beginGroupForFile((*it), t); |
299 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; | 377 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; |
300 | 378 | ||
301 | QString base = (*it); | 379 | QString base = (*it); |
@@ -358,144 +436,145 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
358 | if ( lbs != -1 ) | 436 | if ( lbs != -1 ) |
359 | fpath = fname.left( lbs + 1 ); | 437 | fpath = fname.left( lbs + 1 ); |
360 | fname = fname.right( fname.length() - lbs - 1 ); | 438 | fname = fname.right( fname.length() - lbs - 1 ); |
361 | 439 | ||
362 | QString mocFile; | 440 | QString mocFile; |
363 | if(!project->variables()["MOC_DIR"].isEmpty()) | 441 | if(!project->variables()["MOC_DIR"].isEmpty()) |
364 | mocFile = project->first("MOC_DIR"); | 442 | mocFile = project->first("MOC_DIR"); |
365 | else | 443 | else |
366 | mocFile = fpath; | 444 | mocFile = fpath; |
367 | 445 | ||
368 | QString uiSourcesDir; | 446 | QString uiSourcesDir; |
369 | QString uiHeadersDir; | 447 | QString uiHeadersDir; |
370 | if(!project->variables()["UI_DIR"].isEmpty()) { | 448 | if(!project->variables()["UI_DIR"].isEmpty()) { |
371 | uiSourcesDir = project->first("UI_DIR"); | 449 | uiSourcesDir = project->first("UI_DIR"); |
372 | uiHeadersDir = project->first("UI_DIR"); | 450 | uiHeadersDir = project->first("UI_DIR"); |
373 | } else { | 451 | } else { |
374 | if ( !project->variables()["UI_SOURCES_DIR"].isEmpty() ) | 452 | if ( !project->variables()["UI_SOURCES_DIR"].isEmpty() ) |
375 | uiSourcesDir = project->first("UI_SOURCES_DIR"); | 453 | uiSourcesDir = project->first("UI_SOURCES_DIR"); |
376 | else | 454 | else |
377 | uiSourcesDir = fpath; | 455 | uiSourcesDir = fpath; |
378 | if ( !project->variables()["UI_HEADERS_DIR"].isEmpty() ) | 456 | if ( !project->variables()["UI_HEADERS_DIR"].isEmpty() ) |
379 | uiHeadersDir = project->first("UI_HEADERS_DIR"); | 457 | uiHeadersDir = project->first("UI_HEADERS_DIR"); |
380 | else | 458 | else |
381 | uiHeadersDir = fpath; | 459 | uiHeadersDir = fpath; |
382 | } | 460 | } |
383 | 461 | ||
384 | t << "USERDEP_" << base << "=\"$(QTDIR)\\bin\\moc.exe\" \"$(QTDIR)\\bin\\uic.exe\"" << endl << endl; | 462 | t << "USERDEP_" << base << "=\"$(QTDIR)\\bin\\moc.exe\" \"$(QTDIR)\\bin\\uic.exe\"" << endl << endl; |
385 | 463 | ||
386 | QString build = "\n\n# Begin Custom Build - Uic'ing " + base + "...\n" | 464 | QString build = "\n\n# Begin Custom Build - Uic'ing " + base + "...\n" |
387 | "InputPath=.\\" + base + "\n\n" "BuildCmds= \\\n\t" + uicpath + base + | 465 | "InputPath=.\\" + base + "\n\n" "BuildCmds= \\\n\t" + uicpath + base + |
388 | " -o " + uiHeadersDir + fname + ".h \\\n" "\t" + uicpath + base + | 466 | " -o " + uiHeadersDir + fname + ".h \\\n" "\t" + uicpath + base + |
389 | " -i " + fname + ".h -o " + uiSourcesDir + fname + ".cpp \\\n" | 467 | " -i " + fname + ".h -o " + uiSourcesDir + fname + ".cpp \\\n" |
390 | "\t" + mocpath + uiHeadersDir + fname + ".h -o " + mocFile + "moc_" + fname + ".cpp \\\n"; | 468 | "\t" + mocpath + " " + uiHeadersDir + |
469 | fname + ".h -o " + mocFile + Option::h_moc_mod + fname + Option::h_moc_ext + " \\\n"; | ||
391 | 470 | ||
392 | build.append("\n\"" + uiHeadersDir + fname + ".h\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" | 471 | build.append("\n\"" + uiHeadersDir + fname + ".h\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" |
393 | "\t$(BuildCmds)\n\n" | 472 | "\t$(BuildCmds)\n\n" |
394 | "\"" + uiSourcesDir + fname + ".cpp\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" | 473 | "\"" + uiSourcesDir + fname + ".cpp\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" |
395 | "\t$(BuildCmds)\n\n" | 474 | "\t$(BuildCmds)\n\n" |
396 | "\"" + mocFile + "moc_" + fname + ".cpp\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" | 475 | "\"" + mocFile + Option::h_moc_mod + fname + Option::h_moc_ext + "\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" |
397 | "\t$(BuildCmds)\n\n"); | 476 | "\t$(BuildCmds)\n\n"); |
398 | 477 | ||
399 | build.append("# End Custom Build\n\n"); | 478 | build.append("# End Custom Build\n\n"); |
400 | 479 | ||
401 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 480 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
402 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" << build | 481 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build |
403 | << "!ENDIF \n\n" << "# End Source File" << endl; | 482 | << "!ENDIF \n\n" << "# End Source File" << endl; |
404 | } | 483 | } |
405 | // endGroups(t); | 484 | // endGroups(t); |
406 | t << "\n# End Group\n"; | 485 | t << "\n# End Group\n"; |
407 | } else if(variable == "MSVCDSP_LEXSOURCES") { | 486 | } else if(variable == "MSVCDSP_LEXSOURCES") { |
408 | if(project->variables()["LEXSOURCES"].isEmpty()) | 487 | if(project->variables()["LEXSOURCES"].isEmpty()) |
409 | continue; | 488 | continue; |
410 | 489 | ||
411 | t << "# Begin Group \"Lexables\"\n" | 490 | t << "# Begin Group \"Lexables\"\n" |
412 | << "# Prop Default_Filter \"l\"\n"; | 491 | << "# Prop Default_Filter \"l\"\n"; |
413 | 492 | ||
414 | QString lexpath = var("QMAKE_LEX") + varGlue("QMAKE_LEXFLAGS", " ", " ", "") + " "; | 493 | QString lexpath = var("QMAKE_LEX") + varGlue("QMAKE_LEXFLAGS", " ", " ", "") + " "; |
415 | 494 | ||
416 | QStringList list = project->variables()["LEXSOURCES"]; | 495 | QStringList list = project->variables()["LEXSOURCES"]; |
417 | if(!project->isActiveConfig("flat")) | 496 | if(!project->isActiveConfig("flat")) |
418 | list.sort(); | 497 | list.sort(); |
419 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { | 498 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { |
420 | QString fname = (*it); | 499 | QString fname = (*it); |
421 | // beginGroupForFile(fname, t); | 500 | // beginGroupForFile(fname, t); |
422 | t << "# Begin Source File\n\nSOURCE=" << fname << endl; | 501 | t << "# Begin Source File\n\nSOURCE=" << fname << endl; |
423 | fname.replace(".l", Option::lex_mod + Option::cpp_ext.first()); | 502 | fname.replace(".l", Option::lex_mod + Option::cpp_ext.first()); |
424 | 503 | ||
425 | QString build = "\n\n# Begin Custom Build - Lex'ing " + (*it) + "...\n" | 504 | QString build = "\n\n# Begin Custom Build - Lex'ing " + (*it) + "...\n" |
426 | "InputPath=.\\" + (*it) + "\n\n" | 505 | "InputPath=.\\" + (*it) + "\n\n" |
427 | "\"" + fname + "\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" | 506 | "\"" + fname + "\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" |
428 | "\t" + lexpath + (*it) + "\\\n" | 507 | "\t" + lexpath + (*it) + "\\\n" |
429 | "\tdel " + fname + "\\\n" | 508 | "\tdel " + fname + "\\\n" |
430 | "\tcopy lex.yy.c " + fname + "\n\n" + | 509 | "\tcopy lex.yy.c " + fname + "\n\n" + |
431 | "# End Custom Build\n\n"; | 510 | "# End Custom Build\n\n"; |
432 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 511 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
433 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" << build | 512 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build |
434 | << "!ENDIF \n\n" << build | 513 | << "!ENDIF \n\n" << build |
435 | 514 | ||
436 | << "# End Source File" << endl; | 515 | << "# End Source File" << endl; |
437 | } | 516 | } |
438 | // endGroups(t); | 517 | // endGroups(t); |
439 | t << "\n# End Group\n"; | 518 | t << "\n# End Group\n"; |
440 | } else if(variable == "MSVCDSP_YACCSOURCES") { | 519 | } else if(variable == "MSVCDSP_YACCSOURCES") { |
441 | if(project->variables()["YACCSOURCES"].isEmpty()) | 520 | if(project->variables()["YACCSOURCES"].isEmpty()) |
442 | continue; | 521 | continue; |
443 | 522 | ||
444 | t << "# Begin Group \"Yaccables\"\n" | 523 | t << "# Begin Group \"Yaccables\"\n" |
445 | << "# Prop Default_Filter \"y\"\n"; | 524 | << "# Prop Default_Filter \"y\"\n"; |
446 | 525 | ||
447 | QString yaccpath = var("QMAKE_YACC") + varGlue("QMAKE_YACCFLAGS", " ", " ", "") + " "; | 526 | QString yaccpath = var("QMAKE_YACC") + varGlue("QMAKE_YACCFLAGS", " ", " ", "") + " "; |
448 | 527 | ||
449 | QStringList list = project->variables()["YACCSOURCES"]; | 528 | QStringList list = project->variables()["YACCSOURCES"]; |
450 | if(!project->isActiveConfig("flat")) | 529 | if(!project->isActiveConfig("flat")) |
451 | list.sort(); | 530 | list.sort(); |
452 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { | 531 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { |
453 | QString fname = (*it); | 532 | QString fname = (*it); |
454 | // beginGroupForFile(fname, t); | 533 | // beginGroupForFile(fname, t); |
455 | t << "# Begin Source File\n\nSOURCE=" << fname << endl; | 534 | t << "# Begin Source File\n\nSOURCE=" << fname << endl; |
456 | fname.replace(".y", Option::yacc_mod); | 535 | fname.replace(".y", Option::yacc_mod); |
457 | 536 | ||
458 | QString build = "\n\n# Begin Custom Build - Yacc'ing " + (*it) + "...\n" | 537 | QString build = "\n\n# Begin Custom Build - Yacc'ing " + (*it) + "...\n" |
459 | "InputPath=.\\" + (*it) + "\n\n" | 538 | "InputPath=.\\" + (*it) + "\n\n" |
460 | "\"" + fname + Option::cpp_ext.first() + "\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" | 539 | "\"" + fname + Option::cpp_ext.first() + "\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" |
461 | "\t" + yaccpath + (*it) + "\\\n" | 540 | "\t" + yaccpath + (*it) + "\\\n" |
462 | "\tdel " + fname + Option::h_ext.first() + "\\\n" | 541 | "\tdel " + fname + Option::h_ext.first() + "\\\n" |
463 | "\tmove y.tab.h " + fname + Option::h_ext.first() + "\n\n" + | 542 | "\tmove y.tab.h " + fname + Option::h_ext.first() + "\n\n" + |
464 | "\tdel " + fname + Option::cpp_ext.first() + "\\\n" | 543 | "\tdel " + fname + Option::cpp_ext.first() + "\\\n" |
465 | "\tmove y.tab.c " + fname + Option::cpp_ext.first() + "\n\n" + | 544 | "\tmove y.tab.c " + fname + Option::cpp_ext.first() + "\n\n" + |
466 | "# End Custom Build\n\n"; | 545 | "# End Custom Build\n\n"; |
467 | 546 | ||
468 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 547 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
469 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" << build | 548 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build |
470 | << "!ENDIF \n\n" | 549 | << "!ENDIF \n\n" |
471 | << "# End Source File" << endl; | 550 | << "# End Source File" << endl; |
472 | } | 551 | } |
473 | // endGroups(t); | 552 | // endGroups(t); |
474 | t << "\n# End Group\n"; | 553 | t << "\n# End Group\n"; |
475 | } else if( variable == "MSVCDSP_CONFIGMODE" ) { | 554 | } else if( variable == "MSVCDSP_CONFIGMODE" ) { |
476 | if( project->isActiveConfig( "debug" ) ) | 555 | if( project->isActiveConfig( "debug" ) ) |
477 | t << "Debug"; | 556 | t << "Debug"; |
478 | else | 557 | else |
479 | t << "Release"; | 558 | t << "Release"; |
480 | } else if( variable == "MSVCDSP_IDLSOURCES" ) { | 559 | } else if( variable == "MSVCDSP_IDLSOURCES" ) { |
481 | QStringList list = project->variables()["MSVCDSP_IDLSOURCES"]; | 560 | QStringList list = project->variables()["MSVCDSP_IDLSOURCES"]; |
482 | if(!project->isActiveConfig("flat")) | 561 | if(!project->isActiveConfig("flat")) |
483 | list.sort(); | 562 | list.sort(); |
484 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { | 563 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { |
485 | t << "# Begin Source File" << endl << endl; | 564 | t << "# Begin Source File" << endl << endl; |
486 | t << "SOURCE=" << (*it) << endl; | 565 | t << "SOURCE=" << (*it) << endl; |
487 | t << "# PROP Exclude_From_Build 1" << endl; | 566 | t << "# PROP Exclude_From_Build 1" << endl; |
488 | t << "# End Source File" << endl << endl; | 567 | t << "# End Source File" << endl << endl; |
489 | } | 568 | } |
490 | } | 569 | } |
491 | else | 570 | else |
492 | t << var(variable); | 571 | t << var(variable); |
493 | } | 572 | } |
494 | t << line << endl; | 573 | t << line << endl; |
495 | } | 574 | } |
496 | t << endl; | 575 | t << endl; |
497 | file.close(); | 576 | file.close(); |
498 | return TRUE; | 577 | return TRUE; |
499 | } | 578 | } |
500 | 579 | ||
501 | 580 | ||
@@ -503,496 +582,555 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
503 | void | 582 | void |
504 | DspMakefileGenerator::init() | 583 | DspMakefileGenerator::init() |
505 | { | 584 | { |
506 | if(init_flag) | 585 | if(init_flag) |
507 | return; | 586 | return; |
508 | QStringList::Iterator it; | 587 | QStringList::Iterator it; |
509 | init_flag = TRUE; | 588 | init_flag = TRUE; |
510 | 589 | ||
511 | const bool thread = project->isActiveConfig("thread"); | 590 | const bool thread = project->isActiveConfig("thread"); |
512 | 591 | ||
513 | if ( project->isActiveConfig("stl") ) { | 592 | if ( project->isActiveConfig("stl") ) { |
514 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"]; | 593 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"]; |
515 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"]; | 594 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"]; |
516 | } else { | 595 | } else { |
517 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"]; | 596 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"]; |
518 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"]; | 597 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"]; |
519 | } | 598 | } |
520 | if ( project->isActiveConfig("exceptions") ) { | 599 | if ( project->isActiveConfig("exceptions") ) { |
521 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; | 600 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; |
522 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; | 601 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; |
523 | } else { | 602 | } else { |
524 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; | 603 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; |
525 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; | 604 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; |
526 | } | 605 | } |
527 | if ( project->isActiveConfig("rtti") ) { | 606 | if ( project->isActiveConfig("rtti") ) { |
528 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; | 607 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; |
529 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; | 608 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; |
530 | } else { | 609 | } else { |
531 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; | 610 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; |
532 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; | 611 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; |
533 | } | 612 | } |
534 | 613 | ||
614 | |||
535 | /* this should probably not be here, but I'm using it to wrap the .t files */ | 615 | /* this should probably not be here, but I'm using it to wrap the .t files */ |
536 | if(project->first("TEMPLATE") == "vcapp" ) | 616 | if(project->first("TEMPLATE") == "vcapp" ) |
537 | project->variables()["QMAKE_APP_FLAG"].append("1"); | 617 | project->variables()["QMAKE_APP_FLAG"].append("1"); |
538 | else if(project->first("TEMPLATE") == "vclib") | 618 | else if(project->first("TEMPLATE") == "vclib") |
539 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | 619 | project->variables()["QMAKE_LIB_FLAG"].append("1"); |
540 | if ( project->variables()["QMAKESPEC"].isEmpty() ) | 620 | if ( project->variables()["QMAKESPEC"].isEmpty() ) |
541 | project->variables()["QMAKESPEC"].append( getenv("QMAKESPEC") ); | 621 | project->variables()["QMAKESPEC"].append( getenv("QMAKESPEC") ); |
542 | 622 | ||
543 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); | 623 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); |
544 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | 624 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; |
545 | 625 | ||
546 | QStringList &configs = project->variables()["CONFIG"]; | 626 | QStringList &configs = project->variables()["CONFIG"]; |
547 | if (project->isActiveConfig("shared")) | 627 | if (project->isActiveConfig("shared")) |
548 | project->variables()["DEFINES"].append("QT_DLL"); | 628 | project->variables()["DEFINES"].append("QT_DLL"); |
549 | if (project->isActiveConfig("qt_dll")) | 629 | if (project->isActiveConfig("qt_dll")) |
550 | if(configs.findIndex("qt") == -1) configs.append("qt"); | 630 | if(configs.findIndex("qt") == -1) configs.append("qt"); |
631 | if ( project->isActiveConfig("qtopia") ) { | ||
632 | if(configs.findIndex("qtopialib") == -1) | ||
633 | configs.append("qtopialib"); | ||
634 | if(configs.findIndex("qtopiainc") == -1) | ||
635 | configs.append("qtopiainc"); | ||
636 | } | ||
551 | if ( project->isActiveConfig("qt") ) { | 637 | if ( project->isActiveConfig("qt") ) { |
552 | if ( project->isActiveConfig( "plugin" ) ) { | 638 | if ( project->isActiveConfig( "plugin" ) ) { |
553 | project->variables()["CONFIG"].append("dll"); | 639 | project->variables()["CONFIG"].append("dll"); |
554 | project->variables()["DEFINES"].append("QT_PLUGIN"); | 640 | project->variables()["DEFINES"].append("QT_PLUGIN"); |
555 | } | 641 | } |
556 | if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) && | 642 | if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) && |
557 | ((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 || | 643 | ((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 || |
558 | project->variables()["DEFINES"].findIndex("QT_DLL") != -1) || | 644 | project->variables()["DEFINES"].findIndex("QT_DLL") != -1) || |
559 | (getenv("QT_DLL") && !getenv("QT_NODLL"))) ) { | 645 | (getenv("QT_DLL") && !getenv("QT_NODLL"))) ) { |
560 | project->variables()["QMAKE_QT_DLL"].append("1"); | 646 | project->variables()["QMAKE_QT_DLL"].append("1"); |
561 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) | 647 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) |
562 | project->variables()["CONFIG"].append("dll"); | 648 | project->variables()["CONFIG"].append("dll"); |
563 | } | 649 | } |
564 | } | 650 | } |
565 | if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 651 | if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
566 | project->variables()["CONFIG"].remove("staticlib"); | 652 | project->variables()["CONFIG"].remove("staticlib"); |
567 | project->variables()["QMAKE_APP_OR_DLL"].append("1"); | 653 | project->variables()["QMAKE_APP_OR_DLL"].append("1"); |
568 | } else { | 654 | } else { |
569 | project->variables()["CONFIG"].append("staticlib"); | 655 | project->variables()["CONFIG"].append("staticlib"); |
570 | } | 656 | } |
571 | 657 | ||
572 | if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) { | 658 | if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) { |
573 | project->variables()["CONFIG"].append("windows"); | 659 | project->variables()["CONFIG"].append("windows"); |
574 | } | 660 | } |
575 | if ( !project->variables()["VERSION"].isEmpty() ) { | 661 | if ( !project->variables()["VERSION"].isEmpty() ) { |
576 | QString version = project->variables()["VERSION"][0]; | 662 | QString version = project->variables()["VERSION"][0]; |
577 | int firstDot = version.find( "." ); | 663 | int firstDot = version.find( "." ); |
578 | QString major = version.left( firstDot ); | 664 | QString major = version.left( firstDot ); |
579 | QString minor = version.right( version.length() - firstDot - 1 ); | 665 | QString minor = version.right( version.length() - firstDot - 1 ); |
580 | minor.replace( ".", "" ); | 666 | minor.replace( ".", "" ); |
581 | project->variables()["MSVCDSP_VERSION"].append( "/VERSION:" + major + "." + minor ); | 667 | project->variables()["MSVCDSP_VERSION"].append( "/VERSION:" + major + "." + minor ); |
582 | } | 668 | } |
583 | 669 | ||
670 | if ( project->isActiveConfig("qtopiainc") ) | ||
671 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QTOPIA"]; | ||
672 | if ( project->isActiveConfig("qtopialib") ) { | ||
673 | if(!project->isEmpty("QMAKE_LIBDIR_QTOPIA")) | ||
674 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QTOPIA"]; | ||
675 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QTOPIA"]; | ||
676 | } | ||
677 | |||
584 | if ( project->isActiveConfig("qt") ) { | 678 | if ( project->isActiveConfig("qt") ) { |
585 | project->variables()["CONFIG"].append("moc"); | 679 | project->variables()["CONFIG"].append("moc"); |
586 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; | 680 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; |
587 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; | 681 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; |
588 | 682 | ||
589 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | 683 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { |
590 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 684 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
591 | project->variables()["DEFINES"].append("QT_MAKEDLL"); | 685 | project->variables()["DEFINES"].append("QT_MAKEDLL"); |
592 | project->variables()["QMAKE_LFLAGS"].append("/base:\"0x39D00000\""); | 686 | project->variables()["QMAKE_LFLAGS"].append("/base:\"0x39D00000\""); |
593 | } | 687 | } |
594 | } else { | 688 | } else { |
595 | if( thread ) | 689 | if( thread ) |
596 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | 690 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; |
597 | else | 691 | else |
598 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; | 692 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; |
599 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 693 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
600 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); | 694 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); |
601 | if ( hver == -1 ) | 695 | if ( hver == -1 ) |
602 | hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); | 696 | hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); |
603 | if(hver != -1) { | 697 | if(hver != -1) { |
604 | QString ver; | 698 | QString ver; |
605 | ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (thread ? "-mt" : ""), hver); | 699 | ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (thread ? "-mt" : ""), hver); |
606 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | 700 | QStringList &libs = project->variables()["QMAKE_LIBS"]; |
607 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) | 701 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) |
608 | (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); | 702 | (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); |
609 | } | 703 | } |
610 | } | 704 | } |
611 | if ( project->isActiveConfig( "activeqt" ) ) { | 705 | if ( project->isActiveConfig( "activeqt" ) ) { |
612 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); | 706 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); |
613 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; | 707 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; |
614 | if ( project->isActiveConfig( "dll" ) ) | 708 | if ( project->isActiveConfig( "dll" ) ) |
615 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 709 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
616 | } | 710 | } |
617 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { | 711 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { |
618 | project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 712 | project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
619 | } | 713 | } |
620 | } | 714 | } |
621 | } | 715 | } |
622 | 716 | ||
623 | if ( project->isActiveConfig("debug") ) { | 717 | if ( project->isActiveConfig("debug") ) { |
624 | if ( !project->first("OBJECTS_DIR").isEmpty() ) | 718 | if ( !project->first("OBJECTS_DIR").isEmpty() ) |
625 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = project->first("OBJECTS_DIR"); | 719 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = project->first("OBJECTS_DIR"); |
626 | else | 720 | else |
627 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug"; | 721 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug"; |
628 | project->variables()["MSVCDSP_OBJECTSDIRREL"] = "Release"; | 722 | project->variables()["MSVCDSP_OBJECTSDIRREL"] = "Release"; |
629 | if ( !project->first("DESTDIR").isEmpty() ) | 723 | if ( !project->first("DESTDIR").isEmpty() ) |
630 | project->variables()["MSVCDSP_TARGETDIRDEB"] = project->first("DESTDIR"); | 724 | project->variables()["MSVCDSP_TARGETDIRDEB"] = project->first("DESTDIR"); |
631 | else | 725 | else |
632 | project->variables()["MSVCDSP_TARGETDIRDEB"] = "Debug"; | 726 | project->variables()["MSVCDSP_TARGETDIRDEB"] = "Debug"; |
633 | project->variables()["MSVCDSP_TARGETDIRREL"] = "Release"; | 727 | project->variables()["MSVCDSP_TARGETDIRREL"] = "Release"; |
634 | } else { | 728 | } else { |
635 | if ( !project->first("OBJECTS_DIR").isEmpty() ) | 729 | if ( !project->first("OBJECTS_DIR").isEmpty() ) |
636 | project->variables()["MSVCDSP_OBJECTSDIRREL"] = project->first("OBJECTS_DIR"); | 730 | project->variables()["MSVCDSP_OBJECTSDIRREL"] = project->first("OBJECTS_DIR"); |
731 | else | ||
732 | project->variables()["MSVCDSP_OBJECTSDIRREL"] = "Release"; | ||
637 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug"; | 733 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug"; |
638 | if ( !project->first("DESTDIR").isEmpty() ) | 734 | if ( !project->first("DESTDIR").isEmpty() ) |
639 | project->variables()["MSVCDSP_TARGETDIRREL"] = project->first("DESTDIR"); | 735 | project->variables()["MSVCDSP_TARGETDIRREL"] = project->first("DESTDIR"); |
640 | else | 736 | else |
641 | project->variables()["MSVCDSP_TARGETDIRREL"] = "Release"; | 737 | project->variables()["MSVCDSP_TARGETDIRREL"] = "Release"; |
642 | project->variables()["MSVCDSP_TARGETDIRDEB"] = "Debug"; | 738 | project->variables()["MSVCDSP_TARGETDIRDEB"] = "Debug"; |
643 | } | 739 | } |
644 | 740 | ||
645 | if ( project->isActiveConfig("opengl") ) { | 741 | if ( project->isActiveConfig("opengl") ) { |
646 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | 742 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; |
647 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; | 743 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; |
648 | } | 744 | } |
649 | if ( thread ) { | 745 | if ( thread ) { |
650 | if(project->isActiveConfig("qt")) | 746 | if(project->isActiveConfig("qt")) |
651 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT" ); | 747 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT" ); |
652 | if ( project->isActiveConfig("dll") || project->first("TARGET") == "qtmain" | 748 | if ( project->isActiveConfig("dll") || project->first("TARGET") == "qtmain" |
653 | || !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 749 | || !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
654 | project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; | 750 | project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; |
655 | project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; | 751 | project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; |
656 | } else { | 752 | } else { |
657 | // YES we want to use the DLL even in a static build | 753 | // YES we want to use the DLL even in a static build |
658 | project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"]; | 754 | project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"]; |
659 | project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT"]; | 755 | project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT"]; |
660 | } | 756 | } |
661 | if ( !project->variables()["DEFINES"].contains("QT_DLL") && is_qt | 757 | if ( !project->variables()["DEFINES"].contains("QT_DLL") && is_qt |
662 | && project->first("TARGET") != "qtmain" ) | 758 | && project->first("TARGET") != "qtmain" ) |
663 | project->variables()["QMAKE_LFLAGS"].append("/NODEFAULTLIB:\"libc\""); | 759 | project->variables()["QMAKE_LFLAGS"].append("/NODEFAULTLIB:\"libc\""); |
664 | } | 760 | } |
665 | 761 | ||
666 | if(project->isActiveConfig("qt")) { | 762 | if(project->isActiveConfig("qt")) { |
667 | if ( project->isActiveConfig("accessibility" ) ) | 763 | if ( project->isActiveConfig("accessibility" ) ) |
668 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); | 764 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); |
669 | if ( project->isActiveConfig("tablet") ) | 765 | if ( project->isActiveConfig("tablet") ) |
670 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); | 766 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); |
671 | } | 767 | } |
672 | if ( project->isActiveConfig("dll") ) { | 768 | if ( project->isActiveConfig("dll") ) { |
769 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE_DLL"]; | ||
770 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE_DLL"]; | ||
771 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE_DLL"]; | ||
772 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS_DLL"]; | ||
673 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | 773 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { |
674 | QString ver_xyz(project->first("VERSION")); | 774 | QString ver_xyz(project->first("VERSION")); |
675 | ver_xyz.replace(".", ""); | 775 | ver_xyz.replace(".", ""); |
676 | project->variables()["TARGET_EXT"].append(ver_xyz + ".dll"); | 776 | project->variables()["TARGET_EXT"].append(ver_xyz + ".dll"); |
677 | } else { | 777 | } else { |
678 | project->variables()["TARGET_EXT"].append(".dll"); | 778 | project->variables()["TARGET_EXT"].append(".dll"); |
679 | } | 779 | } |
680 | } else { | 780 | } else { |
781 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE"]; | ||
782 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE"]; | ||
783 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"]; | ||
784 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"]; | ||
681 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) | 785 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) |
682 | project->variables()["TARGET_EXT"].append(".exe"); | 786 | project->variables()["TARGET_EXT"].append(".exe"); |
683 | else | 787 | else |
684 | project->variables()["TARGET_EXT"].append(".lib"); | 788 | project->variables()["TARGET_EXT"].append(".lib"); |
685 | } | 789 | } |
686 | 790 | ||
791 | if ( project->isActiveConfig("windows") ) { | ||
792 | if ( project->isActiveConfig("console") ) { | ||
793 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | ||
794 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | ||
795 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | ||
796 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | ||
797 | } else { | ||
798 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"]; | ||
799 | } | ||
800 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | ||
801 | } else { | ||
802 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | ||
803 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | ||
804 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | ||
805 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | ||
806 | } | ||
807 | |||
687 | project->variables()["MSVCDSP_VER"] = "6.00"; | 808 | project->variables()["MSVCDSP_VER"] = "6.00"; |
688 | project->variables()["MSVCDSP_DEBUG_OPT"] = "/GZ /ZI"; | 809 | project->variables()["MSVCDSP_DEBUG_OPT"] = "/GZ /ZI"; |
689 | 810 | ||
690 | if(!project->isActiveConfig("incremental")) { | 811 | if(!project->isActiveConfig("incremental")) { |
691 | project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no")); | 812 | project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no")); |
692 | if ( is_qt ) | 813 | if ( is_qt ) |
693 | project->variables()["MSVCDSP_DEBUG_OPT"] = "/GZ /Zi"; | 814 | project->variables()["MSVCDSP_DEBUG_OPT"] = "/GZ /Zi"; |
694 | } | 815 | } |
695 | 816 | ||
696 | QString msvcdsp_project; | 817 | QString msvcdsp_project; |
697 | if ( project->variables()["TARGET"].count() ) | 818 | if ( project->variables()["TARGET"].count() ) |
698 | msvcdsp_project = project->variables()["TARGET"].first(); | 819 | msvcdsp_project = project->variables()["TARGET"].first(); |
699 | 820 | ||
700 | QString targetfilename = project->variables()["TARGET"].first(); | 821 | QString targetfilename = project->variables()["TARGET"].first(); |
701 | project->variables()["TARGET"].first() += project->first("TARGET_EXT"); | 822 | project->variables()["TARGET"].first() += project->first("TARGET_EXT"); |
702 | if ( project->isActiveConfig("moc") ) | 823 | if ( project->isActiveConfig("moc") ) |
703 | setMocAware(TRUE); | 824 | setMocAware(TRUE); |
704 | 825 | ||
705 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 826 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
706 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', | 827 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', |
707 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); | 828 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); |
708 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; | 829 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; |
709 | for(it = l.begin(); it != l.end(); ++it) { | 830 | for(it = l.begin(); it != l.end(); ++it) { |
710 | QStringList &gdmf = project->variables()[(*it)]; | 831 | QStringList &gdmf = project->variables()[(*it)]; |
711 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) | 832 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) |
712 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); | 833 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); |
713 | } | 834 | } |
714 | 835 | ||
715 | MakefileGenerator::init(); | 836 | MakefileGenerator::init(); |
716 | if ( msvcdsp_project.isEmpty() ) | 837 | if ( msvcdsp_project.isEmpty() ) |
717 | msvcdsp_project = Option::output.name(); | 838 | msvcdsp_project = Option::output.name(); |
718 | 839 | ||
719 | msvcdsp_project = msvcdsp_project.right( msvcdsp_project.length() - msvcdsp_project.findRev( "\\" ) - 1 ); | 840 | msvcdsp_project = msvcdsp_project.right( msvcdsp_project.length() - msvcdsp_project.findRev( "\\" ) - 1 ); |
720 | msvcdsp_project = msvcdsp_project.left( msvcdsp_project.findRev( "." ) ); | 841 | msvcdsp_project = msvcdsp_project.left( msvcdsp_project.findRev( "." ) ); |
721 | msvcdsp_project.replace("-", ""); | 842 | msvcdsp_project.replace("-", ""); |
722 | 843 | ||
723 | project->variables()["MSVCDSP_PROJECT"].append(msvcdsp_project); | 844 | project->variables()["MSVCDSP_PROJECT"].append(msvcdsp_project); |
724 | QStringList &proj = project->variables()["MSVCDSP_PROJECT"]; | 845 | QStringList &proj = project->variables()["MSVCDSP_PROJECT"]; |
725 | 846 | ||
726 | for(it = proj.begin(); it != proj.end(); ++it) | 847 | for(it = proj.begin(); it != proj.end(); ++it) |
727 | (*it).replace(QRegExp("\\.[a-zA-Z0-9_]*$"), ""); | 848 | (*it).replace(QRegExp("\\.[a-zA-Z0-9_]*$"), ""); |
728 | 849 | ||
729 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 850 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
730 | project->variables()["MSVCDSP_TEMPLATE"].append("win32app" + project->first( "DSP_EXTENSION" ) ); | 851 | project->variables()["MSVCDSP_TEMPLATE"].append("win32app" + project->first( "DSP_EXTENSION" ) ); |
731 | if ( project->isActiveConfig("console") ) { | 852 | if ( project->isActiveConfig("console") ) { |
732 | project->variables()["MSVCDSP_CONSOLE"].append("Console"); | 853 | project->variables()["MSVCDSP_CONSOLE"].append("Console"); |
733 | project->variables()["MSVCDSP_WINCONDEF"].append("_CONSOLE"); | 854 | project->variables()["MSVCDSP_WINCONDEF"].append("_CONSOLE"); |
734 | project->variables()["MSVCDSP_DSPTYPE"].append("0x0103"); | 855 | project->variables()["MSVCDSP_DSPTYPE"].append("0x0103"); |
735 | project->variables()["MSVCDSP_SUBSYSTEM"].append("console"); | ||
736 | } else { | 856 | } else { |
737 | project->variables()["MSVCDSP_CONSOLE"].clear(); | 857 | project->variables()["MSVCDSP_CONSOLE"].clear(); |
738 | project->variables()["MSVCDSP_WINCONDEF"].append("_WINDOWS"); | 858 | project->variables()["MSVCDSP_WINCONDEF"].append("_WINDOWS"); |
739 | project->variables()["MSVCDSP_DSPTYPE"].append("0x0101"); | 859 | project->variables()["MSVCDSP_DSPTYPE"].append("0x0101"); |
740 | project->variables()["MSVCDSP_SUBSYSTEM"].append("windows"); | ||
741 | } | 860 | } |
742 | } else { | 861 | } else { |
743 | if ( project->isActiveConfig("dll") ) { | 862 | if ( project->isActiveConfig("dll") ) { |
744 | project->variables()["MSVCDSP_TEMPLATE"].append("win32dll" + project->first( "DSP_EXTENSION" ) ); | 863 | project->variables()["MSVCDSP_TEMPLATE"].append("win32dll" + project->first( "DSP_EXTENSION" ) ); |
745 | } else { | 864 | } else { |
746 | project->variables()["MSVCDSP_TEMPLATE"].append("win32lib" + project->first( "DSP_EXTENSION" ) ); | 865 | project->variables()["MSVCDSP_TEMPLATE"].append("win32lib" + project->first( "DSP_EXTENSION" ) ); |
747 | } | 866 | } |
748 | } | 867 | } |
749 | 868 | ||
750 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | 869 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; |
870 | |||
871 | processPrlFiles(); | ||
751 | 872 | ||
873 | // Update -lname to name.lib, | ||
874 | QStringList &libs2 = project->variables()["QMAKE_LIBS"]; | ||
875 | for ( QStringList::Iterator libit2 = libs2.begin(); libit2 != libs2.end(); ++libit2 ) { | ||
876 | if ( (*libit2).startsWith( "-l" ) ) { | ||
877 | (*libit2) = (*libit2).mid( 2 ) + ".lib"; | ||
878 | } else if ( (*libit2).startsWith( "-L" ) ) { | ||
879 | project->variables()["QMAKE_LIBDIR"] += (*libit2).mid(2); | ||
880 | libit2 = libs2.remove( libit2 ); | ||
881 | } | ||
882 | } | ||
883 | |||
752 | project->variables()["MSVCDSP_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; | 884 | project->variables()["MSVCDSP_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; |
753 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) | 885 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) |
754 | project->variables()["MSVCDSP_LFLAGS" ].append(varGlue("QMAKE_LIBDIR","/LIBPATH:\"","\" /LIBPATH:\"","\"")); | 886 | project->variables()["MSVCDSP_LFLAGS" ].append(varGlue("QMAKE_LIBDIR","/LIBPATH:\"","\" /LIBPATH:\"","\"")); |
755 | project->variables()["MSVCDSP_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; | 887 | project->variables()["MSVCDSP_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; |
756 | project->variables()["MSVCDSP_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); | 888 | project->variables()["MSVCDSP_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); |
757 | project->variables()["MSVCDSP_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); | 889 | project->variables()["MSVCDSP_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); |
758 | 890 | ||
759 | processPrlFiles(); | 891 | if (!project->variables()["RES_FILE"].isEmpty()) |
892 | project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"]; | ||
893 | |||
760 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | 894 | QStringList &libs = project->variables()["QMAKE_LIBS"]; |
761 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) { | 895 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) { |
762 | QString lib = (*libit); | 896 | QString lib = (*libit); |
763 | lib.replace(QRegExp("\""), ""); | 897 | lib.replace(QRegExp("\""), ""); |
764 | project->variables()["MSVCDSP_LIBS"].append(" \"" + lib + "\""); | 898 | project->variables()["MSVCDSP_LIBS"].append(" \"" + lib + "\""); |
765 | } | 899 | } |
766 | 900 | ||
767 | QStringList &incs = project->variables()["INCLUDEPATH"]; | 901 | QStringList &incs = project->variables()["INCLUDEPATH"]; |
768 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { | 902 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { |
769 | QString inc = (*incit); | 903 | QString inc = (*incit); |
770 | inc.replace("\"", ""); | 904 | inc.replace("\"", ""); |
905 | if(inc.endsWith("\\")) // Remove trailing \'s from paths | ||
906 | inc.truncate(inc.length()-1); | ||
771 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + inc + "\""); | 907 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + inc + "\""); |
772 | } | 908 | } |
773 | 909 | ||
774 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + specdir() + "\""); | 910 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + specdir() + "\""); |
775 | if ( project->isActiveConfig("qt") ) { | 911 | if ( project->isActiveConfig("qt") ) { |
776 | project->variables()["MSVCDSP_RELDEFS"].append("/D \"QT_NO_DEBUG\""); | 912 | project->variables()["MSVCDSP_RELDEFS"].append("/D \"QT_NO_DEBUG\""); |
777 | } else { | 913 | } else { |
778 | project->variables()["MSVCDSP_RELDEFS"].clear(); | 914 | project->variables()["MSVCDSP_RELDEFS"].clear(); |
779 | } | 915 | } |
780 | 916 | ||
781 | QString dest; | 917 | QString dest; |
782 | QString postLinkStep; | 918 | QString postLinkStep; |
783 | QString copyDllStep; | 919 | QString copyDllStep; |
784 | QString activeQtStepPreCopyDll; | 920 | QString activeQtStepPreCopyDll; |
785 | QString activeQtStepPostCopyDll; | 921 | QString activeQtStepPostCopyDll; |
786 | QString activeQtStepPreCopyDllDebug; | 922 | QString activeQtStepPreCopyDllDebug; |
787 | QString activeQtStepPostCopyDllDebug; | 923 | QString activeQtStepPostCopyDllDebug; |
788 | QString activeQtStepPreCopyDllRelease; | 924 | QString activeQtStepPreCopyDllRelease; |
789 | QString activeQtStepPostCopyDllRelease; | 925 | QString activeQtStepPostCopyDllRelease; |
790 | 926 | ||
791 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) | 927 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) |
792 | postLinkStep += var("QMAKE_POST_LINK"); | 928 | postLinkStep += var("QMAKE_POST_LINK"); |
793 | 929 | ||
794 | if ( !project->variables()["DESTDIR"].isEmpty() ) { | 930 | if ( !project->variables()["DESTDIR"].isEmpty() ) { |
795 | project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); | 931 | project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); |
796 | Option::fixPathToTargetOS(project->first("TARGET")); | 932 | Option::fixPathToTargetOS(project->first("TARGET")); |
797 | dest = project->first("TARGET"); | 933 | dest = project->first("TARGET"); |
798 | if ( project->first("TARGET").startsWith("$(QTDIR)") ) | 934 | if ( project->first("TARGET").startsWith("$(QTDIR)") ) |
799 | dest.replace( "$(QTDIR)", getenv("QTDIR") ); | 935 | dest.replace( "$(QTDIR)", getenv("QTDIR") ); |
800 | project->variables()["MSVCDSP_TARGET"].append( | 936 | project->variables()["MSVCDSP_TARGET"].append( |
801 | QString("/out:\"") + dest + "\""); | 937 | QString("/out:\"") + dest + "\""); |
802 | if ( project->isActiveConfig("dll") ) { | 938 | if ( project->isActiveConfig("dll") ) { |
803 | QString imp = dest; | 939 | QString imp = dest; |
804 | imp.replace(".dll", ".lib"); | 940 | imp.replace(".dll", ".lib"); |
805 | project->variables()["MSVCDSP_TARGET"].append(QString(" /implib:\"") + imp + "\""); | 941 | project->variables()["MSVCDSP_TARGET"].append(QString(" /implib:\"") + imp + "\""); |
806 | } | 942 | } |
807 | } | 943 | } |
808 | if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) { | 944 | if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) { |
809 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; | 945 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; |
810 | if ( dlldirs.count() ) | 946 | if ( dlldirs.count() ) |
811 | copyDllStep += "\t"; | 947 | copyDllStep += "\t"; |
812 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { | 948 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { |
813 | copyDllStep += "copy \"$(TargetPath)\" \"" + *dlldir + "\"\t"; | 949 | copyDllStep += "copy \"$(TargetPath)\" \"" + *dlldir + "\"\t"; |
814 | } | 950 | } |
815 | } | 951 | } |
816 | 952 | ||
817 | if ( project->isActiveConfig("activeqt") ) { | 953 | if ( project->isActiveConfig("activeqt") ) { |
818 | QString idl = project->variables()["QMAKE_IDL"].first(); | 954 | QString idl = project->variables()["QMAKE_IDL"].first(); |
819 | QString idc = project->variables()["QMAKE_IDC"].first(); | 955 | QString idc = project->variables()["QMAKE_IDC"].first(); |
820 | QString version = project->variables()["VERSION"].first(); | 956 | QString version = project->variables()["VERSION"].first(); |
821 | if ( version.isEmpty() ) | 957 | if ( version.isEmpty() ) |
822 | version = "1.0"; | 958 | version = "1.0"; |
823 | 959 | project->variables()["MSVCDSP_IDLSOURCES"].append( var("OBJECTS_DIR") + targetfilename + ".idl" ); | |
824 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".idl" ); | ||
825 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".tlb" ); | ||
826 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".midl" ); | ||
827 | if ( project->isActiveConfig( "dll" ) ) { | 960 | if ( project->isActiveConfig( "dll" ) ) { |
828 | activeQtStepPreCopyDll += | 961 | activeQtStepPreCopyDll += |
829 | "\t" + idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version + | 962 | "\t" + idc + " %1 -idl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version + |
830 | "\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" | 963 | "\t" + idl + " /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb" + |
831 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb"; | 964 | "\t" + idc + " %2 /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"; |
832 | activeQtStepPostCopyDll += | 965 | activeQtStepPostCopyDll += |
833 | "\t" + idc + " %1 /regserver\n"; | 966 | "\t" + idc + " %1 /regserver\n"; |
834 | 967 | ||
835 | QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".dll"; | 968 | QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".dll"; |
836 | activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable); | 969 | activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable); |
837 | activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable); | 970 | activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable); |
838 | 971 | ||
839 | executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".dll"; | 972 | executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".dll"; |
840 | activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable); | 973 | activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable); |
841 | activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable); | 974 | activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable); |
842 | } else { | 975 | } else { |
843 | activeQtStepPreCopyDll += | 976 | activeQtStepPreCopyDll += |
844 | "\t%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version + | 977 | "\t%1 -dumpidl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version + |
845 | "\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" | 978 | "\t" + idl + " /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb" + |
846 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb"; | 979 | "\t" + idc + " %2 /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"; |
847 | activeQtStepPostCopyDll += | 980 | activeQtStepPostCopyDll += |
848 | "\t%1 -regserver\n"; | 981 | "\t%1 -regserver\n"; |
849 | QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".exe"; | 982 | QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".exe"; |
850 | activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable); | 983 | activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable); |
851 | activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable); | 984 | activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable); |
852 | 985 | ||
853 | executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".exe"; | 986 | executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".exe"; |
854 | activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable); | 987 | activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable); |
855 | activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable); | 988 | activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable); |
856 | } | 989 | } |
857 | 990 | ||
858 | } | 991 | } |
859 | 992 | ||
860 | 993 | ||
861 | if ( !postLinkStep.isEmpty() || !copyDllStep.isEmpty() || !activeQtStepPreCopyDllDebug.isEmpty() || !activeQtStepPreCopyDllRelease.isEmpty() ) { | 994 | if ( !postLinkStep.isEmpty() || !copyDllStep.isEmpty() || !activeQtStepPreCopyDllDebug.isEmpty() || !activeQtStepPreCopyDllRelease.isEmpty() ) { |
862 | project->variables()["MSVCDSP_POST_LINK_DBG"].append( | 995 | project->variables()["MSVCDSP_POST_LINK_DBG"].append( |
863 | "# Begin Special Build Tool\n" | 996 | "# Begin Special Build Tool\n" |
864 | "SOURCE=$(InputPath)\n" | 997 | "SOURCE=$(InputPath)\n" |
865 | "PostBuild_Desc=Post Build Step\n" | 998 | "PostBuild_Desc=Post Build Step\n" |
866 | "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllDebug + copyDllStep + activeQtStepPostCopyDllDebug + "\n" | 999 | "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllDebug + copyDllStep + activeQtStepPostCopyDllDebug + "\n" |
867 | "# End Special Build Tool\n" ); | 1000 | "# End Special Build Tool\n" ); |
868 | project->variables()["MSVCDSP_POST_LINK_REL"].append( | 1001 | project->variables()["MSVCDSP_POST_LINK_REL"].append( |
869 | "# Begin Special Build Tool\n" | 1002 | "# Begin Special Build Tool\n" |
870 | "SOURCE=$(InputPath)\n" | 1003 | "SOURCE=$(InputPath)\n" |
871 | "PostBuild_Desc=Post Build Step\n" | 1004 | "PostBuild_Desc=Post Build Step\n" |
872 | "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllRelease + copyDllStep + activeQtStepPostCopyDllRelease + "\n" | 1005 | "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllRelease + copyDllStep + activeQtStepPostCopyDllRelease + "\n" |
873 | "# End Special Build Tool\n" ); | 1006 | "# End Special Build Tool\n" ); |
874 | } | 1007 | } |
875 | 1008 | ||
876 | if ( !project->variables()["SOURCES"].isEmpty() || !project->variables()["RC_FILE"].isEmpty() ) { | 1009 | if ( !project->variables()["SOURCES"].isEmpty() || !project->variables()["RC_FILE"].isEmpty() ) { |
877 | project->variables()["SOURCES"] += project->variables()["RC_FILE"]; | 1010 | project->variables()["SOURCES"] += project->variables()["RC_FILE"]; |
878 | } | 1011 | } |
879 | QStringList &list = project->variables()["FORMS"]; | 1012 | QStringList &list = project->variables()["FORMS"]; |
880 | for( it = list.begin(); it != list.end(); ++it ) { | 1013 | for( it = list.begin(); it != list.end(); ++it ) { |
881 | if ( QFile::exists( *it + ".h" ) ) | 1014 | if ( QFile::exists( *it + ".h" ) ) |
882 | project->variables()["SOURCES"].append( *it + ".h" ); | 1015 | project->variables()["SOURCES"].append( *it + ".h" ); |
883 | } | 1016 | } |
884 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCDSP_LIBS"; | 1017 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCDSP_LIBS"; |
885 | } | 1018 | } |
886 | 1019 | ||
887 | 1020 | ||
888 | QString | 1021 | QString |
889 | DspMakefileGenerator::findTemplate(const QString &file) | 1022 | DspMakefileGenerator::findTemplate(const QString &file) |
890 | { | 1023 | { |
891 | QString ret; | 1024 | QString ret; |
892 | if(!QFile::exists((ret = file)) && | 1025 | if(!QFile::exists((ret = file)) && |
893 | !QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) && | 1026 | !QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) && |
894 | !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc/" + file)) && | 1027 | !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc/" + file)) && |
895 | !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) | 1028 | !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) |
896 | return ""; | 1029 | return ""; |
897 | return ret; | 1030 | return ret; |
898 | } | 1031 | } |
899 | 1032 | ||
900 | 1033 | ||
901 | void | 1034 | void |
902 | DspMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) | 1035 | DspMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) |
903 | { | 1036 | { |
904 | if(var == "QMAKE_PRL_DEFINES") { | 1037 | if(var == "QMAKE_PRL_DEFINES") { |
905 | QStringList &out = project->variables()["MSVCDSP_DEFINES"]; | 1038 | QStringList &out = project->variables()["MSVCDSP_DEFINES"]; |
906 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { | 1039 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { |
907 | if(out.findIndex((*it)) == -1) | 1040 | if(out.findIndex((*it)) == -1) |
908 | out.append((" /D \"" + *it + "\"")); | 1041 | out.append((" /D \"" + *it + "\"")); |
909 | } | 1042 | } |
910 | } else { | 1043 | } else { |
911 | MakefileGenerator::processPrlVariable(var, l); | 1044 | MakefileGenerator::processPrlVariable(var, l); |
912 | } | 1045 | } |
913 | } | 1046 | } |
914 | 1047 | ||
915 | 1048 | ||
916 | void | 1049 | void |
917 | DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t, | 1050 | DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t, |
918 | const QString& filter) | 1051 | const QString& filter) |
919 | { | 1052 | { |
920 | if(project->isActiveConfig("flat")) | 1053 | if(project->isActiveConfig("flat")) |
921 | return; | 1054 | return; |
922 | |||
923 | fileFixify(file, QDir::currentDirPath(), QDir::currentDirPath(), TRUE); | 1055 | fileFixify(file, QDir::currentDirPath(), QDir::currentDirPath(), TRUE); |
924 | file = file.section(Option::dir_sep, 0, -2); | 1056 | file = file.section(Option::dir_sep, 0, -2); |
925 | if(file.right(Option::dir_sep.length()) != Option::dir_sep) | 1057 | if(file.right(Option::dir_sep.length()) != Option::dir_sep) |
926 | file += Option::dir_sep; | 1058 | file += Option::dir_sep; |
927 | if(file == currentGroup) | 1059 | if(file == currentGroup) |
928 | return; | 1060 | return; |
929 | 1061 | ||
930 | if(file.isEmpty() || !QDir::isRelativePath(file)) { | 1062 | if(file.isEmpty() || !QDir::isRelativePath(file)) { |
931 | endGroups(t); | 1063 | endGroups(t); |
932 | return; | 1064 | return; |
933 | } | 1065 | } |
934 | if(file.startsWith(currentGroup)) | 1066 | |
935 | file = file.mid(currentGroup.length()); | 1067 | QString tempFile = file; |
1068 | if(tempFile.startsWith(currentGroup)) | ||
1069 | tempFile = tempFile.mid(currentGroup.length()); | ||
936 | int dirSep = currentGroup.findRev( Option::dir_sep ); | 1070 | int dirSep = currentGroup.findRev( Option::dir_sep ); |
937 | while( !file.startsWith( currentGroup ) && dirSep != -1 ) { | 1071 | |
1072 | while( !tempFile.startsWith( currentGroup ) && dirSep != -1 ) { | ||
938 | currentGroup.truncate( dirSep ); | 1073 | currentGroup.truncate( dirSep ); |
939 | dirSep = currentGroup.findRev( Option::dir_sep ); | 1074 | dirSep = currentGroup.findRev( Option::dir_sep ); |
940 | if ( !file.startsWith( currentGroup ) && dirSep != -1 ) | 1075 | if ( !tempFile.startsWith( currentGroup ) && dirSep != -1 ) |
941 | t << "\n# End Group\n"; | 1076 | t << "\n# End Group\n"; |
942 | } | 1077 | } |
943 | if ( !file.startsWith( currentGroup ) ) { | 1078 | if ( !file.startsWith( currentGroup ) ) { |
944 | t << "\n# End Group\n"; | 1079 | t << "\n# End Group\n"; |
945 | currentGroup = ""; | 1080 | currentGroup = ""; |
946 | } | 1081 | } |
1082 | |||
947 | QStringList dirs = QStringList::split(Option::dir_sep, file.right( file.length() - currentGroup.length() ) ); | 1083 | QStringList dirs = QStringList::split(Option::dir_sep, file.right( file.length() - currentGroup.length() ) ); |
948 | for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { | 1084 | for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { |
949 | t << "# Begin Group \"" << (*dir_it) << "\"\n" | 1085 | t << "# Begin Group \"" << (*dir_it) << "\"\n" |
950 | << "# Prop Default_Filter \"" << filter << "\"\n"; | 1086 | << "# Prop Default_Filter \"" << filter << "\"\n"; |
951 | } | 1087 | } |
952 | currentGroup = file; | 1088 | currentGroup = file; |
953 | } | 1089 | } |
954 | 1090 | ||
955 | 1091 | ||
956 | void | 1092 | void |
957 | DspMakefileGenerator::endGroups(QTextStream &t) | 1093 | DspMakefileGenerator::endGroups(QTextStream &t) |
958 | { | 1094 | { |
959 | if(project->isActiveConfig("flat")) | 1095 | if(project->isActiveConfig("flat")) |
960 | return; | 1096 | return; |
961 | else if(currentGroup.isEmpty()) | 1097 | else if(currentGroup.isEmpty()) |
962 | return; | 1098 | return; |
963 | 1099 | ||
964 | QStringList dirs = QStringList::split(Option::dir_sep, currentGroup); | 1100 | QStringList dirs = QStringList::split(Option::dir_sep, currentGroup); |
965 | for(QStringList::Iterator dir_it = dirs.end(); dir_it != dirs.begin(); --dir_it) { | 1101 | for(QStringList::Iterator dir_it = dirs.end(); dir_it != dirs.begin(); --dir_it) { |
966 | t << "\n# End Group\n"; | 1102 | t << "\n# End Group\n"; |
967 | } | 1103 | } |
968 | currentGroup = ""; | 1104 | currentGroup = ""; |
969 | } | 1105 | } |
970 | 1106 | ||
971 | bool | 1107 | bool |
972 | DspMakefileGenerator::openOutput(QFile &file) const | 1108 | DspMakefileGenerator::openOutput(QFile &file) const |
973 | { | 1109 | { |
974 | QString outdir; | 1110 | QString outdir; |
975 | if(!file.name().isEmpty()) { | 1111 | if(!file.name().isEmpty()) { |
1112 | if(QDir::isRelativePath(file.name())) | ||
1113 | file.setName(Option::output_dir + file.name()); //pwd when qmake was run | ||
976 | QFileInfo fi(file); | 1114 | QFileInfo fi(file); |
977 | if(fi.isDir()) | 1115 | if(fi.isDir()) |
978 | outdir = file.name() + QDir::separator(); | 1116 | outdir = file.name() + QDir::separator(); |
979 | } | 1117 | } |
980 | if(!outdir.isEmpty() || file.name().isEmpty()) | 1118 | if(!outdir.isEmpty() || file.name().isEmpty()) |
981 | file.setName(outdir + project->first("TARGET") + project->first("DSP_EXTENSION")); | 1119 | file.setName(outdir + project->first("TARGET") + project->first("DSP_EXTENSION")); |
982 | if(QDir::isRelativePath(file.name())) { | 1120 | if(QDir::isRelativePath(file.name())) { |
983 | QString ofile; | 1121 | QString ofile; |
984 | ofile = file.name(); | 1122 | ofile = file.name(); |
985 | int slashfind = ofile.findRev('\\'); | 1123 | int slashfind = ofile.findRev('\\'); |
986 | if (slashfind == -1) { | 1124 | if (slashfind == -1) { |
987 | ofile = ofile.replace(QRegExp("-"), "_"); | 1125 | ofile = ofile.replace(QRegExp("-"), "_"); |
988 | } else { | 1126 | } else { |
989 | int hypenfind = ofile.find('-', slashfind); | 1127 | int hypenfind = ofile.find('-', slashfind); |
990 | while (hypenfind != -1 && slashfind < hypenfind) { | 1128 | while (hypenfind != -1 && slashfind < hypenfind) { |
991 | ofile = ofile.replace(hypenfind, 1, "_"); | 1129 | ofile = ofile.replace(hypenfind, 1, "_"); |
992 | hypenfind = ofile.find('-', hypenfind + 1); | 1130 | hypenfind = ofile.find('-', hypenfind + 1); |
993 | } | 1131 | } |
994 | } | 1132 | } |
995 | file.setName(Option::fixPathToLocalOS(QDir::currentDirPath() + Option::dir_sep + ofile)); | 1133 | file.setName(Option::fixPathToLocalOS(QDir::currentDirPath() + Option::dir_sep + ofile)); |
996 | } | 1134 | } |
997 | return Win32MakefileGenerator::openOutput(file); | 1135 | return Win32MakefileGenerator::openOutput(file); |
998 | } | 1136 | } |