diff --git a/pygomx-module/.gitignore b/pygomx-module/.gitignore new file mode 100644 index 0000000..3c4e140 --- /dev/null +++ b/pygomx-module/.gitignore @@ -0,0 +1,8 @@ +dist/ +build/ +*.egg-info +*.so +*.h +*.c +*.o +*.a diff --git a/pygomx-module/MANIFEST.in b/pygomx-module/MANIFEST.in new file mode 100644 index 0000000..7e1214c --- /dev/null +++ b/pygomx-module/MANIFEST.in @@ -0,0 +1 @@ +include *.so diff --git a/pygomx-module/Makefile b/pygomx-module/Makefile new file mode 100644 index 0000000..ad9c9c7 --- /dev/null +++ b/pygomx-module/Makefile @@ -0,0 +1,26 @@ +SOURCE_GO=$(shell find ../libmxclient/ -iname "*.go") + +.PHONY: +all: _pygomx.o libmxclient.h + mkdir -p build/lib + cp *.so build/lib + +_pygomx.o: libmxclient.h build_ffi.py + python3 build_ffi.py + +libmxclient.h: ../libmxclient/go.mod ../libmxclient/go.sum $(SOURCE_GO) + cd ../libmxclient/ && \ + CGO_ENABLED=1 go build -buildmode=c-archive -o ../pygomx-module/libmxclient.a . + +.PHONY: +clean: + -rm _pygomx.* + -rm libmxclient.* + -rm -r dist/ + -rm -r build/ + -rm -r pygomx_module.egg-info + +.PHONY: +install: all + python setup.py bdist_wheel + python setup.py install diff --git a/pygomx-module/README.txt b/pygomx-module/README.txt new file mode 100644 index 0000000..52e8a3a --- /dev/null +++ b/pygomx-module/README.txt @@ -0,0 +1,14 @@ +pygomx-module +============= + +python package with the pygomx binaries + + +build wheel: + + make + python setup.py bdist_wheel + +install: + + python setup.py install diff --git a/pygomx-module/build_ffi.py b/pygomx-module/build_ffi.py index dcc8e48..1c88497 100644 --- a/pygomx-module/build_ffi.py +++ b/pygomx-module/build_ffi.py @@ -8,7 +8,9 @@ ffibuilder.set_source( source=""" //passed to the real C compiler #include "libmxclient.h" """, - libraries=["mxclient"], + libraries=["mxclient", "olm"], + library_dirs=["."], + include_dirs=["."], ) ffibuilder.cdef( diff --git a/pygomx-module/requirements.txt b/pygomx-module/requirements.txt new file mode 100644 index 0000000..eefbb88 --- /dev/null +++ b/pygomx-module/requirements.txt @@ -0,0 +1,3 @@ +cffi +setuptools>=80 +wheel diff --git a/pygomx-module/setup.py b/pygomx-module/setup.py new file mode 100644 index 0000000..f5ef31d --- /dev/null +++ b/pygomx-module/setup.py @@ -0,0 +1,3 @@ +from setuptools import setup + +setup(name="pygomx-module", version="0.0.1", py_modules=["_pygomx"])