Scons: one big SContruct for all vs many small ones
I am moving Code::Blocks projects to SCons. I have a source tree with the following structure:
trunk
lib1
lib2
libn
app1
app2
a开发者_如何学编程ppn
This is my first time with Scons and I am trying to figure out what would be better - to have many small SConscripts in each app and lib folder or one big SContruct under the trunk with sections describing sources, switches and pre/post build commands for each project.
I personally prefer dealing with one file but I'd like to hear the opinion of the people experienced with SCons.
Thanks.
One advantage of individual SConscript
files is that filenames within each one are relative to the directory in which the SConscript
file resides. So creating a list of filenames for a build target becomes less verbose.
On the other hand, targets that need to be shared among different SConscript
files sometimes end up needing a lot of Export()
-ing and Import()
-ing of symbols to communicate with each other.
It looks like your apps and libraries are pretty well separated. In your case, I would start with creating multiple SConscript
files in each major directory. It's generally easier to combine them later, than to separate them later.
Think of it this way:
Would you make your real project organized in one big file or many small files? Sure, it may be easier to do some things if everything is all in one file, but for organization, multiple files can sometimes be easier.
You may want to try doing something like having global settings in your main trunk-located SConstruct file (so stuff like your warning and optimization flags), and then import that into your SConscript files which take care of target-specific details.
精彩评论