mirror of
https://github.com/reactos/reactos.git
synced 2024-08-04 02:20:54 +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
|
@ -448,10 +448,13 @@ MingwBackend::GenerateProjectGccOptionsMacro ( const char* assignmentOperation,
|
||||||
|
|
||||||
for ( i = 0; i < data.compilerFlags.size(); i++ )
|
for ( i = 0; i < data.compilerFlags.size(); i++ )
|
||||||
{
|
{
|
||||||
fprintf (
|
if ( data.compilerFlags[i]->compiler == CompilerTypeDontCare )
|
||||||
fMakefile,
|
{
|
||||||
" %s",
|
fprintf (
|
||||||
data.compilerFlags[i]->flag.c_str() );
|
fMakefile,
|
||||||
|
" %s",
|
||||||
|
data.compilerFlags[i]->flag.c_str() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf ( fMakefile, "\n" );
|
fprintf ( fMakefile, "\n" );
|
||||||
|
|
|
@ -764,15 +764,18 @@ MingwModuleHandler::GenerateGccIncludeParameters () const
|
||||||
}
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
MingwModuleHandler::GenerateCompilerParametersFromVector ( const vector<CompilerFlag*>& compilerFlags ) const
|
MingwModuleHandler::GenerateCompilerParametersFromVector ( const vector<CompilerFlag*>& compilerFlags, const CompilerType type ) const
|
||||||
{
|
{
|
||||||
string parameters;
|
string parameters;
|
||||||
for ( size_t i = 0; i < compilerFlags.size (); i++ )
|
for ( size_t i = 0; i < compilerFlags.size (); i++ )
|
||||||
{
|
{
|
||||||
CompilerFlag& compilerFlag = *compilerFlags[i];
|
CompilerFlag& compilerFlag = *compilerFlags[i];
|
||||||
if ( parameters.length () > 0 )
|
if ( compilerFlag.compiler == type )
|
||||||
parameters += " ";
|
{
|
||||||
parameters += compilerFlag.flag;
|
if ( parameters.length () > 0 )
|
||||||
|
parameters += " ";
|
||||||
|
parameters += compilerFlag.flag;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
@ -848,7 +851,7 @@ MingwModuleHandler::GenerateMacro (
|
||||||
|
|
||||||
if ( generatingCompilerMacro )
|
if ( generatingCompilerMacro )
|
||||||
{
|
{
|
||||||
string compilerParameters = GenerateCompilerParametersFromVector ( data.compilerFlags );
|
string compilerParameters = GenerateCompilerParametersFromVector ( data.compilerFlags , CompilerTypeDontCare );
|
||||||
if ( compilerParameters.size () > 0 )
|
if ( compilerParameters.size () > 0 )
|
||||||
{
|
{
|
||||||
fprintf (
|
fprintf (
|
||||||
|
@ -1719,21 +1722,25 @@ MingwModuleHandler::GenerateCommands (
|
||||||
{
|
{
|
||||||
const FileLocation& sourceFile = compilationUnit.GetFilename ();
|
const FileLocation& sourceFile = compilationUnit.GetFilename ();
|
||||||
string extension = GetExtension ( sourceFile );
|
string extension = GetExtension ( sourceFile );
|
||||||
|
string flags = cflagsMacro;
|
||||||
|
flags += " ";
|
||||||
if ( extension == ".c" || extension == ".C" )
|
if ( extension == ".c" || extension == ".C" )
|
||||||
{
|
{
|
||||||
|
flags += GenerateCompilerParametersFromVector ( module.non_if_data.compilerFlags , CompilerTypeCC );
|
||||||
GenerateGccCommand ( &sourceFile,
|
GenerateGccCommand ( &sourceFile,
|
||||||
GetCompilationUnitDependencies ( compilationUnit ) + extraDependencies,
|
GetCompilationUnitDependencies ( compilationUnit ) + extraDependencies,
|
||||||
cc,
|
cc,
|
||||||
cflagsMacro );
|
flags );
|
||||||
}
|
}
|
||||||
else if ( extension == ".cc" || extension == ".CC" ||
|
else if ( extension == ".cc" || extension == ".CC" ||
|
||||||
extension == ".cpp" || extension == ".CPP" ||
|
extension == ".cpp" || extension == ".CPP" ||
|
||||||
extension == ".cxx" || extension == ".CXX" )
|
extension == ".cxx" || extension == ".CXX" )
|
||||||
{
|
{
|
||||||
|
flags += GenerateCompilerParametersFromVector ( module.non_if_data.compilerFlags , CompilerTypeCPP );
|
||||||
GenerateGccCommand ( &sourceFile,
|
GenerateGccCommand ( &sourceFile,
|
||||||
GetCompilationUnitDependencies ( compilationUnit ) + extraDependencies,
|
GetCompilationUnitDependencies ( compilationUnit ) + extraDependencies,
|
||||||
cppc,
|
cppc,
|
||||||
cflagsMacro );
|
flags );
|
||||||
}
|
}
|
||||||
else if ( extension == ".s" || extension == ".S" )
|
else if ( extension == ".s" || extension == ".S" )
|
||||||
{
|
{
|
||||||
|
|
|
@ -130,7 +130,7 @@ private:
|
||||||
std::string ConcatenatePaths ( const std::string& path1,
|
std::string ConcatenatePaths ( const std::string& path1,
|
||||||
const std::string& path2 ) const;
|
const std::string& path2 ) const;
|
||||||
std::string GenerateGccDefineParameters () 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 GenerateLinkerParametersFromVector ( const std::vector<LinkerFlag*>& linkerFlags ) const;
|
||||||
std::string GenerateImportLibraryDependenciesFromVector ( const std::vector<Library*>& libraries );
|
std::string GenerateImportLibraryDependenciesFromVector ( const std::vector<Library*>& libraries );
|
||||||
std::string GenerateLinkerParameters () const;
|
std::string GenerateLinkerParameters () const;
|
||||||
|
|
|
@ -55,7 +55,25 @@ CompilerFlag::Initialize ()
|
||||||
node.location,
|
node.location,
|
||||||
"<compilerflag> is empty." );
|
"<compilerflag> is empty." );
|
||||||
}
|
}
|
||||||
|
|
||||||
flag = node.value;
|
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
|
void
|
||||||
|
|
|
@ -311,6 +311,13 @@ enum HostType
|
||||||
HostDontCare,
|
HostDontCare,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum CompilerType
|
||||||
|
{
|
||||||
|
CompilerTypeDontCare,
|
||||||
|
CompilerTypeCC,
|
||||||
|
CompilerTypeCPP,
|
||||||
|
};
|
||||||
|
|
||||||
class FileLocation
|
class FileLocation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -592,6 +599,7 @@ public:
|
||||||
const Module* module;
|
const Module* module;
|
||||||
const XMLElement& node;
|
const XMLElement& node;
|
||||||
std::string flag;
|
std::string flag;
|
||||||
|
CompilerType compiler;
|
||||||
|
|
||||||
CompilerFlag ( const Project& project,
|
CompilerFlag ( const Project& project,
|
||||||
const XMLElement& compilerFlagNode );
|
const XMLElement& compilerFlagNode );
|
||||||
|
|
Loading…
Reference in a new issue