Cross compilation by default #10904
-
|
Hi! I'm looking into replacing CMake with Meson for an embedded project that always cross-compiles using arm-none-eabi toolchain. As there is a lot of platform specific code, there is little chance of it working on another platform. I currently set toolchain file in CMake by default, so I don't have to specify it each time. I prefer the project builds with a simple Any advice is appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
|
If nothing else, you can do if not meson.is_cross_build()
error('must be invoked with "meson setup--cross-file=./toolchain.ini" or via meson-wrapper.sh')
endifThis does make it impossible for devs to overlook the script. I don't know off the top of my head if this is otherwise possible, unless maybe you can specify a cross file in default_options? Haven't tried it. |
Beta Was this translation helpful? Give feedback.
-
|
One of the design principles of Meson has always been to be as "functional" as possible. That is, once all the various options and other state is set, the configure phase "just runs" and should always produce the same output. Because of this you can't, for example, change the values of options from inside the build files. Doing so would make the whole thing unstable because you would be able to do bad things liked Whether something is a cross build or not (and more specifically what machine it is targetting) is one of the pieces of state that is set "from the outside". While it would be convenient for some, it would open a whole different can of worms for many other projects. |
Beta Was this translation helpful? Give feedback.
If nothing else, you can do
This does make it impossible for devs to overlook the script.
I don't know off the top of my head if this is otherwise possible, unless maybe you can specify a cross file in default_options? Haven't tried it.