obs-StreamFX/CMakeLists.txt
Michael Fabian 'Xaymar' Dirks 9021274297 cmake: Fix up missing linked objects in component system
We should always link the whole object, even if nothing is needed by the module itself.
2023-09-03 15:32:46 +02:00

2381 lines
73 KiB
CMake

# AUTOGENERATED COPYRIGHT HEADER START
# Copyright (C) 2017-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
# Copyright (C) 2019 Cat Stevens <catb0t@protonmail.ch>
# Copyright (C) 2020 Brandon Edens <brandonedens@gmail.com>
# Copyright (C) 2021 Christopher P Yarger <cpyarger@gmail.com>
# Copyright (C) 2022 Carsten Braun <info@braun-cloud.de>
# Copyright (C) 2022 Romain Vigier <romain@romainvigier.fr>
# AUTOGENERATED COPYRIGHT HEADER END
# CMake Setup
cmake_minimum_required(VERSION 3.26)
list(APPEND CMAKE_MESSAGE_INDENT "[StreamFX] ")
project(StreamFX)
################################################################################
# Modules
################################################################################
# Search Paths
set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/clang"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/version"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
)
# Include required Modules
# - Stock
include("CheckIPOSupported")
# - Custom
include("util")
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/version/version.cmake")
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/version/version.cmake")
else()
message(FATAL_ERROR "Please ensure you've cloned recursively and try again. Thank you!")
endif()
# Include optional Modules
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/clang/Clang.cmake")
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/clang/Clang.cmake")
endif()
################################################################################
# Bootstrapping
################################################################################
# MacOSX: Require at least MacOSX 10.15 for C++17 support.
if(APPLE)
if(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 10.15)
CacheSet(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")
endif()
endif()
# Check if this is standalone or bundled.
set(STANDALONE ON)
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}")
set(GROUPED OFF)
set(PREFIX "")
else()
set(GROUPED ON)
set(PREFIX "StreamFX_")
if(GROUPED AND ((TARGET libobs) OR (TARGET OBS::libobs)))
set(STANDALONE OFF)
endif()
endif()
# Operating System
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(D_PLATFORM_OS "windows")
set(D_PLATFORM_WINDOWS 1)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(D_PLATFORM_OS "linux")
set(D_PLATFORM_LINUX 1)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(D_PLATFORM_OS "macos")
set(D_PLATFORM_MAC 1)
else()
set(D_PLATFORM_OS "unknown")
set(D_PLATFORM_UNKNOWN 1)
message(WARNING "The operating system '${CMAKE_SYSTEM_NAME}' is unknown to to this script, continue at your own risk.")
endif()
# Architecture
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()
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_ARCH_X86 ON)
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_ARCH_ARM ON)
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_ARCH_ITANIUM ON)
endif()
# Interprocedural Optimization
check_ipo_supported(RESULT D_HAS_IPO)
set(D_PLATFORM_INSTR ${ARCH_INST})
set(D_PLATFORM_ARCH ${ARCH_INST})
message(STATUS "Target is ${D_PLATFORM_BITS}bit ${ARCH_INST} with a pointer size of ${D_PLATFORM_BITS_PTR}bit.")
################################################################################
# Versioning
################################################################################
version(GENERATE _VERSION COMPRESSED MAJOR 0 MINOR 0 PATCH 0 TWEAK 0 REQUIRE "PATCH;")
version(PARSE _VERSION "${_VERSION}" REQUIRE "PATCH;TWEAK")
# If possible, automatically generate versions from git.
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/.git")
find_program(GIT
NAMES
git
git.exe
)
if(EXISTS "${GIT}")
# Try and calculate the exist version using git.
execute_process(COMMAND "${GIT}" describe --tags --long --abbrev=8 HEAD WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} RESULT_VARIABLE GIT_RESULT OUTPUT_VARIABLE GIT_OUTPUT ERROR_VARIABLE GIT_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
if((GIT_RESULT EQUAL 0) AND (NOT "${GIT_OUTPUT}" STREQUAL ""))
# Result will be MAJOR.MINOR.PATCH-TWEAK-gHASH
string(REPLACE "-" ";" GIT_OUTPUT "${GIT_OUTPUT}")
string(REPLACE "." ";" GIT_OUTPUT "${GIT_OUTPUT}")
# Split into components
list(GET GIT_OUTPUT 0 GIT_OUTPUT_MAJOR)
list(GET GIT_OUTPUT 1 GIT_OUTPUT_MINOR)
list(GET GIT_OUTPUT 2 GIT_OUTPUT_PATCH)
list(GET GIT_OUTPUT 3 GIT_OUTPUT_TWEAK)
list(GET GIT_OUTPUT 4 GIT_OUTPUT_BUILD)
# Special case: Tag contains prerelease
if(GIT_OUTPUT_PATCH MATCHES "([0-9]+)([a-zA-Z]+)([0-9]*)")
# Patch requires special parsing.
set(GIT_OUTPUT_PATCH "${CMAKE_MATCH_1}")
if(CMAKE_MATCH_3 GREATER 0)
set(GIT_OUTPUT_PRERELEASE "${CMAKE_MATCH_2}")
else()
set(GIT_OUTPUT_PRERELEASE "a")
endif()
MATH(EXPR GIT_OUTPUT_TWEAK "${GIT_OUTPUT_TWEAK} + ${CMAKE_MATCH_3}")
# Modify the global version
version(MODIFY _VERSION "${_VERSION}" COMPRESS
MAJOR "${GIT_OUTPUT_MAJOR}"
MINOR "${GIT_OUTPUT_MINOR}"
PATCH "${GIT_OUTPUT_PATCH}"
TWEAK "${GIT_OUTPUT_TWEAK}"
BUILD "${GIT_OUTPUT_BUILD}"
PRERELEASE "${GIT_OUTPUT_PRERELEASE}"
REQUIRE "PATCH;TWEAK"
)
else()
# Modify the global version
version(MODIFY _VERSION "${_VERSION}" COMPRESS
MAJOR "${GIT_OUTPUT_MAJOR}"
MINOR "${GIT_OUTPUT_MINOR}"
PATCH "${GIT_OUTPUT_PATCH}"
TWEAK "${GIT_OUTPUT_TWEAK}"
BUILD "${GIT_OUTPUT_BUILD}"
PRERELEASE "a"
REQUIRE "PATCH;TWEAK"
)
endif()
else()
execute_process(COMMAND "${GIT}" rev-list --count HEAD WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} RESULT_VARIABLE GIT_RESULT OUTPUT_VARIABLE GIT_OUTPUT ERROR_VARIABLE GIT_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
if((GIT_RESULT EQUAL 0) AND (NOT "${GIT_OUTPUT}" STREQUAL ""))
version(MODIFY _VERSION "${_VERSION}" COMPRESS
TWEAK "${GIT_OUTPUT}"
PRERELEASE "a"
REQUIRE "PATCH;TWEAK"
)
# Determine the build using git.
execute_process(COMMAND "${GIT}" log -1 "--pretty=format:g%h" --abbrev=8 HEAD WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} RESULT_VARIABLE GIT_RESULT OUTPUT_VARIABLE GIT_OUTPUT ERROR_VARIABLE GIT_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
if((GIT_RESULT EQUAL 0) AND (NOT "${GIT_OUTPUT}" STREQUAL ""))
version(MODIFY _VERSION "${_VERSION}" COMPRESS
BUILD "${GIT_OUTPUT}"
REQUIRE "PATCH;TWEAK"
)
else()
message(WARNING "Failed to detect build version with 'git'.")
endif()
else()
message(WARNING "Failed to automatically detect version with 'git'.")
endif()
endif()
else()
message(WARNING "'git' not found, automatic version detection disabled.")
endif()
else()
message(STATUS "Not a git repository, automatic version detection disabled.")
endif()
version(PARSE _VERSION "${_VERSION}" REQUIRE "PATCH;TWEAK")
# Allow manual overrides of the detected version.
if(NOT ("${${PREFIX}VERSION}" STREQUAL ""))
version(PARSE _VERSION_CFG "${${PREFIX}VERSION}" REQUIRE "PATCH;TWEAK")
if("${_VERSION_CFG_BUILD}" STREQUAL "")
set(_VERSION_CFG_BUILD "${_VERSION_BUILD}")
endif()
version(GENERATE _VERSION COMPRESS
MAJOR "${_VERSION_CFG_MAJOR}"
MINOR "${_VERSION_CFG_MINOR}"
PATCH "${_VERSION_CFG_PATCH}"
TWEAK "${_VERSION_CFG_TWEAK}"
PRERELEASE "${_VERSION_CFG_PRERELEASE}"
BUILD "${_VERSION_CFG_BUILD}"
)
endif()
set(_VERSION_THIN "${_VERSION_MAJOR}.${_VERSION_MINOR}.${_VERSION_PATCH}")
if(NOT (_VERSION_PRERELEASE STREQUAL ""))
set(_VERSION_THIN "${_VERSION_THIN}${_VERSION_PRERELEASE}${_VERSION_TWEAK}")
endif()
if(NOT (VERSION_COMMIT STREQUAL ""))
set(_VERSION_THIN "${_VERSION_THIN}-${_VERSION_BUILD}")
endif()
# Parse & Log the detected version.
message(STATUS "Version ${_VERSION_THIN}")
################################################################################
# Options
################################################################################
# Don't enable stability affecting features by default.
if(_VERSION_PRERELEASE STREQUAL "a")
set(FEATURE_DEPRECATED ON)
set(FEATURE_EXPERIMENTAL ON)
set(FEATURE_UNSTABLE ON)
set(FEATURE_STABLE ON)
elseif(_VERSION_PRERELEASE STREQUAL "b")
set(FEATURE_DEPRECATED ON)
set(FEATURE_EXPERIMENTAL ON)
set(FEATURE_UNSTABLE ON)
set(FEATURE_STABLE ON)
elseif(_VERSION_PRERELEASE STREQUAL "c")
set(FEATURE_DEPRECATED ON)
set(FEATURE_EXPERIMENTAL OFF)
set(FEATURE_UNSTABLE ON)
set(FEATURE_STABLE ON)
else()
set(FEATURE_DEPRECATED ON)
set(FEATURE_EXPERIMENTAL OFF)
set(FEATURE_UNSTABLE OFF)
set(FEATURE_STABLE ON)
endif()
# Version override
set(${PREFIX}VERSION "" CACHE STRING "Specify an override for the automatically detected version. Accepts a mixture of SemVer 2.0 and CMake Version.")
# Features
## Encoders
set(${PREFIX}ENABLE_ENCODER_FFMPEG ${FEATURE_STABLE} CACHE BOOL "Enable FFmpeg Encoder integration.")
set(${PREFIX}ENABLE_ENCODER_FFMPEG_AMF ${FEATURE_DEPRECATED} CACHE BOOL "Enable AMF Encoder in FFmpeg.")
set(${PREFIX}ENABLE_ENCODER_FFMPEG_NVENC ${FEATURE_STABLE} CACHE BOOL "Enable NVENC Encoder in FFmpeg.")
set(${PREFIX}ENABLE_ENCODER_FFMPEG_PRORES ${FEATURE_STABLE} CACHE BOOL "Enable ProRes Encoder in FFmpeg.")
set(${PREFIX}ENABLE_ENCODER_FFMPEG_DNXHR ${FEATURE_STABLE} CACHE BOOL "Enable DNXHR Encoder in FFmpeg.")
set(${PREFIX}ENABLE_ENCODER_FFMPEG_CFHD ${FEATURE_STABLE} CACHE BOOL "Enable CineForm Encoder in FFmpeg.")
## Filters
set(${PREFIX}ENABLE_FILTER_AUTOFRAMING ${FEATURE_EXPERIMENTAL} CACHE BOOL "Enable Auto-Framing Filter")
set(${PREFIX}ENABLE_FILTER_AUTOFRAMING_NVIDIA ${FEATURE_EXPERIMENTAL} CACHE BOOL "Enable NVIDIA provider(s) Auto-Framing Filter")
set(${PREFIX}ENABLE_FILTER_BLUR ${FEATURE_UNSTABLE} CACHE BOOL "Enable Blur Filter")
set(${PREFIX}ENABLE_FILTER_COLOR_GRADE ${FEATURE_STABLE} CACHE BOOL "Enable Color Grade Filter")
set(${PREFIX}ENABLE_FILTER_DENOISING ${FEATURE_EXPERIMENTAL} CACHE BOOL "Enable Denoising filter")
set(${PREFIX}ENABLE_FILTER_DENOISING_NVIDIA ${FEATURE_EXPERIMENTAL} CACHE BOOL "Enable NVIDIA provider(s) for Denoising Filter")
set(${PREFIX}ENABLE_FILTER_DYNAMIC_MASK ${FEATURE_STABLE} CACHE BOOL "Enable Dynamic Mask Filter")
set(${PREFIX}ENABLE_FILTER_SDF_EFFECTS ${FEATURE_EXPERIMENTAL} CACHE BOOL "Enable SDF Effects Filter")
set(${PREFIX}ENABLE_FILTER_SHADER ${FEATURE_EXPERIMENTAL} CACHE BOOL "Enable Shader Filter")
set(${PREFIX}ENABLE_FILTER_TRANSFORM ${FEATURE_STABLE} CACHE BOOL "Enable Transform Filter")
set(${PREFIX}ENABLE_FILTER_UPSCALING ${FEATURE_EXPERIMENTAL} CACHE BOOL "Enable Upscaling Filter")
set(${PREFIX}ENABLE_FILTER_UPSCALING_NVIDIA ${FEATURE_EXPERIMENTAL} CACHE BOOL "Enable NVIDIA provider(s) for Upscaling Filter")
set(${PREFIX}ENABLE_FILTER_VIRTUAL_GREENSCREEN ${FEATURE_EXPERIMENTAL} CACHE BOOL "Enable Virtual Greenscreen Filter")
set(${PREFIX}ENABLE_FILTER_VIRTUAL_GREENSCREEN_NVIDIA ${FEATURE_EXPERIMENTAL} CACHE BOOL "Enable NVIDIA provider(s) for Virtual Greenscreen Filter")
## Sources
set(${PREFIX}ENABLE_SOURCE_MIRROR ${FEATURE_DEPRECATED} CACHE BOOL "Enable Mirror Source")
set(${PREFIX}ENABLE_SOURCE_SHADER ${FEATURE_EXPERIMENTAL} CACHE BOOL "Enable Shader Source")
## Transitions
set(${PREFIX}ENABLE_TRANSITION_SHADER ${FEATURE_EXPERIMENTAL} CACHE BOOL "Enable Shader Transition")
## FrontEnd & UI
set(${PREFIX}ENABLE_FRONTEND ON CACHE BOOL "Enable Frontend code.")
set(${PREFIX}ENABLE_UPDATER ON CACHE BOOL "Enable automatic update checks.")
## Code Related
if(COMMAND clang_format)
set(${PREFIX}ENABLE_CLANG OFF CACHE BOOL "Enable Clang integration for supported compilers.")
endif()
set(${PREFIX}ENABLE_PROFILING OFF CACHE BOOL "Enable CPU and GPU performance tracking, which has a non-zero overhead at all times. Do not enable this for release builds.")
## Compile/Link Related
set(${PREFIX}ENABLE_LTO ${D_HAS_IPO} CACHE BOOL "Enable Link Time Optimization for faster and smaller binaries.")
set(${PREFIX}ENABLE_FASTMATH ON CACHE BOOL "Enable fast math optimizations, which sacrifice precision and stability.")
if(D_PLATFORM_ARCH_X86)
set(${PREFIX}TARGET_X86_64_V4 OFF CACHE BOOL "Target x86-64-v4 (x86-64-v3, AVX512F, AVX512BW, AVX512CD, AVX512DQ, AVX512VL).")
set(${PREFIX}TARGET_X86_64_V3 OFF CACHE BOOL "Target x86-64-v3 (x86-64-v2, AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE, OSXSAVE).")
set(${PREFIX}TARGET_X86_64_V2_EX ON CACHE BOOL "Target extended x86-64-v2 (x86-64-v2, AVX, BMI1, BMI2, F16C, FMA, MOVBE).")
set(${PREFIX}TARGET_X86_64_V2 ON CACHE BOOL "Target x86-64-v2 (x86-64, CMPXCHG16B, LAHF-SAHF, POPCNT, SSE3, SSE4.1, SSE4.2, SSSE3).")
set(${PREFIX}TARGET_X86_64 ON CACHE BOOL "Target x86-64 (CMOV, CX8, FPU, FXSR, MMX, OSFXSR, SCE, SSE, SSE2).")
endif()
if(NOT MSVC)
set(${PREFIX}TARGET_NATIVE OFF CACHE BOOL "Target the native CPU architecture. Enable it for development or personal builds, but disable it for distribution.")
endif()
# Installation / Packaging
if(STANDALONE)
set(STRUCTURE_UNIFIED CACHE BOOL "Install for use in a Plugin Manager")
if(D_PLATFORM_LINUX)
set(STRUCTURE_PACKAGEMANAGER CACHE BOOL "Install for use in a Package Manager (system-wide installation)")
elseif(D_PLATFORM_MAC)
set(STRUCTURE_BUNDLE ON CACHE BOOL "Install as a Loadable Bundle (.plugin)")
endif()
set(PACKAGE_PREFIX "${CMAKE_BINARY_DIR}" CACHE PATH "Where to place the packages?")
set(PACKAGE_NAME "${PROJECT_NAME}" CACHE STRING "What should the package be called?")
set(PACKAGE_SUFFIX "" CACHE STRING "Any suffix for the package name? (Defaults to the current version string)")
endif()
# 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")
################################################################################
# Project
################################################################################
# Metadata
version(GENERATE PROJECT_VERSION
MAJOR "${_VERSION_MAJOR}"
MINOR "${_VERSION_MINOR}"
PATCH "${_VERSION_PATCH}"
TWEAK "${_VERSION_TWEAK}"
REQUIRE "PATCH;TWEAK"
)
project(
StreamFX
VERSION ${PROJECT_VERSION}
DESCRIPTION "Additional sources, filters, transitions and encoders for OBS Studio."
HOMEPAGE_URL "https://streamfx.xaymar.com/"
)
set(PROJECT_IDENTIFER "com.xaymar.${PROJECT_NAME}.obs")
set(PROJECT_TITLE "StreamFX (for OBS Studio)")
set(PROJECT_AUTHORS "Michael Fabian 'Xaymar' Dirks <info@xaymar.com>")
set(PROJECT_COPYRIGHT "2017 - 2022, Michael Fabian Dirks. All Rights Reserved")
set(PROJECT_TRADEMARKS "")
list(APPEND PROJECT_TRADEMARKS
"AMD is a trademark of Advanced Micro Devices Inc."
"NVIDIA is a trademark of Nvidia Corporation"
)
# Component search paths
list(APPEND CMAKE_PREFIX_PATH
"${${PREFIX}AOM_PATH}"
"${${PREFIX}OBSDEPS_PATH}"
"${${PREFIX}QT_PATH}"
"${AOM_DIR}"
"${CURL_DIR}"
"${DepsPath}"
"${FFmpeg_DIR}"
"${libobs_DIR}"
"${Qt_DIR}"
"${Qt5_DIR}"
"${Qt6_DIR}"
"${QTDIR}"
)
if(D_PLATFORM_MAC)
list(APPEND CMAKE_PREFIX_PATH
"${${PREFIX}AOM_PATH}/Frameworks"
"${${PREFIX}OBSDEPS_PATH}/Frameworks"
"${${PREFIX}QT_PATH}/Frameworks"
"${AOM_DIR}/Frameworks"
"${CURL_DIR}/Frameworks"
"${DepsPath}/Frameworks"
"${FFmpeg_DIR}/Frameworks"
"${libobs_DIR}/Frameworks"
"${Qt_DIR}/Frameworks"
"${Qt5_DIR}/Frameworks"
"${Qt6_DIR}/Frameworks"
"${QTDIR}/Frameworks"
)
endif()
set_property(GLOBAL PROPERTY AUTOGEN_SOURCE_GROUP "User-Interface Files/Generated")
################################################################################
# Components (Old System)
################################################################################
# Component resolving:
# 1. Check which features are enabled. For each feature, set what they require to ON.
# 2. Try and find required items.
# 3. Again check which features are enabled, if their requirements are missing, warn about it and disable them.
# TODO: Consider making this an error instead.
macro(is_feature_enabled FEATURE OUTPUT)
set(T_ENABLED ${${PREFIX}ENABLE_${FEATURE}})
set(T_DISABLED ${${PREFIX}DISABLE_${FEATURE}})
if(T_ENABLED AND NOT T_DISABLED)
set(${OUTPUT} ON)
else()
# set(${PREFIX}DISABLE_${FEATURE} ON CACHE INTERNAL "" FORCE)
set(${OUTPUT} OFF)
endif()
endmacro()
macro(set_feature_disabled FEATURE DISABLED)
set(${PREFIX}DISABLE_${FEATURE} ${DISABLED} CACHE INTERNAL "" FORCE)
endmacro()
# Features
function(feature_encoder_ffmpeg RESOLVE)
is_feature_enabled(ENCODER_FFMPEG T_CHECK)
if(RESOLVE AND T_CHECK)
if(NOT HAVE_FFMPEG)
message(WARNING "FFmpeg Encoder requires FFmpeg. Disabling...")
set_feature_disabled(ENCODER_FFMPEG ON)
else()
# AMF
is_feature_enabled(ENCODER_FFMPEG_AMF T_CHECK)
if(T_CHECK AND D_PLATFORM_MAC)
message(WARNING "FFmpeg Encoder 'AMF' requires Windows or Linux. Disabling...")
set_feature_disabled(ENCODER_FFMPEG_AMF ON)
endif()
# NVENC
is_feature_enabled(ENCODER_FFMPEG_NVENC T_CHECK)
if(T_CHECK AND D_PLATFORM_MAC)
message(WARNING "FFmpeg Encoder 'NVENC' requires Windows or Linux. Disabling...")
set_feature_disabled(ENCODER_FFMPEG_NVENC ON)
endif()
# ProRes
is_feature_enabled(ENCODER_FFMPEG_PRORES T_CHECK)
# DNxHR
is_feature_enabled(ENCODER_FFMPEG_DNXHR T_CHECK)
# CineForm
is_feature_enabled(ENCODER_FFMPEG_CFHD T_CHECK)
endif()
elseif(T_CHECK)
set(REQUIRE_FFMPEG ON PARENT_SCOPE)
endif()
endfunction()
function(feature_encoder_aom_av1 RESOLVE)
is_feature_enabled(ENCODER_AOM_AV1 T_CHECK)
if(RESOLVE AND T_CHECK)
if(NOT HAVE_AOM)
message(WARNING "AOM AV1 encoder missing AOM library. Disabling...")
set_feature_disabled(ENCODER_AOM_AV1 ON)
endif()
elseif(T_CHECK)
set(REQUIRE_AOM ON PARENT_SCOPE)
endif()
endfunction()
function(feature_filter_autoframing RESOLVE)
is_feature_enabled(FILTER_AUTOFRAMING T_CHECK)
if(RESOLVE AND T_CHECK)
# Verify that the requirements for the providers are available
if(NOT HAVE_NVIDIA_AR_SDK)
message(WARNING "'NVIDIA Augmented Reality SDK' is missing. Disabling NVIDIA provider...")
set_feature_disabled(FILTER_AUTOFRAMING_NVIDIA ON)
endif()
# Verify that we have at least one provider for Auto-Framing.
is_feature_enabled(FILTER_AUTOFRAMING_NVIDIA T_CHECK_NVIDIA)
if(NOT T_CHECK_NVIDIA)
message(WARNING "Auto-Framing has no available providers. Disabling...")
set_feature_disabled(FILTER_AUTOFRAMING ON)
endif()
elseif(T_CHECK)
set(REQUIRE_NVIDIA_AR_SDK ON PARENT_SCOPE)
set(REQUIRE_NVIDIA_CUDA ON PARENT_SCOPE)
endif()
endfunction()
function(feature_filter_blur RESOLVE)
is_feature_enabled(FILTER_BLUR T_CHECK)
endfunction()
function(feature_filter_color_grade RESOLVE)
is_feature_enabled(FILTER_COLOR_GRADE T_CHECK)
endfunction()
function(feature_filter_denoising RESOLVE)
is_feature_enabled(FILTER_DENOISING T_CHECK)
if(RESOLVE AND T_CHECK)
# Verify that the requirements for the providers are available
if(NOT HAVE_NVIDIA_VFX_SDK)
message(WARNING "'NVIDIA Video Effects SDK' is missing. Disabling NVIDIA provider...")
set_feature_disabled(FILTER_DENOISING_NVIDIA ON)
endif()
# Verify that we have at least one provider for Video Denoising.
is_feature_enabled(FILTER_DENOISING_NVIDIA T_CHECK_NVIDIA)
if(NOT T_CHECK_NVIDIA)
message(WARNING "Denoising has no available providers. Disabling...")
set_feature_disabled(FILTER_DENOISING ON)
endif()
elseif(T_CHECK)
set(REQUIRE_NVIDIA_VFX_SDK ON PARENT_SCOPE)
endif()
endfunction()
function(feature_filter_dynamic_mask RESOLVE)
is_feature_enabled(FILTER_DYNAMIC_MASK T_CHECK)
endfunction()
function(feature_filter_sdf_effects RESOLVE)
is_feature_enabled(FILTER_SDF_EFFECTS T_CHECK)
endfunction()
function(feature_filter_shader RESOLVE)
is_feature_enabled(FILTER_SHADER T_CHECK)
endfunction()
function(feature_filter_transform RESOLVE)
is_feature_enabled(FILTER_TRANSFORM T_CHECK)
endfunction()
function(feature_filter_upscaling RESOLVE)
is_feature_enabled(FILTER_UPSCALING T_CHECK)
if(RESOLVE AND T_CHECK)
# Verify that the requirements for the providers are available
if(NOT HAVE_NVIDIA_VFX_SDK)
message(WARNING "'NVIDIA Video Effects SDK' is missing. Disabling NVIDIA provider(s)...")
set_feature_disabled(FILTER_UPSCALING_NVIDIA ON)
endif()
# Verify that we have at least one provider for Video Super-Resolution.
is_feature_enabled(FILTER_UPSCALING_NVIDIA T_CHECK_NVIDIA)
if(NOT T_CHECK_NVIDIA)
message(WARNING "Upscaling has no available providers. Disabling...")
set_feature_disabled(FILTER_UPSCALING ON)
endif()
elseif(T_CHECK)
set(REQUIRE_NVIDIA_VFX_SDK ON PARENT_SCOPE)
endif()
endfunction()
function(feature_filter_virtual_greenscreen RESOLVE)
is_feature_enabled(FILTER_VIRTUAL_GREENSCREEN T_CHECK)
if(RESOLVE AND T_CHECK)
# Verify that the requirements for the providers are available
if(NOT HAVE_NVIDIA_VFX_SDK)
message(WARNING "'NVIDIA Video Effects SDK' is missing. Disabling NVIDIA provider(s)...")
set_feature_disabled(FILTER_VIRTUAL_GREENSCREEN_NVIDIA ON)
endif()
# Verify that we have at least one provider for Video Super-Resolution.
is_feature_enabled(FILTER_VIRTUAL_GREENSCREEN_NVIDIA T_CHECK_NVIDIA)
if(NOT T_CHECK_NVIDIA)
message(WARNING "Virtual Greenscreen has no available providers. Disabling...")
set_feature_disabled(FILTER_VIRTUAL_GREENSCREEN ON)
endif()
elseif(T_CHECK)
set(REQUIRE_NVIDIA_VFX_SDK ON PARENT_SCOPE)
endif()
endfunction()
function(feature_source_mirror RESOLVE)
is_feature_enabled(SOURCE_MIRROR T_CHECK)
endfunction()
function(feature_source_shader RESOLVE)
is_feature_enabled(SOURCE_SHADER T_CHECK)
endfunction()
function(feature_transition_shader RESOLVE)
is_feature_enabled(TRANSITION_SHADER T_CHECK)
endfunction()
function(feature_frontend RESOLVE)
is_feature_enabled(FRONTEND T_CHECK)
if(RESOLVE AND T_CHECK)
if(NOT (Qt6_FOUND OR Qt5_FOUND))
message(WARNING "Front-End requires Qt. Disabling...")
set_feature_disabled(FRONTEND ON)
elseif(NOT obs-frontend-api_FOUND)
message(WARNING "Front-End requires OBS FrontEnd API. Disabling...")
set_feature_disabled(FRONTEND ON)
elseif(NOT HAVE_JSON)
message(WARNING "Front-End requires nlohmann::json. Disabling...")
set_feature_disabled(FRONTEND ON)
endif()
elseif(T_CHECK)
set(REQUIRE_QT ON PARENT_SCOPE)
set(REQUIRE_OBS_FRONTEND_API ON PARENT_SCOPE)
set(REQUIRE_JSON ON PARENT_SCOPE)
endif()
endfunction()
function(feature_updater RESOLVE)
is_feature_enabled(UPDATER T_CHECK)
if(RESOLVE AND T_CHECK)
if(NOT CURL_FOUND)
message(WARNING "Updater requires CURL. Disabling...")
set_feature_disabled(UPDATER ON)
elseif(NOT HAVE_JSON)
message(WARNING "Updater requires nlohmann::json. Disabling...")
set_feature_disabled(UPDATER ON)
endif()
elseif(T_CHECK)
set(REQUIRE_CURL ON PARENT_SCOPE)
set(REQUIRE_JSON ON PARENT_SCOPE)
endif()
endfunction()
# Set Requirements
feature_encoder_ffmpeg(OFF)
feature_encoder_aom_av1(OFF)
feature_filter_autoframing(OFF)
feature_filter_blur(OFF)
feature_filter_color_grade(OFF)
feature_filter_denoising(OFF)
feature_filter_dynamic_mask(OFF)
feature_filter_sdf_effects(OFF)
feature_filter_shader(OFF)
feature_filter_transform(OFF)
feature_filter_upscaling(OFF)
feature_filter_virtual_greenscreen(OFF)
feature_source_mirror(OFF)
feature_source_shader(OFF)
feature_transition_shader(OFF)
feature_frontend(OFF)
feature_updater(OFF)
# Fulfill Requirements
#- OBS: Library
if(STANDALONE)
find_package("libobs" REQUIRED CONFIG)
elseif(NOT TARGET OBS::libobs)
# Add the missing OBS::libobs alias target if possible.
add_library(OBS::libobs ALIAS libobs)
endif()
if(D_PLATFORM_MAC)
# We may need to reconstruct the include directories on MacOS.
get_target_property(libobs_INTERFACE_INCLUDE_DIRECTORIES OBS::libobs INTERFACE_INCLUDE_DIRECTORIES)
if("${libobs_INTERFACE_INCLUDE_DIRECTORIES}" STREQUAL "libobs_INTERFACE_INCLUDE_DIRECTORIES-NOTFOUND")
get_target_property(libobs_IMPORTED_LOCATION_RELEASE OBS::libobs IMPORTED_LOCATION_RELEASE)
get_filename_component(libobs_IMPORTED_LOCATION_RELEASE "${libobs_IMPORTED_LOCATION_RELEASE}" DIRECTORY)
get_filename_component(libobs_IMPORTED_LOCATION_RELEASE "${libobs_IMPORTED_LOCATION_RELEASE}" DIRECTORY)
get_filename_component(libobs_IMPORTED_LOCATION_RELEASE "${libobs_IMPORTED_LOCATION_RELEASE}" DIRECTORY)
set(libobs_IMPORTED_LOCATION_RELEASE "${libobs_IMPORTED_LOCATION_RELEASE}/Headers")
set_target_properties(OBS::libobs PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES
"${libobs_IMPORTED_LOCATION_RELEASE}"
)
endif()
endif()
#- OBS: Front-End API
set(obs-frontend-api_FOUND OFF)
if(REQUIRE_OBS_FRONTEND_API)
if(STANDALONE)
find_package("obs-frontend-api" CONFIG)
set(obs-frontend-api_FOUND "${obs-frontend-api_FOUND}")
elseif(TARGET obs-frontend-api)
set(obs-frontend-api_FOUND ON)
endif()
if(NOT TARGET OBS::obs-frontend-api)
add_library(OBS::obs-frontend-api ALIAS obs-frontend-api)
endif()
endif()
#- CURL
set(CURL_FOUND OFF)
if(REQUIRE_CURL)
find_package("CURL")
endif()
#- FFmpeg
set(HAVE_FFMPEG OFF)
if(REQUIRE_FFMPEG)
find_package("FFmpeg"
COMPONENTS "avutil" "avcodec" "swscale"
)
set(HAVE_FFMPEG ${FFmpeg_FOUND})
endif()
#- AOM
set(HAVE_AOM OFF)
if(REQUIRE_AOM)
if(NOT D_PLATFORM_MAC)
find_package("AOM")
set(HAVE_AOM ${AOM_FOUND})
endif()
endif()
#- JSON
set(HAVE_JSON OFF)
if(REQUIRE_JSON)
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/third-party/nlohmann-json/single_include")
message(FATAL_ERROR "Please make sure to update git submodules to their latest supported version.")
return()
else()
set(JSON_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/third-party/nlohmann-json/single_include")
set(HAVE_JSON ON)
endif()
endif()
#- NVIDIA Augmented Reality SDK
set(HAVE_NVIDIA_AR_SDK OFF)
if(REQUIRE_NVIDIA_AR_SDK AND D_PLATFORM_WINDOWS)
if(EXISTS "${PROJECT_SOURCE_DIR}/third-party/nvidia-maxine-ar-sdk/version.h")
set(HAVE_NVIDIA_AR_SDK ON)
endif()
if(NOT TARGET NVIDIA::AR)
add_library(NVIDIA::AR IMPORTED INTERFACE)
target_include_directories(NVIDIA::AR
INTERFACE
"${PROJECT_SOURCE_DIR}/third-party/nvidia-maxine-ar-sdk/nvar/include/"
"${PROJECT_SOURCE_DIR}/third-party/nvidia-maxine-ar-sdk/nvar/src/"
)
endif()
endif()
#- NVIDIA Video Effects SDK
set(HAVE_NVIDIA_VFX_SDK OFF)
if(REQUIRE_NVIDIA_VFX_SDK AND D_PLATFORM_WINDOWS)
if(EXISTS "${PROJECT_SOURCE_DIR}/third-party/nvidia-maxine-vfx-sdk/version.h")
set(HAVE_NVIDIA_VFX_SDK ON)
endif()
if(NOT TARGET NVIDIA::VFX)
add_library(NVIDIA::VFX IMPORTED INTERFACE)
target_include_directories(NVIDIA::VFX
INTERFACE
"${PROJECT_SOURCE_DIR}/third-party/nvidia-maxine-vfx-sdk/nvvfx/include/"
"${PROJECT_SOURCE_DIR}/third-party/nvidia-maxine-vfx-sdk/nvvfx/src/"
)
endif()
set(REQUIRE_NVIDIA_CUDA ON)
endif()
#- NVIDIA CUDA (Windows)
set(HAVE_NVIDIA_CUDA OFF)
if(REQUIRE_NVIDIA_CUDA AND D_PLATFORM_WINDOWS)
set(HAVE_NVIDIA_CUDA ON)
endif()
#- Qt
if(REQUIRE_QT)
# Try Qt6 first...
find_package("Qt6"
COMPONENTS Core Gui Widgets
CONFIG
)
# If Qt6 isn't present, try Qt5
if(NOT Qt6_FOUND)
find_package("Qt5"
COMPONENTS Core Gui Widgets
CONFIG
)
endif()
if(Qt6_FOUND)
message(STATUS "Using Qt6.")
elseif(Qt5_FOUND)
message(STATUS "Using Qt5.")
endif()
endif()
# Verify Requirements
feature_encoder_ffmpeg(ON)
feature_encoder_aom_av1(ON)
feature_filter_autoframing(ON)
feature_filter_blur(ON)
feature_filter_color_grade(ON)
feature_filter_denoising(ON)
feature_filter_dynamic_mask(ON)
feature_filter_sdf_effects(ON)
feature_filter_shader(ON)
feature_filter_transform(ON)
feature_filter_upscaling(ON)
feature_filter_virtual_greenscreen(ON)
feature_source_mirror(ON)
feature_source_shader(ON)
feature_transition_shader(ON)
feature_frontend(ON)
feature_updater(ON)
################################################################################
# Code
################################################################################
set(PROJECT_DATA )
set(PROJECT_LIBRARIES )
set(PROJECT_LIBRARIES_DELAYED )
set(PROJECT_INCLUDE_DIRS )
set(PROJECT_TEMPLATES )
set(PROJECT_PRIVATE_GENERATED )
set(PROJECT_PRIVATE_SOURCE )
set(PROJECT_UI )
set(PROJECT_UI_SOURCE )
set(PROJECT_DEFINITIONS )
set(PROJECT_MEDIA )
# Data
file(GLOB_RECURSE PROJECT_DATA "data/*")
# Media
file(GLOB_RECURSE PROJECT_MEDIA "media/*")
# Templates
file(GLOB_RECURSE PROJECT_TEMPLATES "templates/*")
# Configure Files
configure_file(
"templates/config.hpp.in"
"generated/config.hpp"
)
LIST(APPEND PROJECT_TEMPLATES "templates/config.hpp.in")
LIST(APPEND PROJECT_PRIVATE_GENERATED "${PROJECT_BINARY_DIR}/generated/config.hpp")
configure_file(
"templates/version.hpp.in"
"generated/version.hpp"
)
LIST(APPEND PROJECT_TEMPLATES "templates/version.hpp.in")
LIST(APPEND PROJECT_PRIVATE_GENERATED "${PROJECT_BINARY_DIR}/generated/version.hpp")
configure_file(
"templates/module.cpp.in"
"generated/module.cpp"
)
LIST(APPEND PROJECT_TEMPLATES "templates/module.cpp.in")
LIST(APPEND PROJECT_PRIVATE_GENERATED "${PROJECT_BINARY_DIR}/generated/module.cpp")
# Minimum Dependencies
list(APPEND PROJECT_LIBRARIES OBS::libobs)
# Components
if(CURL_FOUND)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/util/util-curl.hpp"
"source/util/util-curl.cpp"
)
list(APPEND PROJECT_LIBRARIES CURL::libcurl)
endif()
if(HAVE_FFMPEG)
list(APPEND PROJECT_LIBRARIES
${FFMPEG_LIBRARIES}
)
list(APPEND PROJECT_INCLUDE_DIRS
${FFMPEG_INCLUDE_DIRS}
)
endif()
if(HAVE_JSON)
list(APPEND PROJECT_INCLUDE_DIRS ${JSON_INCLUDE_DIR})
endif()
if(TRUE) # OpenGL
if(NOT TARGET khronos_glad)
add_library(khronos_glad STATIC
"${PROJECT_SOURCE_DIR}/third-party/khronos/glad/src/gl.c"
)
target_include_directories(khronos_glad
PRIVATE
"${PROJECT_SOURCE_DIR}/third-party/khronos/glad/include"
INTERFACE
"${PROJECT_SOURCE_DIR}/third-party/khronos/glad/include"
PUBLIC
"${PROJECT_SOURCE_DIR}/third-party/khronos/glad/include"
)
if(D_PLATFORM_WINDOWS)
target_sources(khronos_glad
PRIVATE
"${PROJECT_SOURCE_DIR}/third-party/khronos/glad/src/wgl.c"
)
elseif(D_PLATFORM_LINUX)
target_sources(khronos_glad
PRIVATE
"${PROJECT_SOURCE_DIR}/third-party/khronos/glad/src/glx.c"
)
endif()
# Requires for shared/static mixing.
set_property(TARGET khronos_glad PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()
list(APPEND PROJECT_LIBRARIES khronos_glad)
endif()
if(HAVE_NVIDIA_VFX_SDK OR HAVE_NVIDIA_AR_SDK)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/nvidia/cv/nvidia-cv.hpp"
"source/nvidia/cv/nvidia-cv.cpp"
"source/nvidia/cv/nvidia-cv-image.hpp"
"source/nvidia/cv/nvidia-cv-image.cpp"
"source/nvidia/cv/nvidia-cv-texture.hpp"
"source/nvidia/cv/nvidia-cv-texture.cpp"
)
endif()
if(HAVE_NVIDIA_AR_SDK)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/nvidia/ar/nvidia-ar.hpp"
"source/nvidia/ar/nvidia-ar.cpp"
"source/nvidia/ar/nvidia-ar-feature.hpp"
"source/nvidia/ar/nvidia-ar-feature.cpp"
"source/nvidia/ar/nvidia-ar-facedetection.hpp"
"source/nvidia/ar/nvidia-ar-facedetection.cpp"
)
list(APPEND PROJECT_LIBRARIES
NVIDIA::AR
)
endif()
if(HAVE_NVIDIA_VFX_SDK)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/nvidia/vfx/nvidia-vfx.hpp"
"source/nvidia/vfx/nvidia-vfx.cpp"
"source/nvidia/vfx/nvidia-vfx-denoising.hpp"
"source/nvidia/vfx/nvidia-vfx-denoising.cpp"
"source/nvidia/vfx/nvidia-vfx-effect.hpp"
"source/nvidia/vfx/nvidia-vfx-effect.cpp"
"source/nvidia/vfx/nvidia-vfx-greenscreen.hpp"
"source/nvidia/vfx/nvidia-vfx-greenscreen.cpp"
"source/nvidia/vfx/nvidia-vfx-superresolution.hpp"
"source/nvidia/vfx/nvidia-vfx-superresolution.cpp"
)
list(APPEND PROJECT_LIBRARIES
NVIDIA::VFX
)
endif()
if(HAVE_NVIDIA_CUDA)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/nvidia/cuda/nvidia-cuda.hpp"
"source/nvidia/cuda/nvidia-cuda.cpp"
"source/nvidia/cuda/nvidia-cuda-obs.hpp"
"source/nvidia/cuda/nvidia-cuda-obs.cpp"
"source/nvidia/cuda/nvidia-cuda-context.hpp"
"source/nvidia/cuda/nvidia-cuda-context.cpp"
"source/nvidia/cuda/nvidia-cuda-gs-texture.hpp"
"source/nvidia/cuda/nvidia-cuda-gs-texture.cpp"
"source/nvidia/cuda/nvidia-cuda-memory.hpp"
"source/nvidia/cuda/nvidia-cuda-memory.cpp"
"source/nvidia/cuda/nvidia-cuda-stream.hpp"
"source/nvidia/cuda/nvidia-cuda-stream.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_NVIDIA_CUDA
)
endif()
if(REQUIRE_OBS_FRONTEND_API AND obs-frontend-api_FOUND)
list(APPEND PROJECT_LIBRARIES OBS::obs-frontend-api)
list(APPEND PROJECT_UI_SOURCE
"source/obs/browser/obs-browser-panel.hpp"
)
endif()
if(REQUIRE_QT)
if(Qt5_FOUND)
list(APPEND PROJECT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets)
elseif(Qt6_FOUND)
list(APPEND PROJECT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets)
endif()
endif()
################################################################################
# Features
################################################################################
# Core
list(APPEND PROJECT_PRIVATE_SOURCE
"source/warning-disable.hpp"
"source/warning-enable.hpp"
"source/configuration.hpp"
"source/configuration.cpp"
"source/common.hpp"
"source/strings.hpp"
"source/plugin.hpp"
"source/plugin.cpp"
"source/util/utility.hpp"
"source/util/utility.cpp"
"source/util/util-bitmask.hpp"
"source/util/util-event.hpp"
"source/util/util-library.cpp"
"source/util/util-library.hpp"
"source/util/util-logging.cpp"
"source/util/util-logging.hpp"
"source/util/util-platform.hpp"
"source/util/util-platform.cpp"
"source/util/util-threadpool.cpp"
"source/util/util-threadpool.hpp"
"source/gfx/gfx-util.hpp"
"source/gfx/gfx-util.cpp"
"source/gfx/gfx-mipmapper.hpp"
"source/gfx/gfx-mipmapper.cpp"
"source/gfx/gfx-opengl.hpp"
"source/gfx/gfx-opengl.cpp"
"source/gfx/gfx-source-texture.hpp"
"source/gfx/gfx-source-texture.cpp"
"source/obs/gs/gs-helper.hpp"
"source/obs/gs/gs-helper.cpp"
"source/obs/gs/gs-effect.hpp"
"source/obs/gs/gs-effect.cpp"
"source/obs/gs/gs-effect-parameter.hpp"
"source/obs/gs/gs-effect-parameter.cpp"
"source/obs/gs/gs-effect-pass.hpp"
"source/obs/gs/gs-effect-pass.cpp"
"source/obs/gs/gs-effect-technique.hpp"
"source/obs/gs/gs-effect-technique.cpp"
"source/obs/gs/gs-indexbuffer.hpp"
"source/obs/gs/gs-indexbuffer.cpp"
"source/obs/gs/gs-limits.hpp"
"source/obs/gs/gs-rendertarget.hpp"
"source/obs/gs/gs-rendertarget.cpp"
"source/obs/gs/gs-sampler.hpp"
"source/obs/gs/gs-sampler.cpp"
"source/obs/gs/gs-texture.hpp"
"source/obs/gs/gs-texture.cpp"
"source/obs/gs/gs-vertex.hpp"
"source/obs/gs/gs-vertex.cpp"
"source/obs/gs/gs-vertexbuffer.hpp"
"source/obs/gs/gs-vertexbuffer.cpp"
"source/obs/obs-signal-handler.hpp"
"source/obs/obs-signal-handler.cpp"
"source/obs/obs-source-tracker.hpp"
"source/obs/obs-source-tracker.cpp"
"source/obs/obs-tools.hpp"
"source/obs/obs-tools.cpp"
# obs_encoder_info_t, obs_encoder_t, obs_weak_encoder_t
"source/obs/obs-encoder-factory.hpp"
"source/obs/obs-encoder-factory.cpp"
# obs_source_info_t, obs_source_t, obs_weak_source_t
"source/obs/obs-source-factory.hpp"
"source/obs/obs-source-factory.cpp"
"source/obs/obs-source.hpp"
"source/obs/obs-source.cpp"
"source/obs/obs-source-active-child.hpp"
"source/obs/obs-source-active-child.cpp"
"source/obs/obs-source-active-reference.hpp"
"source/obs/obs-source-active-reference.cpp"
"source/obs/obs-source-showing-reference.hpp"
"source/obs/obs-source-showing-reference.cpp"
"source/obs/obs-weak-source.hpp"
"source/obs/obs-weak-source.cpp"
)
list(APPEND PROJECT_DATA
"data/effects/color_conversion_rgb_hsl.effect"
"data/effects/color_conversion_rgb_hsv.effect"
"data/effects/color_conversion_rgb_yuv.effect"
"data/effects/mipgen.effect"
"data/effects/pack-unpack.effect"
"data/effects/standard.effect"
"data/effects/shared.effect"
"data/locale/en-US.ini"
)
list(APPEND PROJECT_INCLUDE_DIRS
"${PROJECT_BINARY_DIR}/generated"
"${PROJECT_SOURCE_DIR}/source"
)
# Encoder/FFmpeg
is_feature_enabled(ENCODER_FFMPEG T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_PRIVATE_SOURCE
# FFmpeg
"source/ffmpeg/avframe-queue.cpp"
"source/ffmpeg/avframe-queue.hpp"
"source/ffmpeg/swscale.hpp"
"source/ffmpeg/swscale.cpp"
"source/ffmpeg/tools.hpp"
"source/ffmpeg/tools.cpp"
"source/ffmpeg/hwapi/base.hpp"
"source/ffmpeg/hwapi/base.cpp"
"source/ffmpeg/hwapi/d3d11.hpp"
"source/ffmpeg/hwapi/d3d11.cpp"
# Encoders
"source/encoders/encoder-ffmpeg.hpp"
"source/encoders/encoder-ffmpeg.cpp"
# Encoders/Codecs
"source/encoders/codecs/hevc.hpp"
"source/encoders/codecs/hevc.cpp"
"source/encoders/codecs/h264.hpp"
"source/encoders/codecs/h264.cpp"
"source/encoders/codecs/prores.hpp"
"source/encoders/codecs/prores.cpp"
"source/encoders/codecs/dnxhr.hpp"
"source/encoders/codecs/dnxhr.cpp"
# Encoders/Handlers
"source/encoders/ffmpeg/handler.hpp"
"source/encoders/ffmpeg/handler.cpp"
"source/encoders/ffmpeg/debug.hpp"
"source/encoders/ffmpeg/debug.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_ENCODER_FFMPEG
)
# AMF
is_feature_enabled(ENCODER_FFMPEG_AMF T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/encoders/ffmpeg/amf.hpp"
"source/encoders/ffmpeg/amf.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_ENCODER_FFMPEG_AMF
)
endif()
# NVENC
is_feature_enabled(ENCODER_FFMPEG_NVENC T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/encoders/ffmpeg/nvenc.hpp"
"source/encoders/ffmpeg/nvenc.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_ENCODER_FFMPEG_NVENC
)
endif()
# ProRES
is_feature_enabled(ENCODER_FFMPEG_PRORES T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/encoders/ffmpeg/prores_aw.hpp"
"source/encoders/ffmpeg/prores_aw.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_ENCODER_FFMPEG_PRORES
)
endif()
# DNxHR
is_feature_enabled(ENCODER_FFMPEG_DNXHR T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/encoders/ffmpeg/dnxhd.hpp"
"source/encoders/ffmpeg/dnxhd.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_ENCODER_FFMPEG_DNXHR
)
endif()
# CineForm HD
is_feature_enabled(ENCODER_FFMPEG_CFHD T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/encoders/ffmpeg/cfhd.hpp"
"source/encoders/ffmpeg/cfhd.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_ENCODER_FFMPEG_CFHD
)
endif()
endif()
# Filter/Auto-Framing
is_feature_enabled(FILTER_AUTOFRAMING T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/filters/filter-autoframing.hpp"
"source/filters/filter-autoframing.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_AUTOFRAMING
)
is_feature_enabled(FILTER_AUTOFRAMING_NVIDIA T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_AUTOFRAMING_NVIDIA
)
endif()
endif()
# Filter/Blur
is_feature_enabled(FILTER_BLUR T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_DATA
"data/effects/mask.effect"
"data/effects/blur/common.effect"
"data/effects/blur/box.effect"
"data/effects/blur/box-linear.effect"
"data/effects/blur/dual-filtering.effect"
"data/effects/blur/gaussian.effect"
"data/effects/blur/gaussian-linear.effect"
)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/gfx/blur/gfx-blur-base.hpp"
"source/gfx/blur/gfx-blur-base.cpp"
"source/gfx/blur/gfx-blur-box.hpp"
"source/gfx/blur/gfx-blur-box.cpp"
"source/gfx/blur/gfx-blur-box-linear.hpp"
"source/gfx/blur/gfx-blur-box-linear.cpp"
"source/gfx/blur/gfx-blur-dual-filtering.hpp"
"source/gfx/blur/gfx-blur-dual-filtering.cpp"
"source/gfx/blur/gfx-blur-gaussian.hpp"
"source/gfx/blur/gfx-blur-gaussian.cpp"
"source/gfx/blur/gfx-blur-gaussian-linear.hpp"
"source/gfx/blur/gfx-blur-gaussian-linear.cpp"
"source/filters/filter-blur.hpp"
"source/filters/filter-blur.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_BLUR
)
endif()
# Filter/Color Grade
is_feature_enabled(FILTER_COLOR_GRADE T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_DATA
"data/effects/color-grade.effect"
)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/filters/filter-color-grade.hpp"
"source/filters/filter-color-grade.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_COLOR_GRADE
)
set(REQUIRE_LUT ON)
endif()
# Filter/Dynamic Mask
is_feature_enabled(FILTER_DYNAMIC_MASK T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_DATA
"data/effects/channel-mask.effect"
)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/filters/filter-dynamic-mask.hpp"
"source/filters/filter-dynamic-mask.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_DYNAMIC_MASK
)
endif()
# Filter/SDF Effects
is_feature_enabled(FILTER_SDF_EFFECTS T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_DATA
"data/effects/sdf/sdf-producer.effect"
"data/effects/sdf/sdf-consumer.effect"
)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/filters/filter-sdf-effects.hpp"
"source/filters/filter-sdf-effects.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_SDF_EFFECTS
)
endif()
# Filter/Shader
is_feature_enabled(FILTER_SHADER T_CHECK)
if(T_CHECK)
set(REQUIRE_PART_SHADER ON)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/filters/filter-shader.hpp"
"source/filters/filter-shader.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_SHADER
)
endif()
# Filter/Transform
is_feature_enabled(FILTER_TRANSFORM T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/filters/filter-transform.hpp"
"source/filters/filter-transform.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_TRANSFORM
)
endif()
# Filter/Denoising
is_feature_enabled(FILTER_DENOISING T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/filters/filter-denoising.hpp"
"source/filters/filter-denoising.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_DENOISING
)
is_feature_enabled(FILTER_DENOISING_NVIDIA T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_DENOISING_NVIDIA
)
endif()
endif()
# Filter/Upscaling
is_feature_enabled(FILTER_UPSCALING T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/filters/filter-upscaling.hpp"
"source/filters/filter-upscaling.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_UPSCALING
)
is_feature_enabled(FILTER_UPSCALING_NVIDIA T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_UPSCALING_NVIDIA
)
endif()
endif()
# Filter/Virtual Greenscreen
is_feature_enabled(FILTER_VIRTUAL_GREENSCREEN T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/filters/filter-virtual-greenscreen.hpp"
"source/filters/filter-virtual-greenscreen.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_VIRTUAL_GREENSCREEN
)
is_feature_enabled(FILTER_VIRTUAL_GREENSCREEN_NVIDIA T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_VIRTUAL_GREENSCREEN_NVIDIA
)
endif()
endif()
# Source/Mirror
is_feature_enabled(SOURCE_MIRROR T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/sources/source-mirror.hpp"
"source/sources/source-mirror.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_SOURCE_MIRROR
)
endif()
# Source/Shader
is_feature_enabled(SOURCE_SHADER T_CHECK)
if(T_CHECK)
set(REQUIRE_PART_SHADER ON)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/sources/source-shader.hpp"
"source/sources/source-shader.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_SOURCE_SHADER
)
endif()
# Transition/Shader
is_feature_enabled(TRANSITION_SHADER T_CHECK)
if(T_CHECK)
set(REQUIRE_PART_SHADER ON)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/transitions/transition-shader.hpp"
"source/transitions/transition-shader.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_TRANSITION_SHADER
)
endif()
# Profiling
is_feature_enabled(PROFILING T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/util/util-profiler.cpp"
"source/util/util-profiler.hpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_PROFILING
)
endif()
# Updater
is_feature_enabled(UPDATER T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/updater.hpp"
"source/updater.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_UPDATER
)
endif()
# Frontend
is_feature_enabled(FRONTEND T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_UI
"ui/streamfx.qrc"
"ui/about.ui"
"ui/about-entry.ui"
)
list(APPEND PROJECT_UI_SOURCE
"source/ui/ui-common.hpp"
"source/ui/ui.hpp"
"source/ui/ui.cpp"
"source/ui/ui-about.hpp"
"source/ui/ui-about.cpp"
"source/ui/ui-about-entry.hpp"
"source/ui/ui-about-entry.cpp"
"source/ui/ui-obs-browser-widget.hpp"
"source/ui/ui-obs-browser-widget.cpp"
)
list(APPEND PROJECT_INCLUDE_DIRS
"source/ui"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FRONTEND
)
is_feature_enabled(UPDATER T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_UI_SOURCE
"source/ui/ui-updater.hpp"
"source/ui/ui-updater.cpp"
)
list(APPEND PROJECT_UI
"ui/updater.ui"
)
endif()
endif()
################################################################################
# Parts
################################################################################
# Shaders
if(REQUIRE_PART_SHADER)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/gfx/shader/gfx-shader.hpp"
"source/gfx/shader/gfx-shader.cpp"
"source/gfx/shader/gfx-shader-param.hpp"
"source/gfx/shader/gfx-shader-param.cpp"
"source/gfx/shader/gfx-shader-param-audio.hpp"
"source/gfx/shader/gfx-shader-param-audio.cpp"
"source/gfx/shader/gfx-shader-param-basic.hpp"
"source/gfx/shader/gfx-shader-param-basic.cpp"
"source/gfx/shader/gfx-shader-param-matrix.hpp"
"source/gfx/shader/gfx-shader-param-matrix.cpp"
"source/gfx/shader/gfx-shader-param-texture.hpp"
"source/gfx/shader/gfx-shader-param-texture.cpp"
)
endif()
# LUT
if(REQUIRE_LUT)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/gfx/lut/gfx-lut.hpp"
"source/gfx/lut/gfx-lut.cpp"
"source/gfx/lut/gfx-lut-consumer.hpp"
"source/gfx/lut/gfx-lut-consumer.cpp"
"source/gfx/lut/gfx-lut-producer.hpp"
"source/gfx/lut/gfx-lut-producer.cpp"
)
list(APPEND PROJECT_DATA
"data/effects/lut.effect"
"data/effects/lut-consumer.effect"
"data/effects/lut-producer.effect"
)
endif()
# Windows
if(D_PLATFORM_WINDOWS)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/windll.cpp"
)
list(APPEND PROJECT_LIBRARIES
Delayimp.lib
)
# Disable/Enable a ton of things.
list(APPEND PROJECT_DEFINITIONS
# Microsoft Visual C++
_CRT_SECURE_NO_WARNINGS
_ENABLE_EXTENDED_ALIGNED_STORAGE
# windows.h
WIN32_LEAN_AND_MEAN
NOGPICAPMASKS
NOVIRTUALKEYCODES
#NOWINMESSAGES
NOWINSTYLES
NOSYSMETRICS
NOMENUS
NOICONS
NOKEYSTATES
NOSYSCOMMANDS
NORASTEROPS
#NOSHOWWINDOW
NOATOM
NOCLIPBOARD
NOCOLOR
#NOCTLMGR
NODRAWTEXT
#NOGDI
NOKERNEL
#NOUSER
#NONLS
NOMB
NOMEMMGR
NOMETAFILE
NOMINMAX
#NOMSG
NOOPENFILE
NOSCROLL
NOSERVICE
NOSOUND
#NOTEXTMETRIC
NOWH
NOWINOFFSETS
NOCOMM
NOKANJI
#NOHELP
NOPROFILER
NODEFERWINDOWPOS
NOMCX
NOIME
NOMDI
NOINOUT
)
endif()
# GCC before 9.0, Clang before 9.0
if((CMAKE_C_COMPILER_ID STREQUAL "GNU")
OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
OR (CMAKE_C_COMPILER_ID STREQUAL "Clang")
OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
list(APPEND PROJECT_LIBRARIES
"stdc++fs"
)
endif()
endif()
################################################################################
# Helpers
################################################################################
define_property(TARGET PROPERTY COMPONENT_LABEL)
define_property(TARGET PROPERTY COMPONENT_NAME)
define_property(TARGET PROPERTY COMPONENT_OPTION)
define_property(TARGET PROPERTY COMPONENT_DEPENDS)
function(streamfx_add_library TARGET_NAME TARGET_TYPE)
add_library(${TARGET_NAME} ${TARGET_TYPE})
set_target_properties(${TARGET_NAME} PROPERTIES
# Always generate position independent code.
POSITION_INDEPENDENT_CODE ON
# Set C++ Standard and Extensions
C_STANDARD 17
C_STANDARD_REQUIRED ON
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
# Remove prefix from generated files.
PREFIX ""
IMPORT_PREFIX ""
)
if(D_PLATFORM_MAC)
set_target_properties(${TARGET_NAME} PROPERTIES
# @rpath in installed binaries
INSTALL_RPATH "@executable_path/../Frameworks/;@loader_path/../Frameworks/;@loader_path/../Resources/"
)
if(STANDALONE)
set_target_properties(${TARGET_NAME} PROPERTIES
# @rpath in built binaries
BUILD_WITH_INSTALL_RPATH ON
)
endif()
endif()
target_compile_definitions(${TARGET_NAME} PRIVATE
__STDC_WANT_LIB_EXT1__=1
)
# C/C++ Compiler Adjustments
if(D_PLATFORM_WINDOWS AND ((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")))
# MSVC/ClangCL
# - Dynamically link Microsoft C/C++ Redistributable.
target_compile_options(${TARGET_NAME} PRIVATE
$<$<CONFIG:>:/MD>
$<$<CONFIG:Debug>:/MDd>
$<$<CONFIG:Release>:/MD>
$<$<CONFIG:RelWithDebInfo>:/MD>
$<$<CONFIG:MinSizeRel>:/MD>
)
# - Treat Warnings as Errors
target_compile_options(${TARGET_NAME} PRIVATE "/Wall")
# - Explicitly disable treating all Warnings as Errors
target_compile_options(${TARGET_NAME} PRIVATE "/WX-")
# - Disable useless warnings
set(DISABLED_WARNINGS
# Don't warn about unused variables, parameters, labels, functions, or typedefs.
"4100"
"4101"
"4102"
"4505"
"4514"
"5245"
# Don't warn about unreferenced variables or parameters which are assigned/initialized.
"4189"
# Don't warn about not-explicitly-handled enumeration identifiers
"4061"
# Ignore automatic padding warnings.
"4820"
# Ignore assignment/move/copy being implicit '= delete;'.
"4623"
"4625"
"4626"
"5026"
"5027"
# Relative include paths are fine.
"4464"
# Buggy warning: printf expects string literal
"4774"
# Buggy warning: subobject initialization should be wrapped in braces
"5246"
# Ignore undefined, unused or unreferenced pre-processor macros
"4688"
# Ignore non-inlined functions
"4710"
# Ignore Spectre mitigation insertions
"5045"
# Ignore inserted padding.
"4324"
)
foreach(WARN ${DISABLED_WARNINGS})
target_compile_options(${TARGET_NAME} PRIVATE "/wd${WARN}")
endforeach()
# - Require enabled instruction sets.
if(D_PLATFORM_ARCH_X86)
if(${PREFIX}TARGET_X86_64_V4)
target_compile_options(${TARGET_NAME} PRIVATE "/arch:AVX512")
elseif(${PREFIX}TARGET_X86_64_V3)
target_compile_options(${TARGET_NAME} PRIVATE "/arch:AVX2")
elseif(${PREFIX}TARGET_X86_64_V2_EX)
target_compile_options(${TARGET_NAME} PRIVATE "/arch:AVX")
elseif(${PREFIX}TARGET_X86_64_V2)
target_compile_options(${TARGET_NAME} PRIVATE "/d2archSSE42")
elseif(${PREFIX}TARGET_X86_64)
#target_compile_options(${TARGET_NAME} PRIVATE "/arch:SSE2")
endif()
endif()
# - Use fast unordered math if possible.
if(${PREFIX}ENABLE_FASTMATH)
target_compile_options(${TARGET_NAME} PRIVATE "/fp:fast")
else()
target_compile_options(${TARGET_NAME} PRIVATE "/fp:precise")
if(MSVC_VERSION GREATER 1930)
# Keep original behavior in VS2022 and up.
target_compile_options(${TARGET_NAME} PRIVATE "/fp:contract")
endif()
endif()
# - Disable incremental builds
target_compile_options(${TARGET_NAME} PRIVATE "/INCREMENTAL:NO")
# - Enable C++ exceptions with SEH exceptions.
target_compile_options(${TARGET_NAME} PRIVATE "/EHa")
# - Enable multi-processor compiling.
target_compile_options(${TARGET_NAME} PRIVATE "/MP")
# - Enable updated __cplusplus macro
target_compile_options(${TARGET_NAME} PRIVATE "/Zc:__cplusplus")
elseif(D_PLATFORM_LINUX AND ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")))
# GCC/Clang
# - Enable all warnings.
target_compile_options(${TARGET_NAME} PRIVATE "-Wall")
target_compile_options(${TARGET_NAME} PRIVATE "-Wextra")
# - Disable useless warnings
set(DISABLED_WARNINGS
# Don't warn about unused variables, parameters, labels, functions, or typedefs.
"unused-function"
"unused-label"
"unused-local-typedefs"
"unused-parameter"
"unused-result"
"unused-const-variable"
"unused-variable"
"unused-value"
# Don't warn about unreferenced variables or parameters which are assigned/initialized.
"unused-but-set-parameter"
"unused-but-set-variable"
# Don't warn about not-explicitly-handled enumeration identifiers
"switch"
# Ignore automatic padding warnings.
"padded"
# Ignore implicit '= delete;'.
# Ignore extra arguments for printf
"format-extra-args"
# Ignore undefined, unused or unreferenced pre-processor macros
"unused-macros"
)
foreach(WARN ${DISABLED_WARNINGS})
target_compile_options(${TARGET_NAME} PRIVATE "-Wno-${WARN}")
endforeach()
# - Require enabled instruction sets.
if(${PREFIX}TARGET_NATIVE)
target_compile_options(${TARGET_NAME} PRIVATE
"-march=native"
)
elseif(D_PLATFORM_ARCH_X86)
if(${PREFIX}TARGET_X86_64_V4)
target_compile_options(${TARGET_NAME} PRIVATE
"-march=x86-64-v4"
)
elseif(${PREFIX}TARGET_X86_64_V3)
target_compile_options(${TARGET_NAME} PRIVATE
"-march=x86-64-v3"
)
elseif(${PREFIX}TARGET_X86_64_V2_EX)
target_compile_options(${TARGET_NAME} PRIVATE
"-march=x86-64-v2"
"-mavx"
"-mbmi2"
"-mbmi"
"-mfma"
"-mf16c"
"-mmovbe"
"-mpclmul"
"-mpopcnt"
)
elseif(${PREFIX}TARGET_X86_64_V2)
target_compile_options(${TARGET_NAME} PRIVATE
"-march=x86-64-v2"
)
elseif(${PREFIX}TARGET_X86_64)
target_compile_options(${TARGET_NAME} PRIVATE
"-march=x86-64"
)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(${TARGET_NAME} PRIVATE
"-mtune=generic"
)
else()
target_compile_options(${TARGET_NAME} PRIVATE
"-mtune=x86-64"
)
endif()
endif()
# - Use fast unordered math if possible.
if(${PREFIX}ENABLE_FASTMATH)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(${TARGET_NAME} PRIVATE
"-ffast-math"
)
else()
target_compile_options(${TARGET_NAME} PRIVATE
"-ffp-model=fast"
)
endif()
else()
target_compile_options(${TARGET_NAME} PRIVATE
"-ffp-model=precise"
)
endif()
# - Don't export by default, require attributes.
# add_compile_options("-fvisibility=hidden")
elseif(D_PLATFORM_MAC AND (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
# AppleClang
# - Enable most useful warnings.
target_compile_options(${TARGET_NAME} PRIVATE "-Wall")
target_compile_options(${TARGET_NAME} PRIVATE "-Wextra")
# - Require enabled instruction sets.
if(${PREFIX}TARGET_NATIVE)
target_compile_options(${TARGET_NAME} PRIVATE
"-march=native"
)
message(WARNING "Targeting native architecture. Binaries will not be distributable to other systems!")
endif()
# - Use fast unordered math if possible.
# FIXME: Appears to not be supported.
# - Don't export by default, require attributes.
# add_compile_options("-fvisibility=hidden")
endif()
# Enable Qt if needed
set_target_properties(${TARGET_NAME} PROPERTIES
AUTOUIC ON
AUTOUIC_SEARCH_PATHS "${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/ui"
AUTOMOC ON
AUTORCC ON
AUTOGEN_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated"
)
# Extras: Clang
#is_feature_enabled(CLANG T_CHECK)
#if(T_CHECK)
# generate_compile_commands_json(
# TARGETS ${TARGET_NAME}
# )
# clang_tidy(
# TARGETS ${TARGET_NAME}
# VERSION 14.0.0
# )
# clang_format(
# TARGETS ${TARGET_NAME}
# DEPENDENCY
# VERSION 14.0.0
# )
#endif()
endfunction()
set(${PREFIX}COMPONENTS "")
function(streamfx_add_component COMPONENT_NAME)
# Sanitize the component name by trimming whitespace.
string(REGEX REPLACE "^[ \t]+" "" COMPONENT_NAME "${COMPONENT_NAME}")
string(REGEX REPLACE "[ \t]+$" "" COMPONENT_NAME "${COMPONENT_NAME}")
# Generate a sanitized version of the component name for use in targets and options.
string(REGEX REPLACE "[^a-zA-Z0-9_-]+" "_" COMPONENT_SANITIZED_NAME "${COMPONENT_NAME}")
string(REGEX REPLACE "_[_]+" "_" COMPONENT_SANITIZED_NAME "${COMPONENT_SANITIZED_NAME}")
# Convert the sanitized version to upper case.
string(TOUPPER "${COMPONENT_SANITIZED_NAME}" COMPONENT_OPTION_NAME)
set(COMPONENT_OPTION "${PREFIX}COMPONENT_${COMPONENT_OPTION_NAME}" PARENT_SCOPE)
# Define the necessary targets.
set(COMPONENT_TARGET "${PROJECT_NAME}_${COMPONENT_SANITIZED_NAME}")
set(COMPONENT_TARGET "${PROJECT_NAME}_${COMPONENT_SANITIZED_NAME}" PARENT_SCOPE)
set(COMPONENT_ALIAS "${PROJECT_NAME}::${COMPONENT_SANITIZED_NAME}")
set(COMPONENT_ALIAS "${PROJECT_NAME}::${COMPONENT_SANITIZED_NAME}" PARENT_SCOPE)
streamfx_add_library(${COMPONENT_TARGET} STATIC)
target_link_libraries(${COMPONENT_TARGET} PUBLIC ${PROJECT_NAME}::Core)
add_library(${COMPONENT_ALIAS} ALIAS ${COMPONENT_TARGET})
set_target_properties(${COMPONENT_TARGET} PROPERTIES
COMPONENT_LABEL "${COMPONENT_LABEL}"
COMPONENT_NAME "${COMPONENT_ALIAS}"
COMPONENT_OPTION "${COMPONENT_OPTION_NAME}"
)
# Register the component globally.
list(APPEND ${PREFIX}COMPONENTS "${COMPONENT_TARGET}")
# Allow disabling this component.
set(${PREFIX}COMPONENT_${COMPONENT_OPTION_NAME} CACHE BOOL "Enable the ${COMPONENT_NAME} component?")
# Add files in common places.
file(GLOB_RECURSE TEMPLATES FOLLOW_SYMLINKS CONFIGURE_DEPENDS "templates/*")
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/templates" PREFIX "Templates" FILES ${TEMPLATES})
file(GLOB_RECURSE SOURCE_PRIVATE FOLLOW_SYMLINKS CONFIGURE_DEPENDS "ui/*")
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/ui" PREFIX "User-Interface Files" FILES ${UI_PRIVATE})
file(GLOB_RECURSE SOURCE_PRIVATE FOLLOW_SYMLINKS CONFIGURE_DEPENDS "source/*")
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/source" PREFIX "Private Files" FILES ${SOURCE_PRIVATE})
file(GLOB_RECURSE GENERATED_PRIVATE FOLLOW_SYMLINKS CONFIGURE_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/source/*")
source_group(TREE "${CMAKE_CURRENT_BINARY_DIR}/source" PREFIX "Private Files/Generated" FILES ${GENERATED_PRIVATE})
file(GLOB_RECURSE SOURCE_PUBLIC FOLLOW_SYMLINKS CONFIGURE_DEPENDS "include/*")
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/include" PREFIX "Public Files" FILES ${SOURCE_PUBLIC})
file(GLOB_RECURSE GENERATED_PUBLIC FOLLOW_SYMLINKS CONFIGURE_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/include/*")
source_group(TREE "${CMAKE_CURRENT_BINARY_DIR}/include" PREFIX "Public Files/Generated" FILES ${GENERATED_PUBLIC})
target_sources(${COMPONENT_TARGET}
PRIVATE
${TEMPLATES}
${UI_PRIVATE}
${SOURCE_PRIVATE}
${GENERATED_PRIVATE}
PUBLIC
${SOURCE_PUBLIC}
${GENERATED_PUBLIC}
)
# Ignore data only files.
set_source_files_properties(
${TEMPLATES}
${UI_PRIVATE}
PROPERTIES
HEADER_FILE_ONLY ON
)
set_source_files_properties(
${TEMPLATES}
${SOURCE_PRIVATE}
${GENERATED_PRIVATE}
${SOURCE_PUBLIC}
${GENERATED_PUBLIC}
PROPERTIES
SKIP_AUTOGEN ON
SKIP_AUTOMOC ON
SKIP_AUTORCC ON
SKIP_AUTOUIC ON
)
endfunction()
# Use this to add a dependency on another component,
function(streamfx_add_component_dependency _NAME)
get_target_property(DEPENDS ${COMPONENT_TARGET} COMPONENT_DEPENDS)
list(APPEND DEPENDS "${_NAME}")
set_target_properties(${COMPONENT_TARGET} PROPERTIES COMPONENT_DEPENDS "${DEPENDS}")
endfunction()
################################################################################
# Register Library
################################################################################
streamfx_add_library(${PROJECT_NAME} MODULE) # We are a module for libOBS.
target_include_directories(${PROJECT_NAME} PRIVATE
"source"
"include"
"${PROJECT_BINARY_DIR}/generated"
)
if(D_PLATFORM_WINDOWS) # Windows Support
set(PROJECT_PRODUCT_NAME "${PROJECT_FULL_NAME}")
set(PROJECT_COMPANY_NAME "${PROJECT_AUTHORS}")
set(PROJECT_COPYRIGHT "${PROJECT_AUTHORS} © ${PROJECT_COPYRIGHT_YEARS}")
set(PROJECT_LEGAL_TRADEMARKS_1 "")
set(PROJECT_LEGAL_TRADEMARKS_2 "")
configure_file(
"templates/windows/version.rc.in"
"generated/version.rc"
)
target_sources(${PROJECT_NAME}
PRIVATE
"templates/windows/version.rc.in"
"${PROJECT_BINARY_DIR}/generated/version.rc"
)
endif()
# Set file version
set_target_properties(${PROJECT_NAME} PROPERTIES
MACHO_COMPATIBILITY_VERSION ${_VERSION_MAJOR}.${_VERSION_MINOR}
MACHO_CURRENT_VERSION ${PROJECT_VERSION}
SOVERSION ${_VERSION_MAJOR}.${_VERSION_MINOR}
VERSION ${PROJECT_VERSION}
)
# Windows exclusive changes
if(D_PLATFORM_WINDOWS)
foreach(DELAYLOAD ${PROJECT_LIBRARIES_DELAYED})
get_target_property(_lf ${PROJECT_NAME} LINK_FLAGS)
if(NOT _lf)
set(_lf "")
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "${_lf} /DELAYLOAD:${DELAYLOAD}")
add_link_options("/DELAYLOAD:${DELAYLOAD}")
endforeach()
endif()
# MacOS exclusive Changes
if(D_PLATFORM_MAC)
set_target_properties(${PROJECT_NAME} PROPERTIES
# No automatic code signing in XCode
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO"
# @rpath in installed binaries
INSTALL_RPATH "@executable_path/../Frameworks/;@loader_path/../Frameworks/;@loader_path/../Resources/"
)
if(STANDALONE)
set_target_properties(${PROJECT_NAME} PROPERTIES
# @rpath in built binaries
BUILD_WITH_INSTALL_RPATH ON
)
endif()
# Bundle exporting
if(STRUCTURE_BUNDLE)
# Proper location for resources in Bundles
foreach(FILE IN LISTS PROJECT_DATA)
cmake_path(ABSOLUTE_PATH FILE OUTPUT_VARIABLE FILE_PATH)
cmake_path(RELATIVE_PATH FILE_PATH BASE_DIRECTORY "${PROJECT_SOURCE_DIR}/data/")
cmake_path(GET FILE_PATH PARENT_PATH FILE_PATH)
set_source_files_properties("${FILE}" PROPERTIES
MACOSX_PACKAGE_LOCATION "Resources/${FILE_PATH}"
)
endforeach()
# Bundle Icon
set_source_files_properties("media/icon.png" PROPERTIES
MACOSX_PACKAGE_LOCATION "Resources"
)
# Bundle Information
set(MACOSX_BUNDLE_BUNDLE_NAME "${PROJECT_NAME}")
set(MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_VERSION}")
set(MACOSX_BUNDLE_COPYRIGHT "${PROJECT_COPYRIGHT}")
set(MACOSX_BUNDLE_GUI_IDENTIFIER "${PROJECT_IDENTIFER}")
set(MACOSX_BUNDLE_ICON_FILE "icon.png")
set(MACOSX_BUNDLE_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
set(MACOSX_BUNDLE_LONG_VERSION_STRING "${_VERSION}")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}")
set_target_properties(${PROJECT_NAME} PROPERTIES
BUNDLE ON
BUNDLE_EXTENSION "plugin"
OUTPUT_NAME ${PROJECT_NAME}
MACOSX_BUNDLE_INFO_PLIST "${PROJECT_SOURCE_DIR}/templates/macos/Info.plist.in"
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${MACOSX_BUNDLE_GUI_IDENTIFIER}"
)
endif()
endif()
################################################################################
# Add Core
################################################################################
streamfx_add_library(${PROJECT_NAME}_Core STATIC EXCLUDE_FROM_ALL)
add_library(${PROJECT_NAME}::Core ALIAS ${PROJECT_NAME}_Core)
# Combine all variables that matter.
set(PROJECT_FILES
# Always exist
${PROJECT_DATA}
${PROJECT_PRIVATE_GENERATED}
${PROJECT_PRIVATE_SOURCE}
${PROJECT_TEMPLATES}
# UI-only (empty if not enabled)
${PROJECT_UI}
${PROJECT_UI_SOURCE}
# Media
${PROJECT_MEDIA}
)
# Set source groups for IDE generators.
source_group(TREE "${PROJECT_SOURCE_DIR}/data" PREFIX "Data" FILES ${PROJECT_DATA})
source_group(TREE "${PROJECT_SOURCE_DIR}/source" PREFIX "Source" FILES ${PROJECT_PRIVATE_SOURCE} ${PROJECT_UI_SOURCE})
source_group(TREE "${PROJECT_BINARY_DIR}/generated" PREFIX "Source" FILES ${PROJECT_PRIVATE_GENERATED})
source_group(TREE "${PROJECT_SOURCE_DIR}/templates" PREFIX "Templates" FILES ${PROJECT_TEMPLATES})
source_group(TREE "${PROJECT_SOURCE_DIR}/ui" PREFIX "User Interface" FILES ${PROJECT_UI})
source_group(TREE "${PROJECT_SOURCE_DIR}/media" PREFIX "Media" FILES ${PROJECT_MEDIA})
# Prevent unwanted files from being built as source.
set_source_files_properties(${PROJECT_DATA} ${PROJECT_TEMPLATES} ${PROJECT_UI} ${PROJECT_MEDIA} PROPERTIES
HEADER_FILE_ONLY ON
)
# Prevent non-UI files from being Qt'd
if(Qt5_Found OR Qt6_FOUND)
set_source_files_properties(${PROJECT_DATA} ${PROJECT_TEMPLATES} ${PROJECT_MEDIA} ${PROJECT_PRIVATE_GENERATED} ${PROJECT_PRIVATE_SOURCE} PROPERTIES
SKIP_AUTOGEN ON
SKIP_AUTOMOC ON
SKIP_AUTORCC ON
SKIP_AUTOUIC ON
)
endif()
# Register the library
target_sources(${PROJECT_NAME}_Core PRIVATE ${PROJECT_FILES})
target_link_libraries(${PROJECT_NAME}_Core PRIVATE ${PROJECT_LIBRARIES})
target_include_directories(${PROJECT_NAME}_Core PRIVATE ${PROJECT_INCLUDE_DIRS})
target_compile_definitions(${PROJECT_NAME}_Core PRIVATE ${PROJECT_DEFINITIONS})
################################################################################
# Components
################################################################################
# As the above monolithic approach started to show its weaknesses, it was time
# for an improved system which suffers under less issues. This new component
# system should address the main necessary parts,
file(GLOB COMPONENTS RELATIVE ${PROJECT_SOURCE_DIR} CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/components/*)
foreach(COMPONENT ${COMPONENTS})
add_subdirectory(${COMPONENT} EXCLUDE_FROM_ALL)
endforeach()
################################################################################
# Resolve Components
################################################################################
target_link_libraries(${PROJECT_NAME} PUBLIC $<LINK_LIBRARY:WHOLE_ARCHIVE,${PROJECT_NAME}_Core>)
# ################################################################################
# # Installation
# ################################################################################
if(STANDALONE)
# if(STRUCTURE_UNIFIED)
# install(
# DIRECTORY "data/"
# DESTINATION "data/"
# FILE_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# DIRECTORY_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# )
# if(D_PLATFORM_WINDOWS)
# install(
# TARGETS ${PROJECT_NAME}
# RUNTIME DESTINATION "bin/windows-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX
# LIBRARY DESTINATION "bin/windows-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX
# PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# )
# if(MSVC)
# install(
# FILES $<TARGET_PDB_FILE:${PROJECT_NAME}>
# DESTINATION "bin/windows-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/"
# COMPONENT StreamFX
# OPTIONAL
# )
# endif()
# # Dependency: AOM
# if(HAVE_AOM AND AOM_BINARY AND D_PLATFORM_WINDOWS)
# install(
# FILES ${AOM_BINARY}
# DESTINATION "data/" COMPONENT StreamFX
# )
# endif()
# elseif(D_PLATFORM_LINUX)
# install(
# TARGETS ${PROJECT_NAME}
# RUNTIME DESTINATION "bin/linux-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX
# LIBRARY DESTINATION "bin/linux-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX
# PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# )
# elseif(D_PLATFORM_MAC)
# install(
# TARGETS ${PROJECT_NAME}
# RUNTIME DESTINATION "bin/mac-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX
# LIBRARY DESTINATION "bin/mac-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX
# PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# )
# endif()
# install(
# FILES LICENSE
# DESTINATION "LICENSE"
# COMPONENT StreamFX
# )
# install(
# FILES icon.png
# DESTINATION "icon.png"
# COMPONENT StreamFX
# )
# elseif(D_PLATFORM_WINDOWS)
# install(
# TARGETS ${PROJECT_NAME}
# RUNTIME DESTINATION "obs-plugins/${D_PLATFORM_BITS}bit/" COMPONENT StreamFX
# LIBRARY DESTINATION "obs-plugins/${D_PLATFORM_BITS}bit/" COMPONENT StreamFX
# )
# install(
# DIRECTORY "data/"
# DESTINATION "data/obs-plugins/${PROJECT_NAME}/"
# )
# if(MSVC)
# install(
# FILES $<TARGET_PDB_FILE:${PROJECT_NAME}>
# DESTINATION "obs-plugins/${D_PLATFORM_BITS}bit/"
# OPTIONAL
# )
# endif()
# # Dependency: AOM
# if(HAVE_AOM AND AOM_BINARY)
# install(
# FILES "${AOM_BINARY}"
# DESTINATION "data/obs-plugins/${PROJECT_NAME}/" COMPONENT StreamFX
# )
# endif()
# elseif(D_PLATFORM_LINUX)
# if(STRUCTURE_PACKAGEMANAGER)
# install(
# TARGETS ${PROJECT_NAME}
# RUNTIME DESTINATION "lib/obs-plugins/" COMPONENT StreamFX
# LIBRARY DESTINATION "lib/obs-plugins/" COMPONENT StreamFX
# PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# )
# install(
# DIRECTORY "data/"
# DESTINATION "share/obs/obs-plugins/${PROJECT_NAME}"
# COMPONENT StreamFX
# FILE_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# DIRECTORY_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# )
# else()
# install(
# TARGETS ${PROJECT_NAME}
# RUNTIME DESTINATION "plugins/${PROJECT_NAME}/bin/${D_PLATFORM_BITS}bit/" COMPONENT StreamFX
# LIBRARY DESTINATION "plugins/${PROJECT_NAME}/bin/${D_PLATFORM_BITS}bit/" COMPONENT StreamFX
# PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# )
# install(
# DIRECTORY "data/"
# DESTINATION "plugins/${PROJECT_NAME}/data/"
# COMPONENT StreamFX
# FILE_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# DIRECTORY_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# )
# endif()
# elseif(D_PLATFORM_MAC)
# if(STRUCTURE_BUNDLE)
# install(
# TARGETS ${PROJECT_NAME}
# RUNTIME DESTINATION "." COMPONENT StreamFX
# LIBRARY DESTINATION "." COMPONENT StreamFX
# BUNDLE DESTINATION "." COMPONENT StreamFX
# PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# )
# else()
# install(
# TARGETS ${PROJECT_NAME}
# RUNTIME DESTINATION "${PROJECT_NAME}/bin/" COMPONENT StreamFX
# LIBRARY DESTINATION "${PROJECT_NAME}/bin/" COMPONENT StreamFX
# PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# )
# install(
# DIRECTORY "data/"
# DESTINATION "${PROJECT_NAME}/data/"
# COMPONENT StreamFX
# FILE_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# DIRECTORY_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# )
# endif()
# endif()
else()
if(COMMAND setup_plugin_target)
setup_plugin_target(${PROJECT_NAME})
# Seems like we lost the ability to customize which directoy resources are in, and instead are forced to use '/data'.
if(HAVE_AOM AND AOM_BINARY) # Dependency: AOM
add_target_resource(${PROJECT_NAME} "${AOM_BINARY}" "obs-plugins/${PROJECT_NAME}")
endif()
elseif(COMMAND install_obs_plugin_with_data)
install_obs_plugin_with_data(${PROJECT_NAME} data)
if(HAVE_AOM AND AOM_BINARY) # Dependency: AOM
install(
FILES "${AOM_BINARY}"
DESTINATION "${OBS_DATA_DESTINATION}/obs-plugins/${PROJECT_NAME}"
)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy
"${AOM_BINARY}"
"${OBS_DATA_DESTINATION}/obs-plugins/${PROJECT_NAME}"
VERBATIM)
endif()
endif()
endif()
# ################################################################################
# # Packaging
# ################################################################################
# if(STANDALONE)
# # Packaging
# if(NOT PACKAGE_SUFFIX)
# set(_PACKAGE_SUFFIX_OVERRIDE "${_VERSION_THIN}")
# else()
# set(_PACKAGE_SUFFIX_OVERRIDE "${PACKAGE_SUFFIX}")
# endif()
# set(_PACKAGE_FULL_NAME "${PACKAGE_PREFIX}/${PACKAGE_NAME}-${_PACKAGE_SUFFIX_OVERRIDE}")
# if(STRUCTURE_UNIFIED)
# add_custom_target(
# PACKAGE_ZIP
# ${CMAKE_COMMAND} -E tar cfv "${_PACKAGE_FULL_NAME}.obs" --format=zip --
# "."
# WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
# )
# else()
# add_custom_target(
# PACKAGE_7Z
# ${CMAKE_COMMAND} -E tar cfv "${_PACKAGE_FULL_NAME}.7z" --format=7zip --
# "."
# WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
# )
# add_custom_target(
# PACKAGE_ZIP
# ${CMAKE_COMMAND} -E tar cfv "${_PACKAGE_FULL_NAME}.zip" --format=zip --
# "."
# WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
# )
# # Windows
# if(D_PLATFORM_WINDOWS)
# ## Installer (InnoSetup)
# get_filename_component(ISS_FILES_DIR "${CMAKE_INSTALL_PREFIX}" ABSOLUTE)
# file(TO_NATIVE_PATH "${ISS_FILES_DIR}" ISS_FILES_DIR)
# get_filename_component(ISS_PACKAGE_DIR "${PACKAGE_PREFIX}" ABSOLUTE)
# file(TO_NATIVE_PATH "${ISS_PACKAGE_DIR}" ISS_PACKAGE_DIR)
# get_filename_component(ISS_SOURCE_DIR "${PROJECT_SOURCE_DIR}" ABSOLUTE)
# file(TO_NATIVE_PATH "${ISS_SOURCE_DIR}" ISS_SOURCE_DIR)
# get_filename_component(ISS_MSVCHELPER_PATH "${msvc-redist-helper_BUILD_DIR}" ABSOLUTE)
# file(TO_NATIVE_PATH "${ISS_MSVCHELPER_PATH}" ISS_MSVCHELPER_PATH)
# configure_file(
# "templates/windows/installer.iss.in"
# "installer.iss"
# )
# endif()
# # Apple MacOS
# if(D_PLATFORM_MAC)
# # .pkg Installer
# set(PACKAGES_PATH_NAME "${PROJECT_NAME}")
# if(STRUCTURE_BUNDLE)
# set(PACKAGES_PATH_NAME "${PACKAGES_PATH_NAME}.plugin")
# endif()
# configure_file(
# "templates/macos/installer.pkgproj.in"
# "installer.pkgproj"
# )
# endif()
# endif()
# endif()