aboutsummaryrefslogtreecommitdiff
path: root/build2/algorithm.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-07-28 13:46:26 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-07-28 13:46:26 +0200
commit1c7cbb302b1c6e41eb0c5cecfc655532f1919cba (patch)
tree84375e8be2bfe00b2387f02cab8dcca396019299 /build2/algorithm.ixx
parent24402ed431c1780914576f72350f8796308cb59b (diff)
Implement support for linking whole archive
Diffstat (limited to 'build2/algorithm.ixx')
-rw-r--r--build2/algorithm.ixx49
1 files changed, 46 insertions, 3 deletions
diff --git a/build2/algorithm.ixx b/build2/algorithm.ixx
index 53501d3..892c832 100644
--- a/build2/algorithm.ixx
+++ b/build2/algorithm.ixx
@@ -29,6 +29,31 @@ namespace build2
return *r;
}
+ inline const target*
+ search_existing (const prerequisite& p)
+ {
+ assert (phase == run_phase::match || phase == run_phase::execute);
+
+ const target* r (p.target.load (memory_order_consume));
+
+ if (r == nullptr)
+ {
+ r = search_existing (p.key ());
+
+ if (r != nullptr)
+ {
+ const target* e (nullptr);
+ if (!p.target.compare_exchange_strong (
+ e, r,
+ memory_order_release,
+ memory_order_consume))
+ assert (e == r);
+ }
+ }
+
+ return r;
+ }
+
inline const target&
search (const target& t, const target_type& tt, const prerequisite_key& k)
{
@@ -54,9 +79,27 @@ namespace build2
proj,
{
&type,
- &dir,
- &out,
- &name,
+ &dir, &out, &name,
+ ext != nullptr ? optional<string> (*ext) : nullopt
+ },
+ scope});
+ }
+
+ inline const target*
+ search_existing (const target_type& type,
+ const dir_path& dir,
+ const dir_path& out,
+ const string& name,
+ const string* ext,
+ const scope* scope,
+ const optional<string>& proj)
+ {
+ return search_existing (
+ prerequisite_key {
+ proj,
+ {
+ &type,
+ &dir, &out, &name,
ext != nullptr ? optional<string> (*ext) : nullopt
},
scope});