Skip to content

Commit

Permalink
Phazor: Add .pyd for Windows DLLs and cleanup pyproject.toml comments
Browse files Browse the repository at this point in the history
  • Loading branch information
C0rn3j committed Dec 21, 2024
1 parent dddbdc1 commit b63169d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
8 changes: 2 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -85,18 +85,14 @@
# 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
# I have not found a better way to solve this, ideally we would somehow tag this as Linux-exclusive
{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?
Expand Down
15 changes: 7 additions & 8 deletions src/tauon/t_modules/t_phazor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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:
Expand Down

0 comments on commit b63169d

Please sign in to comment.