Skip to content

Commit

Permalink
Jump all the way to scikit-build-core
Browse files Browse the repository at this point in the history
  • Loading branch information
ianhbell committed May 6, 2024
1 parent cd48488 commit ef5f9e8
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 31 deletions.
21 changes: 11 additions & 10 deletions cpp/CMakeLists.txt → CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ project(KineticGas LANGUAGES C CXX)

SET(CMAKE_CXX_STANDARD 17)

cmake_minimum_required(VERSION 3.12)
set(PYBIND11_PYTHON_VERSION "3")
string(ASCII 27 Esc)
message("${Esc}[34mPYBIND11_PYTHON_VERSION is : ${PYBIND11_PYTHON_VERSION}")
message("${Esc}[34mPYTHON_EXECUTABLE is : ${PYTHON_EXECUTABLE}")

if(NOT MSVC)
# set(CMAKE_CXX_COMPILER /usr/bin/g++) # Setting these can, on some systems, cause cmake to go into an infinite loop (see: build.sh to set the compiler)
# set(CMAKE_C_COMPILER /usr/bin/gcc) # Setting these can, on some systems, cause cmake to go into an infinite loop (see: build.sh to set the compiler)
Expand All @@ -22,8 +16,8 @@ if(NOT MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -DDEBUG -Wno-unused-parameter -Wno-unused-const-variable")
endif(NOT MSVC)

set(SOURCES KineticGas.cpp KineticGas_mthr.cpp Spherical.cpp MieKinGas.cpp
Integration/Integration.cpp Factorial.cpp bindings.cpp)
set(SOURCES cpp/KineticGas.cpp cpp/KineticGas_mthr.cpp cpp/Spherical.cpp cpp/MieKinGas.cpp
cpp/Integration/Integration.cpp cpp/Factorial.cpp cpp/bindings.cpp)

if (CMAKE_BUILD_TYPE MATCHES Release)
project(KineticGas_r)
Expand All @@ -33,5 +27,12 @@ else()
set(TARGET KineticGas_d)
endif()

add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../externals/pybind11" "pybind11")
pybind11_add_module(${TARGET} ${SOURCES})
# Find the module development requirements (requires FindPython from 3.17 or
# scikit-build-core's built-in backport)
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
find_package(pybind11 CONFIG REQUIRED)

# Add a library using FindPython's tooling (pybind11 also provides a helper like
# this)
python_add_library(${TARGET} MODULE ${SOURCES} WITH_SOABI)
target_link_libraries(${TARGET} PRIVATE pybind11::headers)
39 changes: 39 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[build-system]
requires = ["scikit-build-core>=0.3.3", "pybind11"]
build-backend = "scikit_build_core.build"


[project]
name = "pykingas"
version = "2.0.0"
description="Revised Enskog theory for Mie fluids, and other spherical potentials. Allows prediction of transport coefficients such as diffusion coefficients, viscosities, thermal diffusion coefficients and thermal conductivities. In dense, multicomponent gas mixtures and supercritical mixtures."
readme = "README.md"
authors = [
{ name = "Vegard Gjeldvik Jervell", email = "vegard.g.j@icloud.com" },
]
requires-python = ">=3.7"
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]

[project.optional-dependencies]
test = ["pytest"]


[tool.scikit-build]
wheel.expand-macos-universal-tags = true


[tool.cibuildwheel]
test-command = "pytest {project}/tests"
test-extras = ["test"]
test-skip = ["*universal2:arm64"]
build-verbosity = 1
42 changes: 21 additions & 21 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
from setuptools import setup
from pathlib import Path
# from setuptools import setup
# from pathlib import Path

this_dir = Path(__file__).parent
readme = (this_dir / 'pykingas/README.md').read_text()
setup(
name='pykingas',
version='2.0.0',
packages=['pykingas'],
package_data={'pykingas': ['KineticGas*', 'fluids/*']},
description='Revised Enskog theory for Mie fluids, and other spherical potentials. Allows prediction of transport '
'coefficients such as diffusion coefficients, viscosities, thermal diffusion coefficients'
' and thermal conductivities. In dense, multicomponent gas mixtures and supercritical mixtures.',
long_description=readme,
long_description_content_type='text/markdown',
author='Vegard Gjeldvik Jervell',
author_email='vegard.g.j@icloud.com',
url='https://github.com/thermotools/KineticGas',
install_requires=["numpy~=1.22",
"scipy~=1.7",
"thermopack~=2.1"]
)
# this_dir = Path(__file__).parent
# readme = (this_dir / 'pykingas/README.md').read_text()
# setup(
# name='pykingas',
# version='2.0.0',
# packages=['pykingas'],
# package_data={'pykingas': ['KineticGas*', 'fluids/*']},
# description='Revised Enskog theory for Mie fluids, and other spherical potentials. Allows prediction of transport '
# 'coefficients such as diffusion coefficients, viscosities, thermal diffusion coefficients'
# ' and thermal conductivities. In dense, multicomponent gas mixtures and supercritical mixtures.',
# long_description=readme,
# long_description_content_type='text/markdown',
# author='Vegard Gjeldvik Jervell',
# author_email='vegard.g.j@icloud.com',
# url='https://github.com/thermotools/KineticGas',
# install_requires=["numpy~=1.22",
# "scipy~=1.7",
# "thermopack~=2.1"]
# )

0 comments on commit ef5f9e8

Please sign in to comment.