diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-02-29 10:57:40 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-02-29 10:57:40 +0200 |
commit | 3cf3b73ffc6881d5428a735736a347f6e143b366 (patch) | |
tree | 3559fa9d2d44cc11e07987752027f7c2a9e3e23e /build2/utility.cxx | |
parent | 2a4f52c46f2081aaeb2664e8026d3d067142e3d5 (diff) |
Implement auxiliary dependency database (.d files), use in cxx.compile
This is part of the "High Fidelity Build" work.
Diffstat (limited to 'build2/utility.cxx')
-rw-r--r-- | build2/utility.cxx | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/build2/utility.cxx b/build2/utility.cxx index b517deb..c3dd99f 100644 --- a/build2/utility.cxx +++ b/build2/utility.cxx @@ -7,6 +7,7 @@ #include <cstdlib> // strtol() #include <build2/context> +#include <build2/variable> #include <build2/diagnostics> using namespace std; @@ -49,6 +50,54 @@ namespace build2 const path empty_path; const dir_path empty_dir_path; + void + append_options (cstrings& args, const lookup<const value>& l) + { + if (l) + append_options (args, as<strings> (*l)); + } + + void + hash_options (sha256& csum, const lookup<const value>& l) + { + if (l) + hash_options (csum, as<strings> (*l)); + } + + void + append_options (cstrings& args, const const_strings_value& sv) + { + if (!sv.empty ()) + { + args.reserve (args.size () + sv.size ()); + + for (const string& s: sv) + args.push_back (s.c_str ()); + } + } + + void + hash_options (sha256& csum, const const_strings_value& sv) + { + for (const string& s: sv) + csum.append (s); + } + + bool + find_option (const char* option, const lookup<const value>& l) + { + if (l) + { + for (const string& s: as<strings> (*l)) + { + if (s == option) + return true; + } + } + + return false; + } + unsigned int to_version (const string& s) { |