diff options
author | Gregor Jasny <gjasny@googlemail.com> | 2017-02-26 21:12:44 (GMT) |
---|---|---|
committer | Gregor Jasny <gjasny@googlemail.com> | 2017-03-22 22:36:11 (GMT) |
commit | 060be58c6f9ffe11235341bc10c8f5d808e31b3d (patch) | |
tree | 499131398261812a2f530e63567bed3d1e2db283 /Source/cmGlobalXCodeGenerator.cxx | |
parent | 484ccb0c454afa36da6b36e4ca5e0258e1739b3d (diff) | |
download | CMake-060be58c6f9ffe11235341bc10c8f5d808e31b3d.zip CMake-060be58c6f9ffe11235341bc10c8f5d808e31b3d.tar.gz CMake-060be58c6f9ffe11235341bc10c8f5d808e31b3d.tar.bz2 |
Xcode: Properly handle Bundle Resources with more than one hierarchy level
Issue: #16680
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 3f5dde7..bd0f55b 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1177,6 +1177,46 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( } } + // create vector of "resource content file" build phases - only for + // framework or bundle targets + if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) { + typedef std::map<std::string, std::vector<cmSourceFile*> > + mapOfVectorOfSourceFiles; + mapOfVectorOfSourceFiles bundleFiles; + for (std::vector<cmSourceFile*>::const_iterator i = classes.begin(); + i != classes.end(); ++i) { + cmGeneratorTarget::SourceFileFlags tsFlags = + gtgt->GetTargetSourceFileFlags(*i); + if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeDeepResource) { + bundleFiles[tsFlags.MacFolder].push_back(*i); + } + } + mapOfVectorOfSourceFiles::iterator mit; + for (mit = bundleFiles.begin(); mit != bundleFiles.end(); ++mit) { + cmXCodeObject* copyFilesBuildPhase = + this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase); + copyFilesBuildPhase->SetComment("Copy files"); + copyFilesBuildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + copyFilesBuildPhase->AddAttribute("dstSubfolderSpec", + this->CreateString("7")); + const std::string dstPath = mit->first.substr(strlen("Resources/")); + copyFilesBuildPhase->AddAttribute("dstPath", + this->CreateString(dstPath)); + copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + 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, gtgt); + buildFiles->AddObject(xsf); + } + contentBuildPhases.push_back(copyFilesBuildPhase); + } + } + // create framework build phase cmXCodeObject* frameworkBuildPhase = 0; if (!externalObjFiles.empty()) { |