Commit 4bf58fa7 authored by Jørgen Lien Sellæg's avatar Jørgen Lien Sellæg
Browse files

add sum example in pybind11

parent cf323913
[submodule "pybind/sum_example/lib/pybind11"]
path = pybind/sum_example/lib/pybind11
url =
cmake_minimum_required(VERSION 2.8)
set(project_name pybind-example)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -Wall -Wextra")
pybind11_add_module("Maths" module.cpp)
Subproject commit 9bb3313162c0b856125e481ceece9d8faa567716
#include <pybind11/pybind11.h>
int sum(int a, int b) {
return a + b;
PYBIND11_MODULE(Maths, m) {
m.def("sum", &sum);
from sys import path
path.append("./build") # sorry
from Maths import sum
result = sum(3, 2)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment