Browse Source

CI: Add necessary build system changes for universal and M1 builds

PatTheMav 3 years ago
parent
commit
8fba906be4

+ 3 - 14
.github/workflows/flatpak.yml

@@ -21,7 +21,7 @@ jobs:
   publish:
     name: Publish to Flathub
     runs-on: [ubuntu-latest]
-    if: github.event_name == 'release'
+    if: "${{ github.event_name == 'release' && ( matrix.branch != 'stable' || (!contains(github.ref, '-beta') && !contains(github.ref, '-rc')) ) }}"
     env:
       FLATPAK_BUILD_PATH: flatpak_app/files/share
     container:
@@ -31,21 +31,13 @@ jobs:
       matrix:
         branch: [stable, beta]
     steps:
-      - name: Check if job should run
-        id: should_run
-        if: "${{ matrix.branch != 'stable' || (!contains(github.ref, '-beta') && !contains(github.ref, '-rc')) }}"
-        run: |
-          echo "::set-output name=should_run::yes"
-
       - name: Checkout
         uses: actions/[email protected]
-        if: steps.should_run.outputs.should_run == 'yes'
         with:
           submodules: 'recursive'
 
       - name: Build Flatpak Manifest
         uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@master
-        if: steps.should_run.outputs.should_run == 'yes'
         with:
           bundle: obs-studio-${{ github.sha }}.flatpak
           manifest-path: CI/flatpak/com.obsproject.Studio.json
@@ -56,26 +48,23 @@ jobs:
       - name: Validate AppStream
         shell: bash
         working-directory: ${{ env.FLATPAK_BUILD_PATH }}
-        if: steps.should_run.outputs.should_run == 'yes'
         run: |
           appstream-util validate appdata/com.obsproject.Studio.appdata.xml
 
       - name: Verify icon and metadata in app-info
         shell: bash
         working-directory: ${{ env.FLATPAK_BUILD_PATH }}
-        if: steps.should_run.outputs.should_run == 'yes'
         run: |
           test -f app-info/icons/flatpak/128x128/com.obsproject.Studio.png || { echo "Missing 128x128 icon in app-info" ; exit 1; }
           test -f app-info/xmls/com.obsproject.Studio.xml.gz || { echo "Missing com.obsproject.Studio.xml.gz in app-info" ; exit 1; }
 
       - name: Commit screenshots to the OSTree repository
-        if: steps.should_run.outputs.should_run == 'yes'
         run: |
           ostree commit --repo=repo --canonical-permissions --branch=screenshots/x86_64 flatpak_app/screenshots
 
       - name: Publish to Flathub Beta
         uses: bilelmoussaoui/flatpak-github-actions/flat-manager@v4
-        if: steps.should_run.outputs.should_run == 'yes' && matrix.branch == 'beta'
+        if: matrix.branch == 'beta'
         with:
           flat-manager-url: https://hub.flathub.org/
           repository: beta
@@ -83,7 +72,7 @@ jobs:
 
       - name: Publish to Flathub
         uses: bilelmoussaoui/flatpak-github-actions/flat-manager@v4
-        if: steps.should_run.outputs.should_run == 'yes' && matrix.branch == 'stable'
+        if: matrix.branch == 'stable'
         with:
           flat-manager-url: https://hub.flathub.org/
           repository: stable

+ 22 - 13
.github/workflows/main.yml

@@ -12,14 +12,22 @@ on:
     branches: [master]
 
 env:
+  CACHE_REVISION: '004'
   CEF_BUILD_VERSION_MAC: '4638'
+  CEF_HASH_MAC_X86_64: '2fe4cc39b1373b85086e4030dedd2a250d5dbbed8c2f8780002d6cd6214b6bc2'
+  CEF_HASH_MAC_ARM64: '27809aac427b9c97b0dadcab04371c5f8211f36c6f3e1caa00822de89c5ed249'
   CEF_BUILD_VERSION_LINUX: '4638'
   CEF_BUILD_VERSION_WIN: '4638'
   QT_VERSION_MAC: '5.15.2'
+  QT_HASH_MAC_X86_64: '35a58fee8dfd70d3d2dcc0ae0b77132c04a451c6f041a02dc41b207b375fc74b'
+  QT_HASH_MAC_ARM64: 'e99146b9c7775c245a2d22f2ef24fc111fccd71bad0f03b64db707124ffb8707'
   QT_VERSION_WIN: '5.15.2'
   DEPS_VERSION_MAC: '2022-02-13'
-  DEPS_VERSION_WIN: '2022-01-31'
+  DEPS_HASH_MAC_X86_64: '1a8715d66e664b857942deaded0dc46c4f6cd22e88f01ed1188f3bd3fcf632c4'
+  DEPS_HASH_MAC_ARM64: '2cfcaf05765400c696908f242aea87b6e1848e1a48cd3edc2eb7f8cb249c9d48'
+  DEPS_VERSION_WIN: '2022-03-16'
   VLC_VERSION_MAC: '3.0.8'
+  VLC_HASH_MAC: 'e0149ef4a20a19b9ecd87309c2d27787ee3f47dfd47c6639644bc1f6fd95bdf6'
   VLC_VERSION_WIN: '3.0.0-git'
   TWITCH_CLIENTID: ${{ secrets.TWITCH_CLIENT_ID }}
   TWITCH_HASH: ${{ secrets.TWITCH_HASH }}
@@ -60,11 +68,12 @@ jobs:
     runs-on: [macos-11]
     strategy:
       matrix:
-        arch: ['x86_64']
+        arch: ['x86_64', 'arm64']
     if: always()
     needs: [clang_check]
     env:
-      MACOSX_DEPLOYMENT_TARGET: '10.13'
+      MACOSX_DEPLOYMENT_TARGET_X86_64: '10.13'
+      MACOSX_DEPLOYMENT_TARGET_ARM64: '11.0'
       SPARKLE_VERSION: '1.26.0'
       SPARKLE_HASH: '8312cbf7528297a49f1b97692c33cb8d33254c396dc51be394e9484e4b6833a0'
       BLOCKED_FORMULAS: 'speexdsp curl php composer'
@@ -109,7 +118,7 @@ jobs:
           CACHE_NAME: 'cef-cache'
         with:
           path: ${{ github.workspace }}/obs-build-dependencies/cef_binary_${{ env.CEF_BUILD_VERSION_MAC }}_macos_${{ matrix.arch }}
-          key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.CEF_BUILD_VERSION_MAC }}-${{ matrix.arch }}
+          key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.CEF_BUILD_VERSION_MAC }}-${{ matrix.arch }}-${{ env.CACHE_REVISION }}
 
       - name: 'Restore VLC dependency from cache'
         id: vlc-cache
@@ -118,7 +127,7 @@ jobs:
           CACHE_NAME: 'vlc-cache'
         with:
           path: ${{ github.workspace }}/obs-build-dependencies/vlc-${{ env.VLC_VERSION_MAC }}
-          key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.VLC_VERSION_MAC }}
+          key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.VLC_VERSION_MAC }}-${{ env.CACHE_REVISION }}
 
       - name: 'Restore Sparkle dependency from cache'
         id: sparkle-cache
@@ -126,8 +135,8 @@ jobs:
         env:
           CACHE_NAME: 'sparkle-cache'
         with:
-          path: ${{ github.workspace }}/obs-build-dependencies/sparkle
-          key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.SPARKLE_VERSION }}
+          path: ${{ github.workspace }}/obs-build-dependencies/obs-deps/lib/Sparkle.framework
+          key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.SPARKLE_VERSION }}-${{ env.CACHE_REVISION }}
 
       - name: 'Setup build environment'
         run: |
@@ -166,13 +175,13 @@ jobs:
         run: CI/macos/02_build_obs.sh --codesign --architecture "${{ matrix.arch }}"
 
       - name: 'Run tests'
-        if: success()
+        if: ${{ success() && matrix.arch == 'x86_64' }}
         run: cmake --build build -t test
 
       - name: 'Create build artifact'
         if: ${{ success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
         run: |
-          CI/macos/03_package_obs.sh --codesign
+          CI/macos/03_package_obs.sh --codesign --architecture "${{ matrix.arch }}"
           ARTIFACT_NAME=$(basename $(/usr/bin/find build -type f -name "obs-studio-*.dmg" -depth 1 | head -1))
           echo "FILE_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
 
@@ -232,7 +241,7 @@ jobs:
           CACHE_NAME: 'cef-cache'
         with:
           path: ${{ github.workspace }}/obs-build-dependencies/cef_binary_${{ env.CEF_BUILD_VERSION_LINUX }}_linux64
-          key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.CEF_BUILD_VERSION_LINUX }}
+          key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.CEF_BUILD_VERSION_LINUX }}-${{ env.CACHE_REVISION }}
 
       - name: 'Install dependencies'
         env:
@@ -300,7 +309,7 @@ jobs:
           CACHE_NAME: 'vlc-cache'
         with:
           path: ${{ github.workspace }}/obs-build-dependencies/vlc-${{ env.VLC_VERSION_WIN }}
-          key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.VLC_VERSION_WIN }}
+          key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.VLC_VERSION_WIN }}-${{ env.CACHE_REVISION }}
 
       - name: 'Restore Chromium Embedded Framework from cache'
         id: cef-cache
@@ -309,7 +318,7 @@ jobs:
           CACHE_NAME: 'cef-cache'
         with:
           path: ${{ github.workspace }}/obs-build-dependencies/cef_binary_${{ env.CEF_BUILD_VERSION_WIN }}_windows${{ matrix.arch }}_minimal
-          key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.CEF_BUILD_VERSION_WIN }}
+          key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.CEF_BUILD_VERSION_WIN }}-${{ env.CACHE_REVISION }}
 
       - name: 'Install dependencies'
         env:
@@ -432,7 +441,7 @@ jobs:
     if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' }}
     strategy:
       matrix:
-        arch: ['x86_64']
+        arch: ['x86_64', 'arm64']
     defaults:
       run:
         shell: bash

+ 2 - 0
CI/build-macos.sh

