aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2009-10-26 21:52:11 +0000
committerJohannes Schickel2009-10-26 21:52:11 +0000
commit23173ae2c7dfc4d0a86092c7c118f6852aedea4c (patch)
tree97b3317dd54e005fd356adbe41543d00173d4272
parent7e0f8a9af9b78c43f73879118cbfe6f20731a71f (diff)
downloadscummvm-rg350-23173ae2c7dfc4d0a86092c7c118f6852aedea4c.tar.gz
scummvm-rg350-23173ae2c7dfc4d0a86092c7c118f6852aedea4c.tar.bz2
scummvm-rg350-23173ae2c7dfc4d0a86092c7c118f6852aedea4c.zip
Cleanup.
svn-id: r45421
-rw-r--r--tools/create_msvc/create_msvc.cpp21
-rw-r--r--tools/create_msvc/create_msvc.h11
2 files changed, 24 insertions, 8 deletions
diff --git a/tools/create_msvc/create_msvc.cpp b/tools/create_msvc/create_msvc.cpp
index 47f9a6bdbc..8cfed79ebf 100644
--- a/tools/create_msvc/create_msvc.cpp
+++ b/tools/create_msvc/create_msvc.cpp
@@ -144,13 +144,11 @@ int main(int argc, char *argv[]) {
for (EngineDescList::iterator j = setup.engines.begin(); j != setup.engines.end(); ++j)
j->enable = true;
} else if (!setEngineBuildState(name, setup.engines, true)) {
- FeatureList::iterator feature = std::find(setup.features.begin(), setup.features.end(), name);
- if (feature == setup.features.end()) {
+ // If none found, we'll try the features list
+ if (!setFeatureBuildState(name, setup.features, true)) {
std::cerr << "ERROR: \"" << name << "\" is neither an engine nor a feature!\n";
return -1;
}
-
- feature->enable = true;
}
} else if (!strncmp(argv[i], "--disable-", 10)) {
const char *name = &argv[i][10];
@@ -164,13 +162,10 @@ int main(int argc, char *argv[]) {
j->enable = false;
} else if (!setEngineBuildState(name, setup.engines, false)) {
// If none found, we'll try the features list
- FeatureList::iterator feature = std::find(setup.features.begin(), setup.features.end(), name);
- if (feature == setup.features.end()) {
+ if (!setFeatureBuildState(name, setup.features, false)) {
std::cerr << "ERROR: \"" << name << "\" is neither an engine nor a feature!\n";
return -1;
}
-
- feature->enable = false;
}
} else if (!strcmp(argv[i], "--file-prefix")) {
if (i + 1 >= argc) {
@@ -542,6 +537,16 @@ StringList getFeatureLibraries(const FeatureList &features) {
return libraries;
}
+bool setFeatureBuildState(const std::string &name, FeatureList &features, bool enable) {
+ FeatureList::iterator i = std::find(features.begin(), features.end(), name);
+ if (i != features.end()) {
+ i->enable = enable;
+ return true;
+ } else {
+ return false;
+ }
+}
+
namespace {
typedef std::map<std::string, std::string> UUIDMap;
diff --git a/tools/create_msvc/create_msvc.h b/tools/create_msvc/create_msvc.h
index 093b73e4de..17830ff8c6 100644
--- a/tools/create_msvc/create_msvc.h
+++ b/tools/create_msvc/create_msvc.h
@@ -164,6 +164,17 @@ StringList getFeatureDefines(const FeatureList &features);
StringList getFeatureLibraries(const FeatureList &features);
/**
+ * Sets the state of a given feature. This can be used to
+ * either include or exclude an feature.
+ *
+ * @param name Name of the feature.
+ * @param features List of features to operate on.
+ * @param enable Whether the feature should be enabled or disabled.
+ * @return "true", when it succeeded, "false" otherwise.
+ */
+bool setFeatureBuildState(const std::string &name, FeatureList &features, bool enable);
+
+/**
* Structure to describe a MSVC build setup.
*
* This includes various information about which engines to