From ac87e3827b214c0ba1bd1c17a2d8a18026637d3f Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 26 Aug 2019 12:06:03 +0300 Subject: Move cxx build system module to separate library --- libbuild2/cxx/buildfile | 90 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 libbuild2/cxx/buildfile (limited to 'libbuild2/cxx/buildfile') diff --git a/libbuild2/cxx/buildfile b/libbuild2/cxx/buildfile new file mode 100644 index 0000000..debb574 --- /dev/null +++ b/libbuild2/cxx/buildfile @@ -0,0 +1,90 @@ +# file : libbuild2/cxx/buildfile +# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +import int_libs = libbutl%lib{butl} + +include ../ +int_libs += ../lib{build2} + +include ../cc/ +int_libs += ../cc/lib{build2-cc} + +./: lib{build2-cxx}: libul{build2-cxx}: {hxx ixx txx cxx}{** -**.test...} \ + $int_libs + +# Unit tests. +# +exe{*.test}: +{ + test = true + install = false +} + +for t: cxx{**.test...} +{ + d = $directory($t) + n = $name($t)... + + ./: $d/exe{$n}: $t $d/{hxx ixx txx}{+$n} $d/testscript{+$n} + $d/exe{$n}: libul{build2-cxx}: bin.whole = false +} + +# Build options. +# +obja{*}: cxx.poptions += -DLIBBUILD2_CXX_STATIC_BUILD +objs{*}: cxx.poptions += -DLIBBUILD2_CXX_SHARED_BUILD + +# Note that we used to compare complete target triplets but that proved too +# strict (see libbuild2/buildfile for details). +# +cross = ($cxx.target.cpu != $build.host.cpu || \ + $cxx.target.system != $build.host.system) + +# Pass native C++ compiler path (not forgetting to escape backslashes on +# Windows). It is used as defaults for BUILD2_DEFAULT_CXX. +# +if! $cross +{ + obj{init}: cxx.poptions += \ + -DBUILD2_NATIVE_CXX=\"$regex.replace($recall($cxx.path), '\\', '\\\\')\" + + obja{init}: cxx.poptions += -DLIBBUILD2_CXX_STATIC_BUILD + objs{init}: cxx.poptions += -DLIBBUILD2_CXX_SHARED_BUILD +} + +# Export options. +# +lib{build2-cxx}: +{ + cxx.export.poptions = "-I$out_root" "-I$src_root" + cxx.export.libs = $int_libs +} + +liba{build2-cxx}: cxx.export.poptions += -DLIBBUILD2_CXX_STATIC +libs{build2-cxx}: cxx.export.poptions += -DLIBBUILD2_CXX_SHARED + +# For pre-releases use the complete version to make sure they cannot be used +# in place of another pre-release or the final version. See the version module +# for details on the version.* variable values. +# +# And because this is a build system module, we also embed the same value as +# the interface version (note that we cannot use build.version.interface for +# bundled modules because we could be built with a different version of the +# build system). +# +ver = ($version.pre_release \ + ? "$version.project_id" \ + : "$version.major.$version.minor") + +lib{build2-cxx}: bin.lib.version = @"-$ver" +libs{build2-cxx}: bin.lib.load_suffix = "-$ver" + +# Install into the libbuild2/cxx/ subdirectory of, say, /usr/include/ +# recreating subdirectories. +# +{hxx ixx txx}{*}: +{ + install = include/libbuild2/cxx/ + install.subdirs = true +} -- cgit v1.1