Skip to content

Commit

Permalink
Merge pull request #647 from basnijholt/python-include-dir
Browse files Browse the repository at this point in the history
Set `PYTHON_INCLUDE_DIR` in `setup.py` and pass it to CMake
  • Loading branch information
NoureldinYosri authored Jan 26, 2024
2 parents a9f3968 + e0a98db commit 3bdec77
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import shutil
import platform
import subprocess
import sysconfig

from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
Expand Down Expand Up @@ -39,10 +40,12 @@ def run(self):

def build_extension(self, ext):
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
python_include_dir = sysconfig.get_path("include")
cmake_args = [
"-DCMAKE_CUDA_COMPILER=nvcc",
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=" + extdir,
"-DPYTHON_EXECUTABLE=" + sys.executable,
"-DPYTHON_INCLUDE_DIR=" + python_include_dir,
]

cfg = "Debug" if self.debug else "Release"
Expand Down

0 comments on commit 3bdec77

Please sign in to comment.