cmake: Improve build system with additional features and options

- Moved all auto-dependencies to a uniform subdirectory for easier caching and cleanup.
- Add an option to download or specify a path for libOBS+obs-frontend-api.
- Remove the dependency on the non-standard obs-frontend-apiConfig.cmake file.
- Add an option to download or specify a path for OBS Dependencies.
- Add an option to download or specify a path for Qt.
- Add an option to download or specify a path for AOM.
- Fix and improve architecture and platform detection.
- Fix some messages having two :, or no prefix at all.
- Fix detection of obs-frontend-api.
- Fix applying custom compiler and linker flags for MSVC and GNU-style builds.
- Use target_compile_options over add_compile_options for compatibility.
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2022-05-10 19:29:58 +02:00
parent 56f2ae4290
commit f160580794
5 changed files with 495 additions and 497 deletions

View file

@ -1,27 +1,14 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL" name: "CodeQL"
on: on:
push: push:
branches: branches:
- 'master'
tags:
- '*' - '*'
- '!i18n_master'
- '!l10n_master'
pull_request: pull_request:
# The branches below must be a subset of the branches above branches:
branches: [ master ] - '*'
schedule:
- cron: '37 20 * * 4'
env: env:
OBS_VERSION: "27.0.0-ci" OBS_VERSION: "27.0.0-ci"
@ -88,20 +75,18 @@ jobs:
cmake \ cmake \
ninja-build \ ninja-build \
git \ git \
gcc-9 g++9 \
qt5-default libqwt-qt5-dev libqt5svg5-dev \ qt5-default libqwt-qt5-dev libqt5svg5-dev \
libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev \ libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev \
libcurl4-openssl-dev libcurl4-openssl-dev
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 800 --slave /usr/bin/g++ g++ /usr/bin/g++-9 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 800 --slave /usr/bin/g++ g++ /usr/bin/g++-9
- name: "libobs: Cache" - name: "Dependencies: Cache"
if: ${{ github.event_name != 'pull_request' }}
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: | path: |
build/temp/libobs-download build/temp/autodeps
build/temp/libobs-build key: autodeps-${{ matrix.id }}-${{ env.CACHE_VERSION }}
build/temp/libobs-src
key: libobs-codeql-${{ env.OBS_VERSION }}-${{ env.DOWNLOAD_OBS_HASH }}-${{ secrets.CACHE_VERSION }}
- name: "StreamFX: Configure" - name: "StreamFX: Configure"
shell: bash shell: bash
@ -110,11 +95,8 @@ jobs:
-DCMAKE_VERBOSE_MAKEFILE=ON \ -DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX="build/distrib" \ -DCMAKE_INSTALL_PREFIX="build/distrib" \
-DENABLE_FILTER_NVIDIA_FACE_TRACKING=FALSE \
-DPACKAGE_NAME="streamfx-${{ matrix.id }}" \ -DPACKAGE_NAME="streamfx-${{ matrix.id }}" \
-DPACKAGE_PREFIX="build/package" \ -DPACKAGE_PREFIX="build/package"
-DDOWNLOAD_OBS_URL="https://github.com/Xaymar/obs-studio/releases/download/${{ env.OBS_VERSION }}/obs-studio-x64-0.0.0.0-ubuntu-x86-64.7z" \
-DDOWNLOAD_OBS_HASH="SHA256=0AF6C7262C37D80C24CB18523A851FD765C04E766D8EB0F4AC0F6E75D13A035F"
- name: "StreamFX: Build" - name: "StreamFX: Build"
shell: bash shell: bash

View file

