From 7fd397f8d98ae503f66b79234583290df1621e7c Mon Sep 17 00:00:00 2001 From: Thomas-Otavio Peulen Date: Thu, 14 Nov 2024 21:24:25 +0100 Subject: [PATCH] Simplify build Set Python_ROOT_DIR to find python. Should not require exact python version anymore. --- conda-recipe/bld.bat | 7 ------- conda-recipe/build.sh | 1 - ext/CMakeLists.txt | 2 +- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/conda-recipe/bld.bat b/conda-recipe/bld.bat index 24e71ee1..b8b75124 100755 --- a/conda-recipe/bld.bat +++ b/conda-recipe/bld.bat @@ -10,12 +10,6 @@ rmdir b2 /s /q mkdir b2 cd b2 -REM Call Python with the --version flag to get the version information -for /f "tokens=2 delims= " %%v in ('%PYTHON% --version 2^>^&1') do set PYTHON_VERSION=%%v - -REM Extract only the numeric part of the version -for /f "tokens=1-3 delims=." %%a in ("%PYTHON_VERSION%") do set PYTHON_VERSION_NUMERIC=%%a.%%b.%%c - echo Python version: %PYTHON_VERSION_NUMERIC% cmake .. -G "NMake Makefiles" ^ -DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^ @@ -25,7 +19,6 @@ cmake .. -G "NMake Makefiles" ^ -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="%SP_DIR%" ^ -DCMAKE_SWIG_OUTDIR="%SP_DIR%" ^ -DPython_ROOT_DIR="%PREFIX%\bin" ^ - -DPYTHON_VERSION="%PYTHON_VERSION_NUMERIC%" ^ -DBUILD_LIBRARY=OFF ^ -DWITH_AVX=OFF ^ -DBoost_USE_STATIC_LIBS=OFF diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh index 5e76aff7..20ceea0d 100755 --- a/conda-recipe/build.sh +++ b/conda-recipe/build.sh @@ -14,7 +14,6 @@ cmake -S .. -B . \ -DWITH_AVX=OFF \ -DBoost_USE_STATIC_LIBS=OFF \ -DPython_ROOT_DIR="${PREFIX}/bin" \ - -DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())')\ -G Ninja \ ${CONFIG_ARGS} diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt index f588c563..982f41be 100644 --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -26,7 +26,7 @@ IF(BUILD_PYTHON_INTERFACE) MESSAGE(STATUS "Python version: '${PYTHON_VERSION}'") cmake_policy(SET CMP0094 NEW) - FIND_PACKAGE(Python ${PYTHON_VERSION} EXACT COMPONENTS Interpreter Development.Module NumPy) + FIND_PACKAGE(Python COMPONENTS Interpreter Development.Module NumPy) INCLUDE_DIRECTORIES(BEFORE ${Python_NumPy_PATH} ${Python_INCLUDE_DIRS}) LINK_LIBRARIES(${Python_LIBRARY} Python::NumPy)