Skip to content

Commit 6517a73

Browse files
authored
Merge pull request #213 from robotpy/cxxheaderparser2
Migrate to cxxheaderparser
2 parents 906503d + 261fb01 commit 6517a73

39 files changed

+2533
-1600
lines changed

docs/autowrap.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ robotpy-build can be told to parse C/C++ headers and automatically generate
88
:std:doc:`pybind11 <pybind11:basics>` wrappers around the functions
99
and objects found in that header.
1010

11-
.. note:: We use a fork of `CppHeaderParser <https://github.com/robotpy/robotpy-cppheaderparser>`_
12-
to parse headers. We've improved it to handle many complicated modern
13-
C++ features, but if you run into problems please file a bug on github.
11+
.. note:: We use `cxxheaderparser <https://github.com/robotpy/cxxheaderparser>`_
12+
to parse headers. It can handle common and complex C++ syntax, but
13+
if you run into problems please file a bug on github.
1414

1515
C++ Features
1616
------------

robotpy_build/autowrap/cls_prologue.cpp.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
{% endif %}
2020

2121
{% for decl in using_declarations %}
22-
using {{ decl }};
22+
using {{ decl.format() }};
2323
{% endfor %}
2424

2525
{% for cls in classes_with_trampolines %}

robotpy_build/autowrap/cls_rpy_include.hpp.j2

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
- Template constructors/method fillers (if applicable)
66
77
#}
8-
{# TODO: remove when h2w is removed #}
9-
{% if 'class_ctx' not in cls %}{{ skip_generation() }}{% endif %}
10-
{% set cls = cls.class_ctx %}
11-
{% if not cls.trampoline and not cls.template %}
12-
{{ skip_generation() }}
13-
{% endif %}
148

159
// This file is autogenerated. DO NOT EDIT
1610

robotpy_build/autowrap/cls_tmpl_impl.hpp.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ using namespace {{ cls.namespace }};
1010
{% endif %}
1111

1212
{% for decl in using_declarations %}
13-
using {{ decl }};
13+
using {{ decl.format() }};
1414
{% endfor %}
1515

1616
template <{{ cls.template.parameter_list }}>

robotpy_build/autowrap/cls_tmpl_inst.cpp.j2

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{% include "cls_prologue.cpp.j2" %}
22

3-
{% set tmpl_data = template_instances[per_tmpl_vars.index] %}
4-
53
#include <rpygen/{{ tmpl_data.header_name }}>
64
#include "{{ hname }}_tmpl.hpp"
75

robotpy_build/autowrap/cls_tmpl_inst.hpp.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace rpygen {
66

7-
{% for tmpl_data in template_instances.values() %}
7+
{% for tmpl_data in template_instances %}
88
struct {{ tmpl_data.binder_typename }} {
99
{{ tmpl_data.binder_typename }}(py::module &m, const char * clsName);
1010
void finish(const char *set_doc, const char *add_doc);

robotpy_build/autowrap/cls_trampoline.hpp.j2

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ using namespace {{ cls.namespace }};
5151
{% endif %}
5252

5353
{% for decl in using_declarations %}
54-
using {{ decl }};
54+
using {{ decl.format() }};
5555
{% endfor %}
5656

5757
{#
@@ -122,6 +122,9 @@ struct PyTrampoline_{{ cls.full_cpp_name_identifier }} : PyTrampolineBase, virtu
122122
{% for ccls in cls.child_classes if not ccls.template %}
123123
using {{ ccls.cpp_name }} [[maybe_unused]] = typename {{ ccls.full_cpp_name }};
124124
{% endfor %}
125+
{% for enum in cls.enums if enum.cpp_name %}
126+
using {{ enum.cpp_name }} [[maybe_unused]] = typename {{ enum.full_cpp_name }};
127+
{% endfor %}
125128
{% for typealias in cls.user_typealias %}
126129
{{ typealias }};
127130
{% endfor %}

robotpy_build/autowrap/clsdeps.json.j2

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)