@ -11,9 +11,7 @@ on:
- '*' - '*'
env: env:
QT_VERSION: "5.15.2" CACHE_VERSION: 1
OBS_VERSION: "27.0.0-ci"
OBSDEPS_VERSION: "27.0.0"
LIBAOM_VERSION: "3.2.0.0" LIBAOM_VERSION: "3.2.0.0"
jobs: jobs:
@ -41,48 +39,15 @@ jobs:
with: with:
submodules: recursive submodules: recursive
fetch-depth: 0 fetch-depth: 0
- name: "libobs: Cache"
- name: "Dependencies: Cache"
if: ${{ github.event_name != 'pull_request' }} if: ${{ github.event_name != 'pull_request' }}
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: | path: |
build/temp/libobs-download build/temp/autodeps
build/temp/libobs-build key: autodeps-${{ matrix.id }}-${{ env.CACHE_VERSION }}
build/temp/libobs-src
key: libobs-${{ matrix.id }}-${{ env.OBS_VERSION }}-${{ env.DOWNLOAD_OBS_HASH }}-${{ secrets.CACHE_VERSION }}
- name: "obsdeps: Cache"
if: ${{ github.event_name != 'pull_request' }}
uses: actions/cache@v2
with:
path: |
build/temp/obsdeps-download
build/temp/obsdeps-build
build/temp/obsdeps-src
key: obsdeps-${{ matrix.id }}-${{ env.OBSDEPS_VERSION }}-${{ env.DOWNLOAD_OBSDEPS_HASH }}-${{ secrets.CACHE_VERSION }}
- name: "qt: Cache"
if: ${{ github.event_name != 'pull_request' }}
uses: actions/cache@v2
with:
path: |
build/temp/qt-download
build/temp/qt-build
build/temp/qt-src
key: qt-${{ matrix.id }}-${{ env.OBSDEPS_VERSION }}-${{ env.QT_VERSION }}-${{ secrets.CACHE_VERSION }}
- name: "libaom: Cache"
if: ${{ github.event_name != 'pull_request' }}
uses: actions/cache@v2
id: libaom-cache
with:
path: |
build/libaom
key: libaom-${{ matrix.id }}-${{ env.LIBAOM_VERSION }}-${{ secrets.CACHE_VERSION }}
- name: "libaom: Install"
if: ${{ steps.libaom-cache.outputs.cache-hit != 'true' }}
id: libaom-install
shell: bash
run: |
curl -L -o "aom.7z" "https://github.com/Xaymar/aom/releases/download/v${{ env.LIBAOM_VERSION }}/aom-windows-64-shared.7z"
7z x -y -o"build/libaom/" "aom.7z"
- name: "Code Signing" - name: "Code Signing"
if: ${{ github.event_name != 'pull_request' }} if: ${{ github.event_name != 'pull_request' }}
id: codesign id: codesign
@ -91,6 +56,7 @@ jobs:
# Restore the Certificate back into a file. # Restore the Certificate back into a file.
echo "${{ secrets.CODESIGN_CERT_WIN }}" | base64 --decode > "${{ github.workspace }}/cert.pfx" echo "${{ secrets.CODESIGN_CERT_WIN }}" | base64 --decode > "${{ github.workspace }}/cert.pfx"
echo "::set-output name=cmake_args::-DENABLE_CODESIGN=ON -DCODESIGN_TIMESTAMPS=ON" echo "::set-output name=cmake_args::-DENABLE_CODESIGN=ON -DCODESIGN_TIMESTAMPS=ON"
- name: "StreamFX: Configure" - name: "StreamFX: Configure"
shell: bash shell: bash
env: env:
@ -103,28 +69,25 @@ jobs:
-DCMAKE_INSTALL_PREFIX="build/distrib" \ -DCMAKE_INSTALL_PREFIX="build/distrib" \
-DPACKAGE_NAME="streamfx-${{ matrix.id }}" \ -DPACKAGE_NAME="streamfx-${{ matrix.id }}" \
-DPACKAGE_PREFIX="build/package" \ -DPACKAGE_PREFIX="build/package" \
-DDOWNLOAD_OBS_URL="https://github.com/Xaymar/obs-studio/releases/download/${{ env.OBS_VERSION }}/obs-studio-x64-0.0.0.0-windows-x86-64.7z" \
-DDOWNLOAD_OBS_HASH="SHA256=EBF9853C8A553E16ECBCA22523F401E6CF1EB2E8DA93F1493FEF41D65BD06633" \
-DDOWNLOAD_OBSDEPS_URL="https://github.com/Xaymar/obs-studio/releases/download/${{ env.OBSDEPS_VERSION }}/deps-windows-x86.7z" \
-DDOWNLOAD_OBSDEPS_HASH="SHA256=B4AED165016F0B64A7E8B256CCC12EAF8AF087F61B0B239B9D3D00277485B5B5" \
-DDOWNLOAD_QT=ON \
-DDOWNLOAD_QT_URL="https://github.com/Xaymar/obs-studio/releases/download/${{ env.OBSDEPS_VERSION }}/qt-${{ env.QT_VERSION }}-windows-x86-64.7z" \
-DDOWNLOAD_QT_HASH="SHA256=109B9C21EF165B0C46DFAA9AD23124F2070ED4D74207C4AFB308183CB8D43BDD" \
-DAOM_PATH="build/libaom/" -DAOM_PATH="build/libaom/"
- name: "StreamFX: Build" - name: "StreamFX: Build"
shell: bash shell: bash
run: | run: |
cmake --build "build/temp" --config RelWithDebInfo --target INSTALL cmake --build "build/temp" --config RelWithDebInfo --target INSTALL
- name: "StreamFX: Package (Install Prerequisites)" - name: "StreamFX: Package (Install Prerequisites)"
run: | run: |
curl "-kL" "https://cdn.xaymar.com/ci/innosetup-6.1.2.exe" "-f" "--retry" "5" "-o" "inno.exe" curl "-kL" "https://cdn.xaymar.com/ci/innosetup-6.1.2.exe" "-f" "--retry" "5" "-o" "inno.exe"
.\inno.exe /VERYSILENT /SP- /SUPPRESSMSGBOXES /NORESTART .\inno.exe /VERYSILENT /SP- /SUPPRESSMSGBOXES /NORESTART
- name: "StreamFX: Package" - name: "StreamFX: Package"
shell: bash shell: bash
run: | run: |
mkdir build/package mkdir build/package
cmake --build "build/temp" --config RelWithDebInfo --target PACKAGE_7Z cmake --build "build/temp" --config RelWithDebInfo --target PACKAGE_7Z
cmake --build "build/temp" --config RelWithDebInfo --target PACKAGE_ZIP cmake --build "build/temp" --config RelWithDebInfo --target PACKAGE_ZIP
- name: "StreamFX: Signed Installer Preparation" - name: "StreamFX: Signed Installer Preparation"
if: ${{ github.event_name != 'pull_request' }} if: ${{ github.event_name != 'pull_request' }}
id: codesign_install id: codesign_install
@ -134,11 +97,13 @@ jobs:
signtool=$(awk 'match($0, /^;signtool=(.+)$/, ary) {print ary[1]}' "${{ github.workspace }}/build/temp/installer.iss") signtool=$(awk 'match($0, /^;signtool=(.+)$/, ary) {print ary[1]}' "${{ github.workspace }}/build/temp/installer.iss")
echo "::set-output name=iscc_signtool::${signtool}" echo "::set-output name=iscc_signtool::${signtool}"
fi fi
- name: "StreamFX: Package Installer" - name: "StreamFX: Package Installer"
shell: cmd shell: cmd
run: | run: |
echo '"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /V10 "/Ssigntool=${{ steps.codesign_install.outputs.iscc_signtool }} $p" ".\build\temp\installer.iss"' echo '"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /V10 "/Ssigntool=${{ steps.codesign_install.outputs.iscc_signtool }} $p" ".\build\temp\installer.iss"'
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /V10 "/Ssigntool=${{ steps.codesign_install.outputs.iscc_signtool }} $p" ".\build\temp\installer.iss" "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /V10 "/Ssigntool=${{ steps.codesign_install.outputs.iscc_signtool }} $p" ".\build\temp\installer.iss"
- name: "Artifacts" - name: "Artifacts"
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
with: with:
@ -178,6 +143,7 @@ jobs:
with: with:
submodules: recursive submodules: recursive
fetch-depth: 0 fetch-depth: 0
- name: "Prerequisites: Apt-Get" - name: "Prerequisites: Apt-Get"
shell: bash shell: bash
run: | run: |
@ -195,36 +161,36 @@ jobs:
libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev \ libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev \
libcurl4-openssl-dev libcurl4-openssl-dev
${{ matrix.extra_command }} ${{ matrix.extra_command }}
- name: "libobs: Cache"
- name: "Dependencies: Cache"
if: ${{ github.event_name != 'pull_request' }} if: ${{ github.event_name != 'pull_request' }}
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: | path: |
build/temp/libobs-download build/temp/autodeps
build/temp/libobs-build key: autodeps-${{ matrix.id }}-${{ env.CACHE_VERSION }}
build/temp/libobs-src
key: libobs-${{ matrix.id }}-${{ env.OBS_VERSION }}-${{ env.DOWNLOAD_OBS_HASH }}-${{ secrets.CACHE_VERSION }}
- name: "StreamFX: Configure" - name: "StreamFX: Configure"
shell: bash shell: bash
run: | run: |
cmake -H. -B"build/temp" \ cmake -H. -B"build/temp" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX="build/distrib" \ -DCMAKE_INSTALL_PREFIX="build/distrib" \
-DENABLE_FILTER_NVIDIA_FACE_TRACKING=FALSE \
-DPACKAGE_NAME="streamfx-${{ matrix.id }}" \ -DPACKAGE_NAME="streamfx-${{ matrix.id }}" \
-DPACKAGE_PREFIX="build/package" \ -DPACKAGE_PREFIX="build/package"
-DDOWNLOAD_OBS_URL="https://github.com/Xaymar/obs-studio/releases/download/${{ env.OBS_VERSION }}/obs-studio-x64-0.0.0.0-ubuntu-x86-64.7z" \
-DDOWNLOAD_OBS_HASH="SHA256=0AF6C7262C37D80C24CB18523A851FD765C04E766D8EB0F4AC0F6E75D13A035F"
- name: "StreamFX: Build" - name: "StreamFX: Build"
shell: bash shell: bash
run: | run: |
cmake --build "build/temp" --config RelWithDebInfo --target install cmake --build "build/temp" --config RelWithDebInfo --target install
- name: "StreamFX: Package" - name: "StreamFX: Package"
shell: bash shell: bash
run: | run: |
mkdir build/package mkdir build/package
cmake --build "build/temp" --config RelWithDebInfo --target PACKAGE_7Z cmake --build "build/temp" --config RelWithDebInfo --target PACKAGE_7Z
cmake --build "build/temp" --config RelWithDebInfo --target PACKAGE_ZIP cmake --build "build/temp" --config RelWithDebInfo --target PACKAGE_ZIP
- name: "Artifacts" - name: "Artifacts"
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
with: with:
@ -251,42 +217,15 @@ jobs:
with: with:
submodules: recursive submodules: recursive
fetch-depth: 0 fetch-depth: 0
- name: "libobs: Cache"
- name: "Dependencies: Cache"
if: ${{ github.event_name != 'pull_request' }} if: ${{ github.event_name != 'pull_request' }}
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: | path: |
build/temp/libobs-download build/temp/autodeps
build/temp/libobs-build key: autodeps-${{ matrix.id }}-${{ env.CACHE_VERSION }}
build/temp/libobs-src
key: libobs-${{ matrix.id }}-${{ env.OBS_VERSION }}-${{ env.DOWNLOAD_OBS_HASH }}-${{ secrets.CACHE_VERSION }}
- name: "obsdeps: Cache"
if: ${{ github.event_name != 'pull_request' }}
uses: actions/cache@v2
with:
path: |
build/temp/obsdeps-download
build/temp/obsdeps-build
build/temp/obsdeps-src
key: obsdeps-${{ matrix.id }}-${{ env.OBSDEPS_VERSION }}-${{ env.DOWNLOAD_OBSDEPS_HASH }}-${{ secrets.CACHE_VERSION }}
- name: "qt: Cache"
if: ${{ github.event_name != 'pull_request' }}
uses: actions/cache@v2
id: qt-cache
with:
path: |
/usr/local/Cellar/qt@5
key: qt-${{ matrix.id }}-${{ env.QT_VERSION }}-${{ secrets.CACHE_VERSION }}
- name: "qt: Install"
if: ${{ (github.event_name == 'pull_request') || (steps.qt-cache.outputs.cache-hit != 'true') }}
shell: bash
run: |
brew install qt@5
- name: "qt: Link"
if: ${{ (github.event_name != 'pull_request') && (steps.qt-cache.outputs.cache-hit != 'false') }}
shell: bash
run: |
brew link qt@5
- name: "StreamFX: Configure" - name: "StreamFX: Configure"
shell: bash shell: bash
run: | run: |
@ -294,22 +233,20 @@ jobs:
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX="build/distrib" \ -DCMAKE_INSTALL_PREFIX="build/distrib" \
-DPACKAGE_NAME="streamfx-${{ matrix.id }}" \ -DPACKAGE_NAME="streamfx-${{ matrix.id }}" \
-DPACKAGE_PREFIX="build/package" \ -DPACKAGE_PREFIX="build/package"
-DQt5_DIR="/usr/local/opt/qt@5/lib/cmake/Qt5/" \
-DDOWNLOAD_OBS_URL="https://github.com/Xaymar/obs-studio/releases/download/${{ env.OBS_VERSION }}/obs-studio-x64-0.0.0.0-macos-x86-64.7z" \
-DDOWNLOAD_OBS_HASH="SHA256=F15BC4CA8EB3F581A94372759CFE554E30D202B604B541445A5756B878E4E799" \
-DDOWNLOAD_OBSDEPS_URL="https://github.com/Xaymar/obs-studio/releases/download/${{ env.OBSDEPS_VERSION }}/deps-macos-x86_64-2021-03-25.tar.gz" \
-DDOWNLOAD_OBSDEPS_HASH="SHA256=1C409374BCAB9D5CEEAFC121AA327E13AB222096718AF62F2648302DF62898D6"
- name: "StreamFX: Build" - name: "StreamFX: Build"
shell: bash shell: bash
run: | run: |
cmake --build "build/temp" --config RelWithDebInfo --target install cmake --build "build/temp" --config RelWithDebInfo --target install
- name: "StreamFX: Package" - name: "StreamFX: Package"
shell: bash shell: bash
run: | run: |
mkdir build/package mkdir build/package
cmake --build "build/temp" --config RelWithDebInfo --target PACKAGE_7Z cmake --build "build/temp" --config RelWithDebInfo --target PACKAGE_7Z
cmake --build "build/temp" --config RelWithDebInfo --target PACKAGE_ZIP cmake --build "build/temp" --config RelWithDebInfo --target PACKAGE_ZIP
- name: 'Packages: Install' - name: 'Packages: Install'
shell: bash shell: bash
run: | run: |
@ -317,10 +254,12 @@ jobs:
sudo hdiutil attach ./Packages.dmg sudo hdiutil attach ./Packages.dmg
pushd /Volumes/Packages* pushd /Volumes/Packages*
sudo installer -pkg ./Install\ Packages.pkg -target / sudo installer -pkg ./Install\ Packages.pkg -target /
- name: "Packages: Package" - name: "Packages: Package"
shell: bash shell: bash
run: | run: |
packagesbuild ./build/temp/installer.pkgproj packagesbuild ./build/temp/installer.pkgproj
- name: "Artifacts" - name: "Artifacts"
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
with: with:

