[Scons-users] env.Command with build explicit build
    Philipp Kraus 
    philipp.kraus at flashpixx.de
       
    Sun Aug 12 05:16:33 EDT 2012
    
    
  
On 2012-08-12 07:40:17 +0200, William Deegan said:
> Kraus,
> On Aug 11, 2012, at 11:39 AM, Kraus Philipp <philipp.kraus at flashpixx.de> wrote:
> 
>> Hello,
>> 
>> I'm using an env.Command call with a own function for running some 
>> externel command:
>> My function shows
>> 
>> def runfunc(target, source, env) :
>> ### do something in preprocess ###
>> if a :
>> run command 1
>> elif b :
>> run command 2
>> elif c :
>> ### build shared library with scons env.SharedLibrary ####
>> return []
>> 
>> My problem is the case c. I need at this point a env.SharedLibrary call, so
>> that a shared library is build after the function is run. I can create the env
>> (which is not a clone of the parameter env, it must be its own structure)
>> but in which way I can run the build process explicit?
>> I need something link
>> 
>> envlib = Environment()
>> set parameter to envlib
>> envlib.SharedLibrary(target="mylib", sources= [...])
>> do envlib
>> 
>> Do you have an idea to solve the problem?
> 
> I'm not really sure what it is you want to do from the description above.
> Do you know a,b,and c at the time you SConscript is executed, or not 
> until the build tree is being processed by SCons?
> If not can you provide a more full example?
> 
> If you do, then you probably want a Pseudo-builder, see:
> http://www.scons.org/doc/production/HTML/scons-user/c3938.html
> 
> No builders are run when the SConstruct/SConscript is processed. They 
> are used to build the DAG for SCons to decide what needs to built, and 
> then the actions they specify are executed.
I know that scons creates the targets after the DAG is created and 
analysed. I need a "practial" idea to do this. I use external code 
which has got a own SConstruct, but this SConstruct
has some errors and does not works on all platforms. This SConstruct 
builds a library and also there is a unix Makefile for building the 
library. I have got create an env-command with
a own function like
env.Command("buildmylib", "", runfunc)
and the runfunc is
def runfunc(target, source, env) :
      if is unix :
            os.system("make")
      elif is osx
            os.system("make")
     else
           envlib = Environment()
           envlib.Sharedlib(...)
    return []
In which way can I pass the envlib to th main DAG, so if my SConstruct 
script is called the envlib library is build?
Thanks
Phil
    
    
More information about the Scons-users
mailing list