mirror of
https://github.com/scummvm/scummvm.git
synced 2026-05-21 05:40:43 +00:00
CREATE_PROJECT: use C++11-style for each loops instead of iterators
This commit is contained in:
committed by
Filippos Karapetis
parent
2e3b977142
commit
b054ef0ecc
@@ -68,11 +68,11 @@ const CMakeProvider::Library *CMakeProvider::getLibraryFromFeature(const char *f
|
||||
LibraryProps("mpc", "mpcdec").Libraries("mpcdec")
|
||||
};
|
||||
|
||||
for (unsigned int i = 0; i < sizeof(s_libraries) / sizeof(s_libraries[0]); i++) {
|
||||
bool matchingSDL = (s_libraries[i].sdlVersion == kSDLVersionAny)
|
||||
|| (s_libraries[i].sdlVersion == useSDL);
|
||||
if (std::strcmp(feature, s_libraries[i].feature) == 0 && matchingSDL) {
|
||||
return &s_libraries[i];
|
||||
for (const auto &library : s_libraries) {
|
||||
bool matchingSDL = (library.sdlVersion == kSDLVersionAny)
|
||||
|| (library.sdlVersion == useSDL);
|
||||
if (std::strcmp(feature, library.feature) == 0 && matchingSDL) {
|
||||
return &library;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ void CodeBlocksProvider::createWorkspace(const BuildSetup &setup) {
|
||||
writeReferences(setup, workspace);
|
||||
|
||||
// Note we assume that the UUID map only includes UUIDs for enabled engines!
|
||||
for (UUIDMap::const_iterator i = _engineUuidMap.begin(); i != _engineUuidMap.end(); ++i) {
|
||||
workspace << "\t\t<Project filename=\"" << i->first << ".cbp\" />\n";
|
||||
for (const auto &i : _engineUuidMap) {
|
||||
workspace << "\t\t<Project filename=\"" << i.first << ".cbp\" />\n";
|
||||
}
|
||||
|
||||
workspace << "\t</Workspace>\n"
|
||||
@@ -59,24 +59,24 @@ StringList getFeatureLibraries(const BuildSetup &setup) {
|
||||
libSDL += setup.getSDLName();
|
||||
libraries.push_back(libSDL);
|
||||
|
||||
for (FeatureList::const_iterator i = setup.features.begin(); i != setup.features.end(); ++i) {
|
||||
if (i->enable && i->library) {
|
||||
for (const auto &feature : setup.features) {
|
||||
if (feature.enable && feature.library) {
|
||||
std::string libname;
|
||||
if (!std::strcmp(i->name, "libcurl")) {
|
||||
libname = i->name;
|
||||
} else if (!std::strcmp(i->name, "zlib")) {
|
||||
if (!std::strcmp(feature.name, "libcurl")) {
|
||||
libname = feature.name;
|
||||
} else if (!std::strcmp(feature.name, "zlib")) {
|
||||
libname = "libz";
|
||||
} else if (!std::strcmp(i->name, "vorbis")) {
|
||||
} else if (!std::strcmp(feature.name, "vorbis")) {
|
||||
libname = "libvorbis";
|
||||
libraries.push_back("libvorbisfile");
|
||||
} else if (!std::strcmp(i->name, "png")) {
|
||||
} else if (!std::strcmp(feature.name, "png")) {
|
||||
libname = "libpng16";
|
||||
} else if (!std::strcmp(i->name, "sdlnet")) {
|
||||
} else if (!std::strcmp(feature.name, "sdlnet")) {
|
||||
libname = libSDL + "_net";
|
||||
libraries.push_back("iphlpapi");
|
||||
} else {
|
||||
libname = "lib";
|
||||
libname += i->name;
|
||||
libname += feature.name;
|
||||
}
|
||||
libraries.push_back(libname);
|
||||
}
|
||||
@@ -111,8 +111,8 @@ void CodeBlocksProvider::createProjectFile(const std::string &name, const std::s
|
||||
StringList libraries = getFeatureLibraries(setup);
|
||||
|
||||
std::string deps;
|
||||
for (StringList::const_iterator i = libraries.begin(); i != libraries.end(); ++i)
|
||||
deps += (*i) + ".a;";
|
||||
for (const auto &library : libraries)
|
||||
deps += library + ".a;";
|
||||
|
||||
project << "\t\t\t<Target title=\"default\">\n"
|
||||
"\t\t\t\t<Option output=\"" << setup.projectName << "\\" << setup.projectName << "\" prefix_auto=\"1\" extension_auto=\"1\" />\n"
|
||||
@@ -130,8 +130,8 @@ void CodeBlocksProvider::createProjectFile(const std::string &name, const std::s
|
||||
writeWarnings(name, project);
|
||||
writeDefines(setup.defines, project);
|
||||
|
||||
for (StringList::const_iterator i = setup.includeDirs.begin(); i != setup.includeDirs.end(); ++i)
|
||||
project << "\t\t\t\t\t<Add directory=\"" << convertPathToWin(*i) << "\" />\n";
|
||||
for (const auto &includeDir : setup.includeDirs)
|
||||
project << "\t\t\t\t\t<Add directory=\"" << convertPathToWin(includeDir) << "\" />\n";
|
||||
|
||||
project << "\t\t\t\t\t<Add directory=\"$(" << LIBS_DEFINE << ")include\" />\n"
|
||||
"\t\t\t\t\t<Add directory=\"$(" << LIBS_DEFINE << ")include\\SDL\" />\n"
|
||||
@@ -145,15 +145,15 @@ void CodeBlocksProvider::createProjectFile(const std::string &name, const std::s
|
||||
// Linker
|
||||
project << "\t\t\t\t<Linker>\n";
|
||||
|
||||
for (StringList::const_iterator i = libraries.begin(); i != libraries.end(); ++i)
|
||||
project << "\t\t\t\t\t<Add library=\"" << (*i) << "\" />\n";
|
||||
for (const auto &library : libraries)
|
||||
project << "\t\t\t\t\t<Add library=\"" << library << "\" />\n";
|
||||
|
||||
for (UUIDMap::const_iterator i = _engineUuidMap.begin(); i != _engineUuidMap.end(); ++i) {
|
||||
project << "\t\t\t\t\t<Add library=\"" << setup.projectName << "\\engines\\" << i->first << "\\lib" << i->first << ".a\" />\n";
|
||||
for (const auto &i : _engineUuidMap) {
|
||||
project << "\t\t\t\t\t<Add library=\"" << setup.projectName << "\\engines\\" << i.first << "\\lib" << i.first << ".a\" />\n";
|
||||
}
|
||||
|
||||
for (StringList::const_iterator i = setup.libraryDirs.begin(); i != setup.libraryDirs.end(); ++i)
|
||||
project << "\t\t\t\t\t<Add directory=\"" << convertPathToWin(*i) << "\" />\n";
|
||||
for (const auto &libraryDir : setup.libraryDirs)
|
||||
project << "\t\t\t\t\t<Add directory=\"" << convertPathToWin(libraryDir) << "\" />\n";
|
||||
|
||||
project << "\t\t\t\t\t<Add directory=\"$(" << LIBS_DEFINE << ")lib\\mingw\" />\n"
|
||||
"\t\t\t\t\t<Add directory=\"$(" << LIBS_DEFINE << ")lib\" />\n"
|
||||
@@ -226,29 +226,27 @@ void CodeBlocksProvider::addResourceFiles(const BuildSetup &setup, StringList &i
|
||||
void CodeBlocksProvider::writeWarnings(const std::string &name, std::ofstream &output) const {
|
||||
|
||||
// Global warnings
|
||||
for (StringList::const_iterator i = _globalWarnings.begin(); i != _globalWarnings.end(); ++i)
|
||||
output << "\t\t\t\t\t<Add option=\"" << *i << "\" />\n";
|
||||
for (const auto &_globalWarning : _globalWarnings)
|
||||
output << "\t\t\t\t\t<Add option=\"" << _globalWarning << "\" />\n";
|
||||
|
||||
// Check for project-specific warnings:
|
||||
std::map<std::string, StringList>::iterator warningsIterator = _projectWarnings.find(name);
|
||||
if (warningsIterator != _projectWarnings.end())
|
||||
for (StringList::const_iterator i = warningsIterator->second.begin(); i != warningsIterator->second.end(); ++i)
|
||||
output << "\t\t\t\t\t<Add option=\"" << *i << "\" />\n";
|
||||
for (const auto &i : warningsIterator->second)
|
||||
output << "\t\t\t\t\t<Add option=\"" << i << "\" />\n";
|
||||
|
||||
}
|
||||
|
||||
void CodeBlocksProvider::writeDefines(const StringList &defines, std::ofstream &output) const {
|
||||
for (StringList::const_iterator i = defines.begin(); i != defines.end(); ++i)
|
||||
output << "\t\t\t\t\t<Add option=\"-D" << *i << "\" />\n";
|
||||
for (const auto &define : defines)
|
||||
output << "\t\t\t\t\t<Add option=\"-D" << define << "\" />\n";
|
||||
}
|
||||
|
||||
void CodeBlocksProvider::writeFileListToProject(const FileNode &dir, std::ostream &projectFile, const int indentation,
|
||||
const std::string &objPrefix, const std::string &filePrefix,
|
||||
const std::string &pchIncludeRoot, const StringList &pchDirs, const StringList &pchExclude) {
|
||||
|
||||
for (FileNode::NodeList::const_iterator i = dir.children.begin(); i != dir.children.end(); ++i) {
|
||||
const FileNode *node = *i;
|
||||
|
||||
for (const auto *node : dir.children) {
|
||||
if (!node->children.empty()) {
|
||||
writeFileListToProject(*node, projectFile, indentation + 1, objPrefix + node->name + '_', filePrefix + node->name + '/', pchIncludeRoot, pchDirs, pchExclude);
|
||||
} else {
|
||||
@@ -273,8 +271,8 @@ void CodeBlocksProvider::writeFileListToProject(const FileNode &dir, std::ostrea
|
||||
void CodeBlocksProvider::writeReferences(const BuildSetup &setup, std::ofstream &output) {
|
||||
output << "\t\t<Project filename=\"" << setup.projectName << ".cbp\" active=\"1\">\n";
|
||||
|
||||
for (UUIDMap::const_iterator i = _engineUuidMap.begin(); i != _engineUuidMap.end(); ++i) {
|
||||
output << "\t\t\t<Depends filename=\"" << i->first << ".cbp\" />\n";
|
||||
for (const auto &i : _engineUuidMap) {
|
||||
output << "\t\t\t<Depends filename=\"" << i.first << ".cbp\" />\n";
|
||||
}
|
||||
|
||||
output << "\t\t</Project>\n";
|
||||
|
||||
@@ -544,8 +544,8 @@ struct FileNode {
|
||||
explicit FileNode(const std::string &n) : name(n), children() {}
|
||||
|
||||
~FileNode() {
|
||||
for (NodeList::iterator i = children.begin(); i != children.end(); ++i)
|
||||
delete *i;
|
||||
for (auto &i : children)
|
||||
delete i;
|
||||
}
|
||||
|
||||
std::string name; ///< Name of the node
|
||||
|
||||
@@ -93,11 +93,11 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri
|
||||
<< "<Project DefaultTargets=\"Build\" ToolsVersion=\"" << _msvcVersion.project << "\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
|
||||
<< "\t<ItemGroup Label=\"ProjectConfigurations\">\n";
|
||||
|
||||
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
|
||||
outputConfiguration(project, "Debug", *arch);
|
||||
outputConfiguration(project, "ASan", *arch);
|
||||
outputConfiguration(project, "LLVM", *arch);
|
||||
outputConfiguration(project, "Release", *arch);
|
||||
for (const auto arch : _archs) {
|
||||
outputConfiguration(project, "Debug", arch);
|
||||
outputConfiguration(project, "ASan", arch);
|
||||
outputConfiguration(project, "LLVM", arch);
|
||||
outputConfiguration(project, "Release", arch);
|
||||
}
|
||||
project << "\t</ItemGroup>\n";
|
||||
|
||||
@@ -112,39 +112,39 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri
|
||||
// Shared configuration
|
||||
project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n";
|
||||
|
||||
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
|
||||
outputConfigurationType(setup, project, name, "Release", *arch, _msvcVersion);
|
||||
outputConfigurationType(setup, project, name, "ASan", *arch, _msvcVersion);
|
||||
outputConfigurationType(setup, project, name, "LLVM", *arch, _msvcVersion);
|
||||
outputConfigurationType(setup, project, name, "Debug", *arch, _msvcVersion);
|
||||
for (const auto arch : _archs) {
|
||||
outputConfigurationType(setup, project, name, "Release", arch, _msvcVersion);
|
||||
outputConfigurationType(setup, project, name, "ASan", arch, _msvcVersion);
|
||||
outputConfigurationType(setup, project, name, "LLVM", arch, _msvcVersion);
|
||||
outputConfigurationType(setup, project, name, "Debug", arch, _msvcVersion);
|
||||
}
|
||||
|
||||
project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n"
|
||||
<< "\t<ImportGroup Label=\"ExtensionSettings\">\n"
|
||||
<< "\t</ImportGroup>\n";
|
||||
|
||||
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
|
||||
outputProperties(setup, project, "Release", *arch);
|
||||
outputProperties(setup, project, "ASan", *arch);
|
||||
outputProperties(setup, project, "LLVM", *arch);
|
||||
outputProperties(setup, project, "Debug", *arch);
|
||||
for (const auto arch : _archs) {
|
||||
outputProperties(setup, project, "Release", arch);
|
||||
outputProperties(setup, project, "ASan", arch);
|
||||
outputProperties(setup, project, "LLVM", arch);
|
||||
outputProperties(setup, project, "Debug", arch);
|
||||
}
|
||||
|
||||
project << "\t<PropertyGroup Label=\"UserMacros\" />\n";
|
||||
|
||||
// Project-specific settings (asan uses debug properties)
|
||||
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
|
||||
for (const auto arch : _archs) {
|
||||
BuildSetup archsetup = setup;
|
||||
std::map<MSVC_Architecture, StringList>::const_iterator disabled_features_it = _arch_disabled_features.find(*arch);
|
||||
const auto disabled_features_it = _arch_disabled_features.find(arch);
|
||||
if (disabled_features_it != _arch_disabled_features.end()) {
|
||||
for (StringList::const_iterator j = disabled_features_it->second.begin(); j != disabled_features_it->second.end(); ++j) {
|
||||
archsetup = removeFeatureFromSetup(archsetup, *j);
|
||||
for (const auto &j : disabled_features_it->second) {
|
||||
archsetup = removeFeatureFromSetup(archsetup, j);
|
||||
}
|
||||
}
|
||||
outputProjectSettings(project, name, archsetup, false, *arch, "Debug");
|
||||
outputProjectSettings(project, name, archsetup, false, *arch, "ASan");
|
||||
outputProjectSettings(project, name, archsetup, false, *arch, "LLVM");
|
||||
outputProjectSettings(project, name, archsetup, true, *arch, "Release");
|
||||
outputProjectSettings(project, name, archsetup, false, arch, "Debug");
|
||||
outputProjectSettings(project, name, archsetup, false, arch, "ASan");
|
||||
outputProjectSettings(project, name, archsetup, false, arch, "LLVM");
|
||||
outputProjectSettings(project, name, archsetup, true, arch, "Release");
|
||||
}
|
||||
|
||||
// Files
|
||||
@@ -224,8 +224,8 @@ void MSBuildProvider::createFiltersFile(const BuildSetup &setup, const std::stri
|
||||
|
||||
// Output the list of filters
|
||||
filters << "\t<ItemGroup>\n";
|
||||
for (std::list<std::string>::iterator filter = _filters.begin(); filter != _filters.end(); ++filter) {
|
||||
filters << "\t\t<Filter Include=\"" << *filter << "\">\n"
|
||||
for (const auto &filter : _filters) {
|
||||
filters << "\t\t<Filter Include=\"" << filter << "\">\n"
|
||||
<< "\t\t\t<UniqueIdentifier>" << createUUID() << "</UniqueIdentifier>\n"
|
||||
<< "\t\t</Filter>\n";
|
||||
}
|
||||
@@ -244,13 +244,13 @@ void MSBuildProvider::createFiltersFile(const BuildSetup &setup, const std::stri
|
||||
void MSBuildProvider::outputFilter(std::ostream &filters, const FileEntries &files, const std::string &action) {
|
||||
if (!files.empty()) {
|
||||
filters << "\t<ItemGroup>\n";
|
||||
for (FileEntries::const_iterator entry = files.begin(), end = files.end(); entry != end; ++entry) {
|
||||
if ((*entry).filter != "") {
|
||||
filters << "\t\t<" << action << " Include=\"" << (*entry).path << "\">\n"
|
||||
<< "\t\t\t<Filter>" << (*entry).filter << "</Filter>\n"
|
||||
for (const auto &entry : files) {
|
||||
if (!entry.filter.empty()) {
|
||||
filters << "\t\t<" << action << " Include=\"" << entry.path << "\">\n"
|
||||
<< "\t\t\t<Filter>" << entry.filter << "</Filter>\n"
|
||||
<< "\t\t</" << action << ">\n";
|
||||
} else {
|
||||
filters << "\t\t<" << action << " Include=\"" << (*entry).path << "\" />\n";
|
||||
filters << "\t\t<" << action << " Include=\"" << entry.path << "\" />\n";
|
||||
}
|
||||
}
|
||||
filters << "\t</ItemGroup>\n";
|
||||
@@ -260,9 +260,9 @@ void MSBuildProvider::outputFilter(std::ostream &filters, const FileEntries &fil
|
||||
void MSBuildProvider::writeReferences(const BuildSetup &setup, std::ofstream &output) {
|
||||
output << "\t<ItemGroup>\n";
|
||||
|
||||
for (UUIDMap::const_iterator i = _engineUuidMap.begin(); i != _engineUuidMap.end(); ++i) {
|
||||
output << "\t<ProjectReference Include=\"" << i->first << ".vcxproj\">\n"
|
||||
<< "\t\t<Project>{" << i->second << "}</Project>\n"
|
||||
for (const auto &i : _engineUuidMap) {
|
||||
output << "\t<ProjectReference Include=\"" << i.first << ".vcxproj\">\n"
|
||||
<< "\t\t<Project>{" << i.second << "}</Project>\n"
|
||||
<< "\t</ProjectReference>\n";
|
||||
}
|
||||
|
||||
@@ -281,8 +281,8 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
|
||||
|
||||
std::string warnings = "";
|
||||
if (warningsIterator != _projectWarnings.end())
|
||||
for (StringList::const_iterator i = warningsIterator->second.begin(); i != warningsIterator->second.end(); ++i)
|
||||
warnings += *i + ';';
|
||||
for (const auto &i : warningsIterator->second)
|
||||
warnings += i + ';';
|
||||
|
||||
project << "\t<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='" << configuration << "|" << getMSVCConfigName(arch) << "'\">\n"
|
||||
<< "\t\t<ClCompile>\n";
|
||||
@@ -308,9 +308,9 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
|
||||
std::string libraries = outputLibraryDependencies(setup, isRelease);
|
||||
|
||||
// MSBuild uses ; for separators instead of spaces
|
||||
for (std::string::iterator i = libraries.begin(); i != libraries.end(); ++i) {
|
||||
if (*i == ' ') {
|
||||
*i = ';';
|
||||
for (char &library : libraries) {
|
||||
if (library == ' ') {
|
||||
library = ';';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,16 +344,16 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
|
||||
void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, MSVC_Architecture arch, const StringList &defines, const std::string &prefix) {
|
||||
|
||||
std::string warnings;
|
||||
for (StringList::const_iterator i = _globalWarnings.begin(); i != _globalWarnings.end(); ++i)
|
||||
warnings += *i + ';';
|
||||
for (const auto &globalWarning : _globalWarnings)
|
||||
warnings += globalWarning + ';';
|
||||
|
||||
std::string warningsAsErrors;
|
||||
for (StringList::const_iterator i = _globalErrors.begin(); i != _globalErrors.end(); ++i)
|
||||
warningsAsErrors += "/we\"" + (*i) + "\" ";
|
||||
for (const auto &globalError : _globalErrors)
|
||||
warningsAsErrors += "/we\"" + globalError + "\" ";
|
||||
|
||||
std::string definesList;
|
||||
for (StringList::const_iterator i = defines.begin(); i != defines.end(); ++i)
|
||||
definesList += *i + ';';
|
||||
for (const auto &define : defines)
|
||||
definesList += define + ';';
|
||||
|
||||
// Add define to include revision header
|
||||
if (setup.runBuildEvents)
|
||||
@@ -437,14 +437,14 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, M
|
||||
}
|
||||
|
||||
std::string includeDirsList;
|
||||
for (StringList::const_iterator i = setup.includeDirs.begin(); i != setup.includeDirs.end(); ++i)
|
||||
includeDirsList += convertPathToWin(*i) + ';';
|
||||
for (const auto &includeDir : setup.includeDirs)
|
||||
includeDirsList += convertPathToWin(includeDir) + ';';
|
||||
|
||||
std::string includeSDL = setup.getSDLName();
|
||||
|
||||
std::string libraryDirsList;
|
||||
for (StringList::const_iterator i = setup.libraryDirs.begin(); i != setup.libraryDirs.end(); ++i)
|
||||
libraryDirsList += convertPathToWin(*i) + ';';
|
||||
for (const auto &libraryDir : setup.libraryDirs)
|
||||
libraryDirsList += convertPathToWin(libraryDir) + ';';
|
||||
|
||||
std::string libsPath;
|
||||
if (setup.libsDir.empty())
|
||||
@@ -577,9 +577,7 @@ void MSBuildProvider::insertPathIntoDirectory(FileNode &dir, const std::string &
|
||||
}
|
||||
|
||||
void MSBuildProvider::createFileNodesFromPCHList(FileNode &dir, const std::string &pathBase, const StringList &pchCompileFiles) {
|
||||
for (StringList::const_iterator it = pchCompileFiles.begin(), itEnd = pchCompileFiles.end(); it != itEnd; ++it) {
|
||||
const std::string &pchPath = *it;
|
||||
|
||||
for (const auto &pchPath : pchCompileFiles) {
|
||||
if (pchPath.size() > pathBase.size() && pchPath.substr(0, pathBase.size()) == pathBase) {
|
||||
std::string internalPath = pchPath.substr(pathBase.size());
|
||||
|
||||
@@ -625,24 +623,24 @@ void MSBuildProvider::writeFileListToProject(const FileNode &dir, std::ostream &
|
||||
_filters.pop_back(); // remove last empty filter
|
||||
|
||||
// Combine lists, removing duplicates
|
||||
for (StringList::const_iterator it = backupFilters.begin(), itEnd = backupFilters.end(); it != itEnd; ++it) {
|
||||
if (std::find(_filters.begin(), _filters.end(), *it) != _filters.end())
|
||||
_filters.push_back(*it);
|
||||
for (const auto &backupFilter : backupFilters) {
|
||||
if (std::find(_filters.begin(), _filters.end(), backupFilter) != _filters.end())
|
||||
_filters.push_back(backupFilter);
|
||||
}
|
||||
}
|
||||
|
||||
// Output asm files
|
||||
if (!_asmFiles.empty()) {
|
||||
projectFile << "\t<ItemGroup>\n";
|
||||
for (std::list<FileEntry>::const_iterator entry = _asmFiles.begin(); entry != _asmFiles.end(); ++entry) {
|
||||
for (const auto &_asmFile : _asmFiles) {
|
||||
|
||||
projectFile << "\t\t<CustomBuild Include=\"" << (*entry).path << "\">\n"
|
||||
projectFile << "\t\t<CustomBuild Include=\"" << _asmFile.path << "\">\n"
|
||||
<< "\t\t\t<FileType>Document</FileType>\n";
|
||||
|
||||
outputNasmCommand(projectFile, "Debug", (*entry).prefix);
|
||||
outputNasmCommand(projectFile, "ASan", (*entry).prefix);
|
||||
outputNasmCommand(projectFile, "Release", (*entry).prefix);
|
||||
outputNasmCommand(projectFile, "LLVM", (*entry).prefix);
|
||||
outputNasmCommand(projectFile, "Debug", _asmFile.prefix);
|
||||
outputNasmCommand(projectFile, "ASan", _asmFile.prefix);
|
||||
outputNasmCommand(projectFile, "Release", _asmFile.prefix);
|
||||
outputNasmCommand(projectFile, "LLVM", _asmFile.prefix);
|
||||
|
||||
projectFile << "\t\t</CustomBuild>\n";
|
||||
}
|
||||
@@ -653,8 +651,8 @@ void MSBuildProvider::writeFileListToProject(const FileNode &dir, std::ostream &
|
||||
void MSBuildProvider::outputFiles(std::ostream &projectFile, const FileEntries &files, const std::string &action) {
|
||||
if (!files.empty()) {
|
||||
projectFile << "\t<ItemGroup>\n";
|
||||
for (FileEntries::const_iterator entry = files.begin(), end = files.end(); entry != end; ++entry) {
|
||||
projectFile << "\t\t<" << action << " Include=\"" << (*entry).path << "\" />\n";
|
||||
for (const auto &file : files) {
|
||||
projectFile << "\t\t<" << action << " Include=\"" << file.path << "\" />\n";
|
||||
}
|
||||
projectFile << "\t</ItemGroup>\n";
|
||||
}
|
||||
@@ -673,17 +671,15 @@ void MSBuildProvider::outputCompileFiles(std::ostream &projectFile, const std::s
|
||||
pchIncludeRootWin = convertPathToWin(pchIncludeRoot);
|
||||
|
||||
// Convert PCH paths to Win
|
||||
for (StringList::const_iterator entry = pchDirs.begin(), end = pchDirs.end(); entry != end; ++entry) {
|
||||
std::string convertedPath = convertPathToWin(*entry);
|
||||
for (const auto &pchDir : pchDirs) {
|
||||
std::string convertedPath = convertPathToWin(pchDir);
|
||||
if (convertedPath.size() < pchIncludeRootWin.size() || convertedPath.substr(0, pchIncludeRootWin.size()) != pchIncludeRootWin) {
|
||||
error("PCH path '" + convertedPath + "' wasn't located under PCH include root '" + pchIncludeRootWin + "'");
|
||||
}
|
||||
|
||||
pchDirsWin.push_back(convertPathToWin(*entry));
|
||||
pchDirsWin.push_back(convertPathToWin(pchDir));
|
||||
}
|
||||
for (StringList::const_iterator entry = pchExclude.begin(), end = pchExclude.end(); entry != end; ++entry) {
|
||||
const std::string path = *entry;
|
||||
|
||||
for (const auto &path : pchExclude) {
|
||||
if (path.size() >= 2 && path[path.size() - 1] == 'o' && path[path.size() - 2] == '.')
|
||||
pchExcludeWin.push_back(convertPathToWin(path.substr(0, path.size() - 2)));
|
||||
}
|
||||
@@ -693,12 +689,12 @@ void MSBuildProvider::outputCompileFiles(std::ostream &projectFile, const std::s
|
||||
|
||||
if (!files.empty()) {
|
||||
projectFile << "\t<ItemGroup>\n";
|
||||
for (FileEntries::const_iterator entry = files.begin(), end = files.end(); entry != end; ++entry) {
|
||||
for (const auto &file : files) {
|
||||
std::string pchIncludePath, pchFilePath, pchFileName;
|
||||
|
||||
bool fileHasPCH = false;
|
||||
if (hasPCH)
|
||||
fileHasPCH = calculatePchPaths(entry->path, pchIncludeRootWin, pchDirsWin, pchExcludeWin, '\\', pchIncludePath, pchFilePath, pchFileName);
|
||||
fileHasPCH = calculatePchPaths(file.path, pchIncludeRootWin, pchDirsWin, pchExcludeWin, '\\', pchIncludePath, pchFilePath, pchFileName);
|
||||
|
||||
if (fileHasPCH) {
|
||||
std::string pchOutputFileName = "$(IntDir)dists\\msvc\\%(RelativeDir)" + pchFileName.substr(0, pchFileName.size() - 2) + ".pch";
|
||||
@@ -707,21 +703,21 @@ void MSBuildProvider::outputCompileFiles(std::ostream &projectFile, const std::s
|
||||
pchInfo.file = pchIncludePath;
|
||||
pchInfo.outputFile = pchOutputFileName;
|
||||
|
||||
projectFile << "\t\t<ClCompile Include=\"" << (*entry).path << "\">\n";
|
||||
projectFile << "\t\t<ClCompile Include=\"" << file.path << "\">\n";
|
||||
projectFile << "\t\t\t<PrecompiledHeader>Use</PrecompiledHeader>\n";
|
||||
projectFile << "\t\t\t<PrecompiledHeaderFile>" << pchIncludePath << "</PrecompiledHeaderFile>\n";
|
||||
projectFile << "\t\t\t<PrecompiledHeaderOutputFile>" << pchOutputFileName << "</PrecompiledHeaderOutputFile>\n";
|
||||
projectFile << "\t\t</ClCompile>\n";
|
||||
} else {
|
||||
projectFile << "\t\t<ClCompile Include=\"" << (*entry).path << "\" />\n";
|
||||
projectFile << "\t\t<ClCompile Include=\"" << file.path << "\" />\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Flush PCH files
|
||||
for (std::map<std::string, PCHInfo>::const_iterator pchIt = pchMap.begin(), pchItEnd = pchMap.end(); pchIt != pchItEnd; ++pchIt) {
|
||||
const PCHInfo &pchInfo = pchIt->second;
|
||||
for (const auto &pchIt : pchMap) {
|
||||
const PCHInfo &pchInfo = pchIt.second;
|
||||
|
||||
const std::string &filePath = pchIt->first;
|
||||
const std::string &filePath = pchIt.first;
|
||||
assert(filePath.size() >= 2 && filePath.substr(filePath.size() - 2) == ".h");
|
||||
|
||||
std::string cppFilePath = filePath.substr(0, filePath.size() - 2) + ".cpp";
|
||||
@@ -781,9 +777,7 @@ void MSBuildProvider::outputCompileFiles(std::ostream &projectFile, const std::s
|
||||
}
|
||||
|
||||
void MSBuildProvider::computeFileList(const FileNode &dir, const std::string &objPrefix, const std::string &filePrefix) {
|
||||
for (FileNode::NodeList::const_iterator i = dir.children.begin(); i != dir.children.end(); ++i) {
|
||||
const FileNode *node = *i;
|
||||
|
||||
for (const auto *node : dir.children) {
|
||||
if (!node->children.empty()) {
|
||||
// Update filter
|
||||
std::string _currentFilter = _filters.back();
|
||||
|
||||
@@ -88,11 +88,11 @@ std::string MSVCProvider::getLibraryFromFeature(const char *feature, const Build
|
||||
};
|
||||
|
||||
const MSVCLibrary *library = nullptr;
|
||||
for (unsigned int i = 0; i < sizeof(s_libraries) / sizeof(s_libraries[0]); i++) {
|
||||
if (std::strcmp(feature, s_libraries[i].feature) == 0 &&
|
||||
((s_libraries[i].sdl == kSDLVersionAny) ||
|
||||
(s_libraries[i].sdl == setup.useSDL))) {
|
||||
library = &s_libraries[i];
|
||||
for (const auto &_library : s_libraries) {
|
||||
if (std::strcmp(feature, _library.feature) == 0 &&
|
||||
((_library.sdl == kSDLVersionAny) ||
|
||||
(_library.sdl == setup.useSDL))) {
|
||||
library = &_library;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -127,9 +127,9 @@ std::string MSVCProvider::outputLibraryDependencies(const BuildSetup &setup, boo
|
||||
// SDL is always enabled
|
||||
libs += getLibraryFromFeature("sdl", setup, isRelease);
|
||||
libs += " ";
|
||||
for (FeatureList::const_iterator i = setup.features.begin(); i != setup.features.end(); ++i) {
|
||||
if (i->enable) {
|
||||
std::string lib = getLibraryFromFeature(i->name, setup, isRelease);
|
||||
for (const auto &i : setup.features) {
|
||||
if (i.enable) {
|
||||
std::string lib = getLibraryFromFeature(i.name, setup, isRelease);
|
||||
if (!lib.empty())
|
||||
libs += lib + " ";
|
||||
}
|
||||
@@ -180,34 +180,34 @@ void MSVCProvider::createWorkspaceClassic(const BuildSetup &setup) {
|
||||
}
|
||||
|
||||
// Note we assume that the UUID map only includes UUIDs for enabled engines!
|
||||
for (UUIDMap::const_iterator i = _engineUuidMap.begin(); i != _engineUuidMap.end(); ++i) {
|
||||
solution << "Project(\"{" << solutionUUID << "}\") = \"" << i->first << "\", \"" << i->first << getProjectExtension() << "\", \"{" << i->second << "}\"\n"
|
||||
for (const auto &i : _engineUuidMap) {
|
||||
solution << "Project(\"{" << solutionUUID << "}\") = \"" << i.first << "\", \"" << i.first << getProjectExtension() << "\", \"{" << i.second << "}\"\n"
|
||||
<< "EndProject\n";
|
||||
}
|
||||
|
||||
solution << "Global\n"
|
||||
"\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n";
|
||||
|
||||
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
|
||||
solution << "\t\tDebug|" << getMSVCConfigName(*arch) << " = Debug|" << getMSVCConfigName(*arch) << "\n"
|
||||
<< "\t\tASan|" << getMSVCConfigName(*arch) << " = ASan|" << getMSVCConfigName(*arch) << "\n"
|
||||
<< "\t\tLLVM|" << getMSVCConfigName(*arch) << " = LLVM|" << getMSVCConfigName(*arch) << "\n"
|
||||
<< "\t\tRelease|" << getMSVCConfigName(*arch) << " = Release|" << getMSVCConfigName(*arch) << "\n";
|
||||
for (const auto arch : _archs) {
|
||||
solution << "\t\tDebug|" << getMSVCConfigName(arch) << " = Debug|" << getMSVCConfigName(arch) << "\n"
|
||||
<< "\t\tASan|" << getMSVCConfigName(arch) << " = ASan|" << getMSVCConfigName(arch) << "\n"
|
||||
<< "\t\tLLVM|" << getMSVCConfigName(arch) << " = LLVM|" << getMSVCConfigName(arch) << "\n"
|
||||
<< "\t\tRelease|" << getMSVCConfigName(arch) << " = Release|" << getMSVCConfigName(arch) << "\n";
|
||||
}
|
||||
|
||||
solution << "\tEndGlobalSection\n"
|
||||
"\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n";
|
||||
|
||||
for (UUIDMap::const_iterator i = _allProjUuidMap.begin(); i != _allProjUuidMap.end(); ++i) {
|
||||
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
|
||||
solution << "\t\t{" << i->second << "}.Debug|" << getMSVCConfigName(*arch) << ".ActiveCfg = Debug|" << getMSVCConfigName(*arch) << "\n"
|
||||
<< "\t\t{" << i->second << "}.Debug|" << getMSVCConfigName(*arch) << ".Build.0 = Debug|" << getMSVCConfigName(*arch) << "\n"
|
||||
<< "\t\t{" << i->second << "}.ASan|" << getMSVCConfigName(*arch) << ".ActiveCfg = ASan|" << getMSVCConfigName(*arch) << "\n"
|
||||
<< "\t\t{" << i->second << "}.ASan|" << getMSVCConfigName(*arch) << ".Build.0 = ASan|" << getMSVCConfigName(*arch) << "\n"
|
||||
<< "\t\t{" << i->second << "}.LLVM|" << getMSVCConfigName(*arch) << ".ActiveCfg = LLVM|" << getMSVCConfigName(*arch) << "\n"
|
||||
<< "\t\t{" << i->second << "}.LLVM|" << getMSVCConfigName(*arch) << ".Build.0 = LLVM|" << getMSVCConfigName(*arch) << "\n"
|
||||
<< "\t\t{" << i->second << "}.Release|" << getMSVCConfigName(*arch) << ".ActiveCfg = Release|" << getMSVCConfigName(*arch) << "\n"
|
||||
<< "\t\t{" << i->second << "}.Release|" << getMSVCConfigName(*arch) << ".Build.0 = Release|" << getMSVCConfigName(*arch) << "\n";
|
||||
for (const auto &i : _allProjUuidMap) {
|
||||
for (const auto arch : _archs) {
|
||||
solution << "\t\t{" << i.second << "}.Debug|" << getMSVCConfigName(arch) << ".ActiveCfg = Debug|" << getMSVCConfigName(arch) << "\n"
|
||||
<< "\t\t{" << i.second << "}.Debug|" << getMSVCConfigName(arch) << ".Build.0 = Debug|" << getMSVCConfigName(arch) << "\n"
|
||||
<< "\t\t{" << i.second << "}.ASan|" << getMSVCConfigName(arch) << ".ActiveCfg = ASan|" << getMSVCConfigName(arch) << "\n"
|
||||
<< "\t\t{" << i.second << "}.ASan|" << getMSVCConfigName(arch) << ".Build.0 = ASan|" << getMSVCConfigName(arch) << "\n"
|
||||
<< "\t\t{" << i.second << "}.LLVM|" << getMSVCConfigName(arch) << ".ActiveCfg = LLVM|" << getMSVCConfigName(arch) << "\n"
|
||||
<< "\t\t{" << i.second << "}.LLVM|" << getMSVCConfigName(arch) << ".Build.0 = LLVM|" << getMSVCConfigName(arch) << "\n"
|
||||
<< "\t\t{" << i.second << "}.Release|" << getMSVCConfigName(arch) << ".ActiveCfg = Release|" << getMSVCConfigName(arch) << "\n"
|
||||
<< "\t\t{" << i.second << "}.Release|" << getMSVCConfigName(arch) << ".Build.0 = Release|" << getMSVCConfigName(arch) << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,11 +269,11 @@ void MSVCProvider::createOtherBuildFiles(const BuildSetup &setup) {
|
||||
|
||||
// Create the configuration property files (for Debug and Release with 32 and 64bits versions)
|
||||
// Note: we use the debug properties for the asan configuration
|
||||
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
|
||||
createBuildProp(setup, true, *arch, "Release");
|
||||
createBuildProp(setup, false, *arch, "Debug");
|
||||
createBuildProp(setup, false, *arch, "ASan");
|
||||
createBuildProp(setup, false, *arch, "LLVM");
|
||||
for (const auto arch : _archs) {
|
||||
createBuildProp(setup, true, arch, "Release");
|
||||
createBuildProp(setup, false, arch, "Debug");
|
||||
createBuildProp(setup, false, arch, "ASan");
|
||||
createBuildProp(setup, false, arch, "LLVM");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,20 +283,20 @@ void MSVCProvider::addResourceFiles(const BuildSetup &setup, StringList &include
|
||||
}
|
||||
|
||||
void MSVCProvider::createGlobalProp(const BuildSetup &setup) {
|
||||
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
|
||||
std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(*arch) + getPropertiesExtension()).c_str());
|
||||
for (const auto arch : _archs) {
|
||||
std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(arch) + getPropertiesExtension()).c_str());
|
||||
if (!properties)
|
||||
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(*arch) + getPropertiesExtension() + "\" for writing");
|
||||
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(arch) + getPropertiesExtension() + "\" for writing");
|
||||
|
||||
BuildSetup archSetup = setup;
|
||||
std::map<MSVC_Architecture, StringList>::const_iterator arch_disabled_features_it = _arch_disabled_features.find(*arch);
|
||||
std::map<MSVC_Architecture, StringList>::const_iterator arch_disabled_features_it = _arch_disabled_features.find(arch);
|
||||
if (arch_disabled_features_it != _arch_disabled_features.end()) {
|
||||
for (StringList::const_iterator feature = arch_disabled_features_it->second.begin(); feature != arch_disabled_features_it->second.end(); ++feature) {
|
||||
archSetup = removeFeatureFromSetup(archSetup, *feature);
|
||||
for (const auto &feature : arch_disabled_features_it->second) {
|
||||
archSetup = removeFeatureFromSetup(archSetup, feature);
|
||||
}
|
||||
}
|
||||
|
||||
outputGlobalPropFile(archSetup, properties, *arch, archSetup.defines, convertPathToWin(archSetup.filePrefix));
|
||||
outputGlobalPropFile(archSetup, properties, arch, archSetup.defines, convertPathToWin(archSetup.filePrefix));
|
||||
properties.close();
|
||||
}
|
||||
}
|
||||
@@ -317,8 +317,8 @@ std::string MSVCProvider::getTestPreBuildEvent(const BuildSetup &setup) const {
|
||||
// Build list of folders containing tests
|
||||
std::string target = "";
|
||||
|
||||
for (StringList::const_iterator it = setup.testDirs.begin(); it != setup.testDirs.end(); ++it)
|
||||
target += " $(SolutionDir)" + *it + "*.h";
|
||||
for (const auto &testDir : setup.testDirs)
|
||||
target += " $(SolutionDir)" + testDir + "*.h";
|
||||
|
||||
std::string cmdLine = "";
|
||||
cmdLine = "if not exist \"$(SolutionDir)test\\runner\" mkdir \"$(SolutionDir)test\\runner\"\n"
|
||||
|
||||
@@ -265,8 +265,8 @@ void XcodeProvider::addResourceFiles(const BuildSetup &setup, StringList &includ
|
||||
}
|
||||
|
||||
ValueList &resources = getResourceFiles(setup);
|
||||
for (ValueList::iterator it = resources.begin(); it != resources.end(); ++it) {
|
||||
includeList.push_back(setup.srcDir + "/" + *it);
|
||||
for (const auto &resource : resources) {
|
||||
includeList.push_back(setup.srcDir + "/" + resource);
|
||||
}
|
||||
|
||||
StringList pchDirs, pchEx;
|
||||
@@ -376,9 +376,7 @@ void XcodeProvider::writeFileListToProject(const FileNode &dir, std::ostream &pr
|
||||
|
||||
// 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;
|
||||
|
||||
for (const auto *node : dir.children) {
|
||||
// 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()) {
|
||||
@@ -697,13 +695,13 @@ void XcodeProvider::setupFrameworksBuildPhase(const BuildSetup &setup) {
|
||||
frameworks_osx.push_back(getLibString(libSDL + "_net", setup.useXCFramework));
|
||||
|
||||
int order = 0;
|
||||
for (ValueList::iterator framework = frameworks_osx.begin(); framework != frameworks_osx.end(); framework++) {
|
||||
std::string id = "Frameworks_" + *framework + "_osx";
|
||||
std::string comment = *framework + " in Frameworks";
|
||||
for (const auto &framework : frameworks_osx) {
|
||||
std::string id = "Frameworks_" + framework + "_osx";
|
||||
std::string comment = framework + " in Frameworks";
|
||||
|
||||
ADD_SETTING_ORDER_NOVALUE(osx_files, getHash(id), comment, order++);
|
||||
ADD_BUILD_FILE(id, *framework, getHash(*framework), comment);
|
||||
ADD_FILE_REFERENCE(*framework, *framework, properties[*framework]);
|
||||
ADD_BUILD_FILE(id, framework, getHash(framework), comment);
|
||||
ADD_FILE_REFERENCE(framework, framework, properties[framework]);
|
||||
}
|
||||
|
||||
framework_OSX->_properties["files"] = osx_files;
|
||||
@@ -820,13 +818,13 @@ void XcodeProvider::setupFrameworksBuildPhase(const BuildSetup &setup) {
|
||||
}
|
||||
|
||||
int order = 0;
|
||||
for (ValueList::iterator framework = frameworks_iOS.begin(); framework != frameworks_iOS.end(); framework++) {
|
||||
std::string id = "Frameworks_" + *framework + "_iphone";
|
||||
std::string comment = *framework + " in Frameworks";
|
||||
for (const auto &framework : frameworks_iOS) {
|
||||
std::string id = "Frameworks_" + framework + "_iphone";
|
||||
std::string comment = framework + " in Frameworks";
|
||||
|
||||
ADD_SETTING_ORDER_NOVALUE(iOS_files, getHash(id), comment, order++);
|
||||
ADD_BUILD_FILE(id, *framework, getHash(*framework), comment);
|
||||
ADD_FILE_REFERENCE(*framework, *framework, properties[*framework]);
|
||||
ADD_BUILD_FILE(id, framework, getHash(framework), comment);
|
||||
ADD_FILE_REFERENCE(framework, framework, properties[framework]);
|
||||
}
|
||||
|
||||
framework_iPhone->_properties["files"] = iOS_files;
|
||||
@@ -939,13 +937,13 @@ void XcodeProvider::setupFrameworksBuildPhase(const BuildSetup &setup) {
|
||||
}
|
||||
|
||||
int order = 0;
|
||||
for (ValueList::iterator framework = frameworks_tvOS.begin(); framework != frameworks_tvOS.end(); framework++) {
|
||||
std::string id = "Frameworks_" + *framework + "_appletv";
|
||||
std::string comment = *framework + " in Frameworks";
|
||||
for (const auto &framework : frameworks_tvOS) {
|
||||
std::string id = "Frameworks_" + framework + "_appletv";
|
||||
std::string comment = framework + " in Frameworks";
|
||||
|
||||
ADD_SETTING_ORDER_NOVALUE(tvOS_files, getHash(id), comment, order++);
|
||||
ADD_BUILD_FILE(id, *framework, getHash(*framework), comment);
|
||||
ADD_FILE_REFERENCE(*framework, *framework, properties[*framework]);
|
||||
ADD_BUILD_FILE(id, framework, getHash(framework), comment);
|
||||
ADD_FILE_REFERENCE(framework, framework, properties[framework]);
|
||||
}
|
||||
|
||||
framework_tvOS->_properties["files"] = tvOS_files;
|
||||
@@ -960,28 +958,28 @@ void XcodeProvider::setupNativeTarget() {
|
||||
// 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++) {
|
||||
Object *target = new Object(this, "PBXNativeTarget_" + _targets[i], "PBXNativeTarget", "PBXNativeTarget", "", _targets[i]);
|
||||
for (const auto &_target : _targets) {
|
||||
Object *target = new Object(this, "PBXNativeTarget_" + _target, "PBXNativeTarget", "PBXNativeTarget", "", _target);
|
||||
|
||||
target->addProperty("buildConfigurationList", getHash("XCConfigurationList_" + _targets[i]), "Build configuration list for PBXNativeTarget \"" + _targets[i] + "\"", kSettingsNoValue);
|
||||
target->addProperty("buildConfigurationList", getHash("XCConfigurationList_" + _target), "Build configuration list for PBXNativeTarget \"" + _target + "\"", kSettingsNoValue);
|
||||
|
||||
Property 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);
|
||||
buildPhases._settings[getHash("PBXResourcesBuildPhase_" + _target)] = Setting("", "Resources", kSettingsNoValue, 0, 0);
|
||||
buildPhases._settings[getHash("PBXSourcesBuildPhase_" + _target)] = Setting("", "Sources", kSettingsNoValue, 0, 1);
|
||||
buildPhases._settings[getHash("PBXFrameworksBuildPhase_" + _target)] = Setting("", "Frameworks", kSettingsNoValue, 0, 2);
|
||||
target->_properties["buildPhases"] = buildPhases;
|
||||
|
||||
target->addProperty("buildRules", "", "", kSettingsNoValue | kSettingsAsList);
|
||||
|
||||
target->addProperty("dependencies", "", "", kSettingsNoValue | kSettingsAsList);
|
||||
|
||||
target->addProperty("name", _targets[i], "", kSettingsNoValue | kSettingsQuoteVariable);
|
||||
target->addProperty("name", _target, "", 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", kSettingsNoValue);
|
||||
addProductFileReference("PBXFileReference_" PROJECT_DESCRIPTION ".app_" + _target, PROJECT_DESCRIPTION ".app");
|
||||
productsGroup->addChildByHash(getHash("PBXFileReference_" PROJECT_DESCRIPTION ".app_" + _target), PROJECT_DESCRIPTION ".app");
|
||||
target->addProperty("productReference", getHash("PBXFileReference_" PROJECT_DESCRIPTION ".app_" + _target), PROJECT_DESCRIPTION ".app", kSettingsNoValue);
|
||||
target->addProperty("productType", "com.apple.product-type.application", "", kSettingsNoValue | kSettingsQuoteVariable);
|
||||
|
||||
_nativeTarget.add(target);
|
||||
@@ -1164,8 +1162,8 @@ XcodeProvider::ValueList& XcodeProvider::getResourceFiles(const BuildSetup &setu
|
||||
files.push_back("NEWS.md");
|
||||
files.push_back("README.md");
|
||||
|
||||
for (int i = 0; i < kEngineDataGroupCount; i++) {
|
||||
for (const std::string &filename : _engineDataGroupDefs[i].dataFiles) {
|
||||
for (const auto &engineDataGroupDef : _engineDataGroupDefs) {
|
||||
for (const std::string &filename : engineDataGroupDef.dataFiles) {
|
||||
if (std::find(files.begin(), files.end(), filename) != files.end())
|
||||
error("Resource file " + filename + " was included multiple times");
|
||||
|
||||
@@ -1193,8 +1191,8 @@ void XcodeProvider::setupResourcesBuildPhase(const BuildSetup &setup) {
|
||||
ValueList &files_list = getResourceFiles(setup);
|
||||
|
||||
// Same as for containers: a rule for each native target
|
||||
for (unsigned int i = 0; i < _targets.size(); i++) {
|
||||
Object *resource = new Object(this, "PBXResourcesBuildPhase_" + _targets[i], "PBXResourcesBuildPhase", "PBXResourcesBuildPhase", "", "Resources");
|
||||
for (const auto &target : _targets) {
|
||||
Object *resource = new Object(this, "PBXResourcesBuildPhase_" + target, "PBXResourcesBuildPhase", "PBXResourcesBuildPhase", "", "Resources");
|
||||
|
||||
resource->addProperty("buildActionMask", "2147483647", "", kSettingsNoValue);
|
||||
|
||||
@@ -1204,13 +1202,13 @@ void XcodeProvider::setupResourcesBuildPhase(const BuildSetup &setup) {
|
||||
files._flags = kSettingsAsList;
|
||||
|
||||
int order = 0;
|
||||
for (ValueList::iterator file = files_list.begin(); file != files_list.end(); file++) {
|
||||
if (shouldSkipFileForTarget(*file, _targets[i], *file)) {
|
||||
for (const auto &file : files_list) {
|
||||
if (shouldSkipFileForTarget(file, target, file)) {
|
||||
continue;
|
||||
}
|
||||
std::string resourceAbsolutePath = _projectRoot + "/" + *file;
|
||||
std::string resourceAbsolutePath = _projectRoot + "/" + file;
|
||||
std::string file_id = "FileReference_" + resourceAbsolutePath;
|
||||
std::string base = basename(*file);
|
||||
std::string base = basename(file);
|
||||
std::string comment = base + " in Resources";
|
||||
addBuildFile(resourceAbsolutePath, base, getHash(file_id), comment);
|
||||
ADD_SETTING_ORDER_NOVALUE(files, getHash(resourceAbsolutePath), comment, order++);
|
||||
@@ -1228,9 +1226,9 @@ void XcodeProvider::setupSourcesBuildPhase() {
|
||||
_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");
|
||||
for (const auto &target : _targets) {
|
||||
const std::string &targetName = target;
|
||||
Object *source = new Object(this, "PBXSourcesBuildPhase_" + target, "PBXSourcesBuildPhase", "PBXSourcesBuildPhase", "", "Sources");
|
||||
|
||||
source->addProperty("buildActionMask", "2147483647", "", kSettingsNoValue);
|
||||
|
||||
@@ -1239,16 +1237,16 @@ void XcodeProvider::setupSourcesBuildPhase() {
|
||||
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 (const auto *object : _buildFile._objects) {
|
||||
const std::string &fileName = object->_name;
|
||||
if (shouldSkipFileForTarget(object->_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(object->_id), comment, order++);
|
||||
}
|
||||
|
||||
setupAdditionalSources(targetName, files, order);
|
||||
@@ -1393,8 +1391,8 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
|
||||
*/
|
||||
ADD_SETTING_QUOTE(scummvmOSX_Debug, "GCC_VERSION", "");
|
||||
ValueList scummvmOSX_HeaderPaths;
|
||||
for (StringList::const_iterator i = setup.includeDirs.begin(); i != setup.includeDirs.end(); ++i)
|
||||
scummvmOSX_HeaderPaths.push_back("\"" + *i + "\"");
|
||||
for (const auto &includeDir : setup.includeDirs)
|
||||
scummvmOSX_HeaderPaths.push_back("\"" + includeDir + "\"");
|
||||
scummvmOSX_HeaderPaths.push_back("/usr/local/include/" + libSDL);
|
||||
scummvmOSX_HeaderPaths.push_back("/opt/homebrew/include/" + libSDL);
|
||||
scummvmOSX_HeaderPaths.push_back("/opt/local/include/" + libSDL);
|
||||
@@ -1410,8 +1408,8 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
|
||||
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;
|
||||
for (StringList::const_iterator i = setup.libraryDirs.begin(); i != setup.libraryDirs.end(); ++i)
|
||||
scummvmOSX_LibPaths.push_back("\"" + *i + "\"");
|
||||
for (const auto &libraryDir : setup.libraryDirs)
|
||||
scummvmOSX_LibPaths.push_back("\"" + libraryDir + "\"");
|
||||
scummvmOSX_LibPaths.push_back("/usr/local/lib");
|
||||
scummvmOSX_LibPaths.push_back("/opt/homebrew/lib");
|
||||
scummvmOSX_LibPaths.push_back("/opt/local/lib");
|
||||
@@ -1469,8 +1467,8 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
|
||||
ValueList iPhone_HeaderSearchPaths;
|
||||
iPhone_HeaderSearchPaths.push_back("$(SRCROOT)/engines/");
|
||||
iPhone_HeaderSearchPaths.push_back("$(SRCROOT)");
|
||||
for (StringList::const_iterator i = setup.includeDirs.begin(); i != setup.includeDirs.end(); ++i)
|
||||
iPhone_HeaderSearchPaths.push_back("\"" + *i + "\"");
|
||||
for (const auto &includeDir : setup.includeDirs)
|
||||
iPhone_HeaderSearchPaths.push_back("\"" + includeDir + "\"");
|
||||
iPhone_HeaderSearchPaths.push_back("\"" + projectOutputDirectory + "\"");
|
||||
if (!setup.useXCFramework) {
|
||||
iPhone_HeaderSearchPaths.push_back("\"" + projectOutputDirectory + "/include\"");
|
||||
@@ -1481,8 +1479,8 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
|
||||
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;
|
||||
for (StringList::const_iterator i = setup.libraryDirs.begin(); i != setup.libraryDirs.end(); ++i)
|
||||
iPhone_LibPaths.push_back("\"" + *i + "\"");
|
||||
for (const auto &libraryDir : setup.libraryDirs)
|
||||
iPhone_LibPaths.push_back("\"" + libraryDir + "\"");
|
||||
iPhone_LibPaths.push_back("$(inherited)");
|
||||
if (!setup.useXCFramework)
|
||||
iPhone_LibPaths.push_back("\"" + projectOutputDirectory + "/lib\"");
|
||||
@@ -1555,8 +1553,8 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
|
||||
ValueList tvOS_HeaderSearchPaths;
|
||||
tvOS_HeaderSearchPaths.push_back("$(SRCROOT)/engines/");
|
||||
tvOS_HeaderSearchPaths.push_back("$(SRCROOT)");
|
||||
for (StringList::const_iterator i = setup.includeDirs.begin(); i != setup.includeDirs.end(); ++i)
|
||||
tvOS_HeaderSearchPaths.push_back("\"" + *i + "\"");
|
||||
for (const auto &includeDir : setup.includeDirs)
|
||||
tvOS_HeaderSearchPaths.push_back("\"" + includeDir + "\"");
|
||||
tvOS_HeaderSearchPaths.push_back("\"" + projectOutputDirectory + "\"");
|
||||
tvOS_HeaderSearchPaths.push_back("\"" + projectOutputDirectory + "/include\"");
|
||||
if (CONTAINS_DEFINE(setup.defines, "USE_SDL_NET")) {
|
||||
@@ -1565,8 +1563,8 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
|
||||
ADD_SETTING_LIST(tvOS_Debug, "HEADER_SEARCH_PATHS", tvOS_HeaderSearchPaths, kSettingsAsList | kSettingsQuoteVariable, 5);
|
||||
ADD_SETTING_QUOTE(tvOS_Debug, "INFOPLIST_FILE", "$(SRCROOT)/dists/tvos/Info.plist");
|
||||
ValueList tvOS_LibPaths;
|
||||
for (StringList::const_iterator i = setup.libraryDirs.begin(); i != setup.libraryDirs.end(); ++i)
|
||||
tvOS_LibPaths.push_back("\"" + *i + "\"");
|
||||
for (const auto &libraryDir : setup.libraryDirs)
|
||||
tvOS_LibPaths.push_back("\"" + libraryDir + "\"");
|
||||
tvOS_LibPaths.push_back("$(inherited)");
|
||||
tvOS_LibPaths.push_back("\"" + projectOutputDirectory + "/lib\"");
|
||||
ADD_SETTING_LIST(tvOS_Debug, "LIBRARY_SEARCH_PATHS", tvOS_LibPaths, kSettingsAsList, 5);
|
||||
@@ -1611,15 +1609,15 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
|
||||
}
|
||||
|
||||
// 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 (const auto *config : _buildConfiguration._objects) {
|
||||
|
||||
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 = kSettingsAsList;
|
||||
|
||||
buildConfigs._settings[getHash((*config)->_id)] = Setting("", "Debug", kSettingsNoValue, 0, 0);
|
||||
buildConfigs._settings[getHash((*(++config))->_id)] = Setting("", "Release", kSettingsNoValue, 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;
|
||||
|
||||
@@ -1664,8 +1662,8 @@ void XcodeProvider::setupAdditionalSources(std::string targetName, Property &fil
|
||||
// Setup global defines
|
||||
void XcodeProvider::setupDefines(const BuildSetup &setup) {
|
||||
|
||||
for (StringList::const_iterator i = setup.defines.begin(); i != setup.defines.end(); ++i) {
|
||||
ADD_DEFINE(_defines, *i);
|
||||
for (const auto &define : setup.defines) {
|
||||
ADD_DEFINE(_defines, define);
|
||||
}
|
||||
// Add special defines for Mac support
|
||||
// TODO: check if it's still needed
|
||||
@@ -1764,11 +1762,11 @@ std::string XcodeProvider::writeProperty(const std::string &variable, Property &
|
||||
output += (prop._flags & kSettingsAsList) ? "(\n" : "{\n";
|
||||
|
||||
OrderedSettingList settings = prop.getOrderedSettingList();
|
||||
for (OrderedSettingList::const_iterator setting = settings.begin(); setting != settings.end(); ++setting) {
|
||||
for (const auto &setting : settings) {
|
||||
if (settings.size() > 1 || (prop._flags & kSettingsSingleItem))
|
||||
output += (flags & kSettingsSingleItem ? " " : "\t\t\t\t");
|
||||
|
||||
output += writeSetting(setting->first, setting->second);
|
||||
output += writeSetting(setting.first, setting.second);
|
||||
|
||||
// The combination of kSettingsAsList, and kSettingsSingleItem should use "," and not ";" (i.e children
|
||||
// in PBXGroup, so we special case that case here.
|
||||
|
||||
@@ -94,8 +94,8 @@ private:
|
||||
}
|
||||
|
||||
Setting(ValueList values, int flgs = 0, int idt = 0, int ord = -1) : _flags(flgs), _indent(idt), _order(ord) {
|
||||
for (unsigned int i = 0; i < values.size(); i++)
|
||||
_entries.push_back(Entry(values[i], ""));
|
||||
for (const auto &value : values)
|
||||
_entries.push_back(Entry(value, ""));
|
||||
}
|
||||
|
||||
Setting(EntryList ents, int flgs = 0, int idt = 0, int ord = -1) : _entries(ents), _flags(flgs), _indent(idt), _order(ord) {}
|
||||
@@ -134,8 +134,8 @@ private:
|
||||
OrderedSettingList list;
|
||||
|
||||
// Prepare vector to sort
|
||||
for (SettingList::const_iterator setting = _settings.begin(); setting != _settings.end(); ++setting)
|
||||
list.push_back(SettingPair(setting->first, setting->second));
|
||||
for (const auto &setting : _settings)
|
||||
list.emplace_back(setting.first, setting.second);
|
||||
|
||||
// Sort vector using setting order
|
||||
if (_hasOrder)
|
||||
@@ -187,11 +187,11 @@ private:
|
||||
output += _parent->writeProperty("isa", _properties["isa"], flags);
|
||||
|
||||
// Write each property
|
||||
for (PropertyList::iterator property = _properties.begin(); property != _properties.end(); ++property) {
|
||||
if (property->first == "isa")
|
||||
for (auto &property : _properties) {
|
||||
if (property.first == "isa")
|
||||
continue;
|
||||
|
||||
output += _parent->writeProperty(property->first, property->second, flags);
|
||||
output += _parent->writeProperty(property.first, property.second, flags);
|
||||
}
|
||||
|
||||
if (flags & kSettingsAsList)
|
||||
@@ -244,9 +244,9 @@ private:
|
||||
}
|
||||
|
||||
Object *find(std::string id) {
|
||||
for (std::vector<Object *>::iterator it = _objects.begin(); it != _objects.end(); ++it) {
|
||||
if ((*it)->_id == id) {
|
||||
return *it;
|
||||
for (const auto &object : _objects) {
|
||||
if (object->_id == id) {
|
||||
return object;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@@ -258,8 +258,8 @@ private:
|
||||
if (!_comment.empty())
|
||||
output = "\n/* Begin " + _comment + " section */\n";
|
||||
|
||||
for (std::vector<Object *>::iterator object = _objects.begin(); object != _objects.end(); ++object)
|
||||
output += (*object)->toString(_flags);
|
||||
for (const auto &object : _objects)
|
||||
output += object->toString(_flags);
|
||||
|
||||
if (!_comment.empty())
|
||||
output += "/* End " + _comment + " section */\n";
|
||||
|
||||
Reference in New Issue
Block a user