You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.3 KiB

3 years ago
# pybindmagic
An IPython kernel magic library. After `import pybindmagic` you can use the cell magic `%%cpp`
In this cell you can write cpp code.
## Requirements
* pybind11
* git
* gcc
* cmake (optional)
## Installation
`pip install git+`
3 years ago
* [ ] add options for cmake flags
* [ ] add other compilers
* [ ] Better exception handling
* [ ] Better debugging output
## Options
### defs
You need to specify all functions or classes you want to expose to python. Either by `%%cpp -f funcname` or by pybind11 syntax at the end of the cell. There is a shortcut by inserting a `defs` in the end of the cell that will add the correct module name. For an example take a look at the example notebook.
### Compiler
Currently only gcc is supported. The default compiler command is `c++`. You can change the compiler command with:
`pybindmagic.compiler_cmd = "gcc"`
### CMake
With `%%cpp -c path/to/folder/with/CMakeList.txt/in` you can specify cmake compilation. After evaluation pybind11 will be downloaded and moved to this folder, a build folder is generated and the cell is compiled in this folder.
Makesure that you add pybind11 to your cmake file.
### rebuild
With the `%cpp -rebuild` flag you can enforce a complete rebuild.