From e2d96a7b74908208375cfc22972abe5c5aac2221 Mon Sep 17 00:00:00 2001
From: ferrari <maxence.ferrari@gmail.com>
Date: Wed, 15 Nov 2023 14:48:18 +0100
Subject: [PATCH] Improve autocompilation and associated readme

---
 README.md             | 8 +++++++-
 gsrp_tdoa_hyperres.py | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 89ec030..8682a07 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ the GSPR loss function with a second-order polynomial.
 
 Prerequisite
 ------------
-This program uses the following libraries (tested with the following version):
+This program uses the following libraries (tested with the following version, but should work with other versions):
 * cython 0.29
 * numpy 1.21
 * scipy 1.7.1
@@ -17,6 +17,12 @@ This program uses the following libraries (tested with the following version):
 * pandas 1.3 (needed only for saving in a non CSV format)
 * tqdm 4.62 (optional if you want a progress bar)
 
+`c_corr.pyx` will automaticly be compiled at the first run of `gsrp_tdoa_hyperres.py`.
+In case the compilation fail, you can manually compile it with:
+```
+python cython_setup.py build_ext --inplace
+```
+
 Usage
 -----
 ```
diff --git a/gsrp_tdoa_hyperres.py b/gsrp_tdoa_hyperres.py
index 729225d..5e51a55 100755
--- a/gsrp_tdoa_hyperres.py
+++ b/gsrp_tdoa_hyperres.py
@@ -29,7 +29,7 @@ try:
 except ModuleNotFoundError:
     print(f'{BColors.WARNING}Unable to load c_corr. Attempting to recompile...{BColors.ENDC}')
     from subprocess import run
-    run('python cython_setup.py build_ext --inplace'.split())
+    run(f"python {os.path.join(os.path.dirname(__file__), 'cython_setup.py')} build_ext --inplace".split())
     import c_corr
     print(f'{BColors.OKGREEN}Done{BColors.ENDC}')
 try:
-- 
GitLab