[question] Toolchain cross building integration
See original GitHub issue- Conan version: 1.47.0
- OS: Ubuntu 20.04
- python 3.6
I had a similar question one year ago #8922, so I am trying again to integrate conan deeper into our building system.
I have created a conan package called LinaroArm64Toolchain
and a profile linaro-aarch64-gcc10.2-linux5.4_release.txt
with the following content.
include(default)
[settings]
os=Linux
arch=armv8
compiler=gcc
compiler.version=10
compiler.libcxx=libstdc++11
build_type=Release
[tool_requires]
linaro-aarch64/10.2.1
[options]
[env]
- Now I can cross build packages with the profile without any issue, and I can see variables such as CC, CXX are populated correctly without any issue.
conan create . hsuan/test --profile:host=./profiles/linaro-aarch64-gcc10.2-linux5.4_release.txt --profile:build=./profiles/linux-x86_x64-build-default.txt
What I would like to achieve next is building a project with toolchain integrated with conan using CMakeToolchain
, for example:
conan install ../conanfile.txt --profile:host=./profiles/linaro-aarch64-gcc10.2-linux5.4_release.txt --profile:build=./profiles/linux-x86_x64-build-default.txt
cmake -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake ..
make
However, it seems this still doesn’t work, as env_info
I defined in LinaroArm64Toolchain
can’t be seen conan_toolchain.cmake
, those 2 are correct
set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR armv8)
But not CONAN_CMAKE_SYSROOT
nor CXX
, CC
.
Same as 1 year ago, this does work with virtualenv
conan install ../conanfile.txt --profile:host=./profiles/linaro-aarch64-gcc10.2-linux5.4_release.txt --profile:build=./profiles/linux-x86_x64-build-default.txt
source activate.sh
cmake ..
make
I wonder if there are any alternatives now? for example, if it is possible to customize conan_toolchain.cmake
in LinaroArm64Toolchain
? So we can add what ever we need? Or is there any way we can create a toolchain file defined in LinaroArm64Toolchain
when we call conan install
without CMakeToolchain
?
Many thanks
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Hi @ericriff
Yes, one of the issues we have open to keep working on this is https://github.com/conan-io/conan/issues/10317 (for beta.1)
Yes, the new approach is using
self.buildenv_info
, because it has several advantages:self.buildenv_info.prepend_path("PATH", ....)
, both for vars that are path-like, and also the intended actionWe package a toolchain with conan and then we expose it using env variables declared on the recipe, like this:
Is env_info deprecated in favor of buildinfo and runinfo @memsharded ?