-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Limitation: The sdist (source distribution for PyPI) now contains the whole of mmCoreAndDevices and more (33 MiB). While technically functional, we should fix this before merging this change. Update mmCoreAndDevices to latest (which has meson.build for MMCore and MMDevice). Add Meson build file. Use meson-python so that `python -m build` just works via pyproject.toml. Move the single source of truth for the version number from _version.py (now generated) to meson.build. The Meson build has several advantages: - Build details of MMDevice and MMCore come from their own build files, rather than being duplicated here in setup.py - Editable installs truly work (even if C++ files are edited) (Caveat: beware of importing pymmcore from the source root) - Since we are using a true C++ build system, controlling build options is much easier and cleaner than it was with setuptools The main disadvantage is that MANIFEST.in can no longer be used to control what gets included in the sdist (meson-python uses `meson dist` to produce the sdist, which includes all version-controlled files). However, once we are ready to use MMDevice and MMCore from independent repositories, this will no longer be an issue (and ends up being simpler than the error-prone MANIFEST.in).
- Loading branch information
1 parent
d7150f9
commit 0ea5577
Showing
10 changed files
with
203 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,18 +14,6 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
jobs: | ||
# check that sdist contains all files and that extra files | ||
# are explicitly ignored in manifest or pyproject | ||
check-manifest: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
submodules: "recursive" | ||
- name: Check manifest | ||
run: pipx run check-manifest | ||
|
||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} ${{ matrix.macos_arch }} | ||
runs-on: ${{ matrix.os }} | ||
|
@@ -44,14 +32,12 @@ jobs: | |
with: | ||
submodules: "recursive" | ||
|
||
- uses: ilammy/msvc-dev-cmd@v1 | ||
|
||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
env: | ||
CIBW_ARCHS_MACOS: "${{ matrix.macos_arch }}" | ||
# Python on Linux is usually configured to add debug information, | ||
# which increases binary size by ~11-fold. Remove for the builds we | ||
# distribute. | ||
CIBW_ENVIRONMENT_LINUX: "LDFLAGS=-Wl,--strip-debug" | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
|
@@ -68,8 +54,7 @@ jobs: | |
|
||
- name: Build sdist | ||
run: | | ||
pip install -U pip build check-manifest | ||
check-manifest | ||
pip install -U pip build | ||
python -m build --sdist | ||
- uses: actions/upload-artifact@v3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# Copyright 2020-2024 Board of Regents of the University of Wisconsin System | ||
# | ||
# This library is free software; you can redistribute it and/or modify it under | ||
# the terms of the GNU Lesser General Public License, version 2.1, as published | ||
# by the Free Software Foundation. | ||
# | ||
# This library is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public License | ||
# along with this library; if not, write to the Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
# | ||
# Author: Mark A. Tsuchida | ||
|
||
project( | ||
'pymmcore', | ||
'cpp', | ||
version: '11.1.1.71.1.dev0', | ||
meson_version: '>=1.3.0', | ||
default_options: [ | ||
'cpp_std=c++14', | ||
'warning_level=3', | ||
], | ||
# Until MMDevice and MMCore are available individually, we need to use them | ||
# from the same git submodule, so this is a bit of a hack: | ||
subproject_dir: 'mmCoreAndDevices', | ||
) | ||
|
||
cxx = meson.get_compiler('cpp') | ||
if cxx.get_id() in ['gcc', 'clang'] | ||
add_project_arguments('-Wno-deprecated', language: 'cpp') # throw() | ||
# Disable warnings triggered by SWIG-generated code: | ||
add_project_arguments('-Wno-unused-parameter', language: 'cpp') | ||
add_project_arguments('-Wno-unused-variable', language: 'cpp') | ||
endif | ||
if cxx.get_id() in ['msvc', 'clang-cl'] | ||
add_project_arguments('-DNOMINMAX', language: 'cpp') | ||
add_project_arguments('-D_CRT_SECURE_NO_WARNINGS', language: 'cpp') | ||
# Disable warnings triggered by SWIG-generated code: | ||
add_project_arguments('/wd4100', language: 'cpp') | ||
add_project_arguments('/wd4101', language: 'cpp') | ||
add_project_arguments('/wd4127', language: 'cpp') | ||
add_project_arguments('/wd4456', language: 'cpp') | ||
add_project_arguments('/wd4706', language: 'cpp') | ||
endif | ||
|
||
fs = import('fs') | ||
|
||
python = import('python').find_installation(pure: false) | ||
|
||
threads_dep = dependency('threads') | ||
|
||
numpy_abs_incdir = run_command( | ||
python, '-c', 'import numpy; print(numpy.get_include())', | ||
check: true, | ||
).stdout().strip() | ||
# The "correct" way would be to "detect" NumPy as a dependency. Since we are | ||
# cutting corners, we need to use a relative path as if the NumPy headers are | ||
# part of this project. | ||
numpy_incdirs = include_directories(fs.relative_to(numpy_abs_incdir, '.')) | ||
|
||
swig = find_program('swig', native: true) | ||
|
||
# For now, use MMCore as a subproject. This may be changed to using as a | ||
# proper dependency via a wrap, but that will likely require better SWIG | ||
# support by Meson in order to get the SWIG include directories from the | ||
# dependency object. | ||
mmcore_proj = subproject( | ||
'MMCore', | ||
default_options: { | ||
'default_library': 'static', | ||
'tests': 'disabled', # Avoid Catch2 subproject in sdist | ||
}, | ||
) | ||
mmcore_dep = mmcore_proj.get_variable('mmcore') | ||
|
||
swig_include_dirs = mmcore_proj.get_variable('swig_include_dirs') | ||
|
||
subdir('src/pymmcore') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.