开发者

Multiple locations within a folder hierarchy to run SCons from

开发者 https://www.devze.com 2023-04-05 20:45 出处:网络
So far, I\'ve only seen examples of running SCons in the same folder as the single SConstruct file resides. Let\'s say my project structure is like:

So far, I've only seen examples of running SCons in the same folder as the single SConstruct file resides. Let's say my project structure is like:

  • src/*.(cpp|h)
  • tools/mytool/*.(cpp|h)

What I'd like is to be able to run 'scons' at the root and also inside tools/mytool. The latter compiles only mytool. Is this possible with SCons?

I assume it involves creating another SConstruct file. I've made another one: tools/mytool/SConstruct

I made it contain only:

SConscript('../../SConstruct')

and I was thinking of doing Import('env mytoolTarget') and call开发者_如何学Going Default(mytoolTarget), but running it with just the above runs in the current directory instead of from the root, so the include paths are broken.

What's the correct way to do this?


You can use the -u option to do this. From any subdirectory, scons -u will search upwards in the directory tree for an SConstruct file.

0

精彩评论

暂无评论...
验证码 换一张
取 消