hotspot/make/src/classes/build/tools/projectcreator/WinGammaPlatformVC10.java
author duke
Wed, 05 Jul 2017 22:53:30 +0200
changeset 43880 b5015f742ba6
parent 43424 5c5d1360b2d3
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19270
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
     1
/*
43424
5c5d1360b2d3 8168137: import-hotspot build target not removed from hotspot-ide-project
ctornqvi
parents: 38247
diff changeset
     2
 * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
19270
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
     4
 *
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
     7
 * published by the Free Software Foundation.
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
     8
 *
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
    13
 * accompanied this code).
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
    14
 *
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
    18
 *
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
    21
 * questions.
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
    22
 *
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
    23
 */
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
    24
38247
6ff550a6307e 8156018: Hotspot visual studio project generation broken
erikj
parents: 31351
diff changeset
    25
package build.tools.projectcreator;
6ff550a6307e 8156018: Hotspot visual studio project generation broken
erikj
parents: 31351
diff changeset
    26
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    27
import java.io.File;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    28
import java.io.FileNotFoundException;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    29
import java.io.IOException;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    30
import java.io.PrintWriter;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    31
import java.io.UnsupportedEncodingException;
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
    32
import java.nio.file.FileSystems;
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    33
import java.util.Iterator;
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
    34
import java.util.LinkedList;
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    35
import java.util.UUID;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    36
import java.util.Vector;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    37
26681
d35d35fbbe43 8055719: Clean out support for old VC versions from ProjectCreator
ctornqvi
parents: 26293
diff changeset
    38