@@ -65,6 +65,7 @@ print_usage() {
             "-h, --help                     : Print this help\n" \
             "-q, --quiet                    : Suppress most build process output\n" \
             "-v, --verbose                  : Enable more verbose build process output\n" \
+            "-a, --architecture             : Specify build architecture (default: x86_64, alternative: arm64)\n" \
             "-d, --skip-dependency-checks   : Skip dependency checks (default: off)\n" \
             "-b, --bundle                   : Create relocatable application bundle (default: off)\n" \
             "-p, --package                  : Create distributable disk image (default: off)\n" \
@@ -94,6 +95,7 @@ obs-build-main() {
             -h | --help ) print_usage; exit 0 ;;
             -q | --quiet ) export QUIET=TRUE; shift ;;
             -v | --verbose ) export VERBOSE=TRUE; shift ;;
+            -a | --architecture ) ARCH="${2}"; shift 2 ;;
             -d | --skip-dependency-checks ) SKIP_DEP_CHECKS=TRUE; shift ;;
             -p | --package ) PACKAGE=TRUE; shift ;;
             -c | --codesign ) CODESIGN=TRUE; shift ;;

+ 1 - 1
CI/flatpak/com.obsproject.Studio.json

@@ -416,7 +416,7 @@
       "config-opts": [
         "-DCMAKE_BUILD_TYPE=Release",
         "-DENABLE_WAYLAND=ON",
-        "-DENABLE_BROWSER_SOURCE=ON",
+        "-DENABLE_BROWSER=ON",
         "-DCEF_ROOT_DIR=/app/cef",
         "-DUSE_XDG=ON",
         "-DENABLE_ALSA=OFF",

+ 2 - 0
CI/include/Brewfile

@@ -3,3 +3,5 @@ brew "ccache"
 brew "ninja"
 brew "freetype"
 brew "cmocka"
+brew "swig"
+brew "coreutils"

+ 25 - 1
CI/include/build_support_macos.sh

@@ -11,11 +11,20 @@
 # Setup build environment
 WORKFLOW_CONTENT=$(/bin/cat "${CI_WORKFLOW}")
 CI_DEPS_VERSION=$(echo "${WORKFLOW_CONTENT}" | /usr/bin/sed -En "s/[ ]+DEPS_VERSION_MAC: '([0-9\-]+)'/\1/p")
+CI_DEPS_HASH_X86_64=$(echo "${WORKFLOW_CONTENT}" | /usr/bin/sed -En "s/[ ]+DEPS_HASH_MAC_X86_64: '([0-9a-f]+)'/\1/p")
+CI_DEPS_HASH_ARM64=$(echo "${WORKFLOW_CONTENT}" | /usr/bin/sed -En "s/[ ]+DEPS_HASH_MAC_ARM64: '([0-9a-f]+)'/\1/p")
 CI_VLC_VERSION=$(echo "${WORKFLOW_CONTENT}" | /usr/bin/sed -En "s/[ ]+VLC_VERSION_MAC: '([0-9\.]+)'/\1/p")
+CI_VLC_HASH=$(echo "${WORKFLOW_CONTENT}" | /usr/bin/sed -En "s/[ ]+VLC_HASH_MAC: '([0-9a-f]+)'/\1/p")
 CI_SPARKLE_VERSION=$(echo "${WORKFLOW_CONTENT}" | /usr/bin/sed -En "s/[ ]+SPARKLE_VERSION: '([0-9\.]+)'/\1/p")
+CI_SPARKLE_HASH=$(echo "${WORKFLOW_CONTENT}" | /usr/bin/sed -En "s/[ ]+SPARKLE_HASH: '([0-9a-f]+)'/\1/p")
 CI_QT_VERSION=$(echo "${WORKFLOW_CONTENT}" | /usr/bin/sed -En "s/[ ]+QT_VERSION_MAC: '([0-9\.]+)'/\1/p" | /usr/bin/head -1)
-CI_MACOSX_DEPLOYMENT_TARGET=$(echo "${WORKFLOW_CONTENT}" | /usr/bin/sed -En "s/[ ]+MACOSX_DEPLOYMENT_TARGET: '([0-9\.]+)'/\1/p")
+CI_QT_HASH_X86_64=$(echo "${WORKFLOW_CONTENT}" | /usr/bin/sed -En "s/[ ]+QT_HASH_MAC_X86_64: '([0-9a-f]+)'/\1/p")
+CI_QT_HASH_ARM64=$(echo "${WORKFLOW_CONTENT}" | /usr/bin/sed -En "s/[ ]+QT_HASH_MAC_ARM64: '([0-9a-f]+)'/\1/p")
+CI_MACOSX_DEPLOYMENT_TARGET_X86_64=$(echo "${WORKFLOW_CONTENT}" | /usr/bin/sed -En "s/[ ]+MACOSX_DEPLOYMENT_TARGET_X86_64: '([0-9\.]+)'/\1/p")
+CI_MACOSX_DEPLOYMENT_TARGET_ARM64=$(echo "${WORKFLOW_CONTENT}" | /usr/bin/sed -En "s/[ ]+MACOSX_DEPLOYMENT_TARGET_ARM64: '([0-9\.]+)'/\1/p")
 CI_MACOS_CEF_VERSION=$(echo "${WORKFLOW_CONTENT}" | /usr/bin/sed -En "s/[ ]+CEF_BUILD_VERSION_MAC: '([0-9]+)'/\1/p")
+CI_CEF_HASH_X86_64=$(echo "${WORKFLOW_CONTENT}" | /usr/bin/sed -En "s/[ ]+CEF_HASH_MAC_X86_64: '([0-9a-f]+)'/\1/p")
+CI_CEF_HASH_ARM64=$(echo "${WORKFLOW_CONTENT}" | /usr/bin/sed -En "s/[ ]+CEF_HASH_MAC_ARM64: '([0-9a-f]+)'/\1/p")
 
 MACOS_VERSION="$(/usr/bin/sw_vers -productVersion)"
 MACOS_MAJOR="$(echo ${MACOS_VERSION} | /usr/bin/cut -d '.' -f 1)"
@@ -37,6 +46,21 @@ fi
 
 ## DEFINE UTILITIES ##
 check_macos_version() {
+    ARCH="${ARCH:-${CURRENT_ARCH}}"
+    if [ "${ARCH}" = "x86_64" ]; then
+        CI_MACOSX_DEPLOYMENT_TARGET="${CI_MACOSX_DEPLOYMENT_TARGET_X86_64}"
+        CI_CEF_HASH="${CI_CEF_HASH_X86_64}"
+        CI_QT_HASH="${CI_QT_HASH_X86_64}"
+        CI_DEPS_HASH="${CI_DEPS_HASH_X86_64}"
+    elif [ "${ARCH}" = "arm64" ]; then
+        CI_MACOSX_DEPLOYMENT_TARGET="${CI_MACOSX_DEPLOYMENT_TARGET_ARM64}"
+        CI_CEF_HASH="${CI_CEF_HASH_ARM64}"
+        CI_QT_HASH="${CI_QT_HASH_ARM64}"
+        CI_DEPS_HASH="${CI_DEPS_HASH_ARM64}"
+    else
+        caught_error "Unsupported architecture '${ARCH}' provided"
+    fi
+
     step "Check macOS version..."
     MIN_VERSION=${MACOSX_DEPLOYMENT_TARGET:-${CI_MACOSX_DEPLOYMENT_TARGET}}
     MIN_MAJOR=$(echo ${MIN_VERSION} | /usr/bin/cut -d '.' -f 1)

+ 19 - 15
CI/macos/01_install_dependencies.sh

@@ -15,19 +15,22 @@ install_obs-deps() {
     status "Set up precompiled macOS OBS dependencies v${1}"
     ensure_dir "${DEPS_BUILD_DIR}"
     step "Download..."
-    ${CURLCMD:-curl} https://github.com/obsproject/obs-deps/releases/download/${1}/macos-deps-${1}.tar.gz
+    check_and_fetch "https://github.com/obsproject/obs-deps/releases/download/${1}/macos-deps-${1}-${ARCH:-x86_64}.tar.xz" "${2}"
+    mkdir -p obs-deps
     step "Unpack..."
-    /usr/bin/tar -xf "./macos-deps-${1}.tar.gz" -C /tmp
+    /usr/bin/tar -xf "./macos-deps-${1}-${ARCH:-x86_64}.tar.xz" -C ./obs-deps
+    /usr/bin/xattr -r -d com.apple.quarantine ./obs-deps
 }
 
 install_qt-deps() {
     status "Set up precompiled dependency Qt v${1}"
     ensure_dir "${DEPS_BUILD_DIR}"
     step "Download..."
-    ${CURLCMD:-curl} https://github.com/obsproject/obs-deps/releases/download/${2}/macos-qt-${1}-${2}.tar.gz
+    check_and_fetch "https://github.com/obsproject/obs-deps/releases/download/${1}/macos-deps-qt-${1}-${ARCH:-x86_64}.tar.xz" "${2}"
+    mkdir -p obs-deps
     step "Unpack..."
-    /usr/bin/tar -xf ./macos-qt-${1}-${2}.tar.gz -C /tmp
-    /usr/bin/xattr -r -d com.apple.quarantine /tmp/obsdeps
+    /usr/bin/tar -xf "./macos-deps-qt-${1}-${ARCH:-x86_64}.tar.xz" -C ./obs-deps
+    /usr/bin/xattr -r -d com.apple.quarantine ./obs-deps
 }
 
 install_vlc() {
@@ -58,16 +61,17 @@ install_sparkle() {
 
     if [ "${CI}" -a "${RESTORED_SPARKLE}" ]; then
         _SKIP=TRUE
-    elif [ -d "${DEPS_BUILD_DIR}/sparkle/Sparkle.framework" -a -f "${DEPS_BUILD_DIR}/sparkle/Sparkle.framework/Sparkle" ]; then
+    elif [ -d "${DEPS_BUILD_DIR}/obs-deps/Frameworks/Sparkle.framework" -a -f "${DEPS_BUILD_DIR}/obs-deps/Frameworks/Sparkle.framework/Sparkle" ]; then
         _SKIP=TRUE
     fi
 
     if [ -z "${_SKIP}" ]; then
         step "Download..."
-        ${CURLCMD:-curl} https://github.com/sparkle-project/Sparkle/releases/download/${1}/Sparkle-${1}.tar.xz
+        check_and_fetch "https://github.com/sparkle-project/Sparkle/releases/download/${1}/Sparkle-${1}.tar.xz" "${2}"
         step "Unpack..."
         ensure_dir "${DEPS_BUILD_DIR}/sparkle"
         /usr/bin/tar -xf ../Sparkle-${1}.tar.xz
+        cp -cpR "${DEPS_BUILD_DIR}"/sparkle/Sparkle.framework "${DEPS_BUILD_DIR}"/obs-deps/lib/
     else
         step "Found existing Sparkle Framework..."
     fi
@@ -86,14 +90,14 @@ install_cef() {
 
     if [ -z "${_SKIP}" ]; then
         step "Download..."
-        ${CURLCMD:-curl} https://cdn-fastly.obsproject.com/downloads/cef_binary_${1}_macos_${ARCH:-x86_64}.tar.xz
+        check_and_fetch "https://cdn-fastly.obsproject.com/downloads/cef_binary_${1}_macos_${ARCH:-x86_64}.tar.xz" "${2}"
         step "Unpack..."
         /usr/bin/tar -xf cef_binary_${1}_macos_${ARCH:-x86_64}.tar.xz
         cd cef_binary_${1}_macos_${ARCH:-x86_64}
         step "Fix tests..."
 
         /usr/bin/sed -i '.orig' '/add_subdirectory(tests\/ceftests)/d' ./CMakeLists.txt
-        /usr/bin/sed -E -i '' 's/"10.(9|10)"/"'${MACOSX_DEPLOYMENT_TARGET:-${CI_MACOSX_DEPLOYMENT_TARGET}}'"/' ./cmake/cef_variables.cmake
+        /usr/bin/sed -E -i '' 's/"10.(9|10|11)"/"'${MACOSX_DEPLOYMENT_TARGET:-${CI_MACOSX_DEPLOYMENT_TARGET}}'"/' ./cmake/cef_variables.cmake
 
         step "Run CMake..."
         check_ccache
@@ -120,11 +124,11 @@ install_dependencies() {
     trap "caught_error 'install_dependencies'" ERR
 
     BUILD_DEPS=(
-        "obs-deps ${MACOS_DEPS_VERSION:-${CI_DEPS_VERSION}}"
-        "qt-deps ${QT_VERSION:-${CI_QT_VERSION}} ${MACOS_DEPS_VERSION:-${CI_DEPS_VERSION}}"
-        "cef ${MACOS_CEF_BUILD_VERSION:-${CI_MACOS_CEF_VERSION}}"
-        "vlc ${VLC_VERSION:-${CI_VLC_VERSION}}"
-        "sparkle ${SPARKLE_VERSION:-${CI_SPARKLE_VERSION}}"
+        "obs-deps ${MACOS_DEPS_VERSION:-${CI_DEPS_VERSION}} ${MACOS_DEPS_HASH:-${CI_DEPS_HASH}}"
+        "qt-deps ${MACOS_DEPS_VERSION:-${CI_DEPS_VERSION}} ${QT_HASH:-${CI_QT_HASH}}"
+        "cef ${MACOS_CEF_BUILD_VERSION:-${CI_MACOS_CEF_VERSION}} ${CEF_HASH:-${CI_CEF_HASH}}"
+        "vlc ${VLC_VERSION:-${CI_VLC_VERSION}} ${VLC_HASH:-${CI_VLC_HASH}}"
+        "sparkle ${SPARKLE_VERSION:-${CI_SPARKLE_VERSION}} ${SPARKLE_HASH:-${CI_SPARKLE_HASH}}"
     )
 
     install_homebrew_deps
@@ -133,7 +137,7 @@ install_dependencies() {
         set -- ${DEPENDENCY}
         trap "caught_error ${DEPENDENCY}" ERR
         FUNC_NAME="install_${1}"
-        ${FUNC_NAME} ${2} ${3}
+        ${FUNC_NAME} ${2} ${3} ${4}
     done
 }
 

+ 9 - 2
CI/macos/02_build_obs.sh

@@ -65,10 +65,16 @@ _configure_obs() {
         GENERATOR="Ninja"
     fi
 
+    if [ "${CI}" -a "${ARCH}" = "x86_64" ]; then
+        UNITTEST_OPTIONS="-DENABLE_UNIT_TESTS=ON"
+    fi
+
     cmake -S . -B ${BUILD_DIR} -G ${GENERATOR} \
         -DCEF_ROOT_DIR="${DEPS_BUILD_DIR}/cef_binary_${MACOS_CEF_BUILD_VERSION:-${CI_MACOS_CEF_VERSION}}_macos_${ARCH:-x86_64}" \
+        -DENABLE_BROWSER=ON \
         -DVLC_PATH="${DEPS_BUILD_DIR}/vlc-${VLC_VERSION:-${CI_VLC_VERSION}}" \
-        -DCMAKE_PREFIX_PATH="/tmp/obsdeps;${DEPS_BUILD_DIR}/sparkle" \
+        -DENABLE_VLC=ON \
+        -DCMAKE_PREFIX_PATH="${DEPS_BUILD_DIR}/obs-deps" \
         -DBROWSER_LEGACY=$(test "${MACOS_CEF_BUILD_VERSION:-${CI_MACOS_CEF_VERSION}}" -le 3770 && echo "ON" || echo "OFF") \
         -DCMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-${CI_MACOSX_DEPLOYMENT_TARGET}} \
         -DCMAKE_OSX_ARCHITECTURES=${CMAKE_ARCHS} \
@@ -79,7 +85,8 @@ _configure_obs() {
         ${YOUTUBE_OPTIONS} \
         ${TWITCH_OPTIONS} \
         ${RESTREAM_OPTIONS} \
-        ${CI:+-DENABLE_UNIT_TESTS=ON -DBUILD_FOR_DISTRIBUTION=${BUILD_FOR_DISTRIBUTION} -DOBS_BUILD_NUMBER=${GITHUB_RUN_ID}} \
+        ${UNITTEST_OPTIONS} \
+        ${CI:+-DBUILD_FOR_DISTRIBUTION=${BUILD_FOR_DISTRIBUTION} -DOBS_BUILD_NUMBER=${GITHUB_RUN_ID}} \
         ${QUIET:+-Wno-deprecated -Wno-dev --log-level=ERROR}
 }
 

+ 3 - 1
CI/macos/03_package_obs.sh

@@ -116,8 +116,8 @@ package-obs-standalone() {
     source "${CHECKOUT_DIR}/CI/include/build_support.sh"
     source "${CHECKOUT_DIR}/CI/include/build_support_macos.sh"
 
-    check_macos_version
     check_archs
+    check_macos_version
 
     step "Fetch OBS tags..."
     /usr/bin/git fetch origin --tags
@@ -154,6 +154,7 @@ print_usage() {
             "-h, --help                     : Print this help\n" \
             "-q, --quiet                    : Suppress most build process output\n" \
             "-v, --verbose                  : Enable more verbose build process output\n" \
+            "-a, --architecture             : Specify build architecture (default: x86_64, alternative: arm64)\n" \
             "-c, --codesign                 : Codesign OBS and all libraries (default: ad-hoc only)\n" \
             "-n, --notarize                 : Notarize OBS (default: off)\n" \
             "--notarize-image [IMAGE]       : Specify existing OBS disk image for notarization\n" \
@@ -168,6 +169,7 @@ package-obs-main() {
                 -h | --help ) print_usage; exit 0 ;;
                 -q | --quiet ) export QUIET=TRUE; shift ;;
                 -v | --verbose ) export VERBOSE=TRUE; shift ;;
+                -a | --architecture ) ARCH="${2}"; shift 2 ;;
                 -c | --codesign ) CODESIGN=TRUE; shift ;;
                 -n | --notarize ) NOTARIZE=TRUE; CODESIGN=TRUE; shift ;;
                 --build-dir ) BUILD_DIR="${2}"; shift 2 ;;

+ 13 - 13
CI/windows/01_install_dependencies.ps1

@@ -26,16 +26,18 @@ Function Install-obs-deps {
     Write-Status "Setup for pre-built Windows OBS dependencies v${Version}"
     Ensure-Directory $DepsBuildDir
 
-    if (!(Test-Path "$DepsBuildDir/dependencies${Version}")) {
+    $ArchSuffix = "$(if ($BuildArch -eq "64-bit") { "x64" } else { "x86" })"
+
+    if (!(Test-Path "${DepsBuildDir}/windows-deps-${Version}-${ArchSuffix}")) {
 
         Write-Step "Download..."
         $ProgressPreference = $(if ($Quiet.isPresent) { "SilentlyContinue" } else { "Continue" })
-        Invoke-WebRequest -Uri "https://cdn-fastly.obsproject.com/downloads/dependencies${Version}.zip" -UseBasicParsing -OutFile "dependencies${Version}.zip"
+        Invoke-WebRequest -Uri "https://github.com/obsproject/obs-deps/releases/download/win-${Version}/windows-deps-${Version}-${ArchSuffix}.zip" -UseBasicParsing -OutFile "windows-deps-${Version}-${ArchSuffix}.zip"
         $ProgressPreference = "Continue"
 
         Write-Step "Unpack..."
 
-        Expand-Archive -Path "dependencies${Version}.zip"
+        Expand-Archive -Path "windows-deps-${Version}-${ArchSuffix}.zip" -DestinationPath "${DepsBuildDir}/windows-deps-${Version}-${ArchSuffix}" -Force
     } else {
         Write-Step "Found existing pre-built dependencies..."
     }
@@ -50,18 +52,18 @@ function Install-qt-deps {
     Write-Status "Setup for pre-built dependency Qt v${Version}"
     Ensure-Directory $DepsBuildDir
 
-    if (!(Test-Path "$DepsBuildDir/Qt_${Version}")) {
+    $ArchSuffix = "$(if ($BuildArch -eq "64-bit") { "x64" } else { "x86" })"
+
+    if (!(Test-Path "${DepsBuildDir}/windows-deps-${Version}-${ArchSuffix}/mkspecs")) {
 
         Write-Step "Download..."
         $ProgressPreference = $(if ($Quiet.isPresent) { 'SilentlyContinue' } else { 'Continue' })
-        Invoke-WebRequest -Uri "https://cdn-fastly.obsproject.com/downloads/Qt_${Version}.7z" -UseBasicParsing -OutFile "Qt_${Version}.7z"
+        Invoke-WebRequest -Uri "https://cdn-fastly.obsproject.com/downloads/windows-deps-qt-${Version}-${ArchSuffix}.zip" -UseBasicParsing -OutFile "windows-deps-qt-${Version}-${ArchSuffix}.zip"
         $ProgressPreference = "Continue"
         
         Write-Step "Unpack..."
 
-        # TODO: Replace with zip and properly package Qt to share directory with other deps
-        Invoke-Expression "7z x Qt_${Version}.7z"
-        Move-Item -Path "${Version}" -Destination "Qt_${Version}"
+        Expand-Archive -Path "windows-deps-qt-${Version}-${ArchSuffix}.zip" -DestinationPath "${DepsBuildDir}/windows-deps-${Version}-${ArchSuffix}" -Force
     } else {
         Write-Step "Found existing pre-built Qt..."
     }
@@ -108,7 +110,7 @@ function Install-cef {
         $ProgressPreference = "Continue"
 
         Write-Step "Unpack..."
-        Invoke-Expression "7z x cef_binary_${Version}_windows_${ArchSuffix}.zip"
+        Expand-Archive -Path "cef_binary_${Version}_windows_${ArchSuffix}.zip" -Force
     } else {
         Write-Step "Found existing CEF framework and loader library..."
     }
@@ -119,13 +121,11 @@ function Install-Dependencies {
         [String]$BuildArch = $(if (Test-Path variable:BuildArch) { "${BuildArch}" })
     )
 
-    if($Choco.isPresent) {
-        Install-Windows-Dependencies
-    }
+    Install-Windows-Dependencies
 
     $BuildDependencies = @(
         @('obs-deps', $WindowsDepsVersion),
-        @('qt-deps', $WindowsQtVersion),
+        @('qt-deps', $WindowsDepsVersion),
         @('vlc', $WindowsVlcVersion),
         @('cef', $WindowsCefVersion)
     )

+ 21 - 7
CI/windows/02_build_obs.ps1

@@ -27,6 +27,13 @@ function Build-OBS {
         [String]$BuildConfiguration = $(if (Test-Path variable:BuildConfiguration) { "${BuildConfiguration}" })
     )
 
+    $NumProcessors = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
+
+    if ( $NumProcessors -gt 1 ) {
+        $env:UseMultiToolTask = $true
+        $env:EnforceProcessCountAcrossBuilds = $true
+    }
+
     Write-Status "Build OBS"
 
     Configure-OBS
@@ -41,11 +48,16 @@ function Configure-OBS {
     Ensure-Directory ${CheckoutDir}
     Write-Status "Configuration of OBS build system..."
 
+    $NumProcessors = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
+
+    if ( $NumProcessors -gt 1 ) {
+        $env:UseMultiToolTask = $true
+        $env:EnforceProcessCountAcrossBuilds = $true
+    }
+
     # TODO: Clean up archive and directory naming across dependencies
-    $QtDirectory = "${CheckoutDir}/../obs-build-dependencies/Qt_${WindowsQtVersion}/msvc2019$(if (${BuildArch} -eq "64-bit") { "_64" })"
-    $DepsDirectory = "${CheckoutDir}/../obs-build-dependencies/dependencies${WindowsDepsVersion}/win$(if (${BuildArch} -eq "64-bit") { "64" } else { "32" })"
-    $CefDirectory = "${CheckoutDir}/../obs-build-dependencies/cef_binary_${WindowsCefVersion}_windows_$(if (${BuildArch} -eq "64-bit") { "x64" } else { "x86" })"
-    $CmakePrefixPath = "${QtDirectory};${DepsDirectory}/bin;${DepsDirectory}"
+    $CmakePrefixPath = Resolve-Path -Path "${CheckoutDir}/../obs-build-dependencies/windows-deps-${WindowsDepsVersion}-$(if (${BuildArch} -eq "64-bit") { "x64" } else { "x86" })"
+    $CefDirectory = Resolve-Path -Path "${CheckoutDir}/../obs-build-dependencies/cef_binary_${WindowsCefVersion}_windows_$(if (${BuildArch} -eq "64-bit") { "x64" } else { "x86" })"
     $BuildDirectoryActual = "${BuildDirectory}$(if (${BuildArch} -eq "64-bit") { "64" } else { "32" })"
     $GeneratorPlatform = "$(if (${BuildArch} -eq "64-bit") { "x64" } else { "Win32" })"
 
@@ -54,9 +66,11 @@ function Configure-OBS {
         "-G `"${CmakeGenerator}`"",
         "-DCMAKE_GENERATOR_PLATFORM=`"${GeneratorPlatform}`"",
         "-DCMAKE_SYSTEM_VERSION=`"${CmakeSystemVersion}`"",
-        "-DCMAKE_PREFIX_PATH=`"${CmakePrefixPath}`"",
-        "-DCEF_ROOT_DIR=`"${CefDirectory}`"",
-        "-DVLC_PATH=`"${CheckoutDir}/../obs-build-dependencies/vlc-${WindowsVlcVersion}`"",
+        "-DCMAKE_PREFIX_PATH:PATH=`"${CmakePrefixPath}`"",
+        "-DCEF_ROOT_DIR:PATH=`"${CefDirectory}`"",
+        "-DENABLE_BROWSER=ON",
+        "-DVLC_PATH:PATH=`"${CheckoutDir}/../obs-build-dependencies/vlc-${WindowsVlcVersion}`"",
+        "-DENABLE_VLC=ON",
         "-DCMAKE_INSTALL_PREFIX=`"${BuildDirectoryActual}/install`"",
         "-DVIRTUALCAM_GUID=`"${Env:VIRTUALCAM-GUID}`"",
         "-DTWITCH_CLIENTID=`"${Env:TWITCH_CLIENTID}`"",

+ 0 - 1
cmake/Modules/ObsDefaults_macOS.cmake

@@ -103,7 +103,6 @@ macro(setup_obs_project)
   endif()
 
   if(BUILD_FOR_DISTRIBUTION OR DEFINED ENV{CI})
-    set_option(CMAKE_PREFIX_PATH "/tmp/obsdeps")
     set_option(ENABLE_SPARKLE_UPDATER ON)
     set_option(ENABLE_RTMPS ON)
   endif()

+ 2 - 1
cmake/Modules/ObsHelpers_macOS.cmake

@@ -363,12 +363,13 @@ function(setup_obs_bundle target)
     COMPONENT obs_resources)
 
   if(ENABLE_SPARKLE_UPDATER)
+
     add_custom_command(
       TARGET ${target}
       POST_BUILD
       COMMAND
         /bin/sh -c
-        "plutil -replace SUFeedURL -string https://obsproject.com/osx_update/stable/updates.xml \"$<TARGET_BUNDLE_CONTENT_DIR:${target}>/Info.plist\""
+        "plutil -replace SUFeedURL -string https://obsproject.com/osx_update/stable/updates_${CMAKE_OSX_ARCHITECTURES}.xml \"$<TARGET_BUNDLE_CONTENT_DIR:${target}>/Info.plist\""
       VERBATIM)
 
     add_custom_command(

+ 1 - 1
cmake/bundle/macOS/Info.plist.in

@@ -21,7 +21,7 @@
 	<key>NSHighResolutionCapable</key>
 	<true/>
 	<key>LSMinimumSystemVersion</key>
-	<string>10.13</string>
+	<string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string>
 	<key>LSAppNapIsDisabled</key>
 	<true/>
 	<key>NSCameraUsageDescription</key>

+ 1 - 1
cmake/bundle/macOS/Plugin-Info.plist.in

@@ -21,7 +21,7 @@
 		<string>MacOSX</string>
 	</array>
 	<key>LSMinimumSystemVersion</key>
-	<string>10.13</string>
+	<string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string>
 	<key>NSHumanReadableCopyright</key>
 	<string>(c) 2012-${CURRENT_YEAR} Hugh Bailey</string>
 </dict>

+ 3 - 1
cmake/bundle/macOS/Virtualcam-Info.plist.in

@@ -21,7 +21,9 @@
 		<string>MacOSX</string>
 	</array>
 	<key>LSMinimumSystemVersion</key>
-	<string>10.13</string>
+	<string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string>
+	<key>NSHumanReadableCopyright</key>
+	<string>(c) 2012-${CURRENT_YEAR} Hugh Bailey</string>
 	<key>CFPlugInFactories</key>
 	<dict>
 		<key>7E950B8C-5E49-4B9E-B7D0-B3608A08E8F6</key>

+ 12 - 0
cmake/bundle/macOS/bundleutils.cmake

@@ -9,9 +9,21 @@ if(POLICY CMP0011)
 endif()
 
 # Add additional search paths for dylibbundler
+list(APPEND _FIXUP_BUNDLES
+     "-s \"${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/Frameworks\"")
 list(APPEND _FIXUP_BUNDLES "-s \"${CMAKE_INSTALL_PREFIX}/lib\"")
 list(APPEND _FIXUP_BUNDLES "-s \"${CMAKE_INSTALL_PREFIX}/Frameworks\"")
 
+foreach(_PREFIX_PATH IN LISTS _DEPENDENCY_PREFIX)
+  list(APPEND _FIXUP_BUNDLES "-s \"${_PREFIX_PATH}/lib\"")
+  file(GLOB _DYLIBS "${_PREFIX_PATH}/lib/*.dylib")
+  file(
+    COPY ${_DYLIBS}
+    DESTINATION ${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/Frameworks
+    FOLLOW_SYMLINK_CHAIN)
+  unset(_DYLIBS)
+endforeach()
+
 # Unlinked modules need to be supplied manually to dylibbundler
 
 # Find all modules (plugin and standalone)