I have a simple build system for a project that I've put together using SCons. The project has quite a few source files, and I thought it would be user-friendly to display some sort of progress information as the build is progressing. SCons provides construction variables like CXXCOMSTR
that I can override to control what gets displayed to the terminal during each of the build steps. For instance, instead of seeing something like:
gcc file.c -o file.o
It would be nice to have something like:
[1/10] Compiling file.c: `gcc file.c -o file.o`
Where the [1/10]
specifies that this is the first of ten targets that are being updated during this build. Is there any way to access this information so that I can generate messages like this? It seems like I would need to know the total number of targets that are being updated (which is based upon the dependency scanning that SCons does) and some way of enumerating each one. I know that similar behavior is similar with other build systems like CMake and waf, but haven't come across anything in SCons's (expansive) documentation.
This can be done with the Progress() SCons function.
There are more examples in the SCons man page, just search for "Progress".
You can either provide a function to be called, a string that will be displayed periodically, or a list of strings that will be displayed in a rotating fashion. You can get access to the current target being built, but I dont think its possible to know the percentage complete.