This example shows how to build and run Python matplotlib from C/C++ source code. The instructions are focused on Linux but it can be ported to other platforms easily.
Install MetaCall:
git clone https://github.com/metacall/core.git
mkdir core/build && cd core/build
cmake -DOPTION_BUILD_LOADERS_PY=On -DOPTION_BUILD_DETOURS=Off -DOPTION_BUILD_SCRIPTS=Off -DOPTION_BUILD_TESTS=Off ..
cmake --build . --target installInstall matplotlib dependency:
pip3 install --user matplotlibBuild example source code:
gcc -std=c11 main.c -lmetacallRun executable previously built:
export LOADER_SCRIPT_PATH="`pwd`"
./a.outBuilding and running with Docker:
docker build -t metacall/embedding-matplotlib-example .
docker run --rm -v $(pwd)/output:/output -it metacall/embedding-matplotlib-example ./a.outFor seeing the plot, open the output folder.