[Scummvm-devel] About common code

Johannes Schickel lordhoto at scummvm.org
Fri Jan 21 15:49:56 CET 2011


On 01/21/2011 11:08 AM, Max Horn wrote:
> For the future, we may have to re-think our whole "common" code approach, I think. Common started out with some generic code that was really used by almost all engines resp. generic code in gui. Nowadays, it (and its siblings) contains more and more code which is relevant for only a few selected engines. Now, of course it is very much desirable to share code between engines. But it also increases the size of the main binary, which is a severe issue, esp. on low-end ports like the Nintendo DS.
>
> We started some time ago to tag some "common" code with checks of the "#ifdef ENGINE_FOOBAR_ENABLED" kind. But that, too, is problematic when doing plugin builds etc.

We do usually check for "DYNAMIC_MODULES" too when having such build guards.

> So, we should think about ways to mitigate this issue. In any case, I predict that the NDS port will get yet again a lot tougher to make for 1.3.0, which is not nice. We are bloating more and more!

Actually last time I talked with Neil he said for the NDS build all 
unused functions will be stripped anyway, thus some/most/all of those 
build guards didn't have any effect on the NDS binary size IIRC.

> Suggestions on what to do are welcome. One would be to move code which is only used by only a handful engines to a separate place(s). Come up with a good way to flag code clearly as to which engines need it and which don't. One that interacts reliably with our build system, too (right now we again and again get re-build issues after a configure run changed which engines are active).
>

I guess fixing such build issues would be easy if we just move all the 
ENABLE_FOO defines to config.h and ensure common/scummsys.h is included 
everythere first.

// Johannes




More information about the Scummvm-devel mailing list