Wed, 27 Apr 2016 01:25:04 +0800
Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/
changeset: 6782:28b50d07f6f8
tag: jdk8u25-b17
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. |
aoqi@0 | 8 | * |
aoqi@0 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 13 | * accompanied this code). |
aoqi@0 | 14 | * |
aoqi@0 | 15 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 18 | * |
aoqi@0 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 20 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 21 | * questions. |
aoqi@0 | 22 | * |
aoqi@0 | 23 | */ |
aoqi@0 | 24 | |
aoqi@0 | 25 | import java.io.File; |
aoqi@0 | 26 | import java.io.FileNotFoundException; |
aoqi@0 | 27 | import java.io.IOException; |
aoqi@0 | 28 | import java.io.PrintWriter; |
aoqi@0 | 29 | import java.io.UnsupportedEncodingException; |
aoqi@0 | 30 | import java.nio.file.FileSystems; |
aoqi@0 | 31 | import java.util.Iterator; |
aoqi@0 | 32 | import java.util.LinkedList; |
aoqi@0 | 33 | import java.util.UUID; |
aoqi@0 | 34 | import java.util.Vector; |
aoqi@0 | 35 | |
aoqi@0 | 36 | public class WinGammaPlatformVC10 extends WinGammaPlatformVC7 { |
aoqi@0 | 37 | |
aoqi@0 | 38 | |
aoqi@0 | 39 | LinkedList <String>filters = new LinkedList<String>(); |
aoqi@0 | 40 | LinkedList <String[]>filterDeps = new LinkedList<String[]>(); |
aoqi@0 | 41 | |
aoqi@0 | 42 | @Override |
aoqi@0 | 43 | protected String getProjectExt() { |
aoqi@0 | 44 | return ".vcxproj"; |
aoqi@0 | 45 | } |
aoqi@0 | 46 | |
aoqi@0 | 47 | @Override |
aoqi@0 | 48 | public void writeProjectFile(String projectFileName, String projectName, |
aoqi@0 | 49 | Vector<BuildConfig> allConfigs) throws IOException { |
aoqi@0 | 50 | System.out.println(); |
aoqi@0 | 51 | System.out.println(" Writing .vcxproj file: " + projectFileName); |
aoqi@0 | 52 | |
aoqi@0 | 53 | String projDir = Util.normalize(new File(projectFileName).getParent()); |
aoqi@0 | 54 | |
aoqi@0 | 55 | printWriter = new PrintWriter(projectFileName, "UTF-8"); |
aoqi@0 | 56 | printWriter.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); |
aoqi@0 | 57 | startTag("Project", |
aoqi@0 | 58 | "DefaultTargets", "Build", |
aoqi@0 | 59 | "ToolsVersion", "4.0", |
aoqi@0 | 60 | "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); |
aoqi@0 | 61 | startTag("ItemGroup", |
aoqi@0 | 62 | "Label", "ProjectConfigurations"); |
aoqi@0 | 63 | for (BuildConfig cfg : allConfigs) { |
aoqi@0 | 64 | startTag("ProjectConfiguration", |
aoqi@0 | 65 | "Include", cfg.get("Name")); |
aoqi@0 | 66 | tagData("Configuration", cfg.get("Id")); |
aoqi@0 | 67 | tagData("Platform", cfg.get("PlatformName")); |
aoqi@0 | 68 | endTag(); |
aoqi@0 | 69 | } |
aoqi@0 | 70 | endTag(); |
aoqi@0 | 71 | |
aoqi@0 | 72 | startTag("PropertyGroup", "Label", "Globals"); |
aoqi@0 | 73 | tagData("ProjectGuid", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}"); |
aoqi@0 | 74 | tag("SccProjectName"); |
aoqi@0 | 75 | tag("SccLocalPath"); |
aoqi@0 | 76 | endTag(); |
aoqi@0 | 77 | |
aoqi@0 | 78 | tag("Import", "Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); |
aoqi@0 | 79 | |
aoqi@0 | 80 | for (BuildConfig cfg : allConfigs) { |
aoqi@0 | 81 | startTag(cfg, "PropertyGroup", "Label", "Configuration"); |
aoqi@0 | 82 | tagData("ConfigurationType", "DynamicLibrary"); |
aoqi@0 | 83 | tagData("UseOfMfc", "false"); |
aoqi@0 | 84 | endTag(); |
aoqi@0 | 85 | } |
aoqi@0 | 86 | |
aoqi@0 | 87 | tag("Import", "Project", "$(VCTargetsPath)\\Microsoft.Cpp.props"); |
aoqi@0 | 88 | startTag("ImportGroup", "Label", "ExtensionSettings"); |
aoqi@0 | 89 | endTag(); |
aoqi@0 | 90 | for (BuildConfig cfg : allConfigs) { |
aoqi@0 | 91 | startTag(cfg, "ImportGroup", "Label", "PropertySheets"); |
aoqi@0 | 92 | tag("Import", |
aoqi@0 | 93 | "Project", "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props", |
aoqi@0 | 94 | "Condition", "exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')", |
aoqi@0 | 95 | "Label", "LocalAppDataPlatform"); |
aoqi@0 | 96 | endTag(); |
aoqi@0 | 97 | } |
aoqi@0 | 98 | |
aoqi@0 | 99 | tag("PropertyGroup", "Label", "UserMacros"); |
aoqi@0 | 100 | |
aoqi@0 | 101 | startTag("PropertyGroup"); |
aoqi@0 | 102 | tagData("_ProjectFileVersion", "10.0.30319.1"); |
aoqi@0 | 103 | for (BuildConfig cfg : allConfigs) { |
aoqi@0 | 104 | tagData(cfg, "OutDir", cfg.get("OutputDir") + Util.sep); |
aoqi@0 | 105 | tagData(cfg, "IntDir", cfg.get("OutputDir") + Util.sep); |
aoqi@0 | 106 | tagData(cfg, "LinkIncremental", "false"); |
aoqi@0 | 107 | } |
aoqi@0 | 108 | for (BuildConfig cfg : allConfigs) { |
aoqi@0 | 109 | tagData(cfg, "CodeAnalysisRuleSet", "AllRules.ruleset"); |
aoqi@0 | 110 | tag(cfg, "CodeAnalysisRules"); |
aoqi@0 | 111 | tag(cfg, "CodeAnalysisRuleAssemblies"); |
aoqi@0 | 112 | } |
aoqi@0 | 113 | endTag(); |
aoqi@0 | 114 | |
aoqi@0 | 115 | for (BuildConfig cfg : allConfigs) { |
aoqi@0 | 116 | startTag(cfg, "ItemDefinitionGroup"); |
aoqi@0 | 117 | startTag("ClCompile"); |
aoqi@0 | 118 | tagV(cfg.getV("CompilerFlags")); |
aoqi@0 | 119 | endTag(); |
aoqi@0 | 120 | |
aoqi@0 | 121 | startTag("Link"); |
aoqi@0 | 122 | tagV(cfg.getV("LinkerFlags")); |
aoqi@0 | 123 | endTag(); |
aoqi@0 | 124 | |
aoqi@0 | 125 | startTag("PreLinkEvent"); |
aoqi@0 | 126 | tagData("Message", BuildConfig.getFieldString(null, "PrelinkDescription")); |
aoqi@0 | 127 | tagData("Command", cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand").replace("\t", "\r\n"))); |
aoqi@0 | 128 | endTag(); |
aoqi@0 | 129 | |
aoqi@0 | 130 | endTag(); |
aoqi@0 | 131 | } |
aoqi@0 | 132 | |
aoqi@0 | 133 | writeFiles(allConfigs, projDir); |
aoqi@0 | 134 | |
aoqi@0 | 135 | tag("Import", "Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets"); |
aoqi@0 | 136 | startTag("ImportGroup", "Label", "ExtensionTargets"); |
aoqi@0 | 137 | endTag(); |
aoqi@0 | 138 | |
aoqi@0 | 139 | endTag(); |
aoqi@0 | 140 | printWriter.close(); |
aoqi@0 | 141 | System.out.println(" Done writing .vcxproj file."); |
aoqi@0 | 142 | |
aoqi@0 | 143 | writeFilterFile(projectFileName, projectName, allConfigs, projDir); |
aoqi@0 | 144 | writeUserFile(projectFileName, allConfigs); |
aoqi@0 | 145 | } |
aoqi@0 | 146 | |
aoqi@0 | 147 | |
aoqi@0 | 148 | private void writeUserFile(String projectFileName, Vector<BuildConfig> allConfigs) throws FileNotFoundException, UnsupportedEncodingException { |
aoqi@0 | 149 | String userFileName = projectFileName + ".user"; |
aoqi@0 | 150 | if (new File(userFileName).exists()) { |
aoqi@0 | 151 | return; |
aoqi@0 | 152 | } |
aoqi@0 | 153 | System.out.print(" Writing .vcxproj.user file: " + userFileName); |
aoqi@0 | 154 | printWriter = new PrintWriter(userFileName, "UTF-8"); |
aoqi@0 | 155 | |
aoqi@0 | 156 | printWriter.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); |
aoqi@0 | 157 | startTag("Project", |
aoqi@0 | 158 | "ToolsVersion", "4.0", |
aoqi@0 | 159 | "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); |
aoqi@0 | 160 | |
aoqi@0 | 161 | for (BuildConfig cfg : allConfigs) { |
aoqi@0 | 162 | startTag(cfg, "PropertyGroup"); |
aoqi@0 | 163 | tagData("LocalDebuggerCommand", cfg.get("JdkTargetRoot") + "\\bin\\java.exe"); |
aoqi@0 | 164 | tagData("LocalDebuggerCommandArguments", "-XXaltjvm=$(TargetDir) -Dsun.java.launcher=gamma"); |
aoqi@0 | 165 | tagData("LocalDebuggerEnvironment", "JAVA_HOME=" + cfg.get("JdkTargetRoot")); |
aoqi@0 | 166 | endTag(); |
aoqi@0 | 167 | } |
aoqi@0 | 168 | |
aoqi@0 | 169 | endTag(); |
aoqi@0 | 170 | printWriter.close(); |
aoqi@0 | 171 | System.out.println(" Done."); |
aoqi@0 | 172 | } |
aoqi@0 | 173 | |
aoqi@0 | 174 | public void addFilter(String rPath) { |
aoqi@0 | 175 | filters.add(rPath); |
aoqi@0 | 176 | } |
aoqi@0 | 177 | |
aoqi@0 | 178 | public void addFilterDependency(String fileLoc, String filter) { |
aoqi@0 | 179 | filterDeps.add(new String[] {fileLoc, filter}); |
aoqi@0 | 180 | } |
aoqi@0 | 181 | |
aoqi@0 | 182 | private void writeFilterFile(String projectFileName, String projectName, |
aoqi@0 | 183 | Vector<BuildConfig> allConfigs, String base) throws FileNotFoundException, UnsupportedEncodingException { |
aoqi@0 | 184 | String filterFileName = projectFileName + ".filters"; |
aoqi@0 | 185 | System.out.print(" Writing .vcxproj.filters file: " + filterFileName); |
aoqi@0 | 186 | printWriter = new PrintWriter(filterFileName, "UTF-8"); |
aoqi@0 | 187 | |
aoqi@0 | 188 | printWriter.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); |
aoqi@0 | 189 | startTag("Project", |
aoqi@0 | 190 | "ToolsVersion", "4.0", |
aoqi@0 | 191 | "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); |
aoqi@0 | 192 | |
aoqi@0 | 193 | startTag("ItemGroup"); |
aoqi@0 | 194 | for (String filter : filters) { |
aoqi@0 | 195 | startTag("Filter", "Include",filter); |
aoqi@0 | 196 | UUID uuid = UUID.randomUUID(); |
aoqi@0 | 197 | tagData("UniqueIdentifier", "{" + uuid.toString() + "}"); |
aoqi@0 | 198 | endTag(); |
aoqi@0 | 199 | } |
aoqi@0 | 200 | startTag("Filter", "Include", "Resource Files"); |
aoqi@0 | 201 | UUID uuid = UUID.randomUUID(); |
aoqi@0 | 202 | tagData("UniqueIdentifier", "{" + uuid.toString() + "}"); |
aoqi@0 | 203 | tagData("Extensions", "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"); |
aoqi@0 | 204 | endTag(); |
aoqi@0 | 205 | endTag(); |
aoqi@0 | 206 | |
aoqi@0 | 207 | //TODO - do I need to split cpp and hpp files? |
aoqi@0 | 208 | |
aoqi@0 | 209 | // then all files |
aoqi@0 | 210 | startTag("ItemGroup"); |
aoqi@0 | 211 | for (String[] dep : filterDeps) { |
aoqi@0 | 212 | String tagName = getFileTagFromSuffix(dep[0]); |
aoqi@0 | 213 | |
aoqi@0 | 214 | startTag(tagName, "Include", dep[0]); |
aoqi@0 | 215 | tagData("Filter", dep[1]); |
aoqi@0 | 216 | endTag(); |
aoqi@0 | 217 | } |
aoqi@0 | 218 | endTag(); |
aoqi@0 | 219 | |
aoqi@0 | 220 | endTag(); |
aoqi@0 | 221 | printWriter.close(); |
aoqi@0 | 222 | System.out.println(" Done."); |
aoqi@0 | 223 | } |
aoqi@0 | 224 | |
aoqi@0 | 225 | public String getFileTagFromSuffix(String fileName) { |
aoqi@0 | 226 | if (fileName.endsWith(".cpp")) { |
aoqi@0 | 227 | return"ClCompile"; |
aoqi@0 | 228 | } else if (fileName.endsWith(".c")) { |
aoqi@0 | 229 | return "ClCompile"; |
aoqi@0 | 230 | } else if (fileName.endsWith(".hpp")) { |
aoqi@0 | 231 | return"ClInclude"; |
aoqi@0 | 232 | } else if (fileName.endsWith(".h")) { |
aoqi@0 | 233 | return "ClInclude"; |
aoqi@0 | 234 | } else { |
aoqi@0 | 235 | return"None"; |
aoqi@0 | 236 | } |
aoqi@0 | 237 | } |
aoqi@0 | 238 | |
aoqi@0 | 239 | void writeFiles(Vector<BuildConfig> allConfigs, String projDir) { |
aoqi@0 | 240 | // This code assummes there are no config specific includes. |
aoqi@0 | 241 | startTag("ItemGroup"); |
aoqi@0 | 242 | |
aoqi@0 | 243 | String sourceBase = BuildConfig.getFieldString(null, "SourceBase"); |
aoqi@0 | 244 | |
aoqi@0 | 245 | // Use first config for all global absolute includes. |
aoqi@0 | 246 | BuildConfig baseConfig = allConfigs.firstElement(); |
aoqi@0 | 247 | Vector<String> rv = new Vector<String>(); |
aoqi@0 | 248 | |
aoqi@0 | 249 | // Then use first config for all relative includes |
aoqi@0 | 250 | Vector<String> ri = new Vector<String>(); |
aoqi@0 | 251 | baseConfig.collectRelevantVectors(ri, "RelativeSrcInclude"); |
aoqi@0 | 252 | for (String f : ri) { |
aoqi@0 | 253 | rv.add(sourceBase + Util.sep + f); |
aoqi@0 | 254 | } |
aoqi@0 | 255 | |
aoqi@0 | 256 | baseConfig.collectRelevantVectors(rv, "AbsoluteSrcInclude"); |
aoqi@0 | 257 | |
aoqi@0 | 258 | handleIncludes(rv, allConfigs); |
aoqi@0 | 259 | |
aoqi@0 | 260 | endTag(); |
aoqi@0 | 261 | } |
aoqi@0 | 262 | |
aoqi@0 | 263 | // Will visit file tree for each include |
aoqi@0 | 264 | private void handleIncludes(Vector<String> includes, Vector<BuildConfig> allConfigs) { |
aoqi@0 | 265 | for (String path : includes) { |
aoqi@0 | 266 | FileTreeCreatorVC10 ftc = new FileTreeCreatorVC10(FileSystems.getDefault().getPath(path) , allConfigs, this); |
aoqi@0 | 267 | try { |
aoqi@0 | 268 | ftc.writeFileTree(); |
aoqi@0 | 269 | } catch (IOException e) { |
aoqi@0 | 270 | e.printStackTrace(); |
aoqi@0 | 271 | } |
aoqi@0 | 272 | } |
aoqi@0 | 273 | } |
aoqi@0 | 274 | |
aoqi@0 | 275 | String buildCond(BuildConfig cfg) { |
aoqi@0 | 276 | return "'$(Configuration)|$(Platform)'=='"+cfg.get("Name")+"'"; |
aoqi@0 | 277 | } |
aoqi@0 | 278 | |
aoqi@0 | 279 | void tagV(Vector<String> v) { |
aoqi@0 | 280 | Iterator<String> i = v.iterator(); |
aoqi@0 | 281 | while(i.hasNext()) { |
aoqi@0 | 282 | String name = i.next(); |
aoqi@0 | 283 | String data = i.next(); |
aoqi@0 | 284 | tagData(name, data); |
aoqi@0 | 285 | } |
aoqi@0 | 286 | } |
aoqi@0 | 287 | |
aoqi@0 | 288 | void tagData(BuildConfig cfg, String name, String data) { |
aoqi@0 | 289 | tagData(name, data, "Condition", buildCond(cfg)); |
aoqi@0 | 290 | } |
aoqi@0 | 291 | |
aoqi@0 | 292 | void tag(BuildConfig cfg, String name, String... attrs) { |
aoqi@0 | 293 | String[] ss = new String[attrs.length + 2]; |
aoqi@0 | 294 | ss[0] = "Condition"; |
aoqi@0 | 295 | ss[1] = buildCond(cfg); |
aoqi@0 | 296 | System.arraycopy(attrs, 0, ss, 2, attrs.length); |
aoqi@0 | 297 | |
aoqi@0 | 298 | tag(name, ss); |
aoqi@0 | 299 | } |
aoqi@0 | 300 | |
aoqi@0 | 301 | void startTag(BuildConfig cfg, String name, String... attrs) { |
aoqi@0 | 302 | String[] ss = new String[attrs.length + 2]; |
aoqi@0 | 303 | ss[0] = "Condition"; |
aoqi@0 | 304 | ss[1] = buildCond(cfg); |
aoqi@0 | 305 | System.arraycopy(attrs, 0, ss, 2, attrs.length); |
aoqi@0 | 306 | |
aoqi@0 | 307 | startTag(name, ss); |
aoqi@0 | 308 | } |
aoqi@0 | 309 | |
aoqi@0 | 310 | } |
aoqi@0 | 311 | |
aoqi@0 | 312 | class CompilerInterfaceVC10 extends CompilerInterface { |
aoqi@0 | 313 | |
aoqi@0 | 314 | @Override |
aoqi@0 | 315 | Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) { |
aoqi@0 | 316 | Vector rv = new Vector(); |
aoqi@0 | 317 | |
aoqi@0 | 318 | addAttr(rv, "AdditionalIncludeDirectories", Util.join(";", includes)); |
aoqi@0 | 319 | addAttr(rv, "PreprocessorDefinitions", |
aoqi@0 | 320 | Util.join(";", defines).replace("\\\"", "\"")); |
aoqi@0 | 321 | addAttr(rv, "PrecompiledHeaderFile", "precompiled.hpp"); |
aoqi@0 | 322 | addAttr(rv, "PrecompiledHeaderOutputFile", outDir+Util.sep+"vm.pch"); |
aoqi@0 | 323 | addAttr(rv, "AssemblerListingLocation", outDir); |
aoqi@0 | 324 | addAttr(rv, "ObjectFileName", outDir+Util.sep); |
aoqi@0 | 325 | addAttr(rv, "ProgramDataBaseFileName", outDir+Util.sep+"jvm.pdb"); |
aoqi@0 | 326 | // Set /nologo option |
aoqi@0 | 327 | addAttr(rv, "SuppressStartupBanner", "true"); |
aoqi@0 | 328 | // Surpass the default /Tc or /Tp. |
aoqi@0 | 329 | addAttr(rv, "CompileAs", "Default"); |
aoqi@0 | 330 | // Set /W3 option. |
aoqi@0 | 331 | addAttr(rv, "WarningLevel", "Level3"); |
aoqi@0 | 332 | // Set /WX option, |
aoqi@0 | 333 | addAttr(rv, "TreatWarningAsError", "true"); |
aoqi@0 | 334 | // Set /GS option |
aoqi@0 | 335 | addAttr(rv, "BufferSecurityCheck", "false"); |
aoqi@0 | 336 | // Set /Zi option. |
aoqi@0 | 337 | addAttr(rv, "DebugInformationFormat", "ProgramDatabase"); |
aoqi@0 | 338 | // Set /Yu option. |
aoqi@0 | 339 | addAttr(rv, "PrecompiledHeader", "Use"); |
aoqi@0 | 340 | // Set /EHsc- option |
aoqi@0 | 341 | addAttr(rv, "ExceptionHandling", ""); |
aoqi@0 | 342 | |
aoqi@0 | 343 | addAttr(rv, "MultiProcessorCompilation", "true"); |
aoqi@0 | 344 | |
aoqi@0 | 345 | return rv; |
aoqi@0 | 346 | } |
aoqi@0 | 347 | |
aoqi@0 | 348 | @Override |
aoqi@0 | 349 | Vector getDebugCompilerFlags(String opt) { |
aoqi@0 | 350 | Vector rv = new Vector(); |
aoqi@0 | 351 | |
aoqi@0 | 352 | // Set /On option |
aoqi@0 | 353 | addAttr(rv, "Optimization", opt); |
aoqi@0 | 354 | // Set /FR option. |
aoqi@0 | 355 | addAttr(rv, "BrowseInformation", "true"); |
aoqi@0 | 356 | addAttr(rv, "BrowseInformationFile", "$(IntDir)"); |
aoqi@0 | 357 | // Set /MD option. |
aoqi@0 | 358 | addAttr(rv, "RuntimeLibrary", "MultiThreadedDLL"); |
aoqi@0 | 359 | // Set /Oy- option |
aoqi@0 | 360 | addAttr(rv, "OmitFramePointers", "false"); |
aoqi@0 | 361 | |
aoqi@0 | 362 | return rv; |
aoqi@0 | 363 | } |
aoqi@0 | 364 | |
aoqi@0 | 365 | @Override |
aoqi@0 | 366 | Vector getProductCompilerFlags() { |
aoqi@0 | 367 | Vector rv = new Vector(); |
aoqi@0 | 368 | |
aoqi@0 | 369 | // Set /O2 option. |
aoqi@0 | 370 | addAttr(rv, "Optimization", "MaxSpeed"); |
aoqi@0 | 371 | // Set /Oy- option |
aoqi@0 | 372 | addAttr(rv, "OmitFramePointers", "false"); |
aoqi@0 | 373 | // Set /Ob option. 1 is expandOnlyInline |
aoqi@0 | 374 | addAttr(rv, "InlineFunctionExpansion", "OnlyExplicitInline"); |
aoqi@0 | 375 | // Set /GF option. |
aoqi@0 | 376 | addAttr(rv, "StringPooling", "true"); |
aoqi@0 | 377 | // Set /MD option. 2 is rtMultiThreadedDLL |
aoqi@0 | 378 | addAttr(rv, "RuntimeLibrary", "MultiThreadedDLL"); |
aoqi@0 | 379 | // Set /Gy option |
aoqi@0 | 380 | addAttr(rv, "FunctionLevelLinking", "true"); |
aoqi@0 | 381 | |
aoqi@0 | 382 | return rv; |
aoqi@0 | 383 | } |
aoqi@0 | 384 | |
aoqi@0 | 385 | @Override |
aoqi@0 | 386 | Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) { |
aoqi@0 | 387 | Vector rv = new Vector(); |
aoqi@0 | 388 | |
aoqi@0 | 389 | addAttr(rv, "AdditionalOptions", |
aoqi@0 | 390 | "/export:JNI_GetDefaultJavaVMInitArgs " + |
aoqi@0 | 391 | "/export:JNI_CreateJavaVM " + |
aoqi@0 | 392 | "/export:JVM_FindClassFromBootLoader "+ |
aoqi@0 | 393 | "/export:JNI_GetCreatedJavaVMs "+ |
aoqi@0 | 394 | "/export:jio_snprintf /export:jio_printf "+ |
aoqi@0 | 395 | "/export:jio_fprintf /export:jio_vfprintf "+ |
aoqi@0 | 396 | "/export:jio_vsnprintf "+ |
aoqi@0 | 397 | "/export:JVM_GetVersionInfo "+ |
aoqi@0 | 398 | "/export:JVM_GetThreadStateNames "+ |
aoqi@0 | 399 | "/export:JVM_GetThreadStateValues "+ |
aoqi@0 | 400 | "/export:JVM_InitAgentProperties"); |
aoqi@0 | 401 | 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;psapi.lib"); |
aoqi@0 | 402 | addAttr(rv, "OutputFile", outDll); |
aoqi@0 | 403 | addAttr(rv, "SuppressStartupBanner", "true"); |
aoqi@0 | 404 | addAttr(rv, "ModuleDefinitionFile", outDir+Util.sep+"vm.def"); |
aoqi@0 | 405 | addAttr(rv, "ProgramDatabaseFile", outDir+Util.sep+"jvm.pdb"); |
aoqi@0 | 406 | addAttr(rv, "SubSystem", "Windows"); |
aoqi@0 | 407 | addAttr(rv, "BaseAddress", "0x8000000"); |
aoqi@0 | 408 | addAttr(rv, "ImportLibrary", outDir+Util.sep+"jvm.lib"); |
aoqi@0 | 409 | |
aoqi@0 | 410 | if(platformName.equals("Win32")) { |
aoqi@0 | 411 | addAttr(rv, "TargetMachine", "MachineX86"); |
aoqi@0 | 412 | } else { |
aoqi@0 | 413 | addAttr(rv, "TargetMachine", "MachineX64"); |
aoqi@0 | 414 | } |
aoqi@0 | 415 | |
aoqi@0 | 416 | // We always want the /DEBUG option to get full symbol information in the pdb files |
aoqi@0 | 417 | addAttr(rv, "GenerateDebugInformation", "true"); |
aoqi@0 | 418 | |
aoqi@0 | 419 | return rv; |
aoqi@0 | 420 | } |
aoqi@0 | 421 | |
aoqi@0 | 422 | @Override |
aoqi@0 | 423 | Vector getDebugLinkerFlags() { |
aoqi@0 | 424 | Vector rv = new Vector(); |
aoqi@0 | 425 | |
aoqi@0 | 426 | // Empty now that /DEBUG option is used by all configs |
aoqi@0 | 427 | |
aoqi@0 | 428 | return rv; |
aoqi@0 | 429 | } |
aoqi@0 | 430 | |
aoqi@0 | 431 | @Override |
aoqi@0 | 432 | Vector getProductLinkerFlags() { |
aoqi@0 | 433 | Vector rv = new Vector(); |
aoqi@0 | 434 | |
aoqi@0 | 435 | // Set /OPT:REF option. |
aoqi@0 | 436 | addAttr(rv, "OptimizeReferences", "true"); |
aoqi@0 | 437 | // Set /OPT:ICF option. |
aoqi@0 | 438 | addAttr(rv, "EnableCOMDATFolding", "true"); |
aoqi@0 | 439 | |
aoqi@0 | 440 | return rv; |
aoqi@0 | 441 | } |
aoqi@0 | 442 | |
aoqi@0 | 443 | @Override |
aoqi@0 | 444 | void getAdditionalNonKernelLinkerFlags(Vector rv) { |
aoqi@0 | 445 | extAttr(rv, "AdditionalOptions", " /export:AsyncGetCallTrace"); |
aoqi@0 | 446 | } |
aoqi@0 | 447 | |
aoqi@0 | 448 | @Override |
aoqi@0 | 449 | String getOptFlag() { |
aoqi@0 | 450 | return "MaxSpeed"; |
aoqi@0 | 451 | } |
aoqi@0 | 452 | |
aoqi@0 | 453 | @Override |
aoqi@0 | 454 | String getNoOptFlag() { |
aoqi@0 | 455 | return "Disabled"; |
aoqi@0 | 456 | } |
aoqi@0 | 457 | |
aoqi@0 | 458 | @Override |
aoqi@0 | 459 | String makeCfgName(String flavourBuild, String platform) { |
aoqi@0 | 460 | return flavourBuild + "|" + platform; |
aoqi@0 | 461 | } |
aoqi@0 | 462 | |
aoqi@0 | 463 | } |