[build2] build2 Module for CLI

Per Edin per.edin at sequence-point.se
Fri Jul 7 17:20:31 UTC 2023


Hi!

You can find a nice example of using build2/cli in the ODB code, here:
https://git.codesynthesis.com/cgit/odb/odb/tree/odb/buildfile

Also written by Boris.

Kind regards
Ryan


On Fri, Jul 7, 2023 at 7:16 PM Markus Pawellek via users <users at build2.org>
wrote:

> Hello,
>
> a few days ago, I learned about CLI and have to say that I really much
> like it so far.
> Thank you so much for your hard work!
>
> https://www.codesynthesis.com/projects/cli/
> https://cppget.org/cli
>
> I wanted to use CLI in conjunction with build2 and created the
> following test repository:
> https://github.com/lyrahgames/build2-cli-test
>
> Hereby, I have included CLI as build-time dependency and used an ad hoc
> recipe
> to automatically transform CLI specification files into their
> respective C++ files.
> Similar to the standard process in build2 for generating version header
> files.
>
> exe{build2-cli-test}: {hxx ixx txx cxx}{** -options} {hxx ixx
> cxx}{options}
>
> <{hxx ixx cxx}{options}>: cli{options}
> {
>  dist = true
>  clean = ($src_root != $out_root)
> }
>
> As a more general approach, I then used a regex-based ad hoc recipe in
> the 'root.build' file.
>
> # Define file type and its extension for CLI specifications.
> #
> define cli: file
> cli{*}: extension = cli
>
> # Immediately import the CLI compiler.
> #
> import! [metadata] clic = cli%exe{cli}
>
> # Provide a regex-based ad hoc rule to run the CLI compiler.
> #
> <{hxx ixx cxx}{~'/(.*)/'}>: cli{~'/\1/'} $clic
> {{
>  diag cli $>
>  $clic \
>    --output-dir $out_base \
>    --hxx-suffix .hpp \
>    --ixx-suffix .ipp \
>    --cxx-suffix .cpp \
>    $path($<[0])
> }}
>
> Would this be the way to go?
>
> Furthermore, thinking of the `in` module of build2 and the ability to
> create custom modules,
> is there already a build2 module for CLI that I might have overseen?
> Otherwise, would it even be possible to create a build2 module for CLI?
> I think build2 depends on CLI, doesn't it?
>
> Greetings
> Markus
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.build2.org/archives/users/attachments/20230707/61575959/attachment.html>


More information about the users mailing list