aboutsummaryrefslogtreecommitdiff
path: root/build2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-08-26 07:34:15 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-08-26 07:34:15 +0200
commit8e0e8edb727a5367d991880b033eb13060f4c8eb (patch)
tree75916dbef9b7a0dc6ef0fa939b9f748fc353d5cc /build2
parent113c43a42d20073428d46c04a1aa1cb305ea12d7 (diff)
Make target types project-wide
Diffstat (limited to 'build2')
-rw-r--r--build2/bin/init.cxx69
-rw-r--r--build2/cc/module.cxx12
-rw-r--r--build2/cli/init.cxx9
3 files changed, 44 insertions, 46 deletions
diff --git a/build2/bin/init.cxx b/build2/bin/init.cxx
index 4e80834..54bd84a 100644
--- a/build2/bin/init.cxx
+++ b/build2/bin/init.cxx
@@ -402,7 +402,7 @@ namespace build2
scope& bs,
const location& loc,
unique_ptr<module_base>&,
- bool,
+ bool first,
bool,
const variable_map& hints)
{
@@ -421,41 +421,41 @@ namespace build2
// Register target types and configure their default "installability".
//
bool install_loaded (cast_false<bool> (rs["install.loaded"]));
-
{
using namespace install;
- auto& t (bs.target_types);
-
- t.insert<obj> ();
- t.insert<obje> ();
- t.insert<obja> ();
- t.insert<objs> ();
-
- t.insert<bmi> ();
- t.insert<bmie> ();
- t.insert<bmia> ();
- t.insert<bmis> ();
-
- t.insert<hbmi> ();
- t.insert<hbmie> ();
- t.insert<hbmia> ();
- t.insert<hbmis> ();
-
- t.insert<libul> ();
- t.insert<libue> ();
- t.insert<libua> ();
- t.insert<libus> ();
-
- t.insert<lib> ();
- t.insert<liba> ();
- t.insert<libs> ();
-
- // Register the def{} target type. Note that we do it here since it is
- // input and can be specified unconditionally (i.e., not only when
- // building for Windows).
- //
- t.insert<def> ();
+ if (first)
+ {
+ rs.insert_target_type<obj> ();
+ rs.insert_target_type<obje> ();
+ rs.insert_target_type<obja> ();
+ rs.insert_target_type<objs> ();
+
+ rs.insert_target_type<bmi> ();
+ rs.insert_target_type<bmie> ();
+ rs.insert_target_type<bmia> ();
+ rs.insert_target_type<bmis> ();
+
+ rs.insert_target_type<hbmi> ();
+ rs.insert_target_type<hbmie> ();
+ rs.insert_target_type<hbmia> ();
+ rs.insert_target_type<hbmis> ();
+
+ rs.insert_target_type<libul> ();
+ rs.insert_target_type<libue> ();
+ rs.insert_target_type<libua> ();
+ rs.insert_target_type<libus> ();
+
+ rs.insert_target_type<lib> ();
+ rs.insert_target_type<liba> ();
+ rs.insert_target_type<libs> ();
+
+ // Register the def{} target type. Note that we do it here since it
+ // is input and can be specified unconditionally (i.e., not only
+ // when building for Windows).
+ //
+ rs.insert_target_type<def> ();
+ }
// Note: libu*{} members are not installable.
//
@@ -494,7 +494,8 @@ namespace build2
{
// Import library.
//
- t.insert<libi> ();
+ if (first)
+ rs.insert_target_type<libi> ();
if (install_loaded)
{
diff --git a/build2/cc/module.cxx b/build2/cc/module.cxx
index 064d954..bd853cc 100644
--- a/build2/cc/module.cxx
+++ b/build2/cc/module.cxx
@@ -642,13 +642,11 @@ namespace build2
{
using namespace install;
- auto& tts (rs.target_types);
+ rs.insert_target_type (x_src);
- tts.insert (x_src);
-
- auto insert_hdr = [&rs, &tts, install_loaded] (const target_type& tt)
+ auto insert_hdr = [&rs, install_loaded] (const target_type& tt)
{
- tts.insert (tt);
+ rs.insert_target_type (tt);
// Install headers into install.include.
//
@@ -666,8 +664,8 @@ namespace build2
if (*x_hdr != &h::static_type)
insert_hdr (h::static_type);
- tts.insert<pca> ();
- tts.insert<pcs> ();
+ rs.insert_target_type<pca> ();
+ rs.insert_target_type<pcs> ();
if (install_loaded)
install_path<pc> (rs, dir_path ("pkgconfig"));
diff --git a/build2/cli/init.cxx b/build2/cli/init.cxx
index 2e553f7..3aebe8e 100644
--- a/build2/cli/init.cxx
+++ b/build2/cli/init.cxx
@@ -301,7 +301,7 @@ namespace build2
scope& bs,
const location& l,
unique_ptr<module_base>&,
- bool,
+ bool first,
bool optional,
const variable_map& hints)
{
@@ -334,11 +334,10 @@ namespace build2
// Register target types.
//
+ if (first)
{
- auto& t (bs.target_types);
-
- t.insert<cli> ();
- t.insert<cli_cxx> ();
+ rs.insert_target_type<cli> ();
+ rs.insert_target_type<cli_cxx> ();
}
// Register our rules.