--- /dev/null
+/* $Id$
+
+This file is part of builder
+Copyright © 2009 Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#include "feature.h"
+
+Feature::Loader::Loader(Feature &f):
+ Msp::DataFile::BasicLoader<Feature>(f)
+{
+ add("description", &Feature::descr);
+ add("default", &Feature::def_value);
+}
#ifndef FEATURE_H_
#define FEATURE_H_
+#include <msp/datafile/loader.h>
+
struct Feature
{
+ class Loader: public Msp::DataFile::BasicLoader<Feature>
+ {
+ public:
+ Loader(Feature &);
+ };
+
std::string name;
std::string descr;
+ std::string def_value;
- Feature(const std::string &n, const std::string &d): name(n), descr(d) { }
+ Feature(const std::string &n): name(n) { }
};
typedef std::list<Feature> FeatureList;
config.add_option("tempdir", "temp", "Directory for storing temporary files");
config.add_option("outdir", ".", "Directory to put build results in");
config.add_option("optimize", "0", "Apply compiler optimizations");
- config.add_option("strip", "0", "Strip symbols from programs");
- config.add_option("debug", "0", "Produce debugging symbols");
+ config.add_option("strip", "no", "Strip symbols from programs");
+ config.add_option("debug", "no", "Produce debugging symbols");
config.add_option("cpu", "none", "CPU type to optimize for");
config.add_option("staticlibs", "local", "Use static libraries");
for(FeatureList::iterator i=features.begin(); i!=features.end(); ++i)
- config.add_option("with_"+i->name, "0", i->descr);
+ config.add_option("with_"+i->name, i->def_value, i->descr);
for(PackageList::const_iterator i=requires.begin(); i!=requires.end(); ++i)
{
void SourcePackage::Loader::feature(const string &n, const string &d)
{
- static_cast<SourcePackage &>(pkg).features.push_back(Feature(n, d));
+ Feature feat(n);
+ feat.descr = d;
+ feat.def_value = "no";
+ load_sub(feat);
+ static_cast<SourcePackage &>(pkg).features.push_back(feat);
}
void SourcePackage::Loader::condition(const string &c)