A combination of C++ and Python to expose an simple API written in C++ to Python as a module. Achieved through the use of pybind11
, a lightweight header-only library that facilitates the seamless integration of C++11 code with Python.
- Meson/CMake
- pybind11
- for Meson and manual building:
pip install pybind11
, - for CMake:
git submodule update --init --recursive --remote
- for Meson and manual building:
- C++11 compatible compiler (Clang or GCC on Linux, MSVC on Windows)
c++ -O3 -Wall -shared -std=c++11 -fPIC $(python3 -m pybind11 --includes) <source.cpp> -o <module_name>$(python3-config --extension-suffix)
meson setup build-meson
meson compile -C build-meson
python3 main.py build-meson
cmake -S . -B build-cmake
cmake --build build-cmake
python3 main.py build-cmake