From d4450875684b59203ddc0873abf8ea4389d1c139 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Kubler?= <gregoire.kubler@proton.me>
Date: Tue, 21 May 2024 12:03:04 +0200
Subject: [PATCH] feat : added default compile type to release

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

diff --git a/setup.py b/setup.py
index 87656a5c..4cc14839 100644
--- a/setup.py
+++ b/setup.py
@@ -44,7 +44,17 @@ class CMakeBuild(build_ext):
 
         os.chdir(str(build_temp))
 
-        compile_type = "Debug"
+        # Impose to use the executable of the python                                                                                                                                                  
+        # used to launch setup.py to setup PythonInterp                                                                                                                                                   
+        python_executable = sys.executable                                                                                                                                                                
+        print(f"python executable :\t{python_executable}")                                                                                                                                                   
+
+        compile_type = (
+            "Release"
+            if "AIDGE_BUILD_TYPE" not in os.environ
+            else os.environ["AIDGE_BUILD_TYPE"]
+        )
+
         install_path = (
             os.path.join(sys.prefix, "lib", "libAidge")
             if "AIDGE_INSTALL" not in os.environ
@@ -54,13 +64,13 @@ class CMakeBuild(build_ext):
             [
                 "cmake",
                 str(cwd),
-                f"-DPYTHON_EXECUTABLE={sys.executable}",
+                f"-DPYTHON_EXECUTABLE={python_executable}",
                 "-DTEST=OFF",
                 f"-DCMAKE_INSTALL_PREFIX:PATH={install_path}",
                 f"-DCMAKE_BUILD_TYPE={compile_type}",
                 "-DPYBIND=ON",
                 "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
-                "-DCOVERAGE=OFF"
+                "-DCOVERAGE=OFF",
             ]
         )
         if not self.dry_run:
-- 
GitLab