brian-team / brian2genn

Brian 2 frontend to the GeNN simulator
http://brian2genn.readthedocs.io/
GNU General Public License v2.0
46 stars 16 forks source link

Include custom headers in `model.cpp` #132

Closed denisalevi closed 3 years ago

denisalevi commented 3 years ago

Fix for issue #131. I only included headers defined via prefs.codegen.cpp.headers.

mstimberg commented 3 years ago

Thanks for the PR! I'm happy with the change in general, but for consistency with the other templates maybe rather use:

{% for name in user_headers | sort %}
#include {{name}}
{% endfor %}

? I don't think we need to support two types of syntaxes to specify headers here. Also, maybe use user_headers = self.headers + prefs['codegen.cpp.headers'] as in the other places? I am not quite sure why we use self.headers elsewhere (it is an empty list anyway), but it might come in handy some day I guess.

mstimberg commented 3 years ago

Oops, sorry... I just saw that the code I mentioned is used in brian2, not in brian2genn...

mstimberg commented 3 years ago

Oh, but note that brian2genn does not work (yet) with brian2 master, due to the changes in the synapse generator.

denisalevi commented 3 years ago

Thanks for the quick merge and the hint! I will stick with the latest brian2 release for the benchmarks.