This commit is contained in:
Anthony Samms
2025-09-15 13:35:50 -04:00
parent 4703ebb4e0
commit d76bf9759e
2 changed files with 32 additions and 52 deletions

View File

@@ -1,52 +1,46 @@
name: Build Audio Library (Windows)
name: Build Audio Library (Windows MSYS2)
on:
workflow_dispatch:
push:
paths:
- "libs/audio/**"
- ".github/workflows/windows-audio-build.yml"
- ".github/workflows/build_audio.yml"
jobs:
build-windows:
build-msys2:
runs-on: windows-latest
env:
VCPKG_DEFAULT_TRIPLET: x64-windows
VCPKG_INSTALLATION_ROOT: ${{ github.workspace }}\vcpkg
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup MSVC Build Environment
uses: microsoft/setup-msbuild@v2
- name: Set up MSYS2
uses: msys2/setup-msys2@v2
with:
update: true
install: >-
base-devel
mingw-w64-x86_64-gcc
mingw-w64-x86_64-portaudio
mingw-w64-x86_64-libsndfile
mingw-w64-x86_64-libsamplerate
- name: Install vcpkg
run: |
git clone https://github.com/microsoft/vcpkg.git
.\vcpkg\bootstrap-vcpkg.bat
- name: Install dependencies with vcpkg
run: |
.\vcpkg\vcpkg.exe install portaudio:x64-windows libsndfile:x64-windows libsamplerate:x64-windows
- name: Add vcpkg include/lib paths to environment
run: |
echo "VCPKG_INCLUDE_PATH=${{ github.workspace }}\vcpkg\installed\x64-windows\include" >> $env:GITHUB_ENV
echo "VCPKG_LIB_PATH=${{ github.workspace }}\vcpkg\installed\x64-windows\lib" >> $env:GITHUB_ENV
- name: Build audio library
- name: Build audio library (DLL)
shell: msys2 {0}
working-directory: libs/audio
run: |
nmake /f Makefile all
make clean
make all
- name: List build outputs
shell: msys2 {0}
working-directory: libs/audio
run: |
dir
ls -l
- name: Clean build artifacts
working-directory: libs/audio
run: |
nmake /f Makefile clean
- name: Upload DLL artifact
uses: actions/upload-artifact@v4
with:
name: libaudio-dll
path: libs/audio/libaudio.dll

View File

@@ -8,30 +8,16 @@ LIBS = -lportaudio -lsndfile -lsamplerate -lpthread -lm
# Detect OS and set appropriate flags
UNAME_S := $(shell uname -s 2>/dev/null || echo Windows)
# Windows detection
ifneq (,$(findstring Windows,$(UNAME_S)))
# Windows with MSVC
CC = cl
# MSYS2/MinGW-w64 detection
ifeq ($(UNAME_S),MINGW64_NT)
CC = x86_64-w64-mingw32-gcc
LIBNAME = libaudio.dll
CFLAGS = /O2 /W3 /MD /TC
LDFLAGS = /DLL
LIBS = portaudio.lib libsndfile.lib libsamplerate.lib
OBJ_EXT = .obj
# Check for vcpkg environment
ifdef VCPKG_INSTALLATION_ROOT
INCLUDE_PATH = /I"$(VCPKG_INSTALLATION_ROOT)/installed/x64-windows/include"
LIB_PATH = /LIBPATH:"$(VCPKG_INSTALLATION_ROOT)/installed/x64-windows/lib"
CFLAGS += $(INCLUDE_PATH)
LDFLAGS += $(LIB_PATH)
CFLAGS = -Wall -Wextra -O3 -fPIC -std=c99 -I/mingw64/include
LDFLAGS = -shared -Wl,--export-all-symbols -L/mingw64/lib
LIBS = -lportaudio -lsndfile -lsamplerate -lpthread -lm
OBJ_EXT = .o
endif
ifdef VCPKG_INCLUDE_PATH
CFLAGS += /I"$(VCPKG_INCLUDE_PATH)"
endif
ifdef VCPKG_LIB_PATH
LDFLAGS += /LIBPATH:"$(VCPKG_LIB_PATH)"
endif
else ifeq ($(UNAME_S),Darwin)
# macOS