-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up scikit-build-core for the fortran extension module
- Loading branch information
Showing
2 changed files
with
77 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
cmake_minimum_required(VERSION 3.17.2...3.26) | ||
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 _auroramodule.c example-f2pywrappers.f | ||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/aurora/main.f90" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/aurora/impden.f90" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/aurora/math.f90" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/aurora/grids.f90" | ||
VERBATIM | ||
COMMAND "${Python_EXECUTABLE}" -m numpy.f2py | ||
"${CMAKE_CURRENT_SOURCE_DIR}/aurora/main.f90" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/aurora/impden.f90" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/aurora/math.f90" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/aurora/grids.f90" | ||
-m _aurora --lower) | ||
|
||
python_add_library(_aurora MODULE "${CMAKE_CURRENT_BINARY_DIR}/_auroramodule.c" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/aurora/main.f90" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/aurora/impden.f90" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/aurora/math.f90" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/aurora/grids.f90" | ||
WITH_SOABI) | ||
target_link_libraries(_aurora PRIVATE fortranobject) | ||
|
||
install(TARGETS _aurora DESTINATION aurora/) |
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,34 @@ | ||
[project] | ||
name = "aurorafusion" | ||
dynamic = ["version"] | ||
description = "Aurora package for particle transport, radiation and neutrals in magnetically-confined plasmas" | ||
authors = [ | ||
{ name = "F. Sciortino", email = "[email protected]" }, | ||
] | ||
urls = { "Homepage" = "https://github.com/fsciortino/Aurora" } | ||
keywords = ["particle and impurity transport, neutrals, radiation, magnetic confinement fusion"] | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
] | ||
dependencies = [ | ||
"matplotlib", | ||
"numpy", | ||
"omfit_classes", | ||
"pandas", | ||
"pexpect", | ||
"requests", | ||
"scipy", | ||
] | ||
|
||
[build-system] | ||
requires = ["scikit-build-core", "numpy"] | ||
build-backend = "scikit_build_core.build" | ||
|
||
[tool.scikit-build] | ||
ninja.minimum-version = "1.10" | ||
cmake.minimum-version = "3.17.2" | ||
wheel.packages = ["aurora"] | ||
|
||
[tool.scikit-build.metadata.version] | ||
provider = "scikit_build_core.metadata.regex" | ||
input = "aurora/__init__.py" |