From 3cc5e3bd441fc9d18fece3d9e99fae75c78438e7 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 28 Jun 2018 09:44:15 +0200 Subject: Implement support for excluded and ad hoc prerequisites The inclusion/exclusion is controlled via the 'include' prerequisite-specific variable. Valid values are: false - exclude true - include adhoc - include but treat as an ad hoc input For example: lib{foo}: cxx{win32-utility}: include = ($cxx.targe.class == 'windows') exe{bar}: libs{plugin}: include = adhoc --- build2/target.hxx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'build2/target.hxx') diff --git a/build2/target.hxx b/build2/target.hxx index 761cb4e..515a082 100644 --- a/build2/target.hxx +++ b/build2/target.hxx @@ -15,8 +15,8 @@ #include #include +#include #include -#include #include #include #include @@ -92,14 +92,18 @@ namespace build2 { using target_type = build2::target; - prerequisite_target (const target_type* t, uintptr_t d = 0) - : target (t), data (d) {} + prerequisite_target (const target_type* t, bool a = false, uintptr_t d = 0) + : target (t), adhoc (a), data (d) {} + + prerequisite_target (const target_type* t, include_type a, uintptr_t d = 0) + : prerequisite_target (t, a == include_type::adhoc, d) {} operator const target_type*& () {return target;} operator const target_type* () const {return target;} const target_type* operator-> () const {return target;} const target_type* target; + bool adhoc; // True if include=adhoc. uintptr_t data; }; using prerequisite_targets = vector; @@ -932,6 +936,12 @@ namespace build2 return os << pm.key (); } + inline include_type + include (action a, const target& t, const prerequisite_member& pm) + { + return include (a, t, pm.prerequisite, pm.member); + } + // A "range" that presents a sequence of prerequisites (e.g., from // group_prerequisites()) as a sequence of prerequisite_member's. For each // group prerequisite you will "see" either the prerequisite itself or all -- cgit v1.1