projectGenerator icon indicating copy to clipboard operation
projectGenerator copied to clipboard

[feature] optional addon preprocessor flags

Open autr opened this issue 5 years ago • 0 comments

Hello, I wanted to share my solution to the problem referenced in this thread:

https://forum.openframeworks.cc/t/conditional-compiles-for-addons/1209/4

An example of this problem is a class abstraction addon I use for ofVideoPlayer, which optionally uses ofxHAPAVPlayer on MacOS and ofxOMXPlayer on RPi. On both they can default back to ofVideoPlayer, yet on other platforms the inclusion of the addons causes problems (or at least extra configuration).

https://github.com/Autr/projectGenerator/commits/addonflags

There are two changes in my fork here: the first adds an --addondefines, -D flag to the CLI. I've tried to be unobtrusive as the nested project parsing seems a bit fragile (perhaps a singleton pattern would be better?). The second adds a toggleable option for the flag when Advanced Options is selected in the frontend.

The end result is a list of addon flags added to the generated project, ie. OFXADDON_OFXHAPAVPLAYER OFXADDON_OFXOMXPLAYER.

autr avatar Mar 03 '20 18:03 autr