From 9ae001d494e0c610ba2ef18fef0103c30a9112dd Mon Sep 17 00:00:00 2001 From: Anthony Samms Date: Tue, 16 Sep 2025 13:41:34 -0400 Subject: [PATCH] Update python-app.yml --- .github/workflows/python-app.yml | 142 +++++++++++++++++++++---------- 1 file changed, 97 insertions(+), 45 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 75713ff..65765a2 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -47,53 +47,82 @@ jobs: mingw-w64-x86_64-cmake mingw-w64-x86_64-pkg-config - # Download pre-built PortAudio with ASIO support (Windows only) - - name: Download pre-built PortAudio with ASIO (Windows) + # Download individual PortAudio files (Windows only) + - name: Download PortAudio individual files (Windows) if: runner.os == 'Windows' shell: msys2 {0} run: | - # Create directory for pre-built libraries - mkdir -p /mingw64/prebuilt - cd /mingw64/prebuilt + # Create directory structure for PortAudio + mkdir -p /mingw64/portaudio-custom/{include,lib,bin} + cd /mingw64/portaudio-custom - # Try multiple sources for pre-built PortAudio with ASIO - echo "=== Attempting to download pre-built PortAudio with ASIO ===" + # Download header files + echo "Downloading PortAudio headers..." + curl -L -o include/portaudio.h https://raw.githubusercontent.com/PortAudio/portaudio/master/include/portaudio.h - # Option 1: Try PortAudio Windows binaries - curl -L https://github.com/PortAudio/portaudio/releases/download/v19.7.0/pa_stable_v190700_20210406_msvc.zip -o portaudio_msvc.zip 2>/dev/null || echo "MSVC binaries not available" + # Download Windows-specific DLL and import library + # Note: You'll need to find actual URLs for these files + echo "Downloading PortAudio binaries..." - # Option 2: Try community builds - curl -L https://github.com/spatialaudio/portaudio-binaries/raw/master/libportaudio64bit-asio.dll -o libportaudio64bit-asio.dll 2>/dev/null || echo "Community binaries not available" + # Option 1: From a release that provides individual files + curl -L -o lib/libportaudio.dll.a https://example.com/path/to/libportaudio.dll.a + curl -L -o lib/portaudio.lib https://example.com/path/to/portaudio.lib # MSVC-style + curl -L -o bin/portaudio_x64.dll https://example.com/path/to/portaudio_x64.dll - # Option 3: Try a known working ASIO-enabled build - curl -L https://www.un4seen.com/files/z/1/bass24-win32.zip -o bass_example.zip 2>/dev/null || echo "Alternative audio library not available" + # Option 2: Alternative sources (adjust URLs as needed) + # curl -L -o lib/libportaudio.a https://github.com/some-repo/portaudio-static/releases/download/v19.7.0/libportaudio.a + # curl -L -o bin/portaudio.dll https://github.com/some-repo/portaudio-binaries/releases/download/v19.7.0/portaudio.dll - # Check what we downloaded - ls -la *.zip 2>/dev/null || echo "No zip files downloaded" + # Verify downloads + echo "=== Downloaded files ===" + find . -type f -ls - # Extract what we have - for zip_file in *.zip; do - if [ -f "$zip_file" ]; then - echo "Extracting $zip_file" - unzip -q "$zip_file" 2>/dev/null || echo "Failed to extract $zip_file" - fi - done - - # Look for PortAudio files - find . -name "*portaudio*" -o -name "*asio*" 2>/dev/null || echo "No PortAudio/ASIO files found in downloads" - - - name: Verify ASIO support (Windows) + - name: Set up PortAudio build environment (Windows) if: runner.os == 'Windows' shell: msys2 {0} run: | - # Check if ASIO symbols are present in PortAudio - echo "=== Checking for ASIO support in PortAudio ===" + # Create pkg-config file for custom PortAudio + mkdir -p /mingw64/lib/pkgconfig + cat > /mingw64/lib/pkgconfig/portaudio-custom.pc << EOF + prefix=/mingw64/portaudio-custom + exec_prefix=\${prefix} + libdir=\${prefix}/lib + includedir=\${prefix}/include - # Look for ASIO in the installed library - find /mingw64 -name "*portaudio*" -exec nm {} \; 2>/dev/null | grep -i asio && echo "ASIO symbols found!" || echo "No ASIO symbols found - will use DirectSound/WASAPI fallback" + Name: PortAudio + Description: Portable cross-platform Audio API + Version: 19.7.0 + Libs: -L\${libdir} -lportaudio -lole32 -luuid -lwinmm -ldsound -lwsock32 -lsetupapi + Cflags: -I\${includedir} + EOF - # Check what audio APIs are available - pkg-config --cflags --libs portaudio 2>/dev/null || echo "Using manual linking flags" + # Or set environment variables directly + export PORTAUDIO_INCLUDE_DIR="/mingw64/portaudio-custom/include" + export PORTAUDIO_LIB_DIR="/mingw64/portaudio-custom/lib" + export PORTAUDIO_BIN_DIR="/mingw64/portaudio-custom/bin" + + - name: Verify PortAudio setup (Windows) + if: runner.os == 'Windows' + shell: msys2 {0} + run: | + echo "=== Verifying PortAudio setup ===" + + # Check header file + if [ -f "/mingw64/portaudio-custom/include/portaudio.h" ]; then + echo "✓ Header file found" + grep -i "asio\|version" /mingw64/portaudio-custom/include/portaudio.h | head -5 + else + echo "✗ Header file missing" + fi + + # Check library files + ls -la /mingw64/portaudio-custom/lib/ || echo "Library directory not found" + + # Check DLL + ls -la /mingw64/portaudio-custom/bin/ || echo "Binary directory not found" + + # Test if we can find ASIO symbols (if available) + find /mingw64/portaudio-custom -name "*.dll" -o -name "*.a" -exec nm {} \; 2>/dev/null | grep -i asio && echo "ASIO symbols found!" || echo "No ASIO symbols found" - name: Build static audio library (Windows) if: runner.os == 'Windows' @@ -103,31 +132,54 @@ jobs: # Clean previous builds make clean 2>/dev/null || echo "No previous build to clean" - # Build with PortAudio support - # Add ASIO flag but don't fail if not available + # Build with custom PortAudio export CFLAGS="$CFLAGS -DPA_USE_ASIO=1" - export PKG_CONFIG_PATH="/mingw64/lib/pkgconfig:$PKG_CONFIG_PATH" - # Try building with pkg-config first, then fallback to manual flags - if pkg-config --exists portaudio; then - echo "Building with pkg-config PortAudio support" - make all PORTAUDIO_CFLAGS="$(pkg-config --cflags portaudio)" PORTAUDIO_LIBS="$(pkg-config --libs portaudio)" + # Method 1: Use pkg-config with custom .pc file + if pkg-config --exists portaudio-custom; then + echo "Building with custom pkg-config PortAudio" + make all PORTAUDIO_CFLAGS="$(pkg-config --cflags portaudio-custom)" PORTAUDIO_LIBS="$(pkg-config --libs portaudio-custom)" + + # Method 2: Use environment variables + elif [ -d "/mingw64/portaudio-custom" ]; then + echo "Building with custom PortAudio paths" + make all \ + PORTAUDIO_CFLAGS="-I/mingw64/portaudio-custom/include" \ + PORTAUDIO_LIBS="-L/mingw64/portaudio-custom/lib -lportaudio -lole32 -luuid -lwinmm -ldsound -lwsock32 -lsetupapi" + + # Method 3: Fallback to system PortAudio else - echo "Building with manual PortAudio linking" - make all PORTAUDIO_LIBS="-lportaudio -lole32 -luuid -lwinmm -ldsound -lwsock32 -lsetupapi" + echo "Falling back to system PortAudio" + if pkg-config --exists portaudio; then + make all PORTAUDIO_CFLAGS="$(pkg-config --cflags portaudio)" PORTAUDIO_LIBS="$(pkg-config --libs portaudio)" + else + make all PORTAUDIO_LIBS="-lportaudio -lole32 -luuid -lwinmm -ldsound -lwsock32 -lsetupapi" + fi fi # Verify the build make verify 2>/dev/null || echo "Verification step not available" - - name: Copy static DLL (Windows) + - name: Copy libraries and DLLs (Windows) if: runner.os == 'Windows' run: | mkdir -p build/lib + + # Copy your built library cp libs/audio/libaudio.dll build/lib/ - # No need to copy other DLLs since everything is statically linked! - echo "Static build complete - single DLL created" + # Copy the custom PortAudio DLL if it exists + if [ -f "/mingw64/portaudio-custom/bin/portaudio.dll" ]; then + cp /mingw64/portaudio-custom/bin/portaudio.dll build/lib/ + echo "✓ Custom PortAudio DLL copied" + elif [ -f "/mingw64/portaudio-custom/bin/portaudio_x64.dll" ]; then + cp /mingw64/portaudio-custom/bin/portaudio_x64.dll build/lib/ + echo "✓ Custom PortAudio x64 DLL copied" + else + echo "⚠ No custom PortAudio DLL found - runtime may need system PortAudio" + fi + + echo "Build output:" ls -la build/lib/ shell: bash