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(-) (limited to 'devtools/create_project/xcode.cpp') 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(-) (limited to 'devtools/create_project/xcode.cpp') 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(-) (limited to 'devtools/create_project/xcode.cpp') 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(-) (limited to 'devtools/create_project/xcode.cpp') 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(-) (limited to 'devtools/create_project/xcode.cpp') 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 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(-) (limited to 'devtools/create_project/xcode.cpp') 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(-) (limited to 'devtools/create_project/xcode.cpp') 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 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(-) (limited to 'devtools/create_project/xcode.cpp') 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 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(+) (limited to 'devtools/create_project/xcode.cpp') 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 ++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 15 deletions(-) (limited to 'devtools/create_project/xcode.cpp') 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", "\"\""); -- 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(-) (limited to 'devtools/create_project/xcode.cpp') 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 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(-) (limited to 'devtools/create_project/xcode.cpp') 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 +++++++++++++++++++++++--------------- 1 file changed, 125 insertions(+), 81 deletions(-) (limited to 'devtools/create_project/xcode.cpp') 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"; -- 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(-) (limited to 'devtools/create_project/xcode.cpp') 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 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'devtools/create_project/xcode.cpp') 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() { -- 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(-) (limited to 'devtools/create_project/xcode.cpp') 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(+) (limited to 'devtools/create_project/xcode.cpp') 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(+) (limited to 'devtools/create_project/xcode.cpp') 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 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(-) (limited to 'devtools/create_project/xcode.cpp') 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(-) (limited to 'devtools/create_project/xcode.cpp') 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(+) (limited to 'devtools/create_project/xcode.cpp') 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(-) (limited to 'devtools/create_project/xcode.cpp') 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 From bf065764985cc05f6e7c098e274aea08b92fee8f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 20 Jul 2015 00:53:10 +0300 Subject: CREATE_PROJECT: Rename XCodeProvider -> XcodeProvider --- devtools/create_project/xcode.cpp | 60 +++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'devtools/create_project/xcode.cpp') diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index 5edbb2985a..49c47c54ca 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -92,7 +92,7 @@ bool producesObjectFileOnOSX(const std::string &fileName) { 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) { +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); @@ -103,7 +103,7 @@ XCodeProvider::Group::Group(XCodeProvider *objectParent, const std::string &grou _treeName = uniqueName; } -void XCodeProvider::Group::ensureChildExists(const std::string &name) { +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); @@ -113,7 +113,7 @@ void XCodeProvider::Group::ensureChildExists(const std::string &name) { } } -void XCodeProvider::Group::addChildInternal(const std::string &id, const std::string &comment) { +void XcodeProvider::Group::addChildInternal(const std::string &id, const std::string &comment) { if (properties.find("children") == properties.end()) { Property children; children.hasOrder = true; @@ -131,11 +131,11 @@ void XCodeProvider::Group::addChildInternal(const std::string &id, const std::st } -void XCodeProvider::Group::addChildGroup(const Group* group) { +void XcodeProvider::Group::addChildGroup(const Group* group) { addChildInternal(parent->getHash(group->_treeName), group->_treeName); } -void XCodeProvider::Group::addChildFile(const std::string &name) { +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, "\"\""); @@ -146,17 +146,17 @@ void XCodeProvider::Group::addChildFile(const std::string &name) { } } -void XCodeProvider::Group::addChildByHash(const std::string &hash, const std::string &name) { +void XcodeProvider::Group::addChildByHash(const std::string &hash, const std::string &name) { addChildInternal(hash, name); } -XCodeProvider::Group *XCodeProvider::Group::getChildGroup(const std::string &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) { +XcodeProvider::Group *XcodeProvider::touchGroupsForPath(const std::string &path) { if (_rootSourceGroup == nullptr) { assert (path == _projectRoot); _rootSourceGroup = new Group(this, "Sources", path, path); @@ -178,7 +178,7 @@ XCodeProvider::Group *XCodeProvider::touchGroupsForPath(const std::string &path) } } -void XCodeProvider::addFileReference(const std::string &id, const std::string &name, FileProperty properties) { +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); @@ -189,7 +189,7 @@ 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) { +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); @@ -199,7 +199,7 @@ void XCodeProvider::addProductFileReference(const std::string &id, const std::st _fileReference.flags = SettingsSingleItem; } -void XCodeProvider::addBuildFile(const std::string &id, const std::string &name, const std::string &fileRefId, const std::string &comment) { +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); @@ -207,12 +207,12 @@ void XCodeProvider::addBuildFile(const std::string &id, const std::string &name, _buildFile.flags = SettingsSingleItem; } -XCodeProvider::XCodeProvider(StringList &global_warnings, std::map &project_warnings, const int version) +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) { +void XcodeProvider::createWorkspace(const BuildSetup &setup) { // Create project folder std::string workspace = setup.outputDir + '/' + PROJECT_NAME ".xcodeproj"; createDirectory(workspace); @@ -238,7 +238,7 @@ void XCodeProvider::createWorkspace(const BuildSetup &setup) { // We are done with constructing all the object graph and we got through every project, output the main project file // (this is kind of a hack since other providers use separate project files) -void XCodeProvider::createOtherBuildFiles(const BuildSetup &setup) { +void XcodeProvider::createOtherBuildFiles(const BuildSetup &setup) { // This needs to be done at the end when all build files have been accounted for setupSourcesBuildPhase(); @@ -246,7 +246,7 @@ void XCodeProvider::createOtherBuildFiles(const BuildSetup &setup) { } // Store information about a project here, for use at the end -void XCodeProvider::createProjectFile(const std::string &, const std::string &, const BuildSetup &setup, const std::string &moduleDir, +void XcodeProvider::createProjectFile(const std::string &, const std::string &, const BuildSetup &setup, const std::string &moduleDir, const StringList &includeList, const StringList &excludeList) { std::string modulePath; if (!moduleDir.compare(0, setup.srcDir.size(), setup.srcDir)) { @@ -265,7 +265,7 @@ void XCodeProvider::createProjectFile(const std::string &, const std::string &, ////////////////////////////////////////////////////////////////////////// // Main Project file ////////////////////////////////////////////////////////////////////////// -void XCodeProvider::ouputMainProjectFile(const BuildSetup &setup) { +void XcodeProvider::ouputMainProjectFile(const BuildSetup &setup) { std::ofstream project((setup.outputDir + '/' + PROJECT_NAME ".xcodeproj" + '/' + "project.pbxproj").c_str()); if (!project) error("Could not open \"" + setup.outputDir + '/' + PROJECT_NAME ".xcodeproj" + '/' + "project.pbxproj\" for writing"); @@ -305,7 +305,7 @@ void XCodeProvider::ouputMainProjectFile(const BuildSetup &setup) { ////////////////////////////////////////////////////////////////////////// // Files ////////////////////////////////////////////////////////////////////////// -void XCodeProvider::writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation, +void XcodeProvider::writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation, const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix) { // Ensure that top-level groups are generated for i.e. engines/ @@ -327,7 +327,7 @@ void XCodeProvider::writeFileListToProject(const FileNode &dir, std::ofstream &p ////////////////////////////////////////////////////////////////////////// // Setup functions ////////////////////////////////////////////////////////////////////////// -void XCodeProvider::setupCopyFilesBuildPhase() { +void XcodeProvider::setupCopyFilesBuildPhase() { // Nothing to do here } @@ -342,7 +342,7 @@ void XCodeProvider::setupCopyFilesBuildPhase() { * * (each native target has different build rules) */ -void XCodeProvider::setupFrameworksBuildPhase() { +void XcodeProvider::setupFrameworksBuildPhase() { _frameworksBuildPhase.comment = "PBXFrameworksBuildPhase"; // Just use a hardcoded id for the Frameworks-group @@ -506,7 +506,7 @@ void XCodeProvider::setupFrameworksBuildPhase() { #endif } -void XCodeProvider::setupNativeTarget() { +void XcodeProvider::setupNativeTarget() { _nativeTarget.comment = "PBXNativeTarget"; // Just use a hardcoded id for the Products-group @@ -547,7 +547,7 @@ void XCodeProvider::setupNativeTarget() { _groups.add(productsGroup); } -void XCodeProvider::setupProject() { +void XcodeProvider::setupProject() { _project.comment = "PBXProject"; Object *project = new Object(this, "PBXProject", "PBXProject", "PBXProject", "", "Project object"); @@ -589,7 +589,7 @@ void XCodeProvider::setupProject() { _project.add(project); } -void XCodeProvider::setupResourcesBuildPhase() { +void XcodeProvider::setupResourcesBuildPhase() { _resourcesBuildPhase.comment = "PBXResourcesBuildPhase"; // Setup resource file properties @@ -666,7 +666,7 @@ void XCodeProvider::setupResourcesBuildPhase() { } } -void XCodeProvider::setupSourcesBuildPhase() { +void XcodeProvider::setupSourcesBuildPhase() { _sourcesBuildPhase.comment = "PBXSourcesBuildPhase"; // Setup source file properties @@ -700,7 +700,7 @@ void XCodeProvider::setupSourcesBuildPhase() { } // Setup all build configurations -void XCodeProvider::setupBuildConfiguration() { +void XcodeProvider::setupBuildConfiguration() { _buildConfiguration.comment = "XCBuildConfiguration"; _buildConfiguration.flags = SettingsAsList; @@ -956,7 +956,7 @@ void XCodeProvider::setupBuildConfiguration() { ////////////////////////////////////////////////////////////////////////// // Setup global defines -void XCodeProvider::setupDefines(const BuildSetup &setup) { +void XcodeProvider::setupDefines(const BuildSetup &setup) { for (StringList::const_iterator i = setup.defines.begin(); i != setup.defines.end(); ++i) { if (*i == "HAVE_NASM") // Not supported on Mac (TODO: change how it's handled in main class or add it only in MSVC/CodeBlocks providers?) @@ -977,7 +977,7 @@ void XCodeProvider::setupDefines(const BuildSetup &setup) { ////////////////////////////////////////////////////////////////////////// // TODO use md5 to compute a file hash (and fall back to standard key generation if not passed a file) -std::string XCodeProvider::getHash(std::string key) { +std::string XcodeProvider::getHash(std::string key) { #if DEBUG_XCODE_HASH return key; @@ -997,7 +997,7 @@ std::string XCodeProvider::getHash(std::string key) { bool isSeparator (char s) { return (s == '-'); } -std::string XCodeProvider::newHash() const { +std::string XcodeProvider::newHash() const { std::string hash = createUUID(); // Remove { and - from UUID and resize to 96-bits uppercase hex string @@ -1029,7 +1029,7 @@ std::string replace(std::string input, const std::string find, std::string repla return input; } -std::string XCodeProvider::writeProperty(const std::string &variable, Property &prop, int flags) const { +std::string XcodeProvider::writeProperty(const std::string &variable, Property &prop, int flags) const { std::string output; output += (flags & SettingsSingleItem ? "" : "\t\t\t") + variable + " = "; @@ -1060,13 +1060,13 @@ std::string XCodeProvider::writeProperty(const std::string &variable, Property & return output; } -std::string XCodeProvider::writeSetting(const std::string &variable, std::string value, std::string comment, int flags, int indent) const { +std::string XcodeProvider::writeSetting(const std::string &variable, std::string value, std::string comment, int flags, int indent) const { return writeSetting(variable, Setting(value, comment, flags, indent)); } // Heavily modified (not in a good way) function, imported from the QMake // XCode project generator pbuilder_pbx.cpp, writeSettings() (under LGPL 2.1) -std::string XCodeProvider::writeSetting(const std::string &variable, const Setting &setting) const { +std::string XcodeProvider::writeSetting(const std::string &variable, const Setting &setting) const { std::string output; const std::string quote = (setting.flags & SettingsNoQuote) ? "" : "\""; const std::string escape_quote = quote.empty() ? "" : "\\" + quote; -- cgit v1.2.3 From 23471eeb5306548878aedf75524ffba0af94cd61 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 20 Jul 2015 00:55:11 +0300 Subject: CREATE_PROJECT: Use NULL instead of nullptr This allows create_project to be built with the C99 standard, instead of C11 --- devtools/create_project/xcode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'devtools/create_project/xcode.cpp') diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index 49c47c54ca..babd530ad7 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -157,7 +157,7 @@ XcodeProvider::Group *XcodeProvider::Group::getChildGroup(const std::string &nam } XcodeProvider::Group *XcodeProvider::touchGroupsForPath(const std::string &path) { - if (_rootSourceGroup == nullptr) { + if (_rootSourceGroup == NULL) { assert (path == _projectRoot); _rootSourceGroup = new Group(this, "Sources", path, path); _groups.add(_rootSourceGroup); -- cgit v1.2.3