mirror of
https://github.com/reactos/reactos.git
synced 2025-07-27 15:41:40 +00:00
Windres support.
svn path=/branches/xmlbuildsystem/; revision=13068
This commit is contained in:
parent
c5b25f41e4
commit
d451f1d1f2
4 changed files with 134 additions and 58 deletions
|
@ -1,4 +1,5 @@
|
|||
<module name="welcome" type="win32gui">
|
||||
<include base="welcome">.</include>
|
||||
<define name="_WIN32_IE">0x0501</define>
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<define name="__USE_W32API" />
|
||||
|
@ -6,4 +7,5 @@
|
|||
<library>gdi32</library>
|
||||
<library>user32</library>
|
||||
<file>welcome.c</file>
|
||||
<file>welcome.rc</file>
|
||||
</module>
|
||||
|
|
|
@ -154,13 +154,16 @@ MingwBackend::GenerateGlobalVariables ()
|
|||
fprintf ( fMakefile, "ld = ld\n" );
|
||||
fprintf ( fMakefile, "ar = ar\n" );
|
||||
fprintf ( fMakefile, "dlltool = dlltool\n\n" );
|
||||
fprintf ( fMakefile, "windres = windres\n\n" );
|
||||
GenerateGlobalCFlagsAndProperties (
|
||||
"=",
|
||||
ProjectNode.properties,
|
||||
ProjectNode.includes,
|
||||
ProjectNode.defines,
|
||||
ProjectNode.ifs );
|
||||
fprintf ( fMakefile, "PROJECT_LFLAGS = %s\n", GenerateProjectLFLAGS ().c_str () );
|
||||
fprintf ( fMakefile, "PROJECT_RCFLAGS = $(PROJECT_CFLAGS)\n" );
|
||||
fprintf ( fMakefile, "PROJECT_LFLAGS = %s\n",
|
||||
GenerateProjectLFLAGS ().c_str () );
|
||||
fprintf ( fMakefile, "\n" );
|
||||
|
||||
fprintf ( fMakefile, ".PHONY: clean\n\n" );
|
||||
|
|
|
@ -34,13 +34,13 @@ MingwModuleHandler::~MingwModuleHandler()
|
|||
}
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
void
|
||||
MingwModuleHandler::SetMakefile ( FILE* f )
|
||||
{
|
||||
fMakefile = f;
|
||||
}
|
||||
|
||||
/*static*/ MingwModuleHandler*
|
||||
MingwModuleHandler*
|
||||
MingwModuleHandler::LookupHandler ( const string& location,
|
||||
ModuleType moduletype )
|
||||
{
|
||||
|
@ -160,8 +160,14 @@ MingwModuleHandler::GetSourceFilenames ( const Module& module ) const
|
|||
string
|
||||
MingwModuleHandler::GetObjectFilename ( const string& sourceFilename ) const
|
||||
{
|
||||
string newExtension;
|
||||
string extension = GetExtension ( sourceFilename );
|
||||
if ( extension == ".rc" || extension == ".RC" )
|
||||
newExtension = ".coff";
|
||||
else
|
||||
newExtension = ".o";
|
||||
return FixupTargetFilename ( ReplaceExtension ( sourceFilename,
|
||||
".o" ) );
|
||||
newExtension ) );
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -239,19 +245,6 @@ MingwModuleHandler::GenerateGccIncludeParametersFromVector ( const vector<Includ
|
|||
return parameters;
|
||||
}
|
||||
|
||||
void
|
||||
MingwModuleHandler::GenerateGccModuleIncludeVariable ( const Module& module ) const
|
||||
{
|
||||
#if 0
|
||||
string name ( module.name + "_CFLAGS" );
|
||||
fprintf ( fMakefile,
|
||||
"%s := %s %s\n",
|
||||
name.c_str(),
|
||||
GenerateGccDefineParameters(module).c_str(),
|
||||
GenerateGccIncludeParameters(module).c_str() );
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
MingwModuleHandler::GenerateGccIncludeParameters ( const Module& module ) const
|
||||
{
|
||||
|
@ -287,26 +280,17 @@ MingwModuleHandler::GenerateLinkerParameters ( const Module& module ) const
|
|||
}
|
||||
|
||||
void
|
||||
MingwModuleHandler::GenerateMacros (
|
||||
const char* assignmentOperation,
|
||||
const vector<File*>& files,
|
||||
MingwModuleHandler::GenerateMacro ( const char* assignmentOperation,
|
||||
const string& macro,
|
||||
const vector<Include*>& includes,
|
||||
const vector<Define*>& defines,
|
||||
const vector<LinkerFlag*>* linkerFlags,
|
||||
const vector<If*>& ifs,
|
||||
const string& cflags_macro,
|
||||
const string& nasmflags_macro,
|
||||
const string& linkerflags_macro,
|
||||
const string& objs_macro) const
|
||||
const vector<Define*>& defines ) const
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if ( includes.size() || defines.size() )
|
||||
{
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"%s %s",
|
||||
cflags_macro.c_str(),
|
||||
macro.c_str(),
|
||||
assignmentOperation );
|
||||
for ( i = 0; i < includes.size(); i++ )
|
||||
{
|
||||
|
@ -329,6 +313,34 @@ MingwModuleHandler::GenerateMacros (
|
|||
d.value.c_str() );
|
||||
}
|
||||
fprintf ( fMakefile, "\n" );
|
||||
}
|
||||
|
||||
void
|
||||
MingwModuleHandler::GenerateMacros (
|
||||
const char* assignmentOperation,
|
||||
const vector<File*>& files,
|
||||
const vector<Include*>& includes,
|
||||
const vector<Define*>& defines,
|
||||
const vector<LinkerFlag*>* linkerFlags,
|
||||
const vector<If*>& ifs,
|
||||
const string& cflags_macro,
|
||||
const string& nasmflags_macro,
|
||||
const string& windresflags_macro,
|
||||
const string& linkerflags_macro,
|
||||
const string& objs_macro) const
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if ( includes.size() || defines.size() )
|
||||
{
|
||||
GenerateMacro ( assignmentOperation,
|
||||
cflags_macro,
|
||||
includes,
|
||||
defines );
|
||||
GenerateMacro ( assignmentOperation,
|
||||
windresflags_macro,
|
||||
includes,
|
||||
defines );
|
||||
}
|
||||
|
||||
if ( linkerFlags != NULL )
|
||||
|
@ -382,6 +394,7 @@ MingwModuleHandler::GenerateMacros (
|
|||
rIf.ifs,
|
||||
cflags_macro,
|
||||
nasmflags_macro,
|
||||
windresflags_macro,
|
||||
linkerflags_macro,
|
||||
objs_macro );
|
||||
fprintf (
|
||||
|
@ -396,6 +409,7 @@ MingwModuleHandler::GenerateMacros (
|
|||
const Module& module,
|
||||
const string& cflags_macro,
|
||||
const string& nasmflags_macro,
|
||||
const string& windresflags_macro,
|
||||
const string& linkerflags_macro,
|
||||
const string& objs_macro) const
|
||||
{
|
||||
|
@ -408,6 +422,7 @@ MingwModuleHandler::GenerateMacros (
|
|||
module.ifs,
|
||||
cflags_macro,
|
||||
nasmflags_macro,
|
||||
windresflags_macro,
|
||||
linkerflags_macro,
|
||||
objs_macro );
|
||||
fprintf ( fMakefile, "\n" );
|
||||
|
@ -417,6 +432,11 @@ MingwModuleHandler::GenerateMacros (
|
|||
"%s += $(PROJECT_CFLAGS)\n\n",
|
||||
cflags_macro.c_str () );
|
||||
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"%s += $(PROJECT_RCFLAGS)\n\n",
|
||||
windresflags_macro.c_str () );
|
||||
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"%s_LFLAGS += $(PROJECT_LFLAGS)\n\n",
|
||||
|
@ -464,12 +484,26 @@ MingwModuleHandler::GenerateNasmCommand ( const Module& module,
|
|||
nasmflagsMacro.c_str () );
|
||||
}
|
||||
|
||||
string
|
||||
MingwModuleHandler::GenerateWindresCommand ( const Module& module,
|
||||
const string& sourceFilename,
|
||||
const string& windresflagsMacro ) const
|
||||
{
|
||||
string objectFilename = GetObjectFilename ( sourceFilename );
|
||||
return ssprintf ( "%s %s -o %s ${%s}\n",
|
||||
"${windres}",
|
||||
sourceFilename.c_str (),
|
||||
objectFilename.c_str (),
|
||||
windresflagsMacro.c_str () );
|
||||
}
|
||||
|
||||
string
|
||||
MingwModuleHandler::GenerateCommand ( const Module& module,
|
||||
const string& sourceFilename,
|
||||
const string& cc,
|
||||
const string& cflagsMacro,
|
||||
const string& nasmflagsMacro ) const
|
||||
const string& nasmflagsMacro,
|
||||
const string& windresflagsMacro ) const
|
||||
{
|
||||
string extension = GetExtension ( sourceFilename );
|
||||
if ( extension == ".c" || extension == ".C" )
|
||||
|
@ -486,6 +520,10 @@ MingwModuleHandler::GenerateCommand ( const Module& module,
|
|||
return GenerateNasmCommand ( module,
|
||||
sourceFilename,
|
||||
nasmflagsMacro );
|
||||
else if ( extension == ".rc" || extension == ".RC" )
|
||||
return GenerateWindresCommand ( module,
|
||||
sourceFilename,
|
||||
windresflagsMacro );
|
||||
|
||||
throw InvalidOperationException ( __FILE__,
|
||||
__LINE__,
|
||||
|
@ -517,7 +555,8 @@ MingwModuleHandler::GenerateObjectFileTargets ( const Module& module,
|
|||
const vector<If*>& ifs,
|
||||
const string& cc,
|
||||
const string& cflagsMacro,
|
||||
const string& nasmflagsMacro ) const
|
||||
const string& nasmflagsMacro,
|
||||
const string& windresflagsMacro ) const
|
||||
{
|
||||
size_t i;
|
||||
|
||||
|
@ -535,20 +574,34 @@ MingwModuleHandler::GenerateObjectFileTargets ( const Module& module,
|
|||
sourceFilename,
|
||||
cc,
|
||||
cflagsMacro,
|
||||
nasmflagsMacro ).c_str () );
|
||||
nasmflagsMacro,
|
||||
windresflagsMacro ).c_str () );
|
||||
}
|
||||
|
||||
for ( i = 0; i < ifs.size(); i++ )
|
||||
GenerateObjectFileTargets ( module, ifs[i]->files, ifs[i]->ifs, cc, cflagsMacro, nasmflagsMacro );
|
||||
GenerateObjectFileTargets ( module,
|
||||
ifs[i]->files,
|
||||
ifs[i]->ifs,
|
||||
cc,
|
||||
cflagsMacro,
|
||||
nasmflagsMacro,
|
||||
windresflagsMacro );
|
||||
}
|
||||
|
||||
void
|
||||
MingwModuleHandler::GenerateObjectFileTargets ( const Module& module,
|
||||
const string& cc,
|
||||
const string& cflagsMacro,
|
||||
const string& nasmflagsMacro ) const
|
||||
const string& nasmflagsMacro,
|
||||
const string& windresflagsMacro ) const
|
||||
{
|
||||
GenerateObjectFileTargets ( module, module.files, module.ifs, cc, cflagsMacro, nasmflagsMacro );
|
||||
GenerateObjectFileTargets ( module,
|
||||
module.files,
|
||||
module.ifs,
|
||||
cc,
|
||||
cflagsMacro,
|
||||
nasmflagsMacro,
|
||||
windresflagsMacro );
|
||||
fprintf ( fMakefile, "\n" );
|
||||
}
|
||||
|
||||
|
@ -609,10 +662,16 @@ MingwModuleHandler::GenerateMacrosAndTargets (
|
|||
{
|
||||
string cflagsMacro = ssprintf ("%s_CFLAGS", module.name.c_str ());
|
||||
string nasmflagsMacro = ssprintf ("%s_NASMFLAGS", module.name.c_str ());
|
||||
string windresflagsMacro = ssprintf ("%s_RCFLAGS", module.name.c_str ());
|
||||
string linkerFlagsMacro = ssprintf ("%s_LFLAGS", module.name.c_str ());
|
||||
string objectsMacro = ssprintf ("%s_OBJS", module.name.c_str ());
|
||||
|
||||
GenerateMacros ( module, cflagsMacro, nasmflagsMacro, linkerFlagsMacro, objectsMacro );
|
||||
GenerateMacros ( module,
|
||||
cflagsMacro,
|
||||
nasmflagsMacro,
|
||||
windresflagsMacro,
|
||||
linkerFlagsMacro,
|
||||
objectsMacro );
|
||||
|
||||
// generate phony target for module name
|
||||
fprintf ( fMakefile, ".PHONY: %s\n",
|
||||
|
@ -627,7 +686,11 @@ MingwModuleHandler::GenerateMacrosAndTargets (
|
|||
objectsMacro = ssprintf ("$(%s)", objectsMacro.c_str ());
|
||||
|
||||
string ar_target = GenerateArchiveTarget ( module, ar, objectsMacro );
|
||||
GenerateObjectFileTargets ( module, cc, cflagsMacro, nasmflagsMacro );
|
||||
GenerateObjectFileTargets ( module,
|
||||
cc,
|
||||
cflagsMacro,
|
||||
nasmflagsMacro,
|
||||
windresflagsMacro );
|
||||
|
||||
vector<string> clean_files;
|
||||
clean_files.push_back ( FixupTargetFilename(module.GetPath()) );
|
||||
|
|
|
@ -38,9 +38,6 @@ protected:
|
|||
void GeneratePreconditionDependencies ( const Module& module ) const;
|
||||
std::string GetObjectsMacro ( const Module& module ) const;
|
||||
std::string GetLinkerMacro ( const Module& module ) const;
|
||||
std::string GenerateMacros ( const Module& module,
|
||||
const std::string& cflags_macro,
|
||||
const std::string& objs_macro ) const;
|
||||
std::string GenerateLinkerCommand ( const Module& module,
|
||||
const std::string& linker,
|
||||
const std::string& linkerParameters,
|
||||
|
@ -54,6 +51,10 @@ private:
|
|||
std::string GenerateGccIncludeParametersFromVector ( const std::vector<Include*>& includes ) const;
|
||||
std::string GenerateLinkerParametersFromVector ( const std::vector<LinkerFlag*>& linkerFlags ) const;
|
||||
std::string GenerateLinkerParameters ( const Module& module ) const;
|
||||
void GenerateMacro ( const char* assignmentOperation,
|
||||
const std::string& macro,
|
||||
const std::vector<Include*>& includes,
|
||||
const std::vector<Define*>& defines ) const;
|
||||
void GenerateMacros ( const char* op,
|
||||
const std::vector<File*>& files,
|
||||
const std::vector<Include*>& includes,
|
||||
|
@ -62,14 +63,15 @@ private:
|
|||
const std::vector<If*>& ifs,
|
||||
const std::string& cflags_macro,
|
||||
const std::string& nasmflags_macro,
|
||||
const std::string& windresflags_macro,
|
||||
const std::string& linkerflags_macro,
|
||||
const std::string& objs_macro) const;
|
||||
void GenerateMacros ( const Module& module,
|
||||
const std::string& cflags_macro,
|
||||
const std::string& nasmflags_macro,
|
||||
const std::string& windresflags_macro,
|
||||
const std::string& linkerflags_macro,
|
||||
const std::string& objs_macro) const;
|
||||
void GenerateGccModuleIncludeVariable ( const Module& module ) const;
|
||||
std::string GenerateGccIncludeParameters ( const Module& module ) const;
|
||||
std::string GenerateGccParameters ( const Module& module ) const;
|
||||
std::string GenerateNasmParameters ( const Module& module ) const;
|
||||
|
@ -84,21 +86,27 @@ private:
|
|||
std::string GenerateNasmCommand ( const Module& module,
|
||||
const std::string& sourceFilename,
|
||||
const std::string& nasmflagsMacro ) const;
|
||||
std::string GenerateWindresCommand ( const Module& module,
|
||||
const std::string& sourceFilename,
|
||||
const std::string& windresflagsMacro ) const;
|
||||
std::string GenerateCommand ( const Module& module,
|
||||
const std::string& sourceFilename,
|
||||
const std::string& cc,
|
||||
const std::string& cflagsMacro,
|
||||
const std::string& nasmflagsMacro ) const;
|
||||
const std::string& nasmflagsMacro,
|
||||
const std::string& windresflagsMacro ) const;
|
||||
void GenerateObjectFileTargets ( const Module& module,
|
||||
const std::vector<File*>& files,
|
||||
const std::vector<If*>& ifs,
|
||||
const std::string& cc,
|
||||
const std::string& cflagsMacro,
|
||||
const std::string& nasmflagsMacro ) const;
|
||||
const std::string& nasmflagsMacro,
|
||||
const std::string& windresflagsMacro ) const;
|
||||
void GenerateObjectFileTargets ( const Module& module,
|
||||
const std::string& cc,
|
||||
const std::string& cflagsMacro,
|
||||
const std::string& nasmflagsMacro ) const;
|
||||
const std::string& nasmflagsMacro,
|
||||
const std::string& windresflagsMacro ) const;
|
||||
void GetCleanTargets ( std::vector<std::string>& out,
|
||||
const std::vector<File*>& files,
|
||||
const std::vector<If*>& ifs ) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue