Open ZZH-Finalize opened 1 year ago
I would love to have something like this as well. We currently only support multiple cross files because python configparser support it, but it's not really what we want most of the time.
That being said, defining exactly what [include]
does could be tricky, and that moves us even further to a "standard" ini file format. Maybe that would be time to just move away completely from the ini format (and for .wrap files too) and make our own format based on Meson syntax. Something like:
stm32f103zet6.machine:
# This interprets common.machine using a global variable namespace, just like subdir() in meson.build files
include('common.machine')
binaries(
c: path / 'gcc',
cpp: path / 'g++',
...
)
properties(
flash_size: '512K',
...
)
common.machine:
path = '/my/toolchain'
Just thinking out loud....
As I know, Linux kernel code has the same problem on "device-tree" code, but they use GCC pre-processor to expand the
#include "xxx.dts"
code to solve this problem.
In my opinion, multiple cross-files are actually the same logic as the "[include]", so can we just add something like a "pre-processor"? This component just reads the input cross-file and finds the [include] section, then it creates a cross-file queue, adds every included file to the head of the queue, then it passes this queue to the current code. That is just like using some code to expand the include chain to a multiple cross-file, and don't need to change meson cross-file logic.
As you say, I think using Meson syntax is a great solution, and whatever which solution is accepted, the final result is similar.
Bump. This would be very useful because command line args get really long and hard to track dependencies between cross files
Currently, I can pass multiple cross-files to meson and this will merge their content, but there is a problem which is this will cause the command to be very long, and a lot of these cross-files are the same, only one of them needs to be changed.
what I want like this:
Then, use: meson setup builddir --cross-file stm32f103c8t6.ini or: meson setup builddir --cross-file stm32f103zet6.ini
instead of:
meson setup builddir --cross-file toolchain.ini --cross-file stm32f10x.ini --cross-file stm32f103c8t6.ini meson setup builddir --cross-file toolchain.ini --cross-file stm32f10x.ini --cross-file stm32f103zet6.ini