bazelbuild / platforms

Constraint values for specifying platforms and toolchains
Apache License 2.0
108 stars 71 forks source link

Define a value for "no OS"? #40

Closed UlrichEckhardt closed 1 year ago

UlrichEckhardt commented 2 years ago

Hello!

I'm working on embedded code which does not run with any OS underneath (on "bare metal"). My initial thought was to specifiy "OS=none" or something like that. What do you think of adding such a constant?

One issue I see is that it looks like it is not really a constraint, rather the opposite thereof. On the other hand, bare metal means direct access to device registers and similar things that the OS prevents normally. Interestingly, compiling an OS kernel itself would be one example of a program that requires this.

Thoughts? Ideas? Concerns?

Uli

aiuto commented 2 years ago

This needs some thought to find a real compelling use case. For the most part, a select would pick up none in //conditions:default. I also have a hunch that people compiling an OS might actually define the target os as their OS. Imagine the Mach kernel being used in MacOS or vanilla Mach.

cpsauer commented 1 year ago

Looks like this already exists! https://github.com/bazelbuild/platforms/blob/3fbc687756043fb58a407c2ea8c944bc2fe1d922/os/BUILD#L52-L55

UlrichEckhardt commented 1 year ago

Not sure why I missed this, thanks to @cpsauer for pointing this out. I think it might have been that I was using an older version of Bazel, because the company I worked for had this contstraint.

Anyway, no need to keep this open.