Usage of bazel for (embedded C + code generation) #21750
Replies: 2 comments
-
Yes, at Meroton we have multiple clients using embedded C with code generation using Python scripts and other languages. As stated in https://bazel.build/about/intro:
Any part of the build graph can use a tool to translate any language into something else. Additionally, you might have restrictions where some code generators, compilers or other tools only can execute in certain environments, e.g. OS, GPU, your own custom hardware, node locked licenses etc., and that also fits into the build graph with remote execution. (Yes, our clients do all of that as well.) Code generators, compilers and other tools are also built by Bazel, so all the above applies: Use any language and code generators to compile the tool, and do the compilation on certain platforms if needed. |
Beta Was this translation helpful? Give feedback.
-
We use Bazel to build embedded C++ (and a little bit of C) in Pigweed
<https://pigweed.dev/>. It's an open source project, so you can poke around
to see how we've done it.
On the code-generation front specifically, we generate embedded-friendly
C++ from proto files (general docs <https://pigweed.dev/pw_protobuf/>, Bazel
rules
<https://cs.opensource.google/pigweed/pigweed/+/main:pw_protobuf_compiler/pw_proto_library.bzl>).
We do this using our custom Python plugin for the proto compiler. I would
say this (integrating multiple languages within a build) is an area in
which Bazel particularly shines: the Python interpreter and our Python
plugin code are managed by Bazel as build inputs, just like the proto files
and regular C++ source and header files. Everything gets rebuilt if and
only if it has to. There are pre-existing build rules for Python (in
rules_python <https://github.com/bazelbuild/rules_python>), just like there
are for C/C++.
…On Wed, Mar 20, 2024 at 3:01 PM Fredrik Medley ***@***.***> wrote:
Yes, at Meroton <https://meroton.com> we have multiple clients using
embedded C with code generation using Python scripts and other languages.
As stated in https://bazel.build/about/intro:
Bazel supports projects in multiple languages and builds outputs for
multiple platforms.
Any part of the build graph can use a tool to translate any language into
something else. Additionally, you might have restrictions where some code
generators, compilers or other tools only can execute in certain
environments, e.g. OS, GPU, your own custom hardware, node locked licenses
etc., and that also fits into the build graph with remote execution. (Yes,
our clients do all of that as well.)
Code generators, compilers and other tools are also built by Bazel, so all
the above applies: Use any language and code generators to compile the
tool, and do the compilation on certain platforms if needed.
—
Reply to this email directly, view it on GitHub
<#21750 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA7UYR4GX2J6KPU74UJLD5DYZIBLNAVCNFSM6AAAAABFAJOJT2VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DQNJYGQ4TK>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Anyone out there using bazel for embedded C with code generation?
I am trying to see how viable bazel would be to replace an existing build system. At present we make use of Python with code generation, based on YAML files for defining configuration options. There are some concepts I'm not sure how to determine whether they are supported:
Beta Was this translation helpful? Give feedback.
All reactions