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: on:
workflow_dispatch: workflow_dispatch:
push: push:
paths: paths:
- "libs/audio/**" - "libs/audio/**"
- ".github/workflows/windows-audio-build.yml" - ".github/workflows/build_audio.yml"
jobs: jobs:
build-windows: build-msys2:
runs-on: windows-latest runs-on: windows-latest
env:
VCPKG_DEFAULT_TRIPLET: x64-windows
VCPKG_INSTALLATION_ROOT: ${{ github.workspace }}\vcpkg
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup MSVC Build Environment - name: Set up MSYS2
uses: microsoft/setup-msbuild@v2 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 - name: Build audio library (DLL)
run: | shell: msys2 {0}
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
working-directory: libs/audio working-directory: libs/audio
run: | run: |
nmake /f Makefile all make clean
make all
- name: List build outputs - name: List build outputs
shell: msys2 {0}
working-directory: libs/audio working-directory: libs/audio
run: | run: |
dir ls -l
- name: Clean build artifacts - name: Upload DLL artifact
working-directory: libs/audio uses: actions/upload-artifact@v4
run: | with:
nmake /f Makefile clean 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 # Detect OS and set appropriate flags
UNAME_S := $(shell uname -s 2>/dev/null || echo Windows) UNAME_S := $(shell uname -s 2>/dev/null || echo Windows)
# Windows detection # MSYS2/MinGW-w64 detection
ifneq (,$(findstring Windows,$(UNAME_S))) ifeq ($(UNAME_S),MINGW64_NT)
# Windows with MSVC CC = x86_64-w64-mingw32-gcc
CC = cl
LIBNAME = libaudio.dll LIBNAME = libaudio.dll
CFLAGS = /O2 /W3 /MD /TC CFLAGS = -Wall -Wextra -O3 -fPIC -std=c99 -I/mingw64/include
LDFLAGS = /DLL LDFLAGS = -shared -Wl,--export-all-symbols -L/mingw64/lib
LIBS = portaudio.lib libsndfile.lib libsamplerate.lib LIBS = -lportaudio -lsndfile -lsamplerate -lpthread -lm
OBJ_EXT = .obj OBJ_EXT = .o
# 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)
endif 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) else ifeq ($(UNAME_S),Darwin)
# macOS # macOS