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