Scons. Go recursive with Glob

前端 未结 4 1610
一个人的身影
一个人的身影 2021-01-13 06:51

I using scons for a few days and confused a bit. Why there is no built-in tools for building sources recursively starting from given root? Let me explain: I have such source

4条回答
  •  日久生厌
    2021-01-13 07:25

    The Glob() SCons function doesnt have the ability to go recursive.

    It would be much more efficient if you change your Python code to use the list.extend() function, like this:

    sources = Glob('./builds/Std/*/*.cpp')
    sources.extend(Glob('./builds/Std/*.cpp'))
    sources.extend(Glob('./builds/Std/*/*/*.cpp'))
    sources.extend(Glob('./builds/Std/*/*/*/*.cpp'))
    

    Instead of trying to go recursive like you are, its quite common to have a SConscript script in each subdirectory and in the root SConstruct call each of them with the SConscript() function. This is called a SCons hierarchical build.

提交回复
热议问题