aboutsummaryrefslogtreecommitdiff
path: root/python/olm_build.py
diff options
context:
space:
mode:
authorDamir Jelić <poljar@termina.org.uk>2018-07-08 12:19:17 +0200
committerHubert Chathi <hubert@uhoreg.ca>2018-07-18 17:44:32 -0400
commitac071d9c0d69e4330a06f171e3bddc713ecd97d6 (patch)
treefacb7f834e43d2a346f07e3405da2c304ff66cc0 /python/olm_build.py
parente3d66733712e161d9287ea3f0116e5b57477b0d8 (diff)
python: Enable build with the local build of the Olm C library.
This patch adds the ability to build the bindings without having a globally installed Olm C library. Provided that the C library is already built, the tests can be run now with make test. Signed-off-by: Damir Jelić <poljar@termina.org.uk>
Diffstat (limited to 'python/olm_build.py')
-rw-r--r--python/olm_build.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/python/olm_build.py b/python/olm_build.py
index 5ffefc2..281a571 100644
--- a/python/olm_build.py
+++ b/python/olm_build.py
@@ -24,6 +24,15 @@ from cffi import FFI
ffibuilder = FFI()
PATH = os.path.dirname(__file__)
+DEVELOP = os.environ.get("DEVELOP")
+
+compile_args = []
+link_args = []
+
+if DEVELOP and DEVELOP.lower() in ["yes", "true", "1"]:
+ compile_args = ["-I../include"]
+ link_args = ['-Wl,-L=../build,-rpath=../build']
+
ffibuilder.set_source(
"_libolm",
@@ -31,7 +40,10 @@ ffibuilder.set_source(
#include <olm/olm.h>
#include <olm/inbound_group_session.h>
#include <olm/outbound_group_session.h>
- """, libraries=["olm"])
+ """,
+ libraries=["olm"],
+ extra_compile_args=compile_args,
+ extra_link_args=link_args)
with open(os.path.join(PATH, "include/olm/olm.h")) as f:
ffibuilder.cdef(f.read(), override=True)