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