From ee2234a457bbd079793fae0177b6ea4f2e1c88fa Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Thu, 20 Oct 2005 08:46:55 +0000 Subject: [PATCH] fix for creating *.sln file svn path=/trunk/; revision=18622 --- reactos/tools/rbuild/backend/msvc/genguid.cpp | 25 +++++-- reactos/tools/rbuild/backend/msvc/msvc.h | 11 +++ .../tools/rbuild/backend/msvc/vcprojmaker.cpp | 71 ++++++++++++------- 3 files changed, 76 insertions(+), 31 deletions(-) diff --git a/reactos/tools/rbuild/backend/msvc/genguid.cpp b/reactos/tools/rbuild/backend/msvc/genguid.cpp index bfe11b34be7..f3dc7ede3bc 100644 --- a/reactos/tools/rbuild/backend/msvc/genguid.cpp +++ b/reactos/tools/rbuild/backend/msvc/genguid.cpp @@ -20,6 +20,12 @@ * */ + +#include "msvc.h" +#include + +using std::string; + #ifdef _WIN32 #include #include @@ -32,12 +38,15 @@ static CoInitializeFunc *pCoInitialize = NULL; static CoUninitializeFunc *pCoUninitialize = NULL; static CoCreateGuidFunc *pCoCreateGuid = NULL; -void gen_guid() + +std::string +MSVCBackend::_gen_guid() { GUID m_guid; HRESULT result; bool good_guid = false; - + char* guid; + // Load ole32. We will need it later on HMODULE olelib = LoadLibrary ( "ole32.dll" ); if ( olelib != NULL ) @@ -67,16 +76,20 @@ void gen_guid() { // TODO FIXME - fall-back to random #'s } - const char* strfmt = "%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X\r\n"; - printf(strfmt,m_guid.Data1,m_guid.Data2,m_guid.Data3,m_guid.Data4[0], + const char* strfmt = "%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X"; + sprintf(guid, strfmt,m_guid.Data1,m_guid.Data2,m_guid.Data3,m_guid.Data4[0], m_guid.Data4[1],m_guid.Data4[2],m_guid.Data4[3],m_guid.Data4[4],m_guid.Data4[5], m_guid.Data4[6],m_guid.Data4[7],m_guid.Data1,m_guid.Data2,m_guid.Data3,m_guid.Data4[0], m_guid.Data4[1],m_guid.Data4[2],m_guid.Data4[3],m_guid.Data4[4],m_guid.Data4[5], m_guid.Data4[6],m_guid.Data4[7]); + + return guid; } -#else /* Linux, etc */ -void gen_guid() +#else /* Linux, etc */ + +std::string +MSVCBackend::_gen_guid() { } #endif /* WIN32/Linux */ diff --git a/reactos/tools/rbuild/backend/msvc/msvc.h b/reactos/tools/rbuild/backend/msvc/msvc.h index f8805bd09d2..ccabc4e7526 100644 --- a/reactos/tools/rbuild/backend/msvc/msvc.h +++ b/reactos/tools/rbuild/backend/msvc/msvc.h @@ -78,10 +78,21 @@ class MSVCBackend : public Backend void _generate_wine_dsw ( FILE* OUT ); // functions in vcprojmaker.cpp: + + std::string _gen_guid(); void _generate_vcproj ( const Module& module ); void _generate_sln_header ( FILE* OUT ); + void _generate_sln_footer ( FILE* OUT ); void _generate_sln ( FILE* OUT ); + void _generate_sln_project ( + FILE* OUT, + const Module& module, + std::string dsp_file, + std::string sln_guid, + std::string vcproj_guid, + const std::vector& dependencies ); + }; #endif // __MSVC_H__ diff --git a/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp b/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp index aed7bc3ba86..dd2463e6556 100644 --- a/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp +++ b/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp @@ -409,9 +409,52 @@ MSVCBackend::_generate_sln_header ( FILE* OUT ) fprintf ( OUT, "\r\n" ); } + +void +MSVCBackend::_generate_sln_project ( + FILE* OUT, + const Module& module, + std::string vcproj_file, + std::string sln_guid, + std::string vcproj_guid, + const std::vector& dependencies ) +{ + + vcproj_file = DosSeparator ( std::string(".\\") + vcproj_file ); + + fprintf ( OUT, "Project(\"%s\") = \"%s\", \"%s\", \"%s\"\r\n", sln_guid.c_str() , module.name.c_str(), vcproj_file.c_str(), vcproj_guid.c_str() ); + fprintf ( OUT, " ProjectSection(ProjectDependencies) = postProject\r\n" ); + fprintf ( OUT, " EndProjectSection\r\n" ); + fprintf ( OUT, "EndProject\r\n" ); +} + + +void +MSVCBackend::_generate_sln_footer ( FILE* OUT ) +{ + fprintf ( OUT, "Global\r\n" ); + + fprintf ( OUT, " GlobalSection(SolutionConfiguration) = preSolution\r\n" ); + fprintf ( OUT, " Debug = Debug\r\n" ); + fprintf ( OUT, " Release = Release\r\n" ); + fprintf ( OUT, " EndGlobalSection\r\n" ); + + fprintf ( OUT, " GlobalSection(ExtensibilityGlobals) = postSolution\r\n" ); + fprintf ( OUT, " EndGlobalSection\r\n" ); + fprintf ( OUT, " GlobalSection(ExtensibilityAddIns) = postSolution\r\n" ); + fprintf ( OUT, " EndGlobalSection\r\n" ); + fprintf ( OUT, "EndGlobal\r\n" ); + + + fprintf ( OUT, "\r\n" ); +} + + void MSVCBackend::_generate_sln ( FILE* OUT ) { + string sln_guid = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"; + _generate_sln_header(OUT); // TODO FIXME - is it necessary to sort them? for ( size_t i = 0; i < ProjectNode.modules.size(); i++ ) @@ -419,31 +462,9 @@ MSVCBackend::_generate_sln ( FILE* OUT ) Module& module = *ProjectNode.modules[i]; std::string vcproj_file = VcprojFileName ( module ); - _generate_dsw_project ( OUT, module, vcproj_file, module.dependencies ); + std::string vcproj_guid = _gen_guid(); + _generate_sln_project ( OUT, module, vcproj_file, sln_guid, vcproj_guid, module.dependencies ); } -// _generate_dsw_footer ( OUT ); + _generate_sln_footer ( OUT ); } - - -/* - m_devFile << "Microsoft Visual Studio Solution File, Format Version 9.00" << endl; - m_devFile << "# Visual Studio 2005" << endl; - - m_devFile << "# FIXME Project listings here" << endl; - m_devFile << "EndProject" << endl; - m_devFile << "Global" << endl; - m_devFile << " GlobalSection(SolutionConfigurationPlatforms) = preSolution" << endl; - m_devFile << " Debug|Win32 = Debug|Win32" << endl; - m_devFile << " Release|Win32 = Release|Win32" << endl; - m_devFile << " EndGlobalSection" << endl; - m_devFile << " GlobalSection(ProjectConfigurationPlatforms) = postSolution" << endl; - m_devFile << " #FIXME Project Listings Here" << endl; - m_devFile << " EndGlobalSection" << endl; - m_devFile << " GlobalSection(SolutionProperties) = preSolution" << endl; - m_devFile << " HideSolutionNode = FALSE" << endl; - m_devFile << " EndGlobalSection" << endl; - m_devFile << "EndGlobal" << endl; - - m_devFile << endl << endl; -*/