Clone and prepare folder
$ git clone https://github.com/dvisionlab/pybind_examples
$ cd pybind_examples
Prepare a virtual environment where to install pybind11
$ python3 -m venv venv
$ . ./venv/bin/activate
Get pybind11 from github, clone it into pybind_test
directory and install it
(venv) $ git clone https://github.com/pybind/pybind11
(venv) $ cd pybind11
(venv) $ python setup.py install
Create a build folder, cd into it and run
(venv) $ ccmake ../src
A TUI should pop up, press c
to configure, then
- set
USE_PYTHON_INCLUDE_DIR ON
- set
CMAKE_BUILD_TYPE Release
Press c
and g
to generate the makefile, then
(venv) $ make
The module foo
should be now present:
(venv) $ python
>>> import foo
>>> foo.add(1, 5)
6
$ git clone https://github.com/vmtk/vmtk
$ mkdir vmtk-build
$ cd vmtk-build
$ ccmake ../vmtk
Then do the following (toggle t
for advanced mode):
- set
BUILD_SHARED_LIBS OFF
- set
VTK_VMTK_WRAP_PYTHON OFF
- set
CMAKE_BUILD_TYPE Release
- set
CMAKE_CXX_FLAGS -std=gnu++11 -fpic
Then configure with c
and generate by pressing g
and build:
$ make -j2
(venv) $ cd pybind_examples
(venv) $ mkdir build_vmtk
(venv) $ cd build_vmtk
$ ccmake ../src_vmtk
Configure using the following:
- set
USE_PYTHON_INCLUDE_DIR ON
- set
CMAKE_BUILD_TYPE Release
- set
ITK_DIRECTORY
aspath_to_vmtk_build/ITK-Build
- set
VTK_DIRECTORY
aspath_to_vmtk_build/VTK-Build
- set
VMTK_DIRECTORY
aspath_to_vmtk_build/Install
Configure and generate using "c" and "g"
(venv) $ make
(venv) $ python3
>>> import vmtk