I have created two Alire projects which require different compilers and am trying to apply that using the alr toolchain --select command but that seems to have a global effect. I am using the same gprbuild version for both projects but when I set the compiler to (say) gnat_arm_elf on the first project then that brakes the compilation in the second project which requires gnat_native and vice-versa.
The Alire docs seem to mention only this way of setting a toolchain (unless I’ve missed some other section). The Note about cross-compilation section also mentions that a Targetattribute needs to be specified for cross targets in the gpr file and I am specifying one for that project indeed.
I was under the impression that toolchain selection is applied on a local basis for the specific project this is run against but it looks like it is applied on a global basis?
Is that the case and if so what would be the typical way of configuring different toolchains for different projects in Alire?
hmm..does alr init not create a crate? I’ve run this command for both the projects but then, as mentioned, when I do alr toolchain --select that gets applied globally so, to both projects.
Or do you mean something else?
Would you mind sharing a link to the Snake game, please?
alr init creates initial content of the crate. If you use it two times, you shold have two alire.toml files, and add dependency for necesssry complier in each (it might be not needed for native).
I don’t use alr toolchain --select for years, Alire do its work excellent.
Source code of Snake game, see snake_* directories.
Yes, you can have a per-crate toolchain with `alr toolchain --local --select`. Otherwise, as you saw, you’re selecting the default toolchain for all your development.