Skip to content

VicenteVicente/cmake-emscripten-pybind11

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMake emsripten/pybind11 cross-compilation example

This is an example for compiling a C++ library using CMake and either pybind11 or emscripten. It also provides an example of its usage on a html page and a python module.

Install emscripten

sudo apt-get install emscripten

Compile to javascript

emcmake cmake -B build/ -DTARGET_TYPE="javascript"
cmake --build build/

Install pybind11

pip3 install "pybind11[global]"

Compile to python

cmake -B build/ -DTARGET_TYPE="python"
cmake --build build/

Run javascript

Just start a web server on this directory and navigate to host:port/index.html.

Run python

Move the compiled library and run main.py.

mv build/binding.<ext> binding.<ext>
python3 main.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published