Merge topic 'target-objects-refactor'
6c9dd0ec
cmGlobalGenerator: Make ComputeTargetObjects non-virtualc481fadc
cmGeneratorTarget: Don't store ObjectSources for object libraries.f6da0440
cmLocalGenerator: Add ComputeObjectFilenames interface.9ad804ac
cmGeneratorTarget: Constify cmSourceFile* in containers.c725bb3c
Constify some APIs in generators.dcfcd23e
cmGeneratorTarget: Make GetSourceDepends const.04cf50ff
cmOSXBundleGenerator: Make MacOSXContentGeneratorType arg const.6132d979
cmGeneratorTarget: Constify the AddExplicitObjectName API.bc512211
cmGeneratorTarget: Constify the AddObject API.cd43433d
cmGlobalGenerator: Extract a ComputeTargetObjectDirectory interface.d5b2e33b
Makefiles: Compute local object files on demand.
This commit is contained in:
commit
b16f26f5f9
|
@ -97,7 +97,7 @@ struct DoAccept
|
||||||
template<>
|
template<>
|
||||||
struct DoAccept<true>
|
struct DoAccept<true>
|
||||||
{
|
{
|
||||||
static void Do(std::vector<cmSourceFile*>& files, cmSourceFile* f)
|
static void Do(std::vector<cmSourceFile const*>& files, cmSourceFile* f)
|
||||||
{
|
{
|
||||||
files.push_back(f);
|
files.push_back(f);
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ struct DoAccept<true>
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
template<typename Tag, typename DataType = std::vector<cmSourceFile*> >
|
template<typename Tag, typename DataType = std::vector<cmSourceFile const*> >
|
||||||
struct TagVisitor
|
struct TagVisitor
|
||||||
{
|
{
|
||||||
DataType& Data;
|
DataType& Data;
|
||||||
|
@ -241,7 +241,7 @@ const char *cmGeneratorTarget::GetProperty(const std::string& prop) const
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::vector<cmSourceFile*> const*
|
std::vector<cmSourceFile*> const*
|
||||||
cmGeneratorTarget::GetSourceDepends(cmSourceFile* sf) const
|
cmGeneratorTarget::GetSourceDepends(cmSourceFile const* sf) const
|
||||||
{
|
{
|
||||||
SourceEntriesType::const_iterator i = this->SourceEntries.find(sf);
|
SourceEntriesType::const_iterator i = this->SourceEntries.find(sf);
|
||||||
if(i != this->SourceEntries.end())
|
if(i != this->SourceEntries.end())
|
||||||
|
@ -306,13 +306,10 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt,
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
void
|
||||||
cmGeneratorTarget::GetObjectSources(std::vector<cmSourceFile*> &data) const
|
cmGeneratorTarget
|
||||||
|
::GetObjectSources(std::vector<cmSourceFile const*> &data) const
|
||||||
{
|
{
|
||||||
IMPLEMENT_VISIT(ObjectSources);
|
IMPLEMENT_VISIT(ObjectSources);
|
||||||
if (this->Target->GetType() == cmTarget::OBJECT_LIBRARY)
|
|
||||||
{
|
|
||||||
this->ObjectSources = data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -321,13 +318,14 @@ const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file)
|
||||||
return this->Objects[file];
|
return this->Objects[file];
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGeneratorTarget::AddObject(cmSourceFile *sf, std::string const&name)
|
void cmGeneratorTarget::AddObject(cmSourceFile const* sf,
|
||||||
|
std::string const&name)
|
||||||
{
|
{
|
||||||
this->Objects[sf] = name;
|
this->Objects[sf] = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmGeneratorTarget::AddExplicitObjectName(cmSourceFile* sf)
|
void cmGeneratorTarget::AddExplicitObjectName(cmSourceFile const* sf)
|
||||||
{
|
{
|
||||||
this->ExplicitObjectName.insert(sf);
|
this->ExplicitObjectName.insert(sf);
|
||||||
}
|
}
|
||||||
|
@ -341,34 +339,39 @@ bool cmGeneratorTarget::HasExplicitObjectName(cmSourceFile const* file) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmGeneratorTarget::GetIDLSources(std::vector<cmSourceFile*>& data) const
|
void cmGeneratorTarget
|
||||||
|
::GetIDLSources(std::vector<cmSourceFile const*>& data) const
|
||||||
{
|
{
|
||||||
IMPLEMENT_VISIT(IDLSources);
|
IMPLEMENT_VISIT(IDLSources);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
void
|
||||||
cmGeneratorTarget::GetHeaderSources(std::vector<cmSourceFile*>& data) const
|
cmGeneratorTarget
|
||||||
|
::GetHeaderSources(std::vector<cmSourceFile const*>& data) const
|
||||||
{
|
{
|
||||||
IMPLEMENT_VISIT(HeaderSources);
|
IMPLEMENT_VISIT(HeaderSources);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmGeneratorTarget::GetExtraSources(std::vector<cmSourceFile*>& data) const
|
void cmGeneratorTarget
|
||||||
|
::GetExtraSources(std::vector<cmSourceFile const*>& data) const
|
||||||
{
|
{
|
||||||
IMPLEMENT_VISIT(ExtraSources);
|
IMPLEMENT_VISIT(ExtraSources);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
void
|
||||||
cmGeneratorTarget::GetCustomCommands(std::vector<cmSourceFile*>& data) const
|
cmGeneratorTarget
|
||||||
|
::GetCustomCommands(std::vector<cmSourceFile const*>& data) const
|
||||||
{
|
{
|
||||||
IMPLEMENT_VISIT(CustomCommands);
|
IMPLEMENT_VISIT(CustomCommands);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
void
|
||||||
cmGeneratorTarget::GetExternalObjects(std::vector<cmSourceFile*>& data) const
|
cmGeneratorTarget
|
||||||
|
::GetExternalObjects(std::vector<cmSourceFile const*>& data) const
|
||||||
{
|
{
|
||||||
IMPLEMENT_VISIT(ExternalObjects);
|
IMPLEMENT_VISIT(ExternalObjects);
|
||||||
}
|
}
|
||||||
|
@ -383,7 +386,8 @@ cmGeneratorTarget::GetExpectedResxHeaders(std::set<std::string>& srcs) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmGeneratorTarget::GetResxSources(std::vector<cmSourceFile*>& srcs) const
|
void cmGeneratorTarget
|
||||||
|
::GetResxSources(std::vector<cmSourceFile const*>& srcs) const
|
||||||
{
|
{
|
||||||
ResxData data;
|
ResxData data;
|
||||||
IMPLEMENT_VISIT_IMPL(Resx, COMMA cmGeneratorTarget::ResxData)
|
IMPLEMENT_VISIT_IMPL(Resx, COMMA cmGeneratorTarget::ResxData)
|
||||||
|
@ -569,9 +573,11 @@ cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs) const
|
||||||
cmTarget* objLib = *ti;
|
cmTarget* objLib = *ti;
|
||||||
cmGeneratorTarget* ogt =
|
cmGeneratorTarget* ogt =
|
||||||
this->GlobalGenerator->GetGeneratorTarget(objLib);
|
this->GlobalGenerator->GetGeneratorTarget(objLib);
|
||||||
for(std::vector<cmSourceFile*>::const_iterator
|
std::vector<cmSourceFile const*> objectSources;
|
||||||
si = ogt->ObjectSources.begin();
|
ogt->GetObjectSources(objectSources);
|
||||||
si != ogt->ObjectSources.end(); ++si)
|
for(std::vector<cmSourceFile const*>::const_iterator
|
||||||
|
si = objectSources.begin();
|
||||||
|
si != objectSources.end(); ++si)
|
||||||
{
|
{
|
||||||
std::string obj = ogt->ObjectDirectory;
|
std::string obj = ogt->ObjectDirectory;
|
||||||
obj += ogt->Objects[*si];
|
obj += ogt->Objects[*si];
|
||||||
|
|
|
@ -32,19 +32,19 @@ public:
|
||||||
bool GetPropertyAsBool(const std::string& prop) const;
|
bool GetPropertyAsBool(const std::string& prop) const;
|
||||||
void GetSourceFiles(std::vector<cmSourceFile*>& files) const;
|
void GetSourceFiles(std::vector<cmSourceFile*>& files) const;
|
||||||
|
|
||||||
void GetObjectSources(std::vector<cmSourceFile*> &) const;
|
void GetObjectSources(std::vector<cmSourceFile const*> &) const;
|
||||||
const std::string& GetObjectName(cmSourceFile const* file);
|
const std::string& GetObjectName(cmSourceFile const* file);
|
||||||
|
|
||||||
void AddObject(cmSourceFile *sf, std::string const&name);
|
void AddObject(cmSourceFile const* sf, std::string const&name);
|
||||||
bool HasExplicitObjectName(cmSourceFile const* file) const;
|
bool HasExplicitObjectName(cmSourceFile const* file) const;
|
||||||
void AddExplicitObjectName(cmSourceFile* sf);
|
void AddExplicitObjectName(cmSourceFile const* sf);
|
||||||
|
|
||||||
void GetResxSources(std::vector<cmSourceFile*>&) const;
|
void GetResxSources(std::vector<cmSourceFile const*>&) const;
|
||||||
void GetIDLSources(std::vector<cmSourceFile*>&) const;
|
void GetIDLSources(std::vector<cmSourceFile const*>&) const;
|
||||||
void GetExternalObjects(std::vector<cmSourceFile*>&) const;
|
void GetExternalObjects(std::vector<cmSourceFile const*>&) const;
|
||||||
void GetHeaderSources(std::vector<cmSourceFile*>&) const;
|
void GetHeaderSources(std::vector<cmSourceFile const*>&) const;
|
||||||
void GetExtraSources(std::vector<cmSourceFile*>&) const;
|
void GetExtraSources(std::vector<cmSourceFile const*>&) const;
|
||||||
void GetCustomCommands(std::vector<cmSourceFile*>&) const;
|
void GetCustomCommands(std::vector<cmSourceFile const*>&) const;
|
||||||
void GetExpectedResxHeaders(std::set<std::string>&) const;
|
void GetExpectedResxHeaders(std::set<std::string>&) const;
|
||||||
|
|
||||||
cmTarget* Target;
|
cmTarget* Target;
|
||||||
|
@ -87,7 +87,8 @@ public:
|
||||||
void LookupObjectLibraries();
|
void LookupObjectLibraries();
|
||||||
|
|
||||||
/** Get sources that must be built before the given source. */
|
/** Get sources that must be built before the given source. */
|
||||||
std::vector<cmSourceFile*> const* GetSourceDepends(cmSourceFile* sf) const;
|
std::vector<cmSourceFile*> const*
|
||||||
|
GetSourceDepends(cmSourceFile const* sf) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flags for a given source file as used in this target. Typically assigned
|
* Flags for a given source file as used in this target. Typically assigned
|
||||||
|
@ -116,17 +117,16 @@ public:
|
||||||
|
|
||||||
struct ResxData {
|
struct ResxData {
|
||||||
mutable std::set<std::string> ExpectedResxHeaders;
|
mutable std::set<std::string> ExpectedResxHeaders;
|
||||||
mutable std::vector<cmSourceFile*> ResxSources;
|
mutable std::vector<cmSourceFile const*> ResxSources;
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
friend class cmTargetTraceDependencies;
|
friend class cmTargetTraceDependencies;
|
||||||
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
|
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
|
||||||
typedef std::map<cmSourceFile*, SourceEntry> SourceEntriesType;
|
typedef std::map<cmSourceFile const*, SourceEntry> SourceEntriesType;
|
||||||
SourceEntriesType SourceEntries;
|
SourceEntriesType SourceEntries;
|
||||||
|
|
||||||
std::map<cmSourceFile const*, std::string> Objects;
|
std::map<cmSourceFile const*, std::string> Objects;
|
||||||
std::set<cmSourceFile const*> ExplicitObjectName;
|
std::set<cmSourceFile const*> ExplicitObjectName;
|
||||||
mutable std::vector<cmSourceFile*> ObjectSources;
|
|
||||||
std::vector<cmTarget*> ObjectLibraries;
|
std::vector<cmTarget*> ObjectLibraries;
|
||||||
mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache;
|
mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache;
|
||||||
|
|
||||||
|
|
|
@ -1449,6 +1449,7 @@ void cmGlobalGenerator::ComputeGeneratorTargetObjects()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
cmGeneratorTarget* gt = ti->second;
|
cmGeneratorTarget* gt = ti->second;
|
||||||
|
this->ComputeTargetObjectDirectory(gt);
|
||||||
gt->LookupObjectLibraries();
|
gt->LookupObjectLibraries();
|
||||||
this->ComputeTargetObjects(gt);
|
this->ComputeTargetObjects(gt);
|
||||||
}
|
}
|
||||||
|
@ -1515,9 +1516,31 @@ cmGlobalGenerator::GetGeneratorTarget(cmTarget const* t) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmGlobalGenerator::ComputeTargetObjects(cmGeneratorTarget*) const
|
void cmGlobalGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const
|
||||||
|
{
|
||||||
|
std::vector<cmSourceFile const*> objectSources;
|
||||||
|
gt->GetObjectSources(objectSources);
|
||||||
|
|
||||||
|
std::map<cmSourceFile const*, std::string> mapping;
|
||||||
|
for(std::vector<cmSourceFile const*>::const_iterator it
|
||||||
|
= objectSources.begin(); it != objectSources.end(); ++it)
|
||||||
|
{
|
||||||
|
mapping[*it];
|
||||||
|
}
|
||||||
|
|
||||||
|
gt->LocalGenerator->ComputeObjectFilenames(mapping, gt);
|
||||||
|
|
||||||
|
for(std::map<cmSourceFile const*, std::string>::const_iterator it
|
||||||
|
= mapping.begin(); it != mapping.end(); ++it)
|
||||||
|
{
|
||||||
|
assert(!it->second.empty());
|
||||||
|
gt->AddObject(it->first, it->second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmGlobalGenerator::ComputeTargetObjectDirectory(cmGeneratorTarget*) const
|
||||||
{
|
{
|
||||||
// Implemented in generator subclasses that need this.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGlobalGenerator::CheckLocalGenerators()
|
void cmGlobalGenerator::CheckLocalGenerators()
|
||||||
|
|
|
@ -323,6 +323,8 @@ public:
|
||||||
GetExportedTargetsFile(const std::string &filename) const;
|
GetExportedTargetsFile(const std::string &filename) const;
|
||||||
void AddCMP0042WarnTarget(const std::string& target);
|
void AddCMP0042WarnTarget(const std::string& target);
|
||||||
|
|
||||||
|
virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef std::vector<cmLocalGenerator*> GeneratorVector;
|
typedef std::vector<cmLocalGenerator*> GeneratorVector;
|
||||||
// for a project collect all its targets by following depend
|
// for a project collect all its targets by following depend
|
||||||
|
@ -441,7 +443,7 @@ private:
|
||||||
void CreateGeneratorTargets(cmMakefile* mf);
|
void CreateGeneratorTargets(cmMakefile* mf);
|
||||||
void CreateGeneratorTargets();
|
void CreateGeneratorTargets();
|
||||||
void ComputeGeneratorTargetObjects();
|
void ComputeGeneratorTargetObjects();
|
||||||
virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;
|
void ComputeTargetObjects(cmGeneratorTarget* gt) const;
|
||||||
|
|
||||||
void ClearGeneratorMembers();
|
void ClearGeneratorMembers();
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "cmVersion.h"
|
#include "cmVersion.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
const char* cmGlobalNinjaGenerator::NINJA_BUILD_FILE = "build.ninja";
|
const char* cmGlobalNinjaGenerator::NINJA_BUILD_FILE = "build.ninja";
|
||||||
const char* cmGlobalNinjaGenerator::NINJA_RULES_FILE = "rules.ninja";
|
const char* cmGlobalNinjaGenerator::NINJA_RULES_FILE = "rules.ninja";
|
||||||
|
@ -631,8 +632,9 @@ std::string cmGlobalNinjaGenerator::GetEditCacheCommand() const
|
||||||
return cmSystemTools::GetCMakeGUICommand();
|
return cmSystemTools::GetCMakeGUICommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Refactor to combine with cmGlobalUnixMakefileGenerator3 impl.
|
//----------------------------------------------------------------------------
|
||||||
void cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const
|
void cmGlobalNinjaGenerator
|
||||||
|
::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
|
||||||
{
|
{
|
||||||
cmTarget* target = gt->Target;
|
cmTarget* target = gt->Target;
|
||||||
|
|
||||||
|
@ -643,19 +645,6 @@ void cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const
|
||||||
dir_max += gt->LocalGenerator->GetTargetDirectory(*target);
|
dir_max += gt->LocalGenerator->GetTargetDirectory(*target);
|
||||||
dir_max += "/";
|
dir_max += "/";
|
||||||
gt->ObjectDirectory = dir_max;
|
gt->ObjectDirectory = dir_max;
|
||||||
|
|
||||||
std::vector<cmSourceFile*> objectSources;
|
|
||||||
gt->GetObjectSources(objectSources);
|
|
||||||
// Compute the name of each object file.
|
|
||||||
for(std::vector<cmSourceFile*>::iterator
|
|
||||||
si = objectSources.begin();
|
|
||||||
si != objectSources.end(); ++si)
|
|
||||||
{
|
|
||||||
cmSourceFile* sf = *si;
|
|
||||||
std::string objectName = gt->LocalGenerator
|
|
||||||
->GetObjectFileNameWithoutTarget(*sf, dir_max);
|
|
||||||
gt->AddObject(sf, objectName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -299,7 +299,7 @@ public:
|
||||||
|
|
||||||
void AddTargetAlias(const std::string& alias, cmTarget* target);
|
void AddTargetAlias(const std::string& alias, cmTarget* target);
|
||||||
|
|
||||||
|
virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/// Overloaded methods.
|
/// Overloaded methods.
|
||||||
|
@ -310,8 +310,6 @@ protected:
|
||||||
private:
|
private:
|
||||||
virtual std::string GetEditCacheCommand() const;
|
virtual std::string GetEditCacheCommand() const;
|
||||||
|
|
||||||
/// @see cmGlobalGenerator::ComputeTargetObjects
|
|
||||||
virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;
|
|
||||||
|
|
||||||
void OpenBuildFileStream();
|
void OpenBuildFileStream();
|
||||||
void CloseBuildFileStream();
|
void CloseBuildFileStream();
|
||||||
|
|
|
@ -106,11 +106,9 @@ std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
void
|
||||||
cmGlobalUnixMakefileGenerator3
|
cmGlobalUnixMakefileGenerator3
|
||||||
::ComputeTargetObjects(cmGeneratorTarget* gt) const
|
::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
|
||||||
{
|
{
|
||||||
cmTarget* target = gt->Target;
|
cmTarget* target = gt->Target;
|
||||||
cmLocalUnixMakefileGenerator3* lg =
|
|
||||||
static_cast<cmLocalUnixMakefileGenerator3*>(gt->LocalGenerator);
|
|
||||||
|
|
||||||
// Compute full path to object file directory for this target.
|
// Compute full path to object file directory for this target.
|
||||||
std::string dir_max;
|
std::string dir_max;
|
||||||
|
@ -119,22 +117,6 @@ cmGlobalUnixMakefileGenerator3
|
||||||
dir_max += gt->LocalGenerator->GetTargetDirectory(*target);
|
dir_max += gt->LocalGenerator->GetTargetDirectory(*target);
|
||||||
dir_max += "/";
|
dir_max += "/";
|
||||||
gt->ObjectDirectory = dir_max;
|
gt->ObjectDirectory = dir_max;
|
||||||
|
|
||||||
std::vector<cmSourceFile*> objectSources;
|
|
||||||
gt->GetObjectSources(objectSources);
|
|
||||||
// Compute the name of each object file.
|
|
||||||
for(std::vector<cmSourceFile*>::iterator
|
|
||||||
si = objectSources.begin();
|
|
||||||
si != objectSources.end(); ++si)
|
|
||||||
{
|
|
||||||
cmSourceFile* sf = *si;
|
|
||||||
bool hasSourceExtension = true;
|
|
||||||
std::string objectName = gt->LocalGenerator
|
|
||||||
->GetObjectFileNameWithoutTarget(*sf, dir_max,
|
|
||||||
&hasSourceExtension);
|
|
||||||
gt->AddObject(sf, objectName);
|
|
||||||
lg->AddLocalObjectFile(target, sf, objectName, hasSourceExtension);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGlobalUnixMakefileGenerator3::Configure()
|
void cmGlobalUnixMakefileGenerator3::Configure()
|
||||||
|
|
|
@ -128,6 +128,7 @@ public:
|
||||||
/** Does the make tool tolerate .NOTPARALLEL? */
|
/** Does the make tool tolerate .NOTPARALLEL? */
|
||||||
virtual bool AllowNotParallel() const { return true; }
|
virtual bool AllowNotParallel() const { return true; }
|
||||||
|
|
||||||
|
virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
|
||||||
protected:
|
protected:
|
||||||
void WriteMainMakefile2();
|
void WriteMainMakefile2();
|
||||||
void WriteMainCMakefile();
|
void WriteMainCMakefile();
|
||||||
|
@ -198,7 +199,6 @@ protected:
|
||||||
private:
|
private:
|
||||||
virtual const char* GetBuildIgnoreErrorsFlag() const { return "-i"; }
|
virtual const char* GetBuildIgnoreErrorsFlag() const { return "-i"; }
|
||||||
virtual std::string GetEditCacheCommand() const;
|
virtual std::string GetEditCacheCommand() const;
|
||||||
virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -470,7 +470,7 @@ cmGlobalVisualStudio10Generator
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmGlobalVisualStudio10Generator::PathTooLong(
|
void cmGlobalVisualStudio10Generator::PathTooLong(
|
||||||
cmTarget* target, cmSourceFile* sf, std::string const& sfRel)
|
cmTarget* target, cmSourceFile const* sf, std::string const& sfRel)
|
||||||
{
|
{
|
||||||
size_t len = (strlen(target->GetMakefile()->GetCurrentOutputDirectory()) +
|
size_t len = (strlen(target->GetMakefile()->GetCurrentOutputDirectory()) +
|
||||||
1 + sfRel.length());
|
1 + sfRel.length());
|
||||||
|
|
|
@ -87,7 +87,7 @@ public:
|
||||||
/** Generate an <output>.rule file path for a given command output. */
|
/** Generate an <output>.rule file path for a given command output. */
|
||||||
virtual std::string GenerateRuleFile(std::string const& output) const;
|
virtual std::string GenerateRuleFile(std::string const& output) const;
|
||||||
|
|
||||||
void PathTooLong(cmTarget* target, cmSourceFile* sf,
|
void PathTooLong(cmTarget* target, cmSourceFile const* sf,
|
||||||
std::string const& sfRel);
|
std::string const& sfRel);
|
||||||
|
|
||||||
virtual const char* GetToolsVersion() { return "4.0"; }
|
virtual const char* GetToolsVersion() { return "4.0"; }
|
||||||
|
@ -112,7 +112,7 @@ private:
|
||||||
LongestSourcePath(): Length(0), Target(0), SourceFile(0) {}
|
LongestSourcePath(): Length(0), Target(0), SourceFile(0) {}
|
||||||
size_t Length;
|
size_t Length;
|
||||||
cmTarget* Target;
|
cmTarget* Target;
|
||||||
cmSourceFile* SourceFile;
|
cmSourceFile const* SourceFile;
|
||||||
std::string SourceRel;
|
std::string SourceRel;
|
||||||
};
|
};
|
||||||
LongestSourcePath LongestSource;
|
LongestSourcePath LongestSource;
|
||||||
|
|
|
@ -119,51 +119,12 @@ void cmGlobalVisualStudioGenerator::Generate()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
void cmGlobalVisualStudioGenerator
|
||||||
cmGlobalVisualStudioGenerator
|
::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
|
||||||
::ComputeTargetObjects(cmGeneratorTarget* gt) const
|
|
||||||
{
|
{
|
||||||
cmLocalVisualStudioGenerator* lg =
|
|
||||||
static_cast<cmLocalVisualStudioGenerator*>(gt->LocalGenerator);
|
|
||||||
std::string dir_max = lg->ComputeLongestObjectDirectory(*gt->Target);
|
|
||||||
|
|
||||||
// Count the number of object files with each name. Note that
|
|
||||||
// windows file names are not case sensitive.
|
|
||||||
std::map<std::string, int> counts;
|
|
||||||
std::vector<cmSourceFile*> objectSources;
|
|
||||||
gt->GetObjectSources(objectSources);
|
|
||||||
for(std::vector<cmSourceFile*>::const_iterator
|
|
||||||
si = objectSources.begin();
|
|
||||||
si != objectSources.end(); ++si)
|
|
||||||
{
|
|
||||||
cmSourceFile* sf = *si;
|
|
||||||
std::string objectNameLower = cmSystemTools::LowerCase(
|
|
||||||
cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()));
|
|
||||||
objectNameLower += ".obj";
|
|
||||||
counts[objectNameLower] += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// For all source files producing duplicate names we need unique
|
|
||||||
// object name computation.
|
|
||||||
for(std::vector<cmSourceFile*>::const_iterator
|
|
||||||
si = objectSources.begin();
|
|
||||||
si != objectSources.end(); ++si)
|
|
||||||
{
|
|
||||||
cmSourceFile* sf = *si;
|
|
||||||
std::string objectName =
|
|
||||||
cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath());
|
|
||||||
objectName += ".obj";
|
|
||||||
if(counts[cmSystemTools::LowerCase(objectName)] > 1)
|
|
||||||
{
|
|
||||||
gt->AddExplicitObjectName(sf);
|
|
||||||
objectName = lg->GetObjectFileNameWithoutTarget(*sf, dir_max);
|
|
||||||
}
|
|
||||||
gt->AddObject(sf, objectName);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string dir = gt->Makefile->GetCurrentOutputDirectory();
|
std::string dir = gt->Makefile->GetCurrentOutputDirectory();
|
||||||
dir += "/";
|
dir += "/";
|
||||||
std::string tgtDir = lg->GetTargetDirectory(*gt->Target);
|
std::string tgtDir = gt->LocalGenerator->GetTargetDirectory(*gt->Target);
|
||||||
if(!tgtDir.empty())
|
if(!tgtDir.empty())
|
||||||
{
|
{
|
||||||
dir += tgtDir;
|
dir += tgtDir;
|
||||||
|
|
|
@ -88,6 +88,7 @@ public:
|
||||||
virtual std::string ExpandCFGIntDir(const std::string& str,
|
virtual std::string ExpandCFGIntDir(const std::string& str,
|
||||||
const std::string& config) const;
|
const std::string& config) const;
|
||||||
|
|
||||||
|
void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
|
||||||
protected:
|
protected:
|
||||||
// Does this VS version link targets to each other if there are
|
// Does this VS version link targets to each other if there are
|
||||||
// dependencies in the SLN file? This was done for VS versions
|
// dependencies in the SLN file? This was done for VS versions
|
||||||
|
@ -116,7 +117,6 @@ private:
|
||||||
virtual std::string GetVSMakeProgram() = 0;
|
virtual std::string GetVSMakeProgram() = 0;
|
||||||
void PrintCompilerAdvice(std::ostream&, std::string const&,
|
void PrintCompilerAdvice(std::ostream&, std::string const&,
|
||||||
const char*) const {}
|
const char*) const {}
|
||||||
void ComputeTargetObjects(cmGeneratorTarget* gt) const;
|
|
||||||
|
|
||||||
void FollowLinkDepends(cmTarget const* target,
|
void FollowLinkDepends(cmTarget const* target,
|
||||||
std::set<cmTarget const*>& linked);
|
std::set<cmTarget const*>& linked);
|
||||||
|
|
|
@ -3935,36 +3935,9 @@ bool cmGlobalXCodeGenerator::IsMultiConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
void cmGlobalXCodeGenerator
|
||||||
cmGlobalXCodeGenerator
|
::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
|
||||||
::ComputeTargetObjects(cmGeneratorTarget* gt) const
|
|
||||||
{
|
{
|
||||||
// Count the number of object files with each name. Warn about duplicate
|
|
||||||
// names since Xcode names them uniquely automatically with a numeric suffix
|
|
||||||
// to avoid exact duplicate file names. Note that Mac file names are not
|
|
||||||
// typically case sensitive, hence the LowerCase.
|
|
||||||
std::map<std::string, int> counts;
|
|
||||||
std::vector<cmSourceFile*> objectSources;
|
|
||||||
gt->GetObjectSources(objectSources);
|
|
||||||
for(std::vector<cmSourceFile*>::const_iterator
|
|
||||||
si = objectSources.begin();
|
|
||||||
si != objectSources.end(); ++si)
|
|
||||||
{
|
|
||||||
cmSourceFile* sf = *si;
|
|
||||||
std::string objectName =
|
|
||||||
cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath());
|
|
||||||
objectName += ".o";
|
|
||||||
|
|
||||||
std::string objectNameLower = cmSystemTools::LowerCase(objectName);
|
|
||||||
counts[objectNameLower] += 1;
|
|
||||||
if (2 == counts[objectNameLower])
|
|
||||||
{
|
|
||||||
// TODO: emit warning about duplicate name?
|
|
||||||
}
|
|
||||||
|
|
||||||
gt->AddObject(sf, objectName);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* configName = this->GetCMakeCFGIntDir();
|
const char* configName = this->GetCMakeCFGIntDir();
|
||||||
std::string dir = this->GetObjectsNormalDirectory(
|
std::string dir = this->GetObjectsNormalDirectory(
|
||||||
"$(PROJECT_NAME)", configName, gt->Target);
|
"$(PROJECT_NAME)", configName, gt->Target);
|
||||||
|
|
|
@ -204,6 +204,7 @@ private:
|
||||||
std::vector<std::string> const& defines,
|
std::vector<std::string> const& defines,
|
||||||
bool dflag = false);
|
bool dflag = false);
|
||||||
|
|
||||||
|
void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
|
||||||
protected:
|
protected:
|
||||||
virtual const char* GetInstallTargetName() const { return "install"; }
|
virtual const char* GetInstallTargetName() const { return "install"; }
|
||||||
virtual const char* GetPackageTargetName() const { return "package"; }
|
virtual const char* GetPackageTargetName() const { return "package"; }
|
||||||
|
@ -216,7 +217,6 @@ protected:
|
||||||
private:
|
private:
|
||||||
void PrintCompilerAdvice(std::ostream&, std::string const&,
|
void PrintCompilerAdvice(std::ostream&, std::string const&,
|
||||||
const char*) const {}
|
const char*) const {}
|
||||||
void ComputeTargetObjects(cmGeneratorTarget* gt) const;
|
|
||||||
|
|
||||||
std::string GetObjectsNormalDirectory(
|
std::string GetObjectsNormalDirectory(
|
||||||
const std::string &projName,
|
const std::string &projName,
|
||||||
|
|
|
@ -3080,6 +3080,14 @@ cmLocalGenerator
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmLocalGenerator::ComputeObjectFilenames(
|
||||||
|
std::map<cmSourceFile const*, std::string>&,
|
||||||
|
cmGeneratorTarget const*)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string
|
std::string
|
||||||
cmLocalGenerator
|
cmLocalGenerator
|
||||||
|
|
|
@ -372,6 +372,10 @@ public:
|
||||||
std::string& linkPath,
|
std::string& linkPath,
|
||||||
cmGeneratorTarget* target);
|
cmGeneratorTarget* target);
|
||||||
|
|
||||||
|
virtual void ComputeObjectFilenames(
|
||||||
|
std::map<cmSourceFile const*, std::string>& mapping,
|
||||||
|
cmGeneratorTarget const* gt = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
///! put all the libraries for a target on into the given stream
|
///! put all the libraries for a target on into the given stream
|
||||||
virtual void OutputLinkLibraries(std::string& linkLibraries,
|
virtual void OutputLinkLibraries(std::string& linkLibraries,
|
||||||
|
|
|
@ -267,6 +267,20 @@ void cmLocalNinjaGenerator::SetConfigName()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmLocalNinjaGenerator::ComputeObjectFilenames(
|
||||||
|
std::map<cmSourceFile const*, std::string>& mapping,
|
||||||
|
cmGeneratorTarget const* gt)
|
||||||
|
{
|
||||||
|
for(std::map<cmSourceFile const*, std::string>::iterator
|
||||||
|
si = mapping.begin(); si != mapping.end(); ++si)
|
||||||
|
{
|
||||||
|
cmSourceFile const* sf = si->first;
|
||||||
|
si->second = this->GetObjectFileNameWithoutTarget(*sf,
|
||||||
|
gt->ObjectDirectory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os)
|
void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os)
|
||||||
{
|
{
|
||||||
cmGlobalNinjaGenerator::WriteDivider(os);
|
cmGlobalNinjaGenerator::WriteDivider(os);
|
||||||
|
|
|
@ -101,6 +101,10 @@ public:
|
||||||
virtual std::string ConvertToLinkReference(std::string const& lib,
|
virtual std::string ConvertToLinkReference(std::string const& lib,
|
||||||
OutputFormat format = SHELL);
|
OutputFormat format = SHELL);
|
||||||
|
|
||||||
|
virtual void ComputeObjectFilenames(
|
||||||
|
std::map<cmSourceFile const*, std::string>& mapping,
|
||||||
|
cmGeneratorTarget const* gt = 0);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual std::string ConvertToIncludeReference(std::string const& path,
|
virtual std::string ConvertToIncludeReference(std::string const& path,
|
||||||
|
|
|
@ -172,26 +172,71 @@ void cmLocalUnixMakefileGenerator3::Generate()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmLocalUnixMakefileGenerator3::AddLocalObjectFile(
|
void cmLocalUnixMakefileGenerator3::ComputeObjectFilenames(
|
||||||
cmTarget* target, cmSourceFile* sf, std::string objNoTargetDir,
|
std::map<cmSourceFile const*, std::string>& mapping,
|
||||||
bool hasSourceExtension)
|
cmGeneratorTarget const* gt)
|
||||||
{
|
{
|
||||||
if(cmSystemTools::FileIsFullPath(objNoTargetDir.c_str()))
|
for(std::map<cmSourceFile const*, std::string>::iterator
|
||||||
|
si = mapping.begin(); si != mapping.end(); ++si)
|
||||||
{
|
{
|
||||||
objNoTargetDir = cmSystemTools::GetFilenameName(objNoTargetDir);
|
cmSourceFile const* sf = si->first;
|
||||||
|
si->second = this->GetObjectFileNameWithoutTarget(*sf,
|
||||||
|
gt->ObjectDirectory);
|
||||||
}
|
}
|
||||||
LocalObjectInfo& info = this->LocalObjectFiles[objNoTargetDir];
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmLocalUnixMakefileGenerator3::
|
||||||
|
GetLocalObjectFiles(std::map<std::string, LocalObjectInfo> &localObjectFiles)
|
||||||
|
{
|
||||||
|
std::set<std::string> emitted;
|
||||||
|
cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
|
||||||
|
for(cmGeneratorTargetsType::iterator ti = targets.begin();
|
||||||
|
ti != targets.end(); ++ti)
|
||||||
|
{
|
||||||
|
cmGeneratorTarget* gt = ti->second;
|
||||||
|
if (gt->GetType() == cmTarget::INTERFACE_LIBRARY)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
std::vector<cmSourceFile const*> objectSources;
|
||||||
|
gt->GetObjectSources(objectSources);
|
||||||
|
// Compute full path to object file directory for this target.
|
||||||
|
std::string dir_max;
|
||||||
|
dir_max += gt->Makefile->GetCurrentOutputDirectory();
|
||||||
|
dir_max += "/";
|
||||||
|
dir_max += this->GetTargetDirectory(*gt->Target);
|
||||||
|
dir_max += "/";
|
||||||
|
// Compute the name of each object file.
|
||||||
|
for(std::vector<cmSourceFile const*>::iterator
|
||||||
|
si = objectSources.begin();
|
||||||
|
si != objectSources.end(); ++si)
|
||||||
|
{
|
||||||
|
cmSourceFile const* sf = *si;
|
||||||
|
bool hasSourceExtension = true;
|
||||||
|
std::string objectName = this->GetObjectFileNameWithoutTarget(*sf,
|
||||||
|
dir_max,
|
||||||
|
&hasSourceExtension);
|
||||||
|
if(cmSystemTools::FileIsFullPath(objectName.c_str()))
|
||||||
|
{
|
||||||
|
objectName = cmSystemTools::GetFilenameName(objectName);
|
||||||
|
}
|
||||||
|
LocalObjectInfo& info = localObjectFiles[objectName];
|
||||||
info.HasSourceExtension = hasSourceExtension;
|
info.HasSourceExtension = hasSourceExtension;
|
||||||
info.push_back(LocalObjectEntry(target, sf->GetLanguage()));
|
info.push_back(LocalObjectEntry(gt->Target, sf->GetLanguage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmLocalUnixMakefileGenerator3::GetIndividualFileTargets
|
void cmLocalUnixMakefileGenerator3::GetIndividualFileTargets
|
||||||
(std::vector<std::string>& targets)
|
(std::vector<std::string>& targets)
|
||||||
{
|
{
|
||||||
|
std::map<std::string, LocalObjectInfo> localObjectFiles;
|
||||||
|
this->GetLocalObjectFiles(localObjectFiles);
|
||||||
for (std::map<std::string, LocalObjectInfo>::iterator lo =
|
for (std::map<std::string, LocalObjectInfo>::iterator lo =
|
||||||
this->LocalObjectFiles.begin();
|
localObjectFiles.begin();
|
||||||
lo != this->LocalObjectFiles.end(); ++lo)
|
lo != localObjectFiles.end(); ++lo)
|
||||||
{
|
{
|
||||||
targets.push_back(lo->first);
|
targets.push_back(lo->first);
|
||||||
|
|
||||||
|
@ -253,11 +298,14 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
|
||||||
bool do_assembly_rules =
|
bool do_assembly_rules =
|
||||||
this->GetCreateAssemblySourceRules();
|
this->GetCreateAssemblySourceRules();
|
||||||
|
|
||||||
|
std::map<std::string, LocalObjectInfo> localObjectFiles;
|
||||||
|
this->GetLocalObjectFiles(localObjectFiles);
|
||||||
|
|
||||||
// now write out the object rules
|
// now write out the object rules
|
||||||
// for each object file name
|
// for each object file name
|
||||||
for (std::map<std::string, LocalObjectInfo>::iterator lo =
|
for (std::map<std::string, LocalObjectInfo>::iterator lo =
|
||||||
this->LocalObjectFiles.begin();
|
localObjectFiles.begin();
|
||||||
lo != this->LocalObjectFiles.end(); ++lo)
|
lo != localObjectFiles.end(); ++lo)
|
||||||
{
|
{
|
||||||
// Add a convenience rule for building the object file.
|
// Add a convenience rule for building the object file.
|
||||||
this->WriteObjectConvenienceRule(ruleFileStream,
|
this->WriteObjectConvenienceRule(ruleFileStream,
|
||||||
|
|
|
@ -224,10 +224,6 @@ public:
|
||||||
// write the target rules for the local Makefile into the stream
|
// write the target rules for the local Makefile into the stream
|
||||||
void WriteLocalAllRules(std::ostream& ruleFileStream);
|
void WriteLocalAllRules(std::ostream& ruleFileStream);
|
||||||
|
|
||||||
void AddLocalObjectFile(cmTarget* target, cmSourceFile* sf,
|
|
||||||
std::string objNoTargetDir,
|
|
||||||
bool hasSourceExtension);
|
|
||||||
|
|
||||||
std::vector<std::string> const& GetLocalHelp() { return this->LocalHelp; }
|
std::vector<std::string> const& GetLocalHelp() { return this->LocalHelp; }
|
||||||
|
|
||||||
/** Get whether to create rules to generate preprocessed and
|
/** Get whether to create rules to generate preprocessed and
|
||||||
|
@ -317,6 +313,10 @@ private:
|
||||||
std::string MakeLauncher(cmCustomCommandGenerator const& ccg,
|
std::string MakeLauncher(cmCustomCommandGenerator const& ccg,
|
||||||
cmTarget* target, RelativeRoot relative);
|
cmTarget* target, RelativeRoot relative);
|
||||||
|
|
||||||
|
virtual void ComputeObjectFilenames(
|
||||||
|
std::map<cmSourceFile const*, std::string>& mapping,
|
||||||
|
cmGeneratorTarget const* gt = 0);
|
||||||
|
|
||||||
friend class cmMakefileTargetGenerator;
|
friend class cmMakefileTargetGenerator;
|
||||||
friend class cmMakefileExecutableTargetGenerator;
|
friend class cmMakefileExecutableTargetGenerator;
|
||||||
friend class cmMakefileLibraryTargetGenerator;
|
friend class cmMakefileLibraryTargetGenerator;
|
||||||
|
@ -366,7 +366,9 @@ private:
|
||||||
LocalObjectInfo():HasSourceExtension(false), HasPreprocessRule(false),
|
LocalObjectInfo():HasSourceExtension(false), HasPreprocessRule(false),
|
||||||
HasAssembleRule(false) {}
|
HasAssembleRule(false) {}
|
||||||
};
|
};
|
||||||
std::map<std::string, LocalObjectInfo> LocalObjectFiles;
|
void GetLocalObjectFiles(
|
||||||
|
std::map<std::string, LocalObjectInfo> &localObjectFiles);
|
||||||
|
|
||||||
void WriteObjectConvenienceRule(std::ostream& ruleFileStream,
|
void WriteObjectConvenienceRule(std::ostream& ruleFileStream,
|
||||||
const char* comment, const char* output,
|
const char* comment, const char* output,
|
||||||
LocalObjectInfo const& info);
|
LocalObjectInfo const& info);
|
||||||
|
|
|
@ -30,6 +30,46 @@ cmLocalVisualStudioGenerator::~cmLocalVisualStudioGenerator()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmLocalVisualStudioGenerator::ComputeObjectFilenames(
|
||||||
|
std::map<cmSourceFile const*, std::string>& mapping,
|
||||||
|
cmGeneratorTarget const* gt)
|
||||||
|
{
|
||||||
|
std::string dir_max = this->ComputeLongestObjectDirectory(*gt->Target);
|
||||||
|
|
||||||
|
// Count the number of object files with each name. Note that
|
||||||
|
// windows file names are not case sensitive.
|
||||||
|
std::map<std::string, int> counts;
|
||||||
|
|
||||||
|
for(std::map<cmSourceFile const*, std::string>::iterator
|
||||||
|
si = mapping.begin(); si != mapping.end(); ++si)
|
||||||
|
{
|
||||||
|
cmSourceFile const* sf = si->first;
|
||||||
|
std::string objectNameLower = cmSystemTools::LowerCase(
|
||||||
|
cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()));
|
||||||
|
objectNameLower += ".obj";
|
||||||
|
counts[objectNameLower] += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For all source files producing duplicate names we need unique
|
||||||
|
// object name computation.
|
||||||
|
|
||||||
|
for(std::map<cmSourceFile const*, std::string>::iterator
|
||||||
|
si = mapping.begin(); si != mapping.end(); ++si)
|
||||||
|
{
|
||||||
|
cmSourceFile const* sf = si->first;
|
||||||
|
std::string objectName =
|
||||||
|
cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath());
|
||||||
|
objectName += ".obj";
|
||||||
|
if(counts[cmSystemTools::LowerCase(objectName)] > 1)
|
||||||
|
{
|
||||||
|
const_cast<cmGeneratorTarget*>(gt)->AddExplicitObjectName(sf);
|
||||||
|
objectName = this->GetObjectFileNameWithoutTarget(*sf, dir_max);
|
||||||
|
}
|
||||||
|
si->second = objectName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmsys::auto_ptr<cmCustomCommand>
|
cmsys::auto_ptr<cmCustomCommand>
|
||||||
cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target,
|
cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target,
|
||||||
|
|
|
@ -61,6 +61,10 @@ public:
|
||||||
|
|
||||||
virtual void AddCMakeListsRules() = 0;
|
virtual void AddCMakeListsRules() = 0;
|
||||||
|
|
||||||
|
virtual void ComputeObjectFilenames(
|
||||||
|
std::map<cmSourceFile const*, std::string>& mapping,
|
||||||
|
cmGeneratorTarget const* = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const char* ReportErrorLabel() const;
|
virtual const char* ReportErrorLabel() const;
|
||||||
virtual bool CustomCommandUseLocal() const { return false; }
|
virtual bool CustomCommandUseLocal() const { return false; }
|
||||||
|
|
|
@ -71,3 +71,31 @@ void cmLocalXCodeGenerator::GenerateInstallRules()
|
||||||
t->HasMacOSXRpathInstallNameDir("");
|
t->HasMacOSXRpathInstallNameDir("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmLocalXCodeGenerator::ComputeObjectFilenames(
|
||||||
|
std::map<cmSourceFile const*, std::string>& mapping,
|
||||||
|
cmGeneratorTarget const*)
|
||||||
|
{
|
||||||
|
// Count the number of object files with each name. Warn about duplicate
|
||||||
|
// names since Xcode names them uniquely automatically with a numeric suffix
|
||||||
|
// to avoid exact duplicate file names. Note that Mac file names are not
|
||||||
|
// typically case sensitive, hence the LowerCase.
|
||||||
|
std::map<std::string, int> counts;
|
||||||
|
for(std::map<cmSourceFile const*, std::string>::iterator
|
||||||
|
si = mapping.begin(); si != mapping.end(); ++si)
|
||||||
|
{
|
||||||
|
cmSourceFile const* sf = si->first;
|
||||||
|
std::string objectName =
|
||||||
|
cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath());
|
||||||
|
objectName += ".o";
|
||||||
|
|
||||||
|
std::string objectNameLower = cmSystemTools::LowerCase(objectName);
|
||||||
|
counts[objectNameLower] += 1;
|
||||||
|
if (2 == counts[objectNameLower])
|
||||||
|
{
|
||||||
|
// TODO: emit warning about duplicate name?
|
||||||
|
}
|
||||||
|
si->second = objectName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -32,6 +32,9 @@ public:
|
||||||
const std::string& rawFlag);
|
const std::string& rawFlag);
|
||||||
virtual void Generate();
|
virtual void Generate();
|
||||||
virtual void GenerateInstallRules();
|
virtual void GenerateInstallRules();
|
||||||
|
virtual void ComputeObjectFilenames(
|
||||||
|
std::map<cmSourceFile const*, std::string>& mapping,
|
||||||
|
cmGeneratorTarget const* gt = 0);
|
||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -153,9 +153,9 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
|
||||||
|
|
||||||
// First generate the object rule files. Save a list of all object
|
// First generate the object rule files. Save a list of all object
|
||||||
// files for this target.
|
// files for this target.
|
||||||
std::vector<cmSourceFile*> customCommands;
|
std::vector<cmSourceFile const*> customCommands;
|
||||||
this->GeneratorTarget->GetCustomCommands(customCommands);
|
this->GeneratorTarget->GetCustomCommands(customCommands);
|
||||||
for(std::vector<cmSourceFile*>::const_iterator
|
for(std::vector<cmSourceFile const*>::const_iterator
|
||||||
si = customCommands.begin();
|
si = customCommands.begin();
|
||||||
si != customCommands.end(); ++si)
|
si != customCommands.end(); ++si)
|
||||||
{
|
{
|
||||||
|
@ -176,27 +176,27 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::vector<cmSourceFile*> headerSources;
|
std::vector<cmSourceFile const*> headerSources;
|
||||||
this->GeneratorTarget->GetHeaderSources(headerSources);
|
this->GeneratorTarget->GetHeaderSources(headerSources);
|
||||||
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
|
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
|
||||||
headerSources,
|
headerSources,
|
||||||
this->MacOSXContentGenerator);
|
this->MacOSXContentGenerator);
|
||||||
std::vector<cmSourceFile*> extraSources;
|
std::vector<cmSourceFile const*> extraSources;
|
||||||
this->GeneratorTarget->GetExtraSources(extraSources);
|
this->GeneratorTarget->GetExtraSources(extraSources);
|
||||||
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
|
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
|
||||||
extraSources,
|
extraSources,
|
||||||
this->MacOSXContentGenerator);
|
this->MacOSXContentGenerator);
|
||||||
std::vector<cmSourceFile*> externalObjects;
|
std::vector<cmSourceFile const*> externalObjects;
|
||||||
this->GeneratorTarget->GetExternalObjects(externalObjects);
|
this->GeneratorTarget->GetExternalObjects(externalObjects);
|
||||||
for(std::vector<cmSourceFile*>::const_iterator
|
for(std::vector<cmSourceFile const*>::const_iterator
|
||||||
si = externalObjects.begin();
|
si = externalObjects.begin();
|
||||||
si != externalObjects.end(); ++si)
|
si != externalObjects.end(); ++si)
|
||||||
{
|
{
|
||||||
this->ExternalObjects.push_back((*si)->GetFullPath());
|
this->ExternalObjects.push_back((*si)->GetFullPath());
|
||||||
}
|
}
|
||||||
std::vector<cmSourceFile*> objectSources;
|
std::vector<cmSourceFile const*> objectSources;
|
||||||
this->GeneratorTarget->GetObjectSources(objectSources);
|
this->GeneratorTarget->GetObjectSources(objectSources);
|
||||||
for(std::vector<cmSourceFile*>::const_iterator
|
for(std::vector<cmSourceFile const*>::const_iterator
|
||||||
si = objectSources.begin(); si != objectSources.end(); ++si)
|
si = objectSources.begin(); si != objectSources.end(); ++si)
|
||||||
{
|
{
|
||||||
// Generate this object file's rule file.
|
// Generate this object file's rule file.
|
||||||
|
@ -373,7 +373,7 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
void
|
||||||
cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()
|
cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()
|
||||||
(cmSourceFile& source, const char* pkgloc)
|
(cmSourceFile const& source, const char* pkgloc)
|
||||||
{
|
{
|
||||||
// Skip OS X content when not building a Framework or Bundle.
|
// Skip OS X content when not building a Framework or Bundle.
|
||||||
if(!this->Generator->GetTarget()->IsBundleOnApple())
|
if(!this->Generator->GetTarget()->IsBundleOnApple())
|
||||||
|
@ -423,7 +423,8 @@ cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source)
|
void cmMakefileTargetGenerator
|
||||||
|
::WriteObjectRuleFiles(cmSourceFile const& source)
|
||||||
{
|
{
|
||||||
// Identify the language of the source file.
|
// Identify the language of the source file.
|
||||||
const std::string& lang =
|
const std::string& lang =
|
||||||
|
@ -498,7 +499,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source)
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
void
|
||||||
cmMakefileTargetGenerator
|
cmMakefileTargetGenerator
|
||||||
::AppendFortranFormatFlags(std::string& flags, cmSourceFile& source)
|
::AppendFortranFormatFlags(std::string& flags, cmSourceFile const& source)
|
||||||
{
|
{
|
||||||
const char* srcfmt = source.GetProperty("Fortran_FORMAT");
|
const char* srcfmt = source.GetProperty("Fortran_FORMAT");
|
||||||
cmLocalGenerator::FortranFormat format =
|
cmLocalGenerator::FortranFormat format =
|
||||||
|
@ -529,7 +530,7 @@ void
|
||||||
cmMakefileTargetGenerator
|
cmMakefileTargetGenerator
|
||||||
::WriteObjectBuildFile(std::string &obj,
|
::WriteObjectBuildFile(std::string &obj,
|
||||||
const std::string& lang,
|
const std::string& lang,
|
||||||
cmSourceFile& source,
|
cmSourceFile const& source,
|
||||||
std::vector<std::string>& depends)
|
std::vector<std::string>& depends)
|
||||||
{
|
{
|
||||||
this->LocalGenerator->AppendRuleDepend(depends,
|
this->LocalGenerator->AppendRuleDepend(depends,
|
||||||
|
@ -1194,7 +1195,7 @@ cmMakefileTargetGenerator
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmMakefileTargetGenerator
|
void cmMakefileTargetGenerator
|
||||||
::WriteObjectDependRules(cmSourceFile& source,
|
::WriteObjectDependRules(cmSourceFile const& source,
|
||||||
std::vector<std::string>& depends)
|
std::vector<std::string>& depends)
|
||||||
{
|
{
|
||||||
// Create the list of dependencies known at cmake time. These are
|
// Create the list of dependencies known at cmake time. These are
|
||||||
|
|
|
@ -81,7 +81,7 @@ protected:
|
||||||
MacOSXContentGeneratorType(cmMakefileTargetGenerator* gen) :
|
MacOSXContentGeneratorType(cmMakefileTargetGenerator* gen) :
|
||||||
Generator(gen) {}
|
Generator(gen) {}
|
||||||
|
|
||||||
void operator()(cmSourceFile& source, const char* pkgloc);
|
void operator()(cmSourceFile const& source, const char* pkgloc);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cmMakefileTargetGenerator* Generator;
|
cmMakefileTargetGenerator* Generator;
|
||||||
|
@ -89,16 +89,16 @@ protected:
|
||||||
friend struct MacOSXContentGeneratorType;
|
friend struct MacOSXContentGeneratorType;
|
||||||
|
|
||||||
// write the rules for an object
|
// write the rules for an object
|
||||||
void WriteObjectRuleFiles(cmSourceFile& source);
|
void WriteObjectRuleFiles(cmSourceFile const& source);
|
||||||
|
|
||||||
// write the build rule for an object
|
// write the build rule for an object
|
||||||
void WriteObjectBuildFile(std::string &obj,
|
void WriteObjectBuildFile(std::string &obj,
|
||||||
const std::string& lang,
|
const std::string& lang,
|
||||||
cmSourceFile& source,
|
cmSourceFile const& source,
|
||||||
std::vector<std::string>& depends);
|
std::vector<std::string>& depends);
|
||||||
|
|
||||||
// write the depend.make file for an object
|
// write the depend.make file for an object
|
||||||
void WriteObjectDependRules(cmSourceFile& source,
|
void WriteObjectDependRules(cmSourceFile const& source,
|
||||||
std::vector<std::string>& depends);
|
std::vector<std::string>& depends);
|
||||||
|
|
||||||
// write the build rule for a custom command
|
// write the build rule for a custom command
|
||||||
|
@ -126,7 +126,8 @@ protected:
|
||||||
// Return the a string with -F flags on apple
|
// Return the a string with -F flags on apple
|
||||||
std::string GetFrameworkFlags(std::string const& l);
|
std::string GetFrameworkFlags(std::string const& l);
|
||||||
|
|
||||||
void AppendFortranFormatFlags(std::string& flags, cmSourceFile& source);
|
void AppendFortranFormatFlags(std::string& flags,
|
||||||
|
cmSourceFile const& source);
|
||||||
|
|
||||||
// append intertarget dependencies
|
// append intertarget dependencies
|
||||||
void AppendTargetDepends(std::vector<std::string>& depends);
|
void AppendTargetDepends(std::vector<std::string>& depends);
|
||||||
|
|
|
@ -126,7 +126,7 @@ void cmNinjaTargetGenerator::AddFeatureFlags(std::string& flags,
|
||||||
// void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
|
// void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
|
||||||
// Refactor it.
|
// Refactor it.
|
||||||
std::string
|
std::string
|
||||||
cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source,
|
cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source,
|
||||||
const std::string& language)
|
const std::string& language)
|
||||||
{
|
{
|
||||||
// TODO: Fortran support.
|
// TODO: Fortran support.
|
||||||
|
@ -211,7 +211,7 @@ bool cmNinjaTargetGenerator::needsDepFile(const std::string& lang)
|
||||||
// void cmMakefileTargetGenerator::WriteTargetLanguageFlags().
|
// void cmMakefileTargetGenerator::WriteTargetLanguageFlags().
|
||||||
std::string
|
std::string
|
||||||
cmNinjaTargetGenerator::
|
cmNinjaTargetGenerator::
|
||||||
ComputeDefines(cmSourceFile *source, const std::string& language)
|
ComputeDefines(cmSourceFile const* source, const std::string& language)
|
||||||
{
|
{
|
||||||
std::set<std::string> defines;
|
std::set<std::string> defines;
|
||||||
|
|
||||||
|
@ -269,14 +269,14 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
cmNinjaTargetGenerator
|
cmNinjaTargetGenerator
|
||||||
::GetSourceFilePath(cmSourceFile* source) const
|
::GetSourceFilePath(cmSourceFile const* source) const
|
||||||
{
|
{
|
||||||
return ConvertToNinjaPath(source->GetFullPath().c_str());
|
return ConvertToNinjaPath(source->GetFullPath().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
cmNinjaTargetGenerator
|
cmNinjaTargetGenerator
|
||||||
::GetObjectFilePath(cmSourceFile* source) const
|
::GetObjectFilePath(cmSourceFile const* source) const
|
||||||
{
|
{
|
||||||
std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
|
std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
|
||||||
if(!path.empty())
|
if(!path.empty())
|
||||||
|
@ -480,36 +480,36 @@ cmNinjaTargetGenerator
|
||||||
<< this->GetTargetName()
|
<< this->GetTargetName()
|
||||||
<< "\n\n";
|
<< "\n\n";
|
||||||
|
|
||||||
std::vector<cmSourceFile*> customCommands;
|
std::vector<cmSourceFile const*> customCommands;
|
||||||
this->GeneratorTarget->GetCustomCommands(customCommands);
|
this->GeneratorTarget->GetCustomCommands(customCommands);
|
||||||
for(std::vector<cmSourceFile*>::const_iterator
|
for(std::vector<cmSourceFile const*>::const_iterator
|
||||||
si = customCommands.begin();
|
si = customCommands.begin();
|
||||||
si != customCommands.end(); ++si)
|
si != customCommands.end(); ++si)
|
||||||
{
|
{
|
||||||
cmCustomCommand const* cc = (*si)->GetCustomCommand();
|
cmCustomCommand const* cc = (*si)->GetCustomCommand();
|
||||||
this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget());
|
this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget());
|
||||||
}
|
}
|
||||||
std::vector<cmSourceFile*> headerSources;
|
std::vector<cmSourceFile const*> headerSources;
|
||||||
this->GeneratorTarget->GetHeaderSources(headerSources);
|
this->GeneratorTarget->GetHeaderSources(headerSources);
|
||||||
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
|
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
|
||||||
headerSources,
|
headerSources,
|
||||||
this->MacOSXContentGenerator);
|
this->MacOSXContentGenerator);
|
||||||
std::vector<cmSourceFile*> extraSources;
|
std::vector<cmSourceFile const*> extraSources;
|
||||||
this->GeneratorTarget->GetExtraSources(extraSources);
|
this->GeneratorTarget->GetExtraSources(extraSources);
|
||||||
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
|
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
|
||||||
extraSources,
|
extraSources,
|
||||||
this->MacOSXContentGenerator);
|
this->MacOSXContentGenerator);
|
||||||
std::vector<cmSourceFile*> externalObjects;
|
std::vector<cmSourceFile const*> externalObjects;
|
||||||
this->GeneratorTarget->GetExternalObjects(externalObjects);
|
this->GeneratorTarget->GetExternalObjects(externalObjects);
|
||||||
for(std::vector<cmSourceFile*>::const_iterator
|
for(std::vector<cmSourceFile const*>::const_iterator
|
||||||
si = externalObjects.begin();
|
si = externalObjects.begin();
|
||||||
si != externalObjects.end(); ++si)
|
si != externalObjects.end(); ++si)
|
||||||
{
|
{
|
||||||
this->Objects.push_back(this->GetSourceFilePath(*si));
|
this->Objects.push_back(this->GetSourceFilePath(*si));
|
||||||
}
|
}
|
||||||
std::vector<cmSourceFile*> objectSources;
|
std::vector<cmSourceFile const*> objectSources;
|
||||||
this->GeneratorTarget->GetObjectSources(objectSources);
|
this->GeneratorTarget->GetObjectSources(objectSources);
|
||||||
for(std::vector<cmSourceFile*>::const_iterator
|
for(std::vector<cmSourceFile const*>::const_iterator
|
||||||
si = objectSources.begin(); si != objectSources.end(); ++si)
|
si = objectSources.begin(); si != objectSources.end(); ++si)
|
||||||
{
|
{
|
||||||
this->WriteObjectBuildStatement(*si);
|
this->WriteObjectBuildStatement(*si);
|
||||||
|
@ -536,7 +536,7 @@ cmNinjaTargetGenerator
|
||||||
|
|
||||||
void
|
void
|
||||||
cmNinjaTargetGenerator
|
cmNinjaTargetGenerator
|
||||||
::WriteObjectBuildStatement(cmSourceFile* source)
|
::WriteObjectBuildStatement(cmSourceFile const* source)
|
||||||
{
|
{
|
||||||
std::string comment;
|
std::string comment;
|
||||||
const std::string language = source->GetLanguage();
|
const std::string language = source->GetLanguage();
|
||||||
|
@ -570,9 +570,9 @@ cmNinjaTargetGenerator
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add order-only dependencies on custom command outputs.
|
// Add order-only dependencies on custom command outputs.
|
||||||
std::vector<cmSourceFile*> customCommands;
|
std::vector<cmSourceFile const*> customCommands;
|
||||||
this->GeneratorTarget->GetCustomCommands(customCommands);
|
this->GeneratorTarget->GetCustomCommands(customCommands);
|
||||||
for(std::vector<cmSourceFile*>::const_iterator
|
for(std::vector<cmSourceFile const*>::const_iterator
|
||||||
si = customCommands.begin();
|
si = customCommands.begin();
|
||||||
si != customCommands.end(); ++si)
|
si != customCommands.end(); ++si)
|
||||||
{
|
{
|
||||||
|
@ -733,7 +733,7 @@ cmNinjaTargetGenerator
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
void
|
||||||
cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()(
|
cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()(
|
||||||
cmSourceFile& source, const char* pkgloc)
|
cmSourceFile const& source, const char* pkgloc)
|
||||||
{
|
{
|
||||||
// Skip OS X content when not building a Framework or Bundle.
|
// Skip OS X content when not building a Framework or Bundle.
|
||||||
if(!this->Generator->GetTarget()->IsBundleOnApple())
|
if(!this->Generator->GetTarget()->IsBundleOnApple())
|
||||||
|
|
|
@ -79,10 +79,10 @@ protected:
|
||||||
* @note Generally it is the value of the variable whose name is computed
|
* @note Generally it is the value of the variable whose name is computed
|
||||||
* by LanguageFlagsVarName().
|
* by LanguageFlagsVarName().
|
||||||
*/
|
*/
|
||||||
std::string ComputeFlagsForObject(cmSourceFile *source,
|
std::string ComputeFlagsForObject(cmSourceFile const* source,
|
||||||
const std::string& language);
|
const std::string& language);
|
||||||
|
|
||||||
std::string ComputeDefines(cmSourceFile *source,
|
std::string ComputeDefines(cmSourceFile const* source,
|
||||||
const std::string& language);
|
const std::string& language);
|
||||||
|
|
||||||
std::string ConvertToNinjaPath(const char *path) const {
|
std::string ConvertToNinjaPath(const char *path) const {
|
||||||
|
@ -96,10 +96,10 @@ protected:
|
||||||
cmNinjaDeps ComputeLinkDeps() const;
|
cmNinjaDeps ComputeLinkDeps() const;
|
||||||
|
|
||||||
/// @return the source file path for the given @a source.
|
/// @return the source file path for the given @a source.
|
||||||
std::string GetSourceFilePath(cmSourceFile* source) const;
|
std::string GetSourceFilePath(cmSourceFile const* source) const;
|
||||||
|
|
||||||
/// @return the object file path for the given @a source.
|
/// @return the object file path for the given @a source.
|
||||||
std::string GetObjectFilePath(cmSourceFile* source) const;
|
std::string GetObjectFilePath(cmSourceFile const* source) const;
|
||||||
|
|
||||||
/// @return the file path where the target named @a name is generated.
|
/// @return the file path where the target named @a name is generated.
|
||||||
std::string GetTargetFilePath(const std::string& name) const;
|
std::string GetTargetFilePath(const std::string& name) const;
|
||||||
|
@ -110,7 +110,7 @@ protected:
|
||||||
void WriteLanguageRules(const std::string& language);
|
void WriteLanguageRules(const std::string& language);
|
||||||
void WriteCompileRule(const std::string& language);
|
void WriteCompileRule(const std::string& language);
|
||||||
void WriteObjectBuildStatements();
|
void WriteObjectBuildStatements();
|
||||||
void WriteObjectBuildStatement(cmSourceFile* source);
|
void WriteObjectBuildStatement(cmSourceFile const* source);
|
||||||
void WriteCustomCommandBuildStatement(cmCustomCommand *cc);
|
void WriteCustomCommandBuildStatement(cmCustomCommand *cc);
|
||||||
|
|
||||||
cmNinjaDeps GetObjects() const
|
cmNinjaDeps GetObjects() const
|
||||||
|
@ -129,7 +129,7 @@ protected:
|
||||||
MacOSXContentGeneratorType(cmNinjaTargetGenerator* g) :
|
MacOSXContentGeneratorType(cmNinjaTargetGenerator* g) :
|
||||||
Generator(g) {}
|
Generator(g) {}
|
||||||
|
|
||||||
void operator()(cmSourceFile& source, const char* pkgloc);
|
void operator()(cmSourceFile const& source, const char* pkgloc);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cmNinjaTargetGenerator* Generator;
|
cmNinjaTargetGenerator* Generator;
|
||||||
|
|
|
@ -190,13 +190,14 @@ void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName,
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
void
|
||||||
cmOSXBundleGenerator::
|
cmOSXBundleGenerator::
|
||||||
GenerateMacOSXContentStatements(std::vector<cmSourceFile*> const& sources,
|
GenerateMacOSXContentStatements(
|
||||||
|
std::vector<cmSourceFile const*> const& sources,
|
||||||
MacOSXContentGeneratorType* generator)
|
MacOSXContentGeneratorType* generator)
|
||||||
{
|
{
|
||||||
if (this->MustSkip())
|
if (this->MustSkip())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(std::vector<cmSourceFile*>::const_iterator
|
for(std::vector<cmSourceFile const*>::const_iterator
|
||||||
si = sources.begin(); si != sources.end(); ++si)
|
si = sources.begin(); si != sources.end(); ++si)
|
||||||
{
|
{
|
||||||
cmGeneratorTarget::SourceFileFlags tsFlags =
|
cmGeneratorTarget::SourceFileFlags tsFlags =
|
||||||
|
|
|
@ -44,11 +44,12 @@ public:
|
||||||
struct MacOSXContentGeneratorType
|
struct MacOSXContentGeneratorType
|
||||||
{
|
{
|
||||||
virtual ~MacOSXContentGeneratorType() {}
|
virtual ~MacOSXContentGeneratorType() {}
|
||||||
virtual void operator()(cmSourceFile& source, const char* pkgloc) = 0;
|
virtual void operator()(cmSourceFile const& source,
|
||||||
|
const char* pkgloc) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
void GenerateMacOSXContentStatements(
|
void GenerateMacOSXContentStatements(
|
||||||
std::vector<cmSourceFile*> const& sources,
|
std::vector<cmSourceFile const*> const& sources,
|
||||||
MacOSXContentGeneratorType* generator);
|
MacOSXContentGeneratorType* generator);
|
||||||
std::string InitMacOSXContentDirectory(const char* pkgloc);
|
std::string InitMacOSXContentDirectory(const char* pkgloc);
|
||||||
|
|
||||||
|
|
|
@ -378,12 +378,12 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences()
|
||||||
|
|
||||||
void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup()
|
void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup()
|
||||||
{
|
{
|
||||||
std::vector<cmSourceFile*> resxObjs;
|
std::vector<cmSourceFile const*> resxObjs;
|
||||||
this->GeneratorTarget->GetResxSources(resxObjs);
|
this->GeneratorTarget->GetResxSources(resxObjs);
|
||||||
if(!resxObjs.empty())
|
if(!resxObjs.empty())
|
||||||
{
|
{
|
||||||
this->WriteString("<ItemGroup>\n", 1);
|
this->WriteString("<ItemGroup>\n", 1);
|
||||||
for(std::vector<cmSourceFile*>::const_iterator oi = resxObjs.begin();
|
for(std::vector<cmSourceFile const*>::const_iterator oi = resxObjs.begin();
|
||||||
oi != resxObjs.end(); ++oi)
|
oi != resxObjs.end(); ++oi)
|
||||||
{
|
{
|
||||||
std::string obj = (*oi)->GetFullPath();
|
std::string obj = (*oi)->GetFullPath();
|
||||||
|
@ -552,9 +552,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
|
||||||
void cmVisualStudio10TargetGenerator::WriteCustomCommands()
|
void cmVisualStudio10TargetGenerator::WriteCustomCommands()
|
||||||
{
|
{
|
||||||
this->SourcesVisited.clear();
|
this->SourcesVisited.clear();
|
||||||
std::vector<cmSourceFile*> customCommands;
|
std::vector<cmSourceFile const*> customCommands;
|
||||||
this->GeneratorTarget->GetCustomCommands(customCommands);
|
this->GeneratorTarget->GetCustomCommands(customCommands);
|
||||||
for(std::vector<cmSourceFile*>::const_iterator
|
for(std::vector<cmSourceFile const*>::const_iterator
|
||||||
si = customCommands.begin();
|
si = customCommands.begin();
|
||||||
si != customCommands.end(); ++si)
|
si != customCommands.end(); ++si)
|
||||||
{
|
{
|
||||||
|
@ -563,7 +563,8 @@ void cmVisualStudio10TargetGenerator::WriteCustomCommands()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmVisualStudio10TargetGenerator::WriteCustomCommand(cmSourceFile* sf)
|
void cmVisualStudio10TargetGenerator
|
||||||
|
::WriteCustomCommand(cmSourceFile const* sf)
|
||||||
{
|
{
|
||||||
if(this->SourcesVisited.insert(sf).second)
|
if(this->SourcesVisited.insert(sf).second)
|
||||||
{
|
{
|
||||||
|
@ -586,7 +587,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomCommand(cmSourceFile* sf)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
|
cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile const* source,
|
||||||
cmCustomCommand const &
|
cmCustomCommand const &
|
||||||
command)
|
command)
|
||||||
{
|
{
|
||||||
|
@ -747,12 +748,12 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
|
||||||
this->WriteGroupSources(ti->first.c_str(), ti->second, sourceGroups);
|
this->WriteGroupSources(ti->first.c_str(), ti->second, sourceGroups);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<cmSourceFile*> resxObjs;
|
std::vector<cmSourceFile const*> resxObjs;
|
||||||
this->GeneratorTarget->GetResxSources(resxObjs);
|
this->GeneratorTarget->GetResxSources(resxObjs);
|
||||||
if(!resxObjs.empty())
|
if(!resxObjs.empty())
|
||||||
{
|
{
|
||||||
this->WriteString("<ItemGroup>\n", 1);
|
this->WriteString("<ItemGroup>\n", 1);
|
||||||
for(std::vector<cmSourceFile*>::const_iterator oi = resxObjs.begin();
|
for(std::vector<cmSourceFile const*>::const_iterator oi = resxObjs.begin();
|
||||||
oi != resxObjs.end(); ++oi)
|
oi != resxObjs.end(); ++oi)
|
||||||
{
|
{
|
||||||
std::string obj = (*oi)->GetFullPath();
|
std::string obj = (*oi)->GetFullPath();
|
||||||
|
@ -903,7 +904,7 @@ WriteGroupSources(const char* name,
|
||||||
for(ToolSources::const_iterator s = sources.begin();
|
for(ToolSources::const_iterator s = sources.begin();
|
||||||
s != sources.end(); ++s)
|
s != sources.end(); ++s)
|
||||||
{
|
{
|
||||||
cmSourceFile* sf = s->SourceFile;
|
cmSourceFile const* sf = s->SourceFile;
|
||||||
std::string const& source = sf->GetFullPath();
|
std::string const& source = sf->GetFullPath();
|
||||||
cmSourceGroup* sourceGroup =
|
cmSourceGroup* sourceGroup =
|
||||||
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
|
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
|
||||||
|
@ -930,7 +931,7 @@ WriteGroupSources(const char* name,
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmVisualStudio10TargetGenerator::WriteSource(
|
void cmVisualStudio10TargetGenerator::WriteSource(
|
||||||
const char* tool, cmSourceFile* sf, const char* end)
|
const char* tool, cmSourceFile const* sf, const char* end)
|
||||||
{
|
{
|
||||||
// Visual Studio tools append relative paths to the current dir, as in:
|
// Visual Studio tools append relative paths to the current dir, as in:
|
||||||
//
|
//
|
||||||
|
@ -986,9 +987,9 @@ void cmVisualStudio10TargetGenerator::WriteSource(
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmVisualStudio10TargetGenerator::WriteSources(
|
void cmVisualStudio10TargetGenerator::WriteSources(
|
||||||
const char* tool, std::vector<cmSourceFile*> const& sources)
|
const char* tool, std::vector<cmSourceFile const*> const& sources)
|
||||||
{
|
{
|
||||||
for(std::vector<cmSourceFile*>::const_iterator
|
for(std::vector<cmSourceFile const*>::const_iterator
|
||||||
si = sources.begin(); si != sources.end(); ++si)
|
si = sources.begin(); si != sources.end(); ++si)
|
||||||
{
|
{
|
||||||
this->WriteSource(tool, *si);
|
this->WriteSource(tool, *si);
|
||||||
|
@ -1003,16 +1004,16 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
|
||||||
}
|
}
|
||||||
this->WriteString("<ItemGroup>\n", 1);
|
this->WriteString("<ItemGroup>\n", 1);
|
||||||
|
|
||||||
std::vector<cmSourceFile*> headerSources;
|
std::vector<cmSourceFile const*> headerSources;
|
||||||
this->GeneratorTarget->GetHeaderSources(headerSources);
|
this->GeneratorTarget->GetHeaderSources(headerSources);
|
||||||
this->WriteSources("ClInclude", headerSources);
|
this->WriteSources("ClInclude", headerSources);
|
||||||
std::vector<cmSourceFile*> idlSources;
|
std::vector<cmSourceFile const*> idlSources;
|
||||||
this->GeneratorTarget->GetIDLSources(idlSources);
|
this->GeneratorTarget->GetIDLSources(idlSources);
|
||||||
this->WriteSources("Midl", idlSources);
|
this->WriteSources("Midl", idlSources);
|
||||||
|
|
||||||
std::vector<cmSourceFile*> objectSources;
|
std::vector<cmSourceFile const*> objectSources;
|
||||||
this->GeneratorTarget->GetObjectSources(objectSources);
|
this->GeneratorTarget->GetObjectSources(objectSources);
|
||||||
for(std::vector<cmSourceFile*>::const_iterator
|
for(std::vector<cmSourceFile const*>::const_iterator
|
||||||
si = objectSources.begin();
|
si = objectSources.begin();
|
||||||
si != objectSources.end(); ++si)
|
si != objectSources.end(); ++si)
|
||||||
{
|
{
|
||||||
|
@ -1051,7 +1052,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<cmSourceFile*> externalObjects;
|
std::vector<cmSourceFile const*> externalObjects;
|
||||||
this->GeneratorTarget->GetExternalObjects(externalObjects);
|
this->GeneratorTarget->GetExternalObjects(externalObjects);
|
||||||
if(this->LocalGenerator->GetVersion() > cmLocalVisualStudioGenerator::VS10)
|
if(this->LocalGenerator->GetVersion() > cmLocalVisualStudioGenerator::VS10)
|
||||||
{
|
{
|
||||||
|
@ -1063,7 +1064,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
|
||||||
{
|
{
|
||||||
// If an object file is generated in this target, then vs10 will use
|
// If an object file is generated in this target, then vs10 will use
|
||||||
// it in the build, and we have to list it as None instead of Object.
|
// it in the build, and we have to list it as None instead of Object.
|
||||||
for(std::vector<cmSourceFile*>::const_iterator
|
for(std::vector<cmSourceFile const*>::const_iterator
|
||||||
si = externalObjects.begin();
|
si = externalObjects.begin();
|
||||||
si != externalObjects.end(); ++si)
|
si != externalObjects.end(); ++si)
|
||||||
{
|
{
|
||||||
|
@ -1073,7 +1074,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<cmSourceFile*> extraSources;
|
std::vector<cmSourceFile const*> extraSources;
|
||||||
this->GeneratorTarget->GetExtraSources(extraSources);
|
this->GeneratorTarget->GetExtraSources(extraSources);
|
||||||
this->WriteSources("None", extraSources);
|
this->WriteSources("None", extraSources);
|
||||||
|
|
||||||
|
@ -1093,9 +1094,9 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
|
bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
|
||||||
cmSourceFile* source)
|
cmSourceFile const* source)
|
||||||
{
|
{
|
||||||
cmSourceFile& sf = *source;
|
cmSourceFile const& sf = *source;
|
||||||
|
|
||||||
std::string objectName;
|
std::string objectName;
|
||||||
if(this->GeneratorTarget->HasExplicitObjectName(&sf))
|
if(this->GeneratorTarget->HasExplicitObjectName(&sf))
|
||||||
|
|
|
@ -45,7 +45,7 @@ public:
|
||||||
private:
|
private:
|
||||||
struct ToolSource
|
struct ToolSource
|
||||||
{
|
{
|
||||||
cmSourceFile* SourceFile;
|
cmSourceFile const* SourceFile;
|
||||||
bool RelativePath;
|
bool RelativePath;
|
||||||
};
|
};
|
||||||
struct ToolSources: public std::vector<ToolSource> {};
|
struct ToolSources: public std::vector<ToolSource> {};
|
||||||
|
@ -55,8 +55,10 @@ private:
|
||||||
void WriteString(const char* line, int indentLevel);
|
void WriteString(const char* line, int indentLevel);
|
||||||
void WriteProjectConfigurations();
|
void WriteProjectConfigurations();
|
||||||
void WriteProjectConfigurationValues();
|
void WriteProjectConfigurationValues();
|
||||||
void WriteSource(const char* tool, cmSourceFile* sf, const char* end = 0);
|
void WriteSource(const char* tool, cmSourceFile const* sf,
|
||||||
void WriteSources(const char* tool, std::vector<cmSourceFile*> const&);
|
const char* end = 0);
|
||||||
|
void WriteSources(const char* tool,
|
||||||
|
std::vector<cmSourceFile const*> const&);
|
||||||
void WriteAllSources();
|
void WriteAllSources();
|
||||||
void WriteDotNetReferences();
|
void WriteDotNetReferences();
|
||||||
void WriteEmbeddedResourceGroup();
|
void WriteEmbeddedResourceGroup();
|
||||||
|
@ -77,13 +79,13 @@ private:
|
||||||
std::vector<std::string> const & includes);
|
std::vector<std::string> const & includes);
|
||||||
void OutputIncludes(std::vector<std::string> const & includes);
|
void OutputIncludes(std::vector<std::string> const & includes);
|
||||||
void OutputLinkIncremental(std::string const& configName);
|
void OutputLinkIncremental(std::string const& configName);
|
||||||
void WriteCustomRule(cmSourceFile* source,
|
void WriteCustomRule(cmSourceFile const* source,
|
||||||
cmCustomCommand const & command);
|
cmCustomCommand const & command);
|
||||||
void WriteCustomCommands();
|
void WriteCustomCommands();
|
||||||
void WriteCustomCommand(cmSourceFile* sf);
|
void WriteCustomCommand(cmSourceFile const* sf);
|
||||||
void WriteGroups();
|
void WriteGroups();
|
||||||
void WriteProjectReferences();
|
void WriteProjectReferences();
|
||||||
bool OutputSourceSpecificFlags(cmSourceFile* source);
|
bool OutputSourceSpecificFlags(cmSourceFile const* source);
|
||||||
void AddLibraries(cmComputeLinkInformation& cli, std::string& libstring);
|
void AddLibraries(cmComputeLinkInformation& cli, std::string& libstring);
|
||||||
void WriteLibOptions(std::string const& config);
|
void WriteLibOptions(std::string const& config);
|
||||||
void WriteEvents(std::string const& configName);
|
void WriteEvents(std::string const& configName);
|
||||||
|
@ -111,7 +113,7 @@ private:
|
||||||
cmGlobalVisualStudio10Generator* GlobalGenerator;
|
cmGlobalVisualStudio10Generator* GlobalGenerator;
|
||||||
cmGeneratedFileStream* BuildFileStream;
|
cmGeneratedFileStream* BuildFileStream;
|
||||||
cmLocalVisualStudio7Generator* LocalGenerator;
|
cmLocalVisualStudio7Generator* LocalGenerator;
|
||||||
std::set<cmSourceFile*> SourcesVisited;
|
std::set<cmSourceFile const*> SourcesVisited;
|
||||||
|
|
||||||
typedef std::map<std::string, ToolSources> ToolSourceMap;
|
typedef std::map<std::string, ToolSources> ToolSourceMap;
|
||||||
ToolSourceMap Tools;
|
ToolSourceMap Tools;
|
||||||
|
|
Loading…
Reference in New Issue