[Scons-users] Has anyone seen anything like this

Bill Deegan bill at baddogconsulting.com
Wed May 25 16:12:53 EDT 2022


SConscript() with variant_dir is generally much easier to use correctly.
(instead of explicit VariantDir(), which most people end up using
incorrectly and then not getting the results they expect)

As far as VariantDir() src and target dirs, you can have many but:
1. Avoid having the source of one include the target of another (including
the current one) (recursion=messy and hard to unravel/understand). (Also do
not chain VariantDirs()   VariantDir('b','a') VariantDir('c','b') == BAD)
2. If you're using VariantDir() you need to address all the sources and
targets as if they were in the target dir. (you can avoid this if you use
the SConscript() form.)
3. Avoid writing files into the sources of variant dirs during the build.
There are known issues where such updates may not cause a rebuild of
targets which depend on such files.

-Bill

On Wed, May 25, 2022 at 11:38 AM Mats Wichmann <mats at wichmann.us> wrote:

> On 5/25/22 12:24, Olivier, Jeffrey V wrote:
> > I've worked around the problem for now.  On your comment about the
> > VariantDir, can you have more than one?  For example, something like
> >
> > VariantDir("{}/src".format(build_prefix), 'src', duplicate=0)
> > # Execute SConscripts in this path
> >
> > VariantDir("{}/utils".format(build_prefix), 'utils', duplicate=0)
> > # Execute SConscripts in this path
>
> You can have many VariantDir mappings. You can have many VariantDir
> mappings to the same source, if you like, though each variant dir must
> be unique.
>
> We'd usually suggest you explore writing the above using this style
> instead, but of course you have to do what's fit for purpose (have not
> examined your repo):
>
> SConcript('src/SConscript', variant_dir="build/src", duplicate=0)
> SConcript('utils/SConscript', variant_dir="build/utils", duplicate=0)
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20220525/ac184fbb/attachment-0001.htm>


More information about the Scons-users mailing list