You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'll try to make this to make this brief, but I'm happy to elaborate more on the context and setup. Also, this seems somewhat related to #11120 (and thus #11121), but I think (correct me if I'm wrong) this is another dimension to cross-compilation.
I'm making software for some specialised hardware (based on an ARM MCU), and I'm trying to migrate this to be built with meson. Somewhat simplified, the code to compile is split into the following
Hardware abstraction layer (hereby named HAL)
FreeRTOS
Utility libraries
Application / executables
Unit tests
3, 4 and 5 are things that relatively easily can be compiled for any platform. To the extent there is any direct interaction with hardware, we can ifdef our way around that.
1 and 2 are however a bit more tricky. To compile these things, we need to know what we're targeting and include or exclude source code accordingly. To take FreeRTOS as an example, we can compile that for Windows, POSIX or our hardware by including the generic FreeRTOS source + the porting folder for the platform.
My question is how to facilitate this easily and fully utilise the cross-compilation support that's found in meson (I really like that concept!). When we build, I'd like to build for the host hardware, but also build unit tests and run them on the build computer. Obviously, when compiling for the hardware we have native: false set, and as a simplified example we get
However, this means we also need to explicitly name the library differently (which makes sense, though it could also be located in different folders), one time for host and one for build. The problem I'm having is that this means that the entire chain following it also needs to know about this. In an ideal world, I'd like meson to understand that building an executable with native: false and including FreeRTOS, means linking with freertos_lib and building the same source code for the executable with native: true means freertos_native_lib. Is there a way to do that, or is this just something we need to keep track of in parallel?
For context, old system would essentially only target one platform, meaning two separate build structures, one for host hardware and one to build and run unit tests on build computer. Obviously, in that setup there's no name clashes or need to keep track of what's host library and what's build library, but you'd also have to make sure to build twice. Having one build structure with meson is a great improvement, so I'm curious how to make the best use of that.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'll try to make this to make this brief, but I'm happy to elaborate more on the context and setup. Also, this seems somewhat related to #11120 (and thus #11121), but I think (correct me if I'm wrong) this is another dimension to cross-compilation.
I'm making software for some specialised hardware (based on an ARM MCU), and I'm trying to migrate this to be built with meson. Somewhat simplified, the code to compile is split into the following
3, 4 and 5 are things that relatively easily can be compiled for any platform. To the extent there is any direct interaction with hardware, we can
ifdef
our way around that.1 and 2 are however a bit more tricky. To compile these things, we need to know what we're targeting and include or exclude source code accordingly. To take FreeRTOS as an example, we can compile that for Windows, POSIX or our hardware by including the generic FreeRTOS source + the porting folder for the platform.
My question is how to facilitate this easily and fully utilise the cross-compilation support that's found in meson (I really like that concept!). When we build, I'd like to build for the host hardware, but also build unit tests and run them on the build computer. Obviously, when compiling for the hardware we have
native: false
set, and as a simplified example we getfreertos_lib = library('FreeRTOS', freertos_hw_src, include_directories: incdir_hw, native: false)
It's easy enough to switch out source when explicitly compiling with
native: true
, and we then havefreertos_native_lib = library('FreeRTOS', freertos_native_src, include_directories: incdir_native, native: true)
However, this means we also need to explicitly name the library differently (which makes sense, though it could also be located in different folders), one time for host and one for build. The problem I'm having is that this means that the entire chain following it also needs to know about this. In an ideal world, I'd like meson to understand that building an executable with
native: false
and including FreeRTOS, means linking withfreertos_lib
and building the same source code for the executable withnative: true
meansfreertos_native_lib
. Is there a way to do that, or is this just something we need to keep track of in parallel?For context, old system would essentially only target one platform, meaning two separate build structures, one for host hardware and one to build and run unit tests on build computer. Obviously, in that setup there's no name clashes or need to keep track of what's host library and what's build library, but you'd also have to make sure to build twice. Having one build structure with meson is a great improvement, so I'm curious how to make the best use of that.
Beta Was this translation helpful? Give feedback.
All reactions