I have CUDA code which I want to build a dynamic library to Python using distutils. But it seems distutils doesn\'t recognize \".cu\" file even if the \"nvcc\" compiler is insta
As an alternative to distutils
/setuptools
, you could use scikit-build (along with CMakeLists.txt
, pyproject.toml
, and setup.cfg
/setup.py
):
from pathlib import Path
from skbuild import setup
from setuptools import find_packages
# https://github.com/scikit-build/scikit-build/issues/521#issuecomment-753035688
for i in (Path(__file__).resolve().parent / "_skbuild").rglob("CMakeCache.txt"):
i.write_text(re.sub("^//.*$\n^[^#].*pip-build-env.*$", "", i.read_text(), flags=re.M))
setup(cmake_args=[f"-DPython3_ROOT_DIR={sys.prefix}"],
packages=find_packages(exclude=["tests"]))