# file : cli/buildfile # license : MIT; see accompanying LICENSE file import libs = libcutl%lib{cutl} # Import the cli program only if explicitly requested. This way a distribution # that includes pre-generated files can be built without installing cli. # if ($config.cli != [null] && $config.cli != false) import! [metadata] cli = cli%exe{cli} ./: exe{cli}: cxx{cli} libue{cli} # Target metadata, see also --build2-metadata in cli.cxx. # exe{cli}: { export.metadata = 1 cli cli.name = [string] cli cli.version = $version cli.checksum = $version } libue{cli}: {hxx ixx txx cxx}{** -cli -version -options -**.test...} \ {hxx}{version} {hxx ixx cxx}{options} \ $libs hxx{version}: in{version} $src_root/manifest # Provide the options parsing code generation recipe if the cli program is # available. # if ($cli != [null]) { <{hxx ixx cxx}{options}>: cli{options} $cli { options = --include-with-brackets --include-prefix cli \ --guard-prefix CLI --generate-file-scanner \ --generate-specifier --generate-modifier \ --suppress-undocumented --reserved-name stdout # Include the generated 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 } {{ diag cli ($<[0]) $cli $options -o $out_base $path($<) }} } # Unit tests. # exe{*.test}: { test = true install = false } for t: cxx{**.test...} { d = $directory($t) n = $name($t)... ./: $d/exe{$n}: $t $d/{hxx ixx txx}{+$n} $d/testscript{+$n} $d/exe{$n}: libue{cli}: bin.whole = false } # Build options. # # Pass the copyright notice extracted from the LICENSE file. # obj{cli}: cxx.poptions += -DCLI_COPYRIGHT=\"$copyright\"