Author: gedmurphy Date: Fri Dec 4 17:15:08 2009 New Revision: 44406
URL: http://svn.reactos.org/svn/reactos?rev=44406&view=rev Log: Start implementing Visual Studio 2010 support. This is seriously boring, don't expect it anytime soon :(
Modified: trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp trunk/reactos/tools/rbuild/backend/msvc/msvc.h trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp trunk/reactos/tools/rbuild/backend/msvc/vcxprojmaker.cpp trunk/reactos/tools/rbuild/rbuild.h
Modified: trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/m... ============================================================================== --- trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp [iso-8859-1] (original) +++ trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp [iso-8859-1] Fri Dec 4 17:15:08 2009 @@ -138,12 +138,16 @@
ProjMaker *projMaker;
- string vcproj_file = VcprojFileName(module); - if (configuration.VSProjectVersion == "10.00") + { + string vcproj_file = VcprojFileName(module); projMaker = new VCXProjMaker( configuration, m_configurations, vcproj_file ); + } 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 ); delete projMaker; @@ -272,6 +276,14 @@ { return FixSeparatorForSystemCommand( ReplaceExtension ( module.output->relative_path + "\" + module.name, "_" + _get_vc_dir() + "_auto.vcproj" ) + ); +} + +std::string +MSVCBackend::VcxprojFileName ( const Module& module ) const +{ + return FixSeparatorForSystemCommand( + ReplaceExtension ( module.output->relative_path + "\" + module.name, "_" + _get_vc_dir() + "_auto.vcxproj" ) ); }
Modified: trunk/reactos/tools/rbuild/backend/msvc/msvc.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/m... ============================================================================== --- trunk/reactos/tools/rbuild/backend/msvc/msvc.h [iso-8859-1] (original) +++ trunk/reactos/tools/rbuild/backend/msvc/msvc.h [iso-8859-1] Fri Dec 4 17:15:08 2009 @@ -103,6 +103,7 @@ void OutputFileUnits();
std::string VcprojFileName ( const Module& module ) const; + std::string VcxprojFileName ( const Module& module ) const; std::string SlnFileName ( const Module& module ) const; std::string SuoFileName ( const Module& module ) const; std::string NcbFileName ( const Module& module ) const;
Modified: trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/v... ============================================================================== --- trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp [iso-8859-1] (original) +++ trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp [iso-8859-1] Fri Dec 4 17:15:08 2009 @@ -107,7 +107,7 @@ if ((computername != "") && (username != "")) 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 intenv = Environment::GetIntermediatePath ();
Modified: trunk/reactos/tools/rbuild/backend/msvc/vcxprojmaker.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/v... ============================================================================== --- trunk/reactos/tools/rbuild/backend/msvc/vcxprojmaker.cpp [iso-8859-1] (original) +++ trunk/reactos/tools/rbuild/backend/msvc/vcxprojmaker.cpp [iso-8859-1] Fri Dec 4 17:15:08 2009 @@ -75,8 +75,195 @@ void VCXProjMaker::_generate_proj_file ( const Module& module ) { - // TODO: Implement me - ProjMaker::_generate_proj_file ( module ); + size_t i; + + 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%5C%22%3E%5Cr%5Cn" ); + + 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 @@ -89,8 +276,10 @@ void VCXProjMaker::_generate_standard_configuration( const Module& module, const MSVCConfiguration& cfg, BinaryType binaryType ) { - // TODO: Implement me - ProjMaker::_generate_standard_configuration ( module, cfg, binaryType ); + fprintf ( OUT, "\t\t<ProjectConfiguration Include="%s|Win32">\r\n", cfg.name.c_str() ); + 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
Modified: trunk/reactos/tools/rbuild/rbuild.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/rbuild.h?rev=4... ============================================================================== --- trunk/reactos/tools/rbuild/rbuild.h [iso-8859-1] (original) +++ trunk/reactos/tools/rbuild/rbuild.h [iso-8859-1] Fri Dec 4 17:15:08 2009 @@ -68,7 +68,7 @@ #define DEF_SBAD_SEP "\" #endif
-#define MS_VS_DEF_VERSION "8.00" +#define MS_VS_DEF_VERSION "9.00"
class XmlNode; class Directory;