ALL: Sync with ScummVM rev: a4002bdeee
This commit is contained in:
parent
e6516edf5e
commit
4631c0e2ed
121 changed files with 1977 additions and 740 deletions
|
@ -103,6 +103,8 @@ enum ProjectType {
|
|||
kProjectXcode
|
||||
};
|
||||
|
||||
std::map<std::string, bool> isEngineEnabled;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
#ifndef USE_WIN32_API
|
||||
// Initialize random number generator for UUID creation
|
||||
|
@ -312,6 +314,7 @@ int main(int argc, char *argv[]) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
isEngineEnabled[i->name] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -402,6 +405,10 @@ int main(int argc, char *argv[]) {
|
|||
setup.defines.push_back("USE_SDL2");
|
||||
}
|
||||
|
||||
if (setup.useStaticDetection) {
|
||||
setup.defines.push_back("DETECTION_STATIC");
|
||||
}
|
||||
|
||||
// List of global warnings and map of project-specific warnings
|
||||
// FIXME: As shown below these two structures have different behavior for
|
||||
// Code::Blocks and MSVC. In Code::Blocks this is used to enable *and*
|
||||
|
@ -1059,6 +1066,9 @@ const Feature s_features[] = {
|
|||
// is just no current way of properly detecting this...
|
||||
{ "text-console", "USE_TEXT_CONSOLE_FOR_DEBUGGER", false, false, "Text console debugger" }, // This feature is always applied in xcode projects
|
||||
// { "tts", "USE_TTS", false, true, "Text to speech support"}
|
||||
{"builtin-resources", "BUILTIN_RESOURCES", false, true, "include resources (e.g. engine data, fonts) into the binary"},
|
||||
{"detection-static", "USE_DETECTION_FEATURES_STATIC", false, true, "Static linking of detection objects for engines."},
|
||||
{ "cxx11", "USE_CXX11", false, true, "Compile with c++11 support"}
|
||||
};
|
||||
|
||||
const Tool s_tools[] = {
|
||||
|
@ -1531,6 +1541,24 @@ void ProjectProvider::createProject(BuildSetup &setup) {
|
|||
//ResidualVM specific:
|
||||
createModuleList(setup.srcDir + "/math", setup.defines, setup.testDirs, in, ex);
|
||||
|
||||
// Create engine-detection submodules.
|
||||
if (setup.useStaticDetection) {
|
||||
std::vector<std::string> detectionModuleDirs;
|
||||
detectionModuleDirs.reserve(setup.engines.size());
|
||||
|
||||
for (EngineDescList::const_iterator i = setup.engines.begin(), end = setup.engines.end(); i != end; ++i) {
|
||||
// We ignore all sub engines here because they require no special handling.
|
||||
if (isSubEngine(i->name, setup.engines)) {
|
||||
continue;
|
||||
}
|
||||
detectionModuleDirs.push_back(setup.srcDir + "/engines/" + i->name);
|
||||
}
|
||||
|
||||
for (std::string &str : detectionModuleDirs) {
|
||||
createModuleList(str, setup.defines, setup.testDirs, in, ex, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Resource files
|
||||
addResourceFiles(setup, in, ex);
|
||||
|
||||
|
@ -1554,7 +1582,7 @@ void ProjectProvider::createProject(BuildSetup &setup) {
|
|||
createOtherBuildFiles(setup);
|
||||
|
||||
// In case we create the main ScummVM project files we will need to
|
||||
// generate engines/plugins_table.h too.
|
||||
// generate engines/plugins_table.h & engines/detection_table.h
|
||||
if (!setup.tests && !setup.devTools) {
|
||||
createEnginePluginsTable(setup);
|
||||
}
|
||||
|
@ -1732,7 +1760,7 @@ void ProjectProvider::addFilesToProject(const std::string &dir, std::ofstream &p
|
|||
delete files;
|
||||
}
|
||||
|
||||
void ProjectProvider::createModuleList(const std::string &moduleDir, const StringList &defines, StringList &testDirs, StringList &includeList, StringList &excludeList) const {
|
||||
void ProjectProvider::createModuleList(const std::string &moduleDir, const StringList &defines, StringList &testDirs, StringList &includeList, StringList &excludeList, bool forDetection) const {
|
||||
const std::string moduleMkFile = moduleDir + "/module.mk";
|
||||
std::ifstream moduleMk(moduleMkFile.c_str());
|
||||
if (!moduleMk)
|
||||
|
@ -1744,6 +1772,7 @@ void ProjectProvider::createModuleList(const std::string &moduleDir, const Strin
|
|||
shouldInclude.push(true);
|
||||
|
||||
StringList filesInVariableList;
|
||||
std::string moduleRootDir;
|
||||
|
||||
bool hadModule = false;
|
||||
std::string line;
|
||||
|
@ -1777,6 +1806,10 @@ void ProjectProvider::createModuleList(const std::string &moduleDir, const Strin
|
|||
error("MODULE root " + moduleRoot + " does not match base dir " + moduleDir);
|
||||
|
||||
hadModule = true;
|
||||
if (forDetection) {
|
||||
moduleRootDir = moduleRoot;
|
||||
break;
|
||||
}
|
||||
} else if (*i == "MODULE_OBJS") {
|
||||
if (tokens.size() < 3)
|
||||
error("Malformed MODULE_OBJS definition in " + moduleMkFile);
|
||||
|
@ -1944,12 +1977,95 @@ void ProjectProvider::createModuleList(const std::string &moduleDir, const Strin
|
|||
shouldInclude.pop();
|
||||
} else if (*i == "elif") {
|
||||
error("Unsupported operation 'elif' in " + moduleMkFile);
|
||||
} else if (*i == "ifeq") {
|
||||
} else if (*i == "ifeq" || *i == "ifneq") {
|
||||
//XXX
|
||||
shouldInclude.push(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (forDetection) {
|
||||
int p = moduleRootDir.find('/');
|
||||
std::string engineName = moduleRootDir.substr(p + 1);
|
||||
std::string engineNameUpper;
|
||||
|
||||
for (char &c : engineName) {
|
||||
engineNameUpper += toupper(c);
|
||||
}
|
||||
for (;;) {
|
||||
std::getline(moduleMk, line);
|
||||
|
||||
if (moduleMk.eof())
|
||||
break;
|
||||
|
||||
if (moduleMk.fail())
|
||||
error("Failed while reading from " + moduleMkFile);
|
||||
|
||||
TokenList tokens = tokenize(line);
|
||||
if (tokens.empty())
|
||||
continue;
|
||||
|
||||
TokenList::const_iterator i = tokens.begin();
|
||||
|
||||
if (*i != "DETECT_OBJS" && *i != "ifneq") {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (*i == "ifneq") {
|
||||
++i;
|
||||
if (*i != ("($(ENABLE_" + engineNameUpper + "),")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// If the engine is already enabled, skip the additional
|
||||
// dependencies for detection objects.
|
||||
if (isEngineEnabled[engineName]) {
|
||||
bool breakEarly = false;
|
||||
while (true) {
|
||||
std::getline(moduleMk, line);
|
||||
if (moduleMk.eof()) {
|
||||
error("Unexpected EOF found, while parsing for " + engineName + " engine's module file.");
|
||||
} else if (line != "endif") {
|
||||
continue;
|
||||
} else {
|
||||
breakEarly = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (breakEarly) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while (*i != "DETECT_OBJS") {
|
||||
std::getline(moduleMk, line);
|
||||
if (moduleMk.eof()) {
|
||||
break;
|
||||
}
|
||||
|
||||
tokens = tokenize(line);
|
||||
|
||||
if (tokens.empty())
|
||||
continue;
|
||||
i = tokens.begin();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (tokens.size() < 3)
|
||||
error("Malformed DETECT_OBJS definition in " + moduleMkFile);
|
||||
++i;
|
||||
|
||||
if (*i != "+=")
|
||||
error("Malformed DETECT_OBJS definition in " + moduleMkFile);
|
||||
|
||||
++i;
|
||||
|
||||
p = (*i).find('/');
|
||||
const std::string filename = moduleDir + "/" + (*i).substr(p + 1);
|
||||
|
||||
includeList.push_back(filename);
|
||||
}
|
||||
}
|
||||
if (shouldInclude.size() != 1)
|
||||
error("Malformed file " + moduleMkFile);
|
||||
}
|
||||
|
@ -1958,17 +2074,29 @@ void ProjectProvider::createEnginePluginsTable(const BuildSetup &setup) {
|
|||
// First we need to create the "engines" directory.
|
||||
createDirectory(setup.outputDir + "/engines");
|
||||
|
||||
// Then, we can generate the actual "plugins_table.h" file.
|
||||
// Then, we can generate the actual "plugins_table.h" & "detection_table.h" file.
|
||||
const std::string enginePluginsTableFile = setup.outputDir + "/engines/plugins_table.h";
|
||||
const std::string detectionTableFile = setup.outputDir + "/engines/detection_table.h";
|
||||
|
||||
std::ofstream enginePluginsTable(enginePluginsTableFile.c_str());
|
||||
std::ofstream detectionTable(detectionTableFile.c_str());
|
||||
|
||||
if (!enginePluginsTable) {
|
||||
error("Could not open \"" + enginePluginsTableFile + "\" for writing");
|
||||
}
|
||||
|
||||
if (!detectionTable) {
|
||||
error("Could not open \"" + detectionTableFile + "\" for writing");
|
||||
}
|
||||
|
||||
enginePluginsTable << "/* This file is automatically generated by create_project */\n"
|
||||
<< "/* DO NOT EDIT MANUALLY */\n"
|
||||
<< "// This file is being included by \"base/plugins.cpp\"\n";
|
||||
|
||||
detectionTable << "/* This file is automatically generated by create_project */\n"
|
||||
<< "/* DO NOT EDIT MANUALLY */\n"
|
||||
<< "// This file is being included by \"base/plugins.cpp\"\n";
|
||||
|
||||
for (EngineDescList::const_iterator i = setup.engines.begin(), end = setup.engines.end(); i != end; ++i) {
|
||||
// We ignore all sub engines here because they require no special
|
||||
// handling.
|
||||
|
@ -1983,6 +2111,8 @@ void ProjectProvider::createEnginePluginsTable(const BuildSetup &setup) {
|
|||
enginePluginsTable << "#if PLUGIN_ENABLED_STATIC(" << engineName << ")\n"
|
||||
<< "LINK_PLUGIN(" << engineName << ")\n"
|
||||
<< "#endif\n";
|
||||
|
||||
detectionTable << "LINK_PLUGIN(" << engineName << "_DETECTION)\n";
|
||||
}
|
||||
}
|
||||
} // namespace CreateProjectTool
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue