Skip to content

Commit 0c21ca6

Browse files
authored
Merge pull request #156 from SpotlightKid/feat/rtmidi-build-updates
Update rtmidi submodule and improve build dependency selection
2 parents ac1acb9 + 20f5cdd commit 0c21ca6

File tree

10 files changed

+31
-39
lines changed

10 files changed

+31
-39
lines changed
Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
name: Build sdist and wheels for testing purposes
22

33
on:
4-
push:
5-
branches:
6-
- improve-build
74
pull_request:
85
branches:
9-
- improve-build
6+
- master
107

118
jobs:
129
build_sdist:
@@ -30,10 +27,6 @@ jobs:
3027
- name: Check metadata
3128
run: pipx run twine check --strict dist/*
3229

33-
- uses: actions/upload-artifact@v3
34-
with:
35-
path: dist/*.tar.gz
36-
3730
build_wheels:
3831
name: Build wheels on ${{ matrix.os }}
3932
runs-on: ${{ matrix.os }}
@@ -53,10 +46,6 @@ jobs:
5346
- name: Build wheels
5447
uses: pypa/[email protected]
5548

56-
- uses: actions/upload-artifact@v3
57-
with:
58-
path: wheelhouse/*.whl
59-
6049
build_arch_wheels:
6150
name: Build wheels on Linux ${{ matrix.arch }}
6251
runs-on: ubuntu-20.04
@@ -81,7 +70,3 @@ jobs:
8170
run: git diff --exit-code
8271
shell: bash
8372

84-
- name: Upload wheels
85-
uses: actions/upload-artifact@v3
86-
with:
87-
path: wheelhouse/*.whl
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ name: Build sdist and wheels and publish to TestPyPI
33
on:
44
push:
55
branches:
6-
- develop
7-
pull_request:
8-
branches:
9-
- develop
6+
- master
107

118
jobs:
129
build_sdist:

meson.build

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ else
2424
jack_dep = disabler()
2525
endif
2626

27-
2827
jack_not_found = jack_dep.found() ? false : true
2928

3029
## From https://github.com/numpy/numpy/blob/main/numpy/meson.build
@@ -65,9 +64,16 @@ else
6564

6665
# API
6766
alsa_dep = dependency('alsa', required: jack_not_found)
68-
threads_dep = dependency('threads')
6967
endif # Platform detection
7068

69+
jack_support = jack_dep.found() and get_option('jack')
70+
alsa_support = host_machine.system() == 'linux' and alsa_dep.found() and get_option('alsa')
71+
coremidi_support = host_machine.system() == 'darwin' and coremidi_dep.found() and get_option('coremidi')
72+
winmm_support = host_machine.system() == 'windows' and winmm_dep.found() and get_option('winmm')
73+
74+
threads_dep = dependency('threads', required: alsa_support or jack_support)
75+
have_semaphore = cpp.has_header('semaphore.h')
76+
7177
pymod = import('python')
7278
python = pymod.find_installation(get_option('python'), required: true)
7379

@@ -85,9 +91,9 @@ endif
8591
summary({
8692
'Debug messages (verbose)': get_option('verbose'),
8793
'Build for wheel': get_option('wheel'),
88-
'JACK support': jack_dep.found() and get_option('jack'),
89-
'ALSA support': host_machine.system() == 'linux' and alsa_dep.found() and get_option('alsa'),
90-
'CoreMIDI support': host_machine.system() == 'darwin' and coremidi_dep.found() and get_option('coremidi'),
91-
'Window MM support': host_machine.system() == 'windows' and winmm_dep.found() and get_option('winmm'),
94+
'JACK support': jack_support,
95+
'ALSA support': alsa_support,
96+
'CoreMIDI support': coremidi_support,
97+
'Window MM support': winmm_support,
9298
}, section: 'Configuration')
9399

meson_postinstall.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
print('Compiling Python module to bytecode...')
1212

1313
moduledir = sysconfig.get_path('purelib', vars={'base': destdir})
14-
compile_dir(path.join(moduledir, 'rtmidi'), optimize=1)
14+
compile_dir(path.join(moduledir, 'rtmidi'), optimize=1, quiet=not verbose,
15+
stripdir=destdir or None)

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ keywords = [
4444
meson-python-option-name = "python"
4545
meson-options = [
4646
"-Dwheel=true",
47-
"-Dverbose=true",
47+
"-Dverbose=false",
4848
"--buildtype=plain"
4949
]
5050

@@ -106,7 +106,7 @@ before-all = [
106106

107107
[tool.cibuildwheel.macos]
108108
build = "cp3{8,9,10,11}-macosx*"
109-
archs = ["universal2"]
109+
archs = ["x86_64", "arm64"]
110110
environment = { MACOSX_DEPLOYMENT_TARGET = "10.14" }
111111
before-all = [
112112
"pipx install ninja",
@@ -115,4 +115,4 @@ before-all = [
115115
[tool.cibuildwheel.windows]
116116
build = "cp3{8,9,10,11}-win*"
117117
archs = ["AMD64"]
118-
build-verbosity = 1
118+

rtmidi/meson.build

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ defines = []
44
dependencies = [python.dependency()]
55
link_args = []
66

7-
if host_machine.system() == 'darwin' and coremidi_dep.found() and get_option('coremidi')
7+
if coremidi_support
88
defines += ['-D__MACOSX_CORE__']
99
#defines += ['-frtti']
1010
dependencies += [coremidi_dep]
@@ -15,25 +15,28 @@ if host_machine.system() == 'darwin' and coremidi_dep.found() and get_option('co
1515
]
1616
endif
1717

18-
if host_machine.system() == 'linux'
18+
if alsa_support or jack_support
1919
dependencies += [threads_dep]
2020
endif
2121

22-
if host_machine.system() == 'linux' and alsa_dep.found() and get_option('alsa')
22+
if alsa_support
2323
defines += ['-D__LINUX_ALSA__']
2424
dependencies += [alsa_dep]
2525
endif
2626

27-
if host_machine.system() == 'windows' and get_option('winmm')
27+
if winmm_support
2828
defines += ['-D__WINDOWS_MM__']
2929
if meson.get_compiler('cpp').get_id() != 'gcc'
3030
defines += ['/EHsc']
3131
endif
3232
dependencies += [winmm_dep]
3333
endif
3434

35-
if jack_dep.found() and get_option('jack')
35+
if jack_support
3636
defines += ['-D__UNIX_JACK__', '-DJACK_HAS_PORT_RENAME']
37+
if have_semaphore
38+
defines += ['-DHAVE_SEMAPHORE']
39+
endif
3740
dependencies += [jack_dep]
3841
endif
3942

src/_rtmidi.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ cdef extern from "RtMidi.h":
150150
LINUX_ALSA "RtMidi::LINUX_ALSA"
151151
UNIX_JACK "RtMidi::UNIX_JACK"
152152
WINDOWS_MM "RtMidi::WINDOWS_MM"
153-
RTMIDI_DUMMY "RtMidi::RTMIDI_DUMMY"
154153
WEB_MIDI "RtMidi::WEB_MIDI_API"
154+
RTMIDI_DUMMY "RtMidi::RTMIDI_DUMMY"
155155

156156
cdef enum ErrorType "RtMidiError::Type":
157157
ERR_WARNING "RtMidiError::WARNING"
@@ -247,8 +247,8 @@ API_MACOSX_CORE = MACOSX_CORE
247247
API_LINUX_ALSA = LINUX_ALSA
248248
API_UNIX_JACK = UNIX_JACK
249249
API_WINDOWS_MM = WINDOWS_MM
250-
API_RTMIDI_DUMMY = RTMIDI_DUMMY
251250
API_WEB_MIDI = WEB_MIDI
251+
API_RTMIDI_DUMMY = RTMIDI_DUMMY
252252

253253
# export error values to Python
254254

tests/test_rtmidi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def test_get_compiled_api_by_name(self):
5757
def test_get_rtmidi_version(self):
5858
version = rtmidi.get_rtmidi_version()
5959
self.assertTrue(isinstance(version, string_types))
60-
self.assertEqual(version, '4.0.0')
60+
self.assertEqual(version, '5.0.0')
6161

6262

6363
class BaseTests:

0 commit comments

Comments
 (0)