mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
fix for creating *.sln file
svn path=/trunk/; revision=18622
This commit is contained in:
parent
2eb4ba358b
commit
ee2234a457
3 changed files with 76 additions and 31 deletions
|
@ -20,6 +20,12 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "msvc.h"
|
||||
#include <string>
|
||||
|
||||
using std::string;
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <objbase.h>
|
||||
#include <stdio.h>
|
||||
|
@ -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 */
|
||||
|
|
|
@ -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<Dependency*>& dependencies );
|
||||
|
||||
};
|
||||
|
||||
#endif // __MSVC_H__
|
||||
|
|
|
@ -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<Dependency*>& 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;
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue