diff --git a/rife_ncnn_vulkan_python/CMakeLists.txt b/rife_ncnn_vulkan_python/CMakeLists.txt index 91451f9..7917d30 100644 --- a/rife_ncnn_vulkan_python/CMakeLists.txt +++ b/rife_ncnn_vulkan_python/CMakeLists.txt @@ -16,10 +16,18 @@ find_package(OpenMP) find_package(Vulkan REQUIRED) # Python -if(${CMAKE_VERSION} VERSION_LESS "3.15") - find_package(Python REQUIRED) +if (DEFINED PY_VERSION) + if (${CMAKE_VERSION} VERSION_LESS "3.15") + find_package(Python ${PY_VERSION} EXACT REQUIRED) + else() + find_package(Python ${PY_VERSION} EXACT REQUIRED COMPONENTS Development) + endif() else() - find_package(Python REQUIRED COMPONENTS Development) + if (${CMAKE_VERSION} VERSION_LESS "3.15") + find_package(Python REQUIRED) + else() + find_package(Python REQUIRED COMPONENTS Development) + endif() endif() # SWIG diff --git a/setup.py b/setup.py index e509ccc..725bce6 100644 --- a/setup.py +++ b/setup.py @@ -80,6 +80,11 @@ def download_models() -> None: # remove the temporary files/dirs rife_ncnn_vulkan_zip.unlink() +cmake_flags = [ + "-DBUILD_SHARED_LIBS:BOOL=OFF", + "-DCALL_FROM_SETUP_PY:BOOL=ON", +] +cmake_flags.extend(os.environ.get("CMAKE_FLAGS", "").split()) # when building bdist wheels/installing the package if sys.argv[1] == "bdist_wheel": @@ -97,10 +102,7 @@ def download_models() -> None: install_prefix="rife_ncnn_vulkan_python", write_top_level_init="from .rife_ncnn_vulkan import Rife, RIFE, wrapped", source_dir=str(pathlib.Path(__file__).parent / "rife_ncnn_vulkan_python"), - cmake_configure_options=[ - "-DBUILD_SHARED_LIBS:BOOL=OFF", - "-DCALL_FROM_SETUP_PY:BOOL=ON", - ], + cmake_configure_options=cmake_flags, ) ], cmdclass={"build_ext": cmake_build_extension.BuildExtension},