aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/bin/buildfile
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-08-24 16:37:29 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-08-28 15:01:48 +0300
commitea24f530048cbce0c5335ca3fd3632c8ce34315a (patch)
tree3f7153cad1c3e34da5e992fe53db104512d7af71 /libbuild2/bin/buildfile
parentd07521c67db21aa02dddf9615dce9f9f3dfe784c (diff)
Move bin build system module to separate library
Diffstat (limited to 'libbuild2/bin/buildfile')
-rw-r--r--libbuild2/bin/buildfile69
1 files changed, 69 insertions, 0 deletions
diff --git a/libbuild2/bin/buildfile b/libbuild2/bin/buildfile
new file mode 100644
index 0000000..e490214
--- /dev/null
+++ b/libbuild2/bin/buildfile
@@ -0,0 +1,69 @@
+# file : libbuild2/bin/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}
+
+./: lib{build2-bin}: libul{build2-bin}: {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-bin}: bin.whole = false
+}
+
+# Build options.
+#
+obja{*}: cxx.poptions += -DLIBBUILD2_BIN_STATIC_BUILD
+objs{*}: cxx.poptions += -DLIBBUILD2_BIN_SHARED_BUILD
+
+# Export options.
+#
+lib{build2-bin}:
+{
+ cxx.export.poptions = "-I$out_root" "-I$src_root"
+ cxx.export.libs = $int_libs
+}
+
+liba{build2-bin}: cxx.export.poptions += -DLIBBUILD2_BIN_STATIC
+libs{build2-bin}: cxx.export.poptions += -DLIBBUILD2_BIN_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-bin}: bin.lib.version = @"-$ver"
+libs{build2-bin}: bin.lib.load_suffix = "-$ver"
+
+# Install into the libbuild2/bin/ subdirectory of, say, /usr/include/
+# recreating subdirectories.
+#
+{hxx ixx txx}{*}:
+{
+ install = include/libbuild2/bin/
+ install.subdirs = true
+}