Mercurial > hg > graal-compiler
comparison src/share/tools/ProjectCreator/WinGammaPlatformVC7.java @ 2233:15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
Summary: Updated create.bat and ProjectCreator
Reviewed-by: brutisso, stefank, ohair
author | sla |
---|---|
date | Thu, 10 Feb 2011 13:03:22 +0100 |
parents | aa6e219afbf1 |
children | 2ab52cda08e5 74e790c48cd4 |
comparison
equal
deleted
inserted
replaced
2205:b83527d0482d | 2233:15d6977f04b0 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
35 String projectVersion() {return "7.10";}; | 35 String projectVersion() {return "7.10";}; |
36 | 36 |
37 public void writeProjectFile(String projectFileName, String projectName, | 37 public void writeProjectFile(String projectFileName, String projectName, |
38 Vector allConfigs) throws IOException { | 38 Vector allConfigs) throws IOException { |
39 System.out.println(); | 39 System.out.println(); |
40 System.out.println(" Writing .vcproj file..."); | 40 System.out.println(" Writing .vcproj file: "+projectFileName); |
41 // If we got this far without an error, we're safe to actually | 41 // If we got this far without an error, we're safe to actually |
42 // write the .vcproj file | 42 // write the .vcproj file |
43 printWriter = new PrintWriter(new FileWriter(projectFileName)); | 43 printWriter = new PrintWriter(new FileWriter(projectFileName)); |
44 | 44 |
45 printWriter.println("<?xml version=\"1.0\" encoding=\"windows-1251\"?>"); | 45 printWriter.println("<?xml version=\"1.0\" encoding=\"windows-1251\"?>"); |
52 "ProjectGUID", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}", | 52 "ProjectGUID", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}", |
53 "SccProjectName", "", | 53 "SccProjectName", "", |
54 "SccLocalPath", "" | 54 "SccLocalPath", "" |
55 } | 55 } |
56 ); | 56 ); |
57 | |
58 startTag("Platforms", null); | 57 startTag("Platforms", null); |
59 tag("Platform", new String[] {"Name", Util.os}); | 58 tag("Platform", new String[] {"Name", (String) BuildConfig.getField(null, "PlatformName")}); |
60 endTag("Platforms"); | 59 endTag("Platforms"); |
61 | 60 |
62 startTag("Configurations", null); | 61 startTag("Configurations", null); |
63 | 62 |
64 for (Iterator i = allConfigs.iterator(); i.hasNext(); ) { | 63 for (Iterator i = allConfigs.iterator(); i.hasNext(); ) { |
79 System.out.println(" Done."); | 78 System.out.println(" Done."); |
80 } | 79 } |
81 | 80 |
82 | 81 |
83 abstract class NameFilter { | 82 abstract class NameFilter { |
84 protected String fname; | 83 protected String fname; |
85 | 84 |
86 abstract boolean match(FileInfo fi); | 85 abstract boolean match(FileInfo fi); |
87 | 86 |
88 String filterString() { return ""; } | 87 String filterString() { return ""; } |
89 String name() { return this.fname;} | 88 String name() { return this.fname;} |
89 | |
90 @Override | |
91 // eclipse auto-generated | |
92 public int hashCode() { | |
93 final int prime = 31; | |
94 int result = 1; | |
95 result = prime * result + getOuterType().hashCode(); | |
96 result = prime * result + ((fname == null) ? 0 : fname.hashCode()); | |
97 return result; | |
98 } | |
99 | |
100 @Override | |
101 // eclipse auto-generated | |
102 public boolean equals(Object obj) { | |
103 if (this == obj) | |
104 return true; | |
105 if (obj == null) | |
106 return false; | |
107 if (getClass() != obj.getClass()) | |
108 return false; | |
109 NameFilter other = (NameFilter) obj; | |
110 if (!getOuterType().equals(other.getOuterType())) | |
111 return false; | |
112 if (fname == null) { | |
113 if (other.fname != null) | |
114 return false; | |
115 } else if (!fname.equals(other.fname)) | |
116 return false; | |
117 return true; | |
118 } | |
119 | |
120 // eclipse auto-generated | |
121 private WinGammaPlatformVC7 getOuterType() { | |
122 return WinGammaPlatformVC7.this; | |
123 } | |
90 } | 124 } |
91 | 125 |
92 class DirectoryFilter extends NameFilter { | 126 class DirectoryFilter extends NameFilter { |
93 String dir; | 127 String dir; |
94 int baseLen, dirLen; | 128 int baseLen, dirLen; |
107 this.fname = fname; | 141 this.fname = fname; |
108 } | 142 } |
109 | 143 |
110 | 144 |
111 boolean match(FileInfo fi) { | 145 boolean match(FileInfo fi) { |
112 int lastSlashIndex = fi.full.lastIndexOf('/'); | 146 int lastSlashIndex = fi.full.lastIndexOf('/'); |
113 String fullDir = fi.full.substring(0, lastSlashIndex); | 147 String fullDir = fi.full.substring(0, lastSlashIndex); |
114 return fullDir.endsWith(dir); | 148 return fullDir.endsWith(dir); |
149 } | |
150 | |
151 @Override | |
152 // eclipse auto-generated | |
153 public int hashCode() { | |
154 final int prime = 31; | |
155 int result = super.hashCode(); | |
156 result = prime * result + getOuterType().hashCode(); | |
157 result = prime * result + baseLen; | |
158 result = prime * result + ((dir == null) ? 0 : dir.hashCode()); | |
159 result = prime * result + dirLen; | |
160 return result; | |
161 } | |
162 | |
163 @Override | |
164 // eclipse auto-generated | |
165 public boolean equals(Object obj) { | |
166 if (this == obj) | |
167 return true; | |
168 if (!super.equals(obj)) | |
169 return false; | |
170 if (getClass() != obj.getClass()) | |
171 return false; | |
172 DirectoryFilter other = (DirectoryFilter) obj; | |
173 if (!getOuterType().equals(other.getOuterType())) | |
174 return false; | |
175 if (baseLen != other.baseLen) | |
176 return false; | |
177 if (dir == null) { | |
178 if (other.dir != null) | |
179 return false; | |
180 } else if (!dir.equals(other.dir)) | |
181 return false; | |
182 if (dirLen != other.dirLen) | |
183 return false; | |
184 return true; | |
185 } | |
186 | |
187 // eclipse auto-generated | |
188 private WinGammaPlatformVC7 getOuterType() { | |
189 return WinGammaPlatformVC7.this; | |
115 } | 190 } |
116 } | 191 } |
117 | 192 |
118 class TypeFilter extends NameFilter { | 193 class TypeFilter extends NameFilter { |
119 String[] exts; | 194 String[] exts; |
230 | 305 |
231 String currentDir = ""; | 306 String currentDir = ""; |
232 DirectoryFilter container = null; | 307 DirectoryFilter container = null; |
233 for(FileInfo fileInfo : files) { | 308 for(FileInfo fileInfo : files) { |
234 | 309 |
235 if (!fileInfo.full.startsWith(sbase)) { | 310 if (!fileInfo.full.startsWith(sbase)) { |
236 continue; | 311 continue; |
237 } | 312 } |
238 | 313 |
239 int lastSlash = fileInfo.full.lastIndexOf('/'); | 314 int lastSlash = fileInfo.full.lastIndexOf('/'); |
240 String dir = fileInfo.full.substring(sbase.length(), lastSlash); | 315 String dir = fileInfo.full.substring(sbase.length(), lastSlash); |
241 if(dir.equals("share/vm")) { | 316 if(dir.equals("share/vm")) { |
242 // skip files directly in share/vm - should only be precompiled.hpp which is handled below | 317 // skip files directly in share/vm - should only be precompiled.hpp which is handled below |
243 continue; | 318 continue; |
244 } | 319 } |
245 if (!dir.equals(currentDir)) { | 320 if (!dir.equals(currentDir)) { |
246 currentDir = dir; | 321 currentDir = dir; |
247 if (container != null) { | 322 if (container != null && !rv.contains(container)) { |
248 rv.add(container); | 323 rv.add(container); |
249 } | 324 } |
250 | 325 |
251 // remove "share/vm/" from names | 326 // remove "share/vm/" from names |
252 String name = dir; | 327 String name = dir; |
253 if (dir.startsWith("share/vm/")) { | 328 if (dir.startsWith("share/vm/")) { |
254 name = dir.substring("share/vm/".length(), dir.length()); | 329 name = dir.substring("share/vm/".length(), dir.length()); |
255 } | 330 } |
256 container = new DirectoryFilter(name, dir, sbase); | 331 DirectoryFilter newfilter = new DirectoryFilter(name, dir, sbase); |
257 } | 332 int i = rv.indexOf(newfilter); |
258 } | 333 if(i == -1) { |
259 if (container != null) { | 334 container = newfilter; |
260 rv.add(container); | 335 } else { |
336 // if the filter already exists, reuse it | |
337 container = (DirectoryFilter) rv.get(i); | |
338 } | |
339 } | |
340 } | |
341 if (container != null && !rv.contains(container)) { | |
342 rv.add(container); | |
261 } | 343 } |
262 | 344 |
263 ContainerFilter generated = new ContainerFilter("Generated"); | 345 ContainerFilter generated = new ContainerFilter("Generated"); |
264 ContainerFilter c1Generated = new ContainerFilter("C1"); | 346 ContainerFilter c1Generated = new ContainerFilter("C1"); |
265 c1Generated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*compiler1/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"})); | 347 c1Generated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*compiler1/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"})); |
581 addAttr(rv, "ExceptionHandling", "FALSE"); | 663 addAttr(rv, "ExceptionHandling", "FALSE"); |
582 | 664 |
583 return rv; | 665 return rv; |
584 } | 666 } |
585 | 667 |
586 Vector getBaseLinkerFlags(String outDir, String outDll) { | 668 Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) { |
587 Vector rv = new Vector(); | 669 Vector rv = new Vector(); |
588 | 670 |
589 addAttr(rv, "Name", "VCLinkerTool"); | 671 addAttr(rv, "Name", "VCLinkerTool"); |
590 addAttr(rv, "AdditionalOptions", | 672 addAttr(rv, "AdditionalOptions", |
591 "/export:JNI_GetDefaultJavaVMInitArgs " + | 673 "/export:JNI_GetDefaultJavaVMInitArgs " + |
608 addAttr(rv, "ProgramDatabaseFile", outDir+Util.sep+"jvm.pdb"); | 690 addAttr(rv, "ProgramDatabaseFile", outDir+Util.sep+"jvm.pdb"); |
609 // Set /SUBSYSTEM option. 2 is subSystemWindows | 691 // Set /SUBSYSTEM option. 2 is subSystemWindows |
610 addAttr(rv, "SubSystem", "2"); | 692 addAttr(rv, "SubSystem", "2"); |
611 addAttr(rv, "BaseAddress", "0x8000000"); | 693 addAttr(rv, "BaseAddress", "0x8000000"); |
612 addAttr(rv, "ImportLibrary", outDir+Util.sep+"jvm.lib"); | 694 addAttr(rv, "ImportLibrary", outDir+Util.sep+"jvm.lib"); |
613 // Set /MACHINE option. 1 is machineX86 | 695 if(platformName.equals("Win32")) { |
614 addAttr(rv, "TargetMachine", "1"); | 696 // Set /MACHINE option. 1 is X86 |
697 addAttr(rv, "TargetMachine", "1"); | |
698 } else { | |
699 // Set /MACHINE option. 17 is X64 | |
700 addAttr(rv, "TargetMachine", "17"); | |
701 } | |
615 | 702 |
616 return rv; | 703 return rv; |
617 } | 704 } |
618 | 705 |
619 void getDebugCompilerFlags_common(String opt,Vector rv) { | 706 void getDebugCompilerFlags_common(String opt,Vector rv) { |
654 void getProductCompilerFlags_common(Vector rv) { | 741 void getProductCompilerFlags_common(Vector rv) { |
655 // Set /O2 option. 2 is optimizeMaxSpeed | 742 // Set /O2 option. 2 is optimizeMaxSpeed |
656 addAttr(rv, "Optimization", "2"); | 743 addAttr(rv, "Optimization", "2"); |
657 // Set /Oy- option | 744 // Set /Oy- option |
658 addAttr(rv, "OmitFramePointers", "FALSE"); | 745 addAttr(rv, "OmitFramePointers", "FALSE"); |
659 } | |
660 | |
661 Vector getProductCompilerFlags() { | |
662 Vector rv = new Vector(); | |
663 | |
664 getProductCompilerFlags_common(rv); | |
665 // Set /Ob option. 1 is expandOnlyInline | 746 // Set /Ob option. 1 is expandOnlyInline |
666 addAttr(rv, "InlineFunctionExpansion", "1"); | 747 addAttr(rv, "InlineFunctionExpansion", "1"); |
667 // Set /GF option. | 748 // Set /GF option. |
668 addAttr(rv, "StringPooling", "TRUE"); | 749 addAttr(rv, "StringPooling", "TRUE"); |
669 // Set /MD option. 2 is rtMultiThreadedDLL | 750 // Set /MD option. 2 is rtMultiThreadedDLL |
670 addAttr(rv, "RuntimeLibrary", "2"); | 751 addAttr(rv, "RuntimeLibrary", "2"); |
671 // Set /Gy option | 752 // Set /Gy option |
672 addAttr(rv, "EnableFunctionLevelLinking", "TRUE"); | 753 addAttr(rv, "EnableFunctionLevelLinking", "TRUE"); |
754 } | |
755 | |
756 Vector getProductCompilerFlags() { | |
757 Vector rv = new Vector(); | |
758 | |
759 getProductCompilerFlags_common(rv); | |
673 | 760 |
674 return rv; | 761 return rv; |
675 } | 762 } |
676 | 763 |
677 Vector getProductLinkerFlags() { | 764 Vector getProductLinkerFlags() { |
691 | 778 |
692 String getNoOptFlag() { | 779 String getNoOptFlag() { |
693 return "0"; | 780 return "0"; |
694 } | 781 } |
695 | 782 |
696 String makeCfgName(String flavourBuild) { | 783 String makeCfgName(String flavourBuild, String platform) { |
697 return flavourBuild + "|" + Util.os; | 784 return flavourBuild + "|" + platform; |
698 } | 785 } |
699 } | 786 } |