conan.tools.microsoft.visual¶
check_min_vs¶
- check_min_vs(conanfile, version, raise_invalid=True)¶
这是一个辅助方法,允许 1.X -> 2.0 和 VisualStudio -> msvc 设置的迁移,而不会破坏配方。旧的带有不同工具集的“Visual Studio”未被管理,不值得付出复杂性。
- 参数:
raise_invalid –
bool
如果版本检查失败,是否引发异常或返回 Falseconanfile –
< ConanFile 对象 >
当前配方对象。始终使用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 对象 >
当前配方对象。始终使用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)¶
根据编译器设置返回相应的平台工具集。如果在配置文件中未配置工具集,它将返回基于编译器版本的工具集,否则,它将返回配置文件中的工具集。当既没有编译器版本也没有配置工具集时,它将返回 None。它支持 msvc、intel-cc 和 clang 编译器。对于 clang,它假设 ClangCl 工具集,由 Visual Studio 安装程序提供。
- 参数:
conanfile – Conanfile 实例以访问 settings.compiler
- 返回:
当 compiler.version 有效或配置了 compiler.toolset 时的工具集。否则为 None。
conan.tools.microsoft.subsystems¶
unix_path¶
- unix_path(conanfile, path, scope='build')¶