IOS: Merge master

This commit is contained in:
Vincent Bénony 2016-01-06 16:19:03 +01:00
commit 64f50761ec
147 changed files with 3109 additions and 4591 deletions

View file

@ -49,42 +49,42 @@ namespace CreateProjectTool {
(std::find(defines.begin(), defines.end(), name) != defines.end())
#define ADD_SETTING(config, key, value) \
config.settings[key] = Setting(value, "", SettingsNoQuote);
config._settings[key] = Setting(value, "", kSettingsNoQuote);
#define ADD_SETTING_ORDER(config, key, value, order) \
config.settings[key] = Setting(value, "", SettingsNoQuote, 0, order);
#define ADD_SETTING_ORDER_NOVALUE(config, key, comment, order) \
config.settings[key] = Setting("", comment, SettingsNoValue, 0, order);
config._settings[key] = Setting("", comment, kSettingsNoValue, 0, order);
#define ADD_SETTING_QUOTE(config, key, value) \
config.settings[key] = Setting(value);
config._settings[key] = Setting(value);
#define ADD_SETTING_QUOTE_VAR(config, key, value) \
config.settings[key] = Setting(value, "", SettingsQuoteVariable);
config._settings[key] = Setting(value, "", kSettingsQuoteVariable);
#define ADD_SETTING_LIST(config, key, values, flags, indent) \
config.settings[key] = Setting(values, flags, indent);
config._settings[key] = Setting(values, flags, indent);
#define REMOVE_SETTING(config, key) \
config.settings.erase(key);
config._settings.erase(key);
#define ADD_BUILD_FILE(id, name, fileRefId, comment) { \
Object *buildFile = new Object(this, id, name, "PBXBuildFile", "PBXBuildFile", comment); \
buildFile->addProperty("fileRef", fileRefId, name, SettingsNoValue); \
buildFile->addProperty("fileRef", fileRefId, name, kSettingsNoValue); \
_buildFile.add(buildFile); \
_buildFile.flags = SettingsSingleItem; \
_buildFile._flags = kSettingsSingleItem; \
}
#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); \
if (!properties.filePath.empty()) fileRef->addProperty("path", properties.filePath, "", SettingsNoValue|SettingsQuoteVariable); \
if (!properties.sourceTree.empty()) fileRef->addProperty("sourceTree", properties.sourceTree, "", SettingsNoValue); \
if (!properties._fileEncoding.empty()) fileRef->addProperty("fileEncoding", properties._fileEncoding, "", kSettingsNoValue); \
if (!properties._lastKnownFileType.empty()) fileRef->addProperty("lastKnownFileType", properties._lastKnownFileType, "", kSettingsNoValue|kSettingsQuoteVariable); \
if (!properties._fileName.empty()) fileRef->addProperty("name", properties._fileName, "", kSettingsNoValue|kSettingsQuoteVariable); \
if (!properties._filePath.empty()) fileRef->addProperty("path", properties._filePath, "", kSettingsNoValue|kSettingsQuoteVariable); \
if (!properties._sourceTree.empty()) fileRef->addProperty("sourceTree", properties._sourceTree, "", kSettingsNoValue); \
_fileReference.add(fileRef); \
_fileReference.flags = SettingsSingleItem; \
_fileReference._flags = kSettingsSingleItem; \
}
bool producesObjectFileOnOSX(const std::string &fileName) {
@ -152,11 +152,11 @@ bool shouldSkipFileForTarget(const std::string &fileID, const std::string &targe
XcodeProvider::Group::Group(XcodeProvider *objectParent, const std::string &groupName, const std::string &uniqueName, const std::string &path) : Object(objectParent, uniqueName, groupName, "PBXGroup", "", groupName) {
bool path_is_absolute = (path.length() > 0 && path.at(0) == '/');
addProperty("name", name, "", SettingsNoValue|SettingsQuoteVariable);
addProperty("sourceTree", path_is_absolute ? "<absolute>" : "<group>", "", SettingsNoValue|SettingsQuoteVariable);
addProperty("name", _name, "", kSettingsNoValue | kSettingsQuoteVariable);
addProperty("sourceTree", path_is_absolute ? "<absolute>" : "<group>", "", kSettingsNoValue | kSettingsQuoteVariable);
if (path != "") {
addProperty("path", path, "", SettingsNoValue|SettingsQuoteVariable);
addProperty("path", path, "", kSettingsNoValue | kSettingsQuoteVariable);
}
_childOrder = 0;
_treeName = uniqueName;
@ -165,43 +165,43 @@ XcodeProvider::Group::Group(XcodeProvider *objectParent, const std::string &grou
void XcodeProvider::Group::ensureChildExists(const std::string &name) {
std::map<std::string, Group*>::iterator it = _childGroups.find(name);
if (it == _childGroups.end()) {
Group *child = new Group(parent, name, this->_treeName + '/' + name, name);
Group *child = new Group(_parent, name, this->_treeName + '/' + name, name);
_childGroups[name] = child;
addChildGroup(child);
parent->_groups.add(child);
_parent->_groups.add(child);
}
}
void XcodeProvider::Group::addChildInternal(const std::string &id, const std::string &comment) {
if (properties.find("children") == properties.end()) {
if (_properties.find("children") == _properties.end()) {
Property children;
children.hasOrder = true;
children.flags = SettingsAsList;
properties["children"] = children;
children._hasOrder = true;
children._flags = kSettingsAsList;
_properties["children"] = children;
}
properties["children"].settings[id] = Setting("", comment + " in Sources", SettingsNoValue, 0, _childOrder++);
_properties["children"]._settings[id] = Setting("", comment + " in Sources", kSettingsNoValue, 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;
_properties["children"]._flags |= kSettingsSingleItem;
} else {
properties["children"].flags ^= SettingsSingleItem;
_properties["children"]._flags ^= kSettingsSingleItem;
}
}
void XcodeProvider::Group::addChildGroup(const Group* group) {
addChildInternal(parent->getHash(group->_treeName), group->_treeName);
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);
addChildInternal(_parent->getHash(id), name);
FileProperty property = FileProperty(name, name, name, "\"<group>\"");
parent->addFileReference(id, name, property);
_parent->addFileReference(id, name, property);
if (producesObjectFileOnOSX(name)) {
parent->addBuildFile(_treeName + "/" + name, name, parent->getHash(id), name + " in Sources");
_parent->addBuildFile(_treeName + "/" + name, name, _parent->getHash(id), name + " in Sources");
}
}
@ -210,14 +210,14 @@ void XcodeProvider::Group::addChildByHash(const std::string &hash, const std::st
}
XcodeProvider::Group *XcodeProvider::Group::getChildGroup(const std::string &name) {
std::map<std::string, Group*>::iterator it = _childGroups.find(name);
std::map<std::string, Group *>::iterator it = _childGroups.find(name);
assert(it != _childGroups.end());
return it->second;
}
XcodeProvider::Group *XcodeProvider::touchGroupsForPath(const std::string &path) {
if (_rootSourceGroup == NULL) {
assert (path == _projectRoot);
assert(path == _projectRoot);
_rootSourceGroup = new Group(this, "Sources", path, path);
_groups.add(_rootSourceGroup);
return _rootSourceGroup;
@ -239,31 +239,31 @@ XcodeProvider::Group *XcodeProvider::touchGroupsForPath(const std::string &path)
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);
if (!properties._fileEncoding.empty()) fileRef->addProperty("fileEncoding", properties._fileEncoding, "", kSettingsNoValue);
if (!properties._lastKnownFileType.empty()) fileRef->addProperty("lastKnownFileType", properties._lastKnownFileType, "", kSettingsNoValue | kSettingsQuoteVariable);
if (!properties._fileName.empty()) fileRef->addProperty("name", properties._fileName, "", kSettingsNoValue | kSettingsQuoteVariable);
if (!properties._filePath.empty()) fileRef->addProperty("path", properties._filePath, "", kSettingsNoValue | kSettingsQuoteVariable);
if (!properties._sourceTree.empty()) fileRef->addProperty("sourceTree", properties._sourceTree, "", kSettingsNoValue);
_fileReference.add(fileRef);
_fileReference.flags = SettingsSingleItem;
_fileReference._flags = kSettingsSingleItem;
}
void XcodeProvider::addProductFileReference(const std::string &id, const std::string &name) {
Object *fileRef = new Object(this, id, name, "PBXFileReference", "PBXFileReference", name);
fileRef->addProperty("explicitFileType", "wrapper.application", "", SettingsNoValue|SettingsQuoteVariable);
fileRef->addProperty("includeInIndex", "0", "", SettingsNoValue);
fileRef->addProperty("path", name, "", SettingsNoValue|SettingsQuoteVariable);
fileRef->addProperty("sourceTree", "BUILT_PRODUCTS_DIR", "", SettingsNoValue);
fileRef->addProperty("explicitFileType", "wrapper.application", "", kSettingsNoValue | kSettingsQuoteVariable);
fileRef->addProperty("includeInIndex", "0", "", kSettingsNoValue);
fileRef->addProperty("path", name, "", kSettingsNoValue | kSettingsQuoteVariable);
fileRef->addProperty("sourceTree", "BUILT_PRODUCTS_DIR", "", kSettingsNoValue);
_fileReference.add(fileRef);
_fileReference.flags = SettingsSingleItem;
_fileReference._flags = kSettingsSingleItem;
}
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->addProperty("fileRef", fileRefId, name, kSettingsNoValue);
_buildFile.add(buildFile);
_buildFile.flags = SettingsSingleItem;
_buildFile._flags = kSettingsSingleItem;
}
XcodeProvider::XcodeProvider(StringList &global_warnings, std::map<std::string, StringList> &project_warnings, const int version)
@ -289,7 +289,7 @@ void XcodeProvider::createWorkspace(const BuildSetup &setup) {
createDirectory(workspace);
_projectRoot = setup.srcDir;
touchGroupsForPath(_projectRoot);
// Setup global objects
setupDefines(setup);
_targets.push_back(PROJECT_DESCRIPTION "-iOS");
@ -341,10 +341,10 @@ void XcodeProvider::ouputMainProjectFile(const BuildSetup &setup) {
// Header
project << "// !$*UTF8*$!\n"
"{\n"
"\t" << writeSetting("archiveVersion", "1", "", SettingsNoQuote) << ";\n"
"\t" << writeSetting("archiveVersion", "1", "", kSettingsNoQuote) << ";\n"
"\tclasses = {\n"
"\t};\n"
"\t" << writeSetting("objectVersion", "46", "", SettingsNoQuote) << ";\n"
"\t" << writeSetting("objectVersion", "46", "", kSettingsNoQuote) << ";\n"
"\tobjects = {\n";
//////////////////////////////////////////////////////////////////////////
@ -364,7 +364,7 @@ void XcodeProvider::ouputMainProjectFile(const BuildSetup &setup) {
//////////////////////////////////////////////////////////////////////////
// Footer
project << "\t};\n"
"\t" << writeSetting("rootObject", getHash("PBXProject"), "Project object", SettingsNoQuote) << ";\n"
"\t" << writeSetting("rootObject", getHash("PBXProject"), "Project object", kSettingsNoQuote) << ";\n"
"}\n";
}
@ -416,14 +416,14 @@ void XcodeProvider::setupCopyFilesBuildPhase() {
* (each native target has different build rules)
*/
void XcodeProvider::setupFrameworksBuildPhase(const BuildSetup &setup) {
_frameworksBuildPhase.comment = "PBXFrameworksBuildPhase";
_frameworksBuildPhase._comment = "PBXFrameworksBuildPhase";
// Just use a hardcoded id for the Frameworks-group
Group *frameworksGroup = new Group(this, "Frameworks", "PBXGroup_CustomTemplate_Frameworks_", "");
Property children;
children.hasOrder = true;
children.flags = SettingsAsList;
children._hasOrder = true;
children._flags = kSettingsAsList;
// Setup framework file properties
std::map<std::string, FileProperty> properties;
@ -476,7 +476,7 @@ void XcodeProvider::setupFrameworksBuildPhase(const BuildSetup &setup) {
DEF_LOCALLIB_STATIC_PATH(absoluteOutputDir + "/libfluidsynth.a", "libfluidsynth", true);
DEF_LOCALLIB_STATIC_PATH(absoluteOutputDir + "/libglib.a", "libglib", true);
frameworksGroup->properties["children"] = children;
frameworksGroup->_properties["children"] = children;
_groups.add(frameworksGroup);
// Force this to be added as a sub-group in the root.
_rootSourceGroup->addChildGroup(frameworksGroup);
@ -489,13 +489,13 @@ void XcodeProvider::setupFrameworksBuildPhase(const BuildSetup &setup) {
// ScummVM-iOS
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);
framework_iPhone->addProperty("buildActionMask", "2147483647", "", kSettingsNoValue);
framework_iPhone->addProperty("runOnlyForDeploymentPostprocessing", "0", "", kSettingsNoValue);
// List of frameworks
Property iOS_files;
iOS_files.hasOrder = true;
iOS_files.flags = SettingsAsList;
iOS_files._hasOrder = true;
iOS_files._flags = kSettingsAsList;
ValueList frameworks_iOS;
frameworks_iOS.push_back("CoreAudio.framework");
@ -539,7 +539,7 @@ void XcodeProvider::setupFrameworksBuildPhase(const BuildSetup &setup) {
ADD_FILE_REFERENCE(*framework, *framework, properties[*framework]);
}
framework_iPhone->properties["files"] = iOS_files;
framework_iPhone->_properties["files"] = iOS_files;
_frameworksBuildPhase.add(framework_iPhone);
@ -547,13 +547,13 @@ void XcodeProvider::setupFrameworksBuildPhase(const BuildSetup &setup) {
// ScummVM-OS X
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);
framework_OSX->addProperty("buildActionMask", "2147483647", "", kSettingsNoValue);
framework_OSX->addProperty("runOnlyForDeploymentPostprocessing", "0", "", kSettingsNoValue);
// List of frameworks
Property osx_files;
osx_files.hasOrder = true;
osx_files.flags = SettingsAsList;
osx_files._hasOrder = true;
osx_files._flags = kSettingsAsList;
ValueList frameworks_osx;
frameworks_osx.push_back("CoreFoundation.framework");
@ -581,13 +581,13 @@ void XcodeProvider::setupFrameworksBuildPhase(const BuildSetup &setup) {
ADD_FILE_REFERENCE(*framework, *framework, properties[*framework]);
}
framework_OSX->properties["files"] = osx_files;
framework_OSX->_properties["files"] = osx_files;
_frameworksBuildPhase.add(framework_OSX);
}
void XcodeProvider::setupNativeTarget() {
_nativeTarget.comment = "PBXNativeTarget";
_nativeTarget._comment = "PBXNativeTarget";
// Just use a hardcoded id for the Products-group
Group *productsGroup = new Group(this, "Products", "PBXGroup_CustomTemplate_Products_" , "");
@ -595,26 +595,26 @@ void XcodeProvider::setupNativeTarget() {
for (unsigned int i = 0; i < _targets.size(); i++) {
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);
target->addProperty("buildConfigurationList", getHash("XCConfigurationList_" + _targets[i]), "Build configuration list for PBXNativeTarget \"" + _targets[i] + "\"", kSettingsNoValue);
Property buildPhases;
buildPhases.hasOrder = true;
buildPhases.flags = SettingsAsList;
buildPhases.settings[getHash("PBXResourcesBuildPhase_" + _targets[i])] = Setting("", "Resources", SettingsNoValue, 0, 0);
buildPhases.settings[getHash("PBXSourcesBuildPhase_" + _targets[i])] = Setting("", "Sources", SettingsNoValue, 0, 1);
buildPhases.settings[getHash("PBXFrameworksBuildPhase_" + _targets[i])] = Setting("", "Frameworks", SettingsNoValue, 0, 2);
target->properties["buildPhases"] = buildPhases;
buildPhases._hasOrder = true;
buildPhases._flags = kSettingsAsList;
buildPhases._settings[getHash("PBXResourcesBuildPhase_" + _targets[i])] = Setting("", "Resources", kSettingsNoValue, 0, 0);
buildPhases._settings[getHash("PBXSourcesBuildPhase_" + _targets[i])] = Setting("", "Sources", kSettingsNoValue, 0, 1);
buildPhases._settings[getHash("PBXFrameworksBuildPhase_" + _targets[i])] = Setting("", "Frameworks", kSettingsNoValue, 0, 2);
target->_properties["buildPhases"] = buildPhases;
target->addProperty("buildRules", "", "", SettingsNoValue|SettingsAsList);
target->addProperty("buildRules", "", "", kSettingsNoValue | kSettingsAsList);
target->addProperty("dependencies", "", "", SettingsNoValue|SettingsAsList);
target->addProperty("dependencies", "", "", kSettingsNoValue | kSettingsAsList);
target->addProperty("name", _targets[i], "", SettingsNoValue|SettingsQuoteVariable);
target->addProperty("productName", PROJECT_NAME, "", SettingsNoValue);
target->addProperty("name", _targets[i], "", kSettingsNoValue | kSettingsQuoteVariable);
target->addProperty("productName", PROJECT_NAME, "", kSettingsNoValue);
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);
target->addProperty("productReference", getHash("PBXFileReference_" PROJECT_DESCRIPTION ".app_" + _targets[i]), PROJECT_DESCRIPTION ".app", kSettingsNoValue);
target->addProperty("productType", "com.apple.product-type.application", "", kSettingsNoValue | kSettingsQuoteVariable);
_nativeTarget.add(target);
}
@ -623,38 +623,38 @@ void XcodeProvider::setupNativeTarget() {
}
void XcodeProvider::setupProject() {
_project.comment = "PBXProject";
_project._comment = "PBXProject";
Object *project = new Object(this, "PBXProject", "PBXProject", "PBXProject", "", "Project object");
project->addProperty("buildConfigurationList", getHash("XCConfigurationList_scummvm"), "Build configuration list for PBXProject \"" PROJECT_NAME "\"", SettingsNoValue);
project->addProperty("compatibilityVersion", "Xcode 3.2", "", SettingsNoValue|SettingsQuoteVariable);
project->addProperty("developmentRegion", "English", "", SettingsNoValue);
project->addProperty("hasScannedForEncodings", "1", "", SettingsNoValue);
project->addProperty("buildConfigurationList", getHash("XCConfigurationList_scummvm"), "Build configuration list for PBXProject \"" PROJECT_NAME "\"", kSettingsNoValue);
project->addProperty("compatibilityVersion", "Xcode 3.2", "", kSettingsNoValue | kSettingsQuoteVariable);
project->addProperty("developmentRegion", "English", "", kSettingsNoValue);
project->addProperty("hasScannedForEncodings", "1", "", kSettingsNoValue);
// List of known regions
Property regions;
regions.flags = SettingsAsList;
regions._flags = kSettingsAsList;
ADD_SETTING_ORDER_NOVALUE(regions, "English", "", 0);
ADD_SETTING_ORDER_NOVALUE(regions, "Japanese", "", 1);
ADD_SETTING_ORDER_NOVALUE(regions, "French", "", 2);
ADD_SETTING_ORDER_NOVALUE(regions, "German", "", 3);
project->properties["knownRegions"] = regions;
project->_properties["knownRegions"] = regions;
project->addProperty("mainGroup", _rootSourceGroup->getHashRef(), "CustomTemplate", SettingsNoValue);
project->addProperty("productRefGroup", getHash("PBXGroup_CustomTemplate_Products_"), "" , SettingsNoValue);
project->addProperty("projectDirPath", _projectRoot, "", SettingsNoValue|SettingsQuoteVariable);
project->addProperty("projectRoot", "", "", SettingsNoValue|SettingsQuoteVariable);
project->addProperty("mainGroup", _rootSourceGroup->getHashRef(), "CustomTemplate", kSettingsNoValue);
project->addProperty("productRefGroup", getHash("PBXGroup_CustomTemplate_Products_"), "" , kSettingsNoValue);
project->addProperty("projectDirPath", _projectRoot, "", kSettingsNoValue | kSettingsQuoteVariable);
project->addProperty("projectRoot", "", "", kSettingsNoValue | kSettingsQuoteVariable);
// List of targets
Property targets;
targets.flags = SettingsAsList;
targets.settings[getHash("PBXNativeTarget_" + _targets[IOS_TARGET])] = Setting("", _targets[IOS_TARGET], SettingsNoValue, 0, 0);
targets.settings[getHash("PBXNativeTarget_" + _targets[OSX_TARGET])] = Setting("", _targets[OSX_TARGET], SettingsNoValue, 0, 1);
project->properties["targets"] = targets;
targets._flags = kSettingsAsList;
targets._settings[getHash("PBXNativeTarget_" + _targets[IOS_TARGET])] = Setting("", _targets[IOS_TARGET], kSettingsNoValue, 0, 0);
targets._settings[getHash("PBXNativeTarget_" + _targets[OSX_TARGET])] = Setting("", _targets[OSX_TARGET], kSettingsNoValue, 0, 1);
project->_properties["targets"] = targets;
// Force list even when there is only a single target
project->properties["targets"].flags |= SettingsSingleItem;
project->_properties["targets"]._flags |= kSettingsSingleItem;
_project.add(project);
}
@ -684,7 +684,7 @@ XcodeProvider::ValueList& XcodeProvider::getResourceFiles() const {
}
void XcodeProvider::setupResourcesBuildPhase() {
_resourcesBuildPhase.comment = "PBXResourcesBuildPhase";
_resourcesBuildPhase._comment = "PBXResourcesBuildPhase";
ValueList &files_list = getResourceFiles();
@ -692,12 +692,12 @@ void XcodeProvider::setupResourcesBuildPhase() {
for (unsigned int i = 0; i < _targets.size(); i++) {
Object *resource = new Object(this, "PBXResourcesBuildPhase_" + _targets[i], "PBXResourcesBuildPhase", "PBXResourcesBuildPhase", "", "Resources");
resource->addProperty("buildActionMask", "2147483647", "", SettingsNoValue);
resource->addProperty("buildActionMask", "2147483647", "", kSettingsNoValue);
// Add default files
Property files;
files.hasOrder = true;
files.flags = SettingsAsList;
files._hasOrder = true;
files._flags = kSettingsAsList;
int order = 0;
for (ValueList::iterator file = files_list.begin(); file != files_list.end(); file++) {
@ -712,46 +712,46 @@ void XcodeProvider::setupResourcesBuildPhase() {
ADD_SETTING_ORDER_NOVALUE(files, getHash(resourceAbsolutePath), comment, order++);
}
resource->properties["files"] = files;
resource->_properties["files"] = files;
resource->addProperty("runOnlyForDeploymentPostprocessing", "0", "", SettingsNoValue);
resource->addProperty("runOnlyForDeploymentPostprocessing", "0", "", kSettingsNoValue);
_resourcesBuildPhase.add(resource);
}
}
void XcodeProvider::setupSourcesBuildPhase() {
_sourcesBuildPhase.comment = "PBXSourcesBuildPhase";
_sourcesBuildPhase._comment = "PBXSourcesBuildPhase";
// Same as for containers: a rule for each native target
for (unsigned int i = 0; i < _targets.size(); i++) {
const std::string &targetName = _targets[i];
Object *source = new Object(this, "PBXSourcesBuildPhase_" + _targets[i], "PBXSourcesBuildPhase", "PBXSourcesBuildPhase", "", "Sources");
source->addProperty("buildActionMask", "2147483647", "", SettingsNoValue);
source->addProperty("buildActionMask", "2147483647", "", kSettingsNoValue);
Property files;
files.hasOrder = true;
files.flags = SettingsAsList;
files._hasOrder = true;
files._flags = kSettingsAsList;
int order = 0;
for (std::vector<Object*>::iterator file = _buildFile.objects.begin(); file !=_buildFile.objects.end(); ++file) {
const std::string &fileName = (*file)->name;
if (shouldSkipFileForTarget((*file)->id, targetName, fileName)) {
for (std::vector<Object *>::iterator file = _buildFile._objects.begin(); file != _buildFile._objects.end(); ++file) {
const std::string &fileName = (*file)->_name;
if (shouldSkipFileForTarget((*file)->_id, targetName, fileName)) {
continue;
}
if (!producesObjectFileOnOSX(fileName)) {
continue;
}
std::string comment = fileName + " in Sources";
ADD_SETTING_ORDER_NOVALUE(files, getHash((*file)->id), comment, order++);
ADD_SETTING_ORDER_NOVALUE(files, getHash((*file)->_id), comment, order++);
}
setupAdditionalSources(targetName, files, order);
source->properties["files"] = files;
source->_properties["files"] = files;
source->addProperty("runOnlyForDeploymentPostprocessing", "0", "", SettingsNoValue);
source->addProperty("runOnlyForDeploymentPostprocessing", "0", "", kSettingsNoValue);
_sourcesBuildPhase.add(source);
}
@ -760,8 +760,8 @@ void XcodeProvider::setupSourcesBuildPhase() {
// Setup all build configurations
void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
_buildConfiguration.comment = "XCBuildConfiguration";
_buildConfiguration.flags = SettingsAsList;
_buildConfiguration._comment = "XCBuildConfiguration";
_buildConfiguration._flags = kSettingsAsList;
std::string projectOutputDirectory;
#ifdef POSIX
@ -792,7 +792,7 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
REMOVE_DEFINE(scummvm_defines, "IPHONE");
REMOVE_DEFINE(scummvm_defines, "IPHONE_OFFICIAL");
REMOVE_DEFINE(scummvm_defines, "SDL_BACKEND");
ADD_SETTING_LIST(scummvm_Debug, "GCC_PREPROCESSOR_DEFINITIONS", scummvm_defines, SettingsNoQuote|SettingsAsList, 5);
ADD_SETTING_LIST(scummvm_Debug, "GCC_PREPROCESSOR_DEFINITIONS", scummvm_defines, kSettingsNoQuote | kSettingsAsList, 5);
ADD_SETTING(scummvm_Debug, "GCC_THUMB_SUPPORT", "NO");
ADD_SETTING(scummvm_Debug, "GCC_USE_GCC3_PFE_SUPPORT", "NO");
ADD_SETTING(scummvm_Debug, "GCC_WARN_ABOUT_RETURN_TYPE", "YES");
@ -801,7 +801,7 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
scummvm_HeaderPaths.push_back("include/");
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_LIST(scummvm_Debug, "HEADER_SEARCH_PATHS", scummvm_HeaderPaths, kSettingsQuoteVariable | kSettingsAsList, 5);
ADD_SETTING_QUOTE(scummvm_Debug, "LIBRARY_SEARCH_PATHS", "");
ADD_SETTING(scummvm_Debug, "ONLY_ACTIVE_ARCH", "YES");
ADD_SETTING_QUOTE(scummvm_Debug, "OTHER_CFLAGS", "");
@ -809,8 +809,8 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
ADD_SETTING(scummvm_Debug, "PREBINDING", "NO");
ADD_SETTING(scummvm_Debug, "ENABLE_TESTABILITY", "YES");
scummvm_Debug_Object->addProperty("name", "Debug", "", SettingsNoValue);
scummvm_Debug_Object->properties["buildSettings"] = scummvm_Debug;
scummvm_Debug_Object->addProperty("name", "Debug", "", kSettingsNoValue);
scummvm_Debug_Object->_properties["buildSettings"] = scummvm_Debug;
// Release
Object *scummvm_Release_Object = new Object(this, "XCBuildConfiguration_" PROJECT_NAME "_Release", PROJECT_NAME, "XCBuildConfiguration", "PBXProject", "Release");
@ -821,8 +821,8 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
REMOVE_SETTING(scummvm_Release, "ONLY_ACTIVE_ARCH");
REMOVE_SETTING(scummvm_Release, "ENABLE_TESTABILITY");
scummvm_Release_Object->addProperty("name", "Release", "", SettingsNoValue);
scummvm_Release_Object->properties["buildSettings"] = scummvm_Release;
scummvm_Release_Object->addProperty("name", "Release", "", kSettingsNoValue);
scummvm_Release_Object->_properties["buildSettings"] = scummvm_Release;
_buildConfiguration.add(scummvm_Debug_Object);
_buildConfiguration.add(scummvm_Release_Object);
@ -842,7 +842,7 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
ValueList iPhone_FrameworkSearchPaths;
iPhone_FrameworkSearchPaths.push_back("$(inherited)");
iPhone_FrameworkSearchPaths.push_back("\"$(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"");
ADD_SETTING_LIST(iPhone_Debug, "FRAMEWORK_SEARCH_PATHS", iPhone_FrameworkSearchPaths, SettingsAsList, 5);
ADD_SETTING_LIST(iPhone_Debug, "FRAMEWORK_SEARCH_PATHS", iPhone_FrameworkSearchPaths, kSettingsAsList, 5);
ADD_SETTING(iPhone_Debug, "GCC_DYNAMIC_NO_PIC", "NO");
ADD_SETTING(iPhone_Debug, "GCC_ENABLE_CPP_EXCEPTIONS", "NO");
ADD_SETTING(iPhone_Debug, "GCC_ENABLE_FIX_AND_CONTINUE", "NO");
@ -858,12 +858,12 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
iPhone_HeaderSearchPaths.push_back("$(SRCROOT)");
iPhone_HeaderSearchPaths.push_back("\"" + projectOutputDirectory + "\"");
iPhone_HeaderSearchPaths.push_back("\"" + projectOutputDirectory + "/include\"");
ADD_SETTING_LIST(iPhone_Debug, "HEADER_SEARCH_PATHS", iPhone_HeaderSearchPaths, SettingsAsList|SettingsQuoteVariable, 5);
ADD_SETTING_LIST(iPhone_Debug, "HEADER_SEARCH_PATHS", iPhone_HeaderSearchPaths, kSettingsAsList | kSettingsQuoteVariable, 5);
ADD_SETTING_QUOTE(iPhone_Debug, "INFOPLIST_FILE", "$(SRCROOT)/dists/ios7/Info.plist");
ValueList iPhone_LibPaths;
iPhone_LibPaths.push_back("$(inherited)");
iPhone_LibPaths.push_back("\"" + projectOutputDirectory + "/lib\"");
ADD_SETTING_LIST(iPhone_Debug, "LIBRARY_SEARCH_PATHS", iPhone_LibPaths, SettingsAsList, 5);
ADD_SETTING_LIST(iPhone_Debug, "LIBRARY_SEARCH_PATHS", iPhone_LibPaths, kSettingsAsList, 5);
ADD_SETTING(iPhone_Debug, "ONLY_ACTIVE_ARCH", "YES");
ADD_SETTING(iPhone_Debug, "PREBINDING", "NO");
ADD_SETTING(iPhone_Debug, "PRODUCT_NAME", PROJECT_NAME);
@ -877,12 +877,12 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
ADD_DEFINE(scummvmIOS_defines, "\"$(inherited)\"");
ADD_DEFINE(scummvmIOS_defines, "IPHONE");
ADD_DEFINE(scummvmIOS_defines, "IPHONE_OFFICIAL");
ADD_SETTING_LIST(iPhone_Debug, "GCC_PREPROCESSOR_DEFINITIONS", scummvmIOS_defines, SettingsNoQuote|SettingsAsList, 5);
ADD_SETTING_LIST(iPhone_Debug, "GCC_PREPROCESSOR_DEFINITIONS", scummvmIOS_defines, kSettingsNoQuote | kSettingsAsList, 5);
ADD_SETTING(iPhone_Debug, "ASSETCATALOG_COMPILER_APPICON_NAME", "AppIcon");
ADD_SETTING(iPhone_Debug, "ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME", "LaunchImage");
iPhone_Debug_Object->addProperty("name", "Debug", "", SettingsNoValue);
iPhone_Debug_Object->properties["buildSettings"] = iPhone_Debug;
iPhone_Debug_Object->addProperty("name", "Debug", "", kSettingsNoValue);
iPhone_Debug_Object->_properties["buildSettings"] = iPhone_Debug;
// Release
Object *iPhone_Release_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-iPhone_Release", _targets[IOS_TARGET] /* ScummVM-iPhone */, "XCBuildConfiguration", "PBXNativeTarget", "Release");
@ -894,8 +894,8 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
REMOVE_SETTING(iPhone_Release, "DEBUG_INFORMATION_FORMAT");
ADD_SETTING_QUOTE(iPhone_Release, "DEBUG_INFORMATION_FORMAT", "dwarf-with-dsym");
iPhone_Release_Object->addProperty("name", "Release", "", SettingsNoValue);
iPhone_Release_Object->properties["buildSettings"] = iPhone_Release;
iPhone_Release_Object->addProperty("name", "Release", "", kSettingsNoValue);
iPhone_Release_Object->_properties["buildSettings"] = iPhone_Release;
_buildConfiguration.add(iPhone_Debug_Object);
_buildConfiguration.add(iPhone_Release_Object);
@ -925,7 +925,7 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
ADD_DEFINE(scummvmOSX_defines, "\"$(inherited)\"");
ADD_DEFINE(scummvmOSX_defines, "SDL_BACKEND");
ADD_DEFINE(scummvmOSX_defines, "MACOSX");
ADD_SETTING_LIST(scummvmOSX_Debug, "GCC_PREPROCESSOR_DEFINITIONS", scummvmOSX_defines, SettingsNoQuote|SettingsAsList, 5);
ADD_SETTING_LIST(scummvmOSX_Debug, "GCC_PREPROCESSOR_DEFINITIONS", scummvmOSX_defines, kSettingsNoQuote | kSettingsAsList, 5);
ADD_SETTING_QUOTE(scummvmOSX_Debug, "GCC_VERSION", "");
ValueList scummvmOSX_HeaderPaths;
scummvmOSX_HeaderPaths.push_back("/opt/local/include/SDL");
@ -934,14 +934,14 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
scummvmOSX_HeaderPaths.push_back("include/");
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_LIST(scummvmOSX_Debug, "HEADER_SEARCH_PATHS", scummvmOSX_HeaderPaths, kSettingsQuoteVariable | kSettingsAsList, 5);
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");
scummvmOSX_LibPaths.push_back("\"$(inherited)\"");
scummvmOSX_LibPaths.push_back("\"\\\\\\\"$(SRCROOT)/lib\\\\\\\"\""); // mmmh, all those slashes, it's almost Christmas \o/
ADD_SETTING_LIST(scummvmOSX_Debug, "LIBRARY_SEARCH_PATHS", scummvmOSX_LibPaths, SettingsNoQuote|SettingsAsList, 5);
ADD_SETTING_LIST(scummvmOSX_Debug, "LIBRARY_SEARCH_PATHS", scummvmOSX_LibPaths, kSettingsNoQuote | kSettingsAsList, 5);
ADD_SETTING_QUOTE(scummvmOSX_Debug, "OTHER_CFLAGS", "");
ValueList scummvmOSX_LdFlags;
scummvmOSX_LdFlags.push_back("-lSDLmain");
@ -956,12 +956,12 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
scummvmOSX_LdFlags.push_back("-lFLAC");
scummvmOSX_LdFlags.push_back("-lSDL");
scummvmOSX_LdFlags.push_back("-lz");
ADD_SETTING_LIST(scummvmOSX_Debug, "OTHER_LDFLAGS", scummvmOSX_LdFlags, SettingsAsList, 5);
ADD_SETTING_LIST(scummvmOSX_Debug, "OTHER_LDFLAGS", scummvmOSX_LdFlags, kSettingsAsList, 5);
ADD_SETTING(scummvmOSX_Debug, "PREBINDING", "NO");
ADD_SETTING(scummvmOSX_Debug, "PRODUCT_NAME", PROJECT_NAME);
scummvmOSX_Debug_Object->addProperty("name", "Debug", "", SettingsNoValue);
scummvmOSX_Debug_Object->properties["buildSettings"] = scummvmOSX_Debug;
scummvmOSX_Debug_Object->addProperty("name", "Debug", "", kSettingsNoValue);
scummvmOSX_Debug_Object->_properties["buildSettings"] = scummvmOSX_Debug;
// Release
Object *scummvmOSX_Release_Object = new Object(this, "XCBuildConfiguration_" PROJECT_DESCRIPTION "-OSX_Release", _targets[OSX_TARGET] /* ScummVM-OS X */, "XCBuildConfiguration", "PBXNativeTarget", "Release");
@ -973,27 +973,27 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
REMOVE_SETTING(scummvmOSX_Release, "DEBUG_INFORMATION_FORMAT");
ADD_SETTING_QUOTE(scummvmOSX_Release, "DEBUG_INFORMATION_FORMAT", "dwarf-with-dsym");
scummvmOSX_Release_Object->addProperty("name", "Release", "", SettingsNoValue);
scummvmOSX_Release_Object->properties["buildSettings"] = scummvmOSX_Release;
scummvmOSX_Release_Object->addProperty("name", "Release", "", kSettingsNoValue);
scummvmOSX_Release_Object->_properties["buildSettings"] = scummvmOSX_Release;
_buildConfiguration.add(scummvmOSX_Debug_Object);
_buildConfiguration.add(scummvmOSX_Release_Object);
// Warning: This assumes we have all configurations with a Debug & Release pair
for (std::vector<Object *>::iterator config = _buildConfiguration.objects.begin(); config != _buildConfiguration.objects.end(); config++) {
for (std::vector<Object *>::iterator config = _buildConfiguration._objects.begin(); config != _buildConfiguration._objects.end(); config++) {
Object *configList = new Object(this, "XCConfigurationList_" + (*config)->name, (*config)->name, "XCConfigurationList", "", "Build configuration list for " + (*config)->refType + " \"" + (*config)->name + "\"");
Object *configList = new Object(this, "XCConfigurationList_" + (*config)->_name, (*config)->_name, "XCConfigurationList", "", "Build configuration list for " + (*config)->_refType + " \"" + (*config)->_name + "\"");
Property buildConfigs;
buildConfigs.flags = SettingsAsList;
buildConfigs._flags = kSettingsAsList;
buildConfigs.settings[getHash((*config)->id)] = Setting("", "Debug", SettingsNoValue, 0, 0);
buildConfigs.settings[getHash((*(++config))->id)] = Setting("", "Release", SettingsNoValue, 0, 1);
buildConfigs._settings[getHash((*config)->_id)] = Setting("", "Debug", kSettingsNoValue, 0, 0);
buildConfigs._settings[getHash((*(++config))->_id)] = Setting("", "Release", kSettingsNoValue, 0, 1);
configList->properties["buildConfigurations"] = buildConfigs;
configList->_properties["buildConfigurations"] = buildConfigs;
configList->addProperty("defaultConfigurationIsVisible", "0", "", SettingsNoValue);
configList->addProperty("defaultConfigurationName", "Release", "", SettingsNoValue);
configList->addProperty("defaultConfigurationIsVisible", "0", "", kSettingsNoValue);
configList->addProperty("defaultConfigurationName", "Release", "", kSettingsNoValue);
_configurationList.add(configList);
}
@ -1023,7 +1023,7 @@ void XcodeProvider::setupAdditionalSources(std::string targetName, Property &fil
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?)
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?)
continue;
ADD_DEFINE(_defines, *i);
@ -1066,7 +1066,7 @@ std::string XcodeProvider::getHash(std::string key) {
#endif
}
bool isSeparator (char s) { return (s == '-'); }
bool isSeparator(char s) { return (s == '-'); }
#ifdef MACOSX
std::string XcodeProvider::md5(std::string key) {
@ -1102,10 +1102,10 @@ std::string replace(std::string input, const std::string find, std::string repla
std::string::size_type findLen = find.length();
std::string::size_type replaceLen = replaceStr.length();
if (findLen == 0 )
if (findLen == 0)
return input;
for (;(pos = input.find(find, pos)) != std::string::npos;) {
for (; (pos = input.find(find, pos)) != std::string::npos;) {
input.replace(pos, findLen, replaceStr);
pos += replaceLen;
}
@ -1116,30 +1116,30 @@ std::string replace(std::string input, const std::string find, std::string repla
std::string XcodeProvider::writeProperty(const std::string &variable, Property &prop, int flags) const {
std::string output;
output += (flags & SettingsSingleItem ? "" : "\t\t\t") + variable + " = ";
output += (flags & kSettingsSingleItem ? "" : "\t\t\t") + variable + " = ";
if (prop.settings.size() > 1 || (prop.flags & SettingsSingleItem))
output += (prop.flags & SettingsAsList) ? "(\n" : "{\n";
if (prop._settings.size() > 1 || (prop._flags & kSettingsSingleItem))
output += (prop._flags & kSettingsAsList) ? "(\n" : "{\n";
OrderedSettingList settings = prop.getOrderedSettingList();
for (OrderedSettingList::const_iterator setting = settings.begin(); setting != settings.end(); ++setting) {
if (settings.size() > 1 || (prop.flags & SettingsSingleItem))
output += (flags & SettingsSingleItem ? " " : "\t\t\t\t");
if (settings.size() > 1 || (prop._flags & kSettingsSingleItem))
output += (flags & kSettingsSingleItem ? " " : "\t\t\t\t");
output += writeSetting((*setting).first, (*setting).second);
// The combination of SettingsAsList, and SettingsSingleItem should use "," and not ";" (i.e children
// The combination of SettingsAsList, and kSettingsSingleItem 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";
if ((prop._flags & kSettingsAsList) && (prop._settings.size() > 1 || (prop._flags & kSettingsSingleItem))) {
output += (prop._settings.size() > 0) ? ",\n" : "\n";
} else {
output += ";";
output += (flags & SettingsSingleItem ? " " : "\n");
output += (flags & kSettingsSingleItem ? " " : "\n");
}
}
if (prop.settings.size() > 1 || (prop.flags & SettingsSingleItem))
output += (prop.flags & SettingsAsList) ? "\t\t\t);\n" : "\t\t\t};\n";
if (prop._settings.size() > 1 || (prop._flags & kSettingsSingleItem))
output += (prop._flags & kSettingsAsList) ? "\t\t\t);\n" : "\t\t\t};\n";
return output;
}
@ -1152,32 +1152,31 @@ std::string XcodeProvider::writeSetting(const std::string &variable, std::string
// 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 output;
const std::string quote = (setting.flags & SettingsNoQuote) ? "" : "\"";
const std::string quote = (setting._flags & kSettingsNoQuote) ? "" : "\"";
const std::string escape_quote = quote.empty() ? "" : "\\" + quote;
std::string newline = "\n";
// Get indent level
for (int i = 0; i < setting.indent; ++i)
for (int i = 0; i < setting._indent; ++i)
newline += "\t";
// Setup variable
std::string var = (setting.flags & SettingsQuoteVariable) ? "\"" + variable + "\"" : variable;
std::string var = (setting._flags & kSettingsQuoteVariable) ? "\"" + variable + "\"" : variable;
// Output a list
if (setting.flags & SettingsAsList) {
if (setting._flags & kSettingsAsList) {
output += var + ((setting._flags & kSettingsNoValue) ? "(" : " = (") + newline;
output += var + ((setting.flags & SettingsNoValue) ? "(" : " = (") + newline;
for (unsigned int i = 0, count = 0; i < setting._entries.size(); ++i) {
for (unsigned int i = 0, count = 0; i < setting.entries.size(); ++i) {
std::string value = setting.entries.at(i).value;
std::string value = setting._entries.at(i)._value;
if (!value.empty()) {
if (count++ > 0)
output += "," + newline;
output += quote + replace(value, quote, escape_quote) + quote;
std::string comment = setting.entries.at(i).comment;
std::string comment = setting._entries.at(i)._comment;
if (!comment.empty())
output += " /* " + comment + " */";
}
@ -1185,24 +1184,24 @@ std::string XcodeProvider::writeSetting(const std::string &variable, const Setti
}
// Add closing ")" on new line
newline.resize(newline.size() - 1);
output += (setting.flags & SettingsNoValue) ? "\t\t\t)" : "," + newline + ")";
output += (setting._flags & kSettingsNoValue) ? "\t\t\t)" : "," + newline + ")";
} else {
output += var;
output += (setting.flags & SettingsNoValue) ? "" : " = " + quote;
output += (setting._flags & kSettingsNoValue) ? "" : " = " + quote;
for(unsigned int i = 0; i < setting.entries.size(); ++i) {
std::string value = setting.entries.at(i).value;
if(i)
for (unsigned int i = 0; i < setting._entries.size(); ++i) {
std::string value = setting._entries.at(i)._value;
if (i)
output += " ";
output += value;
std::string comment = setting.entries.at(i).comment;
std::string comment = setting._entries.at(i)._comment;
if (!comment.empty())
output += " /* " + comment + " */";
}
output += (setting.flags & SettingsNoValue) ? "" : quote;
output += (setting._flags & kSettingsNoValue) ? "" : quote;
}
return output;
}