From 08f36d41ea69ca331715ac8d70b0bf8fd849f401 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 12 Jun 2018 11:56:18 +0200 Subject: Add built-in support for Windows module definition files (.def) --- build2/bin/init.cxx | 6 ++++++ build2/bin/target.cxx | 17 +++++++++++++++++ build2/bin/target.hxx | 12 ++++++++++++ 3 files changed, 35 insertions(+) (limited to 'build2/bin') diff --git a/build2/bin/init.cxx b/build2/bin/init.cxx index 0761bb6..13e3289 100644 --- a/build2/bin/init.cxx +++ b/build2/bin/init.cxx @@ -399,6 +399,12 @@ namespace build2 t.insert (); t.insert (); + // 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 (); + // Note: libu*{} are not installable. // if (install_loaded) diff --git a/build2/bin/target.cxx b/build2/bin/target.cxx index aee2d25..a33875c 100644 --- a/build2/bin/target.cxx +++ b/build2/bin/target.cxx @@ -364,5 +364,22 @@ namespace build2 &file_search, false }; + + // def + // + extern const char def_ext[] = "def"; // VC14 rejects constexpr. + + const target_type def::static_type + { + "def", + &file::static_type, + &target_factory, + &target_extension_fix, + nullptr, /* default_extension */ + &target_pattern_fix, + nullptr, + &file_search, + false + }; } } diff --git a/build2/bin/target.hxx b/build2/bin/target.hxx index 32ef0fb..f0b427f 100644 --- a/build2/bin/target.hxx +++ b/build2/bin/target.hxx @@ -264,6 +264,18 @@ namespace build2 static const target_type static_type; virtual const target_type& dynamic_type () const {return static_type;} }; + + // Windows module definition (.def). + // + class def: public file + { + public: + using file::file; + + public: + static const target_type static_type; + virtual const target_type& dynamic_type () const {return static_type;} + }; } } -- cgit v1.1