Skip to content

Commit

Permalink
CI: build dylib & DLLs (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier authored Mar 30, 2024
1 parent 71bfaa6 commit 476680d
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 55 deletions.
117 changes: 117 additions & 0 deletions .github/workflows/build-libs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Build PortAudio lib
on:
push:
branches-ignore:
- master
permissions:
# This is needed for pushing a new commit to the repo:
contents: write
jobs:

macos:
runs-on: macos-13
env:
CMAKE_OSX_ARCHITECTURES: "arm64;x86_64"
MACOSX_DEPLOYMENT_TARGET: "10.9"
steps:
- name: checkout portaudio
uses: actions/checkout@v4
with:
repository: PortAudio/portaudio
ref: v19.7.0
path: portaudio
- name: cmake configure
run: |
cmake -S portaudio -B build -D CMAKE_BUILD_TYPE=Release
- name: cmake build
run: |
cmake --build build
- name: move dylib
run: |
mv build/libportaudio.dylib .
- name: show some information about dylib
run: |
file libportaudio.dylib
otool -L libportaudio.dylib
- name: upload dylib
uses: actions/upload-artifact@v4
with:
name: macos-dylib
path: libportaudio.dylib

windows:
runs-on: windows-2022
strategy:
matrix:
platform: [x64, Win32]
asio: ["", "-asio"]
include:
- platform: x64
platform-suffix: 64bit
- platform: Win32
platform-suffix: 32bit
env:
# Reproducible build by avoiding time stamp
LDFLAGS: "/Brepro"
steps:
- name: checkout portaudio
uses: actions/checkout@v4
with:
repository: PortAudio/portaudio
ref: v19.7.0
path: portaudio
# The next portaudio release will have an auto-download feature:
- name: download and extract ASIO SDK
if: matrix.asio
run: |
curl -L -o asiosdk.zip https://www.steinberg.net/asiosdk
7z x asiosdk.zip
- name: cmake configure
run: |
cmake -S portaudio -B build -A ${{ matrix.platform }} -D PA_USE_ASIO=${{ matrix.asio && 'ON' || 'OFF' }}
- name: cmake build
run: |
cmake --build build --config Release
- name: rename DLL
run: |
mv build/Release/portaudio_*.dll libportaudio${{ matrix.platform-suffix }}${{ matrix.asio }}.dll
- name: show some information about DLL
run: |
ldd libportaudio${{ matrix.platform-suffix }}${{ matrix.asio }}.dll
- name: upload DLL
uses: actions/upload-artifact@v4
with:
name: windows-${{ matrix.platform }}-dll${{ matrix.asio }}
path: libportaudio${{ matrix.platform-suffix }}${{ matrix.asio }}.dll

push:
runs-on: ubuntu-latest
needs: [macos, windows]
steps:
- name: Clone Git repository
uses: actions/checkout@v4
- name: Retrieve dylib
uses: actions/download-artifact@v4
with:
name: macos-dylib
- name: Retrieve x64 DLL
uses: actions/download-artifact@v4
with:
name: windows-x64-dll
- name: Retrieve x64 DLL with ASIO support
uses: actions/download-artifact@v4
with:
name: windows-x64-dll-asio
- name: Retrieve Win32 DLL
uses: actions/download-artifact@v4
with:
name: windows-Win32-dll
- name: Retrieve Win32 DLL with ASIO support
uses: actions/download-artifact@v4
with:
name: windows-Win32-dll-asio
- name: Commit and push binaries (if there are changes)
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git commit -am "Update binaries" && git push || true
68 changes: 13 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,66 +7,24 @@ This repository provides pre-compiled dynamic libraries for
DLLs for Windows (32-bit and 64-bit)
------------------------------------

The DLLs include all available host APIs, namely WMME, DirectSound, WDM/KS,
WASAPI and ASIO. For more informaton about the ASIO SDK see
There are two sets of DLL files,
one including the default host APIs,
namely MME, DirectSound, WDM/KS and WASAPI,
and another one (`*-asio.dll`) where ASIO is enabled as well.
For more information about the ASIO SDK see
http://www.steinberg.net/en/company/developers.html.

The DLLs were created on a Debian GNU/Linux system using [MXE](http://mxe.cc/)
([this version](https://github.com/mxe/mxe/tree/95649828bc29334d5f9abef2718d49a55d9a5407),
using `pa_stable_v190700_20210406.tgz`)
with the following commands (after installing the
[dependencies](http://mxe.cc/#requirements)):
dylib for macOS (64-bit, "universal")
----------------------------------------

git clone https://github.com/mxe/mxe.git
wget http://www.steinberg.net/sdk_downloads/asiosdk2.3.zip
export PATH=$(pwd)"/mxe/usr/bin:$PATH"
The file `libportaudio.dylib` is compatible both
with Intel (`x86_64`) and with Apple Silicon (`arm64`) CPUs.

Open the file `mxe/src/portaudio.mk` and change
`--with-winapi=wmme,directx,wdmks,wasapi` to
`--with-winapi=wmme,directx,wdmks,wasapi,asio` (and make sure to keep the
backslash at the end of the line).
To the first line starting with "$(MAKE)", append " EXAMPLES= SELFTESTS=" (without the quotes).
Delete the 4 lines before the last line (i.e. keep the line with "endef").
After saving your changes, please continue:
Details
-------

for TARGET in x86_64-w64-mingw32.static i686-w64-mingw32.static
do
unzip asiosdk2.3.zip
# You'll need write access in /usr/local for this:
mv ASIOSDK2.3 /usr/local/asiosdk2
# If it doesn't work, prepend "sudo " to the previous command
make -C mxe portaudio MXE_TARGETS=$TARGET
$TARGET-gcc -O2 -shared -o libportaudio-$TARGET.dll -Wl,--whole-archive -lportaudio -Wl,--no-whole-archive -lstdc++ -lwinmm -lole32 -lsetupapi
$TARGET-strip libportaudio-$TARGET.dll
chmod -x libportaudio-$TARGET.dll
# again, you'll probably have to use "sudo":
rm -r /usr/local/asiosdk2
done

mv libportaudio-x86_64-w64-mingw32.static.dll libportaudio64bit.dll
mv libportaudio-i686-w64-mingw32.static.dll libportaudio32bit.dll

A different set of DLLs (compiled with Visual Studio) is available at
https://github.com/adfernandes/precompiled-portaudio-windows.

dylib for Mac OS X (64-bit)
---------------------------

The dylib was created on a Mac OS X system using XCode.
The XCode CLI tools were installed with:

xcode-select --install

The following commands were used for compilation:

curl -O http://files.portaudio.com/archives/pa_stable_v190700_20210406.tgz
tar xvf pa_stable_v190700_20210406.tgz
cd portaudio
# in configure: replace "-Werror" (just search for it) with "-DNDEBUG"
./configure MACOSX_DEPLOYMENT_TARGET=10.6
make
cd ..
cp portaudio/lib/.libs/libportaudio.2.dylib libportaudio.dylib
All files were auto-created with Github Actions.
For all the details, see [the config file](.github/workflows/build-libs.yml).

Copyright
---------
Expand Down
Binary file modified libportaudio.dylib
Binary file not shown.
Binary file added libportaudio32bit-asio.dll
Binary file not shown.
Binary file modified libportaudio32bit.dll
Binary file not shown.
Binary file added libportaudio64bit-asio.dll
Binary file not shown.
Binary file modified libportaudio64bit.dll
Binary file not shown.

0 comments on commit 476680d

Please sign in to comment.