ENH: add copy header stuff

This commit is contained in:
Bill Hoffman 2007-05-24 17:06:32 -04:00
parent c9aecb91cc
commit d0f12061c3
2 changed files with 70 additions and 2 deletions

View File

@ -729,6 +729,51 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
buildFiles->AddObject(xsf);
}
}
if(cmtarget.GetPropertyAsBool("FRAMEWORK"))
{
this->AddFrameworkPhases(&cmtarget, buildPhases);
}
}
}
//----------------------------------------------------------------------------
void cmGlobalXCodeGenerator::AddFrameworkPhases(cmTarget* target,
cmXCodeObject* buildPhases)
{
const char* headers = target->GetProperty("FRAMEWORK_PUBLIC_HEADERS");
if(!headers)
{
return;
}
cmXCodeObject* copyHeaders =
this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase);
copyHeaders->SetComment("Copy files");
copyHeaders->AddAttribute("buildActionMask",
this->CreateString("2147483647"));
copyHeaders->AddAttribute("dstSubfolderSpec",
this->CreateString("6"));
copyHeaders->AddAttribute("dstPath",
this->CreateString("Headers"));
buildPhases->AddObject(copyHeaders);
cmXCodeObject* headersToCopy =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
copyHeaders->AddAttribute("files", headersToCopy);
std::vector<std::string> headersVec;
cmSystemTools::ExpandListArgument(headers,
headersVec);
cmCustomCommandLines commandLines;
std::vector<std::string> depends;
for(std::vector<std::string>::iterator i = headersVec.begin();
i != headersVec.end(); ++i)
{
cmCustomCommandLine line;
cmSourceFile* sf = this->CurrentMakefile->GetOrCreateSource(i->c_str());
cmXCodeObject* xsf =
this->CreateXCodeSourceFile(this->CurrentLocalGenerator,
sf, *target);
std::cerr << "copy header " << sf->GetFullPath() << "\n";
headersToCopy->AddObject(xsf);
}
}
@ -2008,8 +2053,28 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
cmtarget.GetSourceFiles().push_back
(this->CurrentMakefile->AddSource(file));
}
std::vector<cmSourceFile*> & classes = cmtarget.GetSourceFiles();
std::vector<cmSourceFile*> classes = cmtarget.GetSourceFiles();
// add framework copy headers
if(cmtarget.GetPropertyAsBool("FRAMEWORK"))
{
const char* headers = cmtarget.GetProperty("FRAMEWORK_PUBLIC_HEADERS");
if(!headers)
{
return;
}
std::vector<std::string> headersVec;
cmSystemTools::ExpandListArgument(headers,
headersVec);
cmCustomCommandLines commandLines;
std::vector<std::string> depends;
for(std::vector<std::string>::iterator i = headersVec.begin();
i != headersVec.end(); ++i)
{
cmSourceFile* sf
= this->CurrentMakefile->GetOrCreateSource(i->c_str());
classes.push_back(sf);
}
}
for(std::vector<cmSourceFile*>::const_iterator s = classes.begin();
s != classes.end(); s++)
{

View File

@ -65,6 +65,9 @@ public:
const char* config,
bool ignoreErrors,
bool fast);
// add extra build phases for a framework target
void AddFrameworkPhases(cmTarget*, cmXCodeObject* buildPhases);
/**
* Generate the all required files for building this project/tree. This