* Rbuild MSVC Backend changes:
authorAlex Ionescu <aionescu@gmail.com>
Sat, 7 Jan 2006 01:15:26 +0000 (01:15 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Sat, 7 Jan 2006 01:15:26 +0000 (01:15 +0000)
- Don't do runtime checks for drivers
- Don't do buffer checks for drivers
- Use W0 for speed build, not for the release build.
- Disable Wp64 only for the speed build, not for the release build
- Use /STDCALL default calling convention for native modules because the DDK requires it
- Remove some duplicated options that were passed on the command line
- Replace some options that were passed on the commandline with their appropriate XML keywords.

svn path=/trunk/; revision=20637

reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp

index 7d963e2..f6c6e04 100644 (file)
@@ -96,9 +96,10 @@ MSVCBackend::_generate_vcproj ( const Module& module )
        ifs_list.push_back ( &module.project.non_if_data );\r
        ifs_list.push_back ( &module.non_if_data );\r
 \r
-       // this is a define in MinGW w32api, but not Microsoft's headers\r
+       // MinGW doesn't have a safe-string library yet\r
        defines.push_back ( "_CRT_SECURE_NO_DEPRECATE" );\r
        defines.push_back ( "_CRT_NON_CONFORMING_SWPRINTFS" );\r
+       // this is a define in MinGW w32api, but not Microsoft's headers\r
        defines.push_back ( "STDCALL=__stdcall" );\r
 \r
        string baseaddr;\r
@@ -309,9 +310,9 @@ MSVCBackend::_generate_vcproj ( const Module& module )
                fprintf ( OUT, "\"\r\n" );\r
 \r
                fprintf ( OUT, "\t\t\t\tMinimalRebuild=\"%s\"\r\n", speed ? "FALSE" : "TRUE" );\r
-               fprintf ( OUT, "\t\t\t\tBasicRuntimeChecks=\"%s\"\r\n", debug ? "3" : "0" );\r
+        fprintf ( OUT, "\t\t\t\tBasicRuntimeChecks=\"%s\"\r\n", sys ? 0 : (debug ? "3" : "0") );\r
                fprintf ( OUT, "\t\t\t\tRuntimeLibrary=\"5\"\r\n" );\r
-               fprintf ( OUT, "\t\t\t\tBufferSecurityCheck=\"%s\"\r\n", debug ? "TRUE" : "FALSE" );\r
+        fprintf ( OUT, "\t\t\t\tBufferSecurityCheck=\"%s\"\r\n", sys ? "FALSE" : (debug ? "TRUE" : "FALSE" ));\r
                fprintf ( OUT, "\t\t\t\tEnableFunctionLevelLinking=\"%s\"\r\n", debug ? "TRUE" : "FALSE" );\r
                \r
                if ( module.pch != NULL )\r
@@ -336,8 +337,8 @@ MSVCBackend::_generate_vcproj ( const Module& module )
 \r
                fprintf ( OUT, "\t\t\t\tEnablePREfast=\"%s\"\r\n", debug ? "TRUE" : "FALSE");\r
                fprintf ( OUT, "\t\t\t\tDisableSpecificWarnings=\"4201;4127;4214\"\r\n" );\r
-               fprintf ( OUT, "\t\t\t\tWarningLevel=\"%s\"\r\n", release ? "0" : "4" );\r
-               fprintf ( OUT, "\t\t\t\tDetect64BitPortabilityProblems=\"%s\"\r\n", release ? "FALSE" : "TRUE");\r
+               fprintf ( OUT, "\t\t\t\tWarningLevel=\"%s\"\r\n", speed ? "0" : "4" );\r
+               fprintf ( OUT, "\t\t\t\tDetect64BitPortabilityProblems=\"%s\"\r\n", speed ? "FALSE" : "TRUE");\r
                if ( !module.cplusplus )\r
                        fprintf ( OUT, "\t\t\t\tCompileAs=\"1\"\r\n" );\r
                fprintf ( OUT, "\t\t\t\tDebugInformationFormat=\"%s\"/>\r\n", speed ? "0" : "4");\r
@@ -384,31 +385,39 @@ MSVCBackend::_generate_vcproj ( const Module& module )
 \r
                        if ( sys )\r
                        {\r
-                               fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /DRIVER /ALIGN:0x20 /SUBSYSTEM:NATIVE /SECTION:INIT,D /NODEFAULTLIB /IGNORE:4001,4037,4039,4065,4070,4078,4087,4089,4096\"\r\n" );\r
+                               fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /ALIGN:0x20 /SECTION:INIT,D /IGNORE:4001,4037,4039,4065,4070,4078,4087,4089,4096\"\r\n" );\r
                                fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" );\r
+                               fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", 3 );\r
+                               fprintf ( OUT, "\t\t\t\tDriver=\"%d\"\r\n", 1 );\r
+                               fprintf ( OUT, "\t\t\t\tCallingConvention=\"%d\"\r\n", 2 );\r
                                fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.entrypoint == "" ? "DriverEntry" : module.entrypoint.c_str ());\r
                                fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr == "" ? "0x10000" : baseaddr.c_str ());       \r
                        }\r
                        else if ( exe )\r
                        {\r
                                if ( module.type == Kernel )\r
-                               {\r
-                                       fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /SUBSYSTEM:NATIVE /NODEFAULTLIB /SECTION:INIT,D /ALIGN:0x80\"\r\n" );\r
-                                       fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" );\r
+                               {\r
+                                       fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /SECTION:INIT,D /ALIGN:0x80\"\r\n" );\r
+                                       fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" );\r
+                                       fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", 3 );\r
+                                       fprintf ( OUT, "\t\t\t\tDriver=\"%d\"\r\n", 1 );\r
+                                       fprintf ( OUT, "\t\t\t\tCallingConvention=\"%d\"\r\n", 2 );\r
                                        fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"KiSystemStartup\"\r\n" );\r
                                        fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr.c_str ());    \r
-                               }\r
+                               }\r
                                else if ( module.type == NativeCUI )\r
                                {\r
-                                       fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /SUBSYSTEM:NATIVE /NODEFAULTLIB /ALIGN:0x20\"\r\n" );\r
-                                       fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" );\r
+                                       fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /ALIGN:0x20\"\r\n" );\r
+                                       fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", 1 );\r
+                                       fprintf ( OUT, "\t\t\t\tCallingConvention=\"%d\"\r\n", 2 );\r
+                                       fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" );\r
                                        fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"NtProcessStartup\"\r\n" );\r
                                        fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr.c_str ());    \r
                                }\r
                                else if ( module.type == Win32CUI || module.type == Win32GUI )\r
-                               {\r
-                                       fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", console ? 1 : 2 );\r
-                               }\r
+                               {\r
+                                       fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", console ? 1 : 2 );\r
+                               }\r
                        }\r
                        else if ( dll )\r
                        {\r