From 0d791d9e4e3a1a1114979fb905d33d0e8def260e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Kubler?= <gregoire.kubler@proton.me>
Date: Mon, 13 May 2024 14:59:54 +0200
Subject: [PATCH] fix : python::python not needed (told you so)

---
 cmake/PybindModuleCreation.cmake |  5 ++---
 setup.py                         | 12 +-----------
 2 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/cmake/PybindModuleCreation.cmake b/cmake/PybindModuleCreation.cmake
index ab983830a..32f67e0d9 100644
--- a/cmake/PybindModuleCreation.cmake
+++ b/cmake/PybindModuleCreation.cmake
@@ -4,7 +4,7 @@ macro(generate_python_binding )
 
     # Use the New FindPython mode, recommanded. Requires CMake 3.15+
     find_package(Python 3.7.0
-                    COMPONENTS Interpreter Development.Module
+                    COMPONENTS Interpreter Development.Module 
                     REQUIRED)
     set(PYBIND11_FINDPYTHON ON)
     set(PYBIND_VERSION v2.10.4)
@@ -21,11 +21,10 @@ macro(generate_python_binding )
 
     pybind11_add_module(${project} MODULE ${pybind_src_files} "NO_EXTRAS") # NO EXTRA required for pip install
     target_include_directories(${project} PUBLIC "python_binding" ${pybind11_INCLUDE_DIRECTORIES})
-
     # Handles Python + pybind11 headers dependencies
     target_link_libraries(${module_name}
         PRIVATE
-            Python::Module
+            Python::Module 
         PUBLIC
             pybind11::pybind11
         )
diff --git a/setup.py b/setup.py
index 0be3bb8f8..11f07e689 100644
--- a/setup.py
+++ b/setup.py
@@ -46,15 +46,7 @@ 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\texecutable\t{python_executable}")                                                                                                                                                   
-        print(f"\t\t\tinclude\tdirs {python_include_dirs}")                                                                                                                                               
-        print(f"-DPYTHON_INCLUDE_DIRS={sysconfig.get_config_var('INCLUDEPY')}") # this might need to be the subdir
-        print(f"\t\t\tlibrary\t{python_library}")                                                                                                                                                         
-        print(f"-DPYTHON_LIBRARIES={sysconfig.get_config_var('LIBDEST')}")
-        print(f"\t\t\tprefix\t{python_prefix}")
+        print(f"python executable :\t{python_executable}")                                                                                                                                                   
         compile_type = "Debug"
         install_path = (
             os.path.join(sys.prefix, "lib", "libAidge")
@@ -66,8 +58,6 @@ class CMakeBuild(build_ext):
                 "cmake",
                 str(cwd),
                 f"-DPYTHON_EXECUTABLE={sys.executable}",
-                f"-DPYTHON_INCLUDE_DIRS={sysconfig.get_config_var('INCLUDEPY')}",
-                f"-DPYTHON_LIBRARIES={sysconfig.get_config_var('LIBDEST')}",
                 "-DTEST=OFF",
                 f"-DCMAKE_INSTALL_PREFIX:PATH={install_path}",
                 f"-DCMAKE_BUILD_TYPE={compile_type}",
-- 
GitLab