diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2022-09-08 16:26:08 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2022-09-12 20:19:13 +0300 |
commit | efa2666ada7fcc7679ee8b6031d71855f46e5c6d (patch) | |
tree | 2b6dbaf962a908cd3c67ff8958d20865ff2c2473 /odb | |
parent | 4aa63bc7037cb6c6162eb014f00ddba5c677a169 (diff) |
Use ad hoc recipes to compile options.cli file
Diffstat (limited to 'odb')
-rw-r--r-- | odb/.gitignore | 5 | ||||
-rw-r--r-- | odb/buildfile | 91 | ||||
-rw-r--r-- | odb/pregenerated/odb/options.cxx (renamed from odb/options.cxx) | 0 | ||||
-rw-r--r-- | odb/pregenerated/odb/options.hxx (renamed from odb/options.hxx) | 0 | ||||
-rw-r--r-- | odb/pregenerated/odb/options.ixx (renamed from odb/options.ixx) | 0 |
5 files changed, 63 insertions, 33 deletions
diff --git a/odb/.gitignore b/odb/.gitignore index 7e97b78..4fd410e 100644 --- a/odb/.gitignore +++ b/odb/.gitignore @@ -1,3 +1,2 @@ -odb -odb.so -#options.?xx +/odb +/options.?xx diff --git a/odb/buildfile b/odb/buildfile index 2625e0d..20f8718 100644 --- a/odb/buildfile +++ b/odb/buildfile @@ -94,49 +94,80 @@ switch $cxx.target.system plugin{odb}: cxx.loptions += -undefined dynamic_lookup } -libus{odb}: {hxx ixx txx cxx}{** -odb -options} {hxx ixx cxx}{options} $libs +libus{odb}: {hxx ixx txx cxx}{** -odb -options -pregenerated/**} $libs # Build options. # cxx.poptions += "-I$plugin_dir/include" "-DODB_GXX_NAME=\"$gxx_name\"" cxx.poptions += -DODB_BUILD2 # @@ TMP while supporting other build systems. -# Pass the copyright notice extracted from the LICENSE file. +## Consumption build ($develop == false). # -copyright = $process.run_regex(cat $src_root/LICENSE, \ - 'Copyright \(c\) (.+)\.', \ - '\1') -obj{odb}: cxx.poptions += -DODB_COPYRIGHT=\"$copyright\" +# Use pregenerated versions in the consumption build. +# +libus{odb}: pregenerated/{hxx ixx cxx}{**}: include = (!$develop) + +if! $develop + cxx.poptions =+ "-I($src_base/pregenerated)" # Note: must come first. + +# Distribute pregenerated versions only in the consumption build. +# +pregenerated/{hxx ixx cxx}{*}: dist = (!$develop) -# Generated options parser. # -# @@ TMP: currently generated code is committed to allow building from git. +## + +## Development build ($develop == true). +# + +libus{odb}: {hxx ixx cxx}{options}: include = $develop + +if $develop + import! [metadata] cli = cli%exe{cli} + +# In the development build distribute regenerated {hxx ixx cxx}{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. # -if $cli.configured +<{hxx ixx cxx}{options}>: cli{options} $cli { - cli.cxx{options}: cli{options} - - cli.options += --include-with-brackets --include-prefix odb \ ---guard-prefix ODB --generate-file-scanner --generate-specifier \ ---generate-modifier --generate-description --suppress-undocumented \ ---cxx-prologue '#include <odb/option-parsers.hxx>' - - 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). - # - dist = true - clean = ($src_root != $out_root) - - # We keep the generated code in the repository so copy it back to src in - # case of a forwarded configuration. - # - backlink = overwrite - } + dist = ($develop ? pregenerated/odb/ : false) + + # Symlink the generated code in src for convenience of development. + # + backlink = true } +% +if $develop +{{ + options = --include-with-brackets --include-prefix odb --guard-prefix ODB \ + --generate-file-scanner --generate-specifier --generate-modifier \ + --generate-description --suppress-undocumented \ + --cxx-prologue '#include <odb/option-parsers.hxx>' + + $cli $options -o $out_base $path($<[0]) + + # If the result differs from the pregenerated version, copy it over. + # + if diff $src_base/pregenerated/odb/options.hxx $path($>[0]) >- && \ + diff $src_base/pregenerated/odb/options.ixx $path($>[1]) >- && \ + diff $src_base/pregenerated/odb/options.cxx $path($>[2]) >- + exit + end + + cp $path($>[0]) $src_base/pregenerated/odb/options.hxx + cp $path($>[1]) $src_base/pregenerated/odb/options.ixx + cp $path($>[2]) $src_base/pregenerated/odb/options.cxx +}} + +# +## + +# Pass the copyright notice extracted from the LICENSE file. +# +obj{odb}: cxx.poptions += -DODB_COPYRIGHT=\"$copyright\" # Don't install any of the plugin's headers. # diff --git a/odb/options.cxx b/odb/pregenerated/odb/options.cxx index 93335d2..93335d2 100644 --- a/odb/options.cxx +++ b/odb/pregenerated/odb/options.cxx diff --git a/odb/options.hxx b/odb/pregenerated/odb/options.hxx index 74406a0..74406a0 100644 --- a/odb/options.hxx +++ b/odb/pregenerated/odb/options.hxx diff --git a/odb/options.ixx b/odb/pregenerated/odb/options.ixx index 9a78a2e..9a78a2e 100644 --- a/odb/options.ixx +++ b/odb/pregenerated/odb/options.ixx |