aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/buildfile
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-07-22 22:37:40 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-07-24 21:37:58 +0300
commit72945d9c8eee18aed1550c3f42dc41e6a8a0f029 (patch)
tree9fdfe1c3bf48d0e303dc435c40116dacf48286b3 /libbuild2/buildfile
parent83bb02cada0b894d9134cc5489999e0f0fe8bd7c (diff)
Use CLI-generated classes to parse testscript builtin options
Diffstat (limited to 'libbuild2/buildfile')
-rw-r--r--libbuild2/buildfile40
1 files changed, 39 insertions, 1 deletions
diff --git a/libbuild2/buildfile b/libbuild2/buildfile
index edabfc3..b015d21 100644
--- a/libbuild2/buildfile
+++ b/libbuild2/buildfile
@@ -14,7 +14,9 @@ lib{build2}: libul{build2}: {hxx ixx txx cxx}{* -config -version -*.test...} \
# without them or with their alternative implementations.
#
for m: config dist install test
- libul{build2}: $m/{hxx ixx txx cxx}{** -**.test...}
+ libul{build2}: $m/{hxx ixx txx cxx}{** -**-options -**.test...}
+
+libul{build2}: test/script/{hxx ixx cxx}{builtin-options}
libul{build2}: $int_libs
@@ -87,6 +89,42 @@ if $version.pre_release
else
lib{build2}: bin.lib.version = @"-$version.major.$version.minor"
+# Generated options parser.
+#
+test/script/
+{
+ if $cli.configured
+ {
+ cli.cxx{builtin-options}: cli{builtin}
+
+ cli.options += -I $src_root --include-with-brackets \
+--include-prefix libbuild2/test/script --guard-prefix LIBBUILD2_TEST_SCRIPT \
+--cli-namespace build2::test::script::cli --generate-vector-scanner \
+--generate-specifier --suppress-usage
+
+ cli.cxx{*}:
+ {
+ # Include the generated cli files into the distribution and don't remove
+ # them when cleaning in src (so that clean results in a state identical
+ # to distributed). But don't install their headers since they are only
+ # used internally in the testscript implementation.
+ #
+ dist = true
+ clean = ($src_root != $out_root)
+ install = false
+
+ # We keep the generated code in the repository so copy it back to src in
+ # case of a forwarded configuration.
+ #
+ backlink = overwrite
+ }
+ }
+ else
+ # No install for the pre-generated case.
+ #
+ hxx{builtin-options}@./ ixx{builtin-options}@./: install = false
+}
+
# Install into the libbuild2/ subdirectory of, say, /usr/include/
# recreating subdirectories.
#