27.2. Ninja Build Generator

Note

This is an experimental new feature. It is subject to change and/or removal without depreciation cycle

To use this tool you must install pypi's ninja package. This can be done via pip install ninja

To enable this feature you'll need to use one of the following

                # On the command line
                --experimental=ninja

                # Or in your SConstruct
                SetOption('experimental', 'ninja')
            

This tool will enabled creating a ninja build file from your SCons based build system. It can then invoke ninja to run your build. For most builds ninja will be significantly faster, but you may have to give up some accuracy. You are NOT advised to use this for production builds. It can however significantly speed up your build/debug/compile iterations.

It's not expected that the ninja builder will work for all builds at this point. It's still under active development. If you find that your build doesn't work with ninja please bring this to the users mailing list or devel channel on our discord server.

Specifically if your build has many (or even any) python function actions you may find that the ninja build will be slower as it will run ninja, which will then run SCons for each target created by a python action. To alleviate some of these, especially those python based actions built into SCons there is special logic to implement those actions via shell commands in the ninja build file.

Ninja Build System

Ninja File Format Specification