[Scons-users] Question about scons

Dirk Bächle tshortik at gmx.de
Thu Feb 11 15:55:09 EST 2016


Hi Guillaume,

please find a few high-level answers to your questions inline.

On 11.02.2016 12:15, Guillaume Anciaux wrote:
> [...]
>
>
> - What I wrote also has a configure sequence. But I think this is not
> what a tool should do. Correct ?
>
>  From what I read you can also make your own configure checks.
>
> - I think the environment extension, which defines a few variables based
> on some others, and the 'configure' stage which actually verify that
> everything can be accessed are close related pieces of code: can we make
> a tool that registers specific configure checks ?
>

Each Environment is your "build environment" (think of "shell/terminal") with all its shell variables and paths set for a special 
"build purpose". Depending on which kind of targets you want to build (= Builders that you want to call and execute their actions), 
you have to prepare this Environment.
A Tool is simply a "wrapper" or "helper method" that aims at reducing your work, by collecting such mundane tasks as:

   - adding your custom Builders, Emitters and Scanners,
   - detecting whether an application/executable is available and
   - setting or modifying Environment variables.

It further ensures that you can "share" this knowledge about how to properly set up an Environment, e.g. for creating PDF files from 
LaTeX sources, with your friends, colleagues and the whole world.

All together, a Tool is a means to extend, amend or modify a build environment for a particular build purpose. In doing so, it is 
free to do with the Environment what it wants.


> - The configure stage is adding directly what he found to the $LIBS
> option. However if I just want to know that everything is here and
> manually add to LIBS: can I do that ?
>

You can simply "clone" any existing (and possibly pre-configured) environment with:

   cloned_env = env.Clone()

and then use the copy for your Configure checks.

>
> I guess that in the end I would like to be able to write a sequence of
> code like:
> *********************************
> env = Environment(
>      tools=['defatult','fftw'],
>      FFTW_LIBRARY_WISH = ['thread','omp']
>      FFTW_VERSION = ['thread','omp']
> )
>
> conf = Configure(env)
> conf.CheckFFTW()
> conf.Finish()
> **********************************
>
>
> - how to make it explicit that the FFTW tool depends on the 'default'
> (since it needs a C/C++ compiler to be used) ?
>

We currently don't provide a real mechanism for this, at least I don't know of any right now. If I remember correctly, the current 
Toolchain redesign by Gary will offer such possibilities.
What some Tools do in their "generate()" method though, is to simply import the required other Tools, and first call their 
generate() method on the current build environment as well.

Best regards,

Dirk



More information about the Scons-users mailing list