Mon, 28 Mar 2011 12:48:08 +0200
7031571: Generate native VS2010 project files
Reviewed-by: hosterda, stefank, brutisso
1.1 --- a/make/windows/create.bat Thu Mar 24 23:06:13 2011 -0700 1.2 +++ b/make/windows/create.bat Mon Mar 28 12:48:08 2011 +0200 1.3 @@ -93,16 +93,15 @@ 1.4 echo Will generate VC9 {Visual Studio 2008} 1.5 ) else ( 1.6 if "%MSC_VER%" == "1600" ( 1.7 -echo Detected Visual Studio 2010, but 1.8 -echo will generate VC9 {Visual Studio 2008} 1.9 -echo Use conversion wizard in VS 2010. 1.10 +echo Will generate VC10 {Visual Studio 2010} 1.11 +set ProjectFile=%HotSpotBuildSpace%\jvm.vcxproj 1.12 ) else ( 1.13 echo Will generate VC7 project {Visual Studio 2003 .NET} 1.14 ) 1.15 ) 1.16 ) 1.17 ) 1.18 -echo %ProjectFile% 1.19 +echo %ProjectFile% 1.20 echo ************************************************************** 1.21 1.22 REM Test all variables to see whether the directories they
2.1 --- a/make/windows/makefiles/projectcreator.make Thu Mar 24 23:06:13 2011 -0700 2.2 +++ b/make/windows/makefiles/projectcreator.make Mon Mar 28 12:48:08 2011 +0200 2.3 @@ -27,10 +27,6 @@ 2.4 # This is used externally by both batch and IDE builds, so can't 2.5 # reference any of the HOTSPOTWORKSPACE, HOTSPOTBUILDSPACE, 2.6 # HOTSPOTRELEASEBINDEST, or HOTSPOTDEBUGBINDEST environment variables. 2.7 -# 2.8 -# NOTE: unfortunately the ProjectCreatorSources list must be kept 2.9 -# synchronized between this and the Solaris version 2.10 -# (make/solaris/makefiles/projectcreator.make). 2.11 2.12 ProjectCreatorSources=\ 2.13 $(WorkSpace)\src\share\tools\ProjectCreator\DirectoryTree.java \ 2.14 @@ -42,6 +38,7 @@ 2.15 $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC7.java \ 2.16 $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC8.java \ 2.17 $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC9.java \ 2.18 + $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC10.java \ 2.19 $(WorkSpace)\src\share\tools\ProjectCreator\Util.java \ 2.20 $(WorkSpace)\src\share\tools\ProjectCreator\BuildConfig.java \ 2.21 $(WorkSpace)\src\share\tools\ProjectCreator\ArgsParser.java
3.1 --- a/make/windows/makefiles/rules.make Thu Mar 24 23:06:13 2011 -0700 3.2 +++ b/make/windows/makefiles/rules.make Mon Mar 28 12:48:08 2011 +0200 3.3 @@ -65,8 +65,8 @@ 3.4 3.5 !elseif "$(MSC_VER)" == "1600" 3.6 3.7 -# for compatibility - we don't yet have a ProjectCreator for VC10 3.8 -VcVersion=VC9 3.9 +VcVersion=VC10 3.10 +ProjectFile=jvm.vcxproj 3.11 3.12 !else 3.13
4.1 --- a/src/share/tools/ProjectCreator/Util.java Thu Mar 24 23:06:13 2011 -0700 4.2 +++ b/src/share/tools/ProjectCreator/Util.java Mon Mar 28 12:48:08 2011 +0200 4.3 @@ -47,18 +47,6 @@ 4.4 return sb.toString(); 4.5 } 4.6 4.7 - static String join(String padder, String v[]) { 4.8 - StringBuffer sb = new StringBuffer(); 4.9 - 4.10 - for (int i=0; i<v.length; i++) { 4.11 - sb.append(v[i]); 4.12 - if (i < (v.length - 1)) sb.append(padder); 4.13 - } 4.14 - 4.15 - return sb.toString(); 4.16 - } 4.17 - 4.18 - 4.19 4.20 static String prefixed_join(String padder, Vector v, boolean quoted) { 4.21 StringBuffer sb = new StringBuffer();
5.1 --- a/src/share/tools/ProjectCreator/WinGammaPlatform.java Thu Mar 24 23:06:13 2011 -0700 5.2 +++ b/src/share/tools/ProjectCreator/WinGammaPlatform.java Mon Mar 28 12:48:08 2011 +0200 5.3 @@ -587,7 +587,6 @@ 5.4 Vector allConfigs = new Vector(); 5.5 5.6 allConfigs.add(new C1DebugConfig()); 5.7 - 5.8 allConfigs.add(new C1FastDebugConfig()); 5.9 allConfigs.add(new C1ProductConfig()); 5.10 5.11 @@ -655,6 +654,10 @@ 5.12 boolean isHeader() { 5.13 return attr.shortName.endsWith(".h") || attr.shortName.endsWith(".hpp"); 5.14 } 5.15 + 5.16 + boolean isCpp() { 5.17 + return attr.shortName.endsWith(".cpp"); 5.18 + } 5.19 } 5.20 5.21 5.22 @@ -708,7 +711,7 @@ 5.23 PrintWriter printWriter; 5.24 5.25 public void writeProjectFile(String projectFileName, String projectName, 5.26 - Vector allConfigs) throws IOException { 5.27 + Vector<BuildConfig> allConfigs) throws IOException { 5.28 throw new RuntimeException("use compiler version specific version"); 5.29 } 5.30 }
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java Mon Mar 28 12:48:08 2011 +0200 6.3 @@ -0,0 +1,545 @@ 6.4 +import java.io.File; 6.5 +import java.io.FileNotFoundException; 6.6 +import java.io.IOException; 6.7 +import java.io.PrintWriter; 6.8 +import java.io.UnsupportedEncodingException; 6.9 +import java.util.Hashtable; 6.10 +import java.util.Iterator; 6.11 +import java.util.TreeSet; 6.12 +import java.util.UUID; 6.13 +import java.util.Vector; 6.14 + 6.15 +public class WinGammaPlatformVC10 extends WinGammaPlatformVC7 { 6.16 + 6.17 + @Override 6.18 + protected String getProjectExt() { 6.19 + return ".vcxproj"; 6.20 + } 6.21 + 6.22 + @Override 6.23 + public void writeProjectFile(String projectFileName, String projectName, 6.24 + Vector<BuildConfig> allConfigs) throws IOException { 6.25 + System.out.println(); 6.26 + System.out.print(" Writing .vcxproj file: " + projectFileName); 6.27 + 6.28 + String projDir = Util.normalize(new File(projectFileName).getParent()); 6.29 + 6.30 + printWriter = new PrintWriter(projectFileName, "UTF-8"); 6.31 + printWriter.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); 6.32 + startTag("Project", 6.33 + "DefaultTargets", "Build", 6.34 + "ToolsVersion", "4.0", 6.35 + "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); 6.36 + startTag("ItemGroup", 6.37 + "Label", "ProjectConfigurations"); 6.38 + for (BuildConfig cfg : allConfigs) { 6.39 + startTag("ProjectConfiguration", 6.40 + "Include", cfg.get("Name")); 6.41 + tagData("Configuration", cfg.get("Id")); 6.42 + tagData("Platform", cfg.get("PlatformName")); 6.43 + endTag("ProjectConfiguration"); 6.44 + } 6.45 + endTag("ItemGroup"); 6.46 + 6.47 + startTag("PropertyGroup", "Label", "Globals"); 6.48 + tagData("ProjectGuid", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}"); 6.49 + tag("SccProjectName"); 6.50 + tag("SccLocalPath"); 6.51 + endTag("PropertyGroup"); 6.52 + 6.53 + tag("Import", "Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); 6.54 + 6.55 + for (BuildConfig cfg : allConfigs) { 6.56 + startTag(cfg, "PropertyGroup", "Label", "Configuration"); 6.57 + tagData("ConfigurationType", "DynamicLibrary"); 6.58 + tagData("UseOfMfc", "false"); 6.59 + endTag("PropertyGroup"); 6.60 + } 6.61 + 6.62 + tag("Import", "Project", "$(VCTargetsPath)\\Microsoft.Cpp.props"); 6.63 + startTag("ImportGroup", "Label", "ExtensionSettings"); 6.64 + endTag("ImportGroup"); 6.65 + for (BuildConfig cfg : allConfigs) { 6.66 + startTag(cfg, "ImportGroup", "Label", "PropertySheets"); 6.67 + tag("Import", 6.68 + "Project", "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props", 6.69 + "Condition", "exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')", 6.70 + "Label", "LocalAppDataPlatform"); 6.71 + endTag("ImportGroup"); 6.72 + } 6.73 + 6.74 + tag("PropertyGroup", "Label", "UserMacros"); 6.75 + 6.76 + startTag("PropertyGroup"); 6.77 + tagData("_ProjectFileVersion", "10.0.30319.1"); 6.78 + for (BuildConfig cfg : allConfigs) { 6.79 + tagData(cfg, "OutDir", cfg.get("OutputDir") + Util.sep); 6.80 + tagData(cfg, "IntDir", cfg.get("OutputDir") + Util.sep); 6.81 + tagData(cfg, "LinkIncremental", "false"); 6.82 + } 6.83 + for (BuildConfig cfg : allConfigs) { 6.84 + tagData(cfg, "CodeAnalysisRuleSet", "AllRules.ruleset"); 6.85 + tag(cfg, "CodeAnalysisRules"); 6.86 + tag(cfg, "CodeAnalysisRuleAssemblies"); 6.87 + } 6.88 + endTag("PropertyGroup"); 6.89 + 6.90 + for (BuildConfig cfg : allConfigs) { 6.91 + startTag(cfg, "ItemDefinitionGroup"); 6.92 + startTag("ClCompile"); 6.93 + tagV(cfg.getV("CompilerFlags")); 6.94 + endTag("ClCompile"); 6.95 + 6.96 + startTag("Link"); 6.97 + tagV(cfg.getV("LinkerFlags")); 6.98 + endTag("Link"); 6.99 + 6.100 + startTag("PostBuildEvent"); 6.101 + tagData("Message", BuildConfig.getFieldString(null, "PostbuildDescription")); 6.102 + tagData("Command", cfg.expandFormat(BuildConfig.getFieldString(null, "PostbuildCommand").replace("\t", "\r\n"))); 6.103 + endTag("PostBuildEvent"); 6.104 + 6.105 + startTag("PreLinkEvent"); 6.106 + tagData("Message", BuildConfig.getFieldString(null, "PrelinkDescription")); 6.107 + tagData("Command", cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand").replace("\t", "\r\n"))); 6.108 + endTag("PreLinkEvent"); 6.109 + 6.110 + endTag("ItemDefinitionGroup"); 6.111 + } 6.112 + 6.113 + writeFiles(allConfigs, projDir); 6.114 + 6.115 + tag("Import", "Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets"); 6.116 + startTag("ImportGroup", "Label", "ExtensionTargets"); 6.117 + endTag("ImportGroup"); 6.118 + 6.119 + endTag("Project"); 6.120 + printWriter.close(); 6.121 + System.out.println(" Done."); 6.122 + 6.123 + writeFilterFile(projectFileName, projectName, allConfigs, projDir); 6.124 + writeUserFile(projectFileName, allConfigs); 6.125 + } 6.126 + 6.127 + 6.128 + private void writeUserFile(String projectFileName, Vector<BuildConfig> allConfigs) throws FileNotFoundException, UnsupportedEncodingException { 6.129 + String userFileName = projectFileName + ".user"; 6.130 + if (new File(userFileName).exists()) { 6.131 + return; 6.132 + } 6.133 + System.out.print(" Writing .vcxproj.user file: " + userFileName); 6.134 + printWriter = new PrintWriter(userFileName, "UTF-8"); 6.135 + 6.136 + printWriter.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); 6.137 + startTag("Project", 6.138 + "ToolsVersion", "4.0", 6.139 + "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); 6.140 + 6.141 + for (BuildConfig cfg : allConfigs) { 6.142 + startTag(cfg, "PropertyGroup"); 6.143 + tagData("LocalDebuggerCommand", "$(TargetDir)/hotspot.exe"); 6.144 + endTag("PropertyGroup"); 6.145 + } 6.146 + 6.147 + endTag("Project"); 6.148 + printWriter.close(); 6.149 + System.out.println(" Done."); 6.150 + } 6.151 + 6.152 + private void writeFilterFile(String projectFileName, String projectName, 6.153 + Vector<BuildConfig> allConfigs, String base) throws FileNotFoundException, UnsupportedEncodingException { 6.154 + String filterFileName = projectFileName + ".filters"; 6.155 + System.out.print(" Writing .vcxproj.filters file: " + filterFileName); 6.156 + printWriter = new PrintWriter(filterFileName, "UTF-8"); 6.157 + 6.158 + printWriter.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); 6.159 + startTag("Project", 6.160 + "ToolsVersion", "4.0", 6.161 + "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); 6.162 + 6.163 + Hashtable<String, FileAttribute> allFiles = computeAttributedFiles(allConfigs); 6.164 + TreeSet<FileInfo> sortedFiles = sortFiles(allFiles); 6.165 + Vector<NameFilter> filters = makeFilters(sortedFiles); 6.166 + 6.167 + // first all filters 6.168 + startTag("ItemGroup"); 6.169 + for (NameFilter filter : filters) { 6.170 + doWriteFilter(filter, ""); 6.171 + } 6.172 + startTag("Filter", "Include", "Resource Files"); 6.173 + UUID uuid = UUID.randomUUID(); 6.174 + tagData("UniqueIdentifier", "{" + uuid.toString() + "}"); 6.175 + tagData("Extensions", "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"); 6.176 + endTag("Filter"); 6.177 + endTag("ItemGroup"); 6.178 + 6.179 + // then all cpp files 6.180 + startTag("ItemGroup"); 6.181 + for (NameFilter filter : filters) { 6.182 + doWriteFiles(sortedFiles, filter, "", "ClCompile", new Evaluator() { 6.183 + public boolean pick(FileInfo fi) { 6.184 + return fi.isCpp(); 6.185 + } 6.186 + }, base); 6.187 + } 6.188 + endTag("ItemGroup"); 6.189 + 6.190 + // then all header files 6.191 + startTag("ItemGroup"); 6.192 + for (NameFilter filter : filters) { 6.193 + doWriteFiles(sortedFiles, filter, "", "ClInclude", new Evaluator() { 6.194 + public boolean pick(FileInfo fi) { 6.195 + return fi.isHeader(); 6.196 + } 6.197 + }, base); 6.198 + } 6.199 + endTag("ItemGroup"); 6.200 + 6.201 + // then all other files 6.202 + startTag("ItemGroup"); 6.203 + for (NameFilter filter : filters) { 6.204 + doWriteFiles(sortedFiles, filter, "", "None", new Evaluator() { 6.205 + public boolean pick(FileInfo fi) { 6.206 + return true; 6.207 + } 6.208 + }, base); 6.209 + } 6.210 + endTag("ItemGroup"); 6.211 + 6.212 + endTag("Project"); 6.213 + printWriter.close(); 6.214 + System.out.println(" Done."); 6.215 + } 6.216 + 6.217 + 6.218 + private void doWriteFilter(NameFilter filter, String start) { 6.219 + startTag("Filter", "Include", start + filter.fname); 6.220 + UUID uuid = UUID.randomUUID(); 6.221 + tagData("UniqueIdentifier", "{" + uuid.toString() + "}"); 6.222 + endTag("Filter"); 6.223 + if (filter instanceof ContainerFilter) { 6.224 + Iterator i = ((ContainerFilter)filter).babies(); 6.225 + while (i.hasNext()) { 6.226 + doWriteFilter((NameFilter)i.next(), start + filter.fname + "\\"); 6.227 + } 6.228 + } 6.229 + } 6.230 + 6.231 + interface Evaluator { 6.232 + boolean pick(FileInfo fi); 6.233 + } 6.234 + 6.235 + private void doWriteFiles(TreeSet<FileInfo> allFiles, NameFilter filter, String start, String tool, Evaluator eval, String base) { 6.236 + if (filter instanceof ContainerFilter) { 6.237 + Iterator i = ((ContainerFilter)filter).babies(); 6.238 + while (i.hasNext()) { 6.239 + doWriteFiles(allFiles, (NameFilter)i.next(), start + filter.fname + "\\", tool, eval, base); 6.240 + } 6.241 + } 6.242 + else { 6.243 + Iterator i = allFiles.iterator(); 6.244 + while (i.hasNext()) { 6.245 + FileInfo fi = (FileInfo)i.next(); 6.246 + 6.247 + if (!filter.match(fi)) { 6.248 + continue; 6.249 + } 6.250 + if (eval.pick(fi)) { 6.251 + startTag(tool, "Include", rel(fi.full, base)); 6.252 + tagData("Filter", start + filter.fname); 6.253 + endTag(tool); 6.254 + 6.255 + // we not gonna look at this file anymore (sic!) 6.256 + i.remove(); 6.257 + } 6.258 + } 6.259 + } 6.260 + } 6.261 + 6.262 + 6.263 + void writeFiles(Vector<BuildConfig> allConfigs, String projDir) { 6.264 + Hashtable<String, FileAttribute> allFiles = computeAttributedFiles(allConfigs); 6.265 + TreeSet<FileInfo> sortedFiles = sortFiles(allFiles); 6.266 + 6.267 + // first cpp-files 6.268 + startTag("ItemGroup"); 6.269 + for (FileInfo fi : sortedFiles) { 6.270 + if (!fi.isCpp()) { 6.271 + continue; 6.272 + } 6.273 + writeFile("ClCompile", allConfigs, fi, projDir); 6.274 + } 6.275 + endTag("ItemGroup"); 6.276 + 6.277 + // then header-files 6.278 + startTag("ItemGroup"); 6.279 + for (FileInfo fi : sortedFiles) { 6.280 + if (!fi.isHeader()) { 6.281 + continue; 6.282 + } 6.283 + writeFile("ClInclude", allConfigs, fi, projDir); 6.284 + } 6.285 + endTag("ItemGroup"); 6.286 + 6.287 + // then others 6.288 + startTag("ItemGroup"); 6.289 + for (FileInfo fi : sortedFiles) { 6.290 + if (fi.isHeader() || fi.isCpp()) { 6.291 + continue; 6.292 + } 6.293 + writeFile("None", allConfigs, fi, projDir); 6.294 + } 6.295 + endTag("ItemGroup"); 6.296 + } 6.297 + 6.298 + /** 6.299 + * Make "path" into a relative path using "base" as the base. 6.300 + * 6.301 + * path and base are assumed to be normalized with / as the file separator. 6.302 + * returned path uses "\\" as file separator 6.303 + */ 6.304 + private String rel(String path, String base) 6.305 + { 6.306 + if(!base.endsWith("/")) { 6.307 + base += "/"; 6.308 + } 6.309 + String[] pathTok = path.split("/"); 6.310 + String[] baseTok = base.split("/"); 6.311 + int pi = 0; 6.312 + int bi = 0; 6.313 + StringBuilder newPath = new StringBuilder(); 6.314 + 6.315 + // first step past all path components that are the same 6.316 + while (pi < pathTok.length && 6.317 + bi < baseTok.length && 6.318 + pathTok[pi].equals(baseTok[bi])) { 6.319 + pi++; 6.320 + bi++; 6.321 + } 6.322 + 6.323 + // for each path component left in base, add "../" 6.324 + while (bi < baseTok.length) { 6.325 + bi++; 6.326 + newPath.append("..\\"); 6.327 + } 6.328 + 6.329 + // now add everything left in path 6.330 + while (pi < pathTok.length) { 6.331 + newPath.append(pathTok[pi]); 6.332 + pi++; 6.333 + if (pi != pathTok.length) { 6.334 + newPath.append("\\"); 6.335 + } 6.336 + } 6.337 + return newPath.toString(); 6.338 + } 6.339 + 6.340 + private void writeFile(String tool, Vector<BuildConfig> allConfigs, FileInfo fi, String base) { 6.341 + if (fi.attr.configs == null && fi.attr.pchRoot == false && fi.attr.noPch == false) { 6.342 + tag(tool, "Include", rel(fi.full, base)); 6.343 + } 6.344 + else { 6.345 + startTag(tool, "Include", rel(fi.full, base)); 6.346 + for (BuildConfig cfg : allConfigs) { 6.347 + if (fi.attr.configs != null && !fi.attr.configs.contains(cfg.get("Name"))) { 6.348 + tagData(cfg, "ExcludedFromBuild", "true"); 6.349 + } 6.350 + if (fi.attr.pchRoot) { 6.351 + tagData(cfg, "PrecompiledHeader", "Create"); 6.352 + } 6.353 + if (fi.attr.noPch) { 6.354 + startTag(cfg, "PrecompiledHeader"); 6.355 + endTag("PrecompiledHeader"); 6.356 + } 6.357 + } 6.358 + endTag(tool); 6.359 + } 6.360 + } 6.361 + 6.362 + String buildCond(BuildConfig cfg) { 6.363 + return "'$(Configuration)|$(Platform)'=='"+cfg.get("Name")+"'"; 6.364 + } 6.365 + 6.366 + 6.367 + void tagV(Vector<String> v) { 6.368 + Iterator<String> i = v.iterator(); 6.369 + while(i.hasNext()) { 6.370 + String name = i.next(); 6.371 + String data = i.next(); 6.372 + tagData(name, data); 6.373 + } 6.374 + } 6.375 + 6.376 + void tagData(BuildConfig cfg, String name, String data) { 6.377 + tagData(name, data, "Condition", buildCond(cfg)); 6.378 + } 6.379 + 6.380 + void tag(BuildConfig cfg, String name, String... attrs) { 6.381 + String[] ss = new String[attrs.length + 2]; 6.382 + ss[0] = "Condition"; 6.383 + ss[1] = buildCond(cfg); 6.384 + System.arraycopy(attrs, 0, ss, 2, attrs.length); 6.385 + 6.386 + tag(name, ss); 6.387 + } 6.388 + 6.389 + void startTag(BuildConfig cfg, String name, String... attrs) { 6.390 + String[] ss = new String[attrs.length + 2]; 6.391 + ss[0] = "Condition"; 6.392 + ss[1] = buildCond(cfg); 6.393 + System.arraycopy(attrs, 0, ss, 2, attrs.length); 6.394 + 6.395 + startTag(name, ss); 6.396 + } 6.397 +} 6.398 + 6.399 +class CompilerInterfaceVC10 extends CompilerInterface { 6.400 + 6.401 + @Override 6.402 + Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) { 6.403 + Vector rv = new Vector(); 6.404 + 6.405 + addAttr(rv, "AdditionalIncludeDirectories", Util.join(";", includes)); 6.406 + addAttr(rv, "PreprocessorDefinitions", 6.407 + Util.join(";", defines).replace("\\\"", "\"")); 6.408 + addAttr(rv, "PrecompiledHeaderFile", "precompiled.hpp"); 6.409 + addAttr(rv, "PrecompiledHeaderOutputFile", outDir+Util.sep+"vm.pch"); 6.410 + addAttr(rv, "AssemblerListingLocation", outDir); 6.411 + addAttr(rv, "ObjectFileName", outDir+Util.sep); 6.412 + addAttr(rv, "ProgramDataBaseFileName", outDir+Util.sep+"jvm.pdb"); 6.413 + // Set /nologo option 6.414 + addAttr(rv, "SuppressStartupBanner", "true"); 6.415 + // Surpass the default /Tc or /Tp. 6.416 + addAttr(rv, "CompileAs", "Default"); 6.417 + // Set /W3 option. 6.418 + addAttr(rv, "WarningLevel", "Level3"); 6.419 + // Set /WX option, 6.420 + addAttr(rv, "TreatWarningAsError", "true"); 6.421 + // Set /GS option 6.422 + addAttr(rv, "BufferSecurityCheck", "false"); 6.423 + // Set /Zi option. 6.424 + addAttr(rv, "DebugInformationFormat", "ProgramDatabase"); 6.425 + // Set /Yu option. 6.426 + addAttr(rv, "PrecompiledHeader", "Use"); 6.427 + // Set /EHsc- option 6.428 + addAttr(rv, "ExceptionHandling", ""); 6.429 + 6.430 + addAttr(rv, "MultiProcessorCompilation", "true"); 6.431 + 6.432 + return rv; 6.433 + } 6.434 + 6.435 + @Override 6.436 + Vector getDebugCompilerFlags(String opt) { 6.437 + Vector rv = new Vector(); 6.438 + 6.439 + // Set /On option 6.440 + addAttr(rv, "Optimization", opt); 6.441 + // Set /FR option. 6.442 + addAttr(rv, "BrowseInformation", "true"); 6.443 + addAttr(rv, "BrowseInformationFile", "$(IntDir)"); 6.444 + // Set /MD option. 6.445 + addAttr(rv, "RuntimeLibrary", "MultiThreadedDLL"); 6.446 + // Set /Oy- option 6.447 + addAttr(rv, "OmitFramePointers", "false"); 6.448 + 6.449 + return rv; 6.450 + } 6.451 + 6.452 + @Override 6.453 + Vector getProductCompilerFlags() { 6.454 + Vector rv = new Vector(); 6.455 + 6.456 + // Set /O2 option. 6.457 + addAttr(rv, "Optimization", "MaxSpeed"); 6.458 + // Set /Oy- option 6.459 + addAttr(rv, "OmitFramePointers", "false"); 6.460 + // Set /Ob option. 1 is expandOnlyInline 6.461 + addAttr(rv, "InlineFunctionExpansion", "OnlyExplicitInline"); 6.462 + // Set /GF option. 6.463 + addAttr(rv, "StringPooling", "true"); 6.464 + // Set /MD option. 2 is rtMultiThreadedDLL 6.465 + addAttr(rv, "RuntimeLibrary", "MultiThreadedDLL"); 6.466 + // Set /Gy option 6.467 + addAttr(rv, "FunctionLevelLinking", "true"); 6.468 + 6.469 + return rv; 6.470 + } 6.471 + 6.472 + @Override 6.473 + Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) { 6.474 + Vector rv = new Vector(); 6.475 + 6.476 + addAttr(rv, "AdditionalOptions", 6.477 + "/export:JNI_GetDefaultJavaVMInitArgs " + 6.478 + "/export:JNI_CreateJavaVM " + 6.479 + "/export:JVM_FindClassFromBootLoader "+ 6.480 + "/export:JNI_GetCreatedJavaVMs "+ 6.481 + "/export:jio_snprintf /export:jio_printf "+ 6.482 + "/export:jio_fprintf /export:jio_vfprintf "+ 6.483 + "/export:jio_vsnprintf "+ 6.484 + "/export:JVM_GetVersionInfo "+ 6.485 + "/export:JVM_GetThreadStateNames "+ 6.486 + "/export:JVM_GetThreadStateValues "+ 6.487 + "/export:JVM_InitAgentProperties"); 6.488 + addAttr(rv, "AdditionalDependencies", "kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;Wsock32.lib;winmm.lib"); 6.489 + addAttr(rv, "OutputFile", outDll); 6.490 + addAttr(rv, "SuppressStartupBanner", "true"); 6.491 + addAttr(rv, "ModuleDefinitionFile", outDir+Util.sep+"vm.def"); 6.492 + addAttr(rv, "ProgramDatabaseFile", outDir+Util.sep+"jvm.pdb"); 6.493 + addAttr(rv, "SubSystem", "Windows"); 6.494 + addAttr(rv, "BaseAddress", "0x8000000"); 6.495 + addAttr(rv, "ImportLibrary", outDir+Util.sep+"jvm.lib"); 6.496 + 6.497 + if(platformName.equals("Win32")) { 6.498 + addAttr(rv, "TargetMachine", "MachineX86"); 6.499 + } else { 6.500 + addAttr(rv, "TargetMachine", "MachineX64"); 6.501 + } 6.502 + 6.503 + return rv; 6.504 + } 6.505 + 6.506 + @Override 6.507 + Vector getDebugLinkerFlags() { 6.508 + Vector rv = new Vector(); 6.509 + 6.510 + // /DEBUG option 6.511 + addAttr(rv, "GenerateDebugInformation", "true"); 6.512 + 6.513 + return rv; 6.514 + } 6.515 + 6.516 + @Override 6.517 + Vector getProductLinkerFlags() { 6.518 + Vector rv = new Vector(); 6.519 + 6.520 + // Set /OPT:REF option. 6.521 + addAttr(rv, "OptimizeReferences", "true"); 6.522 + // Set /OPT:ICF option. 6.523 + addAttr(rv, "EnableCOMDATFolding", "true"); 6.524 + 6.525 + return rv; 6.526 + } 6.527 + 6.528 + @Override 6.529 + void getAdditionalNonKernelLinkerFlags(Vector rv) { 6.530 + extAttr(rv, "AdditionalOptions", " /export:AsyncGetCallTrace"); 6.531 + } 6.532 + 6.533 + @Override 6.534 + String getOptFlag() { 6.535 + return "MaxSpeed"; 6.536 + } 6.537 + 6.538 + @Override 6.539 + String getNoOptFlag() { 6.540 + return "Disabled"; 6.541 + } 6.542 + 6.543 + @Override 6.544 + String makeCfgName(String flavourBuild, String platform) { 6.545 + return flavourBuild + "|" + platform; 6.546 + } 6.547 + 6.548 +}
7.1 --- a/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java Thu Mar 24 23:06:13 2011 -0700 7.2 +++ b/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java Mon Mar 28 12:48:08 2011 +0200 7.3 @@ -35,7 +35,7 @@ 7.4 String projectVersion() {return "7.10";}; 7.5 7.6 public void writeProjectFile(String projectFileName, String projectName, 7.7 - Vector allConfigs) throws IOException { 7.8 + Vector<BuildConfig> allConfigs) throws IOException { 7.9 System.out.println(); 7.10 System.out.println(" Writing .vcproj file: "+projectFileName); 7.11 // If we got this far without an error, we're safe to actually 7.12 @@ -54,11 +54,11 @@ 7.13 "SccLocalPath", "" 7.14 } 7.15 ); 7.16 - startTag("Platforms", null); 7.17 + startTag("Platforms"); 7.18 tag("Platform", new String[] {"Name", (String) BuildConfig.getField(null, "PlatformName")}); 7.19 endTag("Platforms"); 7.20 7.21 - startTag("Configurations", null); 7.22 + startTag("Configurations"); 7.23 7.24 for (Iterator i = allConfigs.iterator(); i.hasNext(); ) { 7.25 writeConfiguration((BuildConfig)i.next()); 7.26 @@ -66,11 +66,11 @@ 7.27 7.28 endTag("Configurations"); 7.29 7.30 - tag("References", null); 7.31 + tag("References"); 7.32 7.33 writeFiles(allConfigs); 7.34 7.35 - tag("Globals", null); 7.36 + tag("Globals"); 7.37 7.38 endTag("VisualStudioProject"); 7.39 printWriter.close(); 7.40 @@ -190,28 +190,6 @@ 7.41 } 7.42 } 7.43 7.44 - class TypeFilter extends NameFilter { 7.45 - String[] exts; 7.46 - 7.47 - TypeFilter(String fname, String[] exts) { 7.48 - this.fname = fname; 7.49 - this.exts = exts; 7.50 - } 7.51 - 7.52 - boolean match(FileInfo fi) { 7.53 - for (int i=0; i<exts.length; i++) { 7.54 - if (fi.full.endsWith(exts[i])) { 7.55 - return true; 7.56 - } 7.57 - } 7.58 - return false; 7.59 - } 7.60 - 7.61 - String filterString() { 7.62 - return Util.join(";", exts); 7.63 - } 7.64 - } 7.65 - 7.66 class TerminatorFilter extends NameFilter { 7.67 TerminatorFilter(String fname) { 7.68 this.fname = fname; 7.69 @@ -299,8 +277,8 @@ 7.70 // - container filter just provides a container to group together real filters 7.71 // - real filter can select elements from the set according to some rule, put it into XML 7.72 // and remove from the list 7.73 - Vector makeFilters(TreeSet<FileInfo> files) { 7.74 - Vector rv = new Vector(); 7.75 + Vector<NameFilter> makeFilters(TreeSet<FileInfo> files) { 7.76 + Vector<NameFilter> rv = new Vector<NameFilter>(); 7.77 String sbase = Util.normalize(BuildConfig.getFieldString(null, "SourceBase")+"/src/"); 7.78 7.79 String currentDir = ""; 7.80 @@ -370,13 +348,12 @@ 7.81 rv.add(new SpecificNameFilter("Precompiled Header", new String[] {"precompiled.hpp"})); 7.82 7.83 // this one is to catch files not caught by other filters 7.84 - //rv.add(new TypeFilter("Header Files", new String[] {"h", "hpp", "hxx", "hm", "inl", "fi", "fd"})); 7.85 rv.add(new TerminatorFilter("Source Files")); 7.86 7.87 return rv; 7.88 } 7.89 7.90 - void writeFiles(Vector allConfigs) { 7.91 + void writeFiles(Vector<BuildConfig> allConfigs) { 7.92 7.93 Hashtable allFiles = computeAttributedFiles(allConfigs); 7.94 7.95 @@ -387,7 +364,7 @@ 7.96 7.97 TreeSet sortedFiles = sortFiles(allFiles); 7.98 7.99 - startTag("Files", null); 7.100 + startTag("Files"); 7.101 7.102 for (Iterator i = makeFilters(sortedFiles).iterator(); i.hasNext(); ) { 7.103 doWriteFiles(sortedFiles, allConfigNames, (NameFilter)i.next()); 7.104 @@ -556,34 +533,39 @@ 7.105 int indent; 7.106 7.107 private void startTagPrim(String name, 7.108 + String[] attrs, 7.109 + boolean close) { 7.110 + startTagPrim(name, attrs, close, true); 7.111 + } 7.112 + 7.113 + private void startTagPrim(String name, 7.114 String[] attrs, 7.115 - boolean close) { 7.116 + boolean close, 7.117 + boolean newline) { 7.118 doIndent(); 7.119 printWriter.print("<"+name); 7.120 indent++; 7.121 7.122 - if (attrs != null) { 7.123 - printWriter.println(); 7.124 + if (attrs != null && attrs.length > 0) { 7.125 for (int i=0; i<attrs.length; i+=2) { 7.126 - doIndent(); 7.127 printWriter.print(" " + attrs[i]+"=\""+attrs[i+1]+"\""); 7.128 if (i < attrs.length - 2) { 7.129 - printWriter.println(); 7.130 } 7.131 } 7.132 } 7.133 7.134 if (close) { 7.135 indent--; 7.136 - //doIndent(); 7.137 - printWriter.println("/>"); 7.138 + printWriter.print(" />"); 7.139 } else { 7.140 - //doIndent(); 7.141 - printWriter.println(">"); 7.142 + printWriter.print(">"); 7.143 + } 7.144 + if(newline) { 7.145 + printWriter.println(); 7.146 } 7.147 } 7.148 7.149 - void startTag(String name, String[] attrs) { 7.150 + void startTag(String name, String... attrs) { 7.151 startTagPrim(name, attrs, false); 7.152 } 7.153 7.154 @@ -601,11 +583,25 @@ 7.155 printWriter.println("</"+name+">"); 7.156 } 7.157 7.158 - void tag(String name, String[] attrs) { 7.159 + void tag(String name, String... attrs) { 7.160 startTagPrim(name, attrs, true); 7.161 } 7.162 7.163 - void tagV(String name, Vector attrs) { 7.164 + void tagData(String name, String data) { 7.165 + doIndent(); 7.166 + printWriter.print("<"+name+">"); 7.167 + printWriter.print(data); 7.168 + printWriter.println("</"+name+">"); 7.169 + } 7.170 + 7.171 + void tagData(String name, String data, String... attrs) { 7.172 + startTagPrim(name, attrs, false, false); 7.173 + printWriter.print(data); 7.174 + printWriter.println("</"+name+">"); 7.175 + indent--; 7.176 + } 7.177 + 7.178 + void tagV(String name, Vector attrs) { 7.179 String s[] = new String [attrs.size()]; 7.180 for (int i=0; i<attrs.size(); i++) { 7.181 s[i] = (String)attrs.elementAt(i); 7.182 @@ -616,7 +612,7 @@ 7.183 7.184 void doIndent() { 7.185 for (int i=0; i<indent; i++) { 7.186 - printWriter.print(" "); 7.187 + printWriter.print(" "); 7.188 } 7.189 } 7.190