mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
compilerflags can be set for compiler {ALL|CC|CPP} now (ALL is default)
svn path=/trunk/; revision=32018
This commit is contained in:
parent
9446625ead
commit
d9fdef4e6b
5 changed files with 48 additions and 12 deletions
|
@ -448,10 +448,13 @@ MingwBackend::GenerateProjectGccOptionsMacro ( const char* assignmentOperation,
|
|||
|
||||
for ( i = 0; i < data.compilerFlags.size(); i++ )
|
||||
{
|
||||
fprintf (
|
||||
fMakefile,
|
||||
" %s",
|
||||
data.compilerFlags[i]->flag.c_str() );
|
||||
if ( data.compilerFlags[i]->compiler == CompilerTypeDontCare )
|
||||
{
|
||||
fprintf (
|
||||
fMakefile,
|
||||
" %s",
|
||||
data.compilerFlags[i]->flag.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
fprintf ( fMakefile, "\n" );
|
||||
|
|
|
@ -764,15 +764,18 @@ MingwModuleHandler::GenerateGccIncludeParameters () const
|
|||
}
|
||||
|
||||
string
|
||||
MingwModuleHandler::GenerateCompilerParametersFromVector ( const vector<CompilerFlag*>& compilerFlags ) const
|
||||
MingwModuleHandler::GenerateCompilerParametersFromVector ( const vector<CompilerFlag*>& compilerFlags, const CompilerType type ) const
|
||||
{
|
||||
string parameters;
|
||||
for ( size_t i = 0; i < compilerFlags.size (); i++ )
|
||||
{
|
||||
CompilerFlag& compilerFlag = *compilerFlags[i];
|
||||
if ( parameters.length () > 0 )
|
||||
parameters += " ";
|
||||
parameters += compilerFlag.flag;
|
||||
if ( compilerFlag.compiler == type )
|
||||
{
|
||||
if ( parameters.length () > 0 )
|
||||
parameters += " ";
|
||||
parameters += compilerFlag.flag;
|
||||
}
|
||||
}
|
||||
return parameters;
|
||||
}
|
||||
|
@ -848,7 +851,7 @@ MingwModuleHandler::GenerateMacro (
|
|||
|
||||
if ( generatingCompilerMacro )
|
||||
{
|
||||
string compilerParameters = GenerateCompilerParametersFromVector ( data.compilerFlags );
|
||||
string compilerParameters = GenerateCompilerParametersFromVector ( data.compilerFlags , CompilerTypeDontCare );
|
||||
if ( compilerParameters.size () > 0 )
|
||||
{
|
||||
fprintf (
|
||||
|
@ -1719,21 +1722,25 @@ MingwModuleHandler::GenerateCommands (
|
|||
{
|
||||
const FileLocation& sourceFile = compilationUnit.GetFilename ();
|
||||
string extension = GetExtension ( sourceFile );
|
||||
string flags = cflagsMacro;
|
||||
flags += " ";
|
||||
if ( extension == ".c" || extension == ".C" )
|
||||
{
|
||||
flags += GenerateCompilerParametersFromVector ( module.non_if_data.compilerFlags , CompilerTypeCC );
|
||||
GenerateGccCommand ( &sourceFile,
|
||||
GetCompilationUnitDependencies ( compilationUnit ) + extraDependencies,
|
||||
cc,
|
||||
cflagsMacro );
|
||||
flags );
|
||||
}
|
||||
else if ( extension == ".cc" || extension == ".CC" ||
|
||||
extension == ".cpp" || extension == ".CPP" ||
|
||||
extension == ".cxx" || extension == ".CXX" )
|
||||
{
|
||||
flags += GenerateCompilerParametersFromVector ( module.non_if_data.compilerFlags , CompilerTypeCPP );
|
||||
GenerateGccCommand ( &sourceFile,
|
||||
GetCompilationUnitDependencies ( compilationUnit ) + extraDependencies,
|
||||
cppc,
|
||||
cflagsMacro );
|
||||
flags );
|
||||
}
|
||||
else if ( extension == ".s" || extension == ".S" )
|
||||
{
|
||||
|
|
|
@ -130,7 +130,7 @@ private:
|
|||
std::string ConcatenatePaths ( const std::string& path1,
|
||||
const std::string& path2 ) const;
|
||||
std::string GenerateGccDefineParameters () const;
|
||||
std::string GenerateCompilerParametersFromVector ( const std::vector<CompilerFlag*>& compilerFlags ) const;
|
||||
std::string GenerateCompilerParametersFromVector ( const std::vector<CompilerFlag*>& compilerFlags, const CompilerType type ) const;
|
||||
std::string GenerateLinkerParametersFromVector ( const std::vector<LinkerFlag*>& linkerFlags ) const;
|
||||
std::string GenerateImportLibraryDependenciesFromVector ( const std::vector<Library*>& libraries );
|
||||
std::string GenerateLinkerParameters () const;
|
||||
|
|
|
@ -55,7 +55,25 @@ CompilerFlag::Initialize ()
|
|||
node.location,
|
||||
"<compilerflag> is empty." );
|
||||
}
|
||||
|
||||
flag = node.value;
|
||||
compiler = CompilerTypeDontCare;
|
||||
|
||||
const XMLAttribute* att = node.GetAttribute ( "compiler", false );
|
||||
if ( att != NULL)
|
||||
{
|
||||
if ( att->value == "cpp" )
|
||||
compiler = CompilerTypeCPP;
|
||||
else if ( att->value == "cc" )
|
||||
compiler = CompilerTypeCC;
|
||||
else
|
||||
{
|
||||
throw InvalidAttributeValueException (
|
||||
node.location,
|
||||
"compiler",
|
||||
att->value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -311,6 +311,13 @@ enum HostType
|
|||
HostDontCare,
|
||||
};
|
||||
|
||||
enum CompilerType
|
||||
{
|
||||
CompilerTypeDontCare,
|
||||
CompilerTypeCC,
|
||||
CompilerTypeCPP,
|
||||
};
|
||||
|
||||
class FileLocation
|
||||
{
|
||||
public:
|
||||
|
@ -592,6 +599,7 @@ public:
|
|||
const Module* module;
|
||||
const XMLElement& node;
|
||||
std::string flag;
|
||||
CompilerType compiler;
|
||||
|
||||
CompilerFlag ( const Project& project,
|
||||
const XMLElement& compilerFlagNode );
|
||||
|
|
Loading…
Reference in a new issue