ENH: Add copy stages for bundle files

This commit is contained in:
Andy Cedilnik 2006-03-29 15:02:35 -05:00
parent 4fd3292d04
commit 32ec28ad00
3 changed files with 45 additions and 0 deletions

View File

@ -616,6 +616,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
// add all the sources
std::vector<cmXCodeObject*> externalObjFiles;
std::vector<cmXCodeObject*> headerFiles;
std::vector<cmXCodeObject*> specialBundleFiles;
for(std::vector<cmSourceFile*>::iterator i = classes.begin();
i != classes.end(); ++i)
{
@ -674,6 +675,48 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
headerBuildPhase, frameworkBuildPhase,
cmtarget);
targets.push_back(this->CreateXCodeTarget(l->second, buildPhases));
// copy files build phase
typedef std::map<cmStdString, std::vector<cmSourceFile*> >
mapOfVectorOfSourceFiles;
mapOfVectorOfSourceFiles bundleFiles;
for(std::vector<cmSourceFile*>::iterator i = classes.begin();
i != classes.end(); ++i)
{
const char* resLoc = (*i)->GetProperty("MACOSX_PACKAGE_LOCATION");
if ( !resLoc )
{
continue;
}
bundleFiles[resLoc].push_back(*i);
}
mapOfVectorOfSourceFiles::iterator mit;
for ( mit = bundleFiles.begin(); mit != bundleFiles.end(); ++ mit )
{
cmXCodeObject* copyFilesBuildPhase
= this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase);
buildPhases->AddObject(copyFilesBuildPhase);
copyFilesBuildPhase->SetComment("Copy files");
copyFilesBuildPhase->AddAttribute("buildActionMask",
this->CreateString("2147483647"));
copyFilesBuildPhase->AddAttribute("dstSubfolderSpec",
this->CreateString("6"));
copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
this->CreateString("0"));
cmOStringStream ostr;
ostr << "../" << mit->first.c_str();
copyFilesBuildPhase->AddAttribute("dstPath",
this->CreateString(ostr.str().c_str()));
buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
copyFilesBuildPhase->AddAttribute("files", buildFiles);
std::vector<cmSourceFile*>::iterator sfIt;
for ( sfIt = mit->second.begin(); sfIt != mit->second.end(); ++ sfIt )
{
cmXCodeObject* xsf =
this->CreateXCodeSourceFile(this->CurrentLocalGenerator, *sfIt, cmtarget);
buildFiles->AddObject(xsf);
}
}
}
}

View File

@ -10,6 +10,7 @@ const char* cmXCodeObject::PBXTypeNames[] = {
"PBXExecutableFileReference", "PBXLibraryReference", "PBXToolTarget",
"PBXLibraryTarget", "PBXAggregateTarget", "XCBuildConfiguration",
"XCConfigurationList",
"PBXCopyFilesBuildPhase",
"None"
};

View File

@ -16,6 +16,7 @@ public:
PBXApplicationReference, PBXExecutableFileReference,
PBXLibraryReference, PBXToolTarget, PBXLibraryTarget,
PBXAggregateTarget,XCBuildConfiguration,XCConfigurationList,
PBXCopyFilesBuildPhase,
None
};
class StringVec: public std::vector<cmStdString> {};