scons - always install after build

爱⌒轻易说出口 提交于 2019-12-20 04:19:06

问题


I want scons to always install the built file in several additional directories.

I created the usual install builder with alias a shown in user manual and it installs correctly when I use scons install but I prefer it to run automatically after the target is built and I cannot figure out how to specify the dependencies.

Target = Program(...)
Env.Alias('install', Env.Install(FinalDir, Target))

Should the target depend on install or vice versa or should I use something else?


回答1:


Your code looks fine. I suspect what you're really asking is you want it to always install the target in FinalDir even if you don't specify 'install' as a command-line arg, i.e. when you just say scons. In that case, check out the Default() method in the man page. You can add your 'install' alias to the set of default targets SCons builds. (The "default default" if you don't change it and don't pass any targets on the command line is everything under the current dir.)




回答2:


I went the wrong way of defining install target and trying to figure out how to run it automatically.

I solved it by aliasing the Install builder to the real file names I wanted to install instead of install.

Env.Alias('/some/dir/filename', Env.Install('/some/dir', Target))


来源:https://stackoverflow.com/questions/24189440/scons-always-install-after-build

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!