diff --git a/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp b/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp index 5c1a7bbb904..ddac0078089 100644 --- a/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp +++ b/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp @@ -56,6 +56,7 @@ MSVCBackend::_generate_vcproj ( const Module& module ) bool lib = (module.type == ObjectLibrary) || (module_type == ".lib") || (module_type == ".a"); bool dll = (module_type == ".dll") || (module_type == ".cpl"); bool exe = (module_type == ".exe"); + bool sys = (module_type == ".sys"); // TODO FIXME - need more checks here for 'sys' and possibly 'drv'? bool console = exe && (module.type == Win32CUI); @@ -172,6 +173,7 @@ MSVCBackend::_generate_vcproj ( const Module& module ) } string default_cfg = cfgs.back(); + string include_string; fprintf ( OUT, "\r\n" ); fprintf ( OUT, "\r\n", module.name.c_str(), module_type.c_str() ); + fprintf ( OUT, "\t\t\t\tOutputFile=\"$(OutDir)/%s.lib\"/>\r\n", module.name.c_str() ); } else { @@ -316,7 +320,32 @@ MSVCBackend::_generate_vcproj ( const Module& module ) if ( debug ) fprintf ( OUT, "\t\t\t\tProgramDatabaseFile=\"$(OutDir)/%s.pdb\"\r\n", module.name.c_str() ); - fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", console ? 1 : 2 ); + if ( sys ) + { + fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /DRIVER /ALIGN:0x20 /subsystem:NATIVE /SECTION:INIT,D /FORCE:MULTIPLE /IGNORE:4001,4037,4039,4065,4070,4078,4087,4089,4096\"\r\n" ); + fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" ); + fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.entrypoint == "" ? "DriverEntry" : module.entrypoint.c_str ()); + fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", module.baseaddress == "" ? "0x10000" : module.baseaddress.c_str ()); + } + else if ( exe ) + { + if( module.non_if_data.compilationUnits.size () > 0 ) /* native apps */ + { + fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /SUBSYSTEM:NATIVE /SECTION:INIT,D /ALIGN:4096 /FORCE:MULTIPLE\"\r\n" ); + fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" ); + } + else /* non native apps */ + { + fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", console ? 1 : 2 ); + } + fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.entrypoint.c_str ()); + fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", module.baseaddress.c_str ()); + } + else if ( dll) + { + fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.entrypoint == "" ? "DllMain" : module.entrypoint.c_str ()); + fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", module.baseaddress == "" ? "0x40000" : module.baseaddress.c_str ()); + } fprintf ( OUT, "\t\t\t\tTargetMachine=\"%d\"/>\r\n", 1 ); } @@ -364,26 +393,33 @@ MSVCBackend::_generate_vcproj ( const Module& module ) fprintf ( OUT, "\t\t\tFilter=\"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;S\">\r\n" ); for ( size_t isrcfile = 0; isrcfile < source_files.size(); isrcfile++ ) { - const string& source_file = DosSeparator(source_files[isrcfile]); + string source_file = DosSeparator(source_files[isrcfile]); fprintf ( OUT, "\t\t\t\r\n", source_file.c_str() ); - if (configuration.VSProjectVersion < "8.00") { - if (source_file.at(source_file.size() - 1) == 'S') { - for ( size_t iconfig = 0; iconfig < cfgs.size(); iconfig++ ) - { - std::string& config = cfgs[iconfig]; - fprintf ( OUT, "\t\t\t\t\r\n" ); - fprintf ( OUT, "\t\t\t\t\t\r\n" ); - fprintf ( OUT, "\t\t\t\t\r\n" ); - } + source_file.erase(0,2); + source_file = _replace_str(source_file, "\\", "-"); + string src_string = source_file.substr(0, source_file.find(".")); + for ( size_t iconfig = 0; iconfig < cfgs.size(); iconfig++ ) + { + std::string& config = cfgs[iconfig]; + fprintf ( OUT, "\t\t\t\t\r\n" ); + fprintf ( OUT, "\t\t\t\t\t\r\n", src_string.c_str()); } + else if (configuration.VSProjectVersion < "8.00" && (source_file.find(".asm") != string::npos || tolower(source_file.at(source_file.size() - 1)) == 's')) + { + fprintf ( OUT, "\t\t\t\t\t\tName=\"VCCustomBuildTool\"\r\n" ); + fprintf ( OUT, "\t\t\t\t\t\tCommandLine=\"cl /E "$(InputPath)" %s /D__ASM__ | as -o "$(OutDir)\\%s.obj"\"\r\n",include_string.c_str(), src_string.c_str() ); + fprintf ( OUT, "\t\t\t\t\t\tOutputs=\"$(OutDir)\\%s.obj\"/>\r\n",src_string.c_str() ); + } + fprintf ( OUT, "\t\t\t\t\r\n" ); } fprintf ( OUT, "\t\t\t\r\n" ); }