cmTarget: Move SourceFileFlags to cmGeneratorTarget.
This commit is contained in:
parent
44e784342d
commit
84e5f5a004
@ -25,7 +25,8 @@
|
|||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
|
cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t),
|
||||||
|
SourceFileFlagsConstructed(false)
|
||||||
{
|
{
|
||||||
this->Makefile = this->Target->GetMakefile();
|
this->Makefile = this->Target->GetMakefile();
|
||||||
this->LocalGenerator = this->Makefile->GetLocalGenerator();
|
this->LocalGenerator = this->Makefile->GetLocalGenerator();
|
||||||
@ -876,3 +877,106 @@ bool cmStrictTargetComparison::operator()(cmTarget const* t1,
|
|||||||
}
|
}
|
||||||
return nameResult < 0;
|
return nameResult < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
struct cmGeneratorTarget::SourceFileFlags
|
||||||
|
cmGeneratorTarget::GetTargetSourceFileFlags(const cmSourceFile* sf) const
|
||||||
|
{
|
||||||
|
struct SourceFileFlags flags;
|
||||||
|
this->ConstructSourceFileFlags();
|
||||||
|
std::map<cmSourceFile const*, SourceFileFlags>::iterator si =
|
||||||
|
this->SourceFlagsMap.find(sf);
|
||||||
|
if(si != this->SourceFlagsMap.end())
|
||||||
|
{
|
||||||
|
flags = si->second;
|
||||||
|
}
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmGeneratorTarget::ConstructSourceFileFlags() const
|
||||||
|
{
|
||||||
|
if(this->SourceFileFlagsConstructed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this->SourceFileFlagsConstructed = true;
|
||||||
|
|
||||||
|
// Process public headers to mark the source files.
|
||||||
|
if(const char* files = this->Target->GetProperty("PUBLIC_HEADER"))
|
||||||
|
{
|
||||||
|
std::vector<std::string> relFiles;
|
||||||
|
cmSystemTools::ExpandListArgument(files, relFiles);
|
||||||
|
for(std::vector<std::string>::iterator it = relFiles.begin();
|
||||||
|
it != relFiles.end(); ++it)
|
||||||
|
{
|
||||||
|
if(cmSourceFile* sf = this->Makefile->GetSource(it->c_str()))
|
||||||
|
{
|
||||||
|
SourceFileFlags& flags = this->SourceFlagsMap[sf];
|
||||||
|
flags.MacFolder = "Headers";
|
||||||
|
flags.Type = cmGeneratorTarget::SourceFileTypePublicHeader;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process private headers after public headers so that they take
|
||||||
|
// precedence if a file is listed in both.
|
||||||
|
if(const char* files = this->Target->GetProperty("PRIVATE_HEADER"))
|
||||||
|
{
|
||||||
|
std::vector<std::string> relFiles;
|
||||||
|
cmSystemTools::ExpandListArgument(files, relFiles);
|
||||||
|
for(std::vector<std::string>::iterator it = relFiles.begin();
|
||||||
|
it != relFiles.end(); ++it)
|
||||||
|
{
|
||||||
|
if(cmSourceFile* sf = this->Makefile->GetSource(it->c_str()))
|
||||||
|
{
|
||||||
|
SourceFileFlags& flags = this->SourceFlagsMap[sf];
|
||||||
|
flags.MacFolder = "PrivateHeaders";
|
||||||
|
flags.Type = cmGeneratorTarget::SourceFileTypePrivateHeader;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mark sources listed as resources.
|
||||||
|
if(const char* files = this->Target->GetProperty("RESOURCE"))
|
||||||
|
{
|
||||||
|
std::vector<std::string> relFiles;
|
||||||
|
cmSystemTools::ExpandListArgument(files, relFiles);
|
||||||
|
for(std::vector<std::string>::iterator it = relFiles.begin();
|
||||||
|
it != relFiles.end(); ++it)
|
||||||
|
{
|
||||||
|
if(cmSourceFile* sf = this->Makefile->GetSource(it->c_str()))
|
||||||
|
{
|
||||||
|
SourceFileFlags& flags = this->SourceFlagsMap[sf];
|
||||||
|
flags.MacFolder = "Resources";
|
||||||
|
flags.Type = cmGeneratorTarget::SourceFileTypeResource;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle the MACOSX_PACKAGE_LOCATION property on source files that
|
||||||
|
// were not listed in one of the other lists.
|
||||||
|
std::vector<cmSourceFile*> sources;
|
||||||
|
this->GetSourceFiles(sources);
|
||||||
|
for(std::vector<cmSourceFile*>::const_iterator si = sources.begin();
|
||||||
|
si != sources.end(); ++si)
|
||||||
|
{
|
||||||
|
cmSourceFile* sf = *si;
|
||||||
|
if(const char* location = sf->GetProperty("MACOSX_PACKAGE_LOCATION"))
|
||||||
|
{
|
||||||
|
SourceFileFlags& flags = this->SourceFlagsMap[sf];
|
||||||
|
if(flags.Type == cmGeneratorTarget::SourceFileTypeNormal)
|
||||||
|
{
|
||||||
|
flags.MacFolder = location;
|
||||||
|
if(strcmp(location, "Resources") == 0)
|
||||||
|
{
|
||||||
|
flags.Type = cmGeneratorTarget::SourceFileTypeResource;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flags.Type = cmGeneratorTarget::SourceFileTypeMacContent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -88,6 +88,31 @@ public:
|
|||||||
/** 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* sf) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flags for a given source file as used in this target. Typically assigned
|
||||||
|
* via SET_TARGET_PROPERTIES when the property is a list of source files.
|
||||||
|
*/
|
||||||
|
enum SourceFileType
|
||||||
|
{
|
||||||
|
SourceFileTypeNormal,
|
||||||
|
SourceFileTypePrivateHeader, // is in "PRIVATE_HEADER" target property
|
||||||
|
SourceFileTypePublicHeader, // is in "PUBLIC_HEADER" target property
|
||||||
|
SourceFileTypeResource, // is in "RESOURCE" target property *or*
|
||||||
|
// has MACOSX_PACKAGE_LOCATION=="Resources"
|
||||||
|
SourceFileTypeMacContent // has MACOSX_PACKAGE_LOCATION!="Resources"
|
||||||
|
};
|
||||||
|
struct SourceFileFlags
|
||||||
|
{
|
||||||
|
SourceFileFlags(): Type(SourceFileTypeNormal), MacFolder(0) {}
|
||||||
|
SourceFileFlags(SourceFileFlags const& r):
|
||||||
|
Type(r.Type), MacFolder(r.MacFolder) {}
|
||||||
|
SourceFileType Type;
|
||||||
|
const char* MacFolder; // location inside Mac content folders
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SourceFileFlags
|
||||||
|
GetTargetSourceFileFlags(const cmSourceFile* sf) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class cmTargetTraceDependencies;
|
friend class cmTargetTraceDependencies;
|
||||||
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
|
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
|
||||||
@ -107,6 +132,10 @@ private:
|
|||||||
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;
|
||||||
|
|
||||||
|
void ConstructSourceFileFlags() const;
|
||||||
|
mutable bool SourceFileFlagsConstructed;
|
||||||
|
mutable std::map<cmSourceFile const*, SourceFileFlags> SourceFlagsMap;
|
||||||
|
|
||||||
cmGeneratorTarget(cmGeneratorTarget const&);
|
cmGeneratorTarget(cmGeneratorTarget const&);
|
||||||
void operator=(cmGeneratorTarget const&);
|
void operator=(cmGeneratorTarget const&);
|
||||||
};
|
};
|
||||||
|
@ -713,22 +713,23 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
|
|||||||
|
|
||||||
// Is this a resource file in this target? Add it to the resources group...
|
// Is this a resource file in this target? Add it to the resources group...
|
||||||
//
|
//
|
||||||
cmTarget::SourceFileFlags tsFlags = cmtarget.GetTargetSourceFileFlags(sf);
|
cmGeneratorTarget::SourceFileFlags tsFlags =
|
||||||
bool isResource = (tsFlags.Type == cmTarget::SourceFileTypeResource);
|
this->GetGeneratorTarget(&cmtarget)->GetTargetSourceFileFlags(sf);
|
||||||
|
bool isResource = tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource;
|
||||||
|
|
||||||
// Is this a "private" or "public" framework header file?
|
// Is this a "private" or "public" framework header file?
|
||||||
// Set the ATTRIBUTES attribute appropriately...
|
// Set the ATTRIBUTES attribute appropriately...
|
||||||
//
|
//
|
||||||
if(cmtarget.IsFrameworkOnApple())
|
if(cmtarget.IsFrameworkOnApple())
|
||||||
{
|
{
|
||||||
if(tsFlags.Type == cmTarget::SourceFileTypePrivateHeader)
|
if(tsFlags.Type == cmGeneratorTarget::SourceFileTypePrivateHeader)
|
||||||
{
|
{
|
||||||
cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
||||||
attrs->AddObject(this->CreateString("Private"));
|
attrs->AddObject(this->CreateString("Private"));
|
||||||
settings->AddAttribute("ATTRIBUTES", attrs);
|
settings->AddAttribute("ATTRIBUTES", attrs);
|
||||||
isResource = true;
|
isResource = true;
|
||||||
}
|
}
|
||||||
else if(tsFlags.Type == cmTarget::SourceFileTypePublicHeader)
|
else if(tsFlags.Type == cmGeneratorTarget::SourceFileTypePublicHeader)
|
||||||
{
|
{
|
||||||
cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
||||||
attrs->AddObject(this->CreateString("Public"));
|
attrs->AddObject(this->CreateString("Public"));
|
||||||
@ -973,6 +974,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
|
|||||||
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
|
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
|
||||||
{
|
{
|
||||||
cmTarget& cmtarget = l->second;
|
cmTarget& cmtarget = l->second;
|
||||||
|
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
|
||||||
|
|
||||||
// make sure ALL_BUILD, INSTALL, etc are only done once
|
// make sure ALL_BUILD, INSTALL, etc are only done once
|
||||||
if(this->SpecialTargetEmitted(l->first.c_str()))
|
if(this->SpecialTargetEmitted(l->first.c_str()))
|
||||||
@ -1011,8 +1013,8 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
|
|||||||
cmXCodeObject* filetype =
|
cmXCodeObject* filetype =
|
||||||
fr->GetObject()->GetObject("explicitFileType");
|
fr->GetObject()->GetObject("explicitFileType");
|
||||||
|
|
||||||
cmTarget::SourceFileFlags tsFlags =
|
cmGeneratorTarget::SourceFileFlags tsFlags =
|
||||||
cmtarget.GetTargetSourceFileFlags(*i);
|
gtgt->GetTargetSourceFileFlags(*i);
|
||||||
|
|
||||||
if(filetype &&
|
if(filetype &&
|
||||||
strcmp(filetype->GetString(), "compiled.mach-o.objfile") == 0)
|
strcmp(filetype->GetString(), "compiled.mach-o.objfile") == 0)
|
||||||
@ -1020,12 +1022,12 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
|
|||||||
externalObjFiles.push_back(xsf);
|
externalObjFiles.push_back(xsf);
|
||||||
}
|
}
|
||||||
else if(this->IsHeaderFile(*i) ||
|
else if(this->IsHeaderFile(*i) ||
|
||||||
(tsFlags.Type == cmTarget::SourceFileTypePrivateHeader) ||
|
(tsFlags.Type == cmGeneratorTarget::SourceFileTypePrivateHeader) ||
|
||||||
(tsFlags.Type == cmTarget::SourceFileTypePublicHeader))
|
(tsFlags.Type == cmGeneratorTarget::SourceFileTypePublicHeader))
|
||||||
{
|
{
|
||||||
headerFiles.push_back(xsf);
|
headerFiles.push_back(xsf);
|
||||||
}
|
}
|
||||||
else if(tsFlags.Type == cmTarget::SourceFileTypeResource)
|
else if(tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource)
|
||||||
{
|
{
|
||||||
resourceFiles.push_back(xsf);
|
resourceFiles.push_back(xsf);
|
||||||
}
|
}
|
||||||
@ -1048,7 +1050,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
|
|||||||
// the externalObjFiles above, except each one is not a cmSourceFile
|
// the externalObjFiles above, except each one is not a cmSourceFile
|
||||||
// within the target.)
|
// within the target.)
|
||||||
std::vector<std::string> objs;
|
std::vector<std::string> objs;
|
||||||
this->GetGeneratorTarget(&cmtarget)->UseObjectLibraries(objs);
|
gtgt->UseObjectLibraries(objs);
|
||||||
for(std::vector<std::string>::const_iterator
|
for(std::vector<std::string>::const_iterator
|
||||||
oi = objs.begin(); oi != objs.end(); ++oi)
|
oi = objs.begin(); oi != objs.end(); ++oi)
|
||||||
{
|
{
|
||||||
@ -1138,9 +1140,9 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
|
|||||||
for(std::vector<cmSourceFile*>::const_iterator i = classes.begin();
|
for(std::vector<cmSourceFile*>::const_iterator i = classes.begin();
|
||||||
i != classes.end(); ++i)
|
i != classes.end(); ++i)
|
||||||
{
|
{
|
||||||
cmTarget::SourceFileFlags tsFlags =
|
cmGeneratorTarget::SourceFileFlags tsFlags =
|
||||||
cmtarget.GetTargetSourceFileFlags(*i);
|
gtgt->GetTargetSourceFileFlags(*i);
|
||||||
if(tsFlags.Type == cmTarget::SourceFileTypeMacContent)
|
if(tsFlags.Type == cmGeneratorTarget::SourceFileTypeMacContent)
|
||||||
{
|
{
|
||||||
bundleFiles[tsFlags.MacFolder].push_back(*i);
|
bundleFiles[tsFlags.MacFolder].push_back(*i);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
cmOSXBundleGenerator::
|
cmOSXBundleGenerator::
|
||||||
cmOSXBundleGenerator(cmGeneratorTarget* target,
|
cmOSXBundleGenerator(cmGeneratorTarget* target,
|
||||||
const char* configName)
|
const char* configName)
|
||||||
: Target(target->Target)
|
: GT(target)
|
||||||
, Makefile(target->Target->GetMakefile())
|
, Makefile(target->Target->GetMakefile())
|
||||||
, LocalGenerator(Makefile->GetLocalGenerator())
|
, LocalGenerator(Makefile->GetLocalGenerator())
|
||||||
, ConfigName(configName)
|
, ConfigName(configName)
|
||||||
@ -34,7 +34,7 @@ cmOSXBundleGenerator(cmGeneratorTarget* target,
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmOSXBundleGenerator::MustSkip()
|
bool cmOSXBundleGenerator::MustSkip()
|
||||||
{
|
{
|
||||||
return !this->Target->HaveWellDefinedOutputFiles();
|
return !this->GT->Target->HaveWellDefinedOutputFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@ -47,7 +47,7 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
|
|||||||
// Compute bundle directory names.
|
// Compute bundle directory names.
|
||||||
std::string out = outpath;
|
std::string out = outpath;
|
||||||
out += "/";
|
out += "/";
|
||||||
out += this->Target->GetAppBundleDirectory(this->ConfigName, false);
|
out += this->GT->Target->GetAppBundleDirectory(this->ConfigName, false);
|
||||||
cmSystemTools::MakeDirectory(out.c_str());
|
cmSystemTools::MakeDirectory(out.c_str());
|
||||||
this->Makefile->AddCMakeOutputFile(out);
|
this->Makefile->AddCMakeOutputFile(out);
|
||||||
|
|
||||||
@ -57,9 +57,9 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
|
|||||||
// to be set.
|
// to be set.
|
||||||
std::string plist = outpath;
|
std::string plist = outpath;
|
||||||
plist += "/";
|
plist += "/";
|
||||||
plist += this->Target->GetAppBundleDirectory(this->ConfigName, true);
|
plist += this->GT->Target->GetAppBundleDirectory(this->ConfigName, true);
|
||||||
plist += "/Info.plist";
|
plist += "/Info.plist";
|
||||||
this->LocalGenerator->GenerateAppleInfoPList(this->Target,
|
this->LocalGenerator->GenerateAppleInfoPList(this->GT->Target,
|
||||||
targetName.c_str(),
|
targetName.c_str(),
|
||||||
plist.c_str());
|
plist.c_str());
|
||||||
this->Makefile->AddCMakeOutputFile(plist);
|
this->Makefile->AddCMakeOutputFile(plist);
|
||||||
@ -77,20 +77,20 @@ void cmOSXBundleGenerator::CreateFramework(
|
|||||||
|
|
||||||
// Compute the location of the top-level foo.framework directory.
|
// Compute the location of the top-level foo.framework directory.
|
||||||
std::string contentdir = outpath + "/" +
|
std::string contentdir = outpath + "/" +
|
||||||
this->Target->GetFrameworkDirectory(this->ConfigName, true);
|
this->GT->Target->GetFrameworkDirectory(this->ConfigName, true);
|
||||||
contentdir += "/";
|
contentdir += "/";
|
||||||
|
|
||||||
std::string newoutpath = outpath + "/" +
|
std::string newoutpath = outpath + "/" +
|
||||||
this->Target->GetFrameworkDirectory(this->ConfigName, false);
|
this->GT->Target->GetFrameworkDirectory(this->ConfigName, false);
|
||||||
|
|
||||||
std::string frameworkVersion = this->Target->GetFrameworkVersion();
|
std::string frameworkVersion = this->GT->Target->GetFrameworkVersion();
|
||||||
|
|
||||||
// Configure the Info.plist file into the Resources directory.
|
// Configure the Info.plist file into the Resources directory.
|
||||||
this->MacContentFolders->insert("Resources");
|
this->MacContentFolders->insert("Resources");
|
||||||
std::string plist = newoutpath;
|
std::string plist = newoutpath;
|
||||||
plist += "/Resources/Info.plist";
|
plist += "/Resources/Info.plist";
|
||||||
std::string name = cmSystemTools::GetFilenameName(targetName);
|
std::string name = cmSystemTools::GetFilenameName(targetName);
|
||||||
this->LocalGenerator->GenerateFrameworkInfoPList(this->Target,
|
this->LocalGenerator->GenerateFrameworkInfoPList(this->GT->Target,
|
||||||
name.c_str(),
|
name.c_str(),
|
||||||
plist.c_str());
|
plist.c_str());
|
||||||
|
|
||||||
@ -172,16 +172,16 @@ void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName,
|
|||||||
// Compute bundle directory names.
|
// Compute bundle directory names.
|
||||||
std::string out = root;
|
std::string out = root;
|
||||||
out += "/";
|
out += "/";
|
||||||
out += this->Target->GetCFBundleDirectory(this->ConfigName, false);
|
out += this->GT->Target->GetCFBundleDirectory(this->ConfigName, false);
|
||||||
cmSystemTools::MakeDirectory(out.c_str());
|
cmSystemTools::MakeDirectory(out.c_str());
|
||||||
this->Makefile->AddCMakeOutputFile(out);
|
this->Makefile->AddCMakeOutputFile(out);
|
||||||
|
|
||||||
// Configure the Info.plist file. Note that it needs the executable name
|
// Configure the Info.plist file. Note that it needs the executable name
|
||||||
// to be set.
|
// to be set.
|
||||||
std::string plist =
|
std::string plist =
|
||||||
this->Target->GetCFBundleDirectory(this->ConfigName, true);
|
this->GT->Target->GetCFBundleDirectory(this->ConfigName, true);
|
||||||
plist += "/Info.plist";
|
plist += "/Info.plist";
|
||||||
this->LocalGenerator->GenerateAppleInfoPList(this->Target,
|
this->LocalGenerator->GenerateAppleInfoPList(this->GT->Target,
|
||||||
targetName.c_str(),
|
targetName.c_str(),
|
||||||
plist.c_str());
|
plist.c_str());
|
||||||
this->Makefile->AddCMakeOutputFile(plist);
|
this->Makefile->AddCMakeOutputFile(plist);
|
||||||
@ -199,9 +199,9 @@ GenerateMacOSXContentStatements(std::vector<cmSourceFile*> const& sources,
|
|||||||
for(std::vector<cmSourceFile*>::const_iterator
|
for(std::vector<cmSourceFile*>::const_iterator
|
||||||
si = sources.begin(); si != sources.end(); ++si)
|
si = sources.begin(); si != sources.end(); ++si)
|
||||||
{
|
{
|
||||||
cmTarget::SourceFileFlags tsFlags =
|
cmGeneratorTarget::SourceFileFlags tsFlags =
|
||||||
this->Target->GetTargetSourceFileFlags(*si);
|
this->GT->GetTargetSourceFileFlags(*si);
|
||||||
if(tsFlags.Type != cmTarget::SourceFileTypeNormal)
|
if(tsFlags.Type != cmGeneratorTarget::SourceFileTypeNormal)
|
||||||
{
|
{
|
||||||
(*generator)(**si, tsFlags.MacFolder);
|
(*generator)(**si, tsFlags.MacFolder);
|
||||||
}
|
}
|
||||||
@ -215,7 +215,7 @@ cmOSXBundleGenerator::InitMacOSXContentDirectory(const char* pkgloc)
|
|||||||
// Construct the full path to the content subdirectory.
|
// Construct the full path to the content subdirectory.
|
||||||
|
|
||||||
std::string macdir =
|
std::string macdir =
|
||||||
this->Target->GetMacContentDirectory(this->ConfigName,
|
this->GT->Target->GetMacContentDirectory(this->ConfigName,
|
||||||
/*implib*/ false);
|
/*implib*/ false);
|
||||||
macdir += "/";
|
macdir += "/";
|
||||||
macdir += pkgloc;
|
macdir += pkgloc;
|
||||||
|
@ -59,7 +59,7 @@ private:
|
|||||||
bool MustSkip();
|
bool MustSkip();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cmTarget* Target;
|
cmGeneratorTarget* GT;
|
||||||
cmMakefile* Makefile;
|
cmMakefile* Makefile;
|
||||||
cmLocalGenerator* LocalGenerator;
|
cmLocalGenerator* LocalGenerator;
|
||||||
const char* ConfigName;
|
const char* ConfigName;
|
||||||
|
@ -83,17 +83,12 @@ public:
|
|||||||
cmTargetInternals()
|
cmTargetInternals()
|
||||||
{
|
{
|
||||||
this->PolicyWarnedCMP0022 = false;
|
this->PolicyWarnedCMP0022 = false;
|
||||||
this->SourceFileFlagsConstructed = false;
|
|
||||||
}
|
}
|
||||||
cmTargetInternals(cmTargetInternals const&)
|
cmTargetInternals(cmTargetInternals const&)
|
||||||
{
|
{
|
||||||
this->PolicyWarnedCMP0022 = false;
|
this->PolicyWarnedCMP0022 = false;
|
||||||
this->SourceFileFlagsConstructed = false;
|
|
||||||
}
|
}
|
||||||
~cmTargetInternals();
|
~cmTargetInternals();
|
||||||
typedef cmTarget::SourceFileFlags SourceFileFlags;
|
|
||||||
mutable std::map<cmSourceFile const*, SourceFileFlags> SourceFlagsMap;
|
|
||||||
mutable bool SourceFileFlagsConstructed;
|
|
||||||
|
|
||||||
// The backtrace when the target was created.
|
// The backtrace when the target was created.
|
||||||
cmListFileBacktrace Backtrace;
|
cmListFileBacktrace Backtrace;
|
||||||
@ -647,109 +642,6 @@ void cmTarget::ProcessSourceExpression(std::string const& expr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
struct cmTarget::SourceFileFlags
|
|
||||||
cmTarget::GetTargetSourceFileFlags(const cmSourceFile* sf) const
|
|
||||||
{
|
|
||||||
struct SourceFileFlags flags;
|
|
||||||
this->ConstructSourceFileFlags();
|
|
||||||
std::map<cmSourceFile const*, SourceFileFlags>::iterator si =
|
|
||||||
this->Internal->SourceFlagsMap.find(sf);
|
|
||||||
if(si != this->Internal->SourceFlagsMap.end())
|
|
||||||
{
|
|
||||||
flags = si->second;
|
|
||||||
}
|
|
||||||
return flags;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void cmTarget::ConstructSourceFileFlags() const
|
|
||||||
{
|
|
||||||
if(this->Internal->SourceFileFlagsConstructed)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this->Internal->SourceFileFlagsConstructed = true;
|
|
||||||
|
|
||||||
// Process public headers to mark the source files.
|
|
||||||
if(const char* files = this->GetProperty("PUBLIC_HEADER"))
|
|
||||||
{
|
|
||||||
std::vector<std::string> relFiles;
|
|
||||||
cmSystemTools::ExpandListArgument(files, relFiles);
|
|
||||||
for(std::vector<std::string>::iterator it = relFiles.begin();
|
|
||||||
it != relFiles.end(); ++it)
|
|
||||||
{
|
|
||||||
if(cmSourceFile* sf = this->Makefile->GetSource(it->c_str()))
|
|
||||||
{
|
|
||||||
SourceFileFlags& flags = this->Internal->SourceFlagsMap[sf];
|
|
||||||
flags.MacFolder = "Headers";
|
|
||||||
flags.Type = cmTarget::SourceFileTypePublicHeader;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process private headers after public headers so that they take
|
|
||||||
// precedence if a file is listed in both.
|
|
||||||
if(const char* files = this->GetProperty("PRIVATE_HEADER"))
|
|
||||||
{
|
|
||||||
std::vector<std::string> relFiles;
|
|
||||||
cmSystemTools::ExpandListArgument(files, relFiles);
|
|
||||||
for(std::vector<std::string>::iterator it = relFiles.begin();
|
|
||||||
it != relFiles.end(); ++it)
|
|
||||||
{
|
|
||||||
if(cmSourceFile* sf = this->Makefile->GetSource(it->c_str()))
|
|
||||||
{
|
|
||||||
SourceFileFlags& flags = this->Internal->SourceFlagsMap[sf];
|
|
||||||
flags.MacFolder = "PrivateHeaders";
|
|
||||||
flags.Type = cmTarget::SourceFileTypePrivateHeader;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mark sources listed as resources.
|
|
||||||
if(const char* files = this->GetProperty("RESOURCE"))
|
|
||||||
{
|
|
||||||
std::vector<std::string> relFiles;
|
|
||||||
cmSystemTools::ExpandListArgument(files, relFiles);
|
|
||||||
for(std::vector<std::string>::iterator it = relFiles.begin();
|
|
||||||
it != relFiles.end(); ++it)
|
|
||||||
{
|
|
||||||
if(cmSourceFile* sf = this->Makefile->GetSource(it->c_str()))
|
|
||||||
{
|
|
||||||
SourceFileFlags& flags = this->Internal->SourceFlagsMap[sf];
|
|
||||||
flags.MacFolder = "Resources";
|
|
||||||
flags.Type = cmTarget::SourceFileTypeResource;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle the MACOSX_PACKAGE_LOCATION property on source files that
|
|
||||||
// were not listed in one of the other lists.
|
|
||||||
std::vector<cmSourceFile*> sources;
|
|
||||||
this->GetSourceFiles(sources);
|
|
||||||
for(std::vector<cmSourceFile*>::const_iterator si = sources.begin();
|
|
||||||
si != sources.end(); ++si)
|
|
||||||
{
|
|
||||||
cmSourceFile* sf = *si;
|
|
||||||
if(const char* location = sf->GetProperty("MACOSX_PACKAGE_LOCATION"))
|
|
||||||
{
|
|
||||||
SourceFileFlags& flags = this->Internal->SourceFlagsMap[sf];
|
|
||||||
if(flags.Type == cmTarget::SourceFileTypeNormal)
|
|
||||||
{
|
|
||||||
flags.MacFolder = location;
|
|
||||||
if(strcmp(location, "Resources") == 0)
|
|
||||||
{
|
|
||||||
flags.Type = cmTarget::SourceFileTypeResource;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
flags.Type = cmTarget::SourceFileTypeMacContent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmTarget::MergeLinkLibraries( cmMakefile& mf,
|
void cmTarget::MergeLinkLibraries( cmMakefile& mf,
|
||||||
const char *selfname,
|
const char *selfname,
|
||||||
|
@ -139,34 +139,6 @@ public:
|
|||||||
return this->ObjectLibraries;
|
return this->ObjectLibraries;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Flags for a given source file as used in this target. Typically assigned
|
|
||||||
* via SET_TARGET_PROPERTIES when the property is a list of source files.
|
|
||||||
*/
|
|
||||||
enum SourceFileType
|
|
||||||
{
|
|
||||||
SourceFileTypeNormal,
|
|
||||||
SourceFileTypePrivateHeader, // is in "PRIVATE_HEADER" target property
|
|
||||||
SourceFileTypePublicHeader, // is in "PUBLIC_HEADER" target property
|
|
||||||
SourceFileTypeResource, // is in "RESOURCE" target property *or*
|
|
||||||
// has MACOSX_PACKAGE_LOCATION=="Resources"
|
|
||||||
SourceFileTypeMacContent // has MACOSX_PACKAGE_LOCATION!="Resources"
|
|
||||||
};
|
|
||||||
struct SourceFileFlags
|
|
||||||
{
|
|
||||||
SourceFileFlags(): Type(SourceFileTypeNormal), MacFolder(0) {}
|
|
||||||
SourceFileFlags(SourceFileFlags const& r):
|
|
||||||
Type(r.Type), MacFolder(r.MacFolder) {}
|
|
||||||
SourceFileType Type;
|
|
||||||
const char* MacFolder; // location inside Mac content folders
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the flags for a given source file as used in this target
|
|
||||||
*/
|
|
||||||
struct SourceFileFlags
|
|
||||||
GetTargetSourceFileFlags(const cmSourceFile* sf) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add sources to the target.
|
* Add sources to the target.
|
||||||
*/
|
*/
|
||||||
@ -756,7 +728,6 @@ private:
|
|||||||
friend class cmTargetTraceDependencies;
|
friend class cmTargetTraceDependencies;
|
||||||
cmTargetInternalPointer Internal;
|
cmTargetInternalPointer Internal;
|
||||||
|
|
||||||
void ConstructSourceFileFlags() const;
|
|
||||||
void ComputeVersionedName(std::string& vName,
|
void ComputeVersionedName(std::string& vName,
|
||||||
std::string const& prefix,
|
std::string const& prefix,
|
||||||
std::string const& base,
|
std::string const& base,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user