Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add GitHub action for macOS arm64 #2

Merged
merged 2 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 33 additions & 10 deletions .github/workflows/fauck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: FaucK

env:
FAUCK_VERSION: 0.0.3
CMAKE_OSX_DEPLOYMENT_TARGET: 12.0

on:
# Allows you to run this workflow manually from the Actions tab
Expand All @@ -24,13 +25,13 @@ jobs:
LIBFAUST_DIR: thirdparty/libfaust/ubuntu-x86_64/Release
CMAKE_OSX_ARCHITECTURES: "x86_64"
- name: macos-x86_64
os: macos-11
os: macos-12
LIBFAUST_DIR: thirdparty/libfaust/darwin-x64/Release
CMAKE_OSX_ARCHITECTURES: "x86_64"
# - name: macos-arm64
# os: macos-11
# LIBFAUST_DIR: thirdparty/libfaust/darwin-arm64/Release
# CMAKE_OSX_ARCHITECTURES: "arm64"
- name: macos-arm64
os: macos-12
LIBFAUST_DIR: thirdparty/libfaust/darwin-arm64/Release
CMAKE_OSX_ARCHITECTURES: "arm64"
- name: win64
os: windows-2022
LIBFAUST_DIR: thirdparty/libfaust/win64/Release
Expand All @@ -39,7 +40,7 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -50,8 +51,30 @@ jobs:
libflac-dev libogg-dev libtool libvorbis-dev libopus-dev libmp3lame-dev \
libmpg123-dev pkg-config python

- name: Brew install requirements (arm64)
if: ${{ endsWith( matrix.name, 'macos-arm64') }}
run: |
brew update
PACKAGES=(flac libogg libtool libvorbis opus mpg123 lame)
DEPS=($(brew deps --union --topological $(echo $PACKAGES) | tr '\n' ' '))
PACKAGES=("${DEPS[@]}" "${PACKAGES[@]}")
export HOMEBREW_NO_INSTALL_CLEANUP=1
export HOMEBREW_NO_INSTALL_UPGRADE=1
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
for PACKAGE in "${PACKAGES[@]}"
do
echo "Fetching bottle: $PACKAGE"
response=$(brew fetch --bottle-tag=arm64_monterey $PACKAGE 2>&1)
package_path=$(echo $response | sed -n 's/.*\:\ \(.*\.tar\.gz\).*/\1/p')
package_path=$(echo "$package_path" | xargs)
echo "Package Path: $package_path"
brew reinstall --verbose --force-bottle "$package_path" || true
done

brew uninstall --ignore-dependencies curl git || true

- name: Install dependencies macOS
if: startsWith(matrix.os, 'macos')
if: ${{ endsWith( matrix.name, 'macos-x86_64') }}
run: |
brew install autoconf autogen automake flac libogg libtool libvorbis opus mpg123 pkg-config

Expand Down Expand Up @@ -79,17 +102,17 @@ jobs:
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
run: |
cd thirdparty/libsndfile
cmake -Bbuild -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_C_FLAGS="-fPIC" -DCMAKE_CXX_FLAGS="-fPIC" -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX="./install"
cmake -Bbuild -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_OSX_ARCHITECTURES=${{ matrix.CMAKE_OSX_ARCHITECTURES }} -DCMAKE_OSX_DEPLOYMENT_TARGET=$CMAKE_OSX_DEPLOYMENT_TARGET -DCMAKE_C_FLAGS="-fPIC" -DCMAKE_CXX_FLAGS="-fPIC" -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX="./install"
cmake --build build --config Release
cmake --build build --target install

- name: Build FaucK Release
run: |
cmake -Bbuild -DCMAKE_VERBOSE_MAKEFILE=ON -DLIBFAUST_DIR=${{ github.workspace }}/${{ matrix.LIBFAUST_DIR }} -DCMAKE_OSX_ARCHITECTURES=${{ matrix.CMAKE_OSX_ARCHITECTURES }}
cmake -Bbuild -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_OSX_ARCHITECTURES=${{ matrix.CMAKE_OSX_ARCHITECTURES }} -DCMAKE_OSX_DEPLOYMENT_TARGET=$CMAKE_OSX_DEPLOYMENT_TARGET -DLIBFAUST_DIR=${{ github.workspace }}/${{ matrix.LIBFAUST_DIR }}
cmake --build build --config Release
cmake --build build --config Release --target install

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: fauck-${{ matrix.name }}.zip
path: "package/fauck-${{ env.FAUCK_VERSION }}"
Expand Down
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,7 @@ else()
pkg_check_modules(OGG REQUIRED IMPORTED_TARGET ogg)
pkg_check_modules(OPUS REQUIRED IMPORTED_TARGET opus)
pkg_check_modules(MPG123 REQUIRED IMPORTED_TARGET libmpg123)
if(APPLE)
execute_process(COMMAND find /usr/local/Cellar/lame -name libmp3lame.a OUTPUT_VARIABLE SNDFILE_STATIC_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
list(POP_BACK PKG_CONFIG_EXECUTABLE) # undo the append above
endif()
target_link_libraries (${PROJECT_NAME} PRIVATE PkgConfig::SNDFILE PkgConfig::FLAC PkgConfig::VORBIS PkgConfig::OGG PkgConfig::OPUS PkgConfig::MPG123 ${SNDFILE_STATIC_LIBS})
target_link_libraries (${PROJECT_NAME} PRIVATE PkgConfig::SNDFILE PkgConfig::FLAC PkgConfig::VORBIS PkgConfig::OGG PkgConfig::OPUS PkgConfig::MPG123)
endif()

# Link libfaust based on platform
Expand Down