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 object >
当前的配方对象。始终使用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 >
当前的配方对象。始终使用self
。- 返回:
str
运行时标志。
is_msvc¶
- is_msvc(conanfile, build_context=False)¶
验证当前编译器是否为
msvc
。- 参数:
conanfile –
< ConanFile object >
当前的配方对象。始终使用self
。build_context – 如果为 True,将使用构建上下文中的设置,而不是主机设置
- 返回:
bool
如果主机编译器为msvc
,则为 True,否则为 False。
is_msvc_static_runtime¶
- is_msvc_static_runtime(conanfile)¶
在使用 Visual Studio 或 msvc 并采用 MT 运行时进行构建时进行验证。
- 参数:
conanfile –
< ConanFile object >
当前的配方对象。始终使用self
。- 返回:
bool
如果为msvc + runtime MT
,则为 True。否则为 False。
msvs_toolset¶
- msvs_toolset(conanfile)¶
根据编译器设置返回相应的平台工具集。如果在配置中未配置工具集,它将返回基于编译器版本的工具集;否则,将返回配置中的工具集。当没有配置编译器版本或工具集时,将返回 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')¶