Skip to content

Commit e32d990

Browse files
committed
Update workflows and configuration for improved dependency management and versioning
1 parent f2d30b3 commit e32d990

4 files changed

Lines changed: 36 additions & 5 deletions

File tree

.github/workflows/build-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
if: runner.os == 'macOS'
3333
run: |
3434
brew update
35-
brew install fftw cmake ninja pkg-config libomp boost || true
35+
brew install fftw cmake ninja libomp boost || true
3636
3737
- name: Build wheel (scikit-build-core)
3838
run: |

.github/workflows/release.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
contents: read
1515
steps:
1616
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
1719

1820
- uses: actions/setup-python@v5
1921
with:
@@ -37,6 +39,8 @@ jobs:
3739
contents: read
3840
steps:
3941
- uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 0
4044

4145
- name: Build wheels with cibuildwheel
4246
uses: pypa/cibuildwheel@v2.21.3
@@ -107,11 +111,13 @@ jobs:
107111
contents: read
108112
steps:
109113
- uses: actions/checkout@v4
114+
with:
115+
fetch-depth: 0
110116

111117
- name: Install Homebrew deps
112118
run: |
113119
brew update
114-
brew install fftw libomp boost cmake ninja pkg-config || true
120+
brew install fftw libomp boost cmake ninja || true
115121
116122
- name: Build wheels with cibuildwheel
117123
uses: pypa/cibuildwheel@v2.21.3

CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
cmake_minimum_required(VERSION 3.21)
2-
project(cpp_hf VERSION 0.1.0 LANGUAGES CXX)
2+
3+
# Prefer the project version provided by scikit-build-core when building wheels.
4+
# This lets you set the version in one place (pyproject.toml), and CMake picks it up
5+
# via the SKBUILD_PROJECT_VERSION cache variable. Fallback used for direct CMake builds.
6+
if (DEFINED SKBUILD_PROJECT_VERSION AND NOT "${SKBUILD_PROJECT_VERSION}" STREQUAL "")
7+
set(CPP_HF_VERSION "${SKBUILD_PROJECT_VERSION}")
8+
else()
9+
# Fallback for plain CMake builds without scikit-build-core
10+
set(CPP_HF_VERSION "0.0")
11+
endif()
12+
13+
project(cpp_hf VERSION ${CPP_HF_VERSION} LANGUAGES CXX)
314

415
# Prefer CONFIG packages for Boost on newer CMake
516
if (POLICY CMP0167)

pyproject.toml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
[build-system]
2-
requires = ["scikit-build-core>=0.9", "pybind11>=2.11", "numpy"]
2+
requires = [
3+
"scikit-build-core>=0.9",
4+
"pybind11>=2.11",
5+
"numpy",
6+
"setuptools_scm>=7",
7+
]
38
build-backend = "scikit_build_core.build"
49

510
[project]
611
name = "cpp_hf"
7-
version = "0.1.0"
12+
dynamic = ["version"]
813
description = "Hartree–Fock (k-grid) with FFTW + Eigen via pybind11"
914
readme = "Readme.md"
1015
requires-python = ">=3.8"
@@ -35,3 +40,12 @@ minimum-version = "3.21"
3540

3641
# You can pass -C cmake.define.X=... flags via pip to toggle features:
3742
# pip install . -C cmake.define.HF_USE_OPENMP=ON -C cmake.define.HF_USE_FFTW_THREADS=ON
43+
44+
[tool.scikit-build.metadata.version]
45+
provider = "scikit_build_core.setuptools_scm"
46+
47+
[tool.setuptools_scm]
48+
# Strip leading 'v' from tags like v1.2.3 automatically
49+
version_scheme = "guess-next-dev"
50+
local_scheme = "node-and-date"
51+
fallback_version = "0.0"

0 commit comments

Comments
 (0)