use scikit_build_core as build system
This commit is contained in:
7 files changed
+75
-57
No files matched your search
+4
-6
@@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 4.0)
|
||||
|
||||
project(autoopt)
|
||||
project(slopefit)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
@@ -15,17 +15,15 @@ execute_process(
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE nanobind_ROOT)
|
||||
find_package(nanobind CONFIG REQUIRED)
|
||||
|
||||
file(GLOB_RECURSE SOURCES src/*.cpp)
|
||||
file(GLOB_RECURSE SOURCES lib/*.cpp)
|
||||
|
||||
add_library(autoopt STATIC ${SOURCES})
|
||||
target_include_directories(autoopt PUBLIC include)
|
||||
target_link_libraries(autoopt PUBLIC Eigen3::Eigen)
|
||||
|
||||
install(DIRECTORY include/autoopt DESTINATION include)
|
||||
|
||||
nanobind_add_module(slopefit NOMINSIZE pysrc/module.cpp)
|
||||
nanobind_add_module(slopefit NOMINSIZE src/module.cpp)
|
||||
target_link_libraries(slopefit PRIVATE autoopt)
|
||||
install(TARGETS slopefit DESTINATION lib/python3.13/site-packages)
|
||||
install(TARGETS slopefit DESTINATION slopefit)
|
||||
|
||||
# add tests if gtest is found
|
||||
find_library(GTestPackage gtest QUIET)
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
cmake,
|
||||
ninja,
|
||||
eigen,
|
||||
python3Packages,
|
||||
}:
|
||||
python3Packages.buildPythonPackage {
|
||||
pname = "slopefit";
|
||||
version = "0.1.0";
|
||||
pyproject = true;
|
||||
|
||||
buildInputs = [ eigen ];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
ninja
|
||||
python3Packages.scikit-build-core
|
||||
python3Packages.nanobind
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
cd ..
|
||||
pypaBuildPhase
|
||||
'';
|
||||
|
||||
src = ./.;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
description = "auto-opt-cpp";
|
||||
description = "slopefit";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
@@ -16,66 +16,24 @@
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
pkg =
|
||||
{
|
||||
stdenv,
|
||||
cmake,
|
||||
ninja,
|
||||
lib,
|
||||
eigen,
|
||||
gtest,
|
||||
python313,
|
||||
python313Packages,
|
||||
withTests ? false,
|
||||
}:
|
||||
let
|
||||
fs = lib.fileset;
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "autoopt-cpp";
|
||||
version = "0.1.0";
|
||||
|
||||
src = fs.toSource {
|
||||
root = ./.;
|
||||
fileset = fs.unions [
|
||||
./include
|
||||
./CMakeLists.txt
|
||||
./tests
|
||||
./src
|
||||
./pysrc
|
||||
];
|
||||
};
|
||||
|
||||
buildInputs = lib.optionals withTests [ gtest ];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
ninja
|
||||
eigen
|
||||
(python313.withPackages (
|
||||
ps: with ps; [
|
||||
nanobind
|
||||
matplotlib
|
||||
numpy
|
||||
]
|
||||
))
|
||||
];
|
||||
};
|
||||
pkg = import ./build.nix;
|
||||
in
|
||||
rec {
|
||||
packages = rec {
|
||||
autoopt-cpp = pkgs.callPackage pkg { };
|
||||
autoopt-cpp-with-tests = pkgs.callPackage pkg { withTests = true; };
|
||||
default = autoopt-cpp;
|
||||
slopefit = pkgs.callPackage pkg { };
|
||||
slopefit-with-tests = pkgs.callPackage pkg { };
|
||||
default = slopefit;
|
||||
};
|
||||
devShells = {
|
||||
default = pkgs.mkShell {
|
||||
inputsFrom = [
|
||||
packages.autoopt-cpp-with-tests
|
||||
packages.slopefit-with-tests
|
||||
];
|
||||
|
||||
buildInputs = [ pkgs.python3Packages.pip ];
|
||||
|
||||
shellHook = ''
|
||||
echo "Development shell for autoopt-cpp"
|
||||
echo "Development shell for slopefit"
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
File renamed without changes.
@@ -0,0 +1,34 @@
|
||||
[build-system]
|
||||
requires = ["scikit-build-core>=0.11", "nanobind"]
|
||||
build-backend = "scikit_build_core.build"
|
||||
|
||||
|
||||
[tool.scikit-build]
|
||||
# Protect the configuration against future changes in scikit-build-core
|
||||
minimum-version = "0.4"
|
||||
|
||||
# Setuptools-style build caching in a local directory
|
||||
build-dir = "build/{wheel_tag}"
|
||||
|
||||
# Build stable ABI wheels for CPython 3.12+
|
||||
wheel.py-api = "cp312"
|
||||
|
||||
[project]
|
||||
name = "slopefit"
|
||||
version = "0.1.0"
|
||||
authors = [
|
||||
{ name="Valentin Leon Stöcker", email="valentin@stoeckermail.de" },
|
||||
]
|
||||
description = "fit conic sections"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.9"
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 3",
|
||||
"Operating System :: OS Independent",
|
||||
]
|
||||
license = "MIT"
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://gitea.valentinstoecker.de/vls/slopfit"
|
||||
Issues = "https://gitea.valentinstoecker.de/vls/slopfit/issues"
|
||||
|
||||
File renamed without changes.
Reference in new issue
Block a user