我有一个项目,我使用SCons(和MinGW/gcc,取决于平台)构建.该项目依赖于其他几个库(让我们称之为libfoo和libbar),它可以在不同的地方为不同的用户进行安装.
目前,我的SConstruct文件将硬编码路径嵌入到这些库中(例如,类似:) C:\libfoo.
现在,我想在我的SConstruct文件中添加一个配置选项,以便安装libfoo在其他位置的用户(比如说C:\custom_path\libfoo)可以执行以下操作:
> scons --configure --libfoo-prefix=C:\custom_path\libfoo
Run Code Online (Sandbox Code Playgroud)
要么:
> scons --configure
scons: Reading SConscript files ...
scons: done reading SConscript files.
### Environment configuration ###
Please enter location of 'libfoo' ("C:\libfoo"): C:\custom_path\libfoo
Please enter location of 'libbar' ("C:\libfoo"): C:\custom_path\libbar
### Configuration over ###
Run Code Online (Sandbox Code Playgroud)
选择后,应将这些配置选项写入某个文件,并在每次scons运行时自动重新读取.
是否scons提供这样的机制?我该如何实现这种行为?我并不完全掌握Python,所以即使是明显(但完整)的解决方案也是受欢迎的.
谢谢.