Container-level comptime vars

What you describe sounds to me, like you possibly could use a combination of custom build options and custom compile steps, have one compile step that compiles and runs the application in “build-time” parameter-configuration-collection-mode where the output is these size and scaling factors then you would use the output of that execution to parameterize your application to put it into “runtime-mode” where the size and scaling factors are filled out with build options.

It seems to me it would be possible to do this, but I have to admit, that I haven’t dared to use the build system in such an advanced way yet.

But in general build options are the way to replace #ifdef.
Also take a look at Build system tricks and Zig Build System ⚡ Zig Programming Language