[Scons-users] pointer to info on using a project-built tool?

Bill Deegan bill at baddogconsulting.com
Mon Jun 12 22:31:14 EDT 2017


O.k. Do you mean Builder() ? Or something else when you are saying tool?

Is this the bit of logic you expect to have a absolute path?
json2cbor = env.get('BUILD_DIR') + 'resource/csdk/security/tool/json2cbor'

-Bill

On Mon, Jun 12, 2017 at 4:58 PM, Mats Wichmann <mats at wichmann.us> wrote:

> On 06/12/2017 01:12 PM, Bill Deegan wrote:
> > Any chance you can post any of your code to help better understand your
> > issue?
>
> sure, the basics I can put here if it helps.  (I was actually hoping
> there was some reading somewhere so I didn't need to pester people :)
>
> meanwhile we're talking about the cross-build issue, which I guess is
> something separate.  That problem is the tool can't really be built "in
> isolation" which is what would make more sense for how it wants to be used.
>
> In a generic place, before descending into various subdirectories:
>
>
> ######################################################################
> # Generate Cbor from json files
> ######################################################################
> json2cbor = env.get('BUILD_DIR') + 'resource/csdk/security/tool/json2cbor'
>
> def generate_actions(source, target, env, for_signature):
>     Depends(target, "json2cbor")
>     return " %s %s %s" % (str(json2cbor), source[0], target[0])
>
> builder = Builder(generator = generate_actions,
>                   suffix = '.dat',
>                   src_suffix = '.json')
>
> env.Append(BUILDERS = {'Cbor' : builder})
>
>
> In one of those subdirectories, in a tool directory dedicated only to
> the conversion tool, which does however needs bits from elsewhere in the
> tree:
>
>
> ######################################################################
> # Source files and Targets
> ######################################################################
> json2cbor_src = ['json2cbor.c']
> json2cbor = tools_env.Program('json2cbor', json2cbor_src)
> Alias("json2cbor", [json2cbor])
> tools_env.AppendTarget('json2cbor')
>
>
> and then in a place that has data files which need conversion:
>
>
>     for json_file in Glob('*.json'):
>         examples += examples_env.Install(svr_db_build_dir, str(json_file))
>         examples += examples_env.Cbor(json_file)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20170612/cb0a64bc/attachment.html>


More information about the Scons-users mailing list