ofxAddonTemplate icon indicating copy to clipboard operation
ofxAddonTemplate copied to clipboard

is an addon present?

Open bakercp opened this issue 12 years ago • 3 comments

@obviousjim and I were talking about conditional includes for addon header / impl files and thought that it might be useful to suggest that all addons specify a #define that announces the addon's presence to the system. That way other addons can conditionally include bridge classes. A proposal would be something like ... in the main class ofxMyAddon.h a define like:

#define DEFINE_OFX_MYADDON

And then in the bridge classes of a dependent addon like ofxMyAddonThatDependsOnofxMyAddon.h one would do something like:

#ifdef DEFINE_OFX_MYADDON`

my special class that required OFX_MYADDON

#endif

Right now it is possible to specify required addon dependencies in addon_config.mk, but this is addressing the situation where an addon can optionally add features if an addon is present.

@arturoc @atduskgreg @bilderbuchi

bakercp avatar Jun 15 '13 19:06 bakercp

Hm, is there no way we can do this automatically, e.g. during the build process generate the defines from the list of parsed addons? The make-work character of this define (i.e. have a define which basically echoes the filename) makes me feel we should be able to automate this?

The problem I see is that we have to get every addon author to add this special include, and it will be "only" useful for a subset of users, i.e. people who write addons which depend on some special functionality in another addon. It would be better if we could have a system where the dependent addon author would be the only one who would have to do something (i.e. the ifded above) to make this work for him.

bilderbuchi avatar Jun 16 '13 09:06 bilderbuchi

Good point @bilderbuchi -- it's very easy to do with the new makefile system, but wasn't sure how it would play out in other project files. I suppose an update project generator could also take care of this.

bakercp avatar Jun 16 '13 15:06 bakercp

Hello, was the feature suggested by @bilderbuchi added?

gsautr avatar Jun 11 '18 19:06 gsautr