[Scons-users] SCons working with Ninja
Gary Granger
granger at ucar.edu
Wed Apr 14 16:22:11 EDT 2021
Hello Don,
For whatever it's worth, we have a tool to generate ninja files from
SCons, but I did not try to solve the problem of running python
functions from ninja. Instead, the tool generates a ninja build file
from the nodes, and then it lets scons build just the nodes which do not
use command line actions. Most of our python function builders generate
source files and version header files, so they are the leaves of the
dependency graph and it doesn't matter if ninja cannot build them.
Building the few python actions establishes a 'build baseline', then
ninja builds the rest. Obviously not complete, since someone has to
remember to rebuild the ninja file if the python dependencies change.
Although I suppose the tool could be modified to list all the python
targets with a rule to re-run scons to build just those. And maybe this
does not help you, if most of your actions are not command lines.
That said, we don't use this much because in practice it's easier to
just stick with scons for everything.
https://github.com/NCAR/eol_scons/blob/master/eol_scons/tools/ninja.py
The ninja support mentioned by Mats is surprising news, I'll be
interested to see how that works.
Gary
On 4/14/21 1:42 PM, Don Baldwin wrote:
> Thanks Mats. Will this be implemented in SCons 3.x as well as 4.x? We are planning on moving to 4.x fairly soon, but we aren't there yet, and will probably not move our older projects to 4.x. Also, do you have an ETA of when this will be available?
>
> Also, what about existing tools that claim to support generating Ninja scripts from SCons builds, such as:
>
> * https://github.com/RedBeard0531/mongo_module_ninja
>
> Does anyone in this group know if that supports function actions?
>
> Lastly, we've been able to implement our own home-grown tools for doing a build "play-back" similar to what Ninja does, but we've only gotten it to work for command line actions. I think the main hurdle for function actions is reproducing the SCons environment. We've tried pickling it using both the native pickle library and 'dill', but have encountered infinite loop errors and errors trying to pickle class objects. Has anyone else attempted this and gotten past these errors? This is using SCons 3.1.2.
>
> Thanks,
> Don
More information about the Scons-users
mailing list