Merge topic 'use-generator-target'
638843a Remove the Location member from cmTarget. 90ef1cf Move GenerateTargetManifest to cmGeneratorTarget. 25f1df3 Split CreateGeneratorTargets into two methods.
This commit is contained in:
commit
8a6e82724c
@ -25,8 +25,6 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
|
|||||||
this->Makefile = this->Target->GetMakefile();
|
this->Makefile = this->Target->GetMakefile();
|
||||||
this->LocalGenerator = this->Makefile->GetLocalGenerator();
|
this->LocalGenerator = this->Makefile->GetLocalGenerator();
|
||||||
this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
|
this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
|
||||||
this->ClassifySources();
|
|
||||||
this->LookupObjectLibraries();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@ -324,3 +322,79 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
|
|||||||
{
|
{
|
||||||
return this->Target->GetIncludeDirectories(config);
|
return this->Target->GetIncludeDirectories(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmGeneratorTarget::GenerateTargetManifest(const char* config)
|
||||||
|
{
|
||||||
|
if (this->Target->IsImported())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cmMakefile* mf = this->Target->GetMakefile();
|
||||||
|
cmLocalGenerator* lg = mf->GetLocalGenerator();
|
||||||
|
cmGlobalGenerator* gg = lg->GetGlobalGenerator();
|
||||||
|
|
||||||
|
// Get the names.
|
||||||
|
std::string name;
|
||||||
|
std::string soName;
|
||||||
|
std::string realName;
|
||||||
|
std::string impName;
|
||||||
|
std::string pdbName;
|
||||||
|
if(this->GetType() == cmTarget::EXECUTABLE)
|
||||||
|
{
|
||||||
|
this->Target->GetExecutableNames(name, realName, impName, pdbName,
|
||||||
|
config);
|
||||||
|
}
|
||||||
|
else if(this->GetType() == cmTarget::STATIC_LIBRARY ||
|
||||||
|
this->GetType() == cmTarget::SHARED_LIBRARY ||
|
||||||
|
this->GetType() == cmTarget::MODULE_LIBRARY)
|
||||||
|
{
|
||||||
|
this->Target->GetLibraryNames(name, soName, realName, impName, pdbName,
|
||||||
|
config);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the directory.
|
||||||
|
std::string dir = this->Target->GetDirectory(config, false);
|
||||||
|
|
||||||
|
// Add each name.
|
||||||
|
std::string f;
|
||||||
|
if(!name.empty())
|
||||||
|
{
|
||||||
|
f = dir;
|
||||||
|
f += "/";
|
||||||
|
f += name;
|
||||||
|
gg->AddToManifest(config? config:"", f);
|
||||||
|
}
|
||||||
|
if(!soName.empty())
|
||||||
|
{
|
||||||
|
f = dir;
|
||||||
|
f += "/";
|
||||||
|
f += soName;
|
||||||
|
gg->AddToManifest(config? config:"", f);
|
||||||
|
}
|
||||||
|
if(!realName.empty())
|
||||||
|
{
|
||||||
|
f = dir;
|
||||||
|
f += "/";
|
||||||
|
f += realName;
|
||||||
|
gg->AddToManifest(config? config:"", f);
|
||||||
|
}
|
||||||
|
if(!pdbName.empty())
|
||||||
|
{
|
||||||
|
f = dir;
|
||||||
|
f += "/";
|
||||||
|
f += pdbName;
|
||||||
|
gg->AddToManifest(config? config:"", f);
|
||||||
|
}
|
||||||
|
if(!impName.empty())
|
||||||
|
{
|
||||||
|
f = this->Target->GetDirectory(config, true);
|
||||||
|
f += "/";
|
||||||
|
f += impName;
|
||||||
|
gg->AddToManifest(config? config:"", f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -74,10 +74,13 @@ public:
|
|||||||
|
|
||||||
bool IsSystemIncludeDirectory(const char *dir, const char *config);
|
bool IsSystemIncludeDirectory(const char *dir, const char *config);
|
||||||
|
|
||||||
private:
|
/** Add the target output files to the global generator manifest. */
|
||||||
|
void GenerateTargetManifest(const char* config);
|
||||||
|
|
||||||
void ClassifySources();
|
void ClassifySources();
|
||||||
void LookupObjectLibraries();
|
void LookupObjectLibraries();
|
||||||
|
|
||||||
|
private:
|
||||||
std::map<std::string, std::vector<std::string> > SystemIncludesCache;
|
std::map<std::string, std::vector<std::string> > SystemIncludesCache;
|
||||||
|
|
||||||
cmGeneratorTarget(cmGeneratorTarget const&);
|
cmGeneratorTarget(cmGeneratorTarget const&);
|
||||||
|
@ -1128,6 +1128,9 @@ void cmGlobalGenerator::Generate()
|
|||||||
this->LocalGenerators[i]->AddHelperCommands();
|
this->LocalGenerators[i]->AddHelperCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create per-target generator information.
|
||||||
|
this->CreateGeneratorTargets();
|
||||||
|
|
||||||
// Trace the dependencies, after that no custom commands should be added
|
// Trace the dependencies, after that no custom commands should be added
|
||||||
// because their dependencies might not be handled correctly
|
// because their dependencies might not be handled correctly
|
||||||
for (i = 0; i < this->LocalGenerators.size(); ++i)
|
for (i = 0; i < this->LocalGenerators.size(); ++i)
|
||||||
@ -1141,8 +1144,7 @@ void cmGlobalGenerator::Generate()
|
|||||||
this->LocalGenerators[i]->GenerateTargetManifest();
|
this->LocalGenerators[i]->GenerateTargetManifest();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create per-target generator information.
|
this->ComputeGeneratorTargetObjects();
|
||||||
this->CreateGeneratorTargets();
|
|
||||||
|
|
||||||
this->ProcessEvaluationFiles();
|
this->ProcessEvaluationFiles();
|
||||||
|
|
||||||
@ -1336,7 +1338,6 @@ void cmGlobalGenerator::CreateGeneratorTargets()
|
|||||||
|
|
||||||
cmGeneratorTarget* gt = new cmGeneratorTarget(t);
|
cmGeneratorTarget* gt = new cmGeneratorTarget(t);
|
||||||
this->GeneratorTargets[t] = gt;
|
this->GeneratorTargets[t] = gt;
|
||||||
this->ComputeTargetObjects(gt);
|
|
||||||
generatorTargets[t] = gt;
|
generatorTargets[t] = gt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1353,6 +1354,25 @@ void cmGlobalGenerator::CreateGeneratorTargets()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmGlobalGenerator::ComputeGeneratorTargetObjects()
|
||||||
|
{
|
||||||
|
// Construct per-target generator information.
|
||||||
|
for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
|
||||||
|
{
|
||||||
|
cmMakefile *mf = this->LocalGenerators[i]->GetMakefile();
|
||||||
|
cmGeneratorTargetsType targets = mf->GetGeneratorTargets();
|
||||||
|
for(cmGeneratorTargetsType::iterator ti = targets.begin();
|
||||||
|
ti != targets.end(); ++ti)
|
||||||
|
{
|
||||||
|
cmGeneratorTarget* gt = ti->second;
|
||||||
|
gt->ClassifySources();
|
||||||
|
gt->LookupObjectLibraries();
|
||||||
|
this->ComputeTargetObjects(gt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmGlobalGenerator::ClearGeneratorTargets()
|
void cmGlobalGenerator::ClearGeneratorTargets()
|
||||||
{
|
{
|
||||||
|
@ -408,6 +408,7 @@ private:
|
|||||||
// Per-target generator information.
|
// Per-target generator information.
|
||||||
cmGeneratorTargetsType GeneratorTargets;
|
cmGeneratorTargetsType GeneratorTargets;
|
||||||
void CreateGeneratorTargets();
|
void CreateGeneratorTargets();
|
||||||
|
void ComputeGeneratorTargetObjects();
|
||||||
void ClearGeneratorTargets();
|
void ClearGeneratorTargets();
|
||||||
virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;
|
virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;
|
||||||
|
|
||||||
|
@ -530,10 +530,11 @@ void cmLocalGenerator::GenerateTargetManifest()
|
|||||||
this->Makefile->GetConfigurations(configNames);
|
this->Makefile->GetConfigurations(configNames);
|
||||||
|
|
||||||
// Add our targets to the manifest for each configuration.
|
// Add our targets to the manifest for each configuration.
|
||||||
cmTargets& targets = this->Makefile->GetTargets();
|
cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
|
||||||
for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
|
for(cmGeneratorTargetsType::iterator t = targets.begin();
|
||||||
|
t != targets.end(); ++t)
|
||||||
{
|
{
|
||||||
cmTarget& target = t->second;
|
cmGeneratorTarget& target = *t->second;
|
||||||
if(configNames.empty())
|
if(configNames.empty())
|
||||||
{
|
{
|
||||||
target.GenerateTargetManifest(0);
|
target.GenerateTargetManifest(0);
|
||||||
|
@ -2725,27 +2725,34 @@ const char* cmTarget::GetLocation(const char* config)
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
const char* cmTarget::ImportedGetLocation(const char* config)
|
const char* cmTarget::ImportedGetLocation(const char* config)
|
||||||
{
|
{
|
||||||
this->Location = this->ImportedGetFullPath(config, false);
|
static std::string location;
|
||||||
return this->Location.c_str();
|
location = this->ImportedGetFullPath(config, false);
|
||||||
|
return location.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
const char* cmTarget::NormalGetLocation(const char* config)
|
const char* cmTarget::NormalGetLocation(const char* config)
|
||||||
{
|
{
|
||||||
|
static std::string location;
|
||||||
// Handle the configuration-specific case first.
|
// Handle the configuration-specific case first.
|
||||||
if(config)
|
if(config)
|
||||||
{
|
{
|
||||||
this->Location = this->GetFullPath(config, false);
|
location = this->GetFullPath(config, false);
|
||||||
return this->Location.c_str();
|
return location.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now handle the deprecated build-time configuration location.
|
// Now handle the deprecated build-time configuration location.
|
||||||
this->Location = this->GetDirectory();
|
location = this->GetDirectory();
|
||||||
|
if(!location.empty())
|
||||||
|
{
|
||||||
|
location += "/";
|
||||||
|
}
|
||||||
const char* cfgid = this->Makefile->GetDefinition("CMAKE_CFG_INTDIR");
|
const char* cfgid = this->Makefile->GetDefinition("CMAKE_CFG_INTDIR");
|
||||||
if(cfgid && strcmp(cfgid, ".") != 0)
|
if(cfgid && strcmp(cfgid, ".") != 0)
|
||||||
{
|
{
|
||||||
this->Location += "/";
|
location += "/";
|
||||||
this->Location += cfgid;
|
location += cfgid;
|
||||||
|
location += "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this->IsAppBundleOnApple())
|
if(this->IsAppBundleOnApple())
|
||||||
@ -2753,13 +2760,13 @@ const char* cmTarget::NormalGetLocation(const char* config)
|
|||||||
std::string macdir = this->BuildMacContentDirectory("", config, false);
|
std::string macdir = this->BuildMacContentDirectory("", config, false);
|
||||||
if(!macdir.empty())
|
if(!macdir.empty())
|
||||||
{
|
{
|
||||||
this->Location += "/";
|
location += "/";
|
||||||
this->Location += macdir;
|
location += macdir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->Location += "/";
|
location += "/";
|
||||||
this->Location += this->GetFullName(config, false);
|
location += this->GetFullName(config, false);
|
||||||
return this->Location.c_str();
|
return location.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@ -3916,76 +3923,6 @@ bool cmTarget::GetImplibGNUtoMS(std::string const& gnuName,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void cmTarget::GenerateTargetManifest(const char* config)
|
|
||||||
{
|
|
||||||
cmMakefile* mf = this->Makefile;
|
|
||||||
cmLocalGenerator* lg = mf->GetLocalGenerator();
|
|
||||||
cmGlobalGenerator* gg = lg->GetGlobalGenerator();
|
|
||||||
|
|
||||||
// Get the names.
|
|
||||||
std::string name;
|
|
||||||
std::string soName;
|
|
||||||
std::string realName;
|
|
||||||
std::string impName;
|
|
||||||
std::string pdbName;
|
|
||||||
if(this->GetType() == cmTarget::EXECUTABLE)
|
|
||||||
{
|
|
||||||
this->GetExecutableNames(name, realName, impName, pdbName, config);
|
|
||||||
}
|
|
||||||
else if(this->GetType() == cmTarget::STATIC_LIBRARY ||
|
|
||||||
this->GetType() == cmTarget::SHARED_LIBRARY ||
|
|
||||||
this->GetType() == cmTarget::MODULE_LIBRARY)
|
|
||||||
{
|
|
||||||
this->GetLibraryNames(name, soName, realName, impName, pdbName, config);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the directory.
|
|
||||||
std::string dir = this->GetDirectory(config, false);
|
|
||||||
|
|
||||||
// Add each name.
|
|
||||||
std::string f;
|
|
||||||
if(!name.empty())
|
|
||||||
{
|
|
||||||
f = dir;
|
|
||||||
f += "/";
|
|
||||||
f += name;
|
|
||||||
gg->AddToManifest(config? config:"", f);
|
|
||||||
}
|
|
||||||
if(!soName.empty())
|
|
||||||
{
|
|
||||||
f = dir;
|
|
||||||
f += "/";
|
|
||||||
f += soName;
|
|
||||||
gg->AddToManifest(config? config:"", f);
|
|
||||||
}
|
|
||||||
if(!realName.empty())
|
|
||||||
{
|
|
||||||
f = dir;
|
|
||||||
f += "/";
|
|
||||||
f += realName;
|
|
||||||
gg->AddToManifest(config? config:"", f);
|
|
||||||
}
|
|
||||||
if(!pdbName.empty())
|
|
||||||
{
|
|
||||||
f = this->GetPDBDirectory(config);
|
|
||||||
f += "/";
|
|
||||||
f += pdbName;
|
|
||||||
gg->AddToManifest(config? config:"", f);
|
|
||||||
}
|
|
||||||
if(!impName.empty())
|
|
||||||
{
|
|
||||||
f = this->GetDirectory(config, true);
|
|
||||||
f += "/";
|
|
||||||
f += impName;
|
|
||||||
gg->AddToManifest(config? config:"", f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmTarget::SetPropertyDefault(const char* property,
|
void cmTarget::SetPropertyDefault(const char* property,
|
||||||
const char* default_value)
|
const char* default_value)
|
||||||
|
@ -410,9 +410,6 @@ public:
|
|||||||
bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
|
bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
|
||||||
const char* newExt = 0);
|
const char* newExt = 0);
|
||||||
|
|
||||||
/** Add the target output files to the global generator manifest. */
|
|
||||||
void GenerateTargetManifest(const char* config);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute whether this target must be relinked before installing.
|
* Compute whether this target must be relinked before installing.
|
||||||
*/
|
*/
|
||||||
@ -677,7 +674,6 @@ private:
|
|||||||
bool HaveInstallRule;
|
bool HaveInstallRule;
|
||||||
std::string InstallPath;
|
std::string InstallPath;
|
||||||
std::string RuntimeInstallPath;
|
std::string RuntimeInstallPath;
|
||||||
std::string Location;
|
|
||||||
std::string ExportMacro;
|
std::string ExportMacro;
|
||||||
std::set<cmStdString> Utilities;
|
std::set<cmStdString> Utilities;
|
||||||
bool RecordDependencies;
|
bool RecordDependencies;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user