CREATE_PROJECT: Add ability to remove feature from setup
This commit is contained in:
parent
0de86d6fbf
commit
a23b1789db
2 changed files with 49 additions and 4 deletions
|
@ -1168,14 +1168,22 @@ StringList getFeatureDefines(const FeatureList &features) {
|
|||
return defines;
|
||||
}
|
||||
|
||||
StringList getFeatureLibraries(const Feature &feature) {
|
||||
StringList libraries;
|
||||
|
||||
if (feature.enable && feature.libraries && feature.libraries[0]) {
|
||||
StringList fLibraries = tokenize(feature.libraries);
|
||||
libraries.splice(libraries.end(), fLibraries);
|
||||
}
|
||||
|
||||
return libraries;
|
||||
}
|
||||
|
||||
StringList getFeatureLibraries(const FeatureList &features) {
|
||||
StringList libraries;
|
||||
|
||||
for (FeatureList::const_iterator i = features.begin(); i != features.end(); ++i) {
|
||||
if (i->enable && i->libraries && i->libraries[0]) {
|
||||
StringList fLibraries = tokenize(i->libraries);
|
||||
libraries.splice(libraries.end(), fLibraries);
|
||||
}
|
||||
libraries.merge(getFeatureLibraries(*i));
|
||||
}
|
||||
|
||||
return libraries;
|
||||
|
@ -1200,6 +1208,26 @@ bool getFeatureBuildState(const std::string &name, FeatureList &features) {
|
|||
}
|
||||
}
|
||||
|
||||
BuildSetup removeFeatureFromSetup(BuildSetup setup, const std::string &feature) {
|
||||
for (FeatureList::const_iterator i = setup.features.begin(); i != setup.features.end(); ++i) {
|
||||
if (i->enable && feature == i->name) {
|
||||
StringList fribidi_libs = getFeatureLibraries(*i);
|
||||
for (auto& lib : fribidi_libs) {
|
||||
if (setup.useCanonicalLibNames) {
|
||||
lib = getCanonicalLibName(lib);
|
||||
}
|
||||
setup.libraries.remove(lib);
|
||||
}
|
||||
if (i->define && i->define[0]) {
|
||||
setup.defines.remove(i->define);
|
||||
}
|
||||
setup.features.erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return setup;
|
||||
}
|
||||
|
||||
ToolList getAllTools() {
|
||||
const size_t toolCount = sizeof(s_tools) / sizeof(s_tools[0]);
|
||||
|
||||
|
|
|
@ -200,6 +200,14 @@ StringList getFeatureDefines(const FeatureList &features);
|
|||
*/
|
||||
StringList getFeatureLibraries(const FeatureList &features);
|
||||
|
||||
/**
|
||||
* Returns a list of all external library files, according to the
|
||||
* feature passed.
|
||||
*
|
||||
* @param features Feature for the build (this may contain features, which are *not* enabled!)
|
||||
*/
|
||||
StringList getFeatureLibraries(const Feature& feature);
|
||||
|
||||
/**
|
||||
* Sets the state of a given feature. This can be used to
|
||||
* either include or exclude an feature.
|
||||
|
@ -326,6 +334,15 @@ int getInstalledMSVC();
|
|||
*/
|
||||
std::string getCanonicalLibName(std::string lib);
|
||||
|
||||
/**
|
||||
* Removes given feature from setup.
|
||||
*
|
||||
* @param setup The setup to be processed.
|
||||
* @param feature The feature to be removed
|
||||
* @return A copy of setup less feature.
|
||||
*/
|
||||
BuildSetup removeFeatureFromSetup(BuildSetup setup, const std::string &feature);
|
||||
|
||||
namespace CreateProjectTool {
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue