From be2e39035c04e1862ad7f487219afc443d06626e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Kubler?= <gregoire.kubler@proton.me>
Date: Fri, 10 May 2024 16:40:21 +0200
Subject: [PATCH] fix : added  missing python path

---
 setup.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/setup.py b/setup.py
index e92cd901a..1ed3b124a 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 import sys
 import os
-
+import sysconfig 
 import shutil
 import pathlib
 import multiprocessing
@@ -46,7 +46,13 @@ class CMakeBuild(build_ext):
         # Impose to use the executable of the python
         # used to launch setup.py to setup PythonInterp
         python_executable = sys.executable
+        python_include_dirs = sysconfig.get_path('include')  
+        python_library = sysconfig.get_config_var('LIBDIR')
+        python_prefix = sys.exec_prefix
         print(f"python executable {python_executable}")
+        print(f"python include dirs {python_include_dirs}")
+        print(f"python library {python_library}")
+        print(f"python prefix {python_prefix}")
 
         compile_type = "Debug"
         install_path = (
@@ -54,12 +60,13 @@ class CMakeBuild(build_ext):
             if "AIDGE_INSTALL" not in os.environ
             else os.environ["AIDGE_INSTALL"]
         )
-
         self.spawn(
             [
                 "cmake",
                 str(cwd),
-                "-DPYTHON_EXECUTABLE="+python_executable,
+                f"-DPYTHON_EXECUTABLE={python_executable}",
+                f"-DPYTHON_INCLUDE_DIR={python_include_dirs}",
+                f"-DPYTHON_LIBRARY={python_library}",
                 "-DTEST=OFF",
                 f"-DCMAKE_INSTALL_PREFIX:PATH={install_path}",
                 f"-DCMAKE_BUILD_TYPE={compile_type}",
-- 
GitLab