From b63169d72aa67e32a579ebd0037282f65b539805 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Sat, 21 Dec 2024 15:06:25 +0100 Subject: [PATCH] Phazor: Add .pyd for Windows DLLs and cleanup pyproject.toml comments --- pyproject.toml | 8 ++------ src/tauon/t_modules/t_phazor.py | 15 +++++++-------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 118641b5b..0ba38e045 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,7 +71,7 @@ # https://setuptools.pypa.io/en/latest/userguide/ext_modules.html # This is terribly formatted as in TOML 1.0 it all has to be inline, can only be changed when TOML 1.1 ships - # Windows - MSVC - does not work as PyGobject, GTK, Cairo and et al won't build under MVSC + # Windows (MSVC) - does not work as PyGobject, GTK, Cairo and et al won't build under MVSC # One option would be to test https://github.com/wingtk/gvsbuild + https://stackoverflow.com/a/72737752 # ./vcpkg.exe install libsndfile:x64-windows # TODO download the necessities instead of this bundle, libflac at minimum # ./vcpkg.exe install mpg123:x64-windows @@ -85,7 +85,7 @@ # ext-modules = [ # {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["src/phazor/miniaudio", "C:/Users/Yeet/Tauon/src/phazor/miniaudio", "C:/Users/Yeet/Tauon/vcpkg/installed/x64-windows/include", "C:/Users/Yeet/Tauon/src/phazor/kissfft", "C:/Users/Yeet/Tauon/src/phazor/miniaudio"], libraries=["samplerate", "wavpackdll", "opusfile", "ogg", "opus", "vorbisfile", "mpg123", "FLAC", "openmpt", "pthreadVC3", "gme"], library-dirs = ["vcpkg/installed/x64-windows/lib"] },] - # Linux + macOS + # Linux + macOS + Windows (MINGW64) ext-modules = [ {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus", "/opt/homebrew/include/opus", "/opt/homebrew/include", "/mingw64/include/"], libraries = ["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme"], library-dirs = ["/opt/homebrew/lib"] }, # Set as optional to allow soft-failure, it's expected not to build on Windows/macOS, but we don't want to fail the entire build on it @@ -93,10 +93,6 @@ {name = "phazor-pw", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus"], libraries = ["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme", "pipewire-0.3"], optional = true }, ] - # macOS -# ext-modules = [ -# {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/opt/homebrew/include/opus", "src/phazor/kissfft", "/opt/homebrew/include"], libraries=["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme"], library-dirs = ["/opt/homebrew/lib"] },] - package-dir = {"" = "src"} # Should we care about these options or is it fine to omit them here? diff --git a/src/tauon/t_modules/t_phazor.py b/src/tauon/t_modules/t_phazor.py index 24b8eb439..1fd5badb0 100644 --- a/src/tauon/t_modules/t_phazor.py +++ b/src/tauon/t_modules/t_phazor.py @@ -83,15 +83,14 @@ def find_library(libname: str) -> Path | None: def get_phazor_path(pctl: PlayerCtl) -> Path: - """ - Locate the PHaZOR library in the specified priority order. - Tries .so, .dll, .dynlib in that order and finally uses find_library as a fallback. + """Locate the PHaZOR library in the specified priority order. - :param pctl: PlayerCtl object containing installation details - :return: Path to the library file - :raises Exception: If no library is found - """ + Tries .so, .dll, .dynlib in that order and finally uses find_library as a fallback. + :param pctl: PlayerCtl object containing installation details + :return: Path to the library file + :raises Exception: If no library is found + """ # This is where compile-phazor.sh scrips place the dll base_path = Path(pctl.install_directory).parent.parent / "build" @@ -101,7 +100,7 @@ def get_phazor_path(pctl: PlayerCtl) -> Path: else: lib_name = "phazor" - extensions = [".so", ".dll", ".dynlib"] + extensions = [".so", ".dll", ".pyd", ".dynlib"] # Check explicitly for each file for ext in extensions: