Re: Mixing VariantDirs with "in-tree" build
Bill Deegan <[email protected]>
| Newsgroups | gmane.comp.programming.tools.scons.user |
|---|---|
| Message-ID | <CAEyG4CHJC1emTsRC_Vnq8hwMF99hM93Hpq7zEdgdPW-r6Xiofg@mail.gmail.com> |
Glad that will work for you for the time being. Please don't hesitate to come back with more issues as you run into them. -Bill On Mon, Feb 4, 2019 at 3:16 PM Tobias Herzog <[email protected]> wrote: > I am using a custom code generator, which sources and targets are defined > in a configuration file (pathes are relative to current working directory > of the code generator). If I run this code generator from a variant dir > ("cd" before executing it...), it will not find the source files > (duplicate=0). Furthemore the source files should anyway be in-tree because > they should be checked in (ok - I could copy them of course). > Additionally I don't use the nodes directly, that are returned by the > builder/command of the code generator (what would work, as descibed below), > as I need some of the targets for one build step, and some of the targets > for another. That is why I "hard coded" the pathes to those target files at > some other point within this VariantDir SConscript. > > This is indeed a strange design, and probably the best would be to adjust > the code generator to fit my needs better. But currently I can't/don't want > to change too much with our build system to increase the acceptance for > SCons within our developement team :). > For now I can live with the solution to reference those files from the > SCons root (#/...). > > Thanks for your support, > Tobias > > > Am Mittwoch, den 30.01.2019, 13:59 -0800 schrieb Bill Deegan: > > Sure that make sense. > Once again foo is not a file which is yet to be built, so scons can find > it through the variantdir magic. > > Any reason not to move all your build under a variantdir ? > > On Wed, Jan 30, 2019 at 11:44 AM Tobias Herzog <[email protected]> wrote: > > No, I meant the order of invoking scons: > > > scons -Q --tree=all A/B/foo > cat A/B/foo.src > A/B/foo > +-A/B/foo > +-A/B/foo.src > +-/bin/cat > > scons -Q --tree=all build/bar > cat A/B/foo > build/bar > +-build/bar > +-A/B/foo > +-/bin/cat > > > Am Dienstag, den 29.01.2019, 15:12 -0800 schrieb Bill Deegan: > > so if you swap the order it works? > > > SConscript('A/SConscript', variant_dir='build', duplicate=0) > SConscript('A/B/SConscript') > > > On Tue, Jan 29, 2019 at 1:13 PM Tobias Herzog <[email protected]> wrote: > > Hmm, don't know if I understand you correctly, but if A/B/foo is a regular > file (i.e. not a generated file, a build target) everything works as > expected, because scons looks up build/B/foo (which is in fact not there, > because i Use duplicate=0 with the VariantDir) in the original directory > A/B/foo. > That is also why the build succeeds, when I execute the two commands below > in reverse order (because I "manually" build A/B/foo before). > > Anyway, I accept the answer that this is intended behavior :) > > > > Am Dienstag, den 29.01.2019, 09:17 -0800 schrieb Bill Deegan: > > Your issue has nothing to do with whether the file foo is generated or > just a regular file. > You've created via your variantdir usage (as far as scons is concerned) a > tree which looks like this: > > +-SConstruct > +-A > +-SConscript > +-B > +-SConscript > +-foo.src > +-foo <- to be built > +-build <-- this is the directory scons "works in" when evaluating the > SConscript below > +- SConscript > +- B <-- you're looking for this which doesn't and won't exist > +- foo <-- and this which doesn't and won't exist. > > Does that help? > > > > > On Mon, Jan 28, 2019 at 11:30 PM pasdVn <[email protected]> wrote: > > Thanks for your quick reply! > > I thought that SCons is looking up a node via srcnode() and thus in the > original location, if it is not found in the current variant dir, but > obviously this is not the case here, because A/B/foo is a generate file > (i.e. a target), right? > > > Am 29. Januar 2019 00:51:33 MEZ schrieb Bill Deegan < > [email protected]>: > > See below > > On Mon, Jan 28, 2019 at 12:33 PM Tobias Herzog <[email protected]> wrote: > > Hi scons users, > > consider the following demo project: > > +-SConsctuct > +-A > +-SConscript > +-B > +-SConscript > +-foo.src > > > With SConstruct: > SConscript('A/B/SConscript') > SConscript('A/SConscript', variant_dir='build', duplicate=0) > > A/SConscript: > Command(source='B/foo', > target='bar', > action='cat $SOURCE > $TARGET') > A/B/SConscript: > Command(target='foo', > source='foo.src', > action='cat $SOURCE > $TARGET') > > > No I do: > > scons -Q --tree=all build/bar > scons: *** [build/bar] Source `A/B/foo' not found, needed by target > `build/bar'. > +-build/bar > +-A/B/foo > +-/bin/cat > > and > >scons -Q --tree=all A/B/foo > cat A/B/foo.src > A/B/foo > +-A/B/foo > +-A/B/foo.src > +-/bin/cat > > > I know that this is a quite strage project setup, but nevertheless I > would expect scons to detect the depencies correct. Is this a bug, or > am I missing something? > > > You're missing something. > By saying: > > SConscript('A/SConscript', variant_dir='build', duplicate=0) > > This is the same as: > VariantDir('build','A', duplicate=0) > SConscript('build/SConscript') > > So when you're asking for B/foo from that SConscript, you're actually > asking for build/B/foo. > If you changed it to "#/A/B/foo" it would work, or "../A/B/foo" > > > > If I Return/Export the foo-node and use it in the Command in > A/SConscript it works as intended. > > > Thanks, > Tobias > > _______________________________________________ > Scons-users mailing list > [email protected] > https://pairlist4.pair.net/mailman/listinfo/scons-users > > _______________________________________________ > Scons-users mailing list > [email protected] > https://pairlist4.pair.net/mailman/listinfo/scons-users > > _______________________________________________ > > Scons-users mailing list > > [email protected] > > https://pairlist4.pair.net/mailman/listinfo/scons-users > > > _______________________________________________ > Scons-users mailing list > [email protected] > https://pairlist4.pair.net/mailman/listinfo/scons-users > > _______________________________________________ > > Scons-users mailing list > > [email protected] > > https://pairlist4.pair.net/mailman/listinfo/scons-users > > > _______________________________________________ > Scons-users mailing list > [email protected] > https://pairlist4.pair.net/mailman/listinfo/scons-users > > _______________________________________________ > > Scons-users mailing list > > [email protected] > > https://pairlist4.pair.net/mailman/listinfo/scons-users > > > _______________________________________________ > Scons-users mailing list > [email protected] > https://pairlist4.pair.net/mailman/listinfo/scons-users > _______________________________________________ Scons-users mailing list [email protected] https://pairlist4.pair.net/mailman/listinfo/scons-users