hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java
author jlaskey
Tue, 23 Jul 2013 12:00:29 -0300
changeset 19089 51cfdcf21d35
parent 17382 bba473b81ec0
child 19270 607d97508c60
permissions -rw-r--r--
8021130: Comments need to be tokens Reviewed-by: lagergren, attila Contributed-by: james.laskey@oracle.com
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("PreLinkEvent");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   102
            tagData("Message", BuildConfig.getFieldString(null, "PrelinkDescription"));
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   103
            tagData("Command", cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand").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
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   106
            endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   107
        }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   108
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   109
        writeFiles(allConfigs, projDir);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   110
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   111
        tag("Import", "Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   112
        startTag("ImportGroup", "Label", "ExtensionTargets");
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   113
        endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   114
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   115
        endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   116
        printWriter.close();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   117
        System.out.println("    Done.");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   118
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   119
        writeFilterFile(projectFileName, projectName, allConfigs, projDir);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   120
        writeUserFile(projectFileName, allConfigs);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   121
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   122
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   123
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   124
    private void writeUserFile(String projectFileName, Vector<BuildConfig> allConfigs) throws FileNotFoundException, UnsupportedEncodingException {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   125
        String userFileName = projectFileName + ".user";
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   126
        if (new File(userFileName).exists()) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   127
            return;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   128
        }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   129
        System.out.print("    Writing .vcxproj.user file: " + userFileName);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   130
        printWriter = new PrintWriter(userFileName, "UTF-8");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   131
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   132
        printWriter.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   133
        startTag("Project",
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   134
                "ToolsVersion", "4.0",
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   135
                "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   136
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   137
        for (BuildConfig cfg : allConfigs) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   138
            startTag(cfg, "PropertyGroup");
17382
bba473b81ec0 8008772: remove gamma launcher
twisti
parents: 13892
diff changeset
   139
            tagData("LocalDebuggerCommand", cfg.get("JdkTargetRoot") + "\\bin\\java.exe");
bba473b81ec0 8008772: remove gamma launcher
twisti
parents: 13892
diff changeset
   140
            tagData("LocalDebuggerCommandArguments", "-XXaltjvm=$(TargetDir) -Dsun.java.launcher=gamma");
bba473b81ec0 8008772: remove gamma launcher
twisti
parents: 13892
diff changeset
   141
            tagData("LocalDebuggerEnvironment", "JAVA_HOME=" + cfg.get("JdkTargetRoot"));
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   142
            endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   143
        }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   144
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
        printWriter.close();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   147
        System.out.println("    Done.");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   148
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   149
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   150
    public void addFilter(String rPath) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   151
       filters.add(rPath);
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   152
    }
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   153
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   154
    public void addFilterDependency(String fileLoc, String filter) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   155
      filterDeps.add(new String[] {fileLoc, filter});
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   156
    }
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   157
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   158
    private void writeFilterFile(String projectFileName, String projectName,
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   159
            Vector<BuildConfig> allConfigs, String base) throws FileNotFoundException, UnsupportedEncodingException {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   160
        String filterFileName = projectFileName + ".filters";
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   161
        System.out.print("    Writing .vcxproj.filters file: " + filterFileName);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   162
        printWriter = new PrintWriter(filterFileName, "UTF-8");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   163
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   164
        printWriter.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   165
        startTag("Project",
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   166
                "ToolsVersion", "4.0",
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   167
                "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   168
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   169
        startTag("ItemGroup");
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   170
        for (String filter : filters) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   171
           startTag("Filter", "Include",filter);
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   172
           UUID uuid = UUID.randomUUID();
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   173
           tagData("UniqueIdentifier", "{" + uuid.toString() + "}");
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   174
           endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   175
        }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   176
        startTag("Filter", "Include", "Resource Files");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   177
        UUID uuid = UUID.randomUUID();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   178
        tagData("UniqueIdentifier", "{" + uuid.toString() + "}");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   179
        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
   180
        endTag();
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   181
        endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   182
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   183
        //TODO - do I need to split cpp and hpp files?
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   184
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   185
        // then all files
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   186
        startTag("ItemGroup");
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   187
        for (String[] dep : filterDeps) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   188
           String tagName = getFileTagFromSuffix(dep[0]);
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   189
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   190
           startTag(tagName, "Include", dep[0]);
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   191
           tagData("Filter", dep[1]);
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   192
           endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   193
        }
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   194
        endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   195
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   196
        endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   197
        printWriter.close();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   198
        System.out.println("    Done.");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   199
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   200
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   201
    public String getFileTagFromSuffix(String fileName) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   202
       if (fileName.endsWith(".cpp")) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   203
          return"ClCompile";
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   204
       } else if (fileName.endsWith(".c")) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   205
          return "ClCompile";
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   206
       } else if (fileName.endsWith(".hpp")) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   207
          return"ClInclude";
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   208
       } else if (fileName.endsWith(".h")) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   209
          return "ClInclude";
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   210
       } else {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   211
          return"None";
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   212
       }
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   213
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   214
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   215
    void writeFiles(Vector<BuildConfig> allConfigs, String projDir) {
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   216
       // This code assummes there are no config specific includes.
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   217
       startTag("ItemGroup");
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   218
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   219
       String sourceBase = BuildConfig.getFieldString(null, "SourceBase");
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   220
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   221
       // Use first config for all global absolute includes.
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   222
       BuildConfig baseConfig = allConfigs.firstElement();
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   223
       Vector<String> rv = new Vector<String>();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   224
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   225
       // Then use first config for all relative includes
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   226
       Vector<String> ri = new Vector<String>();
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   227
       baseConfig.collectRelevantVectors(ri, "RelativeSrcInclude");
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   228
       for (String f : ri) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   229
          rv.add(sourceBase + Util.sep + f);
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   230
       }
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   231
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   232
       baseConfig.collectRelevantVectors(rv, "AbsoluteSrcInclude");
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   233
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   234
       handleIncludes(rv, allConfigs);
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   235
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   236
       endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   237
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   238
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   239
    // Will visit file tree for each include
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   240
    private void handleIncludes(Vector<String> includes, Vector<BuildConfig> allConfigs) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   241
       for (String path : includes)  {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   242
          FileTreeCreatorVC10 ftc = new FileTreeCreatorVC10(FileSystems.getDefault().getPath(path) , allConfigs, this);
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   243
          try {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   244
             ftc.writeFileTree();
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   245
          } catch (IOException e) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   246
             e.printStackTrace();
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   247
          }
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   248
       }
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   249
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   250
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   251
    String buildCond(BuildConfig cfg) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   252
        return "'$(Configuration)|$(Platform)'=='"+cfg.get("Name")+"'";
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   253
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   254
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   255
    void tagV(Vector<String> v) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   256
        Iterator<String> i = v.iterator();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   257
        while(i.hasNext()) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   258
            String name = i.next();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   259
            String data = i.next();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   260
            tagData(name, data);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   261
        }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   262
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   263
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   264
    void tagData(BuildConfig cfg, String name, String data) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   265
        tagData(name, data, "Condition", buildCond(cfg));
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   266
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   267
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   268
    void tag(BuildConfig cfg, String name, String... attrs) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   269
        String[] ss = new String[attrs.length + 2];
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   270
        ss[0] = "Condition";
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   271
        ss[1] = buildCond(cfg);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   272
        System.arraycopy(attrs, 0, ss, 2, attrs.length);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   273
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   274
        tag(name, ss);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   275
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   276
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   277
    void startTag(BuildConfig cfg, String name, String... attrs) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   278
        String[] ss = new String[attrs.length + 2];
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   279
        ss[0] = "Condition";
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   280
        ss[1] = buildCond(cfg);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   281
        System.arraycopy(attrs, 0, ss, 2, attrs.length);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   282
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   283
        startTag(name, ss);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   284
    }
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   285
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   286
}
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   287
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   288
class CompilerInterfaceVC10 extends CompilerInterface {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   289
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   290
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   291
    Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   292
        Vector rv = new Vector();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   293
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   294
        addAttr(rv, "AdditionalIncludeDirectories", Util.join(";", includes));
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   295
        addAttr(rv, "PreprocessorDefinitions",
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   296
                Util.join(";", defines).replace("\\\"", "\""));
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   297
        addAttr(rv, "PrecompiledHeaderFile", "precompiled.hpp");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   298
        addAttr(rv, "PrecompiledHeaderOutputFile", outDir+Util.sep+"vm.pch");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   299
        addAttr(rv, "AssemblerListingLocation", outDir);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   300
        addAttr(rv, "ObjectFileName", outDir+Util.sep);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   301
        addAttr(rv, "ProgramDataBaseFileName", outDir+Util.sep+"jvm.pdb");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   302
        // Set /nologo option
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   303
        addAttr(rv, "SuppressStartupBanner", "true");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   304
        // Surpass the default /Tc or /Tp.
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   305
        addAttr(rv, "CompileAs", "Default");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   306
        // Set /W3 option.
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   307
        addAttr(rv, "WarningLevel", "Level3");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   308
        // Set /WX option,
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   309
        addAttr(rv, "TreatWarningAsError", "true");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   310
        // Set /GS option
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   311
        addAttr(rv, "BufferSecurityCheck", "false");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   312
        // Set /Zi option.
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   313
        addAttr(rv, "DebugInformationFormat", "ProgramDatabase");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   314
        // Set /Yu option.
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   315
        addAttr(rv, "PrecompiledHeader", "Use");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   316
        // Set /EHsc- option
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   317
        addAttr(rv, "ExceptionHandling", "");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   318
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   319
        addAttr(rv, "MultiProcessorCompilation", "true");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   320
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   321
        return rv;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   322
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   323
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   324
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   325
    Vector getDebugCompilerFlags(String opt) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   326
        Vector rv = new Vector();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   327
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   328
        // Set /On option
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   329
        addAttr(rv, "Optimization", opt);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   330
        // Set /FR option.
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   331
        addAttr(rv, "BrowseInformation", "true");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   332
        addAttr(rv, "BrowseInformationFile", "$(IntDir)");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   333
        // Set /MD option.
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   334
        addAttr(rv, "RuntimeLibrary", "MultiThreadedDLL");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   335
        // Set /Oy- option
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   336
        addAttr(rv, "OmitFramePointers", "false");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   337
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   338
        return rv;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   339
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   340
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   341
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   342
    Vector getProductCompilerFlags() {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   343
        Vector rv = new Vector();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   344
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   345
        // Set /O2 option.
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   346
        addAttr(rv, "Optimization", "MaxSpeed");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   347
        // Set /Oy- option
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   348
        addAttr(rv, "OmitFramePointers", "false");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   349
        // Set /Ob option.  1 is expandOnlyInline
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   350
        addAttr(rv, "InlineFunctionExpansion", "OnlyExplicitInline");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   351
        // Set /GF option.
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   352
        addAttr(rv, "StringPooling", "true");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   353
        // Set /MD option. 2 is rtMultiThreadedDLL
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   354
        addAttr(rv, "RuntimeLibrary", "MultiThreadedDLL");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   355
        // Set /Gy option
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   356
        addAttr(rv, "FunctionLevelLinking", "true");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   357
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   358
        return rv;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   359
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   360
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   361
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   362
    Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   363
        Vector rv = new Vector();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   364
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   365
        addAttr(rv, "AdditionalOptions",
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   366
                "/export:JNI_GetDefaultJavaVMInitArgs " +
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   367
                "/export:JNI_CreateJavaVM " +
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   368
                "/export:JVM_FindClassFromBootLoader "+
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   369
                "/export:JNI_GetCreatedJavaVMs "+
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   370
                "/export:jio_snprintf /export:jio_printf "+
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   371
                "/export:jio_fprintf /export:jio_vfprintf "+
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   372
                "/export:jio_vsnprintf "+
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   373
                "/export:JVM_GetVersionInfo "+
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   374
                "/export:JVM_GetThreadStateNames "+
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   375
                "/export:JVM_GetThreadStateValues "+
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   376
                "/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
   377
        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
   378
        addAttr(rv, "OutputFile", outDll);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   379
        addAttr(rv, "SuppressStartupBanner", "true");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   380
        addAttr(rv, "ModuleDefinitionFile", outDir+Util.sep+"vm.def");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   381
        addAttr(rv, "ProgramDatabaseFile", outDir+Util.sep+"jvm.pdb");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   382
        addAttr(rv, "SubSystem", "Windows");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   383
        addAttr(rv, "BaseAddress", "0x8000000");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   384
        addAttr(rv, "ImportLibrary", outDir+Util.sep+"jvm.lib");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   385
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   386
        if(platformName.equals("Win32")) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   387
            addAttr(rv, "TargetMachine", "MachineX86");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   388
        } else {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   389
            addAttr(rv, "TargetMachine", "MachineX64");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   390
        }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   391
9131
b41df1504406 7034625: Product builds in Visual Studio projects should produce full symbol information
brutisso
parents: 8860
diff changeset
   392
        // 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
   393
        addAttr(rv, "GenerateDebugInformation", "true");
b41df1504406 7034625: Product builds in Visual Studio projects should produce full symbol information
brutisso
parents: 8860
diff changeset
   394
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   395
        return rv;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   396
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   397
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   398
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   399
    Vector getDebugLinkerFlags() {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   400
        Vector rv = new Vector();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   401
9131
b41df1504406 7034625: Product builds in Visual Studio projects should produce full symbol information
brutisso
parents: 8860
diff changeset
   402
        // Empty now that /DEBUG option is used by all configs
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   403
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   404
        return rv;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   405
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   406
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   407
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   408
    Vector getProductLinkerFlags() {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   409
        Vector rv = new Vector();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   410
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   411
        // Set /OPT:REF option.
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   412
        addAttr(rv, "OptimizeReferences", "true");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   413
        // Set /OPT:ICF option.
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   414
        addAttr(rv, "EnableCOMDATFolding", "true");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   415
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   416
        return rv;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   417
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   418
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   419
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   420
    void getAdditionalNonKernelLinkerFlags(Vector rv) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   421
        extAttr(rv, "AdditionalOptions", " /export:AsyncGetCallTrace");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   422
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   423
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   424
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   425
    String getOptFlag() {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   426
        return "MaxSpeed";
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   427
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   428
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   429
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   430
    String getNoOptFlag() {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   431
        return "Disabled";
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   432
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   433
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   434
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   435
    String makeCfgName(String flavourBuild, String platform) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   436
        return  flavourBuild + "|" + platform;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   437
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   438
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   439
}