From 880bb0f3327573f4d5a0cc9887986e4eda4720f3 Mon Sep 17 00:00:00 2001 From: complexlogic Date: Sat, 23 Dec 2023 10:04:46 -0800 Subject: [PATCH] macOS static build --- .github/workflows/build.yml | 60 ++++++++++++++++++++++++++++++++----- CMakeLists.txt | 2 +- 2 files changed, 53 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a13f4fc..213a913 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -227,6 +227,15 @@ jobs: packages: write strategy: fail-fast: false + matrix: + config: + - name: Intel + OSX_ARCH: x86_64 + VCPKG_TRIPLET: x64-osx + + - name: Apple Silicon + OSX_ARCH: arm64 + VCPKG_TRIPLET: arm64-osx env: CMAKE_BUILD_TYPE: Release @@ -237,19 +246,54 @@ jobs: with: fetch-depth: 0 - - name: "Install dependencies" - run: | - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - brew install libebur128 taglib ffmpeg fmt inih cmake pkg-config || true + - name: Install Dependencies + run: brew install nasm automake autoconf-archive ninja + + - name: Setup vcpkg + uses: friendlyanon/setup-vcpkg@v1 + with: + committish: ${{env.VCPKG_COMMITTISH}} + cache-key: vcpkg-${{matrix.config.name}}-${{env.VCPKG_COMMITISH}} + cache-restore-keys: vcpkg-${{matrix.config.name}}-${{env.VCPKG_COMMITISH}} + + - name: Setup Overlays + uses: actions/checkout@v3 + with: + repository: complexlogic/vcpkg + ref: refs/heads/rsgain + path: build/overlays - name: Configure run: cmake -S . -B build - -DCMAKE_BUILD_TYPE=${{env.CMAKE_BUILD_TYPE}} - -DCMAKE_INSTALL_PREFIX=/usr + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_OSX_ARCHITECTURES=${{matrix.config.OSX_ARCH}} + -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" + -DVCPKG_OVERLAY_PORTS=build/overlays/ports + -DVCPKG_TARGET_TRIPLET=${{matrix.config.VCPKG_TRIPLET}} + -DVCPKG_MANIFEST_FEATURES="fmt;ffmpeg;libebur128;inih;" + -DSTRIP_BINARY=ON + -DPACKAGE=ZIP + -DCPACK_SYSTEM_NAME="macOS-${{matrix.config.OSX_ARCH}}" - name: Build run: | cmake \ --build build \ - --config ${{env.CMAKE_BUILD_TYPE}} - build/rsgain -v + --target package + + - name: Test + if: ${{matrix.config.OSX_ARCH == 'x86_64'}} + run: build/rsgain -v + + - name: Upload Package + uses: actions/upload-artifact@v3 + with: + name: macOS ${{matrix.config.name}} build + path: build/*.zip + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: build/*.zip + token: ${{secrets.ACTIONS_SECRET}} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 629177f..d5cb87d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -183,7 +183,7 @@ elseif (UNIX) install(FILES "${PROJECT_SOURCE_DIR}/docs/${EXECUTABLE_TITLE}.1" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man1") endif () install(DIRECTORY "${PROJECT_SOURCE_DIR}/config/presets" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/${EXECUTABLE_TITLE}") - if (PACKAGE STREQUAL "TXZ") + if (PACKAGE STREQUAL "TXZ" OR PACKAGE STREQUAL "ZIP") set(BINARY_PREFIX ".") set(PRESETS_PREFIX ".") else ()