aboutsummaryrefslogtreecommitdiff
path: root/build2/bin
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-06-12 11:56:18 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-06-12 11:56:18 +0200
commit08f36d41ea69ca331715ac8d70b0bf8fd849f401 (patch)
treeb377f5459fdcdcbf9e8980394386b1305b7dd516 /build2/bin
parente50b11ceb81089fc32eac7614b66daef7119f620 (diff)
Add built-in support for Windows module definition files (.def)
Diffstat (limited to 'build2/bin')
-rw-r--r--build2/bin/init.cxx6
-rw-r--r--build2/bin/target.cxx17
-rw-r--r--build2/bin/target.hxx12
3 files changed, 35 insertions, 0 deletions
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<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> ();
+
// 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<def>,
+ &target_extension_fix<def_ext>,
+ nullptr, /* default_extension */
+ &target_pattern_fix<def_ext>,
+ 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;}
+ };
}
}