From 41c0258b850b29175dd2f388421b435c09dbf43c Mon Sep 17 00:00:00 2001
From: cmoineau <cyril.moineau@cea.fr>
Date: Tue, 3 Oct 2023 13:22:07 +0000
Subject: [PATCH] [setup.py] Update setup.py to install Cmake lib in python env
 by default.

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

diff --git a/README.md b/README.md
index 30b3424..3b32f4d 100644
--- a/README.md
+++ b/README.md
@@ -6,9 +6,11 @@ You can find in this folder the library that implements the CUDA operators.
 
 ## Pip installation
 
-You will need to install first the aidge_core library before installing aidge_backend_cuda.
-Also, make sure that the install path was set before installing aidge_core library.
-Then run in your python environnement : 
+You will need to install first the ``aidge_core`` library before installing ``aidge_backend_cuda``.
+
+If you have set a custom install path for the ``aidge_core`` library, make sure to use the same one here.
+
+Then run in your python environnement :
 ``` bash
 pip install . -v
 ```
diff --git a/setup.py b/setup.py
index 0b0f66e..16305af 100644
--- a/setup.py
+++ b/setup.py
@@ -62,11 +62,11 @@ class CMakeBuild(build_ext):
 
         os.chdir(str(build_temp))
 
-        # Impose to use the executable of the python 
+        # Impose to use the executable of the python
         # used to launch setup.py to setup PythonInterp
         param_py = "-DPYTHON_EXECUTABLE=" + sys.executable
-        
-        install_path = f"{build_temp}/install" if "AIDGE_INSTALL" not in os.environ else os.environ["AIDGE_INSTALL"]
+
+        install_path = os.path.join(sys.prefix, "lib", "libAidge")  if "AIDGE_INSTALL" not in os.environ else os.environ["AIDGE_INSTALL"]
 
         self.spawn(['cmake', str(cwd), param_py, '-DTEST=OFF', f'-DCMAKE_INSTALL_PREFIX:PATH={install_path}'])
         if not self.dry_run:
@@ -83,11 +83,11 @@ class CMakeBuild(build_ext):
             for file in files:
                 if file.endswith('.so') and (root != str(aidge_package.absolute())):
                     currentFile=os.path.join(root, file)
-                    shutil.copy(currentFile, str(aidge_package.absolute())) 
+                    shutil.copy(currentFile, str(aidge_package.absolute()))
 
         # Copy version.txt in aidge_package
         os.chdir(os.path.dirname(__file__))
-        shutil.copy("version.txt", str(aidge_package.absolute()))    
+        shutil.copy("version.txt", str(aidge_package.absolute()))
 
 
 if __name__ == '__main__':
-- 
GitLab