-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Setup Pybind for placeholder C++ code (#38)
* Add Pybind11 as submodule * Add placeholder C++ code
- Loading branch information
Showing
7 changed files
with
69 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "libsnark"] | ||
path = libsnark | ||
[submodule "third_party/pybind11"] | ||
path = third_party/pybind11 | ||
url = https://github.com/pybind/pybind11.git | ||
[submodule "third_party/libsnark"] | ||
path = third_party/libsnark | ||
url = https://github.com/scipr-lab/libsnark.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
cmake_minimum_required( VERSION 3.3.0 ) | ||
project(PyZPK) | ||
|
||
add_subdirectory(third_party/pybind11) | ||
pybind11_add_module(PyZPK src/main.cpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include <pybind11/pybind11.h> | ||
|
||
int add(int i, int j) { | ||
return i + j; | ||
} | ||
|
||
namespace py = pybind11; | ||
|
||
PYBIND11_MODULE(PyZPK, m) { | ||
m.doc() = R"pbdoc( | ||
Pybind11 example plugin | ||
----------------------- | ||
.. currentmodule:: PyZPK | ||
.. autosummary:: | ||
:toctree: _generate | ||
add | ||
subtract | ||
)pbdoc"; | ||
|
||
m.def("add", &add, R"pbdoc( | ||
Add two numbers | ||
Some other explanation about the add function. | ||
)pbdoc"); | ||
|
||
m.def("subtract", [](int i, int j) { return i - j; }, R"pbdoc( | ||
Subtract two numbers | ||
Some other explanation about the subtract function. | ||
)pbdoc"); | ||
|
||
#ifdef VERSION_INFO | ||
m.attr("__version__") = VERSION_INFO; | ||
#else | ||
m.attr("__version__") = "dev"; | ||
#endif | ||
} |
Submodule libsnark
updated
from 000000 to 477c9d