Skip to content

Commit e4b466c

Browse files
committed
Initialize project with scikit-build
1 parent eb4c765 commit e4b466c

File tree

6 files changed

+716
-0
lines changed

6 files changed

+716
-0
lines changed

CMakeLists.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
cmake_minimum_required(VERSION 3.15...3.19)
2+
3+
project(ngtpy VERSION "0.1.0")
4+
5+
if(SKBUILD)
6+
# Scikit-Build does not add your site-packages to the search path
7+
# automatically, so we need to add it _or_ the pybind11 specific directory
8+
# here.
9+
execute_process(
10+
COMMAND "${PYTHON_EXECUTABLE}" -c
11+
"import pybind11; print(pybind11.get_cmake_dir())"
12+
OUTPUT_VARIABLE _tmp_dir
13+
OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ECHO STDOUT)
14+
list(APPEND CMAKE_PREFIX_PATH "${_tmp_dir}")
15+
endif()
16+
17+
18+
add_subdirectory(extern/NGT EXCLUDE_FROM_ALL)
19+
20+
find_package(pybind11 CONFIG REQUIRED)
21+
pybind11_add_module(_ngtpy MODULE src/ngtpy/_ngtpy.cpp)
22+
23+
find_package(OpenMP REQUIRED)
24+
target_link_libraries(_ngtpy PUBLIC OpenMP::OpenMP_CXX)
25+
26+
target_link_libraries(_ngtpy PUBLIC ngtstatic)
27+
target_include_directories(_ngtpy PUBLIC extern/NGT/lib PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/extern/NGT/lib)
28+
29+
install(TARGETS _ngtpy DESTINATION .)

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include LICENSE README.md pyproject.toml setup.py CMakeLists.txt
2+
recursive-include src *
3+
recursive-include extern/NGT *

pyproject.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[build-system]
2+
requires = [
3+
"setuptools>=42",
4+
"wheel",
5+
"pybind11>=2.9.0",
6+
"cmake>=3.22",
7+
"scikit-build>=0.13",
8+
]
9+
10+
build-backend = "setuptools.build_meta"
11+
12+
[tool.isort]
13+
profile = "black"

setup.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import sys
2+
3+
try:
4+
from skbuild import setup
5+
except ImportError:
6+
print(
7+
"Please update pip, you need pip 10 or greater,\n"
8+
" or you need to install the PEP 518 requirements in pyproject.toml yourself",
9+
file=sys.stderr,
10+
)
11+
raise
12+
13+
from setuptools import find_packages
14+
15+
setup(
16+
name="ngtpy",
17+
version="0.1.0",
18+
description="ngt python",
19+
author="Yahoo! JAPAN research",
20+
packages=find_packages(where="src"),
21+
package_dir={"": "src"},
22+
cmake_install_dir="src/ngtpy",
23+
include_package_data=True,
24+
extras_require={"test": ["pytest"]},
25+
python_requires=">=3.7",
26+
install_requires=["numpy"],
27+
)

src/ngtpy/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from ._ngtpy import *

0 commit comments

Comments
 (0)