From ecfae2da0b23631cee3e723a562f64f8aace6879 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 16 Jun 2020 09:43:27 +0200 Subject: Move common functionality from cc to bin --- libbuild2/bin/types.hxx | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 libbuild2/bin/types.hxx (limited to 'libbuild2/bin/types.hxx') diff --git a/libbuild2/bin/types.hxx b/libbuild2/bin/types.hxx new file mode 100644 index 0000000..773ef20 --- /dev/null +++ b/libbuild2/bin/types.hxx @@ -0,0 +1,58 @@ +// file : libbuild2/bin/types.hxx -*- C++ -*- +// license : MIT; see accompanying LICENSE file + +#ifndef LIBBUILD2_BIN_TYPES_HXX +#define LIBBUILD2_BIN_TYPES_HXX + +#include +#include + +namespace build2 +{ + namespace bin + { + // Compiler/linker output type (executable, static, or shared). + // + enum class otype {e, a, s}; + + struct ltype + { + otype type; + bool utility; // True for utility libraries. + + bool executable () const {return type == otype::e && !utility;} + bool library () const {return type != otype::e || utility;} + bool static_library () const {return type == otype::a || utility;} + bool shared_library () const {return type == otype::s && !utility;} + bool member_library () const {return type != otype::e;} + }; + + // Library group (lib{}) members to build. + // + struct lmembers + { + bool a; + bool s; + }; + + // Library link order. + // + enum class lorder {a, s, a_s, s_a}; + + // Link information: output type and link order. + // + struct linfo + { + otype type; + lorder order; + }; + + // Prerequisite target link flags (saved in prerequisite_target::data). + // + using lflags = uintptr_t; + + const lflags lflag_whole = 0x00000001U; // Link whole liba{}/libu*{}. + } +} + +#endif // LIBBUILD2_BIN_TYPES_HXX -- cgit v1.1