<div dir="ltr"><div dir="ltr">Hi!<div><br></div><div>You can find a nice example of using build2/cli in the ODB code, here: <a href="https://git.codesynthesis.com/cgit/odb/odb/tree/odb/buildfile">https://git.codesynthesis.com/cgit/odb/odb/tree/odb/buildfile</a></div><div><br></div><div>Also written by Boris.</div><div><br clear="all"><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><span style="color:rgb(34,34,34)">Kind regards</span></div><div dir="ltr">Ryan</div><div dir="ltr"><br></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 7, 2023 at 7:16 PM Markus Pawellek via users <<a href="mailto:users@build2.org">users@build2.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
a few days ago, I learned about CLI and have to say that I really much <br>
like it so far.<br>
Thank you so much for your hard work!<br>
<br>
<a href="https://www.codesynthesis.com/projects/cli/" rel="noreferrer" target="_blank">https://www.codesynthesis.com/projects/cli/</a><br>
<a href="https://cppget.org/cli" rel="noreferrer" target="_blank">https://cppget.org/cli</a><br>
<br>
I wanted to use CLI in conjunction with build2 and created the <br>
following test repository:<br>
<a href="https://github.com/lyrahgames/build2-cli-test" rel="noreferrer" target="_blank">https://github.com/lyrahgames/build2-cli-test</a><br>
<br>
Hereby, I have included CLI as build-time dependency and used an ad hoc <br>
recipe<br>
to automatically transform CLI specification files into their <br>
respective C++ files.<br>
Similar to the standard process in build2 for generating version header <br>
files.<br>
<br>
exe{build2-cli-test}: {hxx ixx txx cxx}{** -options} {hxx ixx <br>
cxx}{options}<br>
<br>
<{hxx ixx cxx}{options}>: cli{options}<br>
{<br>
dist = true<br>
clean = ($src_root != $out_root)<br>
}<br>
<br>
As a more general approach, I then used a regex-based ad hoc recipe in <br>
the 'root.build' file.<br>
<br>
# Define file type and its extension for CLI specifications.<br>
#<br>
define cli: file<br>
cli{*}: extension = cli<br>
<br>
# Immediately import the CLI compiler.<br>
#<br>
import! [metadata] clic = cli%exe{cli}<br>
<br>
# Provide a regex-based ad hoc rule to run the CLI compiler.<br>
#<br>
<{hxx ixx cxx}{~'/(.*)/'}>: cli{~'/\1/'} $clic<br>
{{<br>
diag cli $><br>
$clic \<br>
--output-dir $out_base \<br>
--hxx-suffix .hpp \<br>
--ixx-suffix .ipp \<br>
--cxx-suffix .cpp \<br>
$path($<[0])<br>
}}<br>
<br>
Would this be the way to go?<br>
<br>
Furthermore, thinking of the `in` module of build2 and the ability to <br>
create custom modules,<br>
is there already a build2 module for CLI that I might have overseen?<br>
Otherwise, would it even be possible to create a build2 module for CLI?<br>
I think build2 depends on CLI, doesn't it?<br>
<br>
Greetings<br>
Markus<br>
<br>
<br>
</blockquote></div></div>