Mercurial > hg > truffle
annotate src/share/tools/ProjectCreator/WinGammaPlatformVC6.java @ 3366:e2a92dd0d3d2
7042122: JSR 292: adjust various inline thresholds for JSR 292 API methods and method handle adapters
Reviewed-by: jrose, never, kvn
author | twisti |
---|---|
date | Tue, 10 May 2011 00:45:03 -0700 |
parents | 15d6977f04b0 |
children | 2ab52cda08e5 |
rev | line source |
---|---|
0 | 1 /* |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 import java.io.*; | |
26 import java.util.*; | |
27 | |
28 public class WinGammaPlatformVC6 extends WinGammaPlatform { | |
29 public void writeProjectFile(String projectFileName, String projectName, | |
30 Vector allConfigs) throws IOException { | |
31 Vector allConfigNames = new Vector(); | |
32 | |
33 printWriter = new PrintWriter(new FileWriter(projectFileName)); | |
34 String cfg = ((BuildConfig)allConfigs.get(0)).get("Name"); | |
35 | |
36 printWriter.println("# Microsoft Developer Studio Project File - Name=\"" + projectName + "\" - Package Owner=<4>"); | |
37 printWriter.println("# Microsoft Developer Studio Generated Build File, Format Version 6.00"); | |
38 printWriter.println("# ** DO NOT EDIT **"); | |
39 printWriter.println(""); | |
40 printWriter.println("# TARGTYPE \"Win32 (x86) Dynamic-Link Library\" 0x0102"); | |
41 printWriter.println("CFG=" + cfg); | |
42 printWriter.println(""); | |
43 | |
44 printWriter.println("!MESSAGE This is not a valid makefile. To build this project using NMAKE,"); | |
45 printWriter.println("!MESSAGE use the Export Makefile command and run"); | |
46 printWriter.println("!MESSAGE "); | |
47 printWriter.println("!MESSAGE NMAKE /f \"" + projectName + ".mak\"."); | |
48 printWriter.println("!MESSAGE "); | |
49 printWriter.println("!MESSAGE You can specify a configuration when running NMAKE"); | |
50 printWriter.println("!MESSAGE by defining the macro CFG on the command line. For example:"); | |
51 printWriter.println("!MESSAGE "); | |
52 printWriter.println("!MESSAGE NMAKE /f \"" + projectName + ".mak\" CFG=\"" + cfg + "\""); | |
53 printWriter.println("!MESSAGE "); | |
54 printWriter.println("!MESSAGE Possible choices for configuration are:"); | |
55 printWriter.println("!MESSAGE "); | |
56 for (Iterator i = allConfigs.iterator(); i.hasNext(); ) { | |
57 String name = ((BuildConfig)i.next()).get("Name"); | |
58 printWriter.println("!MESSAGE \""+ name + "\" (based on \"Win32 (x86) Dynamic-Link Library\")"); | |
59 allConfigNames.add(name); | |
60 } | |
61 printWriter.println("!MESSAGE "); | |
62 printWriter.println(""); | |
63 | |
64 printWriter.println("# Begin Project"); | |
65 printWriter.println("# PROP AllowPerConfigDependencies 0"); | |
66 printWriter.println("# PROP Scc_ProjName \"\""); | |
67 printWriter.println("# PROP Scc_LocalPath \"\""); | |
68 printWriter.println("CPP=cl.exe"); | |
69 printWriter.println("MTL=midl.exe"); | |
70 printWriter.println("RSC=rc.exe"); | |
71 | |
72 | |
73 String keyword = "!IF"; | |
74 for (Iterator i = allConfigs.iterator(); i.hasNext(); ) { | |
75 BuildConfig bcfg = (BuildConfig)i.next(); | |
76 printWriter.println(keyword + " \"$(CFG)\" == \"" + bcfg.get("Name") + "\""); | |
77 writeConfigHeader(bcfg); | |
78 keyword = "!ELSEIF"; | |
79 if (!i.hasNext()) printWriter.println("!ENDIF"); | |
80 } | |
81 | |
82 | |
83 TreeSet sortedFiles = sortFiles(computeAttributedFiles(allConfigs)); | |
84 | |
85 printWriter.println("# Begin Target"); | |
86 | |
87 for (Iterator i = allConfigs.iterator(); i.hasNext(); ) { | |
88 printWriter.println("# Name \"" + ((BuildConfig)i.next()).get("Name") + "\""); | |
89 } | |
90 printWriter.println("# Begin Group \"Header Files\""); | |
91 printWriter.println("# PROP Default_Filter \"h;hpp;hxx;hm;inl;fi;fd\""); | |
92 | |
93 Iterator i = sortedFiles.iterator(); | |
94 | |
95 while (i.hasNext()) { | |
96 FileInfo fi = (FileInfo)i.next(); | |
97 | |
98 // skip sources | |
99 if (!fi.isHeader()) { | |
100 continue; | |
101 } | |
102 | |
103 printFile(fi, allConfigNames); | |
104 } | |
105 printWriter.println("# End Group"); | |
106 printWriter.println(""); | |
107 | |
108 printWriter.println("# Begin Group \"Source Files\""); | |
109 printWriter.println("# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90\""); | |
110 | |
111 i = sortedFiles.iterator(); | |
112 while (i.hasNext()) { | |
113 FileInfo fi = (FileInfo)i.next(); | |
114 | |
115 // skip headers | |
116 if (fi.isHeader()) { | |
117 continue; | |
118 } | |
119 | |
120 printFile(fi, allConfigNames); | |
121 } | |
122 printWriter.println("# End Group"); | |
123 printWriter.println(""); | |
124 | |
125 | |
126 printWriter.println("# Begin Group \"Resource Files\""); | |
127 printWriter.println("# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe\""); | |
128 printWriter.println("# End Group"); | |
129 printWriter.println(""); | |
130 printWriter.println("# End Target"); | |
131 | |
132 printWriter.println("# End Project"); | |
133 | |
134 printWriter.close(); | |
135 } | |
136 | |
137 | |
138 void printFile(FileInfo fi, Vector allConfigNames) { | |
139 printWriter.println("# Begin Source File"); | |
140 printWriter.println(""); | |
141 printWriter.println("SOURCE=\"" + fi.full + "\""); | |
142 FileAttribute attr = fi.attr; | |
143 | |
144 if (attr.noPch) { | |
145 printWriter.println("# SUBTRACT CPP /YX /Yc /Yu"); | |
146 } | |
147 | |
148 if (attr.pchRoot) { | |
149 printWriter.println("# ADD CPP /Yc\"incls/_precompiled.incl\""); | |
150 } | |
151 if (attr.configs != null) { | |
152 String keyword = "!IF"; | |
153 for (Iterator j=allConfigNames.iterator(); j.hasNext();) { | |
154 String cfg = (String)j.next(); | |
155 if (!attr.configs.contains(cfg)) { | |
156 printWriter.println(keyword+" \"$(CFG)\" == \"" + cfg +"\""); | |
157 printWriter.println("# PROP BASE Exclude_From_Build 1"); | |
158 printWriter.println("# PROP Exclude_From_Build 1"); | |
159 keyword = "!ELSEIF"; | |
160 } | |
161 } | |
162 printWriter.println("!ENDIF"); | |
163 } | |
164 | |
165 printWriter.println("# End Source File"); | |
166 } | |
167 | |
168 void writeConfigHeader(BuildConfig cfg) { | |
169 printWriter.println("# Begin Special Build Tool"); | |
170 printWriter.println("SOURCE=\"$(InputPath)\""); | |
171 printWriter.println("PreLink_Desc=" + BuildConfig.getFieldString(null, "PrelinkDescription")); | |
172 printWriter.println("PreLink_Cmds=" + | |
173 cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand"))); | |
174 printWriter.println("# End Special Build Tool"); | |
175 printWriter.println(""); | |
176 | |
177 for (Iterator i = cfg.getV("CompilerFlags").iterator(); i.hasNext(); ) { | |
178 printWriter.println("# "+(String)i.next()); | |
179 } | |
180 | |
181 | |
182 printWriter.println("LINK32=link.exe"); | |
183 | |
184 for (Iterator i = cfg.getV("LinkerFlags").iterator(); i.hasNext(); ) { | |
185 printWriter.println("# "+(String)i.next()); | |
186 } | |
187 | |
188 printWriter.println("ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32"); | |
189 printWriter.println("ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32"); | |
190 printWriter.println("ADD BASE RSC /l 0x409 /d \"_DEBUG\""); | |
191 printWriter.println("ADD RSC /l 0x409 /d \"_DEBUG\""); | |
192 printWriter.println("BSC32=bscmake.exe"); | |
193 printWriter.println("ADD BASE BSC32 /nologo"); | |
194 printWriter.println("ADD BSC32 /nologo"); | |
195 printWriter.println(""); | |
196 } | |
197 | |
198 protected String getProjectExt() { | |
199 return ".dsp"; | |
200 } | |
201 } | |
202 | |
203 | |
204 class CompilerInterfaceVC6 extends CompilerInterface { | |
205 Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) { | |
206 Vector rv = new Vector(); | |
207 | |
208 rv.add("PROP BASE Use_MFC 0"); | |
209 rv.add("PROP Use_MFC 0"); | |
210 rv.add("ADD CPP /nologo /MT /W3 /WX /GX /YX /Fr /FD /c"); | |
211 rv.add("PROP BASE Output_Dir \""+outDir+"\""); | |
212 rv.add("PROP Output_Dir \""+outDir+"\""); | |
213 rv.add("PROP BASE Intermediate_Dir \""+outDir+"\""); | |
214 rv.add("PROP Intermediate_Dir \""+outDir+"\""); | |
215 rv.add("PROP BASE Target_Dir \"\""); | |
216 rv.add("PROP Target_Dir \"\""); | |
217 rv.add("ADD BASE CPP "+Util.prefixed_join(" /I ", includes, true)); | |
218 rv.add("ADD CPP "+Util.prefixed_join(" /I ", includes, true)); | |
219 rv.add("ADD BASE CPP "+Util.prefixed_join(" /D ", defines, true)); | |
220 rv.add("ADD CPP "+Util.prefixed_join(" /D ", defines, true)); | |
221 rv.add("ADD CPP /Yu\"incls/_precompiled.incl\""); | |
222 | |
223 return rv; | |
224 } | |
225 | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
226 Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) { |
0 | 227 Vector rv = new Vector(); |
228 | |
229 rv.add("PROP Ignore_Export_Lib 0"); | |
230 rv.add("ADD BASE CPP /MD"); | |
231 rv.add("ADD CPP /MD"); | |
232 rv.add("ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib " + | |
233 " advapi32.lib shell32.lib ole32.lib oleaut32.lib winmm.lib"); | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
234 String machine = "/machine:I386"; |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
235 if (platformName.equals("x64")) { |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
236 machine = "/machine:X64"; |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
237 } |
0 | 238 rv.add("ADD LINK32 /out:\""+outDll+"\" "+ |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
239 " /nologo /subsystem:windows /machine:" + machine + |
0 | 240 " /nologo /base:\"0x8000000\" /subsystem:windows /dll" + |
241 " /export:JNI_GetDefaultJavaVMInitArgs /export:JNI_CreateJavaVM /export:JNI_GetCreatedJavaVMs "+ | |
242 " /export:jio_snprintf /export:jio_printf /export:jio_fprintf /export:jio_vfprintf "+ | |
243 " /export:jio_vsnprintf "); | |
244 rv.add("SUBTRACT LINK32 /pdb:none /map"); | |
245 | |
246 return rv; | |
247 } | |
248 | |
249 Vector getDebugCompilerFlags(String opt) { | |
250 Vector rv = new Vector(); | |
251 | |
252 rv.add("ADD BASE CPP /Gm /Zi /O"+opt); | |
253 | |
254 return rv; | |
255 } | |
256 | |
257 Vector getDebugLinkerFlags() { | |
258 Vector rv = new Vector(); | |
259 | |
260 rv.add("PROP BASE Use_Debug_Libraries 1"); | |
261 rv.add("PROP Use_Debug_Libraries 1"); | |
262 rv.add("ADD LINK32 /debug"); | |
263 | |
264 return rv; | |
265 } | |
266 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
267 void getAdditionalNonKernelLinkerFlags(Vector rv) {} |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
268 |
0 | 269 Vector getProductCompilerFlags() { |
270 Vector rv = new Vector(); | |
271 | |
272 rv.add("ADD CPP /O"+getOptFlag()); | |
273 | |
274 return rv; | |
275 } | |
276 | |
277 Vector getProductLinkerFlags() { | |
278 Vector rv = new Vector(); | |
279 | |
280 rv.add("PROP BASE Use_Debug_Libraries 0"); | |
281 rv.add("PROP Use_Debug_Libraries 0"); | |
282 | |
283 return rv; | |
284 } | |
285 | |
286 String getOptFlag() { | |
287 return "2"; | |
288 } | |
289 | |
290 String getNoOptFlag() { | |
291 return "d"; | |
292 } | |
293 | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
294 String makeCfgName(String flavourBuild, String platform) { |
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
295 return "vm - "+ platform + " " + flavourBuild; |
0 | 296 } |
297 } |