mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-11 06:15:05 +00:00
cmake: Remove Auto-Dependency system
While the system helped users get started quickly, it also presented a unique problem by itself. As CMake grew, the code that supported this system became more and more fragile to the point of failing at random, with no indication of why it would fail. Additionally as OBS Studio 28.0 adopted a much nicer system, it is no longer necessary to have this system at all. As an addition to this change, all systems that could rely on FindModules now do so. This drastically reduces the complexity of the CMake system, while allowing significantly more flexibility with what binaries are really being used. In the best case this should allow a prepared user to build StreamFX by itself within seconds.
This commit is contained in:
parent
f2e5bdf78a
commit
7937ff4a44
2 changed files with 76 additions and 424 deletions
9
.github/workflows/main.yml
vendored
9
.github/workflows/main.yml
vendored
|
@ -143,15 +143,6 @@ jobs:
|
||||||
sudo installer -pkg ./Install\ Packages.pkg -target /
|
sudo installer -pkg ./Install\ Packages.pkg -target /
|
||||||
echo "CLANG_PATH=$(brew --prefix llvm@14)/bin/" >> "${GITHUB_ENV}"
|
echo "CLANG_PATH=$(brew --prefix llvm@14)/bin/" >> "${GITHUB_ENV}"
|
||||||
|
|
||||||
- name: "Auto-Dependency Cache"
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
build/debug/autodeps
|
|
||||||
build/release/autodeps
|
|
||||||
key: autodeps-${{ matrix.runner }}-${{ matrix.generator }}-${{ env.CACHE_VERSION }}
|
|
||||||
|
|
||||||
- name: "Configure & Build (Debug)"
|
- name: "Configure & Build (Debug)"
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
489
CMakeLists.txt
489
CMakeLists.txt
|
@ -40,7 +40,6 @@ set(CMAKE_MODULE_PATH
|
||||||
# Include
|
# Include
|
||||||
include("util") # CacheClear, CacheSet
|
include("util") # CacheClear, CacheSet
|
||||||
include("version") # version()
|
include("version") # version()
|
||||||
include("DownloadProject") # DownloadProject
|
|
||||||
include("CheckIPOSupported") # check_ipo_supported
|
include("CheckIPOSupported") # check_ipo_supported
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -54,7 +53,7 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}")
|
||||||
else()
|
else()
|
||||||
set(GROUPED ON)
|
set(GROUPED ON)
|
||||||
set(PREFIX "StreamFX_")
|
set(PREFIX "StreamFX_")
|
||||||
if(GROUPED AND (TARGET libobs))
|
if(GROUPED AND ((TARGET libobs) OR (TARGET OBS::libobs)))
|
||||||
set(STANDALONE OFF)
|
set(STANDALONE OFF)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -284,6 +283,15 @@ message(STATUS "${LOGPREFIX}Target is ${D_PLATFORM_BITS}bit ${ARCH_INST} with a
|
||||||
# Options
|
# Options
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
if(STANDALONE)
|
||||||
|
set(libobs_DIR "" CACHE PATH "Path to libobs and obs-frontend-api")
|
||||||
|
set(Qt_DIR "" CACHE PATH "Path to Qt6 or Qt5")
|
||||||
|
set(CURL_DIR "" CACHE PATH "Path to CURL")
|
||||||
|
set(FFmpeg_DIR "" CACHE PATH "Path to FFmpeg")
|
||||||
|
endif()
|
||||||
|
set(AOM_DIR "" CACHE PATH "Path to AOM library")
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
## Encoders
|
## Encoders
|
||||||
set(${PREFIX}ENABLE_ENCODER_FFMPEG ON CACHE BOOL "Enable FFmpeg Encoder integration.")
|
set(${PREFIX}ENABLE_ENCODER_FFMPEG ON CACHE BOOL "Enable FFmpeg Encoder integration.")
|
||||||
|
@ -391,318 +399,38 @@ if(${PREFIX}ENABLE_CODESIGN AND (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/codes
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Auto-Dependency: libOBS + obs-frontend-api
|
# Component search paths
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
if(STANDALONE)
|
list(APPEND CMAKE_PREFIX_PATH
|
||||||
# Options
|
"${${PREFIX}AOM_PATH}"
|
||||||
set(${PREFIX}OBS_DOWNLOAD TRUE CACHE BOOL "Automatically download libOBS and obs-frontend-api?")
|
"${${PREFIX}OBSDEPS_PATH}"
|
||||||
set(${PREFIX}OBS_PATH "" CACHE PATH "Path to libOBS, if ${PREFIX}OBS_DOWNLOAD is not set.")
|
"${${PREFIX}QT_PATH}"
|
||||||
set(${PREFIX}OBS_DOWNLOAD_URL "" CACHE STRING "The URL from which to download libOBS and obs-frontend-api, if autodetection fails. (Optional)")
|
"${AOM_DIR}"
|
||||||
set(${PREFIX}OBS_DOWNLOAD_HASH "" CACHE STRING "The hash string for the given URL. Must be a SHA-256 hash if provided. (Optional)")
|
"${CURL_DIR}"
|
||||||
mark_as_advanced(
|
"${DepsPath}"
|
||||||
${PREFIX}OBS_PATH
|
"${FFmpeg_DIR}"
|
||||||
${PREFIX}OBS_DOWNLOAD_URL
|
"${libobs_DIR}"
|
||||||
${PREFIX}OBS_DOWNLOAD_HASH
|
"${Qt_DIR}"
|
||||||
|
"${Qt5_DIR}"
|
||||||
|
"${Qt6_DIR}"
|
||||||
|
"${QTDIR}"
|
||||||
)
|
)
|
||||||
|
if(D_PLATFORM_MAC)
|
||||||
if(${PREFIX}OBS_DOWNLOAD)
|
list(APPEND CMAKE_PREFIX_PATH
|
||||||
if(${PREFIX}OBS_DOWNLOAD_URL STREQUAL "")
|
"${${PREFIX}AOM_PATH}/Frameworks"
|
||||||
# Figure out download URLs and hashes.
|
"${${PREFIX}OBSDEPS_PATH}/Frameworks"
|
||||||
if(D_PLATFORM_WINDOWS)
|
"${${PREFIX}QT_PATH}/Frameworks"
|
||||||
if(D_PLATFORM_ARCH_X86)
|
"${AOM_DIR}/Frameworks"
|
||||||
if(D_PLATFORM_BITS EQUAL 64)
|
"${CURL_DIR}/Frameworks"
|
||||||
set(OBS_DOWNLOAD_URL "https://github.com/Xaymar/obs-studio/releases/download/27.2.4-ci/windows-x86_64.tar.gz")
|
"${DepsPath}/Frameworks"
|
||||||
set(OBS_DOWNLOAD_HASH "DD931BBB2E0720F1D7573C65D8CC9D638F1EE2AC99F7173BF8935CD3A3BCE3F4")
|
"${FFmpeg_DIR}/Frameworks"
|
||||||
endif()
|
"${libobs_DIR}/Frameworks"
|
||||||
endif()
|
"${Qt_DIR}/Frameworks"
|
||||||
elseif(D_PLATFORM_LINUX)
|
"${Qt5_DIR}/Frameworks"
|
||||||
if(D_PLATFORM_ARCH_X86)
|
"${Qt6_DIR}/Frameworks"
|
||||||
if(D_PLATFORM_BITS EQUAL 64)
|
"${QTDIR}/Frameworks"
|
||||||
set(OBS_DOWNLOAD_URL "https://github.com/Xaymar/obs-studio/releases/download/27.2.4-ci/linux-x86_64.tar.gz")
|
|
||||||
set(OBS_DOWNLOAD_HASH "CA19E8260E1A556E6231D75064837C61C6D480BD90C97A0B930005AE527BF625")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
elseif(D_PLATFORM_MAC)
|
|
||||||
if(D_PLATFORM_ARCH_X86)
|
|
||||||
if(D_PLATFORM_BITS EQUAL 64)
|
|
||||||
set(OBS_DOWNLOAD_URL "https://github.com/Xaymar/obs-studio/releases/download/27.2.4-ci/macos-x86_64.tar.gz")
|
|
||||||
set(OBS_DOWNLOAD_HASH "0DD5A57DD537B97CAA8470212F8F6B637F47D4742A5D1F17787F4FE9DBC70B33")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# 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(
|
|
||||||
PROJ libobs
|
|
||||||
PREFIX "autodeps"
|
|
||||||
URL "${OBS_DOWNLOAD_URL}"
|
|
||||||
DOWNLOAD_NO_PROGRESS 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()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Auto-Dependency: OBS Studio Dependencies
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
if(STANDALONE AND NOT D_PLATFORM_LINUX)
|
|
||||||
# Options
|
|
||||||
set(${PREFIX}OBSDEPS_DOWNLOAD TRUE CACHE BOOL "Automatically download pre-built libOBS dependencies?")
|
|
||||||
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(
|
|
||||||
${PREFIX}OBSDEPS_PATH
|
|
||||||
${PREFIX}OBSDEPS_DOWNLOAD_URL
|
|
||||||
${PREFIX}OBSDEPS_DOWNLOAD_HASH
|
|
||||||
)
|
|
||||||
|
|
||||||
if(${PREFIX}OBSDEPS_DOWNLOAD)
|
|
||||||
if(${PREFIX}OBSDEPS_DOWNLOAD_URL STREQUAL "")
|
|
||||||
# Figure out download URLs and hashes.
|
|
||||||
if(D_PLATFORM_WINDOWS)
|
|
||||||
set(DEPS_VERSION "2022-01-31")
|
|
||||||
if(D_PLATFORM_ARCH_X86)
|
|
||||||
if(D_PLATFORM_BITS EQUAL 64)
|
|
||||||
set(OBSDEPS_DOWNLOAD_URL "https://github.com/obsproject/obs-deps/releases/download/win-${DEPS_VERSION}/windows-deps-${DEPS_VERSION}.zip")
|
|
||||||
set(OBSDEPS_DOWNLOAD_HASH "66E55FE35A507C902C036EB11E691D0257FECA545A8EE57324B69427717026DD")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
elseif(D_PLATFORM_MAC)
|
|
||||||
set(DEPS_VERSION "2022-02-13")
|
|
||||||
if(D_PLATFORM_ARCH_X86 AND D_PLATFORM_ARCH_ARM)
|
|
||||||
if(D_PLATFORM_BITS EQUAL 64)
|
|
||||||
set(OBSDEPS_DOWNLOAD_URL "https://github.com/obsproject/obs-deps/releases/download/${DEPS_VERSION}/macos-deps-${DEPS_VERSION}-universal.tar.xz")
|
|
||||||
set(OBSDEPS_DOWNLOAD_HASH "77471B1D345A768E8EFEC3F6AD9DC79F3C7CD34840B66F721B80025D29713F5D")
|
|
||||||
endif()
|
|
||||||
elseif(D_PLATFORM_ARCH_X86)
|
|
||||||
if(D_PLATFORM_BITS EQUAL 64)
|
|
||||||
set(OBSDEPS_DOWNLOAD_URL "https://github.com/obsproject/obs-deps/releases/download/${DEPS_VERSION}/macos-deps-${DEPS_VERSION}-x86_64.tar.xz")
|
|
||||||
set(OBSDEPS_DOWNLOAD_HASH "1A8715D66E664B857942DEADED0DC46C4F6CD22E88F01ED1188F3BD3FCF632C4")
|
|
||||||
endif()
|
|
||||||
elseif(D_PLATFORM_ARCH_ARM)
|
|
||||||
if(D_PLATFORM_BITS EQUAL 64)
|
|
||||||
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()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# 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(
|
|
||||||
PROJ obsdeps
|
|
||||||
PREFIX "autodeps"
|
|
||||||
URL "${OBSDEPS_DOWNLOAD_URL}"
|
|
||||||
DOWNLOAD_NO_PROGRESS 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)
|
|
||||||
set(_OBSDEPS_PATH "${${PREFIX}OBSDEPS_PATH}/win${D_PLATFORM_BITS}")
|
|
||||||
set(FFmpegPath "${${PREFIX}OBSDEPS_PATH}/win${D_PLATFORM_BITS}")
|
|
||||||
elseif(D_PLATFORM_MAC)
|
|
||||||
set(_OBSDEPS_PATH "${${PREFIX}OBSDEPS_PATH}/obsdeps")
|
|
||||||
set(FFmpegPath "${${PREFIX}OBSDEPS_PATH}/obsdeps")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Auto-Dependency: Qt v5.x
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
if(STANDALONE AND NOT D_PLATFORM_LINUX)
|
|
||||||
# Options
|
|
||||||
set(${PREFIX}QT_DOWNLOAD TRUE CACHE BOOL "Automatically download Qt?")
|
|
||||||
set(${PREFIX}QT_PATH "" CACHE PATH "Path to Qt, if ${PREFIX}QT_DOWNLOAD is not set.")
|
|
||||||
set(${PREFIX}QT_DOWNLOAD_URL "" CACHE STRING "The URL from which to download Qt, if autodetection fails. (Optional)")
|
|
||||||
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(
|
|
||||||
${PREFIX}QT_PATH
|
|
||||||
${PREFIX}QT_DOWNLOAD_URL
|
|
||||||
${PREFIX}QT_DOWNLOAD_HASH
|
|
||||||
)
|
|
||||||
|
|
||||||
if(${PREFIX}QT_DOWNLOAD)
|
|
||||||
if(${PREFIX}QT_DOWNLOAD_URL STREQUAL "")
|
|
||||||
# Figure out download URLs and hashes.
|
|
||||||
if(D_PLATFORM_WINDOWS)
|
|
||||||
set(DEPS_VERSION "5.15.2")
|
|
||||||
if(D_PLATFORM_ARCH_X86)
|
|
||||||
if(D_PLATFORM_BITS EQUAL 64)
|
|
||||||
set(QT_DOWNLOAD_URL "https://cdn-fastly.obsproject.com/downloads/Qt_${DEPS_VERSION}.7z")
|
|
||||||
set(QT_DOWNLOAD_HASH "9EF1DFEEBE6AB7FFC55FD285667CC5D9CB2D298646C107C2295D13F14708E64E")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
elseif(D_PLATFORM_MAC)
|
|
||||||
set(DEPS_VERSION "2022-02-13")
|
|
||||||
if(D_PLATFORM_ARCH_X86 AND D_PLATFORM_ARCH_ARM)
|
|
||||||
if(D_PLATFORM_BITS EQUAL 64)
|
|
||||||
set(QT_DOWNLOAD_URL "https://github.com/obsproject/obs-deps/releases/download/${DEPS_VERSION}/macos-deps-qt-${DEPS_VERSION}-universal.tar.xz")
|
|
||||||
set(QT_DOWNLOAD_HASH "13FBCC45FD9D08B30E702D481FE4D58B23F93AA06848CEDE4EBE0956C79A5E8A")
|
|
||||||
endif()
|
|
||||||
elseif(D_PLATFORM_ARCH_X86)
|
|
||||||
if(D_PLATFORM_BITS EQUAL 64)
|
|
||||||
set(QT_DOWNLOAD_URL "https://github.com/obsproject/obs-deps/releases/download/${DEPS_VERSION}/macos-deps-qt-${DEPS_VERSION}-x86_64.tar.xz")
|
|
||||||
set(QT_DOWNLOAD_HASH "35A58FEE8DFD70D3D2DCC0AE0B77132C04A451C6F041A02DC41B207B375FC74B")
|
|
||||||
endif()
|
|
||||||
elseif(D_PLATFORM_ARCH_ARM)
|
|
||||||
if(D_PLATFORM_BITS EQUAL 64)
|
|
||||||
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()
|
|
||||||
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(
|
|
||||||
PROJ qt
|
|
||||||
PREFIX "autodeps"
|
|
||||||
URL "${QT_DOWNLOAD_URL}"
|
|
||||||
DOWNLOAD_NO_PROGRESS 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}")
|
|
||||||
|
|
||||||
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_ARCH_X86)
|
|
||||||
set(AOM_DOWNLOAD_URL "https://github.com/Xaymar/aom/releases/download/${AOM_VERSION}/aom-windows-${D_PLATFORM_BITS}-shared.7z")
|
|
||||||
set(AOM_DOWNLOAD_HASH "2DE0C215C5B00D6761AD2D1FEAFB545C04249B2CBD542F9F7D423E1A26BA59BD")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# 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()
|
|
||||||
|
|
||||||
set(AOM_PATH "${${PREFIX}AOM_PATH}" CACHE STRING "Path to AOM")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -902,7 +630,7 @@ function(feature_frontend RESOLVE)
|
||||||
if(NOT (Qt6_FOUND OR Qt5_FOUND))
|
if(NOT (Qt6_FOUND OR Qt5_FOUND))
|
||||||
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_OBS_FRONTEND_API)
|
elseif(NOT obs-frontend-api_FOUND)
|
||||||
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()
|
||||||
|
@ -915,7 +643,7 @@ endfunction()
|
||||||
function(feature_updater RESOLVE)
|
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 CURL_FOUND)
|
||||||
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)
|
||||||
|
@ -951,84 +679,38 @@ feature_updater(OFF)
|
||||||
# Fulfill Requirements
|
# Fulfill Requirements
|
||||||
#- OBS: Library
|
#- OBS: Library
|
||||||
if(STANDALONE)
|
if(STANDALONE)
|
||||||
if(EXISTS "${${PREFIX}OBS_PATH}/cmake/LibObs/LibObsConfig.cmake")
|
find_package("libobs" REQUIRED CONFIG)
|
||||||
find_package(LibObs REQUIRED NO_MODULE
|
elseif(NOT TARGET OBS::libobs)
|
||||||
PATHS
|
# Add the missing OBS::libobs alias target if possible.
|
||||||
"${${PREFIX}OBS_PATH}/cmake/libobs"
|
add_library(OBS::libobs ALIAS libobs)
|
||||||
"${${PREFIX}OBS_PATH}/cmake/LibObs"
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
find_package(libobs REQUIRED NO_MODULE
|
|
||||||
PATHS
|
|
||||||
"${${PREFIX}OBS_PATH}/cmake/libobs"
|
|
||||||
"${${PREFIX}OBS_PATH}/cmake/LibObs"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#- OBS: Front-End API
|
#- OBS: Front-End API
|
||||||
set(HAVE_OBS_FRONTEND_API OFF)
|
set(obs-frontend-api_FOUND OFF)
|
||||||
if(REQUIRE_OBS_FRONTEND_API)
|
if(REQUIRE_OBS_FRONTEND_API)
|
||||||
if(STANDALONE)
|
if(STANDALONE)
|
||||||
if(EXISTS "${${PREFIX}OBS_PATH}/cmake/obs-frontend-api/obs-frontend-apiConfig.cmake")
|
find_package("obs-frontend-api" CONFIG)
|
||||||
find_package("obs-frontend-api" NO_MODULE
|
set(obs-frontend-api_FOUND "${obs-frontend-api_FOUND}")
|
||||||
PATHS
|
elseif(TARGET obs-frontend-api)
|
||||||
"${${PREFIX}OBS_PATH}/cmake/obs-frontend-api"
|
set(obs-frontend-api_FOUND ON)
|
||||||
)
|
|
||||||
elseif((EXISTS "${${PREFIX}OBS_PATH}/bin/${D_PLATFORM_BITS}bit/obs-frontend-api.dll") AND (EXISTS "${${PREFIX}OBS_PATH}/bin/${D_PLATFORM_BITS}bit/obs-frontend-api.lib"))
|
|
||||||
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"
|
|
||||||
)
|
|
||||||
elseif(EXISTS "${${PREFIX}OBS_PATH}/bin/${D_PLATFORM_BITS}bit/libobs-frontend-api.so")
|
|
||||||
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_LOCATION_RELWITHDEBINFO "${${PREFIX}OBS_PATH}/bin/${D_PLATFORM_BITS}bit/libobs-frontend-api.so"
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
message(WARNING "${LOGPREFIX}The provided path for libOBS did not contain obs-frontend-api.")
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
if(NOT TARGET OBS::obs-frontend-api)
|
||||||
|
add_library(OBS::obs-frontend-api ALIAS obs-frontend-api)
|
||||||
if(TARGET obs-frontend-api)
|
|
||||||
set(HAVE_OBS_FRONTEND_API ON)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#- CURL
|
#- CURL
|
||||||
set(HAVE_CURL OFF)
|
set(CURL_FOUND OFF)
|
||||||
if(REQUIRE_CURL)
|
if(REQUIRE_CURL)
|
||||||
if(D_PLATFORM_WINDOWS)
|
find_package("CURL")
|
||||||
if(STANDALONE)
|
|
||||||
set(CURL_LIBRARIES "${_OBSDEPS_PATH}/bin/libcurl.lib")
|
|
||||||
set(CURL_INCLUDE_DIRS "${_OBSDEPS_PATH}/include")
|
|
||||||
else()
|
|
||||||
# Already defined by OBS
|
|
||||||
set(CURL_LIBRARIES "${CURL_LIB}")
|
|
||||||
set(CURL_INCLUDE_DIRS "${CURL_INCLUDE_DIR}")
|
|
||||||
endif()
|
|
||||||
set(CURL_LIBRARY_DEBUG ${CURL_LIBRARIES})
|
|
||||||
set(CURL_LIBRARY_RELEASE ${CURL_LIBRARIES})
|
|
||||||
set(CURL_INCLUDE_DIR ${CURL_INCLUDE_DIRS})
|
|
||||||
set(CURL_FOUND ON)
|
|
||||||
else()
|
|
||||||
find_package(CURL)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(HAVE_CURL ${CURL_FOUND})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#- FFmpeg
|
#- FFmpeg
|
||||||
set(HAVE_FFMPEG OFF)
|
set(HAVE_FFMPEG OFF)
|
||||||
if(REQUIRE_FFMPEG)
|
if(REQUIRE_FFMPEG)
|
||||||
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()
|
||||||
|
|
||||||
|
@ -1036,7 +718,7 @@ endif()
|
||||||
set(HAVE_AOM OFF)
|
set(HAVE_AOM OFF)
|
||||||
if(REQUIRE_AOM)
|
if(REQUIRE_AOM)
|
||||||
if(NOT D_PLATFORM_MAC)
|
if(NOT D_PLATFORM_MAC)
|
||||||
find_package(AOM)
|
find_package("AOM")
|
||||||
set(HAVE_AOM ${AOM_FOUND})
|
set(HAVE_AOM ${AOM_FOUND})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -1098,43 +780,23 @@ endif()
|
||||||
#- Qt
|
#- Qt
|
||||||
if(REQUIRE_QT)
|
if(REQUIRE_QT)
|
||||||
# Try Qt6 first...
|
# Try Qt6 first...
|
||||||
find_package(Qt6
|
find_package("Qt6"
|
||||||
COMPONENTS Core Gui Widgets
|
COMPONENTS Core Gui Widgets
|
||||||
CONFIG
|
CONFIG
|
||||||
HINTS
|
|
||||||
"${Qt6_DIR}"
|
|
||||||
"${Qt6_DIR}/lib"
|
|
||||||
"${Qt6_DIR}/lib/cmake"
|
|
||||||
"${Qt6_DIR}/lib/cmake/Qt6"
|
|
||||||
"${QTDIR}"
|
|
||||||
"${QTDIR}/lib"
|
|
||||||
"${QTDIR}/lib/cmake"
|
|
||||||
"${QTDIR}/lib/cmake/Qt6"
|
|
||||||
"${DepsPath}"
|
|
||||||
"${DepsPath}/lib"
|
|
||||||
"${DepsPath}/lib/cmake"
|
|
||||||
"${DepsPath}/lib/cmake/Qt6"
|
|
||||||
)
|
)
|
||||||
if(NOT Qt6_FOUND)
|
|
||||||
# If Qt6 isn't present, try Qt5
|
# If Qt6 isn't present, try Qt5
|
||||||
find_package(Qt5
|
if(NOT Qt6_FOUND)
|
||||||
|
find_package("Qt5"
|
||||||
COMPONENTS Core Gui Widgets
|
COMPONENTS Core Gui Widgets
|
||||||
CONFIG
|
CONFIG
|
||||||
HINTS
|
|
||||||
"${Qt5_DIR}"
|
|
||||||
"${Qt5_DIR}/lib"
|
|
||||||
"${Qt5_DIR}/lib/cmake"
|
|
||||||
"${Qt5_DIR}/lib/cmake/Qt5"
|
|
||||||
"${QTDIR}"
|
|
||||||
"${QTDIR}/lib"
|
|
||||||
"${QTDIR}/lib/cmake"
|
|
||||||
"${QTDIR}/lib/cmake/Qt5"
|
|
||||||
"${DepsPath}"
|
|
||||||
"${DepsPath}/lib"
|
|
||||||
"${DepsPath}/lib/cmake"
|
|
||||||
"${DepsPath}/lib/cmake/Qt5"
|
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
if(Qt6_FOUND)
|
||||||
|
message(STATUS "${LOGPREFIX}Using Qt6.")
|
||||||
|
elseif(Qt5_FOUND)
|
||||||
|
message(STATUS "${LOGPREFIX}Using Qt5.")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Verify Requirements
|
# Verify Requirements
|
||||||
|
@ -1212,16 +874,15 @@ if(D_PLATFORM_WINDOWS) # Windows Support
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Minimum Dependencies
|
# Minimum Dependencies
|
||||||
list(APPEND PROJECT_LIBRARIES libobs)
|
list(APPEND PROJECT_LIBRARIES OBS::libobs)
|
||||||
|
|
||||||
# Components
|
# Components
|
||||||
if(HAVE_CURL)
|
if(CURL_FOUND)
|
||||||
list(APPEND PROJECT_PRIVATE_SOURCE
|
list(APPEND PROJECT_PRIVATE_SOURCE
|
||||||
"source/util/util-curl.hpp"
|
"source/util/util-curl.hpp"
|
||||||
"source/util/util-curl.cpp"
|
"source/util/util-curl.cpp"
|
||||||
)
|
)
|
||||||
list(APPEND PROJECT_LIBRARIES ${CURL_LIBRARY_RELEASE})
|
list(APPEND PROJECT_LIBRARIES CURL::libcurl)
|
||||||
list(APPEND PROJECT_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(HAVE_FFMPEG)
|
if(HAVE_FFMPEG)
|
||||||
|
@ -1332,8 +993,8 @@ if(HAVE_NVIDIA_CUDA)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(REQUIRE_OBS_FRONTEND_API AND HAVE_OBS_FRONTEND_API)
|
if(REQUIRE_OBS_FRONTEND_API AND obs-frontend-api_FOUND)
|
||||||
list(APPEND PROJECT_LIBRARIES obs-frontend-api)
|
list(APPEND PROJECT_LIBRARIES OBS::obs-frontend-api)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(REQUIRE_QT)
|
if(REQUIRE_QT)
|
||||||
|
@ -1997,9 +1658,9 @@ endif()
|
||||||
|
|
||||||
# Register the library
|
# Register the library
|
||||||
add_library(${PROJECT_NAME} MODULE ${PROJECT_FILES}) # We are a module for libOBS.
|
add_library(${PROJECT_NAME} MODULE ${PROJECT_FILES}) # We are a module for libOBS.
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_LIBRARIES})
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_INCLUDE_DIRS})
|
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_INCLUDE_DIRS})
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE ${PROJECT_DEFINITIONS})
|
target_compile_definitions(${PROJECT_NAME} PRIVATE ${PROJECT_DEFINITIONS})
|
||||||
target_link_libraries(${PROJECT_NAME} ${PROJECT_LIBRARIES})
|
|
||||||
|
|
||||||
# Always generate position independent code.
|
# Always generate position independent code.
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||||
|
@ -2276,15 +1937,15 @@ endif()
|
||||||
# Apple otool
|
# Apple otool
|
||||||
if(D_PLATFORM_MAC)
|
if(D_PLATFORM_MAC)
|
||||||
# OBS
|
# OBS
|
||||||
mac_get_linker_id(TARGET libobs OUTPUT T_OBS_LINK)
|
mac_get_linker_id(TARGET OBS::libobs OUTPUT T_OBS_LINK)
|
||||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||||
COMMAND install_name_tool ARGS -change "${T_OBS_LINK}" "@executable_path/../Frameworks/libobs.0.dylib" $<TARGET_FILE:${PROJECT_NAME}>
|
COMMAND install_name_tool ARGS -change "${T_OBS_LINK}" "@executable_path/../Frameworks/libobs.0.dylib" $<TARGET_FILE:${PROJECT_NAME}>
|
||||||
)
|
)
|
||||||
message(STATUS "${LOGPREFIX}Added post-build step for adjusting libobs linking path.")
|
message(STATUS "${LOGPREFIX}Added post-build step for adjusting libobs linking path.")
|
||||||
|
|
||||||
# OBS Front-End API
|
# OBS Front-End API
|
||||||
if(REQUIRE_OBS_FRONTEND_API AND HAVE_OBS_FRONTEND_API)
|
if(REQUIRE_OBS_FRONTEND_API AND obs-frontend-api_FOUND)
|
||||||
mac_get_linker_id(TARGET obs-frontend-api OUTPUT T_OBSFE_LINK)
|
mac_get_linker_id(TARGET OBS::obs-frontend-api OUTPUT T_OBSFE_LINK)
|
||||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||||
COMMAND install_name_tool ARGS -change "${T_OBSFE_LINK}" "@executable_path/../Frameworks/libobs-frontend-api.dylib" $<TARGET_FILE:${PROJECT_NAME}>
|
COMMAND install_name_tool ARGS -change "${T_OBSFE_LINK}" "@executable_path/../Frameworks/libobs-frontend-api.dylib" $<TARGET_FILE:${PROJECT_NAME}>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue