pytutorial/PyBind11/basics
David Rotermund ba2900b2cd
Update README.md
Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
2024-01-03 01:35:04 +01:00
..
README.md Update README.md 2024-01-03 01:35:04 +01:00

Expanding Python with C++ modules

{:.no_toc}

* TOC {:toc}

Top

Questions to David Rotermund

PYBIN=~/P3.9/bin/
COMPILER=clang

PYBIND11INCLUDE=`$(PYBIN)python3 -m pybind11 --includes`

PARAMETERS= -O3 -std=c++14 -fPIC  $(PYBIND11INCLUDE) -Wall

THEMODULENAME=themodule`$(PYBIN)python3-config --extension-suffix`

all: themodule

MyModule.o: MyModule.h MyModule.cpp 
	$(COMPILER) $(PARAMETERS) -c MyModule.cpp -o MyModule.o

themodule.o: MyModule.h themodule.cpp 
	$(COMPILER) $(PARAMETERS) -c themodule.cpp -o themodule.o

themodule: MyModule.o themodule.o
	$(COMPILER) -shared -o themodule MyModule.o themodule.o -lm -lstdc++ -Wall
	cp themodule $(THEMODULENAME)

clean:
	rm -f $(THEMODULENAME)
	rm -f themodule
	rm -f *.o