Pigweed Eng Blog #2: Feature flags in Bazel builds
By Ted Pudlik
Published 2024-05-31
Let’s say you’re migrating your build system to Bazel. Your project heavily
relies on preprocessor defines to configure its code.
-DBUILD_FEATURE_CPU_PROFILE
-DBUILD_FEATURE_HEAP_PROFILE
-DBUILD_FEATURE_HW_SHA256
In your source files, you use these preprocessor variables to conditionally
compile some sections, via #ifdef. When building the same code for
different final product configurations, you want to set different defines.
How do you model this in Bazel?
Th...
Read more at pigweed.dev