diff --git a/reactos/tools/rbuild/backend/msvc/msvc.cpp b/reactos/tools/rbuild/backend/msvc/msvc.cpp index a6105dd3619..b1370c7ca79 100644 --- a/reactos/tools/rbuild/backend/msvc/msvc.cpp +++ b/reactos/tools/rbuild/backend/msvc/msvc.cpp @@ -56,6 +56,27 @@ MSVCBackend::MSVCBackend(Project &project, void MSVCBackend::Process() { + // TODO FIXME wine hack? + bool only_msvc_headers = false; + + while ( m_configurations.size () > 0 ) + { + const MSVCConfiguration* cfg = m_configurations.back(); + m_configurations.pop_back(); + delete cfg; + } + + m_configurations.push_back ( new MSVCConfiguration( Debug )); + m_configurations.push_back ( new MSVCConfiguration( Release )); + m_configurations.push_back ( new MSVCConfiguration( Speed )); + + if (!only_msvc_headers) + { + m_configurations.push_back ( new MSVCConfiguration( Debug, WineHeaders )); + m_configurations.push_back ( new MSVCConfiguration( Release, WineHeaders )); + m_configurations.push_back ( new MSVCConfiguration( Speed, WineHeaders )); + } + if ( configuration.CleanAsYouGo ) { _clean_project_files(); return; @@ -65,21 +86,12 @@ void MSVCBackend::Process() return; } string filename_sln ( ProjectNode.name ); - //string filename_rules = "gccasm.rules"; if ( configuration.VSProjectVersion == "6.00" ) filename_sln += "_auto.dsw"; - else { + else filename_sln += "_auto.sln"; - //m_rulesFile = fopen ( filename_rules.c_str(), "wb" ); - //if ( m_rulesFile ) - //{ - // _generate_rules_file ( m_rulesFile ); - //} - //fclose ( m_rulesFile ); - } - printf ( "Creating MSVC workspace: %s\n", filename_sln.c_str() ); ProcessModules(); @@ -112,14 +124,6 @@ void MSVCBackend::ProcessModules() _generate_dsp ( module ); else _generate_vcproj ( module ); - - - /*for(size_t k = 0; k < module.non_if_data.files.size(); k++) - { - File &file = *module.non_if_data.files[k]; - - ProcessFile(file.name); - }*/ } } diff --git a/reactos/tools/rbuild/backend/msvc/msvc.h b/reactos/tools/rbuild/backend/msvc/msvc.h index bf906298748..669dc38d1a3 100644 --- a/reactos/tools/rbuild/backend/msvc/msvc.h +++ b/reactos/tools/rbuild/backend/msvc/msvc.h @@ -86,7 +86,7 @@ class MSVCBackend : public Backend std::string SuoFileName ( const Module& module ) const; std::string NcbFileName ( const Module& module ) const; - + std::vector m_configurations; std::vector m_fileUnits; std::vector m_folders; diff --git a/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp b/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp index 504c4920d86..c6bcf36a53f 100644 --- a/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp +++ b/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp @@ -100,23 +100,6 @@ MSVCBackend::_generate_vcproj ( const Module& module ) bool console = exe && (module.type == Win32CUI); - // TODO FIXME - not sure if the count here is right... - int parts = 0; - const char* p = strpbrk ( vcproj_file.c_str(), "/\\" ); - while ( p ) - { - ++parts; - p = strpbrk ( p+1, "/\\" ); - } - string msvc_wine_dir = ".."; - while ( --parts ) - msvc_wine_dir += "\\.."; - - string wine_include_dir = msvc_wine_dir + "\\include"; - - //$progress_current++; - //$output->progress("$dsp_file (file $progress_current of $progress_max)"); - string vcproj_path = module.GetBasePath(); vector source_files, resource_files, includes, includes_wine, libraries; StringSet common_defines; @@ -194,22 +177,6 @@ MSVCBackend::_generate_vcproj ( const Module& module ) vector header_files; - // TODO FIXME wine hack? - bool no_msvc_headers = true; - - std::vector cfgs; - - cfgs.push_back ( new MSVCConfiguration( Debug )); - cfgs.push_back ( new MSVCConfiguration( Release )); - cfgs.push_back ( new MSVCConfiguration( Speed )); - - if (!no_msvc_headers) - { - cfgs.push_back ( new MSVCConfiguration( Debug, WineHeaders )); - cfgs.push_back ( new MSVCConfiguration( Release, WineHeaders )); - cfgs.push_back ( new MSVCConfiguration( Speed, WineHeaders )); - } - string include_string; fprintf ( OUT, "\r\n" ); @@ -243,9 +210,9 @@ MSVCBackend::_generate_vcproj ( const Module& module ) std::string output_dir; fprintf ( OUT, "\t\r\n" ); - for ( size_t icfg = 0; icfg < cfgs.size(); icfg++ ) + for ( size_t icfg = 0; icfg < m_configurations.size(); icfg++ ) { - const MSVCConfiguration& cfg = *cfgs[icfg]; + const MSVCConfiguration& cfg = *m_configurations[icfg]; bool debug = ( cfg.optimization == Debug ); bool release = ( cfg.optimization == Release ); @@ -272,7 +239,6 @@ MSVCBackend::_generate_vcproj ( const Module& module ) { if ( multiple_includes ) fprintf ( OUT, ";" ); - fprintf ( OUT, "%s", include.c_str() ); include_string += " /I " + include; multiple_includes = true; @@ -523,9 +489,9 @@ MSVCBackend::_generate_vcproj ( const Module& module ) fprintf ( OUT, "\t\t\t\r\n", source_file.c_str() ); - for ( size_t iconfig = 0; iconfig < cfgs.size(); iconfig++ ) + for ( size_t iconfig = 0; iconfig < m_configurations.size(); iconfig++ ) { - const MSVCConfiguration& config = *cfgs[iconfig]; + const MSVCConfiguration& config = *m_configurations[iconfig]; if (( isrcfile == 0 ) && ( module.pch != NULL )) { @@ -635,31 +601,6 @@ MSVCBackend::_get_solution_verion ( void ) return version; } - -//void -//MSVCBackend::_generate_rules_file ( FILE* OUT ) -//{ -// fprintf ( OUT, "\r\n" ); -// fprintf ( OUT, "\r\n" ); -// fprintf ( OUT, "\t\r\n" ); -// fprintf ( OUT, "\t\t\r\n" ); -// fprintf ( OUT, "\t\t\t\r\n" ); -// fprintf ( OUT, "\t\t\t\r\n" ); -// fprintf ( OUT, "\t\t\r\n" ); -// fprintf ( OUT, "\t\r\n" ); -// fprintf ( OUT, "\r\n" ); -//} - void MSVCBackend::_generate_sln_header ( FILE* OUT ) { @@ -703,8 +644,8 @@ MSVCBackend::_generate_sln_footer ( FILE* OUT ) { fprintf ( OUT, "Global\r\n" ); fprintf ( OUT, "\tGlobalSection(SolutionConfiguration) = preSolution\r\n" ); - fprintf ( OUT, "\t\tDebug = Debug\r\n" ); - fprintf ( OUT, "\t\tRelease = Release\r\n" ); + for ( size_t i = 0; i < m_configurations.size(); i++ ) + fprintf ( OUT, "\t\t%s = %s\r\n", m_configurations[i]->name.c_str(), m_configurations[i]->name.c_str() ); fprintf ( OUT, "\tEndGlobalSection\r\n" ); fprintf ( OUT, "\tGlobalSection(ProjectConfiguration) = postSolution\r\n" ); for ( size_t i = 0; i < ProjectNode.modules.size(); i++ ) @@ -739,10 +680,12 @@ MSVCBackend::_generate_sln_footer ( FILE* OUT ) void MSVCBackend::_generate_sln_configurations ( FILE* OUT, std::string vcproj_guid ) { - fprintf ( OUT, "\t\t%s.Debug|Win32.ActiveCfg = Debug|Win32\r\n", vcproj_guid.c_str() ); - fprintf ( OUT, "\t\t%s.Debug|Win32.Build.0 = Debug|Win32\r\n", vcproj_guid.c_str() ); - fprintf ( OUT, "\t\t%s.Release|Win32.ActiveCfg = Release|Win32\r\n", vcproj_guid.c_str() ); - fprintf ( OUT, "\t\t%s.Release|Win32.Build.0 = Release|Win32\r\n", vcproj_guid.c_str() ); + for ( size_t i = 0; i < m_configurations.size (); i++) + { + const MSVCConfiguration& cfg = *m_configurations[i]; + fprintf ( OUT, "\t\t%s.%s|Win32.ActiveCfg = %s|Win32\r\n", vcproj_guid.c_str(), cfg.name.c_str(), cfg.name.c_str() ); + fprintf ( OUT, "\t\t%s.%s|Win32.Build.0 = %s|Win32\r\n", vcproj_guid.c_str(), cfg.name.c_str(), cfg.name.c_str() ); + } } void