View file

@ -8,6 +8,9 @@ on:
tags: tags:
- '*' - '*'
env:
CACHE_VERSION: 1
jobs: jobs:
clang-format: clang-format:
name: "clang-format" name: "clang-format"
@ -17,38 +20,53 @@ jobs:
CXX: clang++ CXX: clang++
CMAKE_GENERATOR: "Ninja" CMAKE_GENERATOR: "Ninja"
steps: steps:
- name: "Clone Repository" - name: "Clone"
uses: actions/checkout@v1 uses: actions/checkout@v2
- name: "Submodules & Packages" with:
submodules: recursive
fetch-depth: 0
- name: "Prerequisites: Apt-Get"
shell: bash shell: bash
run: | run: |
git submodule update --init --recursive
sudo apt-get -qq update sudo apt-get -qq update
sudo apt-get purge libjpeg9-dev:amd64 libjpeg8-dev:amd64 libjpeg-turbo8-dev:amd64 sudo apt-get purge libjpeg9-dev:amd64 libjpeg8-dev:amd64 libjpeg-turbo8-dev:amd64
sudo apt-get install \ sudo apt-get install \
build-essential \ build-essential \
checkinstall \
pkg-config \
cmake \ cmake \
ninja-build \ ninja-build \
git \ git \
${{ matrix.packages }} \
qt5-default libqwt-qt5-dev libqt5svg5-dev \ qt5-default libqwt-qt5-dev libqt5svg5-dev \
libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev \ libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev \
libcurl4-openssl-dev \ libcurl4-openssl-dev
checkinstall pkg-config
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
- name: "Cache: Prerequisites"
- name: "Dependencies: Cache"
if: ${{ github.event_name != 'pull_request' }}
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: | path: |
build/temp/libobs-download/libobs-download-prefix/src/libobs.7z build/temp/autodeps
key: ubuntu-20.04 key: autodeps-${{ matrix.id }}-${{ env.CACHE_VERSION }}
- name: "Configure & Format Project"
- name: "StreamFX: Configure"
shell: bash shell: bash
run: | run: |
cmake -H. -B"build/temp" \ cmake -H. -B"build/temp" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX="build/distrib" \ -DCMAKE_INSTALL_PREFIX="build/distrib" \
-DCMAKE_PACKAGE_NAME="streamfx-${{ matrix.id }}" -DCMAKE_PACKAGE_PREFIX="build/package" \ -DCMAKE_PACKAGE_NAME="streamfx-${{ matrix.id }}" \
-DENABLE_CLANG=TRUE -DENABLE_FILTER_NVIDIA_FACE_TRACKING=FALSE -DCMAKE_PACKAGE_PREFIX="build/package" \
-DENABLE_CLANG=TRUE
- name: "StreamFX: Format"
shell: bash
run: |
cmake --build "build/temp" --config RelWithDebInfo --target StreamFX_CLANG-FORMAT cmake --build "build/temp" --config RelWithDebInfo --target StreamFX_CLANG-FORMAT
- name: "Validate Formatting" - name: "Validate Formatting"
shell: bash shell: bash
run: | run: |

View file

