The clang-bind is a project to generate python bindings for C++ code using clang python bindings and pybind11.
C++
libclang
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
echo 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main' | sudo tee -a /etc/apt/sources.list
echo 'deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main' | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y libclang-11-dev python3-clang-11
Python
pip install -r requirements.txt
tests/test_project/
foldercmake ..
make -j$(nproc)
python ../../../clang_bind/parse.py --com ./ ../src/simple.cpp
python ../../../clang_bind/generate.py --com json/src/simple.json
The binding code will be available in pybind11-gen/src
folder.