mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 19:26:29 +00:00
Don't mix host and targets include files
Add HostStaticLibrary type svn path=/trunk/; revision=32594
This commit is contained in:
parent
6e49f8efc8
commit
8002abf980
6 changed files with 93 additions and 30 deletions
|
@ -37,6 +37,7 @@ using std::ifstream;
|
|||
#undef OUT
|
||||
#endif//OUT
|
||||
|
||||
#define IsStaticLibrary( module ) ( ( module.type == StaticLibrary ) || ( module.type == HostStaticLibrary ) )
|
||||
|
||||
static class CBFactory : public Backend::Factory
|
||||
{
|
||||
|
@ -497,7 +498,7 @@ CBBackend::_generate_cbproj ( const Module& module )
|
|||
if ( !module.allowWarnings )
|
||||
compiler_flags.push_back ( "-Werror" );
|
||||
|
||||
if ( module.type == StaticLibrary && module.isStartupLib )
|
||||
if ( IsStaticLibrary ( module ) && module.isStartupLib )
|
||||
compiler_flags.push_back ( "-Wno-main" );
|
||||
|
||||
|
||||
|
@ -524,7 +525,7 @@ CBBackend::_generate_cbproj ( const Module& module )
|
|||
|
||||
if ( configuration.UseConfigurationInPath )
|
||||
{
|
||||
if ( module.type == StaticLibrary ||module.type == ObjectLibrary )
|
||||
if ( IsStaticLibrary ( module ) ||module.type == ObjectLibrary )
|
||||
fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\r\n", intdir.c_str (), module.output->relative_path.c_str (), cfg.name.c_str(), module.name.c_str(), module_type.c_str());
|
||||
else
|
||||
fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\r\n", outdir.c_str (), module.output->relative_path.c_str (), cfg.name.c_str(), module.name.c_str(), module_type.c_str());
|
||||
|
@ -532,7 +533,7 @@ CBBackend::_generate_cbproj ( const Module& module )
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( module.type == StaticLibrary || module.type == ObjectLibrary )
|
||||
if ( IsStaticLibrary ( module ) || module.type == ObjectLibrary )
|
||||
fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\r\n", intdir.c_str (), module.output->relative_path.c_str (), module.name.c_str(), module_type.c_str() );
|
||||
else
|
||||
fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\r\n", outdir.c_str (), module.output->relative_path.c_str (), module.name.c_str(), module_type.c_str() );
|
||||
|
@ -672,7 +673,7 @@ CBBackend::_generate_cbproj ( const Module& module )
|
|||
fprintf ( OUT, "\t\t\t\t<ExtraCommands>\r\n" );
|
||||
|
||||
#if 0
|
||||
if ( module.type == StaticLibrary && module.importLibrary )
|
||||
if ( IsStaticLibrary ( module ) && module.importLibrary )
|
||||
fprintf ( OUT, "\t\t\t\t\t<Add after=\"dlltool --dllname %s --def %s --output-lib $exe_output; %s -U\" />\r\n", module.importLibrary->dllname.c_str (), module.importLibrary->definition.c_str(), module.mangledSymbols ? "" : "--kill-at" );
|
||||
else if ( module.importLibrary != NULL )
|
||||
fprintf ( OUT, "\t\t\t\t\t<Add after=\"dlltool --dllname %s --def %s --output-lib "$(TARGET_OBJECT_DIR)lib$(TARGET_OUTPUT_BASENAME).a" %s\" />\r\n", module.GetTargetName ().c_str(), module.importLibrary->definition.c_str(), module.mangledSymbols ? "" : "--kill-at" );
|
||||
|
|
|
@ -30,6 +30,7 @@ using std::string;
|
|||
using std::vector;
|
||||
|
||||
#define CLEAN_FILE(f) clean_files.push_back ( (f).name.length () > 0 ? backend->GetFullName ( f ) : backend->GetFullPath ( f ) );
|
||||
#define IsStaticLibrary( module ) ( ( module.type == StaticLibrary ) || ( module.type == HostStaticLibrary ) )
|
||||
|
||||
MingwBackend*
|
||||
MingwModuleHandler::backend = NULL;
|
||||
|
@ -170,6 +171,9 @@ MingwModuleHandler::InstanciateHandler (
|
|||
case StaticLibrary:
|
||||
handler = new MingwStaticLibraryModuleHandler ( module );
|
||||
break;
|
||||
case HostStaticLibrary:
|
||||
handler = new MingwHostStaticLibraryModuleHandler ( module );
|
||||
break;
|
||||
case ObjectLibrary:
|
||||
handler = new MingwObjectLibraryModuleHandler ( module );
|
||||
break;
|
||||
|
@ -359,7 +363,7 @@ MingwModuleHandler::GetCompilationUnitDependencies (
|
|||
const FileLocation*
|
||||
MingwModuleHandler::GetModuleArchiveFilename () const
|
||||
{
|
||||
if ( module.type == StaticLibrary )
|
||||
if ( IsStaticLibrary ( module ) )
|
||||
return GetTargetFilename ( module, NULL );
|
||||
return new FileLocation ( IntermediateDirectory,
|
||||
module.output->relative_path,
|
||||
|
@ -1842,7 +1846,7 @@ MingwModuleHandler::GenerateArchiveTarget ()
|
|||
|
||||
arRule1.Execute ( fMakefile, backend, module, archiveFilename, clean_files );
|
||||
|
||||
if ( module.type == StaticLibrary && module.importLibrary )
|
||||
if ( IsStaticLibrary ( module ) && module.importLibrary )
|
||||
{
|
||||
const FileLocation *definitionFilename = GetDefinitionFilename ();
|
||||
|
||||
|
@ -2016,11 +2020,14 @@ MingwModuleHandler::GenerateOtherMacros ()
|
|||
&module.linkerFlags,
|
||||
used_defs );
|
||||
|
||||
GenerateMacros (
|
||||
"+=",
|
||||
module.project.non_if_data,
|
||||
NULL,
|
||||
used_defs );
|
||||
if ( module.host == HostFalse )
|
||||
{
|
||||
GenerateMacros (
|
||||
"+=",
|
||||
module.project.non_if_data,
|
||||
NULL,
|
||||
used_defs );
|
||||
}
|
||||
|
||||
vector<FileLocation> s;
|
||||
if ( module.importLibrary )
|
||||
|
@ -2048,7 +2055,12 @@ MingwModuleHandler::GenerateOtherMacros ()
|
|||
fprintf ( fMakefile, "\n" );
|
||||
}
|
||||
|
||||
string globalCflags = "-g";
|
||||
string globalCflags = "";
|
||||
if ( module.host == HostFalse )
|
||||
globalCflags += " $(PROJECT_CFLAGS)";
|
||||
else
|
||||
globalCflags += " -Wall -Wpointer-arith -D__REACTOS__";
|
||||
globalCflags += " -g";
|
||||
if ( backend->usePipe )
|
||||
globalCflags += " -pipe";
|
||||
if ( !module.allowWarnings )
|
||||
|
@ -2058,7 +2070,7 @@ MingwModuleHandler::GenerateOtherMacros ()
|
|||
if ( module.cplusplus )
|
||||
globalCflags += " $(HOST_CPPFLAGS)";
|
||||
else
|
||||
globalCflags += " $(HOST_CFLAGS)";
|
||||
globalCflags += " -Wno-strict-aliasing $(HOST_CFLAGS)";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2077,25 +2089,35 @@ MingwModuleHandler::GenerateOtherMacros ()
|
|||
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"%s += $(PROJECT_CFLAGS) %s\n",
|
||||
"%s +=%s\n",
|
||||
cflagsMacro.c_str (),
|
||||
globalCflags.c_str () );
|
||||
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"%s += $(PROJECT_RCFLAGS)\n",
|
||||
windresflagsMacro.c_str () );
|
||||
if ( module.host == HostFalse )
|
||||
{
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"%s += $(PROJECT_RCFLAGS)\n",
|
||||
windresflagsMacro.c_str () );
|
||||
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"%s += $(PROJECT_WIDLFLAGS) -I%s\n",
|
||||
widlflagsMacro.c_str (),
|
||||
module.output->relative_path.c_str () );
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"%s += $(PROJECT_WIDLFLAGS) -I%s\n",
|
||||
widlflagsMacro.c_str (),
|
||||
module.output->relative_path.c_str () );
|
||||
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"%s_LFLAGS += $(PROJECT_LFLAGS) -g\n",
|
||||
module.name.c_str () );
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"%s_LFLAGS += $(PROJECT_LFLAGS) -g\n",
|
||||
module.name.c_str () );
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"%s_LFLAGS += $(HOST_LFLAGS)\n",
|
||||
module.name.c_str () );
|
||||
}
|
||||
|
||||
fprintf (
|
||||
fMakefile,
|
||||
|
@ -2130,7 +2152,7 @@ MingwModuleHandler::GenerateOtherMacros ()
|
|||
linkerflags.c_str () );
|
||||
}
|
||||
|
||||
if ( module.type == StaticLibrary && module.isStartupLib )
|
||||
if ( IsStaticLibrary ( module ) && module.isStartupLib )
|
||||
{
|
||||
fprintf ( fMakefile,
|
||||
"%s += -Wno-main\n\n",
|
||||
|
@ -2596,6 +2618,26 @@ MingwStaticLibraryModuleHandler::GenerateStaticLibraryModuleTarget ()
|
|||
}
|
||||
|
||||
|
||||
MingwHostStaticLibraryModuleHandler::MingwHostStaticLibraryModuleHandler (
|
||||
const Module& module_ )
|
||||
|
||||
: MingwModuleHandler ( module_ )
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
MingwHostStaticLibraryModuleHandler::Process ()
|
||||
{
|
||||
GenerateHostStaticLibraryModuleTarget ();
|
||||
}
|
||||
|
||||
void
|
||||
MingwHostStaticLibraryModuleHandler::GenerateHostStaticLibraryModuleTarget ()
|
||||
{
|
||||
GenerateRules ();
|
||||
}
|
||||
|
||||
|
||||
MingwObjectLibraryModuleHandler::MingwObjectLibraryModuleHandler (
|
||||
const Module& module_ )
|
||||
|
||||
|
|
|
@ -226,6 +226,17 @@ private:
|
|||
};
|
||||
|
||||
|
||||
class MingwHostStaticLibraryModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwHostStaticLibraryModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostTrue; }
|
||||
virtual void Process ();
|
||||
private:
|
||||
void GenerateHostStaticLibraryModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwObjectLibraryModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -57,6 +57,7 @@ Bootstrap::IsSupportedModuleType ( ModuleType type )
|
|||
return true;
|
||||
case BuildTool:
|
||||
case StaticLibrary:
|
||||
case HostStaticLibrary:
|
||||
case ObjectLibrary:
|
||||
case Iso:
|
||||
case LiveIso:
|
||||
|
|
|
@ -880,6 +880,8 @@ Module::GetModuleType ( const string& location, const XMLAttribute& attribute )
|
|||
return BuildTool;
|
||||
if ( attribute.value == "staticlibrary" )
|
||||
return StaticLibrary;
|
||||
if ( attribute.value == "hoststaticlibrary" )
|
||||
return HostStaticLibrary;
|
||||
if ( attribute.value == "objectlibrary" )
|
||||
return ObjectLibrary;
|
||||
if ( attribute.value == "kernel" )
|
||||
|
@ -965,6 +967,7 @@ Module::GetTargetDirectoryTree () const
|
|||
case ElfExecutable:
|
||||
return OutputDirectory;
|
||||
case StaticLibrary:
|
||||
case HostStaticLibrary:
|
||||
case ObjectLibrary:
|
||||
case RpcServer:
|
||||
case RpcClient:
|
||||
|
@ -990,6 +993,7 @@ Module::GetDefaultModuleExtension () const
|
|||
return ExePostfix;
|
||||
case BootProgram:
|
||||
case StaticLibrary:
|
||||
case HostStaticLibrary:
|
||||
return ".a";
|
||||
case ObjectLibrary:
|
||||
return ".o";
|
||||
|
@ -1067,6 +1071,7 @@ Module::GetDefaultModuleEntrypoint () const
|
|||
return "WinMainCRTStartup";
|
||||
case BuildTool:
|
||||
case StaticLibrary:
|
||||
case HostStaticLibrary:
|
||||
case ObjectLibrary:
|
||||
case BootLoader:
|
||||
case BootSector:
|
||||
|
@ -1115,6 +1120,7 @@ Module::GetDefaultModuleBaseaddress () const
|
|||
return "0xe00000";
|
||||
case BuildTool:
|
||||
case StaticLibrary:
|
||||
case HostStaticLibrary:
|
||||
case ObjectLibrary:
|
||||
case BootLoader:
|
||||
case BootSector:
|
||||
|
@ -1140,7 +1146,7 @@ Module::GetDefaultModuleBaseaddress () const
|
|||
bool
|
||||
Module::HasImportLibrary () const
|
||||
{
|
||||
return importLibrary != NULL && type != StaticLibrary;
|
||||
return importLibrary != NULL && type != StaticLibrary && type != HostStaticLibrary;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1162,6 +1168,7 @@ Module::IsDLL () const
|
|||
case Win32GUI:
|
||||
case BuildTool:
|
||||
case StaticLibrary:
|
||||
case HostStaticLibrary:
|
||||
case ObjectLibrary:
|
||||
case BootLoader:
|
||||
case BootSector:
|
||||
|
@ -1613,7 +1620,7 @@ ImportLibrary::ImportLibrary ( const Project& project,
|
|||
|
||||
if ( dllname )
|
||||
this->dllname = dllname->value;
|
||||
else if ( module.type == StaticLibrary )
|
||||
else if ( module.type == StaticLibrary || module.type == HostStaticLibrary )
|
||||
throw XMLInvalidBuildFileException (
|
||||
node.location,
|
||||
"<importlibrary> dllname attribute required." );
|
||||
|
|
|
@ -300,6 +300,7 @@ enum ModuleType
|
|||
EmbeddedTypeLib = 26,
|
||||
ElfExecutable = 27,
|
||||
RpcProxy,
|
||||
HostStaticLibrary,
|
||||
TypeDontCare,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue