From 3cf3b73ffc6881d5428a735736a347f6e143b366 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 29 Feb 2016 10:57:40 +0200 Subject: Implement auxiliary dependency database (.d files), use in cxx.compile This is part of the "High Fidelity Build" work. --- build2/utility.cxx | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'build2/utility.cxx') 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 // strtol() #include +#include #include 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& l) + { + if (l) + append_options (args, as (*l)); + } + + void + hash_options (sha256& csum, const lookup& l) + { + if (l) + hash_options (csum, as (*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& l) + { + if (l) + { + for (const string& s: as (*l)) + { + if (s == option) + return true; + } + } + + return false; + } + unsigned int to_version (const string& s) { -- cgit v1.1