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