From 717b6f64e35d70d38344aa63a14d9c7ddb95028a Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Fri, 6 Oct 2023 10:02:39 +0300 Subject: [PATCH] hack --- .github/workflows/wheels.yml | 34 ++++++++++++++++++++++++++++++++++ py/pykms/meson.build | 20 ++++++++------------ pyproject.toml | 19 +++++++++++++++++++ 3 files changed, 61 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/wheels.yml create mode 100644 pyproject.toml diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml new file mode 100644 index 00000000..8184fa2a --- /dev/null +++ b/.github/workflows/wheels.yml @@ -0,0 +1,34 @@ +name: Build + +on: [push, pull_request] + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04] + # os: [ubuntu-20.04, windows-2019, macOS-11] + + steps: + - uses: actions/checkout@v4 + + # Used to host cibuildwheel + - uses: actions/setup-python@v3 + + - name: install deps + run: sudo apt install -y meson ninja-build libdrm-dev libevdev-dev libfmt-dev + + - name: Install cibuildwheel + run: python -m pip install cibuildwheel==2.16.2 + + - name: Build wheels + run: python -m cibuildwheel --output-dir wheelhouse + # to supply options, put them in 'env', like: + # env: + # CIBW_SOME_OPTION: value + + - uses: actions/upload-artifact@v3 + with: + path: ./wheelhouse/*.whl diff --git a/py/pykms/meson.build b/py/pykms/meson.build index 866be427..b841be13 100644 --- a/py/pykms/meson.build +++ b/py/pykms/meson.build @@ -1,12 +1,13 @@ -py3_dep = dependency('python3', required : get_option('pykms')) +py = import('python').find_installation('python3') + +py3_dep = py.dependency() if py3_dep.found() == false pybindings_enabled = false subdir_done() endif -pybind11_dep = dependency('pybind11', fallback : ['pybind11', 'pybind11_dep'], - required : get_option('pykms')) +pybind11_dep = dependency('pybind11', required : true) if pybind11_dep.found() == false pybindings_enabled = false @@ -44,16 +45,11 @@ endif pykms_args = [ '-fvisibility=hidden' ] -destdir = get_option('libdir') / 'python' + py3_dep.version() / 'site-packages/pykms' - -pykms = shared_module('pykms', +pykms = py.extension_module('pykms', pykms_sources, - install : true, - install_dir : destdir, - name_prefix : '', + install : false, + # install_dir : destdir, + # name_prefix : '', dependencies : pykms_deps, cpp_args : pykms_args) -# Copy __init__.py to build dir so that we can run without installing -configure_file(input: '__init__.py', output: '__init__.py', copy: true, - install : true, install_dir : destdir) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..6f0bcff2 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,19 @@ +[build-system] +build-backend = 'mesonpy' +requires = ['meson-python', 'pybind11'] + +[project] +name = 'pykms' +version = '0.0.0a1' +description = 'kms++ python bindings' +readme = 'README.md' +requires-python = '>=3.10' + +#[project.urls] +#Source = "https://github.com/will-v-pi/pykms" +#"kms++ Homepage" = "https://github.com/tomba/kmsxx" + +#[tool.meson-python.args] +#setup = [ +# '-Drevision=a4002d2' +#]