@static in Project.toml

I am using the command @static Sys.ARCH == :aarch64 ? using WGLMakie : using GLMakie in my program to use WGLMakie on the Raspberry PI and GLMakie on other machines.

This is due to OpenGL not being available on the RPI.

Can I also use this command in the Project.toml so that the program does not have both WGLMakie and GLMakie in the Project.toml? If not, is there another way to do this?

At the moment, Project.toml and Pkg’s resolver are platform independent. This isn’t a big deal for JLLs wrapping available artifacts, but installing both WGLMakie and GLMakie only spares the precompilation. If you really don’t want the extra baggage of an unused dependency, you need a separate version or package (preferably in the same monorepo, include-ing the same files). It’s obviously weird for 2 packages to have the same code except for one import expression, but it was already weird for 2 dependencies to have the same Makie API to allow that in the first place. If you’re not making a package, then it’s just sending a different environment and script to the Pi.