@ -176,7 +176,6 @@ set(CMAKE_MODULE_PATH
) )
# Include # Include
include("Architecture") # Architecture Detection
include("util") # CacheClear, CacheSet include("util") # CacheClear, CacheSet
include("DownloadProject") # DownloadProject include("DownloadProject") # DownloadProject
@ -201,71 +200,56 @@ else()
endif() endif()
# Architecture # Architecture
set(D_PLATFORM_INSTR ${ARCH_INST}) set(ARCH_INSTR_32 "i386;i686;x86;arm;ARM")
if(ARCH_INST STREQUAL "x86") set(ARCH_INSTR_64 "x86_64;AMD64;IA64;arm64;ARM64")
set(ARCH_INSTR_X86 "i386;i686;x86;x86_64;AMD64")
set(ARCH_INSTR_ARM "arm;ARM;arm64;ARM64")
set(ARCH_INSTR_ITANIUM "IA64")
set(ARCH_BITS 0)
set(ARCH_BITS_POINTER 0)
set(ARCH_INST "")
# - Bitness
list(FIND ARCH_INSTR_32 "${CMAKE_SYSTEM_PROCESSOR}" FOUND)
if(FOUND GREATER -1)
set(ARCH_BITS 32)
endif()
list(FIND ARCH_INSTR_64 "${CMAKE_SYSTEM_PROCESSOR}" FOUND)
if(FOUND GREATER -1)
set(ARCH_BITS 64)
endif()
set(D_PLATFORM_BITS ${ARCH_BITS})
# - Pointer Size (bits)
math(EXPR ARCH_BITS_POINTER "8*${CMAKE_SIZEOF_VOID_P}")
set(D_PLATFORM_BITS_PTR ${ARCH_BITS_POINTER})
# - Basic Instruction Set
list(FIND ARCH_INSTR_X86 "${CMAKE_SYSTEM_PROCESSOR}" FOUND)
if(FOUND GREATER -1)
list(APPEND ARCH_INST "x86")
set(D_PLATFORM_INSTR_X86 ON) set(D_PLATFORM_INSTR_X86 ON)
set(D_PLATFORM_ARCH_X86 ON) set(D_PLATFORM_ARCH_X86 ON)
elseif(ARCH_INST STREQUAL "ARM") endif()
list(FIND ARCH_INSTR_ARM "${CMAKE_SYSTEM_PROCESSOR}" FOUND)
if(FOUND GREATER -1)
list(APPEND ARCH_INST "ARM")
set(D_PLATFORM_INSTR_ARM ON) set(D_PLATFORM_INSTR_ARM ON)
set(D_PLATFORM_ARCH_ARM ON) set(D_PLATFORM_ARCH_ARM ON)
elseif(ARCH_INST STREQUAL "IA64") endif()
list(FIND ARCH_INSTR_ITANIUM "${CMAKE_SYSTEM_PROCESSOR}" FOUND)
if(FOUND GREATER -1)
list(APPEND ARCH_INST "Itanium")
set(D_PLATFORM_INSTR_ITANIUM ON) set(D_PLATFORM_INSTR_ITANIUM ON)
set(D_PLATFORM_ARCH_ITANIUM ON) set(D_PLATFORM_ARCH_ITANIUM ON)
endif() endif()
set(D_PLATFORM_INSTR ${ARCH_INST})
set(D_PLATFORM_ARCH ${ARCH_INST}) set(D_PLATFORM_ARCH ${ARCH_INST})
message(STATUS "${LOGPREFIX} Taget is ${D_PLATFORM_BITS}bit ${ARCH_INST} with a pointer size of ${D_PLATFORM_BITS_PTR}bit.")
# Bitness
set(D_PLATFORM_BITS ${ARCH_BITS})
set(D_PLATFORM_BITS_PTR ${ARCH_BITS_POINTER})
################################################################################
# C/C++ Compiler Adjustments
################################################################################
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
message(STATUS "Applying custom flags for MSVC style build.")
# MSVC/ClangCL
# - Dynamically link Microsoft C/C++ Redistributable.
# - Enable /W3 and disable useless warnings.
# - Enable C++ exceptions with SEH exceptions.
# - Enable multi-processor compiling.
# Build with dynamic MSVC linkage.
add_compile_options(
$<$<CONFIG:>:/MD>
$<$<CONFIG:Debug>:/MDd>
$<$<CONFIG:Release>:/MD>
$<$<CONFIG:RelWithDebInfo>:/MD>
$<$<CONFIG:MinSizeRel>:/MD>
)
# Enable most useful warnings.
set(DISABLED_WARNINGS
"/wd4061" "/wd4100" "/wd4180" "/wd4201" "/wd4464" "/wd4505" "/wd4514"
"/wd4571" "/wd4623" "/wd4625" "/wd4626" "/wd4668" "/wd4710" "/wd4774"
"/wd4820" "/wd5026" "/wd5027" "/wd5039" "/wd5045" "/wd26812"
)
add_compile_options("/W3")
foreach(WARN ${DISABLED_WARNINGS})
add_compile_options("${WARN}")
endforeach()
# C++ Exceptions & SEH
add_compile_options("/EHa")
# Multiprocessor compiling
add_compile_options("/MP")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(STATUS "Applying custom flags for GNU style build.")
# Clang/AppleClang/GNU
# - Don't export by default. (Temporarily disabled)
# - Enable all and extra warnings.
add_compile_options("-Wall")
add_compile_options("-Wextra")
# add_compile_options("-fvisibility=hidden")
endif()
################################################################################ ################################################################################
# Detect if we are building with OBS Studio (different from Grouped builds) # Detect if we are building with OBS Studio (different from Grouped builds)
@ -380,241 +364,342 @@ if(${PREFIX}ENABLE_CODESIGN AND (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/codes
endif() endif()
################################################################################ ################################################################################
# Standalone Build: OBS Studio # Auto-Dependency: libOBS + obs-frontend-api
################################################################################ ################################################################################
if(NOT ${PREFIX}OBS_NATIVE) if(STANDALONE)
# Options # Options
set(${PREFIX}DOWNLOAD_OBS_URL "" CACHE STRING "(Optional) URL of prebuilt libOBS archive to download.") set(${PREFIX}OBS_DOWNLOAD TRUE CACHE BOOL "Automatically download libOBS and obs-frontend-api?")
set(${PREFIX}DOWNLOAD_OBS_HASH "" CACHE STRING "(Optional) The hash for the libOBS archive.") set(${PREFIX}OBS_PATH "" CACHE PATH "Path to libOBS, if ${PREFIX}OBS_DOWNLOAD is not set.")
set(${PREFIX}OBS_DOWNLOAD_URL "" CACHE STRING "The URL from which to download libOBS and obs-frontend-api, if autodetection fails. (Optional)")
set(${PREFIX}OBS_DOWNLOAD_HASH "" CACHE STRING "The hash string for the given URL. Must be a SHA-256 hash if provided. (Optional)")
mark_as_advanced( mark_as_advanced(
${PREFIX}DOWNLOAD_OBS_URL ${PREFIX}OBS_PATH
${PREFIX}DOWNLOAD_OBS_HASH ${PREFIX}OBS_DOWNLOAD_URL
${PREFIX}OBS_DOWNLOAD_HASH
) )
# Allow overriding what version we build against. if(${PREFIX}OBS_DOWNLOAD)
if(${PREFIX}DOWNLOAD_OBS_URL) if(${PREFIX}OBS_DOWNLOAD_URL STREQUAL "")
set(_DOWNLOAD_OBS_URL "${${PREFIX}DOWNLOAD_OBS_URL}") # Figure out download URLs and hashes.
set(_DOWNLOAD_OBS_HASH "${${PREFIX}DOWNLOAD_OBS_HASH}")
else()
set(_DOWNLOAD_OBS_VERSION "27.0.0-ci")
if (D_PLATFORM_WINDOWS) if (D_PLATFORM_WINDOWS)
if (D_PLATFORM_ARCH_X86) if (D_PLATFORM_ARCH_X86)
set(_DOWNLOAD_OBS_URL "https://github.com/Xaymar/obs-studio/releases/download/${_DOWNLOAD_OBS_VERSION}/obs-studio-x64-0.0.0.0-windows-${D_PLATFORM_ARCH}-${D_PLATFORM_BITS}.7z")
if (D_PLATFORM_BITS EQUAL 64) if (D_PLATFORM_BITS EQUAL 64)
set(_DOWNLOAD_OBS_HASH "SHA256=EBF9853C8A553E16ECBCA22523F401E6CF1EB2E8DA93F1493FEF41D65BD06633") set(OBS_DOWNLOAD_URL "https://github.com/Xaymar/obs-studio/releases/download/27.2.4-ci/windows-x86_64.tar.gz")
else() set(OBS_DOWNLOAD_HASH "DD931BBB2E0720F1D7573C65D8CC9D638F1EE2AC99F7173BF8935CD3A3BCE3F4")
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif() endif()
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif() endif()
elseif(D_PLATFORM_LINUX) elseif(D_PLATFORM_LINUX)
if (D_PLATFORM_ARCH_X86) if (D_PLATFORM_ARCH_X86)
set(_DOWNLOAD_OBS_URL "https://github.com/Xaymar/obs-studio/releases/download/${_DOWNLOAD_OBS_VERSION}/obs-studio-x64-0.0.0.0-ubuntu-${D_PLATFORM_ARCH}-${D_PLATFORM_BITS}.7z")
if (D_PLATFORM_BITS EQUAL 64) if (D_PLATFORM_BITS EQUAL 64)
set(_DOWNLOAD_OBS_HASH "SHA256=0AF6C7262C37D80C24CB18523A851FD765C04E766D8EB0F4AC0F6E75D13A035F") set(OBS_DOWNLOAD_URL "https://github.com/Xaymar/obs-studio/releases/download/27.2.4-ci/linux-x86_64.tar.gz")
else() set(OBS_DOWNLOAD_HASH "CA19E8260E1A556E6231D75064837C61C6D480BD90C97A0B930005AE527BF625")
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif() endif()
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif() endif()
elseif(D_PLATFORM_MAC) elseif(D_PLATFORM_MAC)
if (D_PLATFORM_ARCH_X86) if (D_PLATFORM_ARCH_X86)
set(_DOWNLOAD_OBS_URL "https://github.com/Xaymar/obs-studio/releases/download/${_DOWNLOAD_OBS_VERSION}/obs-studio-x64-0.0.0.0-macos-${D_PLATFORM_ARCH}-${D_PLATFORM_BITS}.7z")
if (D_PLATFORM_BITS EQUAL 64) if (D_PLATFORM_BITS EQUAL 64)
set(_DOWNLOAD_OBS_HASH "SHA256=F15BC4CA8EB3F581A94372759CFE554E30D202B604B541445A5756B878E4E799") set(OBS_DOWNLOAD_URL "https://github.com/Xaymar/obs-studio/releases/download/27.2.4-ci/macos-x86_64.tar.gz")
else() set(OBS_DOWNLOAD_HASH "0DD5A57DD537B97CAA8470212F8F6B637F47D4742A5D1F17787F4FE9DBC70B33")
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif() endif()
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif() endif()
endif() endif()
# Download libOBS # Verify that the platform, architecture and bitness is supported.
if(OBS_DOWNLOAD_URL STREQUAL "")
message(FATAL_ERROR "${LOGPREFIX} Download for libOBS failed, as Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
else()
set(OBS_DOWNLOAD_URL "${${PREFIX}OBS_DOWNLOAD_URL}")
set(OBS_DOWNLOAD_HASH "${${PREFIX}OBS_DOWNLOAD_HASH}")
endif()
if(OBS_DOWNLOAD_HASH STREQUAL "")
download_project( download_project(
PROJ libobs PROJ libobs
URL "${_DOWNLOAD_OBS_URL}" PREFIX "autodeps"
URL_HASH "${_DOWNLOAD_OBS_HASH}" URL "${OBS_DOWNLOAD_URL}"
DOWNLOAD_NO_PROGRESS OFF DOWNLOAD_NO_PROGRESS OFF
UPDATE_DISCONNECTED OFF UPDATE_DISCONNECTED OFF
) )
else()
download_project(
PROJ libobs
PREFIX "autodeps"
URL "${OBS_DOWNLOAD_URL}"
URL_HASH "SHA256=${OBS_DOWNLOAD_HASH}"
DOWNLOAD_NO_PROGRESS OFF
UPDATE_DISCONNECTED OFF
)
endif()
CacheSet(${PREFIX}OBS_PATH "${libobs_SOURCE_DIR}")
endif()
include("${libobs_SOURCE_DIR}/cmake/LibObs/LibObsConfig.cmake") if(NOT EXISTS "${${PREFIX}OBS_PATH}/cmake/LibObs/LibObsConfig.cmake")
message(FATAL_ERROR "${LOGPREFIX} The provided path for libOBS is invalid as it did not contain '/cmake/LibObs/LibObsConfig.cmake'.")
return()
else()
include("${${PREFIX}OBS_PATH}/cmake/LibObs/LibObsConfig.cmake")
endif()
if (NOT TARGET obs-frontend-api)
if(EXISTS "${${PREFIX}OBS_PATH}/cmake/obs-frontend-api/obs-frontend-apiConfig.cmake")
include("${${PREFIX}OBS_PATH}/cmake/obs-frontend-api/obs-frontend-apiConfig.cmake")
elseif((EXISTS "${${PREFIX}OBS_PATH}/bin/${D_PLATFORM_BITS}bit/obs-frontend-api.lib") AND (EXISTS "${${PREFIX}OBS_PATH}/include/obs-frontend-api.h"))
add_library(obs-frontend-api SHARED IMPORTED)
set_target_properties(obs-frontend-api PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${${PREFIX}OBS_PATH}/include"
INTERFACE_LINK_LIBRARIES "libobs"
IMPORTED_CONFIGURATIONS RELWITHDEBINFO
IMPORTED_IMPLIB_RELWITHDEBINFO "${${PREFIX}OBS_PATH}/bin/${D_PLATFORM_BITS}bit/obs-frontend-api.lib"
IMPORTED_LOCATION_RELWITHDEBINFO "${${PREFIX}OBS_PATH}/bin/${D_PLATFORM_BITS}bit/obs-frontend-api.dll"
)
else()
message(WARNING "${LOGPREFIX} The provided path for libOBS did not contain obs-frontend-api.")
endif()
endif()
endif() endif()
################################################################################ ################################################################################
# Standalone Build: OBS Studio Dependencies # Auto-Dependency: OBS Studio Dependencies
################################################################################ ################################################################################
if(STANDALONE AND NOT D_PLATFORM_LINUX) if(STANDALONE AND NOT D_PLATFORM_LINUX)
# Options # Options
set(${PREFIX}DOWNLOAD_OBSDEPS_URL "" CACHE STRING "(Optional) URL of prebuilt libOBS archive to download.") set(${PREFIX}OBSDEPS_DOWNLOAD TRUE CACHE BOOL "Automatically download pre-built libOBS dependencies?")
set(${PREFIX}DOWNLOAD_OBSDEPS_HASH "" CACHE STRING "(Optional) The hash for the libOBS archive.") set(${PREFIX}OBSDEPS_PATH "" CACHE PATH "Path to pre-build libOBS dependencies, if ${PREFIX}OBSDEPS_DOWNLOAD is not set.")
set(${PREFIX}OBSDEPS_DOWNLOAD_URL "" CACHE STRING "The URL from which to download pre-built libOBS dependencies, if autodetection fails. (Optional)")
set(${PREFIX}OBSDEPS_DOWNLOAD_HASH "" CACHE STRING "The hash string for the given URL. Must be a SHA-256 hash if provided. (Optional)")
mark_as_advanced( mark_as_advanced(
${PREFIX}DOWNLOAD_OBSDEPS_URL ${PREFIX}OBSDEPS_PATH
${PREFIX}DOWNLOAD_OBSDEPS_HASH ${PREFIX}OBSDEPS_DOWNLOAD_URL
${PREFIX}OBSDEPS_DOWNLOAD_HASH
) )
# Allow overriding what version we build against. if(${PREFIX}OBSDEPS_DOWNLOAD)
if(${PREFIX}DOWNLOAD_OBSDEPS_URL) if(${PREFIX}OBSDEPS_DOWNLOAD_URL STREQUAL "")
set(_DOWNLOAD_OBSDEPS_URL "${${PREFIX}DOWNLOAD_OBSDEPS_URL}") # Figure out download URLs and hashes.
set(_DOWNLOAD_OBSDEPS_HASH "${${PREFIX}DOWNLOAD_OBSDEPS_HASH}")
else()
if (D_PLATFORM_WINDOWS) if (D_PLATFORM_WINDOWS)
set(DEPS_VERSION "2022-01-31")
if (D_PLATFORM_ARCH_X86) if (D_PLATFORM_ARCH_X86)
set(_DOWNLOAD_OBSDEPS_URL "https://github.com/Xaymar/obs-studio/releases/download/27.0.0/deps-windows-x86.7z")
if (D_PLATFORM_BITS EQUAL 64) if (D_PLATFORM_BITS EQUAL 64)
set(_DOWNLOAD_OBSDEPS_HASH "SHA256=B4AED165016F0B64A7E8B256CCC12EAF8AF087F61B0B239B9D3D00277485B5B5") set(OBSDEPS_DOWNLOAD_URL "https://github.com/obsproject/obs-deps/releases/download/win-${DEPS_VERSION}/windows-deps-${DEPS_VERSION}.zip")
elseif (D_PLATFORM_BITS EQUAL 32) set(OBSDEPS_DOWNLOAD_HASH "66E55FE35A507C902C036EB11E691D0257FECA545A8EE57324B69427717026DD")
set(_DOWNLOAD_OBSDEPS_HASH "SHA256=B4AED165016F0B64A7E8B256CCC12EAF8AF087F61B0B239B9D3D00277485B5B5")
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif() endif()
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif() endif()
elseif(D_PLATFORM_MAC) elseif(D_PLATFORM_MAC)
if (D_PLATFORM_ARCH_X86) set(DEPS_VERSION "2022-02-13")
if (D_PLATFORM_ARCH_X86 AND D_PLATFORM_ARCH_ARM)
if (D_PLATFORM_BITS EQUAL 64) if (D_PLATFORM_BITS EQUAL 64)
set(_DOWNLOAD_OBSDEPS_URL "https://github.com/Xaymar/obs-studio/releases/download/27.0.0/deps-macos-x86_64-2021-03-25.tar.gz") set(OBSDEPS_DOWNLOAD_URL "https://github.com/obsproject/obs-deps/releases/download/${DEPS_VERSION}/macos-deps-${DEPS_VERSION}-universal.tar.xz")
set(_DOWNLOAD_OBSDEPS_HASH "SHA256=1C409374BCAB9D5CEEAFC121AA327E13AB222096718AF62F2648302DF62898D6") set(OBSDEPS_DOWNLOAD_HASH "77471B1D345A768E8EFEC3F6AD9DC79F3C7CD34840B66F721B80025D29713F5D")
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif() endif()
elseif(D_PLATFORM_ARCH_ARM) elseif (D_PLATFORM_ARCH_X86)
if (D_PLATFORM_BITS EQUAL 64) if (D_PLATFORM_BITS EQUAL 64)
set(_DOWNLOAD_OBSDEPS_URL "https://github.com/Xaymar/obs-studio/releases/download/27.0.0/deps-macos-arm64-2021-03-25.tar.gz") set(OBSDEPS_DOWNLOAD_URL "https://github.com/obsproject/obs-deps/releases/download/${DEPS_VERSION}/macos-deps-${DEPS_VERSION}-x86_64.tar.xz")
set(_DOWNLOAD_OBSDEPS_HASH "SHA256=C0EC57D360AF190E372D6BB883134FA26B1A7E49840DD146B172B48D548B55BC") set(OBSDEPS_DOWNLOAD_HASH "1A8715D66E664B857942DEADED0DC46C4F6CD22E88F01ED1188F3BD3FCF632C4")
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif() endif()
else() elseif (D_PLATFORM_ARCH_ARM)
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.") if (D_PLATFORM_BITS EQUAL 64)
return() set(OBSDEPS_DOWNLOAD_URL "https://github.com/obsproject/obs-deps/releases/download/${DEPS_VERSION}/macos-deps-${DEPS_VERSION}-arm64.tar.xz")
set(OBSDEPS_DOWNLOAD_HASH "2CFCAF05765400C696908F242AEA87B6E1848E1A48CD3EDC2EB7F8CB249C9D48")
endif() endif()
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif() endif()
endif() endif()
# Download libOBS # Verify that the platform, architecture and bitness is supported.
if(OBSDEPS_DOWNLOAD_URL STREQUAL "")
message(FATAL_ERROR "${LOGPREFIX} Download for pre-built OBS dependencies failed, as Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
else()
set(OBSDEPS_DOWNLOAD_URL "${${PREFIX}OBSDEPS_DOWNLOAD_URL}")
set(OBSDEPS_DOWNLOAD_HASH "${${PREFIX}OBSDEPS_DOWNLOAD_HASH}")
endif()
if(OBSDEPS_DOWNLOAD_HASH STREQUAL "")
download_project( download_project(
PROJ obsdeps PROJ obsdeps
URL "${_DOWNLOAD_OBSDEPS_URL}" PREFIX "autodeps"
URL_HASH "${_DOWNLOAD_OBSDEPS_HASH}" URL "${OBSDEPS_DOWNLOAD_URL}"
DOWNLOAD_NO_PROGRESS OFF DOWNLOAD_NO_PROGRESS OFF
UPDATE_DISCONNECTED OFF UPDATE_DISCONNECTED OFF
) )
else()
download_project(
PROJ obsdeps
PREFIX "autodeps"
URL "${OBSDEPS_DOWNLOAD_URL}"
URL_HASH "SHA256=${OBSDEPS_DOWNLOAD_HASH}"
DOWNLOAD_NO_PROGRESS OFF
UPDATE_DISCONNECTED OFF
)
endif()
CacheSet(${PREFIX}OBSDEPS_PATH "${obsdeps_SOURCE_DIR}")
endif()
if (D_PLATFORM_WINDOWS) if (D_PLATFORM_WINDOWS)
set(_OBSDEPS_PATH "${obsdeps_SOURCE_DIR}/win${D_PLATFORM_BITS}") set(_OBSDEPS_PATH "${${PREFIX}OBSDEPS_PATH}/win${D_PLATFORM_BITS}")
set(FFmpegPath "${${PREFIX}OBSDEPS_PATH}/win${D_PLATFORM_BITS}")
elseif(D_PLATFORM_MAC) elseif(D_PLATFORM_MAC)
set(_OBSDEPS_PATH "${obsdeps_SOURCE_DIR}/obsdeps") set(_OBSDEPS_PATH "${${PREFIX}OBSDEPS_PATH}/obsdeps")
set(FFmpegPath "${${PREFIX}OBSDEPS_PATH}/obsdeps")
endif() endif()
endif() endif()
################################################################################ ################################################################################
# Standalone Build: Qt v5.x # Auto-Dependency: Qt v5.x
################################################################################ ################################################################################
if(STANDALONE AND NOT D_PLATFORM_LINUX) if(STANDALONE AND NOT D_PLATFORM_LINUX)
set(${PREFIX}DOWNLOAD_QT OFF CACHE BOOL "Download Qt?") # Options
set(${PREFIX}QT_DOWNLOAD TRUE CACHE BOOL "Automatically download Qt?")
if(${PREFIX}DOWNLOAD_QT) set(${PREFIX}QT_PATH "" CACHE PATH "Path to Qt, if ${PREFIX}QT_DOWNLOAD is not set.")
set(${PREFIX}DOWNLOAD_QT_URL "" CACHE STRING "") set(${PREFIX}QT_DOWNLOAD_URL "" CACHE STRING "The URL from which to download Qt, if autodetection fails. (Optional)")
set(${PREFIX}DOWNLOAD_QT_HASH "" CACHE STRING "") set(${PREFIX}QT_DOWNLOAD_HASH "" CACHE STRING "The hash string for the given URL. Must be a SHA-256 hash if provided. (Optional)")
mark_as_advanced( mark_as_advanced(
${PREFIX}DOWNLOAD_QT_URL ${PREFIX}QT_PATH
${PREFIX}DOWNLOAD_QT_HASH ${PREFIX}QT_DOWNLOAD_URL
${PREFIX}QT_DOWNLOAD_HASH
) )
# Allow overriding what version we build against. if(${PREFIX}QT_DOWNLOAD)
if(${PREFIX}DOWNLOAD_QT_URL) if(${PREFIX}QT_DOWNLOAD_URL STREQUAL "")
set(_DOWNLOAD_QT_URL "${${PREFIX}DOWNLOAD_QT_URL}") # Figure out download URLs and hashes.
set(_DOWNLOAD_QT_HASH "${${PREFIX}DOWNLOAD_QT_HASH}")
else()
if (D_PLATFORM_WINDOWS) if (D_PLATFORM_WINDOWS)
set(DEPS_VERSION "5.15.2")
if (D_PLATFORM_ARCH_X86) if (D_PLATFORM_ARCH_X86)
if (D_PLATFORM_BITS EQUAL 64) if (D_PLATFORM_BITS EQUAL 64)
set(_DOWNLOAD_QT_URL "https://github.com/Xaymar/obs-studio/releases/download/27.0.0/qt-5.15.2-windows-x86-64.7z") set(QT_DOWNLOAD_URL "https://cdn-fastly.obsproject.com/downloads/Qt_${DEPS_VERSION}.7z")
set(_DOWNLOAD_QT_HASH "SHA256=109B9C21EF165B0C46DFAA9AD23124F2070ED4D74207C4AFB308183CB8D43BDD") set(QT_DOWNLOAD_HASH "9EF1DFEEBE6AB7FFC55FD285667CC5D9CB2D298646C107C2295D13F14708E64E")
elseif (D_PLATFORM_BITS EQUAL 32)
set(_DOWNLOAD_QT_URL "https://github.com/Xaymar/obs-studio/releases/download/27.0.0/qt-5.15.2-windows-x86-32.7z")
set(_DOWNLOAD_QT_HASH "SHA256=372E4FBF2A15DD4FDA955A07334D8B8AC6802990148C9CB4E766C90205F8F570")
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif() endif()
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif() endif()
elseif(D_PLATFORM_MAC) elseif(D_PLATFORM_MAC)
if (D_PLATFORM_ARCH_X86) set(DEPS_VERSION "2022-02-13")
if (D_PLATFORM_ARCH_X86 AND D_PLATFORM_ARCH_ARM)
if (D_PLATFORM_BITS EQUAL 64) if (D_PLATFORM_BITS EQUAL 64)
set(_DOWNLOAD_QT_URL "https://github.com/Xaymar/obs-studio/releases/download/27.0.0/qt-5.15.2-macos-x86_64-2021-03-25.tar.gz") set(QT_DOWNLOAD_URL "https://github.com/obsproject/obs-deps/releases/download/${DEPS_VERSION}/macos-deps-qt-${DEPS_VERSION}-universal.tar.xz")
set(_DOWNLOAD_QT_HASH "SHA256=FFABB54624B931EA3FCC06BED244895F50CEFC95DE09D792D280C46D4F91D4C5") set(QT_DOWNLOAD_HASH "13FBCC45FD9D08B30E702D481FE4D58B23F93AA06848CEDE4EBE0956C79A5E8A")
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif() endif()
elseif(D_PLATFORM_ARCH_ARM) elseif (D_PLATFORM_ARCH_X86)
if (D_PLATFORM_BITS EQUAL 64) if (D_PLATFORM_BITS EQUAL 64)
set(_DOWNLOAD_QT_URL "https://github.com/Xaymar/obs-studio/releases/download/27.0.0/qt-5.15.2-macos-arm64-2021-03-25.tar.gz") set(QT_DOWNLOAD_URL "https://github.com/obsproject/obs-deps/releases/download/${DEPS_VERSION}/macos-deps-qt-${DEPS_VERSION}-x86_64.tar.xz")
set(_DOWNLOAD_QT_HASH "SHA256=366BA8AC0FA0CAC440AFB9ED1C2EF5932E50091DC43BDE8B5C4B490082B6F19F") set(QT_DOWNLOAD_HASH "35A58FEE8DFD70D3D2DCC0AE0B77132C04A451C6F041A02DC41B207B375FC74B")
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif() endif()
else() elseif (D_PLATFORM_ARCH_ARM)
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.") if (D_PLATFORM_BITS EQUAL 64)
return() set(QT_DOWNLOAD_URL "https://github.com/obsproject/obs-deps/releases/download/${DEPS_VERSION}/macos-deps-qt-${DEPS_VERSION}-arm64.tar.xz")
set(QT_DOWNLOAD_HASH "E99146B9C7775C245A2D22F2EF24FC111FCCD71BAD0F03B64DB707124FFB8707")
endif() endif()
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif() endif()
endif() endif()
# Verify that the platform, architecture and bitness is supported.
if(QT_DOWNLOAD_URL STREQUAL "")
message(FATAL_ERROR "${LOGPREFIX} Download for Qt failed, as Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
else()
set(QT_DOWNLOAD_URL "${${PREFIX}QT_DOWNLOAD_URL}")
set(QT_DOWNLOAD_HASH "${${PREFIX}QT_DOWNLOAD_HASH}")
endif()
if(QT_DOWNLOAD_HASH STREQUAL "")
download_project( download_project(
PROJ qt PROJ qt
URL "${_DOWNLOAD_QT_URL}" PREFIX "autodeps"
URL_HASH "${_DOWNLOAD_QT_HASH}" URL "${QT_DOWNLOAD_URL}"
DOWNLOAD_NO_PROGRESS OFF DOWNLOAD_NO_PROGRESS OFF
UPDATE_DISCONNECTED OFF UPDATE_DISCONNECTED OFF
) )
else()
download_project(
PROJ qt
PREFIX "autodeps"
URL "${QT_DOWNLOAD_URL}"
URL_HASH "SHA256=${QT_DOWNLOAD_HASH}"
DOWNLOAD_NO_PROGRESS OFF
UPDATE_DISCONNECTED OFF
)
endif()
execute_process(COMMAND "xattr" "-r" "-d" "com.apple.quarantine" "${qt_SOURCE_DIR}")
set(Qt5_DIR "${qt_SOURCE_DIR}" CACHE STRING "Path to Qt5") if(D_PLATFORM_WINDOWS)
CacheSet(${PREFIX}QT_PATH "${qt_SOURCE_DIR}/msvc2019_64")
else()
CacheSet(${PREFIX}QT_PATH "${qt_SOURCE_DIR}")
endif()
endif()
set(Qt5_DIR "${${PREFIX}QT_PATH}/lib/cmake/Qt5" CACHE STRING "Path to Qt")
CacheSet(Qt5_DIR "${${PREFIX}QT_PATH}/lib/cmake/Qt5")
endif()
################################################################################
# Auto-Dependency: libAOM
################################################################################
if(D_PLATFORM_WINDOWS)
# Options
set(${PREFIX}AOM_DOWNLOAD TRUE CACHE BOOL "Automatically download AOM?")
set(${PREFIX}AOM_PATH "" CACHE PATH "Path to AOM, if ${PREFIX}AOM_DOWNLOAD is not set.")
set(${PREFIX}AOM_DOWNLOAD_URL "" CACHE STRING "The URL from which to download AOM, if autodetection fails. (Optional)")
set(${PREFIX}AOM_DOWNLOAD_HASH "" CACHE STRING "The hash string for the given URL. Must be a SHA-256 hash if provided. (Optional)")
mark_as_advanced(
${PREFIX}AOM_PATH
${PREFIX}AOM_DOWNLOAD_URL
${PREFIX}AOM_DOWNLOAD_HASH
)
if(${PREFIX}AOM_DOWNLOAD)
if(${PREFIX}AOM_DOWNLOAD_URL STREQUAL "")
set(AOM_VERSION "v3.2.0.1")
# Figure out download URLs and hashes.
if (D_PLATFORM_WINDOWS) if (D_PLATFORM_WINDOWS)
if (D_PLATFORM_ARCH_X86) if (D_PLATFORM_ARCH_X86)
if (D_PLATFORM_BITS EQUAL 64) set(AOM_DOWNLOAD_URL "https://github.com/Xaymar/aom/releases/download/${AOM_VERSION}/aom-windows-${D_PLATFORM_BITS}-shared.7z")
CacheSet(Qt5_DIR "${qt_SOURCE_DIR}/lib/cmake/Qt5") set(AOM_DOWNLOAD_HASH "2DE0C215C5B00D6761AD2D1FEAFB545C04249B2CBD542F9F7D423E1A26BA59BD")
elseif (D_PLATFORM_BITS EQUAL 32)
CacheSet(Qt5_DIR "${qt_SOURCE_DIR}/lib/cmake/Qt5")
endif() endif()
endif() endif()
elseif(D_PLATFORM_MAC)
CacheSet(Qt5_DIR "${qt_SOURCE_DIR}/lib/cmake/Qt5") # Verify that the platform, architecture and bitness is supported.
if(AOM_DOWNLOAD_URL STREQUAL "")
message(FATAL_ERROR "${LOGPREFIX} Download for AOM failed, as Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
else()
set(AOM_DOWNLOAD_URL "${${PREFIX}AOM_DOWNLOAD_URL}")
set(AOM_DOWNLOAD_HASH "${${PREFIX}AOM_DOWNLOAD_HASH}")
endif()
if(AOM_DOWNLOAD_HASH STREQUAL "")
download_project(
PROJ AOM
PREFIX "autodeps"
URL "${AOM_DOWNLOAD_URL}"
DOWNLOAD_NO_PROGRESS OFF
UPDATE_DISCONNECTED OFF
)
else()
download_project(
PROJ AOM
PREFIX "autodeps"
URL "${AOM_DOWNLOAD_URL}"
URL_HASH "SHA256=${AOM_DOWNLOAD_HASH}"
DOWNLOAD_NO_PROGRESS OFF
UPDATE_DISCONNECTED OFF
)
endif()
if(D_PLATFORM_WINDOWS)
CacheSet(${PREFIX}AOM_PATH "${AOM_SOURCE_DIR}/msvc2019_64")
else()
CacheSet(${PREFIX}AOM_PATH "${AOM_SOURCE_DIR}")
endif() endif()
endif() endif()
set(AOM_PATH "${${PREFIX}AOM_PATH}" CACHE STRING "Path to AOM")
endif() endif()
################################################################################ ################################################################################
@ -647,20 +732,20 @@ function(feature_encoder_ffmpeg RESOLVE)
is_feature_enabled(ENCODER_FFMPEG T_CHECK) is_feature_enabled(ENCODER_FFMPEG T_CHECK)
if(RESOLVE AND T_CHECK) if(RESOLVE AND T_CHECK)
if(NOT HAVE_FFMPEG) if(NOT HAVE_FFMPEG)
message(WARNING "${LOGPREFIX}: FFmpeg Encoder requires FFmpeg. Disabling...") message(WARNING "${LOGPREFIX} FFmpeg Encoder requires FFmpeg. Disabling...")
set_feature_disabled(ENCODER_FFMPEG ON) set_feature_disabled(ENCODER_FFMPEG ON)
else() else()
# AMF # AMF
is_feature_enabled(ENCODER_FFMPEG_AMF T_CHECK) is_feature_enabled(ENCODER_FFMPEG_AMF T_CHECK)
if(T_CHECK AND D_PLATFORM_MAC) if(T_CHECK AND D_PLATFORM_MAC)
message(WARNING "${LOGPREFIX}: FFmpeg Encoder 'AMF' requires Windows or Linux. Disabling...") message(WARNING "${LOGPREFIX} FFmpeg Encoder 'AMF' requires Windows or Linux. Disabling...")
set_feature_disabled(ENCODER_FFMPEG_AMF ON) set_feature_disabled(ENCODER_FFMPEG_AMF ON)
endif() endif()
# NVENC # NVENC
is_feature_enabled(ENCODER_FFMPEG_NVENC T_CHECK) is_feature_enabled(ENCODER_FFMPEG_NVENC T_CHECK)
if(T_CHECK AND D_PLATFORM_MAC) if(T_CHECK AND D_PLATFORM_MAC)
message(WARNING "${LOGPREFIX}: FFmpeg Encoder 'NVENC' requires Windows or Linux. Disabling...") message(WARNING "${LOGPREFIX} FFmpeg Encoder 'NVENC' requires Windows or Linux. Disabling...")
set_feature_disabled(ENCODER_FFMPEG_NVENC ON) set_feature_disabled(ENCODER_FFMPEG_NVENC ON)
endif() endif()
@ -679,7 +764,7 @@ function(feature_encoder_aom_av1 RESOLVE)
is_feature_enabled(ENCODER_AOM_AV1 T_CHECK) is_feature_enabled(ENCODER_AOM_AV1 T_CHECK)
if(RESOLVE AND T_CHECK) if(RESOLVE AND T_CHECK)
if(NOT HAVE_AOM) if(NOT HAVE_AOM)
message(WARNING "${LOGPREFIX}: AOM AV1 encoder missing AOM library. Disabling...") message(WARNING "${LOGPREFIX} AOM AV1 encoder missing AOM library. Disabling...")
set_feature_disabled(ENCODER_AOM_AV1 ON) set_feature_disabled(ENCODER_AOM_AV1 ON)
endif() endif()
elseif(T_CHECK) elseif(T_CHECK)
@ -692,14 +777,14 @@ function(feature_filter_autoframing RESOLVE)
if(RESOLVE AND T_CHECK) if(RESOLVE AND T_CHECK)
# Verify that the requirements for the providers are available # Verify that the requirements for the providers are available
if(NOT HAVE_NVIDIA_AR_SDK) if(NOT HAVE_NVIDIA_AR_SDK)
message(WARNING "${LOGPREFIX}: 'NVIDIA Augmented Reality SDK' is missing. Disabling NVIDIA provider...") message(WARNING "${LOGPREFIX} 'NVIDIA Augmented Reality SDK' is missing. Disabling NVIDIA provider...")
set_feature_disabled(FILTER_AUTOFRAMING_NVIDIA ON) set_feature_disabled(FILTER_AUTOFRAMING_NVIDIA ON)
endif() endif()
# Verify that we have at least one provider for Auto-Framing. # Verify that we have at least one provider for Auto-Framing.
is_feature_enabled(FILTER_AUTOFRAMING_NVIDIA T_CHECK_NVIDIA) is_feature_enabled(FILTER_AUTOFRAMING_NVIDIA T_CHECK_NVIDIA)
if (NOT T_CHECK_NVIDIA) if (NOT T_CHECK_NVIDIA)
message(WARNING "${LOGPREFIX}: Auto-Framing has no available providers. Disabling...") message(WARNING "${LOGPREFIX} Auto-Framing has no available providers. Disabling...")
set_feature_disabled(FILTER_AUTOFRAMING ON) set_feature_disabled(FILTER_AUTOFRAMING ON)
endif() endif()
elseif(T_CHECK) elseif(T_CHECK)
@ -721,14 +806,14 @@ function(feature_filter_denoising RESOLVE)
if(RESOLVE AND T_CHECK) if(RESOLVE AND T_CHECK)
# Verify that the requirements for the providers are available # Verify that the requirements for the providers are available
if(NOT HAVE_NVIDIA_VFX_SDK) if(NOT HAVE_NVIDIA_VFX_SDK)
message(WARNING "${LOGPREFIX}: 'NVIDIA Video Effects SDK' is missing. Disabling NVIDIA provider...") message(WARNING "${LOGPREFIX} 'NVIDIA Video Effects SDK' is missing. Disabling NVIDIA provider...")
set_feature_disabled(FILTER_DENOISING_NVIDIA ON) set_feature_disabled(FILTER_DENOISING_NVIDIA ON)
endif() endif()
# Verify that we have at least one provider for Video Denoising. # Verify that we have at least one provider for Video Denoising.
is_feature_enabled(FILTER_DENOISING_NVIDIA T_CHECK_NVIDIA) is_feature_enabled(FILTER_DENOISING_NVIDIA T_CHECK_NVIDIA)
if (NOT T_CHECK_NVIDIA) if (NOT T_CHECK_NVIDIA)
message(WARNING "${LOGPREFIX}: Denoising has no available providers. Disabling...") message(WARNING "${LOGPREFIX} Denoising has no available providers. Disabling...")
set_feature_disabled(FILTER_DENOISING ON) set_feature_disabled(FILTER_DENOISING ON)
endif() endif()
elseif(T_CHECK) elseif(T_CHECK)
@ -761,14 +846,14 @@ function(feature_filter_upscaling RESOLVE)
if(RESOLVE AND T_CHECK) if(RESOLVE AND T_CHECK)
# Verify that the requirements for the providers are available # Verify that the requirements for the providers are available
if(NOT HAVE_NVIDIA_VFX_SDK) if(NOT HAVE_NVIDIA_VFX_SDK)
message(WARNING "${LOGPREFIX}: 'NVIDIA Video Effects SDK' is missing. Disabling NVIDIA provider(s)...") message(WARNING "${LOGPREFIX} 'NVIDIA Video Effects SDK' is missing. Disabling NVIDIA provider(s)...")
set_feature_disabled(FILTER_UPSCALING_NVIDIA ON) set_feature_disabled(FILTER_UPSCALING_NVIDIA ON)
endif() endif()
# Verify that we have at least one provider for Video Super-Resolution. # Verify that we have at least one provider for Video Super-Resolution.
is_feature_enabled(FILTER_UPSCALING_NVIDIA T_CHECK_NVIDIA) is_feature_enabled(FILTER_UPSCALING_NVIDIA T_CHECK_NVIDIA)
if (NOT T_CHECK_NVIDIA) if (NOT T_CHECK_NVIDIA)
message(WARNING "${LOGPREFIX}: Upscaling has no available providers. Disabling...") message(WARNING "${LOGPREFIX} Upscaling has no available providers. Disabling...")
set_feature_disabled(FILTER_UPSCALING ON) set_feature_disabled(FILTER_UPSCALING ON)
endif() endif()
elseif(T_CHECK) elseif(T_CHECK)
@ -781,14 +866,14 @@ function(feature_filter_virtual_greenscreen RESOLVE)
if(RESOLVE AND T_CHECK) if(RESOLVE AND T_CHECK)
# Verify that the requirements for the providers are available # Verify that the requirements for the providers are available
if(NOT HAVE_NVIDIA_VFX_SDK) if(NOT HAVE_NVIDIA_VFX_SDK)
message(WARNING "${LOGPREFIX}: 'NVIDIA Video Effects SDK' is missing. Disabling NVIDIA provider(s)...") message(WARNING "${LOGPREFIX} 'NVIDIA Video Effects SDK' is missing. Disabling NVIDIA provider(s)...")
set_feature_disabled(FILTER_VIRTUAL_GREENSCREEN_NVIDIA ON) set_feature_disabled(FILTER_VIRTUAL_GREENSCREEN_NVIDIA ON)
endif() endif()
# Verify that we have at least one provider for Video Super-Resolution. # Verify that we have at least one provider for Video Super-Resolution.
is_feature_enabled(FILTER_VIRTUAL_GREENSCREEN_NVIDIA T_CHECK_NVIDIA) is_feature_enabled(FILTER_VIRTUAL_GREENSCREEN_NVIDIA T_CHECK_NVIDIA)
if (NOT T_CHECK_NVIDIA) if (NOT T_CHECK_NVIDIA)
message(WARNING "${LOGPREFIX}: Virtual Greenscreen has no available providers. Disabling...") message(WARNING "${LOGPREFIX} Virtual Greenscreen has no available providers. Disabling...")
set_feature_disabled(FILTER_VIRTUAL_GREENSCREEN ON) set_feature_disabled(FILTER_VIRTUAL_GREENSCREEN ON)
endif() endif()
elseif(T_CHECK) elseif(T_CHECK)
@ -812,10 +897,10 @@ function(feature_frontend RESOLVE)
is_feature_enabled(FRONTEND T_CHECK) is_feature_enabled(FRONTEND T_CHECK)
if(RESOLVE AND T_CHECK) if(RESOLVE AND T_CHECK)
if(NOT HAVE_QT) if(NOT HAVE_QT)
message(WARNING "${LOGPREFIX}: Front-End requires Qt. Disabling...") message(WARNING "${LOGPREFIX} Front-End requires Qt. Disabling...")
set_feature_disabled(FRONTEND ON) set_feature_disabled(FRONTEND ON)
elseif(NOT HAVE_OBSFE) elseif(NOT HAVE_OBSFE)
message(WARNING "${LOGPREFIX}: Front-End requires OBS FrontEnd API. Disabling...") message(WARNING "${LOGPREFIX} Front-End requires OBS FrontEnd API. Disabling...")
set_feature_disabled(FRONTEND ON) set_feature_disabled(FRONTEND ON)
endif() endif()
elseif(T_CHECK) elseif(T_CHECK)
@ -828,10 +913,10 @@ function(feature_updater RESOLVE)
is_feature_enabled(UPDATER T_CHECK) is_feature_enabled(UPDATER T_CHECK)
if(RESOLVE AND T_CHECK) if(RESOLVE AND T_CHECK)
if(NOT HAVE_CURL) if(NOT HAVE_CURL)
message(WARNING "${LOGPREFIX}: Updater requires CURL. Disabling...") message(WARNING "${LOGPREFIX} Updater requires CURL. Disabling...")
set_feature_disabled(UPDATER ON) set_feature_disabled(UPDATER ON)
elseif(NOT HAVE_JSON) elseif(NOT HAVE_JSON)
message(WARNING "${LOGPREFIX}: Updater requires nlohmann::json. Disabling...") message(WARNING "${LOGPREFIX} Updater requires nlohmann::json. Disabling...")
set_feature_disabled(UPDATER ON) set_feature_disabled(UPDATER ON)
endif() endif()
elseif(T_CHECK) elseif(T_CHECK)
@ -886,33 +971,6 @@ endif()
#- FFmpeg #- FFmpeg
set(HAVE_FFMPEG OFF) set(HAVE_FFMPEG OFF)
if(REQUIRE_FFMPEG) if(REQUIRE_FFMPEG)
if(D_PLATFORM_WINDOWS AND NOT ${PREFIX}OBS_NATIVE)
find_path(
FFmpegPath "libavcodec/avcodec.h"
HINTS
${OBS_DEPENDENCIES_DIR}
${_OBSDEPS_PATH}
${DepsPath}
${DepsPath32}
${DepsPath64}
PATHS
/usr/include
/usr/local/include
/opt/local/include
/sw/include
PATH_SUFFIXES
win${D_PLATFORM_BITS}
win${D_PLATFORM_BITS}/bin
win${D_PLATFORM_BITS}/include
win${D_PLATFORM_INSTR}
win${D_PLATFORM_INSTR}/bin
win${D_PLATFORM_INSTR}/include
bin
include
)
endif()
find_package(FFmpeg COMPONENTS avutil avcodec swscale) find_package(FFmpeg COMPONENTS avutil avcodec swscale)
set(HAVE_FFMPEG ${FFmpeg_FOUND}) set(HAVE_FFMPEG ${FFmpeg_FOUND})
endif() endif()
@ -983,16 +1041,9 @@ endif()
#- OBS Front-End API #- OBS Front-End API
set(HAVE_OBSFE OFF) set(HAVE_OBSFE OFF)
if(REQUIRE_OBSFE) if(REQUIRE_OBSFE)
if(${PREFIX}OBS_NATIVE)
if(TARGET obs-frontend-api) if(TARGET obs-frontend-api)
set(HAVE_OBSFE ON) set(HAVE_OBSFE ON)
endif() endif()
else()
if (EXISTS "${libobs_SOURCE_DIR}/cmake/obs-frontend-api/obs-frontend-apiConfig.cmake")
include("${libobs_SOURCE_DIR}/cmake/obs-frontend-api/obs-frontend-apiConfig.cmake")
set(HAVE_OBSFE ON)
endif()
endif()
endif() endif()
#- Qt5 #- Qt5
@ -1857,6 +1908,55 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_EXTENSIONS OFF CXX_EXTENSIONS OFF
) )
# C/C++ Compiler Adjustments
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
# MSVC/ClangCL
# - Dynamically link Microsoft C/C++ Redistributable.
# - Enable /W3 and disable useless warnings.
# - Enable C++ exceptions with SEH exceptions.
# - Enable multi-processor compiling.
# - Enable updated __cplusplus macro
message(STATUS "${LOGPREFIX} Applying custom flags for MSVC style build.")
# Build with dynamic MSVC linkage.
target_compile_options(${PROJECT_NAME} PUBLIC
$<$<CONFIG:>:/MD>
$<$<CONFIG:Debug>:/MDd>
$<$<CONFIG:Release>:/MD>
$<$<CONFIG:RelWithDebInfo>:/MD>
$<$<CONFIG:MinSizeRel>:/MD>
)
# Enable most useful warnings.
set(DISABLED_WARNINGS
"/wd4061" "/wd4100" "/wd4180" "/wd4201" "/wd4464" "/wd4505" "/wd4514"
"/wd4571" "/wd4623" "/wd4625" "/wd4626" "/wd4668" "/wd4710" "/wd4774"
"/wd4820" "/wd5026" "/wd5027" "/wd5039" "/wd5045" "/wd26812"
)
target_compile_options(${PROJECT_NAME} PUBLIC "/W3")
foreach(WARN ${DISABLED_WARNINGS})
target_compile_options(${PROJECT_NAME} PUBLIC "${WARN}")
endforeach()
# C++ Exceptions & SEH
target_compile_options(${PROJECT_NAME} PUBLIC "/EHa")
# Multiprocessor compiling
target_compile_options(${PROJECT_NAME} PUBLIC "/MP")
# Updated __cplusplus
target_compile_options(${PROJECT_NAME} PUBLIC "/Zc:__cplusplus")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# Clang/AppleClang/GNU
# - Don't export by default. (Temporarily disabled)
# - Enable all and extra warnings.
message(STATUS "${LOGPREFIX} Applying custom flags for GNU style build.")
target_compile_options(${PROJECT_NAME} PUBLIC "-Wall")
target_compile_options(${PROJECT_NAME} PUBLIC "-Wextra")
# add_compile_options("-fvisibility=hidden")
endif()
# Remove prefix on other platforms. # Remove prefix on other platforms.
set_target_properties(${PROJECT_NAME} PROPERTIES set_target_properties(${PROJECT_NAME} PROPERTIES
PREFIX "" PREFIX ""

View file

@ -1,41 +0,0 @@
# Setup
set(ARCH_INSTR_32 "i386;i686;x86;arm;ARM")
set(ARCH_INSTR_64 "x86_64;AMD64;IA64;arm64;ARM64")
set(ARCH_INSTR_X86 "i386;i686;x86;x86_64;AMD64")
set(ARCH_INSTR_ARM "arm;ARM;arm64;ARM64")
set(ARCH_INSTR_ITANIUM "IA64")
set(ARCH_BITS 0)
set(ARCH_BITS_POINTER 0)
set(ARCH_INST "")
# Bitness
list(FIND ARCH_INSTR_32 "${CMAKE_SYSTEM_PROCESSOR}" FOUND)
if(FOUND GREATER -1)
set(ARCH_BITS 32)
endif()
list(FIND ARCH_INSTR_64 "${CMAKE_SYSTEM_PROCESSOR}" FOUND)
if(FOUND GREATER -1)
set(ARCH_BITS 64)
endif()
# Pointer Size (bits)
math(EXPR ARCH_BITS_POINTER "8*${CMAKE_SIZEOF_VOID_P}")
# Basic Instruction Set
list(FIND ARCH_INSTR_X86 "${CMAKE_SYSTEM_PROCESSOR}" FOUND)
if(FOUND GREATER -1)
set(ARCH_INST "x86")
endif()
list(FIND ARCH_INSTR_ARM "${CMAKE_SYSTEM_PROCESSOR}" FOUND)
if(FOUND GREATER -1)
set(ARCH_INST "ARM")
endif()
list(FIND ARCH_INSTR_ITANIUM "${CMAKE_SYSTEM_PROCESSOR}" FOUND)
if(FOUND GREATER -1)
set(ARCH_INST "Itanium")
endif()
message(STATUS "Targetting ${ARCH_INST} with ${ARCH_BITS}bits and a pointer size of ${ARCH_BITS_POINTER}bit.")