aboutsummaryrefslogtreecommitdiff
path: root/build2/cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-05-31 16:35:50 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-05-31 16:36:49 +0200
commit9ae4897cfe935598333a5f709e967fefc4c161aa (patch)
tree16bfbcb21a10994a29db602f5cb77a0a50627bdf /build2/cxx
parentb2fc1fb4a13ffa58640333a3909dd0e53bd21995 (diff)
C++ modules work: add target types
Diffstat (limited to 'build2/cxx')
-rw-r--r--build2/cxx/init.cxx11
-rw-r--r--build2/cxx/target.cxx13
-rw-r--r--build2/cxx/target.hxx15
3 files changed, 36 insertions, 3 deletions
diff --git a/build2/cxx/init.cxx b/build2/cxx/init.cxx
index fde12e3..a5422d2 100644
--- a/build2/cxx/init.cxx
+++ b/build2/cxx/init.cxx
@@ -375,19 +375,21 @@ namespace build2
static const target_type* const hdr[] =
{
&hxx::static_type,
+ &h::static_type,
&ixx::static_type,
&txx::static_type,
- &h::static_type,
+ &mxx::static_type,
nullptr
};
static const target_type* const inc[] =
{
&hxx::static_type,
+ &h::static_type,
&ixx::static_type,
&txx::static_type,
+ &mxx::static_type,
&cxx::static_type,
- &h::static_type,
&c::static_type,
nullptr
};
@@ -414,6 +416,8 @@ namespace build2
if (!cast_false<bool> (rs["cxx.config.loaded"]))
load_module (rs, rs, "cxx.config", loc, false, hints);
+ bool modules (cast<bool> (rs["cxx.features.modules"]));
+
config_module& cm (*rs.modules.lookup<config_module> ("cxx.config"));
cc::data d {
@@ -433,13 +437,14 @@ namespace build2
cm.tstd,
- cast<bool> (rs["cxx.features.modules"]),
+ modules,
cast_null<process_path> (rs["pkgconfig.path"]),
cast<dir_paths> (rs[cm.x_sys_lib_dirs]),
cast<dir_paths> (rs[cm.x_sys_inc_dirs]),
cxx::static_type,
+ modules ? &mxx::static_type : nullptr,
hdr,
inc
};
diff --git a/build2/cxx/target.cxx b/build2/cxx/target.cxx
index 7fb9971..5641e7a 100644
--- a/build2/cxx/target.cxx
+++ b/build2/cxx/target.cxx
@@ -63,5 +63,18 @@ namespace build2
&file_search,
false
};
+
+ extern const char mxx_ext_def[] = "mxx";
+ const target_type mxx::static_type
+ {
+ "mxx",
+ &cc::static_type,
+ &target_factory<mxx>,
+ &target_extension_var<ext_var, mxx_ext_def>,
+ &target_pattern_var<ext_var, mxx_ext_def>,
+ nullptr,
+ &file_search,
+ false
+ };
}
}
diff --git a/build2/cxx/target.hxx b/build2/cxx/target.hxx
index 4dd93e3..f5591d1 100644
--- a/build2/cxx/target.hxx
+++ b/build2/cxx/target.hxx
@@ -57,6 +57,21 @@ namespace build2
static const target_type static_type;
virtual const target_type& dynamic_type () const {return static_type;}
};
+
+ // The module interface unit is both like a header (e.g., we need to
+ // install it) and like a source (we need to compile it). Plus, to
+ // support dual use (modules/headers) it could actually be #include'd
+ // (and in both cases).
+ //
+ class mxx: public cc::cc
+ {
+ public:
+ using cc::cc;
+
+ public:
+ static const target_type static_type;
+ virtual const target_type& dynamic_type () const {return static_type;}
+ };
}
}