[Scons-users] Emiter usage
Bill Deegan
bill at baddogconsulting.com
Tue Sep 20 12:43:10 EDT 2016
Adam,
SCons files are not parsed, they are run by python.
They are python scripts.
You need to give the library a name in each directory...
https://github.com/pholat/sconplay/blob/master/lib1/SConscript
#!/bin/python
Import("env")
tmp = env.Library(Glob("*.cpp"))
env.Install("#bin/lib1",tmp)
Should be something like:
#!/bin/python
Import("env")
tmp = env.Library('lib1',Glob("*.cpp"))
env.Install("#bin/lib1",tmp)
*Really you need to reread the scons users guide. You've clearly not
understood it.*
These are relevant:
http://scons.org/doc/production/HTML/scons-user.html#chap-hierarchical
http://scons.org/doc/production/HTML/scons-user.html#idp1396553892
-Bill
On Tue, Sep 20, 2016 at 2:02 AM, pholat <pholat at gmail.com> wrote:
> Hi,
>
> I wasn't sure if when I run SConscript(...) in for loop dependencies will
> be intact. As dependency check is not sequential and I do not know how
> SCons files are parsed on 'scons' call.
>
> Here is working (just fine) example of my dilemma above:
> https://github.com/pholat/sconplay/tree/master
>
> I'll add 3 different Environments so that it will match my previous
> example.
>
> Great thanks, best regards,
> Adam
>
> Pozdrawiam,
> Adam A. Dobrowolski || pholat
>
> 2016-09-20 1:49 GMT+02:00 Bill Deegan <bill at baddogconsulting.com>:
>
>> Adam,
>>
>> On Mon, Sep 19, 2016 at 1:59 PM, Adam Dobrowolski <pholat at gmail.com>
>> wrote:
>>
>>> On poniedziałek, 19 września 2016 13:09:34 CEST Bill Deegan wrote:
>>> > Adam,
>>> >
>>> > On Mon, Sep 19, 2016 at 12:47 PM, Adam Dobrowolski <pholat at gmail.com>
>>> wrote:
>>> > > Hi,
>>> > >
>>> > > I want to build all four elements which have "Alias" at once, I've
>>> added
>>> > > Alias
>>> > > to mark that these are end products.
>>> > > Right now the main question is if SCons will recognize intermediate
>>> files
>>> > > needed if I loop over them, not write them by hand/copy in
>>> SConsctruct.
>>> > > I vaguely recall that SConstruct & SConscripts are being parsed
>>> before any
>>> > > functions are executed.
>>> >
>>> > Can you expand upon what would be in:
>>> > X86_REL = SConscript("x86_release/SConcsript")
>>> >
>>> > What would you expect to be in X86_REL?
>>> >
>>> > I'm guessing that you don't realize that it's not necessary to pass
>>> around
>>> > the Node's returned from builders if you know the locations in the
>>> > filesystem that their targets will be built in.
>>> >
>>> > So if a SConscript builds a bunch of binaries into : x86_release/bin,
>>> you
>>> > can create the alias either as:
>>> >
>>> > Alias('X86_REL','x86_release/bin')
>>> >
>>> > or if you like
>>> >
>>> > Alias('X86_REL',Glob('x86_release/bin/*'))
>>> >
>>> > Does that answer your question?
>>>
>>> As it was said in example:
>>> (...)
>>> These SConscripts use products of earlier SConscripts in for loop
>>> For 10 SCOnscripts it would be 40 products in total
>>> These are sourced with Glob("*")
>>> (...)
>>>
>>> SConscript creates bunch of libraries which are Globed and compiled into
>>> four
>>> different binaries. I said products previously because I may have
>>> different
>>> builders that Program(..) and Library(..) in use.
>>>
>>
>> You'll need to pastebin your builders for us to help you with that.
>>
>>>
>>> So it doesn't answer my question.
>>>
>>
>> If the alias should cause the respective binaries (and all their
>> dependencies to be built), then specifying just the binaries to the alias
>> is sufficient.
>> In which case I did previously answer your question.
>>
>> -Bill
>>
>>
>>>
>>> >
>>> > > So right now it's a question on SCons dependency handling.
>>> > > ---
>>> > > By the way:
>>> > > The mail has "Emitter usage" in name because:
>>> > > 1) I ate word "question" - sorry for that, I've just found it out.
>>> > > 2) I read manual: http://scons.org/doc/1.2.0/HTM
>>> L/scons-user/x3603.html
>>> > > and I
>>> > > thought that maybe I could do something similar. In the end I still
>>> see no
>>> > > use
>>> > > in emitter in my case and can't grasp when I would need it. ( I
>>> would be
>>> > > grateful to any explanations though )
>>> >
>>> > Are you creating a builder? If not then you don't need it.
>>> > Does the builder you're creating create output files (or input files,
>>> or
>>> > sideffects) which aren't listed as a target or source when the builder
>>> is
>>> > invoked?
>>> > Then you do need an emitter.
>>> > Otherwise you don't need one.
>>> >
>>> >
>>> > Are you running SCons 1.2.0? The current version is 2.5.0.
>>> >
>>> > > Best regards,
>>> > > Adam
>>> > >
>>> > > On poniedziałek, 19 września 2016 19:31:56 CEST Dirk Bächle wrote:
>>> > > > Adam,
>>> > > >
>>> > > > On 19.09.2016 18:46, Adam Dobrowolski wrote:
>>> > > > > Hi Dirk,
>>> > > > >
>>> > > > > Great thanks up to now, I meant something like that:
>>> > > > >
>>> > > > > #!/bin/python
>>> > > > >
>>> > > > > x86_env = Environment(<something for x86);
>>> > > > > x86_deb = env.Clone();
>>> > > > > x86_deb.Append(CXXFLAGS=['-g3','-O2'])
>>> > > > > arm_env = Environment(<something for arm>);
>>> > > > > arm_deb = env.Clone();
>>> > > > > arm_deb.Append(CXXFLAGS=['-g3','-O2'])
>>> > > > >
>>> > > > > libs = [
>>> > > > >
>>> > > > > "lib1/SConscript",
>>> > > > > "lib2/SConscript",
>>> > > > > "lib3/SConscript",
>>> > > > > (...)
>>> > > > > "libN/SConscript",
>>> > > > > ]
>>> > > > >
>>> > > > > for script in libs:
>>> > > > > SConscript(script, exports={'env' : x86_env},
>>> > > > > variant_dir='x86_release')
>>> > > > > SConscript(script, exports={'env' : x86_deb},
>>> > > > > variant_dir='x86_debug')
>>> > > > > SConscript(script, exports={'env' : arm_env},
>>> > > > > variant_dir='arm_release')
>>> > > > > SConscript(script, exports={'env' : arm_deb},
>>> > > > > variant_dir='arm_debug')
>>> > > > >
>>> > > > > # These SConscripts use products of earlier SConscripts in for
>>> loop
>>> > > > > # For 10 SCOnscripts it would be 40 products in total
>>> > > > > # These are sourced with Glob("*")
>>> > > > > X86_REL = SConscript("x86_release/SConcsript")
>>> > > > > X86_DEB = SConscript("x86_debug/SConcsript")
>>> > > > > ARM_REL = SConscript("arm_release/SConcsript")
>>> > > > > ARM_DEB = SConscript("arm_debug/SConcsript")
>>> > > > >
>>> > > > > Alias('X86_REL',X86_REL)
>>> > > > > Alias('X86_DEB',X86_DEB)
>>> > > > > Alias('ARM_REL',ARM_REL)
>>> > > > > Alias('ARM_DEB',ARM_DEB)
>>> > > >
>>> > > > what I get from this is that you want to be able to call "scons
>>> > > > X86_REL",
>>> > > > such that only the corresponding subtree is built. If this
>>> > > > is correct, doesn't it contradict the specifications made in your
>>> first
>>> > >
>>> > > mail:
>>> > > > > What I need to do is:
>>> > > > > Generate different output on different compilation variable.
>>> > > > >
>>> > > > > Exemplary problem: one app version is build with -DDEBUG
>>> variable,
>>> > > > > and
>>> > > > > second one is without. Now I can build DEBUG app (or one
>>> without) by
>>> > > > > changing the Environment by hand. But I would love to build
>>> both in
>>> > >
>>> > > one
>>> > >
>>> > > > > run.
>>> > > >
>>> > > > , especially for the last sentence?
>>> > > >
>>> > > > Regards,
>>> > > >
>>> > > > Dirk
>>> > > >
>>> > > >
>>> > > > _______________________________________________
>>> > > > Scons-users mailing list
>>> > > > Scons-users at scons.org
>>> > > > https://pairlist4.pair.net/mailman/listinfo/scons-users
>>> > >
>>> > > _______________________________________________
>>> > > Scons-users mailing list
>>> > > Scons-users at scons.org
>>> > > https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-users at scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>>
>
> _______________________________________________
> 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/20160920/9d81ba2f/attachment-0001.html>
More information about the Scons-users
mailing list