Conan2: Conceptions & Configurations & Command Lines

Difference between settings and options

• settings are typically a project-wide configuration defined by the client machine.
Things like the operating system, compiler or build configuration that will be common to several Conan packages and would not make sense to define one default value for only one of them.
For example, it doesn’t make sense for a Conan package to declare “Visual Studio” as a default compiler because that is something defined by the end consumer, and unlikely to make sense if they are working in Linux.
• options are intended for package-specific configuration that can be set to a default value in the recipe.
For example, one package can define that its default linkage is static, and this is the linkage that should be used if consumers don’t specify otherwise.

Introducing the concept of Package ID

When consuming packages like Zlib with different settings and options, you might wonder how Conan determines which binary to retrieve from the remote.
The answer lies in the concept of the package_id.

The package_id is an identifier that Conan uses to determine the binary compatibility of packages.
It is computed based on several factors, including the package’s settings, options, and dependencies.
When you modify any of these factors, Conan computes a new package_id to reference the corresponding binary.

Here’s a breakdown of the process:

  1. Determine Settings and Options: Conan first retrieves the user’s input settings and options. These can come from the command line or profiles like –settings=build_type=Debug or –profile=debug.
  2. Compute the Package ID: With the current values for settings, options, and dependencies, Conan computes a hash. This hash serves as the package_id, representing the binary package’s unique identity.
  3. Fetch the Binary: Conan then checks its cache or the specified remote for a binary package with the computed package_id. If it finds a match, it retrieves that binary. If not, Conan can build the package from source or indicate that the binary is missing.

In the context of our tutorial, when we consumed Zlib with different settings and options, Conan used the package_id to ensure that it fetched the correct binary that matched our specified configuration.

specify a directory as local cache path

add a line in file C:\Users\XXXXX\.conan2\global.conf
core.cache:storage_path = Absolute path where the packages and database are stored

create a default profile

> conan profile detect

get the location of the Conan user home

> conan config home

show the contents of the default profile in the /profiles folder

> conan profile show

about --profile argument

These two commands will behave the same:

> conan install . --build=missing
> conan install . --build=missing --profile=default

install Conan in a specifying version

> pip install conan==2.0.17

> 

> 

References

Conan Documentation --Release 2.0.17

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值