hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java
changeset 7397 5b173b4ca846
parent 5547 f4b087cbb361
child 7452 b3fa838286de
equal deleted inserted replaced
7396:518b01b064ff 7397:5b173b4ca846
       
     1 /*
       
     2  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20  * or visit www.oracle.com if you need additional information or have any
       
    21  * questions.
       
    22  *
       
    23  */
       
    24 
       
    25 import java.io.*;
       
    26 import java.util.*;
       
    27 
       
    28 public class WinGammaPlatformVC7 extends WinGammaPlatform {
       
    29 
       
    30     String projectVersion() {return "7.10";};
       
    31 
       
    32     public void writeProjectFile(String projectFileName, String projectName,
       
    33                                  Vector allConfigs) throws IOException {
       
    34         System.out.println();
       
    35         System.out.println("    Writing .vcproj file...");
       
    36         // If we got this far without an error, we're safe to actually
       
    37         // write the .vcproj file
       
    38         printWriter = new PrintWriter(new FileWriter(projectFileName));
       
    39 
       
    40         printWriter.println("<?xml version=\"1.0\" encoding=\"windows-1251\"?>");
       
    41         startTag(
       
    42             "VisualStudioProject",
       
    43             new String[] {
       
    44                 "ProjectType", "Visual C++",
       
    45                 "Version", projectVersion(),
       
    46                 "Name", projectName,
       
    47                 "ProjectGUID", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}",
       
    48                 "SccProjectName", "",
       
    49                 "SccLocalPath", ""
       
    50             }
       
    51             );
       
    52 
       
    53         startTag("Platforms", null);
       
    54         tag("Platform", new String[] {"Name", Util.os});
       
    55         endTag("Platforms");
       
    56 
       
    57         startTag("Configurations", null);
       
    58 
       
    59         for (Iterator i = allConfigs.iterator(); i.hasNext(); ) {
       
    60             writeConfiguration((BuildConfig)i.next());
       
    61         }
       
    62 
       
    63         endTag("Configurations");
       
    64 
       
    65         tag("References", null);
       
    66 
       
    67         writeFiles(allConfigs);
       
    68 
       
    69         tag("Globals", null);
       
    70 
       
    71         endTag("VisualStudioProject");
       
    72         printWriter.close();
       
    73 
       
    74         System.out.println("    Done.");
       
    75     }
       
    76 
       
    77 
       
    78     abstract class NameFilter {
       
    79         protected String fname;
       
    80 
       
    81         abstract boolean match(FileInfo fi);
       
    82 
       
    83         String  filterString() { return ""; }
       
    84         String name() { return this.fname;}
       
    85     }
       
    86 
       
    87     class DirectoryFilter extends NameFilter {
       
    88         String dir;
       
    89         int baseLen, dirLen;
       
    90 
       
    91         DirectoryFilter(String dir, String sbase) {
       
    92             this.dir = dir;
       
    93             this.baseLen = sbase.length();
       
    94             this.dirLen = dir.length();
       
    95             this.fname = dir;
       
    96         }
       
    97 
       
    98         DirectoryFilter(String fname, String dir, String sbase) {
       
    99             this.dir = dir;
       
   100             this.baseLen = sbase.length();
       
   101             this.dirLen = dir.length();
       
   102             this.fname = fname;
       
   103         }
       
   104 
       
   105 
       
   106         boolean match(FileInfo fi) {
       
   107             return fi.full.regionMatches(true, baseLen, dir, 0, dirLen);
       
   108         }
       
   109     }
       
   110 
       
   111     class TypeFilter extends NameFilter {
       
   112         String[] exts;
       
   113 
       
   114         TypeFilter(String fname, String[] exts) {
       
   115             this.fname = fname;
       
   116             this.exts = exts;
       
   117         }
       
   118 
       
   119         boolean match(FileInfo fi) {
       
   120             for (int i=0; i<exts.length; i++) {
       
   121                 if (fi.full.endsWith(exts[i])) {
       
   122                     return true;
       
   123                 }
       
   124             }
       
   125             return false;
       
   126         }
       
   127 
       
   128         String  filterString() {
       
   129             return Util.join(";", exts);
       
   130         }
       
   131     }
       
   132 
       
   133     class TerminatorFilter extends NameFilter {
       
   134         TerminatorFilter(String fname) {
       
   135             this.fname = fname;
       
   136 
       
   137         }
       
   138         boolean match(FileInfo fi) {
       
   139             return true;
       
   140         }
       
   141 
       
   142     }
       
   143 
       
   144     class SpecificNameFilter extends NameFilter {
       
   145         String pats[];
       
   146 
       
   147         SpecificNameFilter(String fname, String[] pats) {
       
   148             this.fname = fname;
       
   149             this.pats = pats;
       
   150         }
       
   151 
       
   152         boolean match(FileInfo fi) {
       
   153             for (int i=0; i<pats.length; i++) {
       
   154                 if (fi.attr.shortName.matches(pats[i])) {
       
   155                     return true;
       
   156                 }
       
   157             }
       
   158             return false;
       
   159         }
       
   160 
       
   161     }
       
   162 
       
   163     class SpecificPathFilter extends NameFilter {
       
   164         String pats[];
       
   165 
       
   166         SpecificPathFilter(String fname, String[] pats) {
       
   167             this.fname = fname;
       
   168             this.pats = pats;
       
   169         }
       
   170 
       
   171         boolean match(FileInfo fi) {
       
   172             for (int i=0; i<pats.length; i++) {
       
   173                 if (fi.full.matches(pats[i])) {
       
   174                     return true;
       
   175                 }
       
   176             }
       
   177             return false;
       
   178         }
       
   179 
       
   180     }
       
   181 
       
   182     class ContainerFilter extends NameFilter {
       
   183         Vector children;
       
   184 
       
   185         ContainerFilter(String fname) {
       
   186             this.fname = fname;
       
   187             children = new Vector();
       
   188 
       
   189         }
       
   190         boolean match(FileInfo fi) {
       
   191             return false;
       
   192         }
       
   193 
       
   194         Iterator babies() { return children.iterator(); }
       
   195 
       
   196         void add(NameFilter f) {
       
   197             children.add(f);
       
   198         }
       
   199     }
       
   200 
       
   201 
       
   202     void writeCustomToolConfig(Vector configs, String[] customToolAttrs) {
       
   203         for (Iterator i = configs.iterator(); i.hasNext(); ) {
       
   204             startTag("FileConfiguration",
       
   205                      new String[] {
       
   206                          "Name",  (String)i.next()
       
   207                      }
       
   208                      );
       
   209             tag("Tool", customToolAttrs);
       
   210 
       
   211             endTag("FileConfiguration");
       
   212         }
       
   213     }
       
   214 
       
   215     // here we define filters, which define layout of what can be seen in 'Solution View' of MSVC
       
   216     // Basically there are two types of entities - container filters and real filters
       
   217     //   - container filter just provides a container to group together real filters
       
   218     //   - real filter can select elements from the set according to some rule, put it into XML
       
   219     //     and remove from the list
       
   220     Vector makeFilters(TreeSet files) {
       
   221         Vector rv = new Vector();
       
   222         String sbase = Util.normalize(BuildConfig.getFieldString(null, "SourceBase")+"/src/");
       
   223 
       
   224         ContainerFilter rt = new ContainerFilter("Runtime");
       
   225         rt.add(new DirectoryFilter("share/vm/prims", sbase));
       
   226         rt.add(new DirectoryFilter("share/vm/runtime", sbase));
       
   227         rt.add(new DirectoryFilter("share/vm/oops", sbase));
       
   228         rv.add(rt);
       
   229 
       
   230         ContainerFilter gc = new ContainerFilter("GC");
       
   231         gc.add(new DirectoryFilter("share/vm/memory", sbase));
       
   232         gc.add(new DirectoryFilter("share/vm/gc_interface", sbase));
       
   233 
       
   234         ContainerFilter gc_impl = new ContainerFilter("Implementations");
       
   235         gc_impl.add(new DirectoryFilter("CMS",
       
   236                                         "share/vm/gc_implementation/concurrentMarkSweep",
       
   237                                         sbase));
       
   238         gc_impl.add(new DirectoryFilter("Parallel Scavenge",
       
   239                                         "share/vm/gc_implementation/parallelScavenge",
       
   240                                         sbase));
       
   241         gc_impl.add(new DirectoryFilter("Shared",
       
   242                                         "share/vm/gc_implementation/shared",
       
   243                                         sbase));
       
   244         // for all leftovers
       
   245         gc_impl.add(new DirectoryFilter("Misc",
       
   246                                         "share/vm/gc_implementation",
       
   247                                         sbase));
       
   248 
       
   249         gc.add(gc_impl);
       
   250         rv.add(gc);
       
   251 
       
   252         rv.add(new DirectoryFilter("C1", "share/vm/c1", sbase));
       
   253 
       
   254         rv.add(new DirectoryFilter("C2", "share/vm/opto", sbase));
       
   255 
       
   256         ContainerFilter comp = new ContainerFilter("Compiler Common");
       
   257         comp.add(new DirectoryFilter("share/vm/asm", sbase));
       
   258         comp.add(new DirectoryFilter("share/vm/ci", sbase));
       
   259         comp.add(new DirectoryFilter("share/vm/code", sbase));
       
   260         comp.add(new DirectoryFilter("share/vm/compiler", sbase));
       
   261         rv.add(comp);
       
   262 
       
   263         rv.add(new DirectoryFilter("Interpreter",
       
   264                                    "share/vm/interpreter",
       
   265                                    sbase));
       
   266 
       
   267         ContainerFilter misc = new ContainerFilter("Misc");
       
   268         misc.add(new DirectoryFilter("share/vm/libadt", sbase));
       
   269         misc.add(new DirectoryFilter("share/vm/services", sbase));
       
   270         misc.add(new DirectoryFilter("share/vm/utilities", sbase));
       
   271         misc.add(new DirectoryFilter("share/vm/classfile", sbase));
       
   272         rv.add(misc);
       
   273 
       
   274         rv.add(new DirectoryFilter("os_cpu", sbase));
       
   275 
       
   276         rv.add(new DirectoryFilter("cpu", sbase));
       
   277 
       
   278         rv.add(new DirectoryFilter("os", sbase));
       
   279 
       
   280         ContainerFilter generated = new ContainerFilter("Generated");
       
   281         ContainerFilter c1Generated = new ContainerFilter("C1");
       
   282         c1Generated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*compiler1/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"}));
       
   283         c1Generated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*compiler1/generated/jvmtifiles/.*"}));
       
   284         generated.add(c1Generated);
       
   285         ContainerFilter c2Generated = new ContainerFilter("C2");
       
   286         c2Generated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*compiler2/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"}));
       
   287         c2Generated.add(new SpecificPathFilter("adfiles", new String[] {".*compiler2/generated/adfiles/.*"}));
       
   288         c2Generated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*compiler2/generated/jvmtifiles/.*"}));
       
   289         generated.add(c2Generated);
       
   290         ContainerFilter coreGenerated = new ContainerFilter("Core");
       
   291         coreGenerated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*core/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"}));
       
   292         coreGenerated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*core/generated/jvmtifiles/.*"}));
       
   293         generated.add(coreGenerated);
       
   294         ContainerFilter tieredGenerated = new ContainerFilter("Tiered");
       
   295         tieredGenerated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*tiered/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"}));
       
   296         tieredGenerated.add(new SpecificPathFilter("adfiles", new String[] {".*tiered/generated/adfiles/.*"}));
       
   297         tieredGenerated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*tiered/generated/jvmtifiles/.*"}));
       
   298         generated.add(tieredGenerated);
       
   299         ContainerFilter kernelGenerated = new ContainerFilter("Kernel");
       
   300         kernelGenerated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*kernel/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"}));
       
   301         kernelGenerated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*kernel/generated/jvmtifiles/.*"}));
       
   302         generated.add(kernelGenerated);
       
   303         rv.add(generated);
       
   304 
       
   305         rv.add(new SpecificNameFilter("Precompiled Header", new String[] {"precompiled.hpp"}));
       
   306 
       
   307         // this one is to catch files not caught by other filters
       
   308         //rv.add(new TypeFilter("Header Files", new String[] {"h", "hpp", "hxx", "hm", "inl", "fi", "fd"}));
       
   309         rv.add(new TerminatorFilter("Source Files"));
       
   310 
       
   311         return rv;
       
   312     }
       
   313 
       
   314     void writeFiles(Vector allConfigs) {
       
   315 
       
   316         Hashtable allFiles = computeAttributedFiles(allConfigs);
       
   317 
       
   318         Vector allConfigNames = new Vector();
       
   319         for (Iterator i = allConfigs.iterator(); i.hasNext(); ) {
       
   320             allConfigNames.add(((BuildConfig)i.next()).get("Name"));
       
   321         }
       
   322 
       
   323         TreeSet sortedFiles = sortFiles(allFiles);
       
   324 
       
   325         startTag("Files", null);
       
   326 
       
   327         for (Iterator i = makeFilters(sortedFiles).iterator(); i.hasNext(); ) {
       
   328             doWriteFiles(sortedFiles, allConfigNames, (NameFilter)i.next());
       
   329         }
       
   330 
       
   331 
       
   332         startTag("Filter",
       
   333                  new String[] {
       
   334                      "Name", "Resource Files",
       
   335                      "Filter", "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
       
   336                  }
       
   337                  );
       
   338         endTag("Filter");
       
   339 
       
   340         endTag("Files");
       
   341     }
       
   342 
       
   343     void doWriteFiles(TreeSet allFiles, Vector allConfigNames, NameFilter filter) {
       
   344         startTag("Filter",
       
   345                  new String[] {
       
   346                      "Name",   filter.name(),
       
   347                      "Filter", filter.filterString()
       
   348                  }
       
   349                  );
       
   350 
       
   351         if (filter instanceof ContainerFilter) {
       
   352 
       
   353             Iterator i = ((ContainerFilter)filter).babies();
       
   354             while (i.hasNext()) {
       
   355                 doWriteFiles(allFiles, allConfigNames, (NameFilter)i.next());
       
   356             }
       
   357 
       
   358         } else {
       
   359 
       
   360             Iterator i = allFiles.iterator();
       
   361             while (i.hasNext()) {
       
   362                 FileInfo fi = (FileInfo)i.next();
       
   363 
       
   364                 if (!filter.match(fi)) {
       
   365                     continue;
       
   366                 }
       
   367 
       
   368                 startTag("File",
       
   369                          new String[] {
       
   370                              "RelativePath", fi.full.replace('/', '\\')
       
   371                          }
       
   372                          );
       
   373 
       
   374                 FileAttribute a = fi.attr;
       
   375                 if (a.pchRoot) {
       
   376                     writeCustomToolConfig(allConfigNames,
       
   377                                           new String[] {
       
   378                                               "Name", "VCCLCompilerTool",
       
   379                                               "UsePrecompiledHeader", "1"
       
   380                                           });
       
   381                 }
       
   382 
       
   383                 if (a.noPch) {
       
   384                     writeCustomToolConfig(allConfigNames,
       
   385                                           new String[] {
       
   386                                               "Name", "VCCLCompilerTool",
       
   387                                               "UsePrecompiledHeader", "0"
       
   388                                           });
       
   389                 }
       
   390 
       
   391                 if (a.configs != null) {
       
   392                     for (Iterator j=allConfigNames.iterator(); j.hasNext();) {
       
   393                         String cfg = (String)j.next();
       
   394                         if (!a.configs.contains(cfg)) {
       
   395                             startTag("FileConfiguration",
       
   396                                      new String[] {
       
   397                                          "Name", cfg,
       
   398                                          "ExcludedFromBuild", "TRUE"
       
   399                                      });
       
   400                             tag("Tool", new String[] {"Name", "VCCLCompilerTool"});
       
   401                             endTag("FileConfiguration");
       
   402 
       
   403                         }
       
   404                     }
       
   405                 }
       
   406 
       
   407                 endTag("File");
       
   408 
       
   409                 // we not gonna look at this file anymore
       
   410                 i.remove();
       
   411             }
       
   412         }
       
   413 
       
   414         endTag("Filter");
       
   415     }
       
   416 
       
   417 
       
   418     void writeConfiguration(BuildConfig cfg) {
       
   419         startTag("Configuration",
       
   420                  new String[] {
       
   421                      "Name", cfg.get("Name"),
       
   422                      "OutputDirectory",  cfg.get("OutputDir"),
       
   423                      "IntermediateDirectory",  cfg.get("OutputDir"),
       
   424                      "ConfigurationType", "2",
       
   425                      "UseOfMFC", "0",
       
   426                      "ATLMinimizesCRunTimeLibraryUsage", "FALSE"
       
   427                  }
       
   428                  );
       
   429 
       
   430 
       
   431 
       
   432         tagV("Tool", cfg.getV("CompilerFlags"));
       
   433 
       
   434         tag("Tool",
       
   435             new String[] {
       
   436                 "Name", "VCCustomBuildTool"
       
   437             }
       
   438             );
       
   439 
       
   440         tagV("Tool", cfg.getV("LinkerFlags"));
       
   441 
       
   442         tag("Tool",
       
   443             new String[] {
       
   444                 "Name", "VCPostBuildEventTool"
       
   445             }
       
   446             );
       
   447 
       
   448         tag("Tool",
       
   449             new String[] {
       
   450                 "Name", "VCPreBuildEventTool"
       
   451             }
       
   452             );
       
   453 
       
   454         tag("Tool",
       
   455             new String[] {
       
   456                 "Name", "VCPreLinkEventTool",
       
   457                 "Description", BuildConfig.getFieldString(null, "PrelinkDescription"),
       
   458                 //Caution: String.replace(String,String) is available from JDK5 onwards only
       
   459                 "CommandLine", cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand").replace
       
   460                    ("\t", "&#x0D;&#x0A;"))
       
   461             }
       
   462             );
       
   463 
       
   464         tag("Tool",
       
   465             new String[] {
       
   466                 "Name", "VCResourceCompilerTool",
       
   467                 // XXX???
       
   468                 "PreprocessorDefinitions", "NDEBUG",
       
   469                 "Culture", "1033"
       
   470             }
       
   471             );
       
   472         tag("Tool",
       
   473             new String[] {
       
   474               "Name", "VCWebServiceProxyGeneratorTool"
       
   475             }
       
   476             );
       
   477 
       
   478         tag ("Tool",
       
   479              new String[] {
       
   480               "Name", "VCXMLDataGeneratorTool"
       
   481              }
       
   482              );
       
   483 
       
   484         tag("Tool",
       
   485             new String[] {
       
   486               "Name", "VCWebDeploymentTool"
       
   487             }
       
   488             );
       
   489         tag("Tool",
       
   490              new String[] {
       
   491             "Name", "VCManagedWrapperGeneratorTool"
       
   492              }
       
   493             );
       
   494         tag("Tool",
       
   495             new String[] {
       
   496               "Name", "VCAuxiliaryManagedWrapperGeneratorTool"
       
   497             }
       
   498             );
       
   499 
       
   500         tag("Tool",
       
   501             new String[] {
       
   502                 "Name", "VCMIDLTool",
       
   503                 "PreprocessorDefinitions", "NDEBUG",
       
   504                 "MkTypLibCompatible", "TRUE",
       
   505                 "SuppressStartupBanner", "TRUE",
       
   506                 "TargetEnvironment", "1",
       
   507                 "TypeLibraryName", cfg.get("OutputDir") + Util.sep + "vm.tlb",
       
   508                 "HeaderFileName", ""
       
   509             }
       
   510             );
       
   511 
       
   512         endTag("Configuration");
       
   513     }
       
   514 
       
   515     int indent;
       
   516 
       
   517     private void startTagPrim(String name,
       
   518                               String[] attrs,
       
   519                               boolean close) {
       
   520         doIndent();
       
   521         printWriter.print("<"+name);
       
   522         indent++;
       
   523 
       
   524         if (attrs != null) {
       
   525             printWriter.println();
       
   526             for (int i=0; i<attrs.length; i+=2) {
       
   527                 doIndent();
       
   528                 printWriter.print(" " + attrs[i]+"=\""+attrs[i+1]+"\"");
       
   529                 if (i < attrs.length - 2) {
       
   530                     printWriter.println();
       
   531                 }
       
   532             }
       
   533         }
       
   534 
       
   535         if (close) {
       
   536             indent--;
       
   537             //doIndent();
       
   538             printWriter.println("/>");
       
   539         } else {
       
   540             //doIndent();
       
   541             printWriter.println(">");
       
   542         }
       
   543     }
       
   544 
       
   545     void startTag(String name, String[] attrs) {
       
   546         startTagPrim(name, attrs, false);
       
   547     }
       
   548 
       
   549     void startTagV(String name, Vector attrs) {
       
   550         String s[] = new String [attrs.size()];
       
   551          for (int i=0; i<attrs.size(); i++) {
       
   552              s[i] = (String)attrs.elementAt(i);
       
   553          }
       
   554         startTagPrim(name, s, false);
       
   555     }
       
   556 
       
   557     void endTag(String name) {
       
   558         indent--;
       
   559         doIndent();
       
   560         printWriter.println("</"+name+">");
       
   561     }
       
   562 
       
   563     void tag(String name, String[] attrs) {
       
   564         startTagPrim(name, attrs, true);
       
   565     }
       
   566 
       
   567      void tagV(String name, Vector attrs) {
       
   568          String s[] = new String [attrs.size()];
       
   569          for (int i=0; i<attrs.size(); i++) {
       
   570              s[i] = (String)attrs.elementAt(i);
       
   571          }
       
   572          startTagPrim(name, s, true);
       
   573     }
       
   574 
       
   575 
       
   576     void doIndent() {
       
   577         for (int i=0; i<indent; i++) {
       
   578             printWriter.print("    ");
       
   579         }
       
   580     }
       
   581 
       
   582     protected String getProjectExt() {
       
   583         return ".vcproj";
       
   584     }
       
   585 }
       
   586 
       
   587 class CompilerInterfaceVC7 extends CompilerInterface {
       
   588     void getBaseCompilerFlags_common(Vector defines, Vector includes, String outDir,Vector rv) {
       
   589 
       
   590         // advanced M$ IDE (2003) can only recognize name if it's first or
       
   591         // second attribute in the tag - go guess
       
   592         addAttr(rv, "Name", "VCCLCompilerTool");
       
   593         addAttr(rv, "AdditionalIncludeDirectories", Util.join(",", includes));
       
   594         addAttr(rv, "PreprocessorDefinitions",
       
   595                                 Util.join(";", defines).replace("\"","&quot;"));
       
   596         addAttr(rv, "PrecompiledHeaderThrough", "precompiled.hpp");
       
   597         addAttr(rv, "PrecompiledHeaderFile", outDir+Util.sep+"vm.pch");
       
   598         addAttr(rv, "AssemblerListingLocation", outDir);
       
   599         addAttr(rv, "ObjectFile", outDir+Util.sep);
       
   600         addAttr(rv, "ProgramDataBaseFileName", outDir+Util.sep+"vm.pdb");
       
   601         // Set /nologo optin
       
   602         addAttr(rv, "SuppressStartupBanner", "TRUE");
       
   603         // Surpass the default /Tc or /Tp. 0 is compileAsDefault
       
   604         addAttr(rv, "CompileAs", "0");
       
   605         // Set /W3 option. 3 is warningLevel_3
       
   606         addAttr(rv, "WarningLevel", "3");
       
   607         // Set /WX option,
       
   608         addAttr(rv, "WarnAsError", "TRUE");
       
   609         // Set /GS option
       
   610         addAttr(rv, "BufferSecurityCheck", "FALSE");
       
   611         // Set /Zi option. 3 is debugEnabled
       
   612         addAttr(rv, "DebugInformationFormat", "3");
       
   613     }
       
   614     Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) {
       
   615         Vector rv = new Vector();
       
   616 
       
   617         getBaseCompilerFlags_common(defines,includes, outDir, rv);
       
   618         // Set /Yu option. 3 is pchUseUsingSpecific
       
   619         // Note: Starting VC8 pchUseUsingSpecific is 2 !!!
       
   620         addAttr(rv, "UsePrecompiledHeader", "3");
       
   621         // Set /EHsc- option
       
   622         addAttr(rv, "ExceptionHandling", "FALSE");
       
   623 
       
   624         return rv;
       
   625     }
       
   626 
       
   627     Vector getBaseLinkerFlags(String outDir, String outDll) {
       
   628         Vector rv = new Vector();
       
   629 
       
   630         addAttr(rv, "Name", "VCLinkerTool");
       
   631         addAttr(rv, "AdditionalOptions",
       
   632                 "/export:JNI_GetDefaultJavaVMInitArgs " +
       
   633                 "/export:JNI_CreateJavaVM " +
       
   634                 "/export:JNI_GetCreatedJavaVMs "+
       
   635                 "/export:jio_snprintf /export:jio_printf "+
       
   636                 "/export:jio_fprintf /export:jio_vfprintf "+
       
   637                 "/export:jio_vsnprintf ");
       
   638         addAttr(rv, "AdditionalDependencies", "Wsock32.lib winmm.lib");
       
   639         addAttr(rv, "OutputFile", outDll);
       
   640         // Set /INCREMENTAL option. 1 is linkIncrementalNo
       
   641         addAttr(rv, "LinkIncremental", "1");
       
   642         addAttr(rv, "SuppressStartupBanner", "TRUE");
       
   643         addAttr(rv, "ModuleDefinitionFile", outDir+Util.sep+"vm.def");
       
   644         addAttr(rv, "ProgramDatabaseFile", outDir+Util.sep+"vm.pdb");
       
   645         // Set /SUBSYSTEM option. 2 is subSystemWindows
       
   646         addAttr(rv, "SubSystem", "2");
       
   647         addAttr(rv, "BaseAddress", "0x8000000");
       
   648         addAttr(rv, "ImportLibrary", outDir+Util.sep+"jvm.lib");
       
   649         // Set /MACHINE option. 1 is machineX86
       
   650         addAttr(rv, "TargetMachine", "1");
       
   651 
       
   652         return rv;
       
   653     }
       
   654 
       
   655     void  getDebugCompilerFlags_common(String opt,Vector rv) {
       
   656 
       
   657         // Set /On option
       
   658         addAttr(rv, "Optimization", opt);
       
   659         // Set /FR option. 1 is brAllInfo
       
   660         addAttr(rv, "BrowseInformation", "1");
       
   661         addAttr(rv, "BrowseInformationFile", "$(IntDir)" + Util.sep);
       
   662         // Set /MD option. 2 is rtMultiThreadedDLL
       
   663         addAttr(rv, "RuntimeLibrary", "2");
       
   664         // Set /Oy- option
       
   665         addAttr(rv, "OmitFramePointers", "FALSE");
       
   666 
       
   667     }
       
   668 
       
   669     Vector getDebugCompilerFlags(String opt) {
       
   670         Vector rv = new Vector();
       
   671 
       
   672         getDebugCompilerFlags_common(opt,rv);
       
   673 
       
   674         return rv;
       
   675     }
       
   676 
       
   677     Vector getDebugLinkerFlags() {
       
   678         Vector rv = new Vector();
       
   679 
       
   680         addAttr(rv, "GenerateDebugInformation", "TRUE"); // == /DEBUG option
       
   681 
       
   682         return rv;
       
   683     }
       
   684 
       
   685     void getProductCompilerFlags_common(Vector rv) {
       
   686         // Set /O2 option. 2 is optimizeMaxSpeed
       
   687         addAttr(rv, "Optimization", "2");
       
   688         // Set /Oy- option
       
   689         addAttr(rv, "OmitFramePointers", "FALSE");
       
   690     }
       
   691 
       
   692     Vector getProductCompilerFlags() {
       
   693         Vector rv = new Vector();
       
   694 
       
   695         getProductCompilerFlags_common(rv);
       
   696         // Set /Ob option.  1 is expandOnlyInline
       
   697         addAttr(rv, "InlineFunctionExpansion", "1");
       
   698         // Set /GF option.
       
   699         addAttr(rv, "StringPooling", "TRUE");
       
   700         // Set /MD option. 2 is rtMultiThreadedDLL
       
   701         addAttr(rv, "RuntimeLibrary", "2");
       
   702         // Set /Gy option
       
   703         addAttr(rv, "EnableFunctionLevelLinking", "TRUE");
       
   704 
       
   705         return rv;
       
   706     }
       
   707 
       
   708     Vector getProductLinkerFlags() {
       
   709         Vector rv = new Vector();
       
   710 
       
   711         // Set /OPT:REF option. 2 is optReferences
       
   712         addAttr(rv, "OptimizeReferences", "2");
       
   713         // Set /OPT:optFolding option. 2 is optFolding
       
   714         addAttr(rv, "EnableCOMDATFolding", "2");
       
   715 
       
   716         return rv;
       
   717     }
       
   718 
       
   719     String getOptFlag() {
       
   720         return "2";
       
   721     }
       
   722 
       
   723     String getNoOptFlag() {
       
   724         return "0";
       
   725     }
       
   726 
       
   727     String makeCfgName(String flavourBuild) {
       
   728         return  flavourBuild + "|" + Util.os;
       
   729     }
       
   730 }