]> git.tdb.fi Git - builder.git/blobdiff - source/buildinfo.cpp
Refactor transitive dependencies to work on all targets
[builder.git] / source / buildinfo.cpp
diff --git a/source/buildinfo.cpp b/source/buildinfo.cpp
deleted file mode 100644 (file)
index 77243ef..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-#include <algorithm>
-#include <set>
-#include "buildinfo.h"
-
-using namespace std;
-using namespace Msp;
-
-namespace {
-
-/** Removes any duplicate entries from a list, leaving only the first one.  The
-order of other elements is preserved.  O(nlogn) efficiency. */
-template<typename T>
-void unique(list<T> &l)
-{
-       set<T> seen;
-       for(typename list<T>::iterator i=l.begin(); i!=l.end(); )
-       {
-               if(seen.count(*i))
-                       l.erase(i++);
-               else
-                       seen.insert(*i++);
-       }
-}
-
-}
-
-
-BuildInfo::BuildInfo():
-       threads(false),
-       debug(false),
-       optimize(0),
-       strip(false)
-{ }
-
-void BuildInfo::update_from(const BuildInfo &bi, UpdateLevel level)
-{
-       for(DefineMap::const_iterator i=bi.defines.begin(); i!=bi.defines.end(); ++i)
-               defines[i->first] = i->second;
-       incpath.insert(incpath.end(), bi.incpath.begin(), bi.incpath.end());
-       if(level!=CHAINED)
-       {
-               libpath.insert(libpath.end(), bi.libpath.begin(), bi.libpath.end());
-               libs.insert(libs.end(), bi.libs.begin(), bi.libs.end());
-       }
-       warnings.insert(warnings.end(), bi.warnings.begin(), bi.warnings.end());
-       threads = bi.threads;
-       if(level==LOCAL)
-       {
-               debug = bi.debug;
-               optimize = bi.optimize;
-               strip = bi.strip;
-       }
-
-       unique();
-}
-
-void BuildInfo::unique()
-{
-       ::unique(incpath);
-       ::unique(libpath);
-       ::unique(libs);
-
-       for(StringList::iterator i=warnings.begin(); i!=warnings.end(); ++i)
-       {
-               bool flag = i->compare(0, 3, "no-");
-
-               string warn = (flag ? *i : i->substr(3));
-               string no_warn = "no-"+warn;
-
-               for(StringList::iterator j=i; j!=warnings.end();)
-               {
-                       if(j!=i && (*j==warn || *j==no_warn))
-                       {
-                               flag = (*j==warn);
-                               j = warnings.erase(j);
-                       }
-                       else
-                               ++j;
-               }
-
-               *i = (flag ? warn : no_warn);
-       }
-}
-
-
-BuildInfo::Loader::Loader(BuildInfo &bi):
-       DataFile::ObjectLoader<BuildInfo>(bi)
-{
-       add("debug",    &BuildInfo::debug);
-       add("define",   &Loader::define);
-       add("incpath",  &Loader::incpath);
-       add("libpath",  &Loader::libpath);
-       add("library",  &Loader::library);
-       add("optimize", &BuildInfo::optimize);
-       add("strip",    &BuildInfo::strip);
-       add("threads",  &BuildInfo::threads);
-       add("warning",  &Loader::warning);
-}
-
-void BuildInfo::Loader::incpath(const std::string &s)
-{
-       obj.incpath.push_back(s);
-}
-
-void BuildInfo::Loader::define(const std::string &d, const std::string &v)
-{
-       obj.defines[d] = v;
-}
-
-void BuildInfo::Loader::libpath(const std::string &s)
-{
-       obj.libpath.push_back(s);
-}
-
-void BuildInfo::Loader::library(const std::string &s)
-{
-       obj.libs.push_back(s);
-}
-
-void BuildInfo::Loader::warning(const std::string &s)
-{
-       obj.warnings.push_back(s);
-}