author | mikael |
Tue, 24 Dec 2013 11:48:39 -0800 | |
changeset 22234 | da823d78ad65 |
parent 19277 | 8952a5e25673 |
child 26293 | 5c7a054e59fe |
permissions | -rw-r--r-- |
1 | 1 |
/* |
22234
da823d78ad65
8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents:
19277
diff
changeset
|
2 |
* Copyright (c) 2005, 2013, 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; |
13892 | 28 |
import java.nio.file.FileSystems; |
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
29 |
import java.util.Vector; |
1 | 30 |
|
31 |
public class WinGammaPlatformVC7 extends WinGammaPlatform { |
|
32 |
||
13892 | 33 |
// TODO How about moving all globals configs to its own BuildConfig? |
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
34 |
|
13892 | 35 |
String projectVersion() { |
36 |
return "7.10"; |
|
37 |
}; |
|
1 | 38 |
|
13892 | 39 |
public void writeProjectFile(String projectFileName, String projectName, |
40 |
Vector<BuildConfig> allConfigs) throws IOException { |
|
41 |
System.out.println(); |
|
42 |
System.out.println(" Writing .vcproj file: " + projectFileName); |
|
43 |
// If we got this far without an error, we're safe to actually |
|
44 |
// write the .vcproj file |
|
45 |
printWriter = new PrintWriter(new FileWriter(projectFileName)); |
|
1 | 46 |
|
13892 | 47 |
printWriter |
48 |
.println("<?xml version=\"1.0\" encoding=\"windows-1251\"?>"); |
|
49 |
startTag("VisualStudioProject", new String[] { "ProjectType", |
|
50 |
"Visual C++", "Version", projectVersion(), "Name", projectName, |
|
51 |
"ProjectGUID", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}", |
|
52 |
"SccProjectName", "", "SccLocalPath", "" }); |
|
53 |
startTag("Platforms"); |
|
54 |
tag("Platform", |
|
55 |
new String[] { "Name", |
|
56 |
(String) BuildConfig.getField(null, "PlatformName") }); |
|
57 |
endTag(); |
|
8303
81a0b8663748
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
7452
diff
changeset
|
58 |
|
13892 | 59 |
startTag("Configurations"); |
8303
81a0b8663748
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
7452
diff
changeset
|
60 |
|
13892 | 61 |
for (BuildConfig cfg : allConfigs) { |
62 |
writeConfiguration(cfg); |
|
63 |
} |
|
1 | 64 |
|
13892 | 65 |
endTag(); |
1 | 66 |
|
13892 | 67 |
tag("References"); |
1 | 68 |
|
13892 | 69 |
writeFiles(allConfigs); |
1 | 70 |
|
13892 | 71 |
tag("Globals"); |
8303
81a0b8663748
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
7452
diff
changeset
|
72 |
|
13892 | 73 |
endTag(); |
74 |
printWriter.close(); |
|
8303
81a0b8663748
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
7452
diff
changeset
|
75 |
|
13892 | 76 |
System.out.println(" Done."); |
77 |
} |
|
8303
81a0b8663748
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
7452
diff
changeset
|
78 |
|
13892 | 79 |
void writeCustomToolConfig(Vector<BuildConfig> configs, String[] customToolAttrs) { |
80 |
for (BuildConfig cfg : configs) { |
|
81 |
startTag("FileConfiguration", |
|
82 |
new String[] { "Name", (String) cfg.get("Name") }); |
|
83 |
tag("Tool", customToolAttrs); |
|
1 | 84 |
|
13892 | 85 |
endTag(); |
86 |
} |
|
87 |
} |
|
1 | 88 |
|
13892 | 89 |
void writeFiles(Vector<BuildConfig> allConfigs) { |
1 | 90 |
|
13892 | 91 |
// This code assummes there are no config specific includes. |
92 |
startTag("Files"); |
|
93 |
String sourceBase = BuildConfig.getFieldString(null, "SourceBase"); |
|
1 | 94 |
|
13892 | 95 |
// Use first config for all global absolute includes. |
96 |
BuildConfig baseConfig = allConfigs.firstElement(); |
|
97 |
Vector<String> rv = new Vector<String>(); |
|
7397 | 98 |
|
13892 | 99 |
// Then use first config for all relative includes |
100 |
Vector<String> ri = new Vector<String>(); |
|
101 |
baseConfig.collectRelevantVectors(ri, "RelativeSrcInclude"); |
|
102 |
for (String f : ri) { |
|
103 |
rv.add(sourceBase + Util.sep + f); |
|
104 |
} |
|
7397 | 105 |
|
13892 | 106 |
baseConfig.collectRelevantVectors(rv, "AbsoluteSrcInclude"); |
1 | 107 |
|
13892 | 108 |
handleIncludes(rv, allConfigs); |
1 | 109 |
|
13892 | 110 |
startTag("Filter", new String[] { "Name", "Resource Files", "Filter", |
111 |
"ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" }); |
|
112 |
endTag(); |
|
1 | 113 |
|
13892 | 114 |
endTag(); |
115 |
} |
|
1 | 116 |
|
13892 | 117 |
// Will visit file tree for each include |
118 |
private void handleIncludes(Vector<String> includes, Vector<BuildConfig> allConfigs) { |
|
119 |
for (String path : includes) { |
|
120 |
FileTreeCreatorVC7 ftc = new FileTreeCreatorVC7(FileSystems.getDefault().getPath(path) , allConfigs, this); |
|
121 |
try { |
|
122 |
ftc.writeFileTree(); |
|
123 |
} catch (IOException e) { |
|
124 |
e.printStackTrace(); |
|
125 |
} |
|
126 |
} |
|
127 |
} |
|
1 | 128 |
|
13892 | 129 |
void writeConfiguration(BuildConfig cfg) { |
130 |
startTag("Configuration", new String[] { "Name", cfg.get("Name"), |
|
131 |
"OutputDirectory", cfg.get("OutputDir"), |
|
132 |
"IntermediateDirectory", cfg.get("OutputDir"), |
|
133 |
"ConfigurationType", "2", "UseOfMFC", "0", |
|
134 |
"ATLMinimizesCRunTimeLibraryUsage", "FALSE" }); |
|
1 | 135 |
|
13892 | 136 |
tagV("Tool", cfg.getV("CompilerFlags")); |
1 | 137 |
|
13892 | 138 |
tag("Tool", new String[] { "Name", "VCCustomBuildTool" }); |
1 | 139 |
|
13892 | 140 |
tagV("Tool", cfg.getV("LinkerFlags")); |
1 | 141 |
|
19277 | 142 |
String postBuildCmd = BuildConfig.getFieldString(null, |
143 |
"PostbuildCommand"); |
|
144 |
if (postBuildCmd != null) { |
|
145 |
tag("Tool", |
|
146 |
new String[] { |
|
147 |
"Name", |
|
148 |
"VCPostBuildEventTool", |
|
149 |
"Description", |
|
150 |
BuildConfig |
|
151 |
.getFieldString(null, "PostbuildDescription"), |
|
152 |
// Caution: String.replace(String,String) is available |
|
153 |
// from JDK5 onwards only |
|
154 |
"CommandLine", |
|
155 |
cfg.expandFormat(postBuildCmd.replace("\t", |
|
156 |
"
")) }); |
|
157 |
} |
|
1 | 158 |
|
13892 | 159 |
tag("Tool", new String[] { "Name", "VCPreBuildEventTool" }); |
1 | 160 |
|
13892 | 161 |
tag("Tool", |
162 |
new String[] { |
|
163 |
"Name", |
|
164 |
"VCPreLinkEventTool", |
|
165 |
"Description", |
|
166 |
BuildConfig.getFieldString(null, "PrelinkDescription"), |
|
167 |
// Caution: String.replace(String,String) is available |
|
168 |
// from JDK5 onwards only |
|
169 |
"CommandLine", |
|
170 |
cfg.expandFormat(BuildConfig.getFieldString(null, |
|
171 |
"PrelinkCommand").replace("\t", "
")) }); |
|
1 | 172 |
|
13892 | 173 |
tag("Tool", new String[] { "Name", "VCResourceCompilerTool", |
174 |
"PreprocessorDefinitions", "NDEBUG", "Culture", "1033" }); |
|
1 | 175 |
|
13892 | 176 |
tag("Tool", new String[] { "Name", "VCMIDLTool", |
177 |
"PreprocessorDefinitions", "NDEBUG", "MkTypLibCompatible", |
|
178 |
"TRUE", "SuppressStartupBanner", "TRUE", "TargetEnvironment", |
|
179 |
"1", "TypeLibraryName", |
|
180 |
cfg.get("OutputDir") + Util.sep + "vm.tlb", "HeaderFileName", |
|
181 |
"" }); |
|
1 | 182 |
|
13892 | 183 |
endTag(); |
184 |
} |
|
1 | 185 |
|
186 |
||
187 |
||
13892 | 188 |
protected String getProjectExt() { |
189 |
return ".vcproj"; |
|
190 |
} |
|
1 | 191 |
} |
192 |
||
193 |
class CompilerInterfaceVC7 extends CompilerInterface { |
|
13892 | 194 |
void getBaseCompilerFlags_common(Vector defines, Vector includes, |
195 |
String outDir, Vector rv) { |
|
1 | 196 |
|
13892 | 197 |
// advanced M$ IDE (2003) can only recognize name if it's first or |
198 |
// second attribute in the tag - go guess |
|
199 |
addAttr(rv, "Name", "VCCLCompilerTool"); |
|
200 |
addAttr(rv, "AdditionalIncludeDirectories", Util.join(",", includes)); |
|
201 |
addAttr(rv, "PreprocessorDefinitions", |
|
202 |
Util.join(";", defines).replace("\"", """)); |
|
203 |
addAttr(rv, "PrecompiledHeaderThrough", "precompiled.hpp"); |
|
204 |
addAttr(rv, "PrecompiledHeaderFile", outDir + Util.sep + "vm.pch"); |
|
205 |
addAttr(rv, "AssemblerListingLocation", outDir); |
|
206 |
addAttr(rv, "ObjectFile", outDir + Util.sep); |
|
207 |
addAttr(rv, "ProgramDataBaseFileName", outDir + Util.sep + "jvm.pdb"); |
|
208 |
// Set /nologo optin |
|
209 |
addAttr(rv, "SuppressStartupBanner", "TRUE"); |
|
210 |
// Surpass the default /Tc or /Tp. 0 is compileAsDefault |
|
211 |
addAttr(rv, "CompileAs", "0"); |
|
212 |
// Set /W3 option. 3 is warningLevel_3 |
|
213 |
addAttr(rv, "WarningLevel", "3"); |
|
214 |
// Set /WX option, |
|
215 |
addAttr(rv, "WarnAsError", "TRUE"); |
|
216 |
// Set /GS option |
|
217 |
addAttr(rv, "BufferSecurityCheck", "FALSE"); |
|
218 |
// Set /Zi option. 3 is debugEnabled |
|
219 |
addAttr(rv, "DebugInformationFormat", "3"); |
|
220 |
} |
|
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
221 |
|
13892 | 222 |
Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) { |
223 |
Vector rv = new Vector(); |
|
1 | 224 |
|
13892 | 225 |
getBaseCompilerFlags_common(defines, includes, outDir, rv); |
226 |
// Set /Yu option. 3 is pchUseUsingSpecific |
|
227 |
// Note: Starting VC8 pchUseUsingSpecific is 2 !!! |
|
228 |
addAttr(rv, "UsePrecompiledHeader", "3"); |
|
229 |
// Set /EHsc- option |
|
230 |
addAttr(rv, "ExceptionHandling", "FALSE"); |
|
1 | 231 |
|
13892 | 232 |
return rv; |
233 |
} |
|
234 |
||
235 |
Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) { |
|
236 |
Vector rv = new Vector(); |
|
1 | 237 |
|
13892 | 238 |
addAttr(rv, "Name", "VCLinkerTool"); |
239 |
addAttr(rv, "AdditionalOptions", |
|
240 |
"/export:JNI_GetDefaultJavaVMInitArgs " |
|
241 |
+ "/export:JNI_CreateJavaVM " |
|
242 |
+ "/export:JVM_FindClassFromBootLoader " |
|
243 |
+ "/export:JNI_GetCreatedJavaVMs " |
|
244 |
+ "/export:jio_snprintf /export:jio_printf " |
|
245 |
+ "/export:jio_fprintf /export:jio_vfprintf " |
|
246 |
+ "/export:jio_vsnprintf " |
|
247 |
+ "/export:JVM_GetVersionInfo " |
|
248 |
+ "/export:JVM_GetThreadStateNames " |
|
249 |
+ "/export:JVM_GetThreadStateValues " |
|
250 |
+ "/export:JVM_InitAgentProperties "); |
|
251 |
addAttr(rv, "AdditionalDependencies", "Wsock32.lib winmm.lib"); |
|
252 |
addAttr(rv, "OutputFile", outDll); |
|
253 |
// Set /INCREMENTAL option. 1 is linkIncrementalNo |
|
254 |
addAttr(rv, "LinkIncremental", "1"); |
|
255 |
addAttr(rv, "SuppressStartupBanner", "TRUE"); |
|
256 |
addAttr(rv, "ModuleDefinitionFile", outDir + Util.sep + "vm.def"); |
|
257 |
addAttr(rv, "ProgramDatabaseFile", outDir + Util.sep + "jvm.pdb"); |
|
258 |
// Set /SUBSYSTEM option. 2 is subSystemWindows |
|
259 |
addAttr(rv, "SubSystem", "2"); |
|
260 |
addAttr(rv, "BaseAddress", "0x8000000"); |
|
261 |
addAttr(rv, "ImportLibrary", outDir + Util.sep + "jvm.lib"); |
|
262 |
if (platformName.equals("Win32")) { |
|
263 |
// Set /MACHINE option. 1 is X86 |
|
264 |
addAttr(rv, "TargetMachine", "1"); |
|
265 |
} else { |
|
266 |
// Set /MACHINE option. 17 is X64 |
|
267 |
addAttr(rv, "TargetMachine", "17"); |
|
268 |
} |
|
1 | 269 |
|
13892 | 270 |
return rv; |
271 |
} |
|
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
272 |
|
13892 | 273 |
void getDebugCompilerFlags_common(String opt, Vector rv) { |
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
274 |
|
13892 | 275 |
// Set /On option |
276 |
addAttr(rv, "Optimization", opt); |
|
277 |
// Set /FR option. 1 is brAllInfo |
|
278 |
addAttr(rv, "BrowseInformation", "1"); |
|
279 |
addAttr(rv, "BrowseInformationFile", "$(IntDir)" + Util.sep); |
|
280 |
// Set /MD option. 2 is rtMultiThreadedDLL |
|
281 |
addAttr(rv, "RuntimeLibrary", "2"); |
|
282 |
// Set /Oy- option |
|
283 |
addAttr(rv, "OmitFramePointers", "FALSE"); |
|
2271
ff6d122287cb
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
1
diff
changeset
|
284 |
|
13892 | 285 |
} |
286 |
||
287 |
Vector getDebugCompilerFlags(String opt) { |
|
288 |
Vector rv = new Vector(); |
|
1 | 289 |
|
13892 | 290 |
getDebugCompilerFlags_common(opt, rv); |
1 | 291 |
|
13892 | 292 |
return rv; |
293 |
} |
|
1 | 294 |
|
13892 | 295 |
Vector getDebugLinkerFlags() { |
296 |
Vector rv = new Vector(); |
|
1 | 297 |
|
13892 | 298 |
addAttr(rv, "GenerateDebugInformation", "TRUE"); // == /DEBUG option |
1 | 299 |
|
13892 | 300 |
return rv; |
301 |
} |
|
302 |
||
303 |
void getAdditionalNonKernelLinkerFlags(Vector rv) { |
|
304 |
extAttr(rv, "AdditionalOptions", "/export:AsyncGetCallTrace "); |
|
305 |
} |
|
7452
b3fa838286de
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
7397
diff
changeset
|
306 |
|
13892 | 307 |
void getProductCompilerFlags_common(Vector rv) { |
308 |
// Set /O2 option. 2 is optimizeMaxSpeed |
|
309 |
addAttr(rv, "Optimization", "2"); |
|
310 |
// Set /Oy- option |
|
311 |
addAttr(rv, "OmitFramePointers", "FALSE"); |
|
312 |
// Set /Ob option. 1 is expandOnlyInline |
|
313 |
addAttr(rv, "InlineFunctionExpansion", "1"); |
|
314 |
// Set /GF option. |
|
315 |
addAttr(rv, "StringPooling", "TRUE"); |
|
316 |
// Set /MD option. 2 is rtMultiThreadedDLL |
|
317 |
addAttr(rv, "RuntimeLibrary", "2"); |
|
318 |
// Set /Gy option |
|
319 |
addAttr(rv, "EnableFunctionLevelLinking", "TRUE"); |
|
320 |
} |
|
8303
81a0b8663748
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
7452
diff
changeset
|
321 |
|
13892 | 322 |
Vector getProductCompilerFlags() { |
323 |
Vector rv = new Vector(); |
|
8303
81a0b8663748
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
7452
diff
changeset
|
324 |
|
13892 | 325 |
getProductCompilerFlags_common(rv); |
1 | 326 |
|
13892 | 327 |
return rv; |
328 |
} |
|
1 | 329 |
|
13892 | 330 |
Vector getProductLinkerFlags() { |
331 |
Vector rv = new Vector(); |
|
1 | 332 |
|
13892 | 333 |
// Set /OPT:REF option. 2 is optReferences |
334 |
addAttr(rv, "OptimizeReferences", "2"); |
|
335 |
// Set /OPT:optFolding option. 2 is optFolding |
|
336 |
addAttr(rv, "EnableCOMDATFolding", "2"); |
|
1 | 337 |
|
13892 | 338 |
return rv; |
339 |
} |
|
1 | 340 |
|
13892 | 341 |
String getOptFlag() { |
342 |
return "2"; |
|
343 |
} |
|
1 | 344 |
|
13892 | 345 |
String getNoOptFlag() { |
346 |
return "0"; |
|
347 |
} |
|
1 | 348 |
|
13892 | 349 |
String makeCfgName(String flavourBuild, String platform) { |
350 |
return flavourBuild + "|" + platform; |
|
351 |
} |
|
352 |
||
1 | 353 |
} |