2025-02-27 5:16 PM
I want to support two variants of a product in the same codebase, but select the appropriate screens at compile time to avoid redundant code in the binaries. I considered two separate .touchgfx files but that doesn't work because they write over top of each other when generating code. So I have a TouchGFX project with all screens and images in it. I have a CMake project and I can use variables in CMakeLists to select appropriate src and generated files for View, Presenter etc but I also want to exclude image srcs. I can do this in CMakeLists but they are also defined and referenced in BitmapDatabase.cpp and BitmapDatabase.hpp. These are autogenerated so not really editable. I would like the designer to support compile-time product variants - is this possible?
What I'm thinking is tagging some screens to a variant string and during code generation these sections get wrapped in #ifdef VARIANT. But I note that BitmapDatabase.hpp uses incrementing indices, which would need to change.