File tree 3 files changed +48
-0
lines changed
3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < pybind11/pybind11.h>
2
+
3
+ namespace py = pybind11;
4
+
5
+ PYBIND11_PLUGIN (cmake_example)
6
+ {
7
+ py::module m (" cmake_example" , R"pbdoc(
8
+ Pybind11 example plugin
9
+ -----------------------
10
+ .. currentmodule:: cmake_example
11
+ .. autosummary::
12
+ :toctree: _generate
13
+ add
14
+ subtract
15
+ )pbdoc" );
16
+
17
+ m.def (" add" , &add, R"pbdoc(
18
+ Add two numbers
19
+ Some other explanation about the add function.
20
+ )pbdoc" );
21
+
22
+ m.def (" subtract" , &subtract, R"pbdoc(
23
+ Subtract two numbers
24
+ Some other explanation about the subtract function.
25
+ )pbdoc" );
26
+
27
+ #ifdef VERSION_INFO
28
+ m.attr (" __version__" ) = py::str (VERSION_INFO);
29
+ #else
30
+ m.attr (" __version__" ) = py::str (" dev" );
31
+ #endif
32
+
33
+ return m.ptr ();
34
+ }
Original file line number Diff line number Diff line change
1
+ #include " main.hpp"
2
+
3
+ int add (int i, int j)
4
+ {
5
+ return i + j;
6
+ }
7
+
8
+ int subtract (int i, int j)
9
+ {
10
+ return i - j;
11
+ }
Original file line number Diff line number Diff line change
1
+ int add (int i, int j);
2
+
3
+ int subtract (int i, int j);
You can’t perform that action at this time.
0 commit comments