diff options
author | halx99 <halx99@live.com> | 2023-07-31 01:08:10 (GMT) |
---|---|---|
committer | halx99 <halx99@live.com> | 2023-07-31 01:08:10 (GMT) |
commit | e40d2cb3afe44ba3f47aecf38db7a56b8ad36a16 (patch) | |
tree | 3671ea24a98081556dc2a828c40a1a9a4fb8b728 /Source | |
parent | d747bc18e1010e71482478b4a9bc60c49f7e2044 (diff) | |
download | CMake-e40d2cb3afe44ba3f47aecf38db7a56b8ad36a16.zip CMake-e40d2cb3afe44ba3f47aecf38db7a56b8ad36a16.tar.gz CMake-e40d2cb3afe44ba3f47aecf38db7a56b8ad36a16.tar.bz2 |
Xcode: Add embed resources support
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 34 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.h | 2 |
2 files changed, 32 insertions, 4 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 0472631..7691bff 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1267,10 +1267,16 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath( fileRef->AddAttribute("sourceTree", this->CreateString(sourceTree)); cmXCodeObject* group = this->GroupMap[key]; - if (!group && IsLibraryType(fileType)) { - group = this->FrameworkGroup; - this->GroupMap[key] = group; + if (!group) { + if (IsLibraryType(fileType)) { + group = this->FrameworkGroup; + } else if (fileType == "folder") { + group = this->ResourcesGroup; + } + if (group) + this->GroupMap[key] = group; } + if (!group) { cmSystemTools::Error("Could not find a PBX group for " + key); return nullptr; @@ -4056,7 +4062,8 @@ void cmGlobalXCodeGenerator::AddEmbeddedObjects( buildFile = it->second; } } else if (cmSystemTools::IsPathToFramework(relFile) || - cmSystemTools::IsPathToMacOSSharedLibrary(relFile)) { + cmSystemTools::IsPathToMacOSSharedLibrary(relFile) || + cmSystemTools::FileIsDirectory(filePath)) { // This is a regular string path - create file reference auto it = this->EmbeddedLibRefs.find(relFile); if (it == this->EmbeddedLibRefs.end()) { @@ -4157,6 +4164,15 @@ void cmGlobalXCodeGenerator::AddEmbeddedExtensionKitExtensions( "$(EXTENSIONS_FOLDER_PATH)"); } +void cmGlobalXCodeGenerator::AddEmbeddedResources(cmXCodeObject* target) +{ + static const auto dstSubfolderSpec = "7"; + + this->AddEmbeddedObjects(target, "Embed Resources", + "XCODE_EMBED_RESOURCES_PATH", dstSubfolderSpec, + NoActionOnCopyByDefault); +} + bool cmGlobalXCodeGenerator::CreateGroups( std::vector<cmLocalGenerator*>& generators) { @@ -4358,6 +4374,15 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( this->FrameworkGroup->AddAttribute("children", frameworkGroupChildren); this->MainGroupChildren->AddObject(this->FrameworkGroup); + this->ResourcesGroup = this->CreateObject(cmXCodeObject::PBXGroup); + this->ResourcesGroup->AddAttribute("name", this->CreateString("Resources")); + this->ResourcesGroup->AddAttribute("sourceTree", + this->CreateString("<group>")); + cmXCodeObject* ResourcesGroupChildren = + this->CreateObject(cmXCodeObject::OBJECT_LIST); + this->ResourcesGroup->AddAttribute("children", ResourcesGroupChildren); + this->MainGroupChildren->AddObject(this->ResourcesGroup); + this->RootObject = this->CreateObject(cmXCodeObject::PBXProject); this->RootObject->SetComment("Project object"); @@ -4549,6 +4574,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( this->AddEmbeddedPlugIns(t); this->AddEmbeddedAppExtensions(t); this->AddEmbeddedExtensionKitExtensions(t); + this->AddEmbeddedResources(t); // Inherit project-wide values for any target-specific search paths. this->InheritBuildSettingAttribute(t, "HEADER_SEARCH_PATHS"); this->InheritBuildSettingAttribute(t, "SYSTEM_HEADER_SEARCH_PATHS"); diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 1fdd189..9fff173 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -224,6 +224,7 @@ private: void AddEmbeddedPlugIns(cmXCodeObject* target); void AddEmbeddedAppExtensions(cmXCodeObject* target); void AddEmbeddedExtensionKitExtensions(cmXCodeObject* target); + void AddEmbeddedResources(cmXCodeObject* target); void AddPositionIndependentLinkAttribute(cmGeneratorTarget* target, cmXCodeObject* buildSettings, const std::string& configName); @@ -355,6 +356,7 @@ private: std::string const& configName); cmXCodeObject* MainGroupChildren; cmXCodeObject* FrameworkGroup; + cmXCodeObject* ResourcesGroup; cmMakefile* CurrentMakefile; cmLocalGenerator* CurrentLocalGenerator; cmLocalGenerator* CurrentRootGenerator = nullptr; |