I'm trying to add pre and post-process actions when building a project with SCons.
The SConstruct and SConscript files are at the top of the project.
Pre-process actions: Generating code(by calling different tools): -> without knowing the exact files that will be generated after this pre-process (additional pre-process for deciding which files were generated can be created in order to feed SCons with them)
-> running external scripts(python, pearl scripts), executed before compilation
Post-process actions:
->running external tools, running external scripts that should be executed after linking
What I tried until now:
For pre-process:
- To use os.system from python in order to run a cmd. ( works fine but I'm looking for a "SCons solution" )
- To use
AddPreAction(target, action)
function from SCons. Unfortunately this function is executed after compiling the project as the SCons user manual states:"The specified pre_action would be executed before scons calls the link command that actually generates the executable program binary foo, not before compiling the foo.c file into an object file."
For post-process:
- To use
AddPostAction(target, action)
and this works fine, fortunately.
I'm looking for solutions that will make SCons somehow aware of this pre and post processes.
My question is the following:
What is the best approach, for the requirements stated above, using SCons ? Is there a way to execute pre-process actions before compilation using SCons built-in functions ?