From f4a9f2035b3c67051772be76d6b16cbd2a5daea5 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Thu, 9 Apr 2015 19:25:57 +0200 Subject: CREATE_PROJECT: Add the product files to a group in XCode aswell (makes things easier when configuring build-schemes) --- devtools/create_project/xcode.cpp | 16 ++++++++++++++++ devtools/create_project/xcode.h | 1 + 2 files changed, 17 insertions(+) (limited to 'devtools') diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index 4628cf9de9..ef156830e1 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -189,6 +189,16 @@ void XCodeProvider::addFileReference(const std::string &id, const std::string &n _fileReference.flags = SettingsSingleItem; } +void XCodeProvider::addProductFileReference(const std::string &id, const std::string &name) { + Object *fileRef = new Object(this, id, name, "PBXFileReference", "PBXFileReference", name); + fileRef->addProperty("explicitFileType", "compiled.mach-o.executable", "", SettingsNoValue|SettingsQuoteVariable); + fileRef->addProperty("includeInIndex", "0", "", SettingsNoValue); + fileRef->addProperty("path", name, "", SettingsNoValue|SettingsQuoteVariable); + fileRef->addProperty("sourceTree", "BUILT_PRODUCTS_DIR", "", SettingsNoValue); + _fileReference.add(fileRef); + _fileReference.flags = SettingsSingleItem; +} + void XCodeProvider::addBuildFile(const std::string &id, const std::string &name, const std::string &fileRefId, const std::string &comment) { Object *buildFile = new Object(this, id, name, "PBXBuildFile", "PBXBuildFile", comment); @@ -499,6 +509,8 @@ void XCodeProvider::setupFrameworksBuildPhase() { void XCodeProvider::setupNativeTarget() { _nativeTarget.comment = "PBXNativeTarget"; + // Just use a hardcoded id for the Products-group + Group *productsGroup = new Group(this, "Products", "PBXGroup_CustomTemplate_Products_" , ""); // Output native target section for (unsigned int i = 0; i < _targets.size(); i++) { #ifndef ENABLE_IOS @@ -524,11 +536,15 @@ void XCodeProvider::setupNativeTarget() { target->addProperty("name", _targets[i], "", SettingsNoValue|SettingsQuoteVariable); target->addProperty("productName", PROJECT_NAME, "", SettingsNoValue); + addProductFileReference("PBXFileReference_" PROJECT_DESCRIPTION ".app_" + _targets[i], PROJECT_DESCRIPTION ".app"); + productsGroup->addChildByHash(getHash("PBXFileReference_" PROJECT_DESCRIPTION ".app_" + _targets[i]), PROJECT_DESCRIPTION ".app"); target->addProperty("productReference", getHash("PBXFileReference_" PROJECT_DESCRIPTION ".app_" + _targets[i]), PROJECT_DESCRIPTION ".app", SettingsNoValue); target->addProperty("productType", "com.apple.product-type.application", "", SettingsNoValue|SettingsQuoteVariable); _nativeTarget.add(target); } + _rootSourceGroup->addChildGroup(productsGroup); + _groups.add(productsGroup); } void XCodeProvider::setupProject() { diff --git a/devtools/create_project/xcode.h b/devtools/create_project/xcode.h index 792fa06d8b..7b16bd2dd1 100644 --- a/devtools/create_project/xcode.h +++ b/devtools/create_project/xcode.h @@ -286,6 +286,7 @@ private: Group *touchGroupsForPath(const std::string &path); // Functionality for adding file-refs and build-files, as Group-objects need to be able to do this. void addFileReference(const std::string &id, const std::string &name, FileProperty properties); + void addProductFileReference(const std::string &id, const std::string &name); void addBuildFile(const std::string &id, const std::string &name, const std::string &fileRefId, const std::string &comment); // All objects std::map _hashDictionnary; -- cgit v1.2.3