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.
DESCRIPTION. The scons utility builds software (or other files) by determining which component pieces must be rebuilt and executing the necessary commands to rebuild them.
The command 'scons --max-drift=1 --implicit-deps-unchanged' will execute your build as fast as possible.
SCons is an Open Source software construction tool. Think of SCons as an improved, cross-platform substitute for the classic Make utility with integrated functionality similar to autoconf/automake and compiler caches such as ccache. In short, SCons is an easier, more reliable and faster way to build software.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With