So I\'ve read the questions on here about hierarchical builds like: Creating a Hierarchical Build with SCons
I want to do real hierarchical construction of two standalon
SConscript(dirs=['src', 'doc'])
Im not sure why you would need to make a custom builder, if I understand you correctly, I think everything you need can be done with SCons and its builtin builders.
To do what you explain, you would indeed need 3 Seperate SConsctruct files, to be able to do 3 seperate builds. I would also add 3 SConscript files and make all of them as follows:
Edit: In this example, its better to create the Environment() in the SConstruct scripts
project_root/SConstruct
# This SConstruct orchestrates building 3 subdirs
import os
subdirs = ['libfoo_subrepo', 'barapp_subrepo', 'test']
env = Environment()
for subdir in subdirs:
SConscript(os.path.join(subdir, 'SConscript'), exports = ['env'])
libfoo_subrepo/SConstruct
# This SConstruct does nothing more than load the SConscript in this dir
# The Environment() is created in the SConstruct script
# This dir can be built standalone by executing scons here, or together
# by executing scons in the parent directory
env = Environment()
SConscript('SConscript', exports = ['env'])
libfoo_subrepo/SConscript
# This SConstruct orchestrates building 2 subdirs
import os
Import('env')
subdirs = ['src', 'test']
for subdir in subdirs:
SConscript(os.path.join(subdir, 'SConscript'), exports = ['env'])
barapp_subrepo/SConstruct
# This SConstruct does nothing more than load the SConscript in this dir
# The Environment() is created in the SConstruct script
# This dir can be build standalone by executing scons here, or together
# by executing scons in the parent directory
env = Environment()
SConscript('SConscript', exports = ['env'])
barapp_subrepo/SConscript
# This SConstruct orchestrates building 2 subdirs
import os
Import('env')
subdirs = ['src', 'test']
for subdir in subdirs:
SConscript(os.path.join(subdir, 'SConscript'), exports = ['env'])
I hope the comments in each file explains its purpose.
Hope this helps.