From f967cbebb957069a011bf1b6dcf7cd6179ff8c8f Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Fri, 11 Oct 2024 09:46:08 -0700 Subject: [PATCH] `PYBIND11_FINDPYTHON=ON` Reuse our `find_package(Python ...)` call and use new CMake logic in pybind11. https://pybind11.readthedocs.io/en/stable/compiling.html#modules-with-cmake Signed-off-by: Axel Huebl --- cmake/dependencies/pybind11.cmake | 5 +++++ setup.py | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/dependencies/pybind11.cmake b/cmake/dependencies/pybind11.cmake index cd5ee7463..3a6c01e99 100644 --- a/cmake/dependencies/pybind11.cmake +++ b/cmake/dependencies/pybind11.cmake @@ -10,6 +10,11 @@ function(find_pybind11) message(STATUS "pybind11 repository: ${ImpactX_pybind11_repo} (${ImpactX_pybind11_branch})") include(FetchContent) endif() + + # rely on our find_package(Python ...) call + # https://pybind11.readthedocs.io/en/stable/compiling.html#modules-with-cmake + set(PYBIND11_FINDPYTHON ON) + if(ImpactX_pybind11_internal OR ImpactX_pybind11_src) set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) diff --git a/setup.py b/setup.py index 480089744..cf59a32dc 100644 --- a/setup.py +++ b/setup.py @@ -78,7 +78,6 @@ def build_extension(self, ext): "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=" + os.path.join(extdir, "impactx"), "-DCMAKE_VERBOSE_MAKEFILE=ON", "-DCMAKE_PYTHON_OUTPUT_DIRECTORY=" + extdir, - "-DPython_EXECUTABLE=" + sys.executable, ## variants "-DImpactX_COMPUTE=" + ImpactX_COMPUTE, "-DImpactX_FFT:BOOL=" + ImpactX_FFT,