Skip to content

Commit

Permalink
Merge pull request #5 from Justin62628/master
Browse files Browse the repository at this point in the history
Update setup.py and CMakeLists.txt to fix mis-reference of different python dlls
  • Loading branch information
ArchieMeng authored Mar 8, 2022
2 parents 5f057f9 + 3a33e0d commit 367a381
Showing 2 changed files with 17 additions and 7 deletions.
14 changes: 11 additions & 3 deletions rife_ncnn_vulkan_python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
10 changes: 6 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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},

0 comments on commit 367a381

Please sign in to comment.