From e69696a536b500941398ca42c6eec082a8891c08 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Fri, 3 Apr 2015 01:09:22 +0200 Subject: CREATE_PROJECT: Make PBXGroups use PBXFileReference-hashes instead of PBXBuildFile-hashes. --- devtools/create_project/xcode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index d95bf3e9ee..f70b359edb 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -193,7 +193,7 @@ void XCodeProvider::writeFileListToProject(const FileNode &dir, std::ofstream &p std::string id = "FileReference_" + node->name; FileProperty property = FileProperty(node->name, node->name, node->name, ""); - ADD_SETTING_ORDER_NOVALUE(children, getHash(id), node->name, order++); + ADD_SETTING_ORDER_NOVALUE(children, getHash(node->name), node->name, order++); ADD_BUILD_FILE(id, node->name, node->name + " in Sources"); ADD_FILE_REFERENCE(node->name, property); -- cgit v1.2.3 From 8f66bc1c92d8ac61078dc1a3fb00875e608a25a2 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Fri, 3 Apr 2015 01:19:24 +0200 Subject: CREATE_PROJECT: Escape \" in "" for PBXFileReferences during writeFileListToProject This has to be applied explicitly, as modifying ADD_FILE_REFERENCE to use SettingsQuoteVariable would be wrong (i.e. SDKROOT should not become "SDKROOT"). --- devtools/create_project/xcode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index f70b359edb..18ab98560b 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -191,7 +191,7 @@ void XCodeProvider::writeFileListToProject(const FileNode &dir, std::ofstream &p const FileNode *node = *i; std::string id = "FileReference_" + node->name; - FileProperty property = FileProperty(node->name, node->name, node->name, ""); + FileProperty property = FileProperty(node->name, node->name, node->name, "\"\""); ADD_SETTING_ORDER_NOVALUE(children, getHash(node->name), node->name, order++); ADD_BUILD_FILE(id, node->name, node->name + " in Sources"); -- cgit v1.2.3 From 0395948cd3d612f8b629dc16c09fd0bac0225411 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Fri, 3 Apr 2015 01:31:51 +0200 Subject: CREATE_PROJECT: Quote lastKnownFileType, name and path to avoid breakage on c++11-compat.h --- devtools/create_project/xcode.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index 18ab98560b..0cc16d1f8d 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -64,9 +64,9 @@ namespace CreateProjectTool { #define ADD_FILE_REFERENCE(name, properties) { \ Object *fileRef = new Object(this, name, name, "PBXFileReference", "PBXFileReference", name); \ if (!properties.fileEncoding.empty()) fileRef->addProperty("fileEncoding", properties.fileEncoding, "", SettingsNoValue); \ - if (!properties.lastKnownFileType.empty()) fileRef->addProperty("lastKnownFileType", properties.lastKnownFileType, "", SettingsNoValue); \ - if (!properties.fileName.empty()) fileRef->addProperty("name", properties.fileName, "", SettingsNoValue); \ - if (!properties.filePath.empty()) fileRef->addProperty("path", properties.filePath, "", SettingsNoValue); \ + if (!properties.lastKnownFileType.empty()) fileRef->addProperty("lastKnownFileType", properties.lastKnownFileType, "", SettingsNoValue|SettingsQuoteVariable); \ + if (!properties.fileName.empty()) fileRef->addProperty("name", properties.fileName, "", SettingsNoValue|SettingsQuoteVariable); \ + if (!properties.filePath.empty()) fileRef->addProperty("path", properties.filePath, "", SettingsNoValue|SettingsQuoteVariable); \ if (!properties.sourceTree.empty()) fileRef->addProperty("sourceTree", properties.sourceTree, "", SettingsNoValue); \ _fileReference.add(fileRef); \ _fileReference.flags = SettingsSingleItem; \ -- cgit v1.2.3 From b2ff6726cd2a4cbbbd6ce9e8f9568c06f0b2bfeb Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Fri, 3 Apr 2015 05:26:36 +0200 Subject: CREATE_PROJECT: Fix Info.plist path. --- devtools/create_project/xcode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index 0cc16d1f8d..428f35d4e4 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -660,7 +660,7 @@ void XCodeProvider::setupBuildConfiguration() { scummvmOSX_HeaderPaths.push_back("../../engines/"); scummvmOSX_HeaderPaths.push_back("../../"); ADD_SETTING_LIST(scummvmOSX_Debug, "HEADER_SEARCH_PATHS", scummvmOSX_HeaderPaths, SettingsNoQuote|SettingsAsList, 5); - ADD_SETTING_QUOTE(scummvmOSX_Debug, "INFOPLIST_FILE", "$(SRCROOT)/../macosx/Info.plist"); + ADD_SETTING_QUOTE(scummvmOSX_Debug, "INFOPLIST_FILE", "$(SRCROOT)/dists/macosx/Info.plist"); ValueList scummvmOSX_LibPaths; scummvmOSX_LibPaths.push_back("/sw/lib"); scummvmOSX_LibPaths.push_back("/opt/local/lib"); -- cgit v1.2.3 From d6625c20bfa27a3745b78956adbe47d20c3ff0ad Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Fri, 3 Apr 2015 05:26:52 +0200 Subject: CREATE_PROJECT: Use whatever SDK is available on OS X. --- devtools/create_project/xcode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index 428f35d4e4..40ed3aaab6 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -609,7 +609,7 @@ void XCodeProvider::setupBuildConfiguration() { ADD_SETTING_QUOTE(scummvm_Debug, "OTHER_CFLAGS", ""); ADD_SETTING_QUOTE(scummvm_Debug, "OTHER_LDFLAGS", "-lz"); ADD_SETTING(scummvm_Debug, "PREBINDING", "NO"); - ADD_SETTING(scummvm_Debug, "SDKROOT", "macosx10.6"); + ADD_SETTING(scummvm_Debug, "SDKROOT", "macosx"); scummvm_Debug_Object->addProperty("name", "Debug", "", SettingsNoValue); scummvm_Debug_Object->properties["buildSettings"] = scummvm_Debug; -- cgit v1.2.3 From 9ef6e598058179e5124a75963d25e7e0936c29c4 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Sat, 4 Apr 2015 18:17:10 +0200 Subject: CREATE_PROJECT: Make ProjectProvider able to work properly with subclasses that want to create one single project. --- devtools/create_project/create_project.cpp | 20 +++++++++++++------- devtools/create_project/create_project.h | 7 +++++++ devtools/create_project/xcode.h | 3 ++- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 34d30e1d69..ffaa4274f4 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -1279,18 +1279,23 @@ void ProjectProvider::createProject(BuildSetup &setup) { for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) { if (i->first == setup.projectName) continue; - - in.clear(); ex.clear(); + // Retain the files between engines if we're creating a single project + if (createOneProjectPerEngine()) { + in.clear(); ex.clear(); + } const std::string moduleDir = setup.srcDir + targetFolder + i->first; createModuleList(moduleDir, setup.defines, setup.testDirs, in, ex); - createProjectFile(i->first, i->second, setup, moduleDir, in, ex); + if (createOneProjectPerEngine()) { + createProjectFile(i->first, i->second, setup, moduleDir, in, ex); + } } if (setup.tests) { // Create the main project file. - in.clear(); ex.clear(); - + if (createOneProjectPerEngine()) { + in.clear(); ex.clear(); + } createModuleList(setup.srcDir + "/backends", setup.defines, setup.testDirs, in, ex); createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, setup.testDirs, in, ex); createModuleList(setup.srcDir + "/base", setup.defines, setup.testDirs, in, ex); @@ -1304,8 +1309,9 @@ void ProjectProvider::createProject(BuildSetup &setup) { createProjectFile(setup.projectName, svmUUID, setup, setup.srcDir, in, ex); } else if (!setup.devTools) { // Last but not least create the main project file. - in.clear(); ex.clear(); - + if (createOneProjectPerEngine()) { + in.clear(); ex.clear(); + } // File list for the Project file createModuleList(setup.srcDir + "/backends", setup.defines, setup.testDirs, in, ex); createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, setup.testDirs, in, ex); diff --git a/devtools/create_project/create_project.h b/devtools/create_project/create_project.h index 459342a67d..cea1222b4d 100644 --- a/devtools/create_project/create_project.h +++ b/devtools/create_project/create_project.h @@ -458,6 +458,13 @@ protected: */ virtual const char *getProjectExtension() { return ""; } + /** + * Returns whether the provider produces one project per engine + * allowing providers such as the XCode-project provider to disable + * the logic for this in the super-class, thus merging the engine-files + * into the main project instead. + */ + virtual bool createOneProjectPerEngine() const { return true; } /** * Adds files of the specified directory recursively to given project file. * diff --git a/devtools/create_project/xcode.h b/devtools/create_project/xcode.h index f86e7c555c..f7714e4dba 100644 --- a/devtools/create_project/xcode.h +++ b/devtools/create_project/xcode.h @@ -45,7 +45,8 @@ protected: void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation, const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix); - + // Disable multi-project creation on ProjectProvider + bool createOneProjectPerEngine() const { return false; } private: enum { SettingsAsList = 0x01, -- cgit v1.2.3 From 7e7347f877e7dd3a08c8d36b397badc6b81d9ea3 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Sat, 4 Apr 2015 18:35:18 +0200 Subject: CREATE_PROJECT: Modify XCodeProvider to add the various folders as groups, instead of file-references, hardcoding the root as the group "CustomTemplate" This also modifies the hashes, so that subfolders get unique hashes, even if they have the same name as some other folder in the tree (i.e. there are multiple folders named "sdl" in the various subfolders of backends/platforms). --- devtools/create_project/xcode.cpp | 50 +++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index 40ed3aaab6..c1192d3a58 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -173,11 +173,27 @@ void XCodeProvider::writeFileListToProject(const FileNode &dir, std::ofstream &p // Init root group _groups.comment = "PBXGroup"; - + + // We use only the last path component for paths, as every folder gets its own group, + // and subfolders then only need to specify their path relative to their parent folder. + std::string path = getLastPathComponent(dir.name); + std::string name = path; + // We need to use the prefix-name to make sure that the hashes become unique for folders + // that have the same name. + std::string prefixName = objPrefix; + std::string groupName; + // Special case handling for the root-node + if (indentation == 0) { // Indentation level 0 is the root + // Hard-code the name, so that we can use it as mainGroup + name = "CustomTemplate"; + // Should already be "", but lets make sure. + assert(prefixName == ""); + groupName = "PBXGroup_" + name; + } else { + groupName = "PBXGroup_" + prefixName; + } // Create group - std::string name = getLastPathComponent(dir.name); - Object *group = new Object(this, "PBXGroup_" + name , "PBXGroup", "PBXGroup", "", name); - + Object *group = new Object(this, groupName , "PBXGroup", "PBXGroup", "", name); // List of children Property children; children.hasOrder = true; @@ -185,18 +201,32 @@ void XCodeProvider::writeFileListToProject(const FileNode &dir, std::ofstream &p group->addProperty("name", name, "", SettingsNoValue|SettingsQuoteVariable); group->addProperty("sourceTree", "", "", SettingsNoValue|SettingsQuoteVariable); - + // Sub-groups below the root need to have their relative path set (relative to their parent group) + if (indentation != 0) { + group->addProperty("path", path, "", SettingsNoValue|SettingsQuoteVariable); + } int order = 0; for (FileNode::NodeList::const_iterator i = dir.children.begin(); i != dir.children.end(); ++i) { const FileNode *node = *i; std::string id = "FileReference_" + node->name; FileProperty property = FileProperty(node->name, node->name, node->name, "\"\""); - - ADD_SETTING_ORDER_NOVALUE(children, getHash(node->name), node->name, order++); - ADD_BUILD_FILE(id, node->name, node->name + " in Sources"); - ADD_FILE_REFERENCE(node->name, property); - + + // If it is a folder, create a group with a hash made from the concatenated name of the node and + // all its parents, this way, the various folders with the same name (i.e. sdl a bunch of places + // in backends) gets unique hashes, instead of the same hash becoming the child of multiple groups. + if (!node->children.empty()) { + ADD_SETTING_ORDER_NOVALUE(children, getHash("PBXGroup_" + prefixName + node->name + "_"), node->name, order++); + } else { + // Otherwise, simply hash the filename, and hope that we don't get conflicts on those. (Seems to work so far) + ADD_SETTING_ORDER_NOVALUE(children, getHash(node->name), node->name, order++); + } + // Iff it is a file, then add (build) file references. Since we're using Groups and not File References + // for folders, we shouldn't add folders as file references, obviously. + if (node->children.empty()) { + ADD_BUILD_FILE(id, node->name, node->name + " in Sources"); + ADD_FILE_REFERENCE(node->name, property); + } // Process child nodes if (!node->children.empty()) writeFileListToProject(*node, projectFile, indentation + 1, duplicate, objPrefix + node->name + '_', filePrefix + node->name + '/'); -- cgit v1.2.3 From 7052823969df356b9567358d52e8012bb5459c86 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Sat, 4 Apr 2015 18:40:20 +0200 Subject: CREATE_PROJECT: Make sure that children of PBXGroups are always listed as a list with "," after every item, even when there's only one child. This modifies the combination of SettingsAsList and SettingsSingleItem so that "," is used after the item, instead of ";", but only when they are used together. --- devtools/create_project/xcode.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index c1192d3a58..4e651072b1 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -231,7 +231,11 @@ void XCodeProvider::writeFileListToProject(const FileNode &dir, std::ofstream &p if (!node->children.empty()) writeFileListToProject(*node, projectFile, indentation + 1, duplicate, objPrefix + node->name + '_', filePrefix + node->name + '/'); } - + if (order == 1) { + // Force children to use () even when there is only 1 child. + // Also this enforces the use of "," after the single item, instead of ; (see writeProperty) + children.flags |= SettingsSingleItem; + } group->properties["children"] = children; _groups.add(group); @@ -877,7 +881,9 @@ std::string XCodeProvider::writeProperty(const std::string &variable, Property & output += writeSetting((*setting).first, (*setting).second); - if ((prop.flags & SettingsAsList) && prop.settings.size() > 1) { + // The combination of SettingsAsList, and SettingsSingleItem should use "," and not ";" (i.e children + // in PBXGroup, so we special case that case here. + if ((prop.flags & SettingsAsList) && (prop.settings.size() > 1 || (prop.flags & SettingsSingleItem))) { output += (prop.settings.size() > 0) ? ",\n" : "\n"; } else { output += ";"; -- cgit v1.2.3 From 8af5d6e72208e96930f37f6442de71a81e8019cc Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Sat, 4 Apr 2015 18:40:50 +0200 Subject: CREATE_PROJECT: Disable the WIN32-define when creating an XCode-project. --- devtools/create_project/create_project.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index ffaa4274f4..43d3df1702 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -336,7 +336,9 @@ int main(int argc, char *argv[]) { setup.defines.splice(setup.defines.begin(), featureDefines); // Windows only has support for the SDL backend, so we hardcode it here (along with winmm) - setup.defines.push_back("WIN32"); + if (projectType != kProjectXcode) { + setup.defines.push_back("WIN32"); + } setup.defines.push_back("SDL_BACKEND"); if (!useSDL2) { cout << "\nLinking to SDL 1.2\n\n"; -- cgit v1.2.3 From f8b054621a08925f716e2468070911c9100acb0a Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Sat, 4 Apr 2015 18:43:42 +0200 Subject: CREATE_PROJECT: Implement setupSourcesBuildPhase for XCode, basing it on setupResourcesBuildPhase. --- devtools/create_project/xcode.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index 4e651072b1..590fee3af4 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -538,7 +538,36 @@ void XCodeProvider::setupResourcesBuildPhase() { } void XCodeProvider::setupSourcesBuildPhase() { - // TODO + _sourcesBuildPhase.comment = "PBXSourcesBuildPhase"; + + // Setup source file properties + std::map properties; + + // Same as for containers: a rule for each native target + for (unsigned int i = 0; i < _targets.size(); i++) { + Object *source = new Object(this, "PBXSourcesBuildPhase_" + _targets[i], "PBXSourcesBuildPhase", "PBXSourcesBuildPhase", "", "Sources"); + + source->addProperty("buildActionMask", "2147483647", "", SettingsNoValue); + + Property files; + files.hasOrder = true; + files.flags = SettingsAsList; + + int order = 0; + for (std::vector::iterator file = _buildFile.objects.begin(); file !=_buildFile.objects.end(); ++file) { + if (!producesObjectFile((*file)->name)) { + continue; + } + std::string comment = (*file)->name + " in Sources"; + ADD_SETTING_ORDER_NOVALUE(files, getHash((*file)->id), comment, order++); + } + + source->properties["files"] = files; + + source->addProperty("runOnlyForDeploymentPostprocessing", "0", "", SettingsNoValue); + + _sourcesBuildPhase.add(source); + } } // Setup all build configurations -- cgit v1.2.3 From bf919232e9424e54caade5e8d789e4a6231d8e42 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Sat, 4 Apr 2015 18:45:18 +0200 Subject: CREATE_PROJECT: Enable XCode-project creation. --- devtools/create_project/create_project.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 43d3df1702..7b55446b57 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -20,7 +20,7 @@ * */ -//#define ENABLE_XCODE +#define ENABLE_XCODE // HACK to allow building with the SDL backend on MinGW // see bug #1800764 "TOOLS: MinGW tools building broken" -- cgit v1.2.3 From 16618acef73baa01adfb936cd7dc73d308eec67f Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Sat, 4 Apr 2015 18:56:48 +0200 Subject: CREATE_PROJECT: Explicitly add /opt/include/freetype2 to header paths. --- devtools/create_project/xcode.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index 590fee3af4..f86cc9da49 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -719,6 +719,7 @@ void XCodeProvider::setupBuildConfiguration() { ValueList scummvmOSX_HeaderPaths; scummvmOSX_HeaderPaths.push_back("/opt/local/include/SDL"); scummvmOSX_HeaderPaths.push_back("/opt/local/include"); + scummvmOSX_HeaderPaths.push_back("/opt/local/include/freetype2"); scummvmOSX_HeaderPaths.push_back("include/"); scummvmOSX_HeaderPaths.push_back("../../engines/"); scummvmOSX_HeaderPaths.push_back("../../"); -- cgit v1.2.3 From 8cd84a0152955c1413e3360ec4e8bd5558648187 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Sun, 5 Apr 2015 01:11:29 +0200 Subject: CREATE_PROJECT: Define a group for the Frameworks, and add it to the mainGroup, so that the buildPhase can figure things out. --- devtools/create_project/xcode.cpp | 53 ++++++++++++++++++++++++++++----------- devtools/create_project/xcode.h | 1 + 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index f86cc9da49..8989974975 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -236,6 +236,12 @@ void XCodeProvider::writeFileListToProject(const FileNode &dir, std::ofstream &p // Also this enforces the use of "," after the single item, instead of ; (see writeProperty) children.flags |= SettingsSingleItem; } + if (indentation == 0) { + // Add any root-groups to the very bottom (Frameworks-etc) + for (std::vector::iterator it = _rootGroups.objects.begin(); it != _rootGroups.objects.end(); ++it) { + ADD_SETTING_ORDER_NOVALUE(children, getHash((*it)->id), (*it)->id, order++); + } + } group->properties["children"] = children; _groups.add(group); @@ -248,6 +254,9 @@ void XCodeProvider::setupCopyFilesBuildPhase() { // Nothing to do here } +#define DEF_SYSFRAMEWORK(framework) properties[framework".framework"] = FileProperty("wrapper.framework", framework".framework", "System/Library/Frameworks/" framework ".framework", "SDKROOT"); \ + ADD_SETTING_ORDER_NOVALUE(children, getHash(framework".framework"), framework".framework", fwOrder++); + /** * Sets up the frameworks build phase. * @@ -256,24 +265,38 @@ void XCodeProvider::setupCopyFilesBuildPhase() { void XCodeProvider::setupFrameworksBuildPhase() { _frameworksBuildPhase.comment = "PBXFrameworksBuildPhase"; + // Just use a hardcoded id for the Frameworks-group + Object *frameworksGroup = new Object(this, "PBXGroup_CustomTemplate_Frameworks_" , "PBXGroup", "PBXGroup", "", "CustomTemplate_Frameworks_"); + frameworksGroup->addProperty("name", "Frameworks", "", SettingsNoValue|SettingsQuoteVariable); + frameworksGroup->addProperty("sourceTree", "", "", SettingsNoValue|SettingsQuoteVariable); + + Property children; + children.hasOrder = true; + children.flags = SettingsAsList; + // Setup framework file properties std::map properties; - + int fwOrder = 0; // Frameworks - properties["ApplicationServices.framework"] = FileProperty("wrapper.framework", "ApplicationServices.framework", "System/Library/Frameworks/ApplicationServices.framework", "SDKROOT"); - properties["AudioToolbox.framework"] = FileProperty("wrapper.framework", "AudioToolbox.framework", "System/Library/Frameworks/AudioToolbox.framework", "SDKROOT"); - properties["AudioUnit.framework"] = FileProperty("wrapper.framework", "AudioUnit.framework", "System/Library/Frameworks/AudioUnit.framework", "SDKROOT"); - properties["Carbon.framework"] = FileProperty("wrapper.framework", "Carbon.framework", "System/Library/Frameworks/Carbon.framework", "SDKROOT"); - properties["Cocoa.framework"] = FileProperty("wrapper.framework", "Cocoa.framework", "System/Library/Frameworks/Cocoa.framework", "SDKROOT"); - properties["CoreAudio.framework"] = FileProperty("wrapper.framework", "CoreAudio.framework", "System/Library/Frameworks/CoreAudio.framework", "SDKROOT"); - properties["CoreFoundation.framework"] = FileProperty("wrapper.framework", "CoreFoundation.framework", "System/Library/Frameworks/CoreFoundation.framework", "SDKROOT"); - properties["CoreMIDI.framework"] = FileProperty("wrapper.framework", "CoreMIDI.framework", "System/Library/Frameworks/CoreMIDI.framework", "SDKROOT"); - properties["Foundation.framework"] = FileProperty("wrapper.framework", "Foundation.framework", "System/Library/Frameworks/Foundation.framework", "SDKROOT"); - properties["IOKit.framework"] = FileProperty("wrapper.framework", "IOKit.framework", "System/Library/Frameworks/IOKit.framework", "SDKROOT"); - properties["OpenGLES.framework"] = FileProperty("wrapper.framework", "OpenGLES.framework", "System/Library/Frameworks/OpenGLES.framework", "SDKROOT"); - properties["QuartzCore.framework"] = FileProperty("wrapper.framework", "QuartzCore.framework", "System/Library/Frameworks/QuartzCore.framework", "SDKROOT"); - properties["QuickTime.framework"] = FileProperty("wrapper.framework", "QuickTime.framework", "System/Library/Frameworks/QuickTime.framework", "SDKROOT"); - properties["UIKit.framework"] = FileProperty("wrapper.framework", "UIKit.framework", "System/Library/Frameworks/UIKit.framework", "SDKROOT"); + DEF_SYSFRAMEWORK("ApplicationServices"); + DEF_SYSFRAMEWORK("AudioToolbox"); + DEF_SYSFRAMEWORK("AudioUnit"); + DEF_SYSFRAMEWORK("Carbon"); + DEF_SYSFRAMEWORK("Cocoa"); + DEF_SYSFRAMEWORK("CoreAudio"); + DEF_SYSFRAMEWORK("CoreFoundation"); + DEF_SYSFRAMEWORK("CoreMIDI"); + DEF_SYSFRAMEWORK("Foundation"); + DEF_SYSFRAMEWORK("IOKit"); + DEF_SYSFRAMEWORK("OpenGLES"); + DEF_SYSFRAMEWORK("QuartzCore"); + DEF_SYSFRAMEWORK("QuickTime"); + DEF_SYSFRAMEWORK("UIKit"); + + frameworksGroup->properties["children"] = children; + _groups.add(frameworksGroup); + // Force this to be added as a sub-group in the root. + _rootGroups.add(frameworksGroup); // Local libraries properties["libFLAC.a"] = FileProperty("archive.ar", "libFLAC.a", "lib/libFLAC.a", "\"\""); diff --git a/devtools/create_project/xcode.h b/devtools/create_project/xcode.h index f7714e4dba..f0b0b1e350 100644 --- a/devtools/create_project/xcode.h +++ b/devtools/create_project/xcode.h @@ -272,6 +272,7 @@ private: ObjectList _fileReference; ObjectList _frameworksBuildPhase; ObjectList _groups; + ObjectList _rootGroups; ObjectList _nativeTarget; ObjectList _project; ObjectList _resourcesBuildPhase; -- cgit v1.2.3 From 484ad4dde7a92c1c2cc4859601da94c66a940a5e Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Sun, 5 Apr 2015 01:12:14 +0200 Subject: CREATE_PROJECT: Define MACOSX and POSIX in XCode-projects for now (ignoring iOS for the moment) --- devtools/create_project/create_project.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 7b55446b57..4113d6c83e 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -338,6 +338,9 @@ int main(int argc, char *argv[]) { // Windows only has support for the SDL backend, so we hardcode it here (along with winmm) if (projectType != kProjectXcode) { setup.defines.push_back("WIN32"); + } else { + setup.defines.push_back("POSIX"); + setup.defines.push_back("MACOSX"); // This will break iOS, but allows OS X to catch up on browser_osx. } setup.defines.push_back("SDL_BACKEND"); if (!useSDL2) { -- cgit v1.2.3 From 675bbde43602581b6954505ea15df8ebe6074498 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Sun, 5 Apr 2015 01:13:14 +0200 Subject: CREATE_PROJECT: Use a different producesObjectFile-function for Xcode, so that we can allow Objective-C(++) and disallow .asm --- devtools/create_project/xcode.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index 8989974975..01a03d1357 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -560,6 +560,18 @@ void XCodeProvider::setupResourcesBuildPhase() { } } +bool producesObjectFileOnOSX(const std::string &fileName) { + std::string n, ext; + splitFilename(fileName, n, ext); + + // Note that the difference between this and the general producesObjectFile is that + // this one adds Objective-C(++), and removes asm-support. + if (ext == "cpp" || ext == "c" || ext == "m" || ext == "mm") + return true; + else + return false; +} + void XCodeProvider::setupSourcesBuildPhase() { _sourcesBuildPhase.comment = "PBXSourcesBuildPhase"; @@ -578,7 +590,7 @@ void XCodeProvider::setupSourcesBuildPhase() { int order = 0; for (std::vector::iterator file = _buildFile.objects.begin(); file !=_buildFile.objects.end(); ++file) { - if (!producesObjectFile((*file)->name)) { + if (!producesObjectFileOnOSX((*file)->name)) { continue; } std::string comment = (*file)->name + " in Sources"; -- cgit v1.2.3 From 219a43d7458886062b30eb1e36d8f2259f388128 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Thu, 9 Apr 2015 18:30:03 +0200 Subject: CREATE_PROJECT: Revert idea about createOneProjectPerEngine. --- devtools/create_project/create_project.cpp | 17 +++++------------ devtools/create_project/create_project.h | 7 ------- devtools/create_project/xcode.h | 3 +-- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 4113d6c83e..2f784529bd 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -1285,22 +1285,17 @@ void ProjectProvider::createProject(BuildSetup &setup) { if (i->first == setup.projectName) continue; // Retain the files between engines if we're creating a single project - if (createOneProjectPerEngine()) { - in.clear(); ex.clear(); - } + in.clear(); ex.clear(); + const std::string moduleDir = setup.srcDir + targetFolder + i->first; createModuleList(moduleDir, setup.defines, setup.testDirs, in, ex); - if (createOneProjectPerEngine()) { - createProjectFile(i->first, i->second, setup, moduleDir, in, ex); - } + createProjectFile(i->first, i->second, setup, moduleDir, in, ex); } if (setup.tests) { // Create the main project file. - if (createOneProjectPerEngine()) { - in.clear(); ex.clear(); - } + in.clear(); ex.clear(); createModuleList(setup.srcDir + "/backends", setup.defines, setup.testDirs, in, ex); createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, setup.testDirs, in, ex); createModuleList(setup.srcDir + "/base", setup.defines, setup.testDirs, in, ex); @@ -1314,9 +1309,7 @@ void ProjectProvider::createProject(BuildSetup &setup) { createProjectFile(setup.projectName, svmUUID, setup, setup.srcDir, in, ex); } else if (!setup.devTools) { // Last but not least create the main project file. - if (createOneProjectPerEngine()) { - in.clear(); ex.clear(); - } + in.clear(); ex.clear(); // File list for the Project file createModuleList(setup.srcDir + "/backends", setup.defines, setup.testDirs, in, ex); createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, setup.testDirs, in, ex); diff --git a/devtools/create_project/create_project.h b/devtools/create_project/create_project.h index cea1222b4d..459342a67d 100644 --- a/devtools/create_project/create_project.h +++ b/devtools/create_project/create_project.h @@ -458,13 +458,6 @@ protected: */ virtual const char *getProjectExtension() { return ""; } - /** - * Returns whether the provider produces one project per engine - * allowing providers such as the XCode-project provider to disable - * the logic for this in the super-class, thus merging the engine-files - * into the main project instead. - */ - virtual bool createOneProjectPerEngine() const { return true; } /** * Adds files of the specified directory recursively to given project file. * diff --git a/devtools/create_project/xcode.h b/devtools/create_project/xcode.h index f0b0b1e350..b02cb5b75c 100644 --- a/devtools/create_project/xcode.h +++ b/devtools/create_project/xcode.h @@ -45,9 +45,8 @@ protected: void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation, const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix); - // Disable multi-project creation on ProjectProvider - bool createOneProjectPerEngine() const { return false; } private: + std::string _projectRoot; enum { SettingsAsList = 0x01, SettingsSingleItem = 0x02, -- cgit v1.2.3 From 000b80263c46287843b5859d84cfb6fcaf3363ff Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Thu, 9 Apr 2015 18:39:03 +0200 Subject: CREATE_PROJECT: Add macros to disable IOS-project creation for now. --- devtools/create_project/xcode.cpp | 67 +++++++++++++++++++++++++++------------ 1 file changed, 47 insertions(+), 20 deletions(-) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index 01a03d1357..20525af2d8 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -30,6 +30,14 @@ namespace CreateProjectTool { #define DEBUG_XCODE_HASH 0 +#ifdef ENABLE_IOS +#define IOS_TARGET 0 +#define OSX_TARGET 1 +#define SIM_TARGET 2 +#else +#define OSX_TARGET 0 +#endif + #define ADD_DEFINE(defines, name) \ defines.push_back(name); @@ -83,10 +91,13 @@ void XCodeProvider::createWorkspace(const BuildSetup &setup) { // Setup global objects setupDefines(setup); +#ifdef ENABLE_IOS _targets.push_back(PROJECT_DESCRIPTION "-iPhone"); +#endif _targets.push_back(PROJECT_DESCRIPTION "-OS X"); +#ifdef ENABLE_IOS _targets.push_back(PROJECT_DESCRIPTION "-Simulator"); - +#endif setupCopyFilesBuildPhase(); setupFrameworksBuildPhase(); setupNativeTarget(); @@ -304,9 +315,12 @@ void XCodeProvider::setupFrameworksBuildPhase() { //properties["libmpeg2.a"] = FileProperty("archive.ar", "libmpeg2.a", "lib/libmpeg2.a", "\"\""); properties["libvorbisidec.a"] = FileProperty("archive.ar", "libvorbisidec.a", "lib/libvorbisidec.a", "\"\""); + // Declare this here, as it's used across the three targets + int order = 0; +#ifdef ENABLE_IOS ////////////////////////////////////////////////////////////////////////// // iPhone - Object *framework_iPhone = new Object(this, "PBXFrameworksBuildPhase_" + _targets[0], "PBXFrameworksBuildPhase", "PBXFrameworksBuildPhase", "", "Frameworks"); + Object *framework_iPhone = new Object(this, "PBXFrameworksBuildPhase_" + _targets[IOS_TARGET], "PBXFrameworksBuildPhase", "PBXFrameworksBuildPhase", "", "Frameworks"); framework_iPhone->addProperty("buildActionMask", "2147483647", "", SettingsNoValue); framework_iPhone->addProperty("runOnlyForDeploymentPostprocessing", "0", "", SettingsNoValue); @@ -329,7 +343,6 @@ void XCodeProvider::setupFrameworksBuildPhase() { frameworks_iPhone.push_back("libvorbisidec.a"); frameworks_iPhone.push_back("OpenGLES.framework"); - int order = 0; for (ValueList::iterator framework = frameworks_iPhone.begin(); framework != frameworks_iPhone.end(); framework++) { std::string id = "Frameworks_" + *framework + "_iphone"; std::string comment = *framework + " in Frameworks"; @@ -342,10 +355,10 @@ void XCodeProvider::setupFrameworksBuildPhase() { framework_iPhone->properties["files"] = iPhone_files; _frameworksBuildPhase.add(framework_iPhone); - +#endif ////////////////////////////////////////////////////////////////////////// // ScummVM-OS X - Object *framework_OSX = new Object(this, "PBXFrameworksBuildPhase_" + _targets[1], "PBXFrameworksBuildPhase", "PBXFrameworksBuildPhase", "", "Frameworks"); + Object *framework_OSX = new Object(this, "PBXFrameworksBuildPhase_" + _targets[OSX_TARGET], "PBXFrameworksBuildPhase", "PBXFrameworksBuildPhase", "", "Frameworks"); framework_OSX->addProperty("buildActionMask", "2147483647", "", SettingsNoValue); framework_OSX->addProperty("runOnlyForDeploymentPostprocessing", "0", "", SettingsNoValue); @@ -382,10 +395,10 @@ void XCodeProvider::setupFrameworksBuildPhase() { framework_OSX->properties["files"] = osx_files; _frameworksBuildPhase.add(framework_OSX); - +#ifdef ENABLE_IOS ////////////////////////////////////////////////////////////////////////// // Simulator - Object *framework_simulator = new Object(this, "PBXFrameworksBuildPhase_" + _targets[2], "PBXFrameworksBuildPhase", "PBXFrameworksBuildPhase", "", "Frameworks"); + Object *framework_simulator = new Object(this, "PBXFrameworksBuildPhase_" + _targets[SIM_TARGET], "PBXFrameworksBuildPhase", "PBXFrameworksBuildPhase", "", "Frameworks"); framework_simulator->addProperty("buildActionMask", "2147483647", "", SettingsNoValue); framework_simulator->addProperty("runOnlyForDeploymentPostprocessing", "0", "", SettingsNoValue); @@ -417,6 +430,7 @@ void XCodeProvider::setupFrameworksBuildPhase() { framework_simulator->properties["files"] = simulator_files; _frameworksBuildPhase.add(framework_simulator); +#endif } void XCodeProvider::setupNativeTarget() { @@ -424,6 +438,11 @@ void XCodeProvider::setupNativeTarget() { // Output native target section for (unsigned int i = 0; i < _targets.size(); i++) { +#ifndef ENABLE_IOS + if (i != OSX_TARGET) { // TODO: Fix iOS-targets, for now just disable them. + continue; + } +#endif Object *target = new Object(this, "PBXNativeTarget_" + _targets[i], "PBXNativeTarget", "PBXNativeTarget", "", _targets[i]); target->addProperty("buildConfigurationList", getHash("XCConfigurationList_" + _targets[i]), "Build configuration list for PBXNativeTarget \"" + _targets[i] + "\"", SettingsNoValue); @@ -475,10 +494,18 @@ void XCodeProvider::setupProject() { // List of targets Property targets; targets.flags = SettingsAsList; - targets.settings[getHash("PBXNativeTarget_" + _targets[0])] = Setting("", _targets[0], SettingsNoValue, 0, 0); - targets.settings[getHash("PBXNativeTarget_" + _targets[1])] = Setting("", _targets[1], SettingsNoValue, 0, 1); - targets.settings[getHash("PBXNativeTarget_" + _targets[2])] = Setting("", _targets[2], SettingsNoValue, 0, 2); +#ifdef ENABLE_IOS + targets.settings[getHash("PBXNativeTarget_" + _targets[IOS_TARGET])] = Setting("", _targets[IOS_TARGET], SettingsNoValue, 0, 0); +#endif + targets.settings[getHash("PBXNativeTarget_" + _targets[OSX_TARGET])] = Setting("", _targets[OSX_TARGET], SettingsNoValue, 0, 1); +#ifdef ENABLE_IOS + targets.settings[getHash("PBXNativeTarget_" + _targets[SIM_TARGET])] = Setting("", _targets[SIM_TARGET], SettingsNoValue, 0, 2); +#endif project->properties["targets"] = targets; +#ifndef ENABLE_IOS + // Force list even when there is only a single target + project->properties["targets"].flags |= SettingsSingleItem; +#endif _project.add(project); } @@ -614,9 +641,9 @@ void XCodeProvider::setupBuildConfiguration() { ///**************************************** // * iPhone // ****************************************/ - +#ifdef ENABLE_IOS // Debug - Object *iPhone_Debug_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-iPhone_Debug", _targets[0] /* ScummVM-iPhone */, "XCBuildConfiguration", "PBXNativeTarget", "Debug"); + Object *iPhone_Debug_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-iPhone_Debug", _targets[IOS_TARGET] /* ScummVM-iPhone */, "XCBuildConfiguration", "PBXNativeTarget", "Debug"); Property iPhone_Debug; ADD_SETTING_QUOTE(iPhone_Debug, "ARCHS", "$(ARCHS_UNIVERSAL_IPHONE_OS)"); ADD_SETTING_QUOTE(iPhone_Debug, "CODE_SIGN_IDENTITY", "iPhone Developer"); @@ -658,7 +685,7 @@ void XCodeProvider::setupBuildConfiguration() { iPhone_Debug_Object->properties["buildSettings"] = iPhone_Debug; // Release - Object *iPhone_Release_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-iPhone_Release", _targets[0] /* ScummVM-iPhone */, "XCBuildConfiguration", "PBXNativeTarget", "Release"); + Object *iPhone_Release_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-iPhone_Release", _targets[IOS_TARGET] /* ScummVM-iPhone */, "XCBuildConfiguration", "PBXNativeTarget", "Release"); Property iPhone_Release(iPhone_Debug); ADD_SETTING(iPhone_Release, "GCC_OPTIMIZATION_LEVEL", "3"); ADD_SETTING(iPhone_Release, "COPY_PHASE_STRIP", "YES"); @@ -670,7 +697,7 @@ void XCodeProvider::setupBuildConfiguration() { _buildConfiguration.add(iPhone_Debug_Object); _buildConfiguration.add(iPhone_Release_Object); - +#endif /**************************************** * scummvm ****************************************/ @@ -731,7 +758,7 @@ void XCodeProvider::setupBuildConfiguration() { ****************************************/ // Debug - Object *scummvmOSX_Debug_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-OSX_Debug", _targets[1] /* ScummVM-OS X */, "XCBuildConfiguration", "PBXNativeTarget", "Debug"); + Object *scummvmOSX_Debug_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-OSX_Debug", _targets[OSX_TARGET] /* ScummVM-OS X */, "XCBuildConfiguration", "PBXNativeTarget", "Debug"); Property scummvmOSX_Debug; ADD_SETTING_QUOTE(scummvmOSX_Debug, "ARCHS", "$(NATIVE_ARCH)"); ADD_SETTING(scummvmOSX_Debug, "COMPRESS_PNG_FILES", "NO"); @@ -784,7 +811,7 @@ void XCodeProvider::setupBuildConfiguration() { scummvmOSX_Debug_Object->properties["buildSettings"] = scummvmOSX_Debug; // Release - Object *scummvmOSX_Release_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-OSX_Release", _targets[1] /* ScummVM-OS X */, "XCBuildConfiguration", "PBXNativeTarget", "Release"); + Object *scummvmOSX_Release_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-OSX_Release", _targets[OSX_TARGET] /* ScummVM-OS X */, "XCBuildConfiguration", "PBXNativeTarget", "Release"); Property scummvmOSX_Release(scummvmOSX_Debug); ADD_SETTING(scummvmOSX_Release, "COPY_PHASE_STRIP", "YES"); REMOVE_SETTING(scummvmOSX_Release, "GCC_DYNAMIC_NO_PIC"); @@ -796,13 +823,13 @@ void XCodeProvider::setupBuildConfiguration() { _buildConfiguration.add(scummvmOSX_Debug_Object); _buildConfiguration.add(scummvmOSX_Release_Object); - +#ifdef ENABLE_IOS /**************************************** * ScummVM-Simulator ****************************************/ // Debug - Object *scummvmSimulator_Debug_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-Simulator_Debug", _targets[2] /* ScummVM-Simulator */, "XCBuildConfiguration", "PBXNativeTarget", "Debug"); + Object *scummvmSimulator_Debug_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-Simulator_Debug", _targets[SIM_TARGET] /* ScummVM-Simulator */, "XCBuildConfiguration", "PBXNativeTarget", "Debug"); Property scummvmSimulator_Debug(iPhone_Debug); ADD_SETTING_QUOTE(scummvmSimulator_Debug, "FRAMEWORK_SEARCH_PATHS", "$(inherited)"); ADD_SETTING_LIST(scummvmSimulator_Debug, "GCC_PREPROCESSOR_DEFINITIONS", scummvm_defines, SettingsNoQuote|SettingsAsList, 5); @@ -814,7 +841,7 @@ void XCodeProvider::setupBuildConfiguration() { scummvmSimulator_Debug_Object->properties["buildSettings"] = scummvmSimulator_Debug; // Release - Object *scummvmSimulator_Release_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-Simulator_Release", _targets[2] /* ScummVM-Simulator */, "XCBuildConfiguration", "PBXNativeTarget", "Release"); + Object *scummvmSimulator_Release_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-Simulator_Release", _targets[SIM_TARGET] /* ScummVM-Simulator */, "XCBuildConfiguration", "PBXNativeTarget", "Release"); Property scummvmSimulator_Release(scummvmSimulator_Debug); ADD_SETTING(scummvmSimulator_Release, "COPY_PHASE_STRIP", "YES"); ADD_SETTING(scummvmSimulator_Release, "GCC_OPTIMIZATION_LEVEL", "3"); @@ -831,7 +858,7 @@ void XCodeProvider::setupBuildConfiguration() { // Configuration List _configurationList.comment = "XCConfigurationList"; _configurationList.flags = SettingsAsList; - +#endif // Warning: This assumes we have all configurations with a Debug & Release pair for (std::vector::iterator config = _buildConfiguration.objects.begin(); config != _buildConfiguration.objects.end(); config++) { -- cgit v1.2.3 From 790f7dc0178b05a519b9e353e8e6d542ae6d9cf9 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Thu, 9 Apr 2015 19:19:20 +0200 Subject: CREATE_PROJECT: Introduce a subclass of Object to manage group-creation. This rewrites the way groups are created, so that the root source folder has groups created for any subfolder that is used, which allows for merging in the engines/-subfolder automatically. --- devtools/create_project/xcode.cpp | 206 +++++++++++++++++++++++--------------- devtools/create_project/xcode.h | 35 ++++++- 2 files changed, 157 insertions(+), 84 deletions(-) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index 20525af2d8..ab94bdc05f 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -80,15 +80,135 @@ namespace CreateProjectTool { _fileReference.flags = SettingsSingleItem; \ } +bool producesObjectFileOnOSX(const std::string &fileName) { + std::string n, ext; + splitFilename(fileName, n, ext); + + // Note that the difference between this and the general producesObjectFile is that + // this one adds Objective-C(++), and removes asm-support. + if (ext == "cpp" || ext == "c" || ext == "m" || ext == "mm") + return true; + else + return false; +} + +XCodeProvider::Group::Group(XCodeProvider *objectParent, const std::string &groupName, const std::string &uniqueName, const std::string &path) : Object(objectParent, uniqueName, groupName, "PBXGroup", "", groupName) { + addProperty("name", name, "", SettingsNoValue|SettingsQuoteVariable); + addProperty("sourceTree", "", "", SettingsNoValue|SettingsQuoteVariable); + + if (path != "") { + addProperty("path", path, "", SettingsNoValue|SettingsQuoteVariable); + } + _childOrder = 0; + _treeName = uniqueName; +} + +void XCodeProvider::Group::ensureChildExists(const std::string &name) { + std::map::iterator it = _childGroups.find(name); + if (it == _childGroups.end()) { + Group *child = new Group(parent, name, this->_treeName + '/' + name, name); + _childGroups[name] = child; + addChildGroup(child); + parent->_groups.add(child); + } +} + +void XCodeProvider::Group::addChildInternal(const std::string &id, const std::string &comment) { + if (properties.find("children") == properties.end()) { + Property children; + children.hasOrder = true; + children.flags = SettingsAsList; + properties["children"] = children; + } + properties["children"].settings[id] = Setting("", comment + " in Sources", SettingsNoValue, 0, _childOrder++); + if (_childOrder == 1) { + // Force children to use () even when there is only 1 child. + // Also this enforces the use of "," after the single item, instead of ; (see writeProperty) + properties["children"].flags |= SettingsSingleItem; + } else { + properties["children"].flags ^= SettingsSingleItem; + } + +} + +void XCodeProvider::Group::addChildGroup(const Group* group) { + addChildInternal(parent->getHash(group->_treeName), group->_treeName); +} + +void XCodeProvider::Group::addChildFile(const std::string &name) { + std::string id = "FileReference_" + _treeName + "/" + name; + addChildInternal(parent->getHash(id), name); + FileProperty property = FileProperty(name, name, name, "\"\""); + + parent->addFileReference(id, name, property); + if (producesObjectFileOnOSX(name)) { + parent->addBuildFile(_treeName + "/" + name, name, parent->getHash(id), name + " in Sources"); + } +} + +void XCodeProvider::Group::addChildByHash(const std::string &hash, const std::string &name) { + addChildInternal(hash, name); +} + +XCodeProvider::Group *XCodeProvider::Group::getChildGroup(const std::string &name) { + std::map::iterator it = _childGroups.find(name); + assert(it != _childGroups.end()); + return it->second; +} + +XCodeProvider::Group *XCodeProvider::touchGroupsForPath(const std::string &path) { + if (_rootSourceGroup == nullptr) { + assert (path == _projectRoot); + _rootSourceGroup = new Group(this, "Sources", path, path); + _groups.add(_rootSourceGroup); + return _rootSourceGroup; + } else { + assert(path.find(_projectRoot) == 0); + std::string subPath = path.substr(_projectRoot.size() + 1); + Group *currentGroup = _rootSourceGroup; + size_t firstPathComponent = subPath.find_first_of('/'); + // We assume here that all paths have trailing '/', otherwise this breaks. + while (firstPathComponent != std::string::npos) { + currentGroup->ensureChildExists(subPath.substr(0, firstPathComponent)); + currentGroup = currentGroup->getChildGroup(subPath.substr(0, firstPathComponent)); + subPath = subPath.substr(firstPathComponent + 1); + firstPathComponent = subPath.find_first_of('/'); + } + return currentGroup; + } +} + +void XCodeProvider::addFileReference(const std::string &id, const std::string &name, FileProperty properties) { + Object *fileRef = new Object(this, id, name, "PBXFileReference", "PBXFileReference", name); + if (!properties.fileEncoding.empty()) fileRef->addProperty("fileEncoding", properties.fileEncoding, "", SettingsNoValue); + if (!properties.lastKnownFileType.empty()) fileRef->addProperty("lastKnownFileType", properties.lastKnownFileType, "", SettingsNoValue|SettingsQuoteVariable); + if (!properties.fileName.empty()) fileRef->addProperty("name", properties.fileName, "", SettingsNoValue|SettingsQuoteVariable); + if (!properties.filePath.empty()) fileRef->addProperty("path", properties.filePath, "", SettingsNoValue|SettingsQuoteVariable); + if (!properties.sourceTree.empty()) fileRef->addProperty("sourceTree", properties.sourceTree, "", 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); + buildFile->addProperty("fileRef", fileRefId, name, SettingsNoValue); + _buildFile.add(buildFile); + _buildFile.flags = SettingsSingleItem; +} + XCodeProvider::XCodeProvider(StringList &global_warnings, std::map &project_warnings, const int version) : ProjectProvider(global_warnings, project_warnings, version) { + _rootSourceGroup = NULL; } void XCodeProvider::createWorkspace(const BuildSetup &setup) { // Create project folder std::string workspace = setup.outputDir + '/' + PROJECT_NAME ".xcodeproj"; createDirectory(workspace); - + _projectRoot = setup.srcDir; + touchGroupsForPath(_projectRoot); + // Setup global objects setupDefines(setup); #ifdef ENABLE_IOS @@ -178,84 +298,20 @@ void XCodeProvider::ouputMainProjectFile(const BuildSetup &setup) { void XCodeProvider::writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation, const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix) { - // Add comments for shared lists - _buildFile.comment = "PBXBuildFile"; - _fileReference.comment = "PBXFileReference"; - - // Init root group - _groups.comment = "PBXGroup"; - - // We use only the last path component for paths, as every folder gets its own group, - // and subfolders then only need to specify their path relative to their parent folder. - std::string path = getLastPathComponent(dir.name); - std::string name = path; - // We need to use the prefix-name to make sure that the hashes become unique for folders - // that have the same name. - std::string prefixName = objPrefix; - std::string groupName; - // Special case handling for the root-node - if (indentation == 0) { // Indentation level 0 is the root - // Hard-code the name, so that we can use it as mainGroup - name = "CustomTemplate"; - // Should already be "", but lets make sure. - assert(prefixName == ""); - groupName = "PBXGroup_" + name; - } else { - groupName = "PBXGroup_" + prefixName; - } - // Create group - Object *group = new Object(this, groupName , "PBXGroup", "PBXGroup", "", name); - // List of children - Property children; - children.hasOrder = true; - children.flags = SettingsAsList; - - group->addProperty("name", name, "", SettingsNoValue|SettingsQuoteVariable); - group->addProperty("sourceTree", "", "", SettingsNoValue|SettingsQuoteVariable); - // Sub-groups below the root need to have their relative path set (relative to their parent group) - if (indentation != 0) { - group->addProperty("path", path, "", SettingsNoValue|SettingsQuoteVariable); - } - int order = 0; + // Ensure that top-level groups are generated for i.e. engines/ + Group *group = touchGroupsForPath(filePrefix); for (FileNode::NodeList::const_iterator i = dir.children.begin(); i != dir.children.end(); ++i) { const FileNode *node = *i; - std::string id = "FileReference_" + node->name; - FileProperty property = FileProperty(node->name, node->name, node->name, "\"\""); - - // If it is a folder, create a group with a hash made from the concatenated name of the node and - // all its parents, this way, the various folders with the same name (i.e. sdl a bunch of places - // in backends) gets unique hashes, instead of the same hash becoming the child of multiple groups. - if (!node->children.empty()) { - ADD_SETTING_ORDER_NOVALUE(children, getHash("PBXGroup_" + prefixName + node->name + "_"), node->name, order++); - } else { - // Otherwise, simply hash the filename, and hope that we don't get conflicts on those. (Seems to work so far) - ADD_SETTING_ORDER_NOVALUE(children, getHash(node->name), node->name, order++); - } // Iff it is a file, then add (build) file references. Since we're using Groups and not File References // for folders, we shouldn't add folders as file references, obviously. if (node->children.empty()) { - ADD_BUILD_FILE(id, node->name, node->name + " in Sources"); - ADD_FILE_REFERENCE(node->name, property); + group->addChildFile(node->name); } // Process child nodes if (!node->children.empty()) writeFileListToProject(*node, projectFile, indentation + 1, duplicate, objPrefix + node->name + '_', filePrefix + node->name + '/'); } - if (order == 1) { - // Force children to use () even when there is only 1 child. - // Also this enforces the use of "," after the single item, instead of ; (see writeProperty) - children.flags |= SettingsSingleItem; - } - if (indentation == 0) { - // Add any root-groups to the very bottom (Frameworks-etc) - for (std::vector::iterator it = _rootGroups.objects.begin(); it != _rootGroups.objects.end(); ++it) { - ADD_SETTING_ORDER_NOVALUE(children, getHash((*it)->id), (*it)->id, order++); - } - } - group->properties["children"] = children; - - _groups.add(group); } ////////////////////////////////////////////////////////////////////////// @@ -487,7 +543,7 @@ void XCodeProvider::setupProject() { ADD_SETTING_ORDER_NOVALUE(regions, "German", "", 3); project->properties["knownRegions"] = regions; - project->addProperty("mainGroup", getHash("PBXGroup_CustomTemplate"), "CustomTemplate", SettingsNoValue); + project->addProperty("mainGroup", _rootSourceGroup->getHashRef(), "CustomTemplate", SettingsNoValue); project->addProperty("projectDirPath", "", "", SettingsNoValue|SettingsQuoteVariable); project->addProperty("projectRoot", "", "", SettingsNoValue|SettingsQuoteVariable); @@ -587,18 +643,6 @@ void XCodeProvider::setupResourcesBuildPhase() { } } -bool producesObjectFileOnOSX(const std::string &fileName) { - std::string n, ext; - splitFilename(fileName, n, ext); - - // Note that the difference between this and the general producesObjectFile is that - // this one adds Objective-C(++), and removes asm-support. - if (ext == "cpp" || ext == "c" || ext == "m" || ext == "mm") - return true; - else - return false; -} - void XCodeProvider::setupSourcesBuildPhase() { _sourcesBuildPhase.comment = "PBXSourcesBuildPhase"; diff --git a/devtools/create_project/xcode.h b/devtools/create_project/xcode.h index b02cb5b75c..792fa06d8b 100644 --- a/devtools/create_project/xcode.h +++ b/devtools/create_project/xcode.h @@ -46,7 +46,6 @@ protected: void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation, const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix); private: - std::string _projectRoot; enum { SettingsAsList = 0x01, SettingsSingleItem = 0x02, @@ -210,9 +209,10 @@ private: return output; } - private: + // Slight hack, to allow Group access to parent. + protected: XCodeProvider *parent; - + private: // Returns the type property (should always be the first in the properties map) std::string getType() { assert(!properties.empty()); @@ -258,6 +258,35 @@ private: } }; + // A class to maintain a folder-reference group-hierarchy, which together with the functionality below + // allows for breaking up sub-paths into a chain of groups. This helps with merging engines into the + // overall group-layout. + class Group : public Object { + int _childOrder; + std::map _childGroups; + std::string _treeName; + void addChildInternal(const std::string &id, const std::string &comment); + public: + Group(XCodeProvider *objectParent, const std::string &groupName, const std::string &uniqueName, const std::string &path); + void addChildFile(const std::string &name); + void addChildByHash(const std::string &hash, const std::string &name); + // Should be passed the hash for the entry + void addChildGroup(const Group* group); + void ensureChildExists(const std::string &name); + Group *getChildGroup(const std::string &name); + std::string getHashRef() const { return parent->getHash(id); } + }; + + // The path used by the root-source group + std::string _projectRoot; + // The base source group, currently also re-purposed for containing the various support-groups. + Group *_rootSourceGroup; + // Helper function to create the chain of groups for the various subfolders. Necessary as + // create_project likes to start in engines/ + 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 addBuildFile(const std::string &id, const std::string &name, const std::string &fileRefId, const std::string &comment); // All objects std::map _hashDictionnary; ValueList _defines; -- cgit v1.2.3 From 1f13d42c6b4981e26df5342e2804f3bcdf70ad73 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Thu, 9 Apr 2015 19:24:27 +0200 Subject: CREATE_PROJECT: Refactor the Framework and library adding for XCode, and add the relevant Frameworks to a group. --- devtools/create_project/xcode.cpp | 47 ++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index ab94bdc05f..4628cf9de9 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -62,15 +62,15 @@ namespace CreateProjectTool { #define REMOVE_SETTING(config, key) \ config.settings.erase(key); -#define ADD_BUILD_FILE(id, name, comment) { \ +#define ADD_BUILD_FILE(id, name, fileRefId, comment) { \ Object *buildFile = new Object(this, id, name, "PBXBuildFile", "PBXBuildFile", comment); \ - buildFile->addProperty("fileRef", getHash(name), name, SettingsNoValue); \ + buildFile->addProperty("fileRef", fileRefId, name, SettingsNoValue); \ _buildFile.add(buildFile); \ _buildFile.flags = SettingsSingleItem; \ } -#define ADD_FILE_REFERENCE(name, properties) { \ - Object *fileRef = new Object(this, name, name, "PBXFileReference", "PBXFileReference", name); \ +#define ADD_FILE_REFERENCE(id, name, properties) { \ + Object *fileRef = new Object(this, id, name, "PBXFileReference", "PBXFileReference", name); \ if (!properties.fileEncoding.empty()) fileRef->addProperty("fileEncoding", properties.fileEncoding, "", SettingsNoValue); \ if (!properties.lastKnownFileType.empty()) fileRef->addProperty("lastKnownFileType", properties.lastKnownFileType, "", SettingsNoValue|SettingsQuoteVariable); \ if (!properties.fileName.empty()) fileRef->addProperty("name", properties.fileName, "", SettingsNoValue|SettingsQuoteVariable); \ @@ -324,6 +324,9 @@ void XCodeProvider::setupCopyFilesBuildPhase() { #define DEF_SYSFRAMEWORK(framework) properties[framework".framework"] = FileProperty("wrapper.framework", framework".framework", "System/Library/Frameworks/" framework ".framework", "SDKROOT"); \ ADD_SETTING_ORDER_NOVALUE(children, getHash(framework".framework"), framework".framework", fwOrder++); +#define DEF_LOCALLIB_STATIC(lib) properties[lib".a"] = FileProperty("archive.ar", lib".a", "/opt/local/lib/" lib ".a", "\"\""); \ + ADD_SETTING_ORDER_NOVALUE(children, getHash(lib".a"), lib".a", fwOrder++); + /** * Sets up the frameworks build phase. * @@ -333,9 +336,7 @@ void XCodeProvider::setupFrameworksBuildPhase() { _frameworksBuildPhase.comment = "PBXFrameworksBuildPhase"; // Just use a hardcoded id for the Frameworks-group - Object *frameworksGroup = new Object(this, "PBXGroup_CustomTemplate_Frameworks_" , "PBXGroup", "PBXGroup", "", "CustomTemplate_Frameworks_"); - frameworksGroup->addProperty("name", "Frameworks", "", SettingsNoValue|SettingsQuoteVariable); - frameworksGroup->addProperty("sourceTree", "", "", SettingsNoValue|SettingsQuoteVariable); + Group *frameworksGroup = new Group(this, "Frameworks", "PBXGroup_CustomTemplate_Frameworks_", ""); Property children; children.hasOrder = true; @@ -359,17 +360,21 @@ void XCodeProvider::setupFrameworksBuildPhase() { DEF_SYSFRAMEWORK("QuartzCore"); DEF_SYSFRAMEWORK("QuickTime"); DEF_SYSFRAMEWORK("UIKit"); + // Optionals: + DEF_SYSFRAMEWORK("OpenGL"); + + // Local libraries + DEF_LOCALLIB_STATIC("libFLAC"); + DEF_LOCALLIB_STATIC("libmad"); + DEF_LOCALLIB_STATIC("libvorbisidec"); + DEF_LOCALLIB_STATIC("libfreetype"); +// DEF_LOCALLIB_STATIC("libmpeg2"); frameworksGroup->properties["children"] = children; _groups.add(frameworksGroup); // Force this to be added as a sub-group in the root. - _rootGroups.add(frameworksGroup); + _rootSourceGroup->addChildGroup(frameworksGroup); - // Local libraries - properties["libFLAC.a"] = FileProperty("archive.ar", "libFLAC.a", "lib/libFLAC.a", "\"\""); - properties["libmad.a"] = FileProperty("archive.ar", "libmad.a", "lib/libmad.a", "\"\""); - //properties["libmpeg2.a"] = FileProperty("archive.ar", "libmpeg2.a", "lib/libmpeg2.a", "\"\""); - properties["libvorbisidec.a"] = FileProperty("archive.ar", "libvorbisidec.a", "lib/libvorbisidec.a", "\"\""); // Declare this here, as it's used across the three targets int order = 0; @@ -404,8 +409,8 @@ void XCodeProvider::setupFrameworksBuildPhase() { std::string comment = *framework + " in Frameworks"; ADD_SETTING_ORDER_NOVALUE(iPhone_files, getHash(id), comment, order++); - ADD_BUILD_FILE(id, *framework, comment); - ADD_FILE_REFERENCE(*framework, properties[*framework]); + ADD_BUILD_FILE(id, *framework, getHash(*framework), comment); + ADD_FILE_REFERENCE(*framework, *framework, properties[*framework]); } framework_iPhone->properties["files"] = iPhone_files; @@ -437,6 +442,8 @@ void XCodeProvider::setupFrameworksBuildPhase() { frameworks_osx.push_back("IOKit.framework"); frameworks_osx.push_back("Cocoa.framework"); frameworks_osx.push_back("AudioUnit.framework"); + // Optionals: + frameworks_osx.push_back("OpenGL.framework"); order = 0; for (ValueList::iterator framework = frameworks_osx.begin(); framework != frameworks_osx.end(); framework++) { @@ -444,8 +451,8 @@ void XCodeProvider::setupFrameworksBuildPhase() { std::string comment = *framework + " in Frameworks"; ADD_SETTING_ORDER_NOVALUE(osx_files, getHash(id), comment, order++); - ADD_BUILD_FILE(id, *framework, comment); - ADD_FILE_REFERENCE(*framework, properties[*framework]); + ADD_BUILD_FILE(id, *framework, getHash(*framework), comment); + ADD_FILE_REFERENCE(*framework, *framework, properties[*framework]); } framework_OSX->properties["files"] = osx_files; @@ -479,8 +486,8 @@ void XCodeProvider::setupFrameworksBuildPhase() { std::string comment = *framework + " in Frameworks"; ADD_SETTING_ORDER_NOVALUE(simulator_files, getHash(id), comment, order++); - ADD_BUILD_FILE(id, *framework, comment); - ADD_FILE_REFERENCE(*framework, properties[*framework]); + ADD_BUILD_FILE(id, *framework, getHash(*framework), comment); + ADD_FILE_REFERENCE(*framework, *framework, properties[*framework]); } framework_simulator->properties["files"] = simulator_files; @@ -623,7 +630,7 @@ void XCodeProvider::setupResourcesBuildPhase() { ADD_SETTING_ORDER_NOVALUE(files, getHash(id), comment, order++); // TODO Fix crash when adding build file for data //ADD_BUILD_FILE(id, *file, comment); - ADD_FILE_REFERENCE(*file, properties[*file]); + ADD_FILE_REFERENCE(*file, *file, properties[*file]); } // Add custom files depending on the target -- cgit v1.2.3 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(+) 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 From 0801a553bdf7df3c1c1c116b5c8917b8e3d63610 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Thu, 9 Apr 2015 19:27:01 +0200 Subject: CREATE_PROJECT: Enable RTTI in XCode-projects. --- devtools/create_project/xcode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index ef156830e1..082fefacde 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -779,7 +779,7 @@ void XCodeProvider::setupBuildConfiguration() { ADD_SETTING_QUOTE(scummvm_Debug, "FRAMEWORK_SEARCH_PATHS", ""); ADD_SETTING(scummvm_Debug, "GCC_C_LANGUAGE_STANDARD", "c99"); ADD_SETTING(scummvm_Debug, "GCC_ENABLE_CPP_EXCEPTIONS", "NO"); - ADD_SETTING(scummvm_Debug, "GCC_ENABLE_CPP_RTTI", "NO"); + ADD_SETTING(scummvm_Debug, "GCC_ENABLE_CPP_RTTI", "YES"); ADD_SETTING(scummvm_Debug, "GCC_INPUT_FILETYPE", "automatic"); ADD_SETTING(scummvm_Debug, "GCC_OPTIMIZATION_LEVEL", "0"); ValueList scummvm_defines(_defines); @@ -834,7 +834,7 @@ void XCodeProvider::setupBuildConfiguration() { ADD_SETTING_QUOTE(scummvmOSX_Debug, "FRAMEWORK_SEARCH_PATHS", ""); ADD_SETTING(scummvmOSX_Debug, "GCC_C_LANGUAGE_STANDARD", "c99"); ADD_SETTING(scummvmOSX_Debug, "GCC_ENABLE_CPP_EXCEPTIONS", "NO"); - ADD_SETTING(scummvmOSX_Debug, "GCC_ENABLE_CPP_RTTI", "NO"); + ADD_SETTING(scummvmOSX_Debug, "GCC_ENABLE_CPP_RTTI", "YES"); ADD_SETTING(scummvmOSX_Debug, "GCC_DYNAMIC_NO_PIC", "NO"); ADD_SETTING(scummvmOSX_Debug, "GCC_ENABLE_FIX_AND_CONTINUE", "NO"); ADD_SETTING(scummvmOSX_Debug, "GCC_OPTIMIZATION_LEVEL", "0"); -- cgit v1.2.3 From 24f9c95ee958724a4d59efc4a39c1dcdbe5560de Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Thu, 9 Apr 2015 19:27:24 +0200 Subject: CREATE_PROJECT: Link against libpng and libfreetype in XCode-projects. --- devtools/create_project/xcode.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index 082fefacde..c9f0448aea 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -864,6 +864,8 @@ void XCodeProvider::setupBuildConfiguration() { ValueList scummvmOSX_LdFlags; scummvmOSX_LdFlags.push_back("-lSDLmain"); scummvmOSX_LdFlags.push_back("-logg"); + scummvmOSX_LdFlags.push_back("-lpng"); + scummvmOSX_LdFlags.push_back("-lfreetype"); scummvmOSX_LdFlags.push_back("-lvorbisfile"); scummvmOSX_LdFlags.push_back("-lvorbis"); scummvmOSX_LdFlags.push_back("-lmad"); -- cgit v1.2.3 From ff802b8eae3c9c378279e8596ca25d59c586818a Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Thu, 9 Apr 2015 19:45:47 +0200 Subject: CREATE_PROJECT: Add SRCROOT and SRCROOT/engines to USER_HEADER_SEARCH_PATHS for XCode. --- devtools/create_project/xcode.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index c9f0448aea..1406f2d766 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -773,6 +773,7 @@ void XCodeProvider::setupBuildConfiguration() { Object *scummvm_Debug_Object = new Object(this, "XCBuildConfiguration_" PROJECT_NAME "_Debug", PROJECT_NAME, "XCBuildConfiguration", "PBXProject", "Debug"); Property scummvm_Debug; ADD_SETTING(scummvm_Debug, "ALWAYS_SEARCH_USER_PATHS", "NO"); + ADD_SETTING_QUOTE(scummvm_Debug, "USER_HEADER_SEARCH_PATHS", "$(SRCROOT) $(SRCROOT)/engines"); ADD_SETTING_QUOTE(scummvm_Debug, "ARCHS", "$(ARCHS_STANDARD_32_BIT)"); ADD_SETTING_QUOTE(scummvm_Debug, "CODE_SIGN_IDENTITY", "Don't Code Sign"); ADD_SETTING_QUOTE_VAR(scummvm_Debug, "CODE_SIGN_IDENTITY[sdk=iphoneos*]", "Don't Code Sign"); -- cgit v1.2.3 From 7de2f25466b2aa227147a537c09588e37ec33c77 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Thu, 9 Apr 2015 19:48:34 +0200 Subject: CREATE_PROJECT: Remove leftover _rootGroups. --- devtools/create_project/xcode.h | 1 - 1 file changed, 1 deletion(-) diff --git a/devtools/create_project/xcode.h b/devtools/create_project/xcode.h index 7b16bd2dd1..d49be93de2 100644 --- a/devtools/create_project/xcode.h +++ b/devtools/create_project/xcode.h @@ -301,7 +301,6 @@ private: ObjectList _fileReference; ObjectList _frameworksBuildPhase; ObjectList _groups; - ObjectList _rootGroups; ObjectList _nativeTarget; ObjectList _project; ObjectList _resourcesBuildPhase; -- cgit v1.2.3 From e24737f142112776ede892c9ba4091b09dafe68c Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Thu, 9 Apr 2015 19:51:01 +0200 Subject: CREATE_PROJECT: Modify producesObjectFile to take .m and .mm into account. This should be safe outside XCode, as only OSX/iOS-projects introduce such files to begin with. --- devtools/create_project/create_project.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 2f784529bd..42f4466b5e 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -1044,7 +1044,7 @@ bool producesObjectFile(const std::string &fileName) { std::string n, ext; splitFilename(fileName, n, ext); - if (ext == "cpp" || ext == "c" || ext == "asm") + if (ext == "cpp" || ext == "c" || ext == "asm" || ext == "m" || ext == "mm") return true; else return false; -- cgit v1.2.3 From 32b245475117abe37a9f5b1002a423dfffb8d87d Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Thu, 9 Apr 2015 19:51:33 +0200 Subject: CREATE_PROJECT: Don't add -fno-rtti. --- devtools/create_project/create_project.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 42f4466b5e..2e4e53dc59 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -415,7 +415,6 @@ int main(int argc, char *argv[]) { globalWarnings.push_back("-Wwrite-strings"); // The following are not warnings at all... We should consider adding them to // a different list of parameters. - globalWarnings.push_back("-fno-rtti"); globalWarnings.push_back("-fno-exceptions"); globalWarnings.push_back("-fcheck-new"); -- cgit v1.2.3 From 21d0210758a5aac44a660f1fd017395c311eed90 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Thu, 9 Apr 2015 20:27:21 +0200 Subject: CREATE_PROJECT: Set projectDirPath to the source-path in XCode. --- devtools/create_project/xcode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index 1406f2d766..f8d7f15719 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -567,7 +567,7 @@ void XCodeProvider::setupProject() { project->properties["knownRegions"] = regions; project->addProperty("mainGroup", _rootSourceGroup->getHashRef(), "CustomTemplate", SettingsNoValue); - project->addProperty("projectDirPath", "", "", SettingsNoValue|SettingsQuoteVariable); + project->addProperty("projectDirPath", _projectRoot, "", SettingsNoValue|SettingsQuoteVariable); project->addProperty("projectRoot", "", "", SettingsNoValue|SettingsQuoteVariable); // List of targets -- cgit v1.2.3 From be35b8b12ba8424859b3381449186a3586ab62c8 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Thu, 9 Apr 2015 20:35:54 +0200 Subject: CREATE_PROJECT: Use SRCROOT-relative include paths. --- devtools/create_project/xcode.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index f8d7f15719..4c9f1cf6f1 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -731,10 +731,10 @@ void XCodeProvider::setupBuildConfiguration() { ADD_SETTING(iPhone_Debug, "GCC_THUMB_SUPPORT", "NO"); ADD_SETTING(iPhone_Debug, "GCC_UNROLL_LOOPS", "YES"); ValueList iPhone_HeaderSearchPaths; - iPhone_HeaderSearchPaths.push_back("../../engines/"); - iPhone_HeaderSearchPaths.push_back("../../"); + iPhone_HeaderSearchPaths.push_back("$(SRCROOT)/engines/"); + iPhone_HeaderSearchPaths.push_back("$(SRCROOT)"); iPhone_HeaderSearchPaths.push_back("include/"); - ADD_SETTING_LIST(iPhone_Debug, "HEADER_SEARCH_PATHS", iPhone_HeaderSearchPaths, SettingsAsList|SettingsNoQuote, 5); + ADD_SETTING_LIST(iPhone_Debug, "HEADER_SEARCH_PATHS", iPhone_HeaderSearchPaths, SettingsAsList|SettingsQuoteVariable, 5); ADD_SETTING(iPhone_Debug, "INFOPLIST_FILE", "Info.plist"); ValueList iPhone_LibPaths; iPhone_LibPaths.push_back("$(inherited)"); @@ -794,9 +794,9 @@ void XCodeProvider::setupBuildConfiguration() { ADD_SETTING(scummvm_Debug, "GCC_WARN_UNUSED_VARIABLE", "YES"); ValueList scummvm_HeaderPaths; scummvm_HeaderPaths.push_back("include/"); - scummvm_HeaderPaths.push_back("../../engines/"); - scummvm_HeaderPaths.push_back("../../"); - ADD_SETTING_LIST(scummvm_Debug, "HEADER_SEARCH_PATHS", scummvm_HeaderPaths, SettingsNoQuote|SettingsAsList, 5); + scummvm_HeaderPaths.push_back("$(SRCROOT)/engines/"); + scummvm_HeaderPaths.push_back("$(SRCROOT)"); + ADD_SETTING_LIST(scummvm_Debug, "HEADER_SEARCH_PATHS", scummvm_HeaderPaths, SettingsQuoteVariable|SettingsAsList, 5); ADD_SETTING_QUOTE(scummvm_Debug, "LIBRARY_SEARCH_PATHS", ""); ADD_SETTING(scummvm_Debug, "ONLY_ACTIVE_ARCH", "YES"); ADD_SETTING_QUOTE(scummvm_Debug, "OTHER_CFLAGS", ""); @@ -851,9 +851,9 @@ void XCodeProvider::setupBuildConfiguration() { scummvmOSX_HeaderPaths.push_back("/opt/local/include"); scummvmOSX_HeaderPaths.push_back("/opt/local/include/freetype2"); scummvmOSX_HeaderPaths.push_back("include/"); - scummvmOSX_HeaderPaths.push_back("../../engines/"); - scummvmOSX_HeaderPaths.push_back("../../"); - ADD_SETTING_LIST(scummvmOSX_Debug, "HEADER_SEARCH_PATHS", scummvmOSX_HeaderPaths, SettingsNoQuote|SettingsAsList, 5); + scummvmOSX_HeaderPaths.push_back("$(SRCROOT)/engines/"); + scummvmOSX_HeaderPaths.push_back("$(SRCROOT)"); + ADD_SETTING_LIST(scummvmOSX_Debug, "HEADER_SEARCH_PATHS", scummvmOSX_HeaderPaths, SettingsQuoteVariable|SettingsAsList, 5); ADD_SETTING_QUOTE(scummvmOSX_Debug, "INFOPLIST_FILE", "$(SRCROOT)/dists/macosx/Info.plist"); ValueList scummvmOSX_LibPaths; scummvmOSX_LibPaths.push_back("/sw/lib"); -- cgit v1.2.3 From 680b10727839f6b4ec088d9219c0384aa1240589 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Thu, 9 Apr 2015 20:39:11 +0200 Subject: CREATE_PROJECT: Link theora and jpeg in XCode-projects. --- devtools/create_project/xcode.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index 4c9f1cf6f1..3f0fb9ae3e 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -866,6 +866,8 @@ void XCodeProvider::setupBuildConfiguration() { scummvmOSX_LdFlags.push_back("-lSDLmain"); scummvmOSX_LdFlags.push_back("-logg"); scummvmOSX_LdFlags.push_back("-lpng"); + scummvmOSX_LdFlags.push_back("-ljpeg"); + scummvmOSX_LdFlags.push_back("-ltheora"); scummvmOSX_LdFlags.push_back("-lfreetype"); scummvmOSX_LdFlags.push_back("-lvorbisfile"); scummvmOSX_LdFlags.push_back("-lvorbis"); -- cgit v1.2.3 From c49fd6afeb547a25f39494745cd2bd28fd4b6834 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Thu, 9 Apr 2015 20:41:16 +0200 Subject: CREATE_PROJECT: Remove forced USE_TREMOR define on OS X. --- devtools/create_project/xcode.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index 3f0fb9ae3e..5edbb2985a 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -970,7 +970,6 @@ void XCodeProvider::setupDefines(const BuildSetup &setup) { ADD_DEFINE(_defines, "SCUMM_LITTLE_ENDIAN"); ADD_DEFINE(_defines, "UNIX"); ADD_DEFINE(_defines, "SCUMMVM"); - ADD_DEFINE(_defines, "USE_TREMOR"); } ////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3