[Idea/Feature Request] Gems with configurable flags conditional compilation and asset directory filtering (may help managing the legacy stuff)

For who hates to pollute the editor ui and the final game with things that he doesn’t use.
To help to move legacy stuff out of newer projects, help define a flexible gem granularity and to just include the needed set of assets(using directories with the same name of the flag).

All this thanks to simple configurable flags(32bit set) that define conditional compilation and Asset directory inclusion. You may both manually choose the active flags visually from the project configurator than let other gems require the activation of one or more flags in a gem they depend on.

Legacy stuff could then be put in a single or few gems giving flexible granularity without gem number explosion and let projects choose how much legacy stuff to require with the maximum precision.

The flags set may append a hexadecimal hash to the name of the dll to differentiate 2 dll of the same gem using 2 different flag sets.A management function may clean up all the configuration permutations not actually required by any active project.

Cross flag dependency or flags that require one or more other flags can be usefull to especially for assets required by multiple features that can be toggled separately.

Assets directories with the same name of a flag can be included or excluded based on the actual settings. If an asset is required by 2 or more flags it may be put in a “parent” flag directory required by any flag requiring the asset that then get activated automatically if one of the “children” flags is choosen

Awesome idea @Gamely! I’ve added this to our feature request list for further action—keep em coming :slight_smile:

a debug strategy should be employed to catch c and lua code that calls function excluded by a missing flag (at least in debug build) better if automated (Macros or code generation).

in debug Excluded functions and classes may be replaced by stub versions that just trow the detailed error.

um… isnt there already something like this with using the wscript?

I do something like this with the “defines” variable in the wscript to control debug compilation and there is a way to use a variation of the defines variable based on what kind of build it is, i.e. debug vs performance.

You can see it with my sqlite gem’s wscript here.

And for dealing with files, you can use waf’s feature system which my alternative audio port audio playback gem uses here.

waf’s feature explanation.