-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace
numpy.distutils
with CMake
and scikit-build-core
build …
…backend (#87) + convert the build system from `numpy.distutils` to `CMake` and `scikit-build-core`, to support the fortran module compilation for python 3.12+. - add `CMakeLists.txt` file for the `solid.for` module - `pyproject.toml`: switch the build backend from `setuptools` to `scikit-build-core` - `setup.py`: switch the build setup from `numpy.distutils` to `skbuild` + .circleci/config.yml: update docker image from `ubuntu:bionic` to `cimg/base`, to avoid the spin up environment error: `Error response from daemon: Head "https://registry-1.docker.io/v2/library/ubuntu/manifests/bionic": received unexpected HTTP status: 503 Service Unavailable` + point.py: replace np.NaN with np.nan, as `np.NaN` was removed in the NumPy 2.0 release. + pyproject.toml: unpin setuptools/numpy versions, as they are not needed anymore + tests/requirements.txt: add meson, to support calling f2py for manual compilation + README: remove the export SETUPTOOLS_ENABLE_FEATURES commands, as it's not needed anymore. --------- Co-authored-by: Zhang Yunjun <[email protected]>
- Loading branch information
1 parent
4deebdf
commit a71073e
Showing
8 changed files
with
49 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,3 +131,6 @@ dmypy.json | |
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# Scikit-build temp directory | ||
/_skbuild/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Based on: | ||
# https://github.com/scikit-build/scikit-build-core/tree/main/docs/examples/getting_started/fortran | ||
|
||
cmake_minimum_required(VERSION 3.17.2...3.29) | ||
project(${SKBUILD_PROJECT_NAME} LANGUAGES C Fortran) | ||
|
||
find_package( | ||
Python | ||
COMPONENTS Interpreter Development.Module NumPy | ||
REQUIRED) | ||
|
||
# F2PY headers | ||
execute_process( | ||
COMMAND "${PYTHON_EXECUTABLE}" -c | ||
"import numpy.f2py; print(numpy.f2py.get_include())" | ||
OUTPUT_VARIABLE F2PY_INCLUDE_DIR | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
|
||
add_library(fortranobject OBJECT "${F2PY_INCLUDE_DIR}/fortranobject.c") | ||
target_link_libraries(fortranobject PUBLIC Python::NumPy) | ||
target_include_directories(fortranobject PUBLIC "${F2PY_INCLUDE_DIR}") | ||
set_property(TARGET fortranobject PROPERTY POSITION_INDEPENDENT_CODE ON) | ||
|
||
add_custom_command( | ||
OUTPUT solidmodule.c solid-f2pywrappers.f | ||
DEPENDS src/pysolid/solid.for | ||
VERBATIM | ||
COMMAND "${Python_EXECUTABLE}" -m numpy.f2py | ||
"${CMAKE_CURRENT_SOURCE_DIR}/src/pysolid/solid.for" -m solid --lower) | ||
|
||
python_add_library( | ||
solid MODULE "${CMAKE_CURRENT_BINARY_DIR}/solidmodule.c" | ||
"${CMAKE_CURRENT_BINARY_DIR}/solid-f2pywrappers.f" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/src/pysolid/solid.for" WITH_SOABI) | ||
target_link_libraries(solid PRIVATE fortranobject) | ||
|
||
install(TARGETS solid DESTINATION pysolid) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters