Skip to content

Commit 39d4039

Browse files
committed
feat: add numpy get include in setup py
1 parent 1e9a603 commit 39d4039

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ Even if numpy is installed, CMake was not able to find correctly numpy header du
6767
cmake .. -DCMAKE_TOOLCHAIN_FILE=${VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake -DNUMPY_INCLUDE_DIR="${PYTHON_USER_DIR}/LocalCache/local-packages/Python39/site-packages/numpy/core/include/"
6868
```
6969

70+
Numpy header location can be found with the following command :
71+
72+
```bash
73+
python -c "import numpy as np; print(np.get_include())"
74+
```
7075

7176
## Build with `setup.py` and cmake
7277

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from setuptools import setup, Extension
1111
from setuptools.command.build_ext import build_ext
12+
import numpy as np
1213

1314
# Convert distutils Windows platform specifiers to CMake -A arguments
1415
PLAT_TO_CMAKE = {
@@ -50,7 +51,8 @@ def build_extension(self, ext):
5051
"-DPYTHON_EXECUTABLE={}".format(sys.executable),
5152
"-DEXAMPLE_VERSION_INFO={}".format(self.distribution.get_version()),
5253
"-DCMAKE_BUILD_TYPE={}".format(cfg), # not used on MSVC, but no harm
53-
"-DCMAKE_TOOLCHAIN_FILE={}/scripts/buildsystems/vcpkg.cmake".format(os.environ.get("VCPKG_DIR"))
54+
"-DCMAKE_TOOLCHAIN_FILE={}/scripts/buildsystems/vcpkg.cmake".format(os.environ.get("VCPKG_DIR")),
55+
"-DNUMPY_INCLUDE_DIR={}".format(np.get_include())
5456
]
5557
build_args = []
5658

0 commit comments

Comments
 (0)