Skip to content

Commit e4dd9b1

Browse files
committed
simplifications, bump dependencies
1 parent d9b8fd7 commit e4dd9b1

File tree

3 files changed

+13
-26
lines changed

3 files changed

+13
-26
lines changed

CMakeLists.txt

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
project(nanobind_example)
21
cmake_minimum_required(VERSION 3.18...3.22)
32

3+
project(nanobind_example)
4+
45
if (NOT SKBUILD)
56
message(WARNING "\
67
This CMake file is meant to be executed using 'scikit-build'. Running
@@ -20,40 +21,26 @@ if (NOT SKBUILD)
2021
=====================================================================")
2122
endif()
2223

23-
# The following boilerplate code configures CMake so that it finds the right
24-
# Python version (in particular, when it is run as part of 'scikit-build' using
25-
# the GitHub Actions continuous integration server)
26-
if (SKBUILD)
27-
# Fix missing shared library name for cibuildwheel+windows+pypy3.9
28-
if (MSVC AND NOT PYTHON_LIBRARY AND (${PYTHON_VERSION_STRING} MATCHES "3.9."))
29-
get_filename_component(PYTHON_LIBRARY ${PYTHON_INCLUDE_DIR} DIRECTORY)
30-
set(PYTHON_LIBRARY "${PYTHON_LIBRARY}/libs/python39.lib")
31-
endif()
32-
33-
set(Python_VERSION "${PYTHON_VERSION_STRING}")
34-
set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}")
35-
set(Python_INCLUDE_DIR "${PYTHON_INCLUDE_DIR}")
36-
set(Python_LIBRARY "${PYTHON_LIBRARY}")
37-
elseif (MSVC)
38-
# MSVC needs a little extra help finding the Python library
39-
find_package(PythonInterp)
40-
find_package(Python)
24+
# Perform a release build by default
25+
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
26+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
27+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
4128
endif()
4229

4330
# Create CMake targets for all Python components needed by nanobind
44-
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.26)
31+
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.26 AND Python_INTERPRETER_ID STREQUAL "Python")
4532
find_package(Python 3.8 COMPONENTS Interpreter Development.Module Development.SABIModule REQUIRED)
4633
else()
4734
find_package(Python 3.8 COMPONENTS Interpreter Development.Module REQUIRED)
4835
endif()
4936

50-
# Run `nanobind.cmake_dir()` from Python to detect where nanobind is installed
37+
# Determine the nanobind CMake include path and register it
5138
execute_process(
52-
COMMAND "${Python_EXECUTABLE}" -c "import nanobind; print(nanobind.cmake_dir())"
39+
COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir
5340
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE NB_DIR)
5441
list(APPEND CMAKE_PREFIX_PATH "${NB_DIR}")
5542

56-
# Now, import nanobind through CMake's find_package mechanism
43+
# Import nanobind through CMake's find_package mechanism
5744
find_package(nanobind CONFIG REQUIRED)
5845

5946
# We are now ready to compile the actual extension module

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
requires = [
33
"setuptools>=42",
44
"wheel",
5-
"scikit-build==0.14.0",
5+
"scikit-build>=0.16.7",
66
"cmake>=3.18",
7-
"nanobind>=0.2.0",
7+
"nanobind>=1.1.0",
88
"ninja; platform_system!='Windows'"
99
]
1010

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import sys, re, os
1+
import sys
22

33
try:
44
from skbuild import setup

0 commit comments

Comments
 (0)