From a5d3f5bb92bec485d09cecc376f03336605cb5ae Mon Sep 17 00:00:00 2001 From: pantor Date: Mon, 8 Jan 2024 20:23:57 +0100 Subject: [PATCH] use scikit-build-core and pyproject.toml --- CMakeLists.txt | 2 +- pyproject.toml | 36 +++++++++++++++++++++-- setup.py | 77 -------------------------------------------------- 3 files changed, 35 insertions(+), 80 deletions(-) delete mode 100644 setup.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 38bca6bd..436ddb65 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.15) set(RUCKIG_VERSION 0.12.1) project(ruckig VERSION ${RUCKIG_VERSION} LANGUAGES CXX) diff --git a/pyproject.toml b/pyproject.toml index c55b1590..1e1aa292 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,38 @@ +[project] +name = "ruckig" +version = "0.12.1" +authors = [ + {name = "Lars Berscheid", email = "lars.berscheid@ruckig.com"}, +] +readme = "README.md" +description = "Instantaneous Motion Generation for Robots and Machines." +keywords = ["robotics", "trajectory-generation", "real-time", "jerk-constrained", "time-optimal"] +license = {text = "MIT License"} +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering", + "License :: OSI Approved :: MIT License", + "Programming Language :: C++", +] +requires-python = ">=3.7" + +[project.urls] +Homepage = "https://ruckig.com" +Documentation = "https://docs.ruckig.com" +Repository = "https://github.com/pantor/ruckig.git" +Issues = "https://github.com/pantor/ruckig/issues" + + [build-system] -requires = ["setuptools>=42", "wheel", "pybind11~=2.6.1", "ninja", "cmake>=3.10"] -build-backend = "setuptools.build_meta" +requires = ["scikit-build-core", "pybind11"] +build-backend = "scikit_build_core.build" + +[tool.scikit-build.cmake.define] +BUILD_EXAMPLES = "OFF" +BUILD_PYTHON_MODULE = "ON" +BUILD_TESTS = "OFF" + [tool.ruff] select = ["A", "COM", "E", "F", "G", "N", "PIE", "PTH", "PYI", "RSE", "RET", "SIM", "TCH", "W", "Q", "E201", "E202", "E203"] diff --git a/setup.py b/setup.py deleted file mode 100644 index 79be315d..00000000 --- a/setup.py +++ /dev/null @@ -1,77 +0,0 @@ -import os -import subprocess -import sys - -from setuptools import setup, Extension, find_packages -from setuptools.command.build_ext import build_ext - - -with open('README.md', 'r') as readme_file: - long_description = readme_file.read() - - -class CMakeExtension(Extension): - def __init__(self, name, sourcedir=''): - Extension.__init__(self, name, sources=[]) - self.sourcedir = os.path.abspath(sourcedir) - - -class CMakeBuild(build_ext): - def run(self): - for ext in self.extensions: - self.build_extension(ext) - - def build_extension(self, ext): - extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name))) - - # required for auto-detection of auxiliary "native" libs - if not extdir.endswith(os.path.sep): - extdir += os.path.sep - - build_type = os.environ.get('BUILD_TYPE', 'Release') - cmake_args = [ - '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir, - '-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=' + extdir, - '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=' + extdir, - '-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE=' + extdir, - '-DPYTHON_EXECUTABLE={}'.format(sys.executable), - '-DEXAMPLE_VERSION_INFO={}'.format(self.distribution.get_version()), - '-DCMAKE_BUILD_TYPE=' + build_type, - '-DBUILD_PYTHON_MODULE=ON', - '-DBUILD_EXAMPLES=OFF', - '-DBUILD_TESTS=OFF', - '-DBUILD_SHARED_LIBS=OFF', - '-DCMAKE_POSITION_INDEPENDENT_CODE=ON', - ] - - if not os.path.exists(self.build_temp): - os.makedirs(self.build_temp) - - subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp) - subprocess.check_call(['cmake', '--build', '.', '--config', build_type, '-j2'], cwd=self.build_temp) - - -setup( - name='ruckig', - version='0.12.1', - description='Instantaneous Motion Generation for Robots and Machines.', - long_description=long_description, - long_description_content_type='text/markdown', - author='Lars Berscheid', - author_email='lars.berscheid@ruckig.com', - url='https://www.ruckig.com', - packages=find_packages(), - license='MIT', - ext_modules=[CMakeExtension('python_ruckig')], - cmdclass=dict(build_ext=CMakeBuild), - keywords=['robotics', 'trajectory-generation', 'real-time', 'jerk-constrained', 'time-optimal'], - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Science/Research', - 'Topic :: Scientific/Engineering', - 'License :: OSI Approved :: MIT License', - 'Programming Language :: C++', - ], - python_requires='>=3.7', - zip_safe=False, -)