From c05d2e7c0b7442558fce2733999886f36a2b201a Mon Sep 17 00:00:00 2001 From: Justin62628 <37169106+Justin62628@users.noreply.github.com> Date: Tue, 8 Mar 2022 02:50:46 +0800 Subject: [PATCH 1/2] Update setup.py --- setup.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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}, From 3a33e0d1c028459570f58f1d8f520f6a4c569afc Mon Sep 17 00:00:00 2001 From: Justin62628 <37169106+Justin62628@users.noreply.github.com> Date: Tue, 8 Mar 2022 02:53:32 +0800 Subject: [PATCH 2/2] Update CMakeLists.txt --- rife_ncnn_vulkan_python/CMakeLists.txt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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