From 0dcdf430f51b8922675f5de4425cfe396a015658 Mon Sep 17 00:00:00 2001 From: Anthony Samms Date: Mon, 15 Sep 2025 11:20:25 -0400 Subject: [PATCH] Update python-app.yml --- .github/workflows/python-app.yml | 66 +++++++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 9 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index d4392d2..57d6ee7 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -40,13 +40,35 @@ jobs: - name: Install Audio Dependencies (Windows) if: runner.os == 'Windows' run: | - # Using vcpkg for Windows dependencies + # Install vcpkg dependencies + vcpkg integrate install vcpkg install portaudio:x64-windows libsndfile:x64-windows libsamplerate:x64-windows - # Set environment variables for linking + + # Set up environment variables for the build system echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" >> $env:GITHUB_ENV - echo "PKG_CONFIG_PATH=$env:VCPKG_INSTALLATION_ROOT/installed/x64-windows/lib/pkgconfig" >> $env:GITHUB_ENV + echo "CMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" >> $env:GITHUB_ENV + + # Set up include and library paths + $vcpkgPath = "$env:VCPKG_INSTALLATION_ROOT/installed/x64-windows" + echo "CPPFLAGS=-I$vcpkgPath/include" >> $env:GITHUB_ENV + echo "LDFLAGS=-L$vcpkgPath/lib" >> $env:GITHUB_ENV + echo "PKG_CONFIG_PATH=$vcpkgPath/lib/pkgconfig" >> $env:GITHUB_ENV + + # Add bin directory to PATH for runtime DLLs + echo "$vcpkgPath/bin" >> $env:GITHUB_PATH shell: powershell + # Set up build tools for Windows + - name: Setup MSVC (Windows) + if: runner.os == 'Windows' + uses: microsoft/setup-msbuild@v2 + + - name: Setup MSVC Environment (Windows) + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 + # Compile the audio library - name: Check Audio Library Dependencies run: | @@ -55,7 +77,19 @@ jobs: shell: bash continue-on-error: true - - name: Compile Audio Library + - name: Compile Audio Library (Windows) + if: runner.os == 'Windows' + run: | + cd libs/audio + make clean + # Use environment variables set above + make all CC=cl CFLAGS="/I%VCPKG_INSTALLATION_ROOT%/installed/x64-windows/include" LDFLAGS="/LIBPATH:%VCPKG_INSTALLATION_ROOT%/installed/x64-windows/lib" + shell: cmd + env: + VCPKG_INSTALLATION_ROOT: ${{ env.VCPKG_ROOT }} + + - name: Compile Audio Library (Unix) + if: runner.os != 'Windows' run: | cd libs/audio make clean @@ -69,13 +103,27 @@ jobs: sudo make install shell: bash - - name: Copy Audio Library to System Path (Windows) + - name: Setup Audio Library (Windows) if: runner.os == 'Windows' run: | cd libs/audio - # Copy DLL to a location where Python can find it + # Create build directory and copy library files mkdir -p ../../build/lib - cp libaudio.dll ../../build/lib/ + + # Copy the compiled library + if (Test-Path "libaudio.dll") { + Copy-Item "libaudio.dll" "../../build/lib/" + } + if (Test-Path "audio.dll") { + Copy-Item "audio.dll" "../../build/lib/" + } + + # Copy vcpkg DLLs that might be needed at runtime + $vcpkgBin = "$env:VCPKG_INSTALLATION_ROOT/installed/x64-windows/bin" + if (Test-Path $vcpkgBin) { + Copy-Item "$vcpkgBin/*.dll" "../../build/lib/" -ErrorAction SilentlyContinue + } + # Add to PATH echo "${{ github.workspace }}/build/lib" >> $env:GITHUB_PATH shell: powershell @@ -105,8 +153,8 @@ jobs: # Copy the compiled audio library to release if [ "${{ runner.os }}" == "Windows" ]; then - cp libs/audio/libaudio.dll release/ 2>/dev/null || true - cp build/lib/libaudio.dll release/ 2>/dev/null || true + cp libs/audio/*.dll release/ 2>/dev/null || true + cp build/lib/*.dll release/ 2>/dev/null || true elif [ "${{ runner.os }}" == "macOS" ]; then cp libs/audio/libaudio.dylib release/ 2>/dev/null || true else