falkben / cpp-binding-demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cpp-binding-demo

This is an implementation of the Cython demo/tutorial

cython

From within the rect directory in order to build run:

python setup.py build_ext --inplace

To test (from within Python interpreter):

import rect
rect_obj = rect.PyRectangle(1,2,3,4)
rect_obj.get_area()
dir(rect_obj)

pybind11

Test cases

To run the test cases

  1. Install cmake and boost
  2. Checkout pybind11 from github: git clone https://github.com/pybind/pybind11.git
  3. Use bash (Errors when using fish shell)

Compiling

To build python module rect from rect.cpp

c++ -O3 -Wall -shared -std=c++11 -fPIC `python3 -m pybind11 --includes` rect.cpp -o rect`python3-config --extension-suffix`

Or using a setup.py

About

License:Apache License 2.0


Languages

Language:Python 54.4%Language:C++ 45.6%