I need to be able to tune a construction environment so that I can either build a static or a shared objects in lower levels. Currently, I came up with the following approach:
top-level SConstruct:
if build_shared:
env.Replace(ObjectBuilder = env.SharedObject)
env.Replace(LibraryBuilder = env.SharedLibrary)
else:
env.Replace(ObjectBuilder = env.StaticObject)
env.Replace(LibraryBuilder = env.StaticLibrary)
and in lower-level SConstructs I invoke them by name:
env[ ObjectBuilder ]( foo.c )
env[ LibraryBuilder ]( lib , objects)
However, I m not sure how sound this solution is. Is there a more straightforward/proper way to achieve the same functionality?
Thanks in advance.