Profile 插件¶
扩展插件 profile.py 是一个 Python 脚本,它接收一个 profile 并允许检查和修改它。
此插件位于缓存文件夹 extensions/plugins/profile.py 中。
此 profile.py 包含一个默认实现,它会
对于
msvc和clang编译器(在 Windows 上),如果未定义compiler.runtime_type,则会尝试定义它,并将其定义为与settings.build_type匹配。 这允许用户在 profile 中将其保持未定义,并仅使用-s build_type=Debug在命令行中方便地切换它。如果定义了
compiler.cppstd值,它将检查该值,以验证当前编译器版本是否支持它。 例如,如果开发者尝试使用-s compiler=gcc -s compiler.version=5 -s compiler.cppstd=20,它将引发错误。虽然
profile.py插件有一些用于处理compiler.cstd检查的规定,但尚未实现,因此该插件对于定义错误将是宽松的,请确保您的编译器版本实际支持compiler.cstd。
用户可以自定义此 profile.py 并通过 conan config install 分发它,在这种情况下,应该删除第一行
# This file was generated by Conan. Remove this comment if you edit this file or Conan
# will destroy your changes.
并且 profile.py 应该包含一个具有以下签名的函数
def profile_plugin(profile):
settings = profile.settings
print(settings)
当计算 profile 时,它将显示如下内容
OrderedDict([('arch', 'x86_64'), ('build_type', 'Release'), ('compiler', 'msvc'), ('compiler.cppstd', '14'), ('compiler.runtime', 'dynamic'), ('compiler.runtime_type', 'Release'), ('compiler.version', '192'), ('os', 'Windows')])
另请参阅
请参阅有关 Conan profiles 的文档。