aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/bin/utility.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-06-16 09:43:27 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-06-16 09:43:27 +0200
commitecfae2da0b23631cee3e723a562f64f8aace6879 (patch)
tree6f7bae1bec966bcc456b71fbaabf8556f031d61b /libbuild2/bin/utility.ixx
parentbd9ca1e55dc1396da73c4699ccc021dc1f604fe6 (diff)
Move common functionality from cc to bin
Diffstat (limited to 'libbuild2/bin/utility.ixx')
-rw-r--r--libbuild2/bin/utility.ixx21
1 files changed, 21 insertions, 0 deletions
diff --git a/libbuild2/bin/utility.ixx b/libbuild2/bin/utility.ixx
new file mode 100644
index 0000000..91c919b
--- /dev/null
+++ b/libbuild2/bin/utility.ixx
@@ -0,0 +1,21 @@
+// file : libbuild2/bin/utility.ixx -*- C++ -*-
+// license : MIT; see accompanying LICENSE file
+
+namespace build2
+{
+ namespace bin
+ {
+ inline ltype
+ link_type (const target& t)
+ {
+ bool u (false);
+ otype o (
+ t.is_a<exe> () || (u = t.is_a<libue> ()) ? otype::e :
+ t.is_a<liba> () || (u = t.is_a<libua> ()) ? otype::a :
+ t.is_a<libs> () || (u = t.is_a<libus> ()) ? otype::s :
+ static_cast<otype> (0xFF));
+
+ return ltype {o, u};
+ }
+ }
+}