author | sla |
Wed, 15 Dec 2010 07:11:31 -0800 | |
changeset 7452 | b3fa838286de |
parent 7397 | 5b173b4ca846 |
child 8303 | 81a0b8663748 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
7397 | 2 |
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
25 |
import java.io.FileWriter; |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
26 |
import java.io.IOException; |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
27 |
import java.io.PrintWriter; |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
28 |
import java.util.Hashtable; |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
29 |
import java.util.Iterator; |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
30 |
import java.util.TreeSet; |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
31 |
import java.util.Vector; |
1 | 32 |
|
33 |
public class WinGammaPlatformVC7 extends WinGammaPlatform { |
|
34 |
||
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
35 |
String projectVersion() {return "7.10";}; |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
36 |
|
1 | 37 |
public void writeProjectFile(String projectFileName, String projectName, |
38 |
Vector allConfigs) throws IOException { |
|
39 |
System.out.println(); |
|
40 |
System.out.println(" Writing .vcproj file..."); |
|
41 |
// If we got this far without an error, we're safe to actually |
|
42 |
// write the .vcproj file |
|
43 |
printWriter = new PrintWriter(new FileWriter(projectFileName)); |
|
44 |
||
45 |
printWriter.println("<?xml version=\"1.0\" encoding=\"windows-1251\"?>"); |
|
46 |
startTag( |
|
47 |
"VisualStudioProject", |
|
48 |
new String[] { |
|
49 |
"ProjectType", "Visual C++", |
|
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
50 |
"Version", projectVersion(), |
1 | 51 |
"Name", projectName, |
52 |
"ProjectGUID", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}", |
|
53 |
"SccProjectName", "", |
|
54 |
"SccLocalPath", "" |
|
55 |
} |
|
56 |
); |
|
57 |
||
58 |
startTag("Platforms", null); |
|
59 |
tag("Platform", new String[] {"Name", Util.os}); |
|
60 |
endTag("Platforms"); |
|
61 |
||
62 |
startTag("Configurations", null); |
|
63 |
||
64 |
for (Iterator i = allConfigs.iterator(); i.hasNext(); ) { |
|
65 |
writeConfiguration((BuildConfig)i.next()); |
|
66 |
} |
|
67 |
||
68 |
endTag("Configurations"); |
|
69 |
||
70 |
tag("References", null); |
|
71 |
||
72 |
writeFiles(allConfigs); |
|
73 |
||
74 |
tag("Globals", null); |
|
75 |
||
76 |
endTag("VisualStudioProject"); |
|
77 |
printWriter.close(); |
|
78 |
||
79 |
System.out.println(" Done."); |
|
80 |
} |
|
81 |
||
82 |
||
83 |
abstract class NameFilter { |
|
84 |
protected String fname; |
|
85 |
||
86 |
abstract boolean match(FileInfo fi); |
|
87 |
||
88 |
String filterString() { return ""; } |
|
89 |
String name() { return this.fname;} |
|
90 |
} |
|
91 |
||
92 |
class DirectoryFilter extends NameFilter { |
|
93 |
String dir; |
|
94 |
int baseLen, dirLen; |
|
95 |
||
96 |
DirectoryFilter(String dir, String sbase) { |
|
97 |
this.dir = dir; |
|
98 |
this.baseLen = sbase.length(); |
|
99 |
this.dirLen = dir.length(); |
|
100 |
this.fname = dir; |
|
101 |
} |
|
102 |
||
103 |
DirectoryFilter(String fname, String dir, String sbase) { |
|
104 |
this.dir = dir; |
|
105 |
this.baseLen = sbase.length(); |
|
106 |
this.dirLen = dir.length(); |
|
107 |
this.fname = fname; |
|
108 |
} |
|
109 |
||
110 |
||
111 |
boolean match(FileInfo fi) { |
|
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
112 |
int lastSlashIndex = fi.full.lastIndexOf('/'); |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
113 |
String fullDir = fi.full.substring(0, lastSlashIndex); |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
114 |
return fullDir.endsWith(dir); |
1 | 115 |
} |
116 |
} |
|
117 |
||
118 |
class TypeFilter extends NameFilter { |
|
119 |
String[] exts; |
|
120 |
||
121 |
TypeFilter(String fname, String[] exts) { |
|
122 |
this.fname = fname; |
|
123 |
this.exts = exts; |
|
124 |
} |
|
125 |
||
126 |
boolean match(FileInfo fi) { |
|
127 |
for (int i=0; i<exts.length; i++) { |
|
128 |
if (fi.full.endsWith(exts[i])) { |
|
129 |
return true; |
|
130 |
} |
|
131 |
} |
|
132 |
return false; |
|
133 |
} |
|
134 |
||
135 |
String filterString() { |
|
136 |
return Util.join(";", exts); |
|
137 |
} |
|
138 |
} |
|
139 |
||
140 |
class TerminatorFilter extends NameFilter { |
|
141 |
TerminatorFilter(String fname) { |
|
142 |
this.fname = fname; |
|
143 |
||
144 |
} |
|
145 |
boolean match(FileInfo fi) { |
|
146 |
return true; |
|
147 |
} |
|
148 |
||
149 |
} |
|
150 |
||
151 |
class SpecificNameFilter extends NameFilter { |
|
152 |
String pats[]; |
|
153 |
||
154 |
SpecificNameFilter(String fname, String[] pats) { |
|
155 |
this.fname = fname; |
|
156 |
this.pats = pats; |
|
157 |
} |
|
158 |
||
159 |
boolean match(FileInfo fi) { |
|
160 |
for (int i=0; i<pats.length; i++) { |
|
161 |
if (fi.attr.shortName.matches(pats[i])) { |
|
162 |
return true; |
|
163 |
} |
|
164 |
} |
|
165 |
return false; |
|
166 |
} |
|
167 |
||
168 |
} |
|
169 |
||
7397 | 170 |
class SpecificPathFilter extends NameFilter { |
171 |
String pats[]; |
|
172 |
||
173 |
SpecificPathFilter(String fname, String[] pats) { |
|
174 |
this.fname = fname; |
|
175 |
this.pats = pats; |
|
176 |
} |
|
177 |
||
178 |
boolean match(FileInfo fi) { |
|
179 |
for (int i=0; i<pats.length; i++) { |
|
180 |
if (fi.full.matches(pats[i])) { |
|
181 |
return true; |
|
182 |
} |
|
183 |
} |
|
184 |
return false; |
|
185 |
} |
|
186 |
||
187 |
} |
|
188 |
||
1 | 189 |
class ContainerFilter extends NameFilter { |
190 |
Vector children; |
|
191 |
||
192 |
ContainerFilter(String fname) { |
|
193 |
this.fname = fname; |
|
194 |
children = new Vector(); |
|
195 |
||
196 |
} |
|
197 |
boolean match(FileInfo fi) { |
|
198 |
return false; |
|
199 |
} |
|
200 |
||
201 |
Iterator babies() { return children.iterator(); } |
|
202 |
||
203 |
void add(NameFilter f) { |
|
204 |
children.add(f); |
|
205 |
} |
|
206 |
} |
|
207 |
||
208 |
||
209 |
void writeCustomToolConfig(Vector configs, String[] customToolAttrs) { |
|
210 |
for (Iterator i = configs.iterator(); i.hasNext(); ) { |
|
211 |
startTag("FileConfiguration", |
|
212 |
new String[] { |
|
213 |
"Name", (String)i.next() |
|
214 |
} |
|
215 |
); |
|
216 |
tag("Tool", customToolAttrs); |
|
217 |
||
218 |
endTag("FileConfiguration"); |
|
219 |
} |
|
220 |
} |
|
221 |
||
222 |
// here we define filters, which define layout of what can be seen in 'Solution View' of MSVC |
|
223 |
// Basically there are two types of entities - container filters and real filters |
|
224 |
// - container filter just provides a container to group together real filters |
|
225 |
// - real filter can select elements from the set according to some rule, put it into XML |
|
226 |
// and remove from the list |
|
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
227 |
Vector makeFilters(TreeSet<FileInfo> files) { |
1 | 228 |
Vector rv = new Vector(); |
229 |
String sbase = Util.normalize(BuildConfig.getFieldString(null, "SourceBase")+"/src/"); |
|
230 |
||
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
231 |
String currentDir = ""; |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
232 |
DirectoryFilter container = null; |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
233 |
for(FileInfo fileInfo : files) { |
1 | 234 |
|
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
235 |
if (!fileInfo.full.startsWith(sbase)) { |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
236 |
continue; |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
237 |
} |
1 | 238 |
|
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
239 |
int lastSlash = fileInfo.full.lastIndexOf('/'); |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
240 |
String dir = fileInfo.full.substring(sbase.length(), lastSlash); |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
241 |
if(dir.equals("share/vm")) { |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
242 |
// skip files directly in share/vm - should only be precompiled.hpp which is handled below |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
243 |
continue; |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
244 |
} |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
245 |
if (!dir.equals(currentDir)) { |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
246 |
currentDir = dir; |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
247 |
if (container != null) { |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
248 |
rv.add(container); |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
249 |
} |
1 | 250 |
|
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
251 |
// remove "share/vm/" from names |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
252 |
String name = dir; |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
253 |
if (dir.startsWith("share/vm/")) { |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
254 |
name = dir.substring("share/vm/".length(), dir.length()); |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
255 |
} |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
256 |
container = new DirectoryFilter(name, dir, sbase); |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
257 |
} |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
258 |
} |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
259 |
if (container != null) { |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
260 |
rv.add(container); |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
261 |
} |
1 | 262 |
|
7397 | 263 |
ContainerFilter generated = new ContainerFilter("Generated"); |
264 |
ContainerFilter c1Generated = new ContainerFilter("C1"); |
|
265 |
c1Generated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*compiler1/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"})); |
|
266 |
c1Generated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*compiler1/generated/jvmtifiles/.*"})); |
|
267 |
generated.add(c1Generated); |
|
268 |
ContainerFilter c2Generated = new ContainerFilter("C2"); |
|
269 |
c2Generated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*compiler2/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"})); |
|
270 |
c2Generated.add(new SpecificPathFilter("adfiles", new String[] {".*compiler2/generated/adfiles/.*"})); |
|
271 |
c2Generated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*compiler2/generated/jvmtifiles/.*"})); |
|
272 |
generated.add(c2Generated); |
|
273 |
ContainerFilter coreGenerated = new ContainerFilter("Core"); |
|
274 |
coreGenerated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*core/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"})); |
|
275 |
coreGenerated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*core/generated/jvmtifiles/.*"})); |
|
276 |
generated.add(coreGenerated); |
|
277 |
ContainerFilter tieredGenerated = new ContainerFilter("Tiered"); |
|
278 |
tieredGenerated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*tiered/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"})); |
|
279 |
tieredGenerated.add(new SpecificPathFilter("adfiles", new String[] {".*tiered/generated/adfiles/.*"})); |
|
280 |
tieredGenerated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*tiered/generated/jvmtifiles/.*"})); |
|
281 |
generated.add(tieredGenerated); |
|
282 |
ContainerFilter kernelGenerated = new ContainerFilter("Kernel"); |
|
283 |
kernelGenerated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*kernel/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"})); |
|
284 |
kernelGenerated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*kernel/generated/jvmtifiles/.*"})); |
|
285 |
generated.add(kernelGenerated); |
|
286 |
rv.add(generated); |
|
1 | 287 |
|
7397 | 288 |
rv.add(new SpecificNameFilter("Precompiled Header", new String[] {"precompiled.hpp"})); |
1 | 289 |
|
290 |
// this one is to catch files not caught by other filters |
|
291 |
//rv.add(new TypeFilter("Header Files", new String[] {"h", "hpp", "hxx", "hm", "inl", "fi", "fd"})); |
|
292 |
rv.add(new TerminatorFilter("Source Files")); |
|
293 |
||
294 |
return rv; |
|
295 |
} |
|
296 |
||
297 |
void writeFiles(Vector allConfigs) { |
|
298 |
||
299 |
Hashtable allFiles = computeAttributedFiles(allConfigs); |
|
300 |
||
301 |
Vector allConfigNames = new Vector(); |
|
302 |
for (Iterator i = allConfigs.iterator(); i.hasNext(); ) { |
|
303 |
allConfigNames.add(((BuildConfig)i.next()).get("Name")); |
|
304 |
} |
|
305 |
||
306 |
TreeSet sortedFiles = sortFiles(allFiles); |
|
307 |
||
308 |
startTag("Files", null); |
|
309 |
||
310 |
for (Iterator i = makeFilters(sortedFiles).iterator(); i.hasNext(); ) { |
|
311 |
doWriteFiles(sortedFiles, allConfigNames, (NameFilter)i.next()); |
|
312 |
} |
|
313 |
||
314 |
||
315 |
startTag("Filter", |
|
316 |
new String[] { |
|
317 |
"Name", "Resource Files", |
|
318 |
"Filter", "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" |
|
319 |
} |
|
320 |
); |
|
321 |
endTag("Filter"); |
|
322 |
||
323 |
endTag("Files"); |
|
324 |
} |
|
325 |
||
326 |
void doWriteFiles(TreeSet allFiles, Vector allConfigNames, NameFilter filter) { |
|
327 |
startTag("Filter", |
|
328 |
new String[] { |
|
329 |
"Name", filter.name(), |
|
330 |
"Filter", filter.filterString() |
|
331 |
} |
|
332 |
); |
|
333 |
||
334 |
if (filter instanceof ContainerFilter) { |
|
335 |
||
336 |
Iterator i = ((ContainerFilter)filter).babies(); |
|
337 |
while (i.hasNext()) { |
|
338 |
doWriteFiles(allFiles, allConfigNames, (NameFilter)i.next()); |
|
339 |
} |
|
340 |
||
341 |
} else { |
|
342 |
||
343 |
Iterator i = allFiles.iterator(); |
|
344 |
while (i.hasNext()) { |
|
345 |
FileInfo fi = (FileInfo)i.next(); |
|
346 |
||
347 |
if (!filter.match(fi)) { |
|
348 |
continue; |
|
349 |
} |
|
350 |
||
351 |
startTag("File", |
|
352 |
new String[] { |
|
353 |
"RelativePath", fi.full.replace('/', '\\') |
|
354 |
} |
|
355 |
); |
|
356 |
||
357 |
FileAttribute a = fi.attr; |
|
358 |
if (a.pchRoot) { |
|
359 |
writeCustomToolConfig(allConfigNames, |
|
360 |
new String[] { |
|
361 |
"Name", "VCCLCompilerTool", |
|
362 |
"UsePrecompiledHeader", "1" |
|
363 |
}); |
|
364 |
} |
|
365 |
||
366 |
if (a.noPch) { |
|
367 |
writeCustomToolConfig(allConfigNames, |
|
368 |
new String[] { |
|
369 |
"Name", "VCCLCompilerTool", |
|
370 |
"UsePrecompiledHeader", "0" |
|
371 |
}); |
|
372 |
} |
|
373 |
||
374 |
if (a.configs != null) { |
|
375 |
for (Iterator j=allConfigNames.iterator(); j.hasNext();) { |
|
376 |
String cfg = (String)j.next(); |
|
377 |
if (!a.configs.contains(cfg)) { |
|
378 |
startTag("FileConfiguration", |
|
379 |
new String[] { |
|
380 |
"Name", cfg, |
|
381 |
"ExcludedFromBuild", "TRUE" |
|
382 |
}); |
|
383 |
endTag("FileConfiguration"); |
|
384 |
||
385 |
} |
|
386 |
} |
|
387 |
} |
|
388 |
||
389 |
endTag("File"); |
|
390 |
||
391 |
// we not gonna look at this file anymore |
|
392 |
i.remove(); |
|
393 |
} |
|
394 |
} |
|
395 |
||
396 |
endTag("Filter"); |
|
397 |
} |
|
398 |
||
399 |
||
400 |
void writeConfiguration(BuildConfig cfg) { |
|
401 |
startTag("Configuration", |
|
402 |
new String[] { |
|
403 |
"Name", cfg.get("Name"), |
|
404 |
"OutputDirectory", cfg.get("OutputDir"), |
|
405 |
"IntermediateDirectory", cfg.get("OutputDir"), |
|
406 |
"ConfigurationType", "2", |
|
407 |
"UseOfMFC", "0", |
|
408 |
"ATLMinimizesCRunTimeLibraryUsage", "FALSE" |
|
409 |
} |
|
410 |
); |
|
411 |
||
412 |
||
413 |
||
414 |
tagV("Tool", cfg.getV("CompilerFlags")); |
|
415 |
||
416 |
tag("Tool", |
|
417 |
new String[] { |
|
418 |
"Name", "VCCustomBuildTool" |
|
419 |
} |
|
420 |
); |
|
421 |
||
422 |
tagV("Tool", cfg.getV("LinkerFlags")); |
|
423 |
||
424 |
tag("Tool", |
|
425 |
new String[] { |
|
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
426 |
"Name", "VCPostBuildEventTool", |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
427 |
"Description", BuildConfig.getFieldString(null, "PostbuildDescription"), |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
428 |
//Caution: String.replace(String,String) is available from JDK5 onwards only |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
429 |
"CommandLine", cfg.expandFormat(BuildConfig.getFieldString(null, "PostbuildCommand").replace |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
430 |
("\t", "
")) |
1 | 431 |
} |
432 |
); |
|
433 |
||
434 |
tag("Tool", |
|
435 |
new String[] { |
|
436 |
"Name", "VCPreBuildEventTool" |
|
437 |
} |
|
438 |
); |
|
439 |
||
440 |
tag("Tool", |
|
441 |
new String[] { |
|
442 |
"Name", "VCPreLinkEventTool", |
|
443 |
"Description", BuildConfig.getFieldString(null, "PrelinkDescription"), |
|
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
444 |
//Caution: String.replace(String,String) is available from JDK5 onwards only |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
445 |
"CommandLine", cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand").replace |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
446 |
("\t", "
")) |
1 | 447 |
} |
448 |
); |
|
449 |
||
450 |
tag("Tool", |
|
451 |
new String[] { |
|
452 |
"Name", "VCResourceCompilerTool", |
|
453 |
// XXX??? |
|
454 |
"PreprocessorDefinitions", "NDEBUG", |
|
455 |
"Culture", "1033" |
|
456 |
} |
|
457 |
); |
|
458 |
||
459 |
tag("Tool", |
|
460 |
new String[] { |
|
461 |
"Name", "VCMIDLTool", |
|
462 |
"PreprocessorDefinitions", "NDEBUG", |
|
463 |
"MkTypLibCompatible", "TRUE", |
|
464 |
"SuppressStartupBanner", "TRUE", |
|
465 |
"TargetEnvironment", "1", |
|
466 |
"TypeLibraryName", cfg.get("OutputDir") + Util.sep + "vm.tlb", |
|
467 |
"HeaderFileName", "" |
|
468 |
} |
|
469 |
); |
|
470 |
||
471 |
endTag("Configuration"); |
|
472 |
} |
|
473 |
||
474 |
int indent; |
|
475 |
||
476 |
private void startTagPrim(String name, |
|
477 |
String[] attrs, |
|
478 |
boolean close) { |
|
479 |
doIndent(); |
|
480 |
printWriter.print("<"+name); |
|
481 |
indent++; |
|
482 |
||
483 |
if (attrs != null) { |
|
484 |
printWriter.println(); |
|
485 |
for (int i=0; i<attrs.length; i+=2) { |
|
486 |
doIndent(); |
|
7397 | 487 |
printWriter.print(" " + attrs[i]+"=\""+attrs[i+1]+"\""); |
488 |
if (i < attrs.length - 2) { |
|
489 |
printWriter.println(); |
|
490 |
} |
|
1 | 491 |
} |
492 |
} |
|
493 |
||
494 |
if (close) { |
|
495 |
indent--; |
|
496 |
//doIndent(); |
|
497 |
printWriter.println("/>"); |
|
498 |
} else { |
|
499 |
//doIndent(); |
|
500 |
printWriter.println(">"); |
|
501 |
} |
|
502 |
} |
|
503 |
||
504 |
void startTag(String name, String[] attrs) { |
|
505 |
startTagPrim(name, attrs, false); |
|
506 |
} |
|
507 |
||
508 |
void startTagV(String name, Vector attrs) { |
|
509 |
String s[] = new String [attrs.size()]; |
|
510 |
for (int i=0; i<attrs.size(); i++) { |
|
511 |
s[i] = (String)attrs.elementAt(i); |
|
512 |
} |
|
513 |
startTagPrim(name, s, false); |
|
514 |
} |
|
515 |
||
516 |
void endTag(String name) { |
|
517 |
indent--; |
|
518 |
doIndent(); |
|
519 |
printWriter.println("</"+name+">"); |
|
520 |
} |
|
521 |
||
522 |
void tag(String name, String[] attrs) { |
|
523 |
startTagPrim(name, attrs, true); |
|
524 |
} |
|
525 |
||
526 |
void tagV(String name, Vector attrs) { |
|
527 |
String s[] = new String [attrs.size()]; |
|
528 |
for (int i=0; i<attrs.size(); i++) { |
|
529 |
s[i] = (String)attrs.elementAt(i); |
|
530 |
} |
|
531 |
startTagPrim(name, s, true); |
|
532 |
} |
|
533 |
||
534 |
||
535 |
void doIndent() { |
|
536 |
for (int i=0; i<indent; i++) { |
|
537 |
printWriter.print(" "); |
|
538 |
} |
|
539 |
} |
|
540 |
||
541 |
protected String getProjectExt() { |
|
542 |
return ".vcproj"; |
|
543 |
} |
|
544 |
} |
|
545 |
||
546 |
class CompilerInterfaceVC7 extends CompilerInterface { |
|
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
547 |
void getBaseCompilerFlags_common(Vector defines, Vector includes, String outDir,Vector rv) { |
1 | 548 |
|
549 |
// advanced M$ IDE (2003) can only recognize name if it's first or |
|
550 |
// second attribute in the tag - go guess |
|
551 |
addAttr(rv, "Name", "VCCLCompilerTool"); |
|
552 |
addAttr(rv, "AdditionalIncludeDirectories", Util.join(",", includes)); |
|
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
553 |
addAttr(rv, "PreprocessorDefinitions", |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
554 |
Util.join(";", defines).replace("\"",""")); |
7397 | 555 |
addAttr(rv, "PrecompiledHeaderThrough", "precompiled.hpp"); |
1 | 556 |
addAttr(rv, "PrecompiledHeaderFile", outDir+Util.sep+"vm.pch"); |
557 |
addAttr(rv, "AssemblerListingLocation", outDir); |
|
558 |
addAttr(rv, "ObjectFile", outDir+Util.sep); |
|
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
559 |
addAttr(rv, "ProgramDataBaseFileName", outDir+Util.sep+"jvm.pdb"); |
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
560 |
// Set /nologo optin |
1 | 561 |
addAttr(rv, "SuppressStartupBanner", "TRUE"); |
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
562 |
// Surpass the default /Tc or /Tp. 0 is compileAsDefault |
1 | 563 |
addAttr(rv, "CompileAs", "0"); |
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
564 |
// Set /W3 option. 3 is warningLevel_3 |
1 | 565 |
addAttr(rv, "WarningLevel", "3"); |
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
566 |
// Set /WX option, |
1 | 567 |
addAttr(rv, "WarnAsError", "TRUE"); |
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
568 |
// Set /GS option |
1 | 569 |
addAttr(rv, "BufferSecurityCheck", "FALSE"); |
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
570 |
// Set /Zi option. 3 is debugEnabled |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
571 |
addAttr(rv, "DebugInformationFormat", "3"); |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
572 |
} |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
573 |
Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) { |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
574 |
Vector rv = new Vector(); |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
575 |
|
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
576 |
getBaseCompilerFlags_common(defines,includes, outDir, rv); |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
577 |
// Set /Yu option. 3 is pchUseUsingSpecific |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
578 |
// Note: Starting VC8 pchUseUsingSpecific is 2 !!! |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
579 |
addAttr(rv, "UsePrecompiledHeader", "3"); |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
580 |
// Set /EHsc- option |
1 | 581 |
addAttr(rv, "ExceptionHandling", "FALSE"); |
582 |
||
583 |
return rv; |
|
584 |
} |
|
585 |
||
586 |
Vector getBaseLinkerFlags(String outDir, String outDll) { |
|
587 |
Vector rv = new Vector(); |
|
588 |
||
589 |
addAttr(rv, "Name", "VCLinkerTool"); |
|
590 |
addAttr(rv, "AdditionalOptions", |
|
591 |
"/export:JNI_GetDefaultJavaVMInitArgs " + |
|
592 |
"/export:JNI_CreateJavaVM " + |
|
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
593 |
"/export:JVM_FindClassFromBootLoader "+ |
1 | 594 |
"/export:JNI_GetCreatedJavaVMs "+ |
595 |
"/export:jio_snprintf /export:jio_printf "+ |
|
596 |
"/export:jio_fprintf /export:jio_vfprintf "+ |
|
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
597 |
"/export:jio_vsnprintf "+ |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
598 |
"/export:JVM_GetVersionInfo "+ |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
599 |
"/export:JVM_GetThreadStateNames "+ |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
600 |
"/export:JVM_GetThreadStateValues "+ |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
601 |
"/export:JVM_InitAgentProperties "); |
1 | 602 |
addAttr(rv, "AdditionalDependencies", "Wsock32.lib winmm.lib"); |
603 |
addAttr(rv, "OutputFile", outDll); |
|
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
604 |
// Set /INCREMENTAL option. 1 is linkIncrementalNo |
1 | 605 |
addAttr(rv, "LinkIncremental", "1"); |
606 |
addAttr(rv, "SuppressStartupBanner", "TRUE"); |
|
607 |
addAttr(rv, "ModuleDefinitionFile", outDir+Util.sep+"vm.def"); |
|
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
608 |
addAttr(rv, "ProgramDatabaseFile", outDir+Util.sep+"jvm.pdb"); |
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
609 |
// Set /SUBSYSTEM option. 2 is subSystemWindows |
1 | 610 |
addAttr(rv, "SubSystem", "2"); |
611 |
addAttr(rv, "BaseAddress", "0x8000000"); |
|
612 |
addAttr(rv, "ImportLibrary", outDir+Util.sep+"jvm.lib"); |
|
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
613 |
// Set /MACHINE option. 1 is machineX86 |
1 | 614 |
addAttr(rv, "TargetMachine", "1"); |
615 |
||
616 |
return rv; |
|
617 |
} |
|
618 |
||
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
619 |
void getDebugCompilerFlags_common(String opt,Vector rv) { |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
620 |
|
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
621 |
// Set /On option |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
622 |
addAttr(rv, "Optimization", opt); |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
623 |
// Set /FR option. 1 is brAllInfo |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
624 |
addAttr(rv, "BrowseInformation", "1"); |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
625 |
addAttr(rv, "BrowseInformationFile", "$(IntDir)" + Util.sep); |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
626 |
// Set /MD option. 2 is rtMultiThreadedDLL |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
627 |
addAttr(rv, "RuntimeLibrary", "2"); |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
628 |
// Set /Oy- option |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
629 |
addAttr(rv, "OmitFramePointers", "FALSE"); |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
630 |
|
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
631 |
} |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
632 |
|
1 | 633 |
Vector getDebugCompilerFlags(String opt) { |
634 |
Vector rv = new Vector(); |
|
635 |
||
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
636 |
getDebugCompilerFlags_common(opt,rv); |
1 | 637 |
|
638 |
return rv; |
|
639 |
} |
|
640 |
||
641 |
Vector getDebugLinkerFlags() { |
|
642 |
Vector rv = new Vector(); |
|
643 |
||
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
644 |
addAttr(rv, "GenerateDebugInformation", "TRUE"); // == /DEBUG option |
1 | 645 |
|
646 |
return rv; |
|
647 |
} |
|
648 |
||
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
649 |
void getAdditionalNonKernelLinkerFlags(Vector rv) { |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
650 |
extAttr(rv, "AdditionalOptions", |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
651 |
"/export:AsyncGetCallTrace "); |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
652 |
} |
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
653 |
|
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
654 |
void getProductCompilerFlags_common(Vector rv) { |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
655 |
// Set /O2 option. 2 is optimizeMaxSpeed |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
656 |
addAttr(rv, "Optimization", "2"); |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
657 |
// Set /Oy- option |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
658 |
addAttr(rv, "OmitFramePointers", "FALSE"); |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
659 |
} |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
660 |
|
1 | 661 |
Vector getProductCompilerFlags() { |
662 |
Vector rv = new Vector(); |
|
663 |
||
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
664 |
getProductCompilerFlags_common(rv); |
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
665 |
// Set /Ob option. 1 is expandOnlyInline |
1 | 666 |
addAttr(rv, "InlineFunctionExpansion", "1"); |
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
667 |
// Set /GF option. |
1 | 668 |
addAttr(rv, "StringPooling", "TRUE"); |
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
669 |
// Set /MD option. 2 is rtMultiThreadedDLL |
1 | 670 |
addAttr(rv, "RuntimeLibrary", "2"); |
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
671 |
// Set /Gy option |
1 | 672 |
addAttr(rv, "EnableFunctionLevelLinking", "TRUE"); |
673 |
||
674 |
return rv; |
|
675 |
} |
|
676 |
||
677 |
Vector getProductLinkerFlags() { |
|
678 |
Vector rv = new Vector(); |
|
679 |
||
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
680 |
// Set /OPT:REF option. 2 is optReferences |
1 | 681 |
addAttr(rv, "OptimizeReferences", "2"); |
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
682 |
// Set /OPT:optFolding option. 2 is optFolding |
1 | 683 |
addAttr(rv, "EnableCOMDATFolding", "2"); |
684 |
||
685 |
return rv; |
|
686 |
} |
|
687 |
||
688 |
String getOptFlag() { |
|
689 |
return "2"; |
|
690 |
} |
|
691 |
||
692 |
String getNoOptFlag() { |
|
693 |
return "0"; |
|
694 |
} |
|
695 |
||
696 |
String makeCfgName(String flavourBuild) { |
|
697 |
return flavourBuild + "|" + Util.os; |
|
698 |
} |
|
699 |
} |