Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Include custom headers in model.cpp #132

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion brian2genn/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -1647,7 +1647,8 @@ def generate_model_source(self, writer, main_lines, use_GPU):
codeobj_inc=codeobj_inc,
dtDef=self.dtDef,
prefs=prefs,
precision=precision
precision=precision,
header_files=prefs['codegen.cpp.headers']
)
writer.write('magicnetwork_model.cpp', model_tmp)

Expand Down
9 changes: 9 additions & 0 deletions brian2genn/templates/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@

#include "objects.h"
#include "objects.cpp"

{% for header in header_files %}
{% if header.startswith('"') or header.startswith('<') %}
#include {{header}}
{% else %}
#include "{{header}}"
{% endif %}
{% endfor %}

// We need these to compile objects.cpp, but they are only used in _write_arrays which we never call.
double Network::_last_run_time = 0.0;
double Network::_last_run_completed_fraction = 0.0;
Expand Down