addons_config.mk variables are not treated the same way they are in makefiles
I just tested the included project generator on the latest download (OSX) and it isn't adding some addons that were previously added (e.g. ofxJSON). This seems to be an issue in recent PGs.
Not sure what the problem is, but trying to track it down.
can you explain what you mean? I've just tested and ofxJson via PG on 0.8.2 and it's compiling / working for me.
I'm using https://github.com/bakercp/ofxJSON (the same thing happens with https://github.com/bakercp/ofxJSONRPC).
My branch is maintained and has an addons_config.mk file etc, which is the key difference I believe.
When I try to build the project files for the ofxJSON examples, the include paths and source are not included in the project.
ah ok - I'll check that branch out. I'd focus on this and see if it's missing something somewhere?
https://github.com/ofZach/projectGeneratorSimple/blob/master/src/addons/ofAddon.cpp#L271-L339
Cool. Will do. I'll look at it now.
http://christopherbaker.net
On Sun, Jun 29, 2014 at 2:07 PM, ofZach [email protected] wrote:
ah ok - I'll check that branch out. I'd focus on this and see if it's missing something somewhere?
https://github.com/ofZach/projectGeneratorSimple/blob/master/src/addons/ofAddon.cpp#L271-L339
— Reply to this email directly or view it on GitHub https://github.com/ofZach/projectGeneratorSimple/issues/52#issuecomment-47468510 .
i think you might need to comment out the variables in the beginning og addons_config.mk, this:
ADDON_INCLUDES =
is setting the includes to empty
On Sun, 2014-06-29 at 12:45 -0700, Christopher Baker wrote:
Cool. Will do. I'll look at it now.
http://christopherbaker.net
On Sun, Jun 29, 2014 at 2:07 PM, ofZach [email protected] wrote:
ah ok - I'll check that branch out. I'd focus on this and see if it's missing something somewhere?
https://github.com/ofZach/projectGeneratorSimple/blob/master/src/addons/ofAddon.cpp#L271-L339
— Reply to this email directly or view it on GitHub
https://github.com/ofZach/projectGeneratorSimple/issues/52#issuecomment-47468510 .
— Reply to this email directly or view it on GitHub.
It turns out that both ADDON_INCLUDES = and ADDON_SOURCES = (and perhaps others) are clearing all of the existing sources and includes with that are parsed from the file system.
In the addons_config.mk file these variables are not supposed to completely define all sources (you wouldn't want to have to re-list all source files found in the file system if your goal was just to exclude a few -- that's what the exclude variables are for), but are meant to add additional source files that are not added by nature of their location in the file system (as prescribed by the ofxAddonsTemplate).
Basically the concept is that variables (even those that are undefined or empty) in the addons_config.mk file will not override the file system sources defined sources unless explicit excludes or includes are added. The goal with that design (as far as I recall) was that the addons_config.mk file would be completely backward compatible and optional.
Anyway, this is how the variables are treated in the makefile system so it seems that they should be treated the same with the project generator.
Make sense? Shall I issue a PR?
this is correct, if you want to add sources or includes out of the autodetected you have to use:
ADDON_INCLUDES += ...
the same way it would happen if you define a variable in the makefile and then just = it to empty it'll void it
@arturoc ADDON_INCLUDES = should not remove all of the includes found from the file system structure. Currently the makefile system does not do this, so the project generator should not either imho.
The reason we designed it this way was because we wanted to define behaviors based on exceptions and minimal intervention for special cases, rather than using addons_config.mk as a replacement for the file-system auto-detection-based approach.
Thus, the way the makefile system works now - is that it gathers sources and includes from the file system structure and then adds anything it finds in ADDON_INCLUDES (and the like) and then filters all includes / sources using the *EXCLUDES variables, removing anything in those lists.
I've been using (and continue to use) addon_config.mk with things like ADDON_INCLUDES = uncommented since we rebuilt the makefile system during the raspberry pi push and it's a solid system.
Anyway, is this making sense? I changed the title of the issue to help clarify :)
Just by way of experimentation, you compare the verbose output of project generator (and the way it handles these variables) to the make MAKEFILE_DEBUG=1 you'll see the differences between PG and the makefile system.
i think there should be a way to define those variables from scratch, for most addons the automatic parsing or parsing + exceptions should be fine but in some cases it might be useful to define everything in the config file. i think = clears the variable and += adds to it is a good convention, even if the makefile system is not working like that right now, that's how variables in Makefiles work. you can also do ?= to say that if a variable is defined before it should take the previous value and if not the one you are passing in the ?=
@arturoc. OK. I understand that perspective and agree. +1.
Let me think about it a bit more as I'm deep into the makefile system again with ofSketch.
In fact, I'm finally updating a lot of the documentation etc that was hanging out in this old https://github.com/openframeworks/openFrameworks/pull/2094 as we work on ofSketch this summer. Sometime in the next few weeks I'll update this thread, but leave it open for now.
Thanks all!