aboutsummaryrefslogtreecommitdiff
path: root/mod/buildfile
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2022-09-02 21:22:18 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-09-09 21:28:21 +0300
commit77f0b35782edcfad2c73cc75784b926c1e8b9a74 (patch)
tree7f8d9499451d28dc522f30fa9cd22336ba1b0b9a /mod/buildfile
parent76a8a874ea2bf01110b306e534c9e35c757c6e87 (diff)
Add odb and cli conditional build-time dependenciesodb-cli-deps
Diffstat (limited to 'mod/buildfile')
-rw-r--r--mod/buildfile79
1 files changed, 57 insertions, 22 deletions
diff --git a/mod/buildfile b/mod/buildfile
index 58a3caf..b5865cd 100644
--- a/mod/buildfile
+++ b/mod/buildfile
@@ -31,38 +31,73 @@ mod{brep}: {hxx ixx txx cxx}{* -module-options -{$libu_src}} \
libus{mod} ../libbrep/lib{brep} ../web/server/libus{web-server} \
$libs
-{libue libus}{mod}: {hxx ixx cxx}{module-options} \
- {hxx ixx txx cxx}{+{$libu_src} } \
- $libs
+{libue libus}{mod}: {hxx ixx txx cxx}{+{$libu_src}} $libs
libus{mod}: ../web/xhtml/libus{xhtml}
libue{mod}: ../web/xhtml/libue{xhtml}
-# Generated options parser.
+## Consumption build ($develop == false).
+#
+
+# Use pregenerated versions in the consumption build.
+#
+{libue libus}{mod}: pregenerated/{hxx ixx cxx}{**}: include = (!$develop)
+
+if! $develop
+ cxx.poptions =+ "-I($src_base/pregenerated)"
+
+# Distribute pregenerated versions only in the consumption build.
+#
+pregenerated/{hxx ixx cxx}{*}: dist = (!$develop)
+
+#
+##
+
+## Development build ($develop == true).
#
-if $cli.configured
-{
- cli.cxx{module-options}: cli{module}
+{libue libus}{mod}: {hxx ixx cxx}{module-options}: include = $develop
+
+if $develop
+ import! [metadata] cli = cli%exe{cli}
+
+# In the development build distribute regenerated
+# {hxx ixx cxx}{module-options}, remapping their locations to the paths of the
+# pregenerated versions (which are only distributed in the consumption build;
+# see above). This way we make sure that the distributed files are always
+# up-to-date.
+#
+<{hxx ixx cxx}{module-options}>: cli{module} $cli
+{
# Set option prefix to the empty value to handle all unknown request
# parameters uniformly with a single catch block.
#
- cli.options += --std c++11 -I $src_root --include-with-brackets \
---include-prefix mod --guard-prefix MOD --generate-specifier \
---cxx-prologue "#include <mod/types-parsers.hxx>" \
---cli-namespace brep::cli --generate-file-scanner --option-length 46 \
---generate-modifier --generate-description --option-prefix ""
-
- # 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).
- #
- cli.cxx{*}:
- {
- dist = true
- clean = ($src_root != $out_root)
- }
+ options = --std c++11 -I $src_root --include-with-brackets \
+ --include-prefix mod --guard-prefix MOD --generate-specifier \
+ --cxx-prologue "#include <mod/types-parsers.hxx>" \
+ --cli-namespace brep::cli --generate-file-scanner \
+ --option-length 46 --generate-modifier --generate-description \
+ --option-prefix "" --output-suffix "-options"
}
+%
+if $develop
+{{
+ diag cli ($<[0])
+ ($<[1]) $options -o $out_base/ $path($<[0])
+
+ if diff $src_base/pregenerated/mod/module-options.hxx $path($>[0]) >- && \
+ diff $src_base/pregenerated/mod/module-options.ixx $path($>[1]) >- && \
+ diff $src_base/pregenerated/mod/module-options.cxx $path($>[2]) >-
+ exit
+ end
+
+ cp $path($>[0]) $src_base/pregenerated/mod/module-options.hxx
+ cp $path($>[1]) $src_base/pregenerated/mod/module-options.ixx
+ cp $path($>[2]) $src_base/pregenerated/mod/module-options.cxx
+}}
+
+#
+##
# Don't install any of the module's headers.
#