From d91f94626a4d6f54ebd62c50392cc60b81e55fc5 Mon Sep 17 00:00:00 2001
From: thibault allenet <thibault.allenet@cea.fr>
Date: Thu, 7 Dec 2023 13:56:53 +0000
Subject: [PATCH] Fix setup.py

---
 setup.py | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/setup.py b/setup.py
index 0b0f66e..b6e2d45 100644
--- a/setup.py
+++ b/setup.py
@@ -62,15 +62,17 @@ 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"]
 
-        self.spawn(['cmake', str(cwd), param_py, '-DTEST=OFF', f'-DCMAKE_INSTALL_PREFIX:PATH={install_path}'])
+        compile_type = 'Debug'
+        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}', f'-DCMAKE_BUILD_TYPE={compile_type}'])
         if not self.dry_run:
-            self.spawn(['make', 'all', 'install', '-j', max_jobs])
+            self.spawn(['cmake', '--build', '.', '--config', compile_type, '-j', max_jobs])
+            self.spawn(['cmake', '--install', '.', '--config', compile_type])
         os.chdir(str(cwd))
 
         aidge_package = build_lib / (get_project_name())
@@ -81,9 +83,9 @@ class CMakeBuild(build_ext):
         # Copy all shared object files from build_temp/lib to aidge_package
         for root, _, files in os.walk(build_temp.absolute()):
             for file in files:
-                if file.endswith('.so') and (root != str(aidge_package.absolute())):
+                if (file.endswith('.so') or file.endswith('.pyd')) 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__))
@@ -100,13 +102,13 @@ if __name__ == '__main__':
         long_description_content_type="text/markdown",
         long_description="\n".join(DOCLINES[2:]),
         classifiers=[c for c in CLASSIFIERS.split('\n') if c],
-        platforms=["Linux"],
         packages=find_packages(where="."),
         include_package_data=True,
         ext_modules=[CMakeExtension(get_project_name())],
         cmdclass={
             'build_ext': CMakeBuild,
         },
+        install_requires=['aidge_core','aidge_backend_cpu'],
         zip_safe=False,
 
     )
-- 
GitLab