From 0841e7002e97b9532a21131b9d13d22243e25c8e Mon Sep 17 00:00:00 2001
From: cmoineau <cyril.moineau@cea.fr>
Date: Tue, 6 Feb 2024 15:21:53 +0000
Subject: [PATCH] Remove dependency to backend_cpu.

---
 CMakeLists.txt | 13 ++++++++++---
 setup.py       | 10 +++++-----
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f933e00..e315098 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,8 +36,9 @@ enable_language(CUDA)
 find_package(CUDAToolkit REQUIRED)
 
 find_package(aidge_core REQUIRED)
-find_package(aidge_backend_cpu REQUIRED)
-
+if(TEST)
+    find_package(aidge_backend_cpu REQUIRED)
+endif()
 ##############################################
 # Create target and set properties
 
@@ -48,11 +49,17 @@ add_library(${module_name} ${src_files} ${inc_files})
 target_link_libraries(${module_name}
     PUBLIC
         _aidge_core # _ is added because we link the target not the project
-        _aidge_backend_cpu # _ is added because we link the target not the project
         CUDA::cudart
         cudnn
 )
 
+if(TEST)
+    target_link_libraries(${module_name}
+    PUBLIC
+        _aidge_backend_cpu # _ is added because we link the target not the project
+    )
+endif()
+
 #Set target properties
 target_include_directories(${module_name}
     PUBLIC
diff --git a/setup.py b/setup.py
index dbf82e2..80500f3 100644
--- a/setup.py
+++ b/setup.py
@@ -62,10 +62,10 @@ 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
-        
+
         compile_type = 'Debug'
         install_path = os.path.join(sys.prefix, "lib", "libAidge")  if "AIDGE_INSTALL" not in os.environ else os.environ["AIDGE_INSTALL"]
 
@@ -85,11 +85,11 @@ class CMakeBuild(build_ext):
             for file in files:
                 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__))
-        shutil.copy("version.txt", str(aidge_package.absolute()))    
+        shutil.copy("version.txt", str(aidge_package.absolute()))
 
 
 if __name__ == '__main__':
@@ -108,7 +108,7 @@ if __name__ == '__main__':
         cmdclass={
             'build_ext': CMakeBuild,
         },
-        install_requires=['aidge_core', 'aidge_backend_cpu'],
+        install_requires=['aidge_core'],
         zip_safe=False,
 
     )
-- 
GitLab