Specifying a set of cfg
s for given crates (cfg
groups)
#17815
Labels
C-feature
Category: feature request
cfg
s for given crates (cfg
groups)
#17815
The Linux kernel has ~20k (yes, kilo!) configuration options, and we pass them via
--cfg
s. This means that, in ourrust-project.json
file, we have to put (a subset of) all of them, repeated per crate.Currently we only have a small number of crates, but our configuration file can already reach 150k lines, ~7.5 MiB with just 6 crates (plus
core
etc. that do not need thecfg
s). As Rust in the kernel grows, and as we start splitting ourkernel
crate in smaller ones, it can get out of control soon: we may have 10 now, but we can eventually end up with 1000s if Rust is a success. Thus the file size may explode, and I imagine performance and memory usage may not be great either, depending on how it is implemented.From a quick look at the documentation, it does not seem like one can define a set of "global"
cfg
s to apply to "all" crates. Ideally, one would be able to define "groups" and then apply those groups to some crates before their individual set ofcfg
s.So, for instance, in our case, we would just define a group like
"kernel": ["CONFIG_...=...", ...],
with essentially all thecfg
s, and then in each kernel crate that needs them we would have a key like:"cfg_groups": ["kernel"],
, rather than repeating every time all thecfg
s in the existing"cfg"
key.The text was updated successfully, but these errors were encountered: