mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 21:32:56 +00:00
Start implementing Visual Studio 2010 support.
This is seriously boring, don't expect it anytime soon :( svn path=/trunk/; revision=44406
This commit is contained in:
parent
0f11aa37e2
commit
ca6850941c
5 changed files with 211 additions and 9 deletions
|
@ -138,12 +138,16 @@ void MSVCBackend::ProcessModules()
|
||||||
|
|
||||||
ProjMaker *projMaker;
|
ProjMaker *projMaker;
|
||||||
|
|
||||||
string vcproj_file = VcprojFileName(module);
|
|
||||||
|
|
||||||
if (configuration.VSProjectVersion == "10.00")
|
if (configuration.VSProjectVersion == "10.00")
|
||||||
|
{
|
||||||
|
string vcproj_file = VcprojFileName(module);
|
||||||
projMaker = new VCXProjMaker( configuration, m_configurations, vcproj_file );
|
projMaker = new VCXProjMaker( configuration, m_configurations, vcproj_file );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
projMaker = new VCProjMaker( configuration, m_configurations, vcproj_file );
|
{
|
||||||
|
string vcxproj_file = VcxprojFileName(module);
|
||||||
|
projMaker = new VCProjMaker( configuration, m_configurations, vcxproj_file );
|
||||||
|
}
|
||||||
|
|
||||||
projMaker->_generate_proj_file ( module );
|
projMaker->_generate_proj_file ( module );
|
||||||
delete projMaker;
|
delete projMaker;
|
||||||
|
@ -275,6 +279,14 @@ MSVCBackend::VcprojFileName ( const Module& module ) const
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
MSVCBackend::VcxprojFileName ( const Module& module ) const
|
||||||
|
{
|
||||||
|
return FixSeparatorForSystemCommand(
|
||||||
|
ReplaceExtension ( module.output->relative_path + "\\" + module.name, "_" + _get_vc_dir() + "_auto.vcxproj" )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
std::string MSVCBackend::_get_vc_dir ( void ) const
|
std::string MSVCBackend::_get_vc_dir ( void ) const
|
||||||
{
|
{
|
||||||
if ( configuration.VSProjectVersion == "8.00" )
|
if ( configuration.VSProjectVersion == "8.00" )
|
||||||
|
|
|
@ -103,6 +103,7 @@ class MSVCBackend : public Backend
|
||||||
void OutputFileUnits();
|
void OutputFileUnits();
|
||||||
|
|
||||||
std::string VcprojFileName ( const Module& module ) const;
|
std::string VcprojFileName ( const Module& module ) const;
|
||||||
|
std::string VcxprojFileName ( const Module& module ) const;
|
||||||
std::string SlnFileName ( const Module& module ) const;
|
std::string SlnFileName ( const Module& module ) const;
|
||||||
std::string SuoFileName ( const Module& module ) const;
|
std::string SuoFileName ( const Module& module ) const;
|
||||||
std::string NcbFileName ( const Module& module ) const;
|
std::string NcbFileName ( const Module& module ) const;
|
||||||
|
|
|
@ -107,7 +107,7 @@ VCProjMaker::_generate_proj_file ( const Module& module )
|
||||||
if ((computername != "") && (username != ""))
|
if ((computername != "") && (username != ""))
|
||||||
vcproj_file_user = vcproj_file + "." + computername + "." + username + ".user";
|
vcproj_file_user = vcproj_file + "." + computername + "." + username + ".user";
|
||||||
|
|
||||||
printf ( "Creating MSVC.NET project: '%s'\n", vcproj_file.c_str() );
|
printf ( "Creating MSVC project: '%s'\n", vcproj_file.c_str() );
|
||||||
|
|
||||||
string path_basedir = module.GetPathToBaseDir ();
|
string path_basedir = module.GetPathToBaseDir ();
|
||||||
string intenv = Environment::GetIntermediatePath ();
|
string intenv = Environment::GetIntermediatePath ();
|
||||||
|
|
|
@ -75,8 +75,195 @@ VCXProjMaker::~VCXProjMaker()
|
||||||
void
|
void
|
||||||
VCXProjMaker::_generate_proj_file ( const Module& module )
|
VCXProjMaker::_generate_proj_file ( const Module& module )
|
||||||
{
|
{
|
||||||
// TODO: Implement me
|
size_t i;
|
||||||
ProjMaker::_generate_proj_file ( module );
|
|
||||||
|
string computername;
|
||||||
|
string username;
|
||||||
|
|
||||||
|
// make sure the containers are empty
|
||||||
|
header_files.clear();
|
||||||
|
includes.clear();
|
||||||
|
includes_ros.clear();
|
||||||
|
libraries.clear();
|
||||||
|
common_defines.clear();
|
||||||
|
|
||||||
|
if (getenv ( "USERNAME" ) != NULL)
|
||||||
|
username = getenv ( "USERNAME" );
|
||||||
|
if (getenv ( "COMPUTERNAME" ) != NULL)
|
||||||
|
computername = getenv ( "COMPUTERNAME" );
|
||||||
|
else if (getenv ( "HOSTNAME" ) != NULL)
|
||||||
|
computername = getenv ( "HOSTNAME" );
|
||||||
|
|
||||||
|
string vcproj_file_user = "";
|
||||||
|
|
||||||
|
if ((computername != "") && (username != ""))
|
||||||
|
vcproj_file_user = vcproj_file + "." + computername + "." + username + ".user";
|
||||||
|
|
||||||
|
printf ( "Creating MSVC project: '%s'\n", vcproj_file.c_str() );
|
||||||
|
|
||||||
|
string path_basedir = module.GetPathToBaseDir ();
|
||||||
|
string intenv = Environment::GetIntermediatePath ();
|
||||||
|
string outenv = Environment::GetOutputPath ();
|
||||||
|
string outdir;
|
||||||
|
string intdir;
|
||||||
|
string vcdir;
|
||||||
|
|
||||||
|
if ( intenv == "obj-i386" )
|
||||||
|
intdir = path_basedir + "obj-i386"; /* append relative dir from project dir */
|
||||||
|
else
|
||||||
|
intdir = intenv;
|
||||||
|
|
||||||
|
if ( outenv == "output-i386" )
|
||||||
|
outdir = path_basedir + "output-i386";
|
||||||
|
else
|
||||||
|
outdir = outenv;
|
||||||
|
|
||||||
|
if ( configuration.UseVSVersionInPath )
|
||||||
|
{
|
||||||
|
vcdir = DEF_SSEP + _get_vc_dir();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool include_idl = false;
|
||||||
|
|
||||||
|
vector<string> source_files, resource_files;
|
||||||
|
vector<const IfableData*> ifs_list;
|
||||||
|
ifs_list.push_back ( &module.project.non_if_data );
|
||||||
|
ifs_list.push_back ( &module.non_if_data );
|
||||||
|
|
||||||
|
while ( ifs_list.size() )
|
||||||
|
{
|
||||||
|
const IfableData& data = *ifs_list.back();
|
||||||
|
ifs_list.pop_back();
|
||||||
|
const vector<File*>& files = data.files;
|
||||||
|
for ( i = 0; i < files.size(); i++ )
|
||||||
|
{
|
||||||
|
if (files[i]->file.directory != SourceDirectory)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// We want the full path here for directory support later on
|
||||||
|
string path = Path::RelativeFromDirectory (
|
||||||
|
files[i]->file.relative_path,
|
||||||
|
module.output->relative_path );
|
||||||
|
string file = path + std::string("\\") + files[i]->file.name;
|
||||||
|
|
||||||
|
if ( !stricmp ( Right(file,3).c_str(), ".rc" ) )
|
||||||
|
resource_files.push_back ( file );
|
||||||
|
else if ( !stricmp ( Right(file,2).c_str(), ".h" ) )
|
||||||
|
header_files.push_back ( file );
|
||||||
|
else
|
||||||
|
source_files.push_back ( file );
|
||||||
|
}
|
||||||
|
const vector<Include*>& incs = data.includes;
|
||||||
|
for ( i = 0; i < incs.size(); i++ )
|
||||||
|
{
|
||||||
|
string path = Path::RelativeFromDirectory (
|
||||||
|
incs[i]->directory->relative_path,
|
||||||
|
module.output->relative_path );
|
||||||
|
if ( module.type != RpcServer && module.type != RpcClient )
|
||||||
|
{
|
||||||
|
if ( path.find ("/include/reactos/idl") != string::npos)
|
||||||
|
{
|
||||||
|
include_idl = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// switch between general headers and ros headers
|
||||||
|
if ( !strncmp(incs[i]->directory->relative_path.c_str(), "include\\crt", 11 ) ||
|
||||||
|
!strncmp(incs[i]->directory->relative_path.c_str(), "include\\ddk", 11 ) ||
|
||||||
|
!strncmp(incs[i]->directory->relative_path.c_str(), "include\\GL", 10 ) ||
|
||||||
|
!strncmp(incs[i]->directory->relative_path.c_str(), "include\\psdk", 12 ) ||
|
||||||
|
!strncmp(incs[i]->directory->relative_path.c_str(), "include\\reactos\\wine", 20 ) )
|
||||||
|
{
|
||||||
|
if (strncmp(incs[i]->directory->relative_path.c_str(), "include\\crt", 11 ))
|
||||||
|
// not crt include
|
||||||
|
includes_ros.push_back ( path );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
includes.push_back ( path );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const vector<Library*>& libs = data.libraries;
|
||||||
|
for ( i = 0; i < libs.size(); i++ )
|
||||||
|
{
|
||||||
|
string libpath = outdir + "\\" + libs[i]->importedModule->output->relative_path + "\\" + _get_vc_dir() + "\\---\\" + libs[i]->name + ".lib";
|
||||||
|
libraries.push_back ( libpath );
|
||||||
|
}
|
||||||
|
const vector<Define*>& defs = data.defines;
|
||||||
|
for ( i = 0; i < defs.size(); i++ )
|
||||||
|
{
|
||||||
|
if ( defs[i]->backend != "" && defs[i]->backend != "msvc" )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ( defs[i]->value[0] )
|
||||||
|
common_defines.insert( defs[i]->name + "=" + defs[i]->value );
|
||||||
|
else
|
||||||
|
common_defines.insert( defs[i]->name );
|
||||||
|
}
|
||||||
|
for ( std::map<std::string, Property*>::const_iterator p = data.properties.begin(); p != data.properties.end(); ++ p )
|
||||||
|
{
|
||||||
|
Property& prop = *p->second;
|
||||||
|
if ( strstr ( module.baseaddress.c_str(), prop.name.c_str() ) )
|
||||||
|
baseaddr = prop.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* include intermediate path for reactos.rc */
|
||||||
|
string version = intdir + "\\include";
|
||||||
|
includes.push_back (version);
|
||||||
|
version += "\\reactos";
|
||||||
|
includes.push_back (version);
|
||||||
|
|
||||||
|
// Set the binary type
|
||||||
|
string module_type = GetExtension(*module.output);
|
||||||
|
BinaryType binaryType;
|
||||||
|
if ((module.type == ObjectLibrary) || (module.type == RpcClient) ||(module.type == RpcServer) || (module_type == ".lib") || (module_type == ".a"))
|
||||||
|
binaryType = Lib;
|
||||||
|
else if ((module_type == ".dll") || (module_type == ".cpl"))
|
||||||
|
binaryType = Dll;
|
||||||
|
else if ((module_type == ".exe") || (module_type == ".scr"))
|
||||||
|
binaryType = Exe;
|
||||||
|
else if (module_type == ".sys")
|
||||||
|
binaryType = Sys;
|
||||||
|
else
|
||||||
|
binaryType = BinUnknown;
|
||||||
|
|
||||||
|
string include_string;
|
||||||
|
|
||||||
|
fprintf ( OUT, "<?xml version=\"1.0\" encoding = \"utf-8\"?>\r\n" );
|
||||||
|
fprintf ( OUT, "<Project " );
|
||||||
|
fprintf ( OUT, "DefaultTargets=\"Build\" " ); //FIXME: what's Build??
|
||||||
|
fprintf ( OUT, "ToolsVersion=\"4.0\" " ); //FIXME: Is it always 4.0??
|
||||||
|
fprintf ( OUT, "xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n" );
|
||||||
|
|
||||||
|
if (configuration.VSProjectVersion.empty())
|
||||||
|
configuration.VSProjectVersion = "10.00";
|
||||||
|
|
||||||
|
// Write out the configurations
|
||||||
|
fprintf ( OUT, "\t<ItemGroup Label=\"ProjectConfigurations\">\r\n" );
|
||||||
|
for ( size_t icfg = 0; icfg < m_configurations.size(); icfg++ )
|
||||||
|
{
|
||||||
|
const MSVCConfiguration& cfg = *m_configurations[icfg];
|
||||||
|
|
||||||
|
if ( cfg.optimization == RosBuild )
|
||||||
|
{
|
||||||
|
_generate_makefile_configuration( module, cfg );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_generate_standard_configuration( module, cfg, binaryType );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fprintf ( OUT, "\t</ItemGroup>\r\n" );
|
||||||
|
|
||||||
|
// Write out the global info
|
||||||
|
fprintf ( OUT, "\t<PropertyGroup Label=\"Globals\">\r\n" );
|
||||||
|
fprintf ( OUT, "\t\t<ProjectGuid>{%s}</ProjectGuid>\r\n", module.guid.c_str() );
|
||||||
|
fprintf ( OUT, "\t\t<Keyword>%s</Keyword>\r\n", "Win32Proj" ); //FIXME: Win32Proj???
|
||||||
|
fprintf ( OUT, "\t\t<RootNamespace>%s</RootNamespace>\r\n", module.name.c_str() ); //FIXME: shouldn't this be the soltion name?
|
||||||
|
fprintf ( OUT, "\t</PropertyGroup>\r\n" );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -89,8 +276,10 @@ VCXProjMaker::_generate_user_configuration ()
|
||||||
void
|
void
|
||||||
VCXProjMaker::_generate_standard_configuration( const Module& module, const MSVCConfiguration& cfg, BinaryType binaryType )
|
VCXProjMaker::_generate_standard_configuration( const Module& module, const MSVCConfiguration& cfg, BinaryType binaryType )
|
||||||
{
|
{
|
||||||
// TODO: Implement me
|
fprintf ( OUT, "\t\t<ProjectConfiguration Include=\"%s|Win32\">\r\n", cfg.name.c_str() );
|
||||||
ProjMaker::_generate_standard_configuration ( module, cfg, binaryType );
|
fprintf ( OUT, "\t\t<Configuration>%s</Configuration>\r\n", cfg.name.c_str() );
|
||||||
|
fprintf ( OUT, "\t\t<Platform>Win32</Platform>\r\n" );
|
||||||
|
fprintf ( OUT, "\t</ProjectConfiguration>\r\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -68,7 +68,7 @@ extern char cBadSep;
|
||||||
#define DEF_SBAD_SEP "\\"
|
#define DEF_SBAD_SEP "\\"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MS_VS_DEF_VERSION "8.00"
|
#define MS_VS_DEF_VERSION "9.00"
|
||||||
|
|
||||||
class XmlNode;
|
class XmlNode;
|
||||||
class Directory;
|
class Directory;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue