mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
enhance generated msvc projects - patch by Brezenbak
svn path=/trunk/; revision=19743
This commit is contained in:
parent
9ff294c54e
commit
0e2e90ebaa
1 changed files with 54 additions and 18 deletions
|
@ -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, "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\r\n" );
|
||||
fprintf ( OUT, "<VisualStudioProject\r\n" );
|
||||
|
@ -232,7 +234,9 @@ MSVCBackend::_generate_vcproj ( const Module& module )
|
|||
{
|
||||
if ( multiple_includes )
|
||||
fprintf ( OUT, ";" );
|
||||
|
||||
fprintf ( OUT, "%s", include.c_str() );
|
||||
include_string += " /I " + include;
|
||||
multiple_includes = true;
|
||||
}
|
||||
}
|
||||
|
@ -293,7 +297,7 @@ MSVCBackend::_generate_vcproj ( const Module& module )
|
|||
{
|
||||
fprintf ( OUT, "\t\t\t<Tool\r\n" );
|
||||
fprintf ( OUT, "\t\t\t\tName=\"VCLibrarianTool\"\r\n" );
|
||||
fprintf ( OUT, "\t\t\t\tOutputFile=\"$(OutDir)/%s%s\"/>\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<File\r\n" );
|
||||
fprintf ( OUT, "\t\t\t\tRelativePath=\"%s\">\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<FileConfiguration\r\n" );
|
||||
fprintf ( OUT, "\t\t\t\t\tName=\"" );
|
||||
fprintf ( OUT, config.c_str());
|
||||
fprintf ( OUT, "|Win32\">\r\n" );
|
||||
fprintf ( OUT, "\t\t\t\t\t<Tool\r\n" );
|
||||
fprintf ( OUT, "\t\t\t\t\t\tName=\"VCCustomBuildTool\"\r\n" );
|
||||
fprintf ( OUT, "\t\t\t\t\t\tCommandLine=\"cl /E "$(InputPath)" | as -o "$(OutDir)\\$(InputName).obj"\"\r\n" );
|
||||
fprintf ( OUT, "\t\t\t\t\t\tOutputs=\"$(OutDir)\\$(InputName).obj\"/>\r\n" );
|
||||
fprintf ( OUT, "\t\t\t\t</FileConfiguration>\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<FileConfiguration\r\n" );
|
||||
fprintf ( OUT, "\t\t\t\t\tName=\"" );
|
||||
fprintf ( OUT, config.c_str() );
|
||||
fprintf ( OUT, "|Win32\">\r\n" );
|
||||
fprintf ( OUT, "\t\t\t\t\t<Tool\r\n" );
|
||||
if (source_file.at(source_file.size() - 1) == 'c' || source_file.find(".cpp") != string::npos)
|
||||
{
|
||||
fprintf ( OUT, "\t\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n" );
|
||||
fprintf ( OUT, "\t\t\t\t\t\tObjectFile=\"$(OutDir)\\%s.obj\"/>\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</FileConfiguration>\r\n" );
|
||||
}
|
||||
fprintf ( OUT, "\t\t\t</File>\r\n" );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue