Mercurial > hg > truffle
comparison src/share/tools/MakeDeps/WinGammaPlatformVC7.java @ 659:520d43965b1f
6812297: update project creation for Visual Studio 2005-2008
Summary: Add 2 news classes to create VC8 and VC9 projects
Reviewed-by: apetrusenko, xlu
author | ikrylov |
---|---|
date | Fri, 27 Mar 2009 01:35:39 -0500 |
parents | a61af66fc99e |
children | bd02caa94611 |
comparison
equal
deleted
inserted
replaced
658:fe62b51b93f4 | 659:520d43965b1f |
---|---|
25 import java.io.*; | 25 import java.io.*; |
26 import java.util.*; | 26 import java.util.*; |
27 | 27 |
28 public class WinGammaPlatformVC7 extends WinGammaPlatform { | 28 public class WinGammaPlatformVC7 extends WinGammaPlatform { |
29 | 29 |
30 String projectVersion() {return "7.10";}; | |
31 | |
30 public void writeProjectFile(String projectFileName, String projectName, | 32 public void writeProjectFile(String projectFileName, String projectName, |
31 Vector allConfigs) throws IOException { | 33 Vector allConfigs) throws IOException { |
32 System.out.println(); | 34 System.out.println(); |
33 System.out.println(" Writing .vcproj file..."); | 35 System.out.println(" Writing .vcproj file..."); |
34 // If we got this far without an error, we're safe to actually | 36 // If we got this far without an error, we're safe to actually |
38 printWriter.println("<?xml version=\"1.0\" encoding=\"windows-1251\"?>"); | 40 printWriter.println("<?xml version=\"1.0\" encoding=\"windows-1251\"?>"); |
39 startTag( | 41 startTag( |
40 "VisualStudioProject", | 42 "VisualStudioProject", |
41 new String[] { | 43 new String[] { |
42 "ProjectType", "Visual C++", | 44 "ProjectType", "Visual C++", |
43 "Version", "7.10", | 45 "Version", projectVersion(), |
44 "Name", projectName, | 46 "Name", projectName, |
45 "ProjectGUID", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}", | 47 "ProjectGUID", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}", |
46 "SccProjectName", "", | 48 "SccProjectName", "", |
47 "SccLocalPath", "" | 49 "SccLocalPath", "" |
48 } | 50 } |
415 | 417 |
416 tag("Tool", | 418 tag("Tool", |
417 new String[] { | 419 new String[] { |
418 "Name", "VCPreLinkEventTool", | 420 "Name", "VCPreLinkEventTool", |
419 "Description", BuildConfig.getFieldString(null, "PrelinkDescription"), | 421 "Description", BuildConfig.getFieldString(null, "PrelinkDescription"), |
420 "CommandLine", cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand").replace('\t', '\n')) | 422 //Caution: String.replace(String,String) is available from JDK5 onwards only |
423 "CommandLine", cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand").replace | |
424 ("\t", "
")) | |
421 } | 425 } |
422 ); | 426 ); |
423 | 427 |
424 tag("Tool", | 428 tag("Tool", |
425 new String[] { | 429 new String[] { |
540 return ".vcproj"; | 544 return ".vcproj"; |
541 } | 545 } |
542 } | 546 } |
543 | 547 |
544 class CompilerInterfaceVC7 extends CompilerInterface { | 548 class CompilerInterfaceVC7 extends CompilerInterface { |
545 Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) { | 549 void getBaseCompilerFlags_common(Vector defines, Vector includes, String outDir,Vector rv) { |
546 Vector rv = new Vector(); | |
547 | 550 |
548 // advanced M$ IDE (2003) can only recognize name if it's first or | 551 // advanced M$ IDE (2003) can only recognize name if it's first or |
549 // second attribute in the tag - go guess | 552 // second attribute in the tag - go guess |
550 addAttr(rv, "Name", "VCCLCompilerTool"); | 553 addAttr(rv, "Name", "VCCLCompilerTool"); |
551 addAttr(rv, "AdditionalIncludeDirectories", Util.join(",", includes)); | 554 addAttr(rv, "AdditionalIncludeDirectories", Util.join(",", includes)); |
552 addAttr(rv, "PreprocessorDefinitions", Util.join(";", defines).replace("\"",""")); | 555 addAttr(rv, "PreprocessorDefinitions", |
553 addAttr(rv, "UsePrecompiledHeader", "3"); | 556 Util.join(";", defines).replace("\"",""")); |
554 addAttr(rv, "PrecompiledHeaderThrough", "incls"+Util.sep+"_precompiled.incl"); | 557 addAttr(rv, "PrecompiledHeaderThrough", |
558 "incls"+Util.sep+"_precompiled.incl"); | |
555 addAttr(rv, "PrecompiledHeaderFile", outDir+Util.sep+"vm.pch"); | 559 addAttr(rv, "PrecompiledHeaderFile", outDir+Util.sep+"vm.pch"); |
556 addAttr(rv, "AssemblerListingLocation", outDir); | 560 addAttr(rv, "AssemblerListingLocation", outDir); |
557 addAttr(rv, "ObjectFile", outDir+Util.sep); | 561 addAttr(rv, "ObjectFile", outDir+Util.sep); |
558 addAttr(rv, "ProgramDataBaseFileName", outDir+Util.sep+"vm.pdb"); | 562 addAttr(rv, "ProgramDataBaseFileName", outDir+Util.sep+"vm.pdb"); |
563 // Set /nologo optin | |
559 addAttr(rv, "SuppressStartupBanner", "TRUE"); | 564 addAttr(rv, "SuppressStartupBanner", "TRUE"); |
565 // Surpass the default /Tc or /Tp. 0 is compileAsDefault | |
560 addAttr(rv, "CompileAs", "0"); | 566 addAttr(rv, "CompileAs", "0"); |
567 // Set /W3 option. 3 is warningLevel_3 | |
561 addAttr(rv, "WarningLevel", "3"); | 568 addAttr(rv, "WarningLevel", "3"); |
569 // Set /WX option, | |
562 addAttr(rv, "WarnAsError", "TRUE"); | 570 addAttr(rv, "WarnAsError", "TRUE"); |
571 // Set /GS option | |
563 addAttr(rv, "BufferSecurityCheck", "FALSE"); | 572 addAttr(rv, "BufferSecurityCheck", "FALSE"); |
573 // Set /Zi option. 3 is debugEnabled | |
574 addAttr(rv, "DebugInformationFormat", "3"); | |
575 } | |
576 Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) { | |
577 Vector rv = new Vector(); | |
578 | |
579 getBaseCompilerFlags_common(defines,includes, outDir, rv); | |
580 // Set /Yu option. 3 is pchUseUsingSpecific | |
581 // Note: Starting VC8 pchUseUsingSpecific is 2 !!! | |
582 addAttr(rv, "UsePrecompiledHeader", "3"); | |
583 // Set /EHsc- option | |
564 addAttr(rv, "ExceptionHandling", "FALSE"); | 584 addAttr(rv, "ExceptionHandling", "FALSE"); |
565 | 585 |
566 return rv; | 586 return rv; |
567 } | 587 } |
568 | 588 |
577 "/export:jio_snprintf /export:jio_printf "+ | 597 "/export:jio_snprintf /export:jio_printf "+ |
578 "/export:jio_fprintf /export:jio_vfprintf "+ | 598 "/export:jio_fprintf /export:jio_vfprintf "+ |
579 "/export:jio_vsnprintf "); | 599 "/export:jio_vsnprintf "); |
580 addAttr(rv, "AdditionalDependencies", "Wsock32.lib winmm.lib"); | 600 addAttr(rv, "AdditionalDependencies", "Wsock32.lib winmm.lib"); |
581 addAttr(rv, "OutputFile", outDll); | 601 addAttr(rv, "OutputFile", outDll); |
602 // Set /INCREMENTAL option. 1 is linkIncrementalNo | |
582 addAttr(rv, "LinkIncremental", "1"); | 603 addAttr(rv, "LinkIncremental", "1"); |
583 addAttr(rv, "SuppressStartupBanner", "TRUE"); | 604 addAttr(rv, "SuppressStartupBanner", "TRUE"); |
584 addAttr(rv, "ModuleDefinitionFile", outDir+Util.sep+"vm.def"); | 605 addAttr(rv, "ModuleDefinitionFile", outDir+Util.sep+"vm.def"); |
585 addAttr(rv, "ProgramDatabaseFile", outDir+Util.sep+"vm.pdb"); | 606 addAttr(rv, "ProgramDatabaseFile", outDir+Util.sep+"vm.pdb"); |
607 // Set /SUBSYSTEM option. 2 is subSystemWindows | |
586 addAttr(rv, "SubSystem", "2"); | 608 addAttr(rv, "SubSystem", "2"); |
587 addAttr(rv, "BaseAddress", "0x8000000"); | 609 addAttr(rv, "BaseAddress", "0x8000000"); |
588 addAttr(rv, "ImportLibrary", outDir+Util.sep+"jvm.lib"); | 610 addAttr(rv, "ImportLibrary", outDir+Util.sep+"jvm.lib"); |
611 // Set /MACHINE option. 1 is machineX86 | |
589 addAttr(rv, "TargetMachine", "1"); | 612 addAttr(rv, "TargetMachine", "1"); |
590 | 613 |
591 return rv; | 614 return rv; |
615 } | |
616 | |
617 void getDebugCompilerFlags_common(String opt,Vector rv) { | |
618 | |
619 // Set /On option | |
620 addAttr(rv, "Optimization", opt); | |
621 // Set /FR option. 1 is brAllInfo | |
622 addAttr(rv, "BrowseInformation", "1"); | |
623 addAttr(rv, "BrowseInformationFile", "$(IntDir)" + Util.sep); | |
624 // Set /MD option. 2 is rtMultiThreadedDLL | |
625 addAttr(rv, "RuntimeLibrary", "2"); | |
626 // Set /Oy- option | |
627 addAttr(rv, "OmitFramePointers", "FALSE"); | |
628 | |
592 } | 629 } |
593 | 630 |
594 Vector getDebugCompilerFlags(String opt) { | 631 Vector getDebugCompilerFlags(String opt) { |
595 Vector rv = new Vector(); | 632 Vector rv = new Vector(); |
596 | 633 |
597 addAttr(rv, "Optimization", opt); | 634 getDebugCompilerFlags_common(opt,rv); |
598 addAttr(rv, "OptimizeForProcessor", "1"); | |
599 addAttr(rv, "DebugInformationFormat", "3"); | |
600 addAttr(rv, "RuntimeLibrary", "2"); | |
601 addAttr(rv, "BrowseInformation", "1"); | |
602 addAttr(rv, "BrowseInformationFile", "$(IntDir)" + Util.sep); | |
603 | 635 |
604 return rv; | 636 return rv; |
605 } | 637 } |
606 | 638 |
607 Vector getDebugLinkerFlags() { | 639 Vector getDebugLinkerFlags() { |
608 Vector rv = new Vector(); | 640 Vector rv = new Vector(); |
609 | 641 |
610 addAttr(rv, "GenerateDebugInformation", "TRUE"); | 642 addAttr(rv, "GenerateDebugInformation", "TRUE"); // == /DEBUG option |
611 | 643 |
612 return rv; | 644 return rv; |
645 } | |
646 | |
647 void getProductCompilerFlags_common(Vector rv) { | |
648 // Set /O2 option. 2 is optimizeMaxSpeed | |
649 addAttr(rv, "Optimization", "2"); | |
650 // Set /Oy- option | |
651 addAttr(rv, "OmitFramePointers", "FALSE"); | |
613 } | 652 } |
614 | 653 |
615 Vector getProductCompilerFlags() { | 654 Vector getProductCompilerFlags() { |
616 Vector rv = new Vector(); | 655 Vector rv = new Vector(); |
617 | 656 |
618 addAttr(rv, "Optimization", "2"); | 657 getProductCompilerFlags_common(rv); |
658 // Set /Ob option. 1 is expandOnlyInline | |
619 addAttr(rv, "InlineFunctionExpansion", "1"); | 659 addAttr(rv, "InlineFunctionExpansion", "1"); |
660 // Set /GF option. | |
620 addAttr(rv, "StringPooling", "TRUE"); | 661 addAttr(rv, "StringPooling", "TRUE"); |
662 // Set /MD option. 2 is rtMultiThreadedDLL | |
621 addAttr(rv, "RuntimeLibrary", "2"); | 663 addAttr(rv, "RuntimeLibrary", "2"); |
664 // Set /Gy option | |
622 addAttr(rv, "EnableFunctionLevelLinking", "TRUE"); | 665 addAttr(rv, "EnableFunctionLevelLinking", "TRUE"); |
623 | 666 |
624 return rv; | 667 return rv; |
625 } | 668 } |
626 | 669 |
627 Vector getProductLinkerFlags() { | 670 Vector getProductLinkerFlags() { |
628 Vector rv = new Vector(); | 671 Vector rv = new Vector(); |
629 | 672 |
673 // Set /OPT:REF option. 2 is optReferences | |
630 addAttr(rv, "OptimizeReferences", "2"); | 674 addAttr(rv, "OptimizeReferences", "2"); |
675 // Set /OPT:optFolding option. 2 is optFolding | |
631 addAttr(rv, "EnableCOMDATFolding", "2"); | 676 addAttr(rv, "EnableCOMDATFolding", "2"); |
632 | 677 |
633 return rv; | 678 return rv; |
634 } | 679 } |
635 | 680 |