public class WinGammaPlatformVC10 extends WinGammaPlatform {
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    39
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
    40
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
    41
   LinkedList <String>filters = new LinkedList<String>();
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
    42
   LinkedList <String[]>filterDeps = new LinkedList<String[]>();
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
    43
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    44
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    45
    protected String getProjectExt() {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    46
        return ".vcxproj";
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    47
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    48
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    49
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    50
    public void writeProjectFile(String projectFileName, String projectName,
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    51
            Vector<BuildConfig> allConfigs) throws IOException {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    52
        System.out.println();
19270
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
    53
        System.out.println("    Writing .vcxproj file: " + projectFileName);
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    54
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    55
        String projDir = Util.normalize(new File(projectFileName).getParent());
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    56
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    57
        printWriter = new PrintWriter(projectFileName, "UTF-8");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    58
        printWriter.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    59
        startTag("Project",
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    60
                "DefaultTargets", "Build",
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    61
                "ToolsVersion", "4.0",
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    62
                "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    63
        startTag("ItemGroup",
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    64
                "Label", "ProjectConfigurations");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    65
        for (BuildConfig cfg : allConfigs) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    66
            startTag("ProjectConfiguration",
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    67
                    "Include", cfg.get("Name"));
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    68
            tagData("Configuration", cfg.get("Id"));
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    69
            tagData("Platform", cfg.get("PlatformName"));
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
    70
            endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    71
        }
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
        startTag("PropertyGroup", "Label", "Globals");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    75
        tagData("ProjectGuid", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}");
38247
6ff550a6307e 8156018: Hotspot visual studio project generation broken
erikj
parents: 31351
diff changeset
    76
        tagData("Keyword", "MakeFileProj");
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    77
        tag("SccProjectName");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    78
        tag("SccLocalPath");
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
    79
        endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    80
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    81
        tag("Import", "Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    82
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    83
        for (BuildConfig cfg : allConfigs) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    84
            startTag(cfg, "PropertyGroup", "Label", "Configuration");
38247
6ff550a6307e 8156018: Hotspot visual studio project generation broken
erikj
parents: 31351
diff changeset
    85
            tagData("ConfigurationType", "Makefile");
6ff550a6307e 8156018: Hotspot visual studio project generation broken
erikj
parents: 31351
diff changeset
    86
            tagData("UseDebugLibraries", "true");
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
    87
            endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    88
        }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    89
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    90
        tag("Import", "Project", "$(VCTargetsPath)\\Microsoft.Cpp.props");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    91
        startTag("ImportGroup", "Label", "ExtensionSettings");
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
    92
        endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    93
        for (BuildConfig cfg : allConfigs) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    94
            startTag(cfg, "ImportGroup", "Label", "PropertySheets");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    95
            tag("Import",
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    96
                    "Project", "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props",
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    97
                    "Condition", "exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')",
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
    98
                    "Label", "LocalAppDataPlatform");
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
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   102
        tag("PropertyGroup", "Label", "UserMacros");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   103
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   104
        startTag("PropertyGroup");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   105
        tagData("_ProjectFileVersion", "10.0.30319.1");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   106
        for (BuildConfig cfg : allConfigs) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   107
            tagData(cfg, "OutDir", cfg.get("OutputDir") + Util.sep);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   108
            tagData(cfg, "IntDir", cfg.get("OutputDir") + Util.sep);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   109
            tagData(cfg, "LinkIncremental", "false");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   110
        }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   111
        for (BuildConfig cfg : allConfigs) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   112
            tagData(cfg, "CodeAnalysisRuleSet", "AllRules.ruleset");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   113
            tag(cfg, "CodeAnalysisRules");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   114
            tag(cfg, "CodeAnalysisRuleAssemblies");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   115
        }
38247
6ff550a6307e 8156018: Hotspot visual studio project generation broken
erikj
parents: 31351
diff changeset
   116
        for (BuildConfig cfg : allConfigs) {
43424
5c5d1360b2d3 8168137: import-hotspot build target not removed from hotspot-ide-project
ctornqvi
parents: 38247
diff changeset
   117
            tagData(cfg, "NMakeBuildCommandLine", cfg.get("MakeBinary") + " -f ../../Makefile hotspot LOG=info");
5c5d1360b2d3 8168137: import-hotspot build target not removed from hotspot-ide-project
ctornqvi
parents: 38247
diff changeset
   118
            tagData(cfg, "NMakeReBuildCommandLine", cfg.get("MakeBinary") + " -f ../../Makefile clean-hotspot hotspot LOG=info");
38247
6ff550a6307e 8156018: Hotspot visual studio project generation broken
erikj
parents: 31351
diff changeset
   119
            tagData(cfg, "NMakeCleanCommandLine", cfg.get("MakeBinary") + " -f ../../Makefile clean-hotspot LOG=info");
6ff550a6307e 8156018: Hotspot visual studio project generation broken
erikj
parents: 31351
diff changeset
   120
            tagData(cfg, "NMakeOutput", cfg.get("MakeOutput") + Util.sep + "jvm.dll");
6ff550a6307e 8156018: Hotspot visual studio project generation broken
erikj
parents: 31351
diff changeset
   121
            tagData(cfg, "NMakePreprocessorDefinitions", Util.join(";", cfg.getDefines()));
6ff550a6307e 8156018: Hotspot visual studio project generation broken
erikj
parents: 31351
diff changeset
   122
            tagData(cfg, "NMakeIncludeSearchPath", Util.join(";", cfg.getIncludes()));
6ff550a6307e 8156018: Hotspot visual studio project generation broken
erikj
parents: 31351
diff changeset
   123
        }
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   124
        endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   125
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   126
        for (BuildConfig cfg : allConfigs) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   127
            startTag(cfg, "ItemDefinitionGroup");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   128
            startTag("ClCompile");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   129
            tagV(cfg.getV("CompilerFlags"));
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   130
            endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   131
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   132
            startTag("Link");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   133
            tagV(cfg.getV("LinkerFlags"));
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   134
            endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   135
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   136
            endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   137
        }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   138
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   139
        writeFiles(allConfigs, projDir);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   140
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   141
        tag("Import", "Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   142
        startTag("ImportGroup", "Label", "ExtensionTargets");
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   143
        endTag();
8860
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();
19270
607d97508c60 8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
dcubed
parents: 17382
diff changeset
   147
        System.out.println("    Done writing .vcxproj file.");
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   148
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   149
        writeFilterFile(projectFileName, projectName, allConfigs, projDir);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   150
        writeUserFile(projectFileName, allConfigs);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   151
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   152
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   153
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   154
    private void writeUserFile(String projectFileName, Vector<BuildConfig> allConfigs) throws FileNotFoundException, UnsupportedEncodingException {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   155
        String userFileName = projectFileName + ".user";
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   156
        if (new File(userFileName).exists()) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   157
            return;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   158
        }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   159
        System.out.print("    Writing .vcxproj.user file: " + userFileName);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   160
        printWriter = new PrintWriter(userFileName, "UTF-8");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   161
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   162
        printWriter.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   163
        startTag("Project",
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   164
                "ToolsVersion", "4.0",
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   165
                "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   166
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   167
        for (BuildConfig cfg : allConfigs) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   168
            startTag(cfg, "PropertyGroup");
17382
bba473b81ec0 8008772: remove gamma launcher
twisti
parents: 13892
diff changeset
   169
            tagData("LocalDebuggerCommand", cfg.get("JdkTargetRoot") + "\\bin\\java.exe");
38247
6ff550a6307e 8156018: Hotspot visual studio project generation broken
erikj
parents: 31351
diff changeset
   170
            // Since we run "make hotspot-import", we get the correct jvm.dll by java.exe.
6ff550a6307e 8156018: Hotspot visual studio project generation broken
erikj
parents: 31351
diff changeset
   171
            // The '-XX:+PauseAtExit' option
22734
41757c1f3946 8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents: 19270
diff changeset
   172
            // causes the VM to wait for key press before exiting; this
41757c1f3946 8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents: 19270
diff changeset
   173
            // allows any stdout or stderr messages to be seen before
41757c1f3946 8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents: 19270
diff changeset
   174
            // the cmdtool exits.
38247
6ff550a6307e 8156018: Hotspot visual studio project generation broken
erikj
parents: 31351
diff changeset
   175
            tagData("LocalDebuggerCommandArguments",
6ff550a6307e 8156018: Hotspot visual studio project generation broken
erikj
parents: 31351
diff changeset
   176
                    "-XX:+UnlockDiagnosticVMOptions -XX:+PauseAtExit");
17382
bba473b81ec0 8008772: remove gamma launcher
twisti
parents: 13892
diff changeset
   177
            tagData("LocalDebuggerEnvironment", "JAVA_HOME=" + cfg.get("JdkTargetRoot"));
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   178
            endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   179
        }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   180
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   181
        endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   182
        printWriter.close();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   183
        System.out.println("    Done.");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   184
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   185
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   186
    public void addFilter(String rPath) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   187
       filters.add(rPath);
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   188
    }
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   189
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   190
    public void addFilterDependency(String fileLoc, String filter) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   191
      filterDeps.add(new String[] {fileLoc, filter});
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   192
    }
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   193
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   194
    private void writeFilterFile(String projectFileName, String projectName,
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   195
            Vector<BuildConfig> allConfigs, String base) throws FileNotFoundException, UnsupportedEncodingException {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   196
        String filterFileName = projectFileName + ".filters";
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   197
        System.out.print("    Writing .vcxproj.filters file: " + filterFileName);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   198
        printWriter = new PrintWriter(filterFileName, "UTF-8");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   199
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   200
        printWriter.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   201
        startTag("Project",
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   202
                "ToolsVersion", "4.0",
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   203
                "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   204
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   205
        startTag("ItemGroup");
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   206
        for (String filter : filters) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   207
           startTag("Filter", "Include",filter);
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   208
           UUID uuid = UUID.randomUUID();
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   209
           tagData("UniqueIdentifier", "{" + uuid.toString() + "}");
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   210
           endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   211
        }
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   212
        endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   213
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   214
        //TODO - do I need to split cpp and hpp files?
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   215
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   216
        // then all files
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   217
        startTag("ItemGroup");
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   218
        for (String[] dep : filterDeps) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   219
           String tagName = getFileTagFromSuffix(dep[0]);
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   220
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   221
           startTag(tagName, "Include", dep[0]);
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   222
           tagData("Filter", dep[1]);
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   223
           endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   224
        }
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   225
        endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   226
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   227
        endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   228
        printWriter.close();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   229
        System.out.println("    Done.");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   230
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   231
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   232
    public String getFileTagFromSuffix(String fileName) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   233
       if (fileName.endsWith(".cpp")) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   234
          return"ClCompile";
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   235
       } else if (fileName.endsWith(".c")) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   236
          return "ClCompile";
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   237
       } else if (fileName.endsWith(".hpp")) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   238
          return"ClInclude";
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   239
       } else if (fileName.endsWith(".h")) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   240
          return "ClInclude";
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   241
       } else {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   242
          return"None";
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   243
       }
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   244
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   245
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   246
    void writeFiles(Vector<BuildConfig> allConfigs, String projDir) {
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   247
       // This code assummes there are no config specific includes.
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   248
       startTag("ItemGroup");
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   249
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   250
       String sourceBase = BuildConfig.getFieldString(null, "SourceBase");
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   251
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   252
       // Use first config for all global absolute includes.
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   253
       BuildConfig baseConfig = allConfigs.firstElement();
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   254
       Vector<String> rv = new Vector<String>();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   255
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   256
       // Then use first config for all relative includes
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   257
       Vector<String> ri = new Vector<String>();
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   258
       baseConfig.collectRelevantVectors(ri, "RelativeSrcInclude");
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   259
       for (String f : ri) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   260
          rv.add(sourceBase + Util.sep + f);
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   261
       }
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   262
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   263
       baseConfig.collectRelevantVectors(rv, "AbsoluteSrcInclude");
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   264
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   265
       handleIncludes(rv, allConfigs);
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   266
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   267
       endTag();
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   268
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   269
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   270
    // Will visit file tree for each include
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   271
    private void handleIncludes(Vector<String> includes, Vector<BuildConfig> allConfigs) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   272
       for (String path : includes)  {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   273
          FileTreeCreatorVC10 ftc = new FileTreeCreatorVC10(FileSystems.getDefault().getPath(path) , allConfigs, this);
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   274
          try {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   275
             ftc.writeFileTree();
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   276
          } catch (IOException e) {
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   277
             e.printStackTrace();
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   278
          }
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   279
       }
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   280
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   281
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   282
    String buildCond(BuildConfig cfg) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   283
        return "'$(Configuration)|$(Platform)'=='"+cfg.get("Name")+"'";
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   284
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   285
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   286
    void tagV(Vector<String> v) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   287
        Iterator<String> i = v.iterator();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   288
        while(i.hasNext()) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   289
            String name = i.next();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   290
            String data = i.next();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   291
            tagData(name, data);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   292
        }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   293
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   294
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   295
    void tagData(BuildConfig cfg, String name, String data) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   296
        tagData(name, data, "Condition", buildCond(cfg));
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   297
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   298
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   299
    void tag(BuildConfig cfg, String name, String... attrs) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   300
        String[] ss = new String[attrs.length + 2];
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   301
        ss[0] = "Condition";
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   302
        ss[1] = buildCond(cfg);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   303
        System.arraycopy(attrs, 0, ss, 2, attrs.length);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   304
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   305
        tag(name, ss);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   306
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   307
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   308
    void startTag(BuildConfig cfg, String name, String... attrs) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   309
        String[] ss = new String[attrs.length + 2];
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   310
        ss[0] = "Condition";
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   311
        ss[1] = buildCond(cfg);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   312
        System.arraycopy(attrs, 0, ss, 2, attrs.length);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   313
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   314
        startTag(name, ss);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   315
    }
13892
9ba13acea673 7163863: Updated projectcreator
neliasso
parents: 10284
diff changeset
   316
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   317
}
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   318
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   319
class CompilerInterfaceVC10 extends CompilerInterface {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   320
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   321
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   322
    Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   323
        Vector rv = new Vector();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   324
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   325
        addAttr(rv, "AdditionalIncludeDirectories", Util.join(";", includes));
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   326
        addAttr(rv, "PreprocessorDefinitions",
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   327
                Util.join(";", defines).replace("\\\"", "\""));
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   328
        addAttr(rv, "PrecompiledHeaderFile", "precompiled.hpp");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   329
        addAttr(rv, "PrecompiledHeaderOutputFile", outDir+Util.sep+"vm.pch");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   330
        addAttr(rv, "AssemblerListingLocation", outDir);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   331
        addAttr(rv, "ObjectFileName", outDir+Util.sep);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   332
        addAttr(rv, "ProgramDataBaseFileName", outDir+Util.sep+"jvm.pdb");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   333
        // Set /nologo option
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   334
        addAttr(rv, "SuppressStartupBanner", "true");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   335
        // Surpass the default /Tc or /Tp.
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   336
        addAttr(rv, "CompileAs", "Default");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   337
        // Set /W3 option.
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   338
        addAttr(rv, "WarningLevel", "Level3");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   339
        // Set /WX option,
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   340
        addAttr(rv, "TreatWarningAsError", "true");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   341
        // Set /GS option
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   342
        addAttr(rv, "BufferSecurityCheck", "false");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   343
        // Set /Zi option.
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   344
        addAttr(rv, "DebugInformationFormat", "ProgramDatabase");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   345
        // Set /Yu option.
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   346
        addAttr(rv, "PrecompiledHeader", "Use");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   347
        // Set /EHsc- option
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   348
        addAttr(rv, "ExceptionHandling", "");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   349
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   350
        addAttr(rv, "MultiProcessorCompilation", "true");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   351
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   352
        return rv;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   353
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   354
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   355
    @Override
26293
5c7a054e59fe 8027480: Build Windows x64 fastdebug builds using /homeparams
ctornqvi
parents: 22734
diff changeset
   356
    Vector getDebugCompilerFlags(String opt, String platformName) {
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   357
        Vector rv = new Vector();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   358
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   359
        // Set /On option
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   360
        addAttr(rv, "Optimization", opt);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   361
        // Set /MD option.
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   362
        addAttr(rv, "RuntimeLibrary", "MultiThreadedDLL");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   363
        // Set /Oy- option
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   364
        addAttr(rv, "OmitFramePointers", "false");
26293
5c7a054e59fe 8027480: Build Windows x64 fastdebug builds using /homeparams
ctornqvi
parents: 22734
diff changeset
   365
        // Set /homeparams for x64 debug builds
5c7a054e59fe 8027480: Build Windows x64 fastdebug builds using /homeparams
ctornqvi
parents: 22734
diff changeset
   366
        if(platformName.equals("x64")) {
5c7a054e59fe 8027480: Build Windows x64 fastdebug builds using /homeparams
ctornqvi
parents: 22734
diff changeset
   367
            addAttr(rv, "AdditionalOptions", "/homeparams");
5c7a054e59fe 8027480: Build Windows x64 fastdebug builds using /homeparams
ctornqvi
parents: 22734
diff changeset
   368
        }
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   369
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   370
        return rv;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   371
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   372
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   373
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   374
    Vector getProductCompilerFlags() {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   375
        Vector rv = new Vector();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   376
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   377
        // Set /O2 option.
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   378
        addAttr(rv, "Optimization", "MaxSpeed");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   379
        // Set /Oy- option
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   380
        addAttr(rv, "OmitFramePointers", "false");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   381
        // Set /Ob option.  1 is expandOnlyInline
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   382
        addAttr(rv, "InlineFunctionExpansion", "OnlyExplicitInline");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   383
        // Set /GF option.
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   384
        addAttr(rv, "StringPooling", "true");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   385
        // Set /MD option. 2 is rtMultiThreadedDLL
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   386
        addAttr(rv, "RuntimeLibrary", "MultiThreadedDLL");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   387
        // Set /Gy option
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   388
        addAttr(rv, "FunctionLevelLinking", "true");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   389
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   390
        return rv;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   391
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   392
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   393
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   394
    Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   395
        Vector rv = new Vector();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   396
27652
b07e72c58aef 8043491: warning LNK4197: export '... ...' specified multiple times; using first specification
ccheung
parents: 27467
diff changeset
   397
        if(platformName.equals("Win32")) {
b07e72c58aef 8043491: warning LNK4197: export '... ...' specified multiple times; using first specification
ccheung
parents: 27467
diff changeset
   398
            addAttr(rv, "AdditionalOptions",
b07e72c58aef 8043491: warning LNK4197: export '... ...' specified multiple times; using first specification
ccheung
parents: 27467
diff changeset
   399
                    "/export:JNI_GetDefaultJavaVMInitArgs " +
b07e72c58aef 8043491: warning LNK4197: export '... ...' specified multiple times; using first specification
ccheung
parents: 27467
diff changeset
   400
                    "/export:JNI_CreateJavaVM " +
b07e72c58aef 8043491: warning LNK4197: export '... ...' specified multiple times; using first specification
ccheung
parents: 27467
diff changeset
   401
                    "/export:JVM_FindClassFromBootLoader "+
b07e72c58aef 8043491: warning LNK4197: export '... ...' specified multiple times; using first specification
ccheung
parents: 27467
diff changeset
   402
                    "/export:JNI_GetCreatedJavaVMs "+
b07e72c58aef 8043491: warning LNK4197: export '... ...' specified multiple times; using first specification
ccheung
parents: 27467
diff changeset
   403
                    "/export:jio_snprintf /export:jio_printf "+
b07e72c58aef 8043491: warning LNK4197: export '... ...' specified multiple times; using first specification
ccheung
parents: 27467
diff changeset
   404
                    "/export:jio_fprintf /export:jio_vfprintf "+
b07e72c58aef 8043491: warning LNK4197: export '... ...' specified multiple times; using first specification
ccheung
parents: 27467
diff changeset
   405
                    "/export:jio_vsnprintf "+
b07e72c58aef 8043491: warning LNK4197: export '... ...' specified multiple times; using first specification
ccheung
parents: 27467
diff changeset
   406
                    "/export:JVM_GetVersionInfo "+
b07e72c58aef 8043491: warning LNK4197: export '... ...' specified multiple times; using first specification
ccheung
parents: 27467
diff changeset
   407
                    "/export:JVM_InitAgentProperties");
b07e72c58aef 8043491: warning LNK4197: export '... ...' specified multiple times; using first specification
ccheung
parents: 27467
diff changeset
   408
        }
27467
cdc1d5bc86cf 8059803: Update use of GetVersionEx to get correct Windows version in hs_err files
ctornqvi
parents: 27157
diff changeset
   409
        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;version.lib");
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   410
        addAttr(rv, "OutputFile", outDll);
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   411
        addAttr(rv, "SuppressStartupBanner", "true");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   412
        addAttr(rv, "ModuleDefinitionFile", outDir+Util.sep+"vm.def");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   413
        addAttr(rv, "ProgramDatabaseFile", outDir+Util.sep+"jvm.pdb");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   414
        addAttr(rv, "SubSystem", "Windows");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   415
        addAttr(rv, "BaseAddress", "0x8000000");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   416
        addAttr(rv, "ImportLibrary", outDir+Util.sep+"jvm.lib");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   417
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   418
        if(platformName.equals("Win32")) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   419
            addAttr(rv, "TargetMachine", "MachineX86");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   420
        } else {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   421
            addAttr(rv, "TargetMachine", "MachineX64");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   422
        }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   423
9131
b41df1504406 7034625: Product builds in Visual Studio projects should produce full symbol information
brutisso
parents: 8860
diff changeset
   424
        // 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
   425
        addAttr(rv, "GenerateDebugInformation", "true");
b41df1504406 7034625: Product builds in Visual Studio projects should produce full symbol information
brutisso
parents: 8860
diff changeset
   426
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   427
        return rv;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   428
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   429
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   430
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   431
    Vector getDebugLinkerFlags() {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   432
        Vector rv = new Vector();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   433
9131
b41df1504406 7034625: Product builds in Visual Studio projects should produce full symbol information
brutisso
parents: 8860
diff changeset
   434
        // Empty now that /DEBUG option is used by all configs
8860
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   435
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   436
        return rv;
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
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   440
    Vector getProductLinkerFlags() {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   441
        Vector rv = new Vector();
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   442
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   443
        // Set /OPT:REF option.
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   444
        addAttr(rv, "OptimizeReferences", "true");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   445
        // Set /OPT:ICF option.
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   446
        addAttr(rv, "EnableCOMDATFolding", "true");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   447
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   448
        return rv;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   449
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   450
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   451
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   452
    void getAdditionalNonKernelLinkerFlags(Vector rv) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   453
        extAttr(rv, "AdditionalOptions", " /export:AsyncGetCallTrace");
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   454
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   455
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   456
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   457
    String getOptFlag() {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   458
        return "MaxSpeed";
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   459
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   460
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   461
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   462
    String getNoOptFlag() {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   463
        return "Disabled";
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   464
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   465
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   466
    @Override
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   467
    String makeCfgName(String flavourBuild, String platform) {
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   468
        return  flavourBuild + "|" + platform;
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   469
    }
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   470
98a7ff20acf0 7031571: Generate native VS2010 project files
sla
parents:
diff changeset
   471
}