[Build] Switch to Conan v2 #1163
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Closes #1020. Conan v2 has been out for some time now and supports all of our dependencies.
The command-line syntax is somewhat different, so update all usages to use the new syntax.
It is no longer possible to mutate a Conan profile via the command line, so we have to supply a custom profile (or edit the default profile via an alternative mechanism - not pursued here).
Thankfully, Conan profiles are Jinja templates with some handy utility functions injected out of the box, in particular the
detect_api. This means we can ship a single Conan profile, which will work across all platforms. Currently, auto-detection is used for all profile fields except the C++ standard, and on Linux the libstdc++ ABI toggle. Both of these explicitly specified fields follow VFX Reference Platform CY2022.Use the
CMakeToolchaingenerator, rather than the (now removed)cmake_paths. Hence update the variousCMAKE_TOOLCHAIN_FILEet al. references to useconan_toolchain.cmakeTest Instructions
Assuming a Debug build of OpenAssetIO, the new command line becomes
where
&is a special token that means "host application". The effect of"&:build_type=Debugis to create CMake config files for debug builds. Without this, a debug build will fail since the imported target won't have any properties (e.g. include directories).The
-pris optional - you can use the auto-detected profile, but it's less likely to be CY22 compliant.