check_min_vs¶
- check_min_vs(conanfile, version, raise_invalid=True)¶
这是一个辅助方法,允许在迁移 1.X -> 2.0 和 VisualStudio -> msvc 设置时,不破坏 recipe。旧的“Visual Studio”及不同的 toolset 不受管理,不值得为此增加复杂性。
- 参数:
raise_invalid –
bool如果版本检查失败,是否引发异常或返回 Falseconanfile –
< ConanFile 对象 >当前配方对象。始终使用self。version –
strVisual Studio 或 msvc 的版本号。
示例
def validate(self):
check_min_vs(self, "192")
msvc_runtime_flag¶
- msvc_runtime_flag(conanfile)¶
根据 settings 中的
compiler.runtime值获取 MSVC 运行时标志。- 参数:
conanfile –
< ConanFile 对象 >当前配方对象。始终使用self。- 返回:
str运行时标志。
is_msvc¶
- is_msvc(conanfile, build_context=False)¶
验证当前编译器是否为
msvc。- 参数:
conanfile –
< ConanFile 对象 >当前配方对象。始终使用self。build_context – 如果为 True,将使用构建上下文的设置,而不是宿主上下文的设置
- 返回:
bool如果宿主编译器是msvc,则为 True,否则为 False。
is_msvc_static_runtime¶
- is_msvc_static_runtime(conanfile)¶
在用 Visual Studio 或 msvc 构建且运行时为 MT 时进行验证。
- 参数:
conanfile –
< ConanFile 对象 >当前配方对象。始终使用self。- 返回:
bool如果是msvc + runtime MT,则为 True。否则为 False。
msvs_toolset¶
- msvs_toolset(conanfile)¶
根据编译器设置返回相应的平台工具集。如果没有在 profile 中配置 toolset,它将返回一个基于编译器版本的 toolset,否则,它将返回 profile 中的 toolset。当没有配置编译器版本和 toolset 时,它将返回 None。它支持 msvc、intel-cc 和 clang 编译器。对于 clang,它假定使用 Visual Studio 安装程序提供的 ClangCl toolset。
- 参数:
conanfile – Conanfile 实例,用于访问 settings.compiler
- 返回:
当 compiler.version 有效或 compiler.toolset 已配置时,返回一个 toolset。否则,返回 None。
unix_path¶
- unix_path(conanfile, path, scope='build')¶