2020-12-14 16:47:13 +00:00
# StreamFX - The premier VFX plugin for OBS Studio.
# Copyright (C) 2017 - 2020 Michael Fabian Dirks
2018-09-25 23:17:08 +00:00
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
2017-06-28 21:21:42 +00:00
2018-04-24 10:31:43 +00:00
# CMake Setup
2020-12-14 16:47:13 +00:00
cmake_minimum_required(VERSION 3.8...4.0)
2017-11-02 23:30:53 +00:00
2021-01-31 14:57:42 +00:00
################################################################################
2020-12-14 16:47:13 +00:00
# Configure Type
2021-01-31 14:57:42 +00:00
################################################################################
# Detect if we are building by ourselves or as part of something else.
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}")
set(GROUPED OFF)
set(PREFIX "")
else()
set(GROUPED ON)
set(PREFIX "StreamFX_")
endif()
set(LOGPREFIX "StreamFX:")
################################################################################
# Versioning
################################################################################
2019-10-13 03:42:54 +00:00
set(VERSION_MAJOR 0)
2021-01-20 23:46:59 +00:00
set(VERSION_MINOR 10)
2019-12-22 07:31:00 +00:00
set(VERSION_PATCH 0)
2019-10-13 03:42:54 +00:00
set(VERSION_TWEAK 0)
2021-02-21 03:05:12 +00:00
set(VERSION_SUFFIX "b1")
2021-01-31 14:57:42 +00:00
set(VERSION_COMMIT "00000000")
# Check if we are in a git repository.
2019-10-13 03:42:54 +00:00
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/.git")
2021-01-31 14:57:42 +00:00
# Try and figure out where git is.
find_program(GIT git
PATHS
/bin
/sbin
/usr/bin
/usr/local/bin
2018-09-25 23:17:08 +00:00
)
2021-01-31 14:57:42 +00:00
if(GIT)
set(GIT_RESULT)
set(GIT_OUTPUT)
set(GIT_ERROR)
execute_process(
2021-02-06 15:24:43 +00:00
COMMAND "${GIT}" describe --tags --long --match "[0-9]*.[0-9]*.[0-9]*" --abbrev=8 HEAD
2021-01-31 14:57:42 +00:00
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)
string(REPLACE "-" "." GIT_OUTPUT "${GIT_OUTPUT}")
string(REPLACE "." ";" GIT_OUTPUT "${GIT_OUTPUT}")
# Parse Version
list(GET GIT_OUTPUT 0 VERSION_MAJOR)
list(GET GIT_OUTPUT 1 VERSION_MINOR)
list(GET GIT_OUTPUT 2 VERSION_PATCH)
2021-03-23 19:41:20 +00:00
list(GET GIT_OUTPUT 3 VERSION_TWEAK)
2021-01-31 14:57:42 +00:00
list(GET GIT_OUTPUT 4 VERSION_COMMIT)
# Patch needs additional parsing.
# This may be a [0-9]*[a-z]*[0-9]+ string.
2021-03-23 19:41:20 +00:00
string(REGEX MATCHALL "^([0-9]+)([a-z]+[0-9]+)?" T_MATCHES "${VERSION_PATCH}")
2021-01-31 14:57:42 +00:00
set(VERSION_PATCH "${CMAKE_MATCH_1}")
if(CMAKE_MATCH_2)
set(VERSION_SUFFIX "${CMAKE_MATCH_2}")
2021-01-31 16:21:52 +00:00
else()
set(VERSION_SUFFIX "")
2021-01-31 14:57:42 +00:00
endif()
else()
message(WARNING "${LOGPREFIX} Failed to detect version, using default instead.")
endif()
2019-10-13 03:42:54 +00:00
endif()
2021-03-23 19:41:20 +00:00
else()
message(STATUS "${LOGPREFIX} Not a git repository, automatic version detection disabled.")
2019-10-13 03:42:54 +00:00
endif()
2021-01-31 14:57:42 +00:00
# Allow manual overrides of the detected version.
2021-01-31 16:21:52 +00:00
set(${PREFIX}VERSION "" CACHE STRING "Override StreamFX version with this string. Format: Major.Minor.Patch[Suffix][-Tweak[-Commit8c]]")
2021-03-23 19:41:20 +00:00
if(NOT (${PREFIX}VERSION STREQUAL ""))
2021-01-31 14:57:42 +00:00
string(REPLACE "-" "." T_VERSION "${${PREFIX}VERSION}")
2021-01-31 16:21:52 +00:00
string(REPLACE "." ";" T_VERSION "${${PREFIX}VERSION}")
list(LENGTH T_VERSION T_VERSIONLEN)
list(GET T_VERSION 0 VERSION_MAJOR)
list(GET T_VERSION 1 VERSION_MINOR)
list(GET T_VERSION 2 VERSION_PATCH)
if (T_VERSIONLEN GREATER_EQUAL 3)
2021-03-23 19:41:20 +00:00
list(GET T_VERSION 3 VERSION_TWEAK)
2021-01-31 16:21:52 +00:00
else()
set(VERSION_BUILD 0)
endif()
if (T_VERSIONLEN GREATER_EQUAL 4)
list(GET T_VERSION 4 VERSION_COMMIT)
else()
2021-03-23 19:41:20 +00:00
set(VERSION_COMMIT "")
2021-01-31 16:21:52 +00:00
endif()
# Patch needs additional parsing.
# This may be a [0-9]*[a-z]*[0-9]+ string.
2021-03-23 19:41:20 +00:00
string(REGEX MATCHALL "^([0-9]+)([a-z]+[0-9]+)?" T_MATCHES "${VERSION_PATCH}")
2021-01-31 16:21:52 +00:00
set(VERSION_PATCH "${CMAKE_MATCH_1}")
if(CMAKE_MATCH_2)
set(VERSION_SUFFIX "${CMAKE_MATCH_2}")
else()
set(VERSION_SUFFIX "")
endif()
2021-01-31 14:57:42 +00:00
endif()
# Generate Version String
2021-03-23 19:41:20 +00:00
if(NOT (VERSION_COMMIT STREQUAL ""))
2020-09-28 00:02:46 +00:00
set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_TWEAK}${VERSION_SUFFIX}-${VERSION_COMMIT}")
2020-04-22 20:49:09 +00:00
else()
set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_TWEAK}${VERSION_SUFFIX}")
endif()
2018-04-24 10:31:43 +00:00
2021-01-31 14:57:42 +00:00
# Log the detected version.
message(STATUS "${LOGPREFIX} Version ${VERSION_STRING}")
################################################################################
# Project
################################################################################
2019-12-21 16:03:00 +00:00
project(
2019-12-22 05:26:28 +00:00
StreamFX
2018-09-25 23:17:08 +00:00
VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_TWEAK}
2020-12-14 16:47:13 +00:00
DESCRIPTION "Additional sources, filters, transitions and encoders for OBS Studio."
HOMEPAGE_URL "https://streamfx.xaymar.com/"
2018-09-25 23:17:08 +00:00
)
2021-01-31 14:57:42 +00:00
2020-12-14 16:47:13 +00:00
# Full Project Name
set(PROJECT_FULL_NAME "StreamFX (for OBS Studio)")
# Description
2020-01-13 00:52:30 +00:00
set(PROJECT_DESCRIPTION "Better Production Quality, for free.")
2020-12-14 16:47:13 +00:00
# Authors (TODO: Generate this from AUTHORS)
2018-12-23 19:49:18 +00:00
set(PROJECT_AUTHORS "Michael Fabian 'Xaymar' Dirks <info@xaymar.com>")
2020-12-14 16:47:13 +00:00
# Copyright Years (TODO: Update every year)
2020-01-13 00:52:30 +00:00
set(PROJECT_COPYRIGHT_YEARS "2018 - 2020")
2017-06-28 21:21:42 +00:00
2020-12-14 16:47:13 +00:00
# Versioning
set(PROJECT_VERSION_STRING ${VERSION_STRING})
2017-11-02 23:30:53 +00:00
################################################################################
2020-12-14 16:47:13 +00:00
# Modules
2017-11-02 23:30:53 +00:00
################################################################################
2020-12-14 16:47:13 +00:00
# Search Paths
2021-03-22 21:14:19 +00:00
set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/clang"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
2020-12-14 16:47:13 +00:00
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
)
2020-07-27 06:22:07 +00:00
2020-12-14 16:47:13 +00:00
# Include
include("Architecture") # Architecture Detection
include("util") # CacheClear, CacheSet
include("DownloadProject") # DownloadProject
2019-12-21 16:03:00 +00:00
2020-12-14 16:47:13 +00:00
################################################################################
# Platform Setup
################################################################################
# Operating System
2020-09-28 19:08:07 +00:00
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
2020-12-14 16:47:13 +00:00
set(D_PLATFORM_OS "windows")
2020-09-28 19:08:07 +00:00
set(D_PLATFORM_WINDOWS 1)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
2020-12-14 16:47:13 +00:00
set(D_PLATFORM_OS "linux")
2020-09-28 19:08:07 +00:00
set(D_PLATFORM_LINUX 1)
2020-10-06 09:28:23 +00:00
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
2020-12-14 16:47:13 +00:00
set(D_PLATFORM_OS "macos")
2020-09-28 19:08:07 +00:00
set(D_PLATFORM_MAC 1)
else()
2020-12-14 16:47:13 +00:00
set(D_PLATFORM_OS "unknown")
set(D_PLATFORM_UNKNOWN 1)
message(WARNING "${LOGPREFIX} The operating system '${CMAKE_SYSTEM_NAME}' is unknown to to this script, continue at your own risk.")
2018-12-23 19:49:18 +00:00
endif()
2017-11-02 23:30:53 +00:00
2020-12-14 16:47:13 +00:00
# Architecture
set(D_PLATFORM_INSTR ${ARCH_INST})
if(ARCH_INST STREQUAL "x86")
set(D_PLATFORM_INSTR_X86 ON)
2021-03-23 16:53:21 +00:00
set(D_PLATFORM_ARCH_X86 ON)
2020-12-14 16:47:13 +00:00
elseif(ARCH_INST STREQUAL "ARM")
set(D_PLATFORM_INSTR_ARM ON)
2021-03-23 16:53:21 +00:00
set(D_PLATFORM_ARCH_ARM ON)
2020-12-14 16:47:13 +00:00
elseif(ARCH_INST STREQUAL "IA64")
set(D_PLATFORM_INSTR_ITANIUM ON)
2021-03-23 16:53:21 +00:00
set(D_PLATFORM_ARCH_ITANIUM ON)
2020-12-14 16:47:13 +00:00
endif()
2021-03-23 16:53:21 +00:00
set(D_PLATFORM_ARCH ${ARCH_INST})
2020-12-14 16:47:13 +00:00
# Bitness
set(D_PLATFORM_BITS ${ARCH_BITS})
set(D_PLATFORM_BITS_PTR ${ARCH_BITS_POINTER})
2020-09-28 00:07:53 +00:00
################################################################################
# C/C++ Compiler Adjustments
################################################################################
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
message(STATUS "Applying custom flags for MSVC style build.")
# MSVC/ClangCL
# - Dynamically link Microsoft C/C++ Redistributable.
# - Enable /W3 and disable useless warnings.
# - Enable C++ exceptions with SEH exceptions.
# - Enable multi-processor compiling.
2020-09-28 19:08:07 +00:00
# Build with dynamic MSVC linkage.
add_compile_options(
$<$<CONFIG:>:/MD>
$<$<CONFIG:Debug>:/MDd>
$<$<CONFIG:Release>:/MD>
$<$<CONFIG:RelWithDebInfo>:/MD>
$<$<CONFIG:MinSizeRel>:/MD>
)
2020-09-28 00:07:53 +00:00
# Enable most useful warnings.
2021-03-22 21:14:19 +00:00
set(DISABLED_WARNINGS
2020-09-28 00:07:53 +00:00
"/wd4061" "/wd4100" "/wd4180" "/wd4201" "/wd4464" "/wd4505" "/wd4514"
"/wd4571" "/wd4623" "/wd4625" "/wd4626" "/wd4668" "/wd4710" "/wd4774"
"/wd4820" "/wd5026" "/wd5027" "/wd5039" "/wd5045" "/wd26812"
)
add_compile_options("/W3")
foreach(WARN ${DISABLED_WARNINGS})
add_compile_options("${WARN}")
endforeach()
# C++ Exceptions & SEH
add_compile_options("/EHa")
# Multiprocessor compiling
add_compile_options("/MP")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(STATUS "Applying custom flags for GNU style build.")
2021-03-22 21:14:19 +00:00
2020-09-28 00:07:53 +00:00
# Clang/AppleClang/GNU
2020-11-05 19:12:57 +00:00
# - Don't export by default. (Temporarily disabled)
2020-09-28 00:07:53 +00:00
# - Enable all and extra warnings.
2021-03-22 21:14:19 +00:00
2020-09-28 00:07:53 +00:00
add_compile_options("-Wall")
add_compile_options("-Wextra")
2020-11-05 19:12:57 +00:00
# add_compile_options("-fvisibility=hidden")
2019-09-04 01:32:18 +00:00
endif()
2018-12-23 19:49:18 +00:00
################################################################################
2020-12-14 16:47:13 +00:00
# Detect if we are building with OBS Studio (different from Grouped builds)
2019-12-22 05:26:28 +00:00
################################################################################
2020-12-14 16:47:13 +00:00
set(STANDALONE ON)
if(GROUPED AND (TARGET libobs))
set(STANDALONE OFF)
endif()
if(STANDALONE)
message(STATUS "${LOGPREFIX} This is a standalone build, please make sure you've followed the instructions.")
set(${PREFIX}OBS_NATIVE OFF)
2020-01-13 00:52:30 +00:00
else()
2020-12-14 16:47:13 +00:00
message(STATUS "${LOGPREFIX} This is a combined build.")
set(${PREFIX}OBS_NATIVE ON)
2020-09-28 19:08:07 +00:00
endif()
2019-12-22 05:26:28 +00:00
2020-09-28 19:08:07 +00:00
################################################################################
# Options
################################################################################
2020-03-16 19:37:31 +00:00
# Features
2020-04-25 23:04:04 +00:00
## Encoders
2020-12-14 16:47:13 +00:00
set(${PREFIX}ENABLE_ENCODER_FFMPEG ON CACHE BOOL "Enable FFmpeg Encoder integration.")
set(${PREFIX}ENABLE_ENCODER_FFMPEG_AMF ON CACHE BOOL "Enable AMF Encoder in FFmpeg.")
set(${PREFIX}ENABLE_ENCODER_FFMPEG_NVENC ON CACHE BOOL "Enable NVENC Encoder in FFmpeg.")
set(${PREFIX}ENABLE_ENCODER_FFMPEG_PRORES ON CACHE BOOL "Enable ProRes Encoder in FFmpeg.")
2020-09-28 19:08:07 +00:00
2020-04-25 23:04:04 +00:00
## Filters
2020-12-14 16:47:13 +00:00
set(${PREFIX}ENABLE_FILTER_BLUR ON CACHE BOOL "Enable Blur Filter")
set(${PREFIX}ENABLE_FILTER_COLOR_GRADE ON CACHE BOOL "Enable Color Grade Filter")
set(${PREFIX}ENABLE_FILTER_DISPLACEMENT ON CACHE BOOL "Enable Displacement Filter")
set(${PREFIX}ENABLE_FILTER_DYNAMIC_MASK ON CACHE BOOL "Enable Dynamic Mask Filter")
set(${PREFIX}ENABLE_FILTER_NVIDIA_FACE_TRACKING ON CACHE BOOL "Enable NVidia Face Tracking Filter")
set(${PREFIX}ENABLE_FILTER_SDF_EFFECTS ON CACHE BOOL "Enable SDF Effects Filter")
set(${PREFIX}ENABLE_FILTER_SHADER ON CACHE BOOL "Enable Shader Filter")
set(${PREFIX}ENABLE_FILTER_TRANSFORM ON CACHE BOOL "Enable Transform Filter")
2020-09-28 19:08:07 +00:00
2020-04-25 23:04:04 +00:00
## Sources
2020-12-14 16:47:13 +00:00
set(${PREFIX}ENABLE_SOURCE_MIRROR ON CACHE BOOL "Enable Mirror Source")
set(${PREFIX}ENABLE_SOURCE_SHADER ON CACHE BOOL "Enable Shader Source")
2020-09-28 19:08:07 +00:00
2020-04-25 23:04:04 +00:00
## Transitions
2020-12-14 16:47:13 +00:00
set(${PREFIX}ENABLE_TRANSITION_SHADER ON CACHE BOOL "Enable Shader Transition")
2020-09-28 19:08:07 +00:00
2020-12-14 16:47:13 +00:00
## FrontEnd & UI
set(${PREFIX}ENABLE_FRONTEND ON CACHE BOOL "Enable Frontend code.")
set(${PREFIX}ENABLE_UPDATER ON CACHE BOOL "Enable automatic update checks.")
2020-09-28 19:08:07 +00:00
2020-05-31 14:50:59 +00:00
## Code Related
2020-12-14 16:47:13 +00:00
set(${PREFIX}ENABLE_CLANG ON CACHE BOOL "Enable Clang integration for supported compilers.")
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.")
2021-01-31 21:05:23 +00:00
# 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)")
endif()
set(PACKAGE_PREFIX "${CMAKE_BINARY_DIR}" CACHE PATH "Where to place the packages?")
2021-03-23 16:53:21 +00:00
set(PACKAGE_NAME "${PROJECT_NAME}" CACHE STRING "What should the package be called?")
2021-01-31 21:05:23 +00:00
set(PACKAGE_SUFFIX "" CACHE STRING "Any suffix for the package name? (Defaults to the current version string)")
endif()
2020-12-14 16:47:13 +00:00
################################################################################
# Clang
################################################################################
2020-03-16 19:37:31 +00:00
2020-12-14 16:47:13 +00:00
if(${PREFIX}ENABLE_CLANG AND (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/clang/Clang.cmake"))
include("Clang")
set(HAVE_CLANG ON)
endif()
2020-06-14 02:34:05 +00:00
2020-12-14 16:47:13 +00:00
################################################################################
# Standalone Build: OBS Studio
################################################################################
if(NOT ${PREFIX}OBS_NATIVE)
# Options
2021-03-23 16:53:21 +00:00
set(${PREFIX}DOWNLOAD_OBS_URL "" CACHE STRING "(Optional) URL of prebuilt libOBS archive to download.")
set(${PREFIX}DOWNLOAD_OBS_HASH "" CACHE STRING "(Optional) The hash for the libOBS archive.")
2020-11-02 15:52:02 +00:00
mark_as_advanced(
2021-03-23 16:53:21 +00:00
${PREFIX}DOWNLOAD_OBS_URL
${PREFIX}DOWNLOAD_OBS_HASH
2020-11-02 15:52:02 +00:00
)
2020-12-14 16:47:13 +00:00
# Allow overriding what version we build against.
2021-03-23 16:53:21 +00:00
if(${PREFIX}DOWNLOAD_OBS_URL)
set(_DOWNLOAD_OBS_URL "${${PREFIX}DOWNLOAD_OBS_URL}")
set(_DOWNLOAD_OBS_HASH "${${PREFIX}DOWNLOAD_OBS_HASH}")
2020-11-02 15:52:02 +00:00
else()
2021-03-23 16:53:21 +00:00
set(_DOWNLOAD_OBS_VERSION "26.1.0-ci")
if (D_PLATFORM_WINDOWS)
if (D_PLATFORM_ARCH_X86)
set(_DOWNLOAD_OBS_URL "https://github.com/Xaymar/obs-studio/releases/download/${_DOWNLOAD_OBS_VERSION}/obs-studio-x64-0.0.0.0-windows-${D_PLATFORM_BITS}.7z")
if (D_PLATFORM_BITS EQUAL 64)
set(_DOWNLOAD_OBS_HASH "SHA256=EA9EE4CCEC0A19605C0768F1F4C21391A919CF0886F7A7CC94D63A95402CFD9B")
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
2020-11-02 15:52:02 +00:00
elseif(D_PLATFORM_LINUX)
2021-03-23 16:53:21 +00:00
if (D_PLATFORM_ARCH_X86)
set(_DOWNLOAD_OBS_URL "https://github.com/Xaymar/obs-studio/releases/download/${_DOWNLOAD_OBS_VERSION}/obs-studio-x64-0.0.0.0-ubuntu-${D_PLATFORM_BITS}.7z")
if (D_PLATFORM_BITS EQUAL 64)
set(_DOWNLOAD_OBS_HASH "SHA256=2B2793CDD0C3F5940924665022E31A76C10E34174073BF7B221325C11E764DF5")
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
2020-11-02 15:52:02 +00:00
elseif(D_PLATFORM_MAC)
2021-03-23 16:53:21 +00:00
if (D_PLATFORM_ARCH_X86)
set(_DOWNLOAD_OBS_URL "https://github.com/Xaymar/obs-studio/releases/download/${_DOWNLOAD_OBS_VERSION}/obs-studio-x64-0.0.0.0-macos-${D_PLATFORM_BITS}.7z")
if (D_PLATFORM_BITS EQUAL 64)
set(_DOWNLOAD_OBS_HASH "SHA256=34ABD3E574C62DA4E026E5DE271B93AB5151927E564F77264A59456F6ABCBDD0")
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
2020-11-02 15:52:02 +00:00
else()
2021-03-23 16:53:21 +00:00
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
2020-11-02 15:52:02 +00:00
return()
endif()
endif()
2020-12-14 16:47:13 +00:00
# Download libOBS
2020-09-28 19:08:07 +00:00
download_project(
PROJ libobs
2021-03-23 16:53:21 +00:00
URL "${_DOWNLOAD_OBS_URL}"
URL_HASH "${_DOWNLOAD_OBS_HASH}"
2020-09-28 19:08:07 +00:00
DOWNLOAD_NO_PROGRESS OFF
UPDATE_DISCONNECTED OFF
)
2020-11-01 13:05:53 +00:00
2020-12-14 16:47:13 +00:00
include("${libobs_SOURCE_DIR}/cmake/LibObs/LibObsConfig.cmake")
2021-03-23 16:53:21 +00:00
endif()
2020-12-14 16:47:13 +00:00
2021-03-23 16:53:21 +00:00
################################################################################
# Standalone Build: OBS Studio Dependencies
################################################################################
2020-12-14 16:47:13 +00:00
2021-03-23 16:53:21 +00:00
if(STANDALONE AND NOT D_PLATFORM_LINUX)
# Options
set(${PREFIX}DOWNLOAD_OBSDEPS_URL "" CACHE STRING "(Optional) URL of prebuilt libOBS archive to download.")
set(${PREFIX}DOWNLOAD_OBSDEPS_HASH "" CACHE STRING "(Optional) The hash for the libOBS archive.")
mark_as_advanced(
${PREFIX}DOWNLOAD_OBSDEPS_URL
${PREFIX}DOWNLOAD_OBSDEPS_HASH
)
# Allow overriding what version we build against.
if(${PREFIX}DOWNLOAD_OBSDEPS_URL)
set(_DOWNLOAD_OBSDEPS_URL "${${PREFIX}DOWNLOAD_OBSDEPS_URL}")
set(_DOWNLOAD_OBSDEPS_HASH "${${PREFIX}DOWNLOAD_OBSDEPS_HASH}")
else()
if (D_PLATFORM_WINDOWS)
if (D_PLATFORM_ARCH_X86)
set(_DOWNLOAD_OBSDEPS_URL "https://github.com/Xaymar/obs-studio/releases/download/26.1.0/deps_windows_x86.7z")
if (D_PLATFORM_BITS EQUAL 64)
set(_DOWNLOAD_OBSDEPS_HASH "SHA256=F5F8F5A53FDB26FF8F4D24811CA0FEA891B3A0C8477515B886129669A81D37C2")
elseif (D_PLATFORM_BITS EQUAL 32)
set(_DOWNLOAD_OBSDEPS_HASH "SHA256=F5F8F5A53FDB26FF8F4D24811CA0FEA891B3A0C8477515B886129669A81D37C2")
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
elseif(D_PLATFORM_MAC)
if (D_PLATFORM_ARCH_X86)
set(_DOWNLOAD_OBSDEPS_URL "https://github.com/Xaymar/obs-studio/releases/download/26.1.0/deps_macos_x86.tar.gz")
if (D_PLATFORM_BITS EQUAL 64)
set(_DOWNLOAD_OBSDEPS_HASH "SHA256=B316DD7802E0DEAE2BD43F52D4C8BD52EF893D203B90148C2AB851A00AA733FF")
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
2020-12-14 16:47:13 +00:00
else()
2021-03-23 16:53:21 +00:00
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
2020-12-14 16:47:13 +00:00
endif()
2021-03-23 16:53:21 +00:00
endif()
2021-03-22 21:14:19 +00:00
2021-03-23 16:53:21 +00:00
# Download libOBS
download_project(
PROJ obsdeps
URL "${_DOWNLOAD_OBSDEPS_URL}"
URL_HASH "${_DOWNLOAD_OBSDEPS_HASH}"
DOWNLOAD_NO_PROGRESS OFF
UPDATE_DISCONNECTED OFF
)
if (D_PLATFORM_WINDOWS)
set(_OBSDEPS_PATH "${obsdeps_SOURCE_DIR}/win${D_PLATFORM_BITS}")
elseif(D_PLATFORM_MAC)
set(_OBSDEPS_PATH "${obsdeps_SOURCE_DIR}/obsdeps")
2020-09-28 19:08:07 +00:00
endif()
2020-12-14 16:47:13 +00:00
endif()
2020-09-28 19:08:07 +00:00
2020-12-14 16:47:13 +00:00
################################################################################
# Standalone Build: Qt v5.x
################################################################################
2021-03-23 16:53:21 +00:00
if(STANDALONE AND NOT D_PLATFORM_LINUX)
2020-12-14 16:47:13 +00:00
set(${PREFIX}DOWNLOAD_QT OFF CACHE BOOL "Download Qt?")
if(${PREFIX}DOWNLOAD_QT)
2021-03-23 16:53:21 +00:00
set(${PREFIX}DOWNLOAD_QT_URL "" CACHE STRING "")
2020-12-14 16:47:13 +00:00
set(${PREFIX}DOWNLOAD_QT_HASH "" CACHE STRING "")
mark_as_advanced(
2021-03-23 16:53:21 +00:00
${PREFIX}DOWNLOAD_QT_URL
${PREFIX}DOWNLOAD_QT_HASH
2020-12-14 16:47:13 +00:00
)
2021-03-22 21:14:19 +00:00
2021-03-23 16:53:21 +00:00
# Allow overriding what version we build against.
if(${PREFIX}DOWNLOAD_QT_URL)
set(_DOWNLOAD_QT_URL "${${PREFIX}DOWNLOAD_QT_URL}")
set(_DOWNLOAD_QT_HASH "${${PREFIX}DOWNLOAD_QT_HASH}")
else()
if (D_PLATFORM_WINDOWS)
if (D_PLATFORM_ARCH_X86)
if (D_PLATFORM_BITS EQUAL 64)
set(_DOWNLOAD_QT_URL "https://github.com/Xaymar/obs-studio/releases/download/26.1.0/qt_5.15.2_windows_64.7z")
set(_DOWNLOAD_QT_HASH "SHA256=109B9C21EF165B0C46DFAA9AD23124F2070ED4D74207C4AFB308183CB8D43BDD")
elseif (D_PLATFORM_BITS EQUAL 32)
set(_DOWNLOAD_QT_URL "https://github.com/Xaymar/obs-studio/releases/download/26.1.0/qt_5.15.2_windows_32.7z")
set(_DOWNLOAD_QT_HASH "SHA256=372E4FBF2A15DD4FDA955A07334D8B8AC6802990148C9CB4E766C90205F8F570")
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
elseif(D_PLATFORM_MAC)
if (D_PLATFORM_ARCH_X86)
set(_DOWNLOAD_QT_URL "https://github.com/obsproject/obs-deps/releases/download/2020-12-22/macos-qt-5.15.2-2020-12-22.tar.gz")
if (D_PLATFORM_BITS EQUAL 64)
set(_DOWNLOAD_QT_HASH "SHA256=5BA0BC722F54391FE27508D6DB57EC63BDA22DAD890F5960145C731C1BB837ED")
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
else()
message(FATAL_ERROR "${LOGPREFIX} Platform '${D_PLATFORM_OS}' with architecture '${D_PLATFORM_ARCH}' and bitness '${D_PLATFORM_BITS}' is not supported.")
return()
endif()
endif()
2020-12-14 16:47:13 +00:00
download_project(
PROJ qt
2021-03-23 16:53:21 +00:00
URL "${_DOWNLOAD_QT_URL}"
2020-12-14 16:47:13 +00:00
URL_HASH "${_DOWNLOAD_QT_HASH}"
2021-03-23 16:53:21 +00:00
DOWNLOAD_NO_PROGRESS OFF
UPDATE_DISCONNECTED OFF
2020-12-14 16:47:13 +00:00
)
set(Qt5_DIR "${qt_SOURCE_DIR}" CACHE STRING "Path to Qt5")
2021-03-23 16:53:21 +00:00
if (D_PLATFORM_WINDOWS)
if (D_PLATFORM_ARCH_X86)
if (D_PLATFORM_BITS EQUAL 64)
CacheSet(Qt5_DIR "${qt_SOURCE_DIR}/lib/cmake/Qt5")
elseif (D_PLATFORM_BITS EQUAL 32)
CacheSet(Qt5_DIR "${qt_SOURCE_DIR}/lib/cmake/Qt5")
endif()
endif()
elseif(D_PLATFORM_MAC)
CacheSet(Qt5_DIR "${qt_SOURCE_DIR}/lib/cmake/Qt5")
2020-12-14 16:47:13 +00:00
endif()
endif()
2018-12-23 19:49:18 +00:00
endif()
2018-04-24 10:31:43 +00:00
2020-12-14 16:47:13 +00:00
################################################################################
# Components
################################################################################
# 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.
function(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 PARENT_SCOPE)
else()
set(${PREFIX}DISABLE_${FEATURE} ON PARENT_SCOPE)
set(${OUTPUT} OFF PARENT_SCOPE)
endif()
endfunction()
2021-02-14 12:15:22 +00:00
macro(set_feature_disabled FEATURE DISABLED)
2020-12-14 16:47:13 +00:00
set(${PREFIX}DISABLE_${FEATURE} ${DISABLED} PARENT_SCOPE)
2021-02-14 12:15:22 +00:00
endmacro()
2020-12-14 16:47:13 +00:00
# Features
function(feature_encoder_ffmpeg RESOLVE)
is_feature_enabled(ENCODER_FFMPEG T_CHECK)
if(RESOLVE AND T_CHECK)
if(NOT HAVE_FFMPEG)
message(WARNING "${LOGPREFIX}: 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 "${LOGPREFIX}: 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 "${LOGPREFIX}: 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)
endif()
elseif(T_CHECK)
set(REQUIRE_FFMPEG 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_displacement RESOLVE)
is_feature_enabled(FILTER_DISPLACEMENT T_CHECK)
endfunction()
function(feature_filter_dynamic_mask RESOLVE)
is_feature_enabled(FILTER_DYNAMIC_MASK T_CHECK)
endfunction()
function(feature_filter_nvidia_face_tracking RESOLVE)
is_feature_enabled(FILTER_NVIDIA_FACE_TRACKING T_CHECK)
if(RESOLVE AND T_CHECK)
if(NOT D_PLATFORM_WINDOWS)
message(WARNING "${LOGPREFIX}: NVIDIA Face Tracking requires Windows. Disabling...")
set_feature_disabled(FILTER_NVIDIA_FACE_TRACKING ON)
elseif(NOT HAVE_NVIDIA_ARSDK)
message(WARNING "${LOGPREFIX}: NVIDIA Face Tracking requires NVIDIA AR SDK. Disabling...")
set_feature_disabled(FILTER_NVIDIA_FACE_TRACKING ON)
elseif(NOT HAVE_NVIDIA_CUDA)
message(WARNING "${LOGPREFIX}: NVIDIA Face Tracking requires NVIDIA CUDA. Disabling...")
set_feature_disabled(FILTER_NVIDIA_FACE_TRACKING ON)
endif()
elseif(T_CHECK)
set(REQUIRE_NVIDIA_ARSDK ON PARENT_SCOPE)
set(REQUIRE_NVIDIA_CUDA ON PARENT_SCOPE)
endif()
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_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 HAVE_QT)
message(WARNING "${LOGPREFIX}: Front-End requires Qt. Disabling...")
set_feature_disabled(FRONTEND ON)
elseif(NOT HAVE_OBSFE)
message(WARNING "${LOGPREFIX}: Front-End requires OBS FrontEnd API. Disabling...")
set_feature_disabled(FRONTEND ON)
endif()
elseif(T_CHECK)
set(REQUIRE_QT ON PARENT_SCOPE)
set(REQUIRE_OBSFE ON PARENT_SCOPE)
endif()
endfunction()
function(feature_updater RESOLVE)
is_feature_enabled(UPDATER T_CHECK)
if(RESOLVE AND T_CHECK)
if(NOT HAVE_CURL)
message(WARNING "${LOGPREFIX}: Updater requires CURL. Disabling...")
set_feature_disabled(UPDATER ON)
elseif(NOT HAVE_JSON)
message(WARNING "${LOGPREFIX}: 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_filter_blur(OFF)
feature_filter_color_grade(OFF)
feature_filter_displacement(OFF)
feature_filter_dynamic_mask(OFF)
feature_filter_nvidia_face_tracking(OFF)
feature_filter_sdf_effects(OFF)
feature_filter_shader(OFF)
feature_filter_transform(OFF)
feature_source_mirror(OFF)
feature_source_shader(OFF)
feature_transition_shader(OFF)
feature_frontend(OFF)
feature_updater(OFF)
# Fulfill Requirements
2021-03-22 21:14:19 +00:00
#- CURL
2020-12-14 16:47:13 +00:00
set(HAVE_CURL OFF)
2020-09-09 03:01:24 +00:00
if(REQUIRE_CURL)
2020-12-14 16:47:13 +00:00
if(D_PLATFORM_WINDOWS)
2020-09-28 19:08:07 +00:00
if(${PREFIX}OBS_NATIVE) # Already defined by OBS
2020-09-09 03:01:24 +00:00
set(CURL_LIBRARIES "${CURL_LIB}")
set(CURL_INCLUDE_DIRS "${CURL_INCLUDE_DIR}")
2020-09-28 19:08:07 +00:00
else()
2021-03-23 16:53:21 +00:00
set(CURL_LIBRARIES "${_OBSDEPS_PATH}/bin/libcurl.lib")
set(CURL_INCLUDE_DIRS "${_OBSDEPS_PATH}/include")
2020-09-09 03:01:24 +00:00
endif()
2020-09-09 03:06:15 +00:00
set(CURL_LIBRARY_DEBUG ${CURL_LIBRARIES})
set(CURL_LIBRARY_RELEASE ${CURL_LIBRARIES})
set(CURL_INCLUDE_DIR ${CURL_INCLUDE_DIRS})
2020-09-09 03:01:24 +00:00
set(CURL_FOUND ON)
2020-09-09 03:06:15 +00:00
else()
2020-09-28 19:08:07 +00:00
find_package(CURL)
endif()
set(HAVE_CURL ${CURL_FOUND})
endif()
2021-03-22 21:14:19 +00:00
#- FFmpeg
2020-12-14 16:47:13 +00:00
set(HAVE_FFMPEG OFF)
2020-09-28 19:08:07 +00:00
if(REQUIRE_FFMPEG)
2020-12-14 16:47:13 +00:00
if(D_PLATFORM_WINDOWS AND NOT ${PREFIX}OBS_NATIVE)
2020-09-28 19:08:07 +00:00
find_path(
FFmpegPath "libavcodec/avcodec.h"
HINTS
${OBS_DEPENDENCIES_DIR}
2021-03-23 16:53:21 +00:00
${_OBSDEPS_PATH}
2020-09-28 19:08:07 +00:00
${DepsPath}
${DepsPath32}
${DepsPath64}
2021-03-22 21:14:19 +00:00
2020-09-28 19:08:07 +00:00
PATHS
/usr/include
/usr/local/include
/opt/local/include
/sw/include
PATH_SUFFIXES
2020-12-14 16:47:13 +00:00
win${D_PLATFORM_BITS}
win${D_PLATFORM_BITS}/bin
win${D_PLATFORM_BITS}/include
win${D_PLATFORM_INSTR}
win${D_PLATFORM_INSTR}/bin
win${D_PLATFORM_INSTR}/include
2020-09-28 19:08:07 +00:00
bin
include
)
2020-09-09 03:01:24 +00:00
endif()
2020-12-14 16:47:13 +00:00
2020-09-28 19:08:07 +00:00
find_package(FFmpeg COMPONENTS avutil avcodec swscale)
set(HAVE_FFMPEG ${FFmpeg_FOUND})
2020-09-09 03:01:24 +00:00
endif()
2021-03-22 21:14:19 +00:00
#- JSON
2020-12-14 16:47:13 +00:00
set(HAVE_JSON OFF)
if(REQUIRE_JSON)
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/third-party/nlohmann-json/single_include")
message(FATAL_ERROR "${LOGPREFIX} 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()
2020-09-28 19:08:07 +00:00
endif()
2021-03-22 21:14:19 +00:00
#- NVIDIA Augmented Reality SDK (Windows)
2020-12-14 16:47:13 +00:00
set(HAVE_NVIDIA_ARSDK OFF)
2021-02-14 12:15:22 +00:00
if(REQUIRE_NVIDIA_ARSDK AND D_PLATFORM_WINDOWS)
2020-12-14 16:47:13 +00:00
if(EXISTS "${PROJECT_SOURCE_DIR}/third-party/nvidia-arsdk/version.h")
set(NVAR_ROOT "${PROJECT_SOURCE_DIR}/third-party/nvidia-arsdk")
2020-09-28 19:08:07 +00:00
endif()
2020-12-14 16:47:13 +00:00
find_package(NVAR)
2020-09-28 19:08:07 +00:00
2020-12-14 16:47:13 +00:00
set(HAVE_NVIDIA_ARSDK ${NVAR_FOUND})
2020-09-28 19:08:07 +00:00
endif()
2020-12-14 16:47:13 +00:00
2021-03-22 21:14:19 +00:00
#- NVIDIA CUDA (Windows)
2020-12-14 16:47:13 +00:00
set(HAVE_NVIDIA_CUDA OFF)
2021-02-14 12:15:22 +00:00
if(REQUIRE_NVIDIA_CUDA AND D_PLATFORM_WINDOWS)
2020-12-14 16:47:13 +00:00
set(HAVE_NVIDIA_CUDA ON)
2020-09-28 19:08:07 +00:00
endif()
2021-03-22 21:14:19 +00:00
#- OBS Front-End API
2020-12-14 16:47:13 +00:00
set(HAVE_OBSFE OFF)
2020-09-28 19:08:07 +00:00
if(REQUIRE_OBSFE)
2020-12-14 16:47:13 +00:00
if(${PREFIX}OBS_NATIVE)
if(TARGET obs-frontend-api)
set(HAVE_OBSFE ON)
2020-09-28 19:08:07 +00:00
endif()
else()
2020-12-14 16:47:13 +00:00
if (EXISTS "${libobs_SOURCE_DIR}/cmake/obs-frontend-api/obs-frontend-apiConfig.cmake")
include("${libobs_SOURCE_DIR}/cmake/obs-frontend-api/obs-frontend-apiConfig.cmake")
set(HAVE_OBSFE ON)
2020-09-28 19:08:07 +00:00
endif()
endif()
endif()
2020-09-09 03:04:42 +00:00
2021-03-22 21:14:19 +00:00
#- Qt5
2020-12-14 16:47:13 +00:00
set(HAVE_QT OFF)
if(REQUIRE_QT)
2021-03-22 21:14:19 +00:00
find_package(Qt5
2020-12-14 16:47:13 +00:00
COMPONENTS Widgets Core REQUIRED
)
set(HAVE_QT ${Qt5_FOUND})
2020-09-28 19:08:07 +00:00
endif()
2020-12-14 16:47:13 +00:00
# Verify Requirements
feature_encoder_ffmpeg(ON)
feature_filter_blur(ON)
feature_filter_color_grade(ON)
feature_filter_displacement(ON)
feature_filter_dynamic_mask(ON)
feature_filter_nvidia_face_tracking(ON)
feature_filter_sdf_effects(ON)
feature_filter_shader(ON)
feature_filter_transform(ON)
feature_source_mirror(ON)
feature_source_shader(ON)
feature_transition_shader(ON)
feature_frontend(ON)
feature_updater(ON)
2020-09-28 19:08:07 +00:00
2017-06-28 21:21:42 +00:00
################################################################################
# Code
################################################################################
2020-03-16 19:37:31 +00:00
set(PROJECT_DATA_LOCALE )
set(PROJECT_DATA_EFFECTS )
set(PROJECT_DATA_SHADERS )
set(PROJECT_LIBRARIES )
set(PROJECT_LIBRARIES_DELAYED )
2020-04-05 08:33:35 +00:00
set(PROJECT_INCLUDE_DIRS )
2020-03-16 19:37:31 +00:00
set(PROJECT_TEMPLATES )
set(PROJECT_PRIVATE_GENERATED )
set(PROJECT_PRIVATE_SOURCE )
2020-04-05 08:33:35 +00:00
set(PROJECT_UI )
2020-09-28 19:08:07 +00:00
set(PROJECT_UI_SOURCE )
2020-09-09 03:01:24 +00:00
set(PROJECT_DEFINITIONS )
2020-03-16 19:37:31 +00:00
2020-12-14 16:47:13 +00:00
# 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")
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/version.rc.in"
"generated/version.rc"
@ONLY
)
LIST(APPEND PROJECT_TEMPLATES "templates/version.rc.in")
LIST(APPEND PROJECT_PRIVATE_GENERATED "${PROJECT_BINARY_DIR}/generated/version.rc")
2020-09-28 19:08:07 +00:00
endif()
2020-12-14 16:47:13 +00:00
# Minimum Dependencies
list(APPEND PROJECT_LIBRARIES libobs)
# Components
if(HAVE_CURL)
2020-09-09 03:01:24 +00:00
list(APPEND PROJECT_PRIVATE_SOURCE
"source/util/util-curl.hpp"
"source/util/util-curl.cpp"
)
2020-09-28 19:08:07 +00:00
list(APPEND PROJECT_LIBRARIES ${CURL_LIBRARY_RELEASE})
list(APPEND PROJECT_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
endif()
2020-12-14 16:47:13 +00:00
if(HAVE_FFMPEG)
2020-09-09 03:01:24 +00:00
list(APPEND PROJECT_LIBRARIES
2020-09-28 19:08:07 +00:00
${FFMPEG_LIBRARIES}
2020-09-09 03:01:24 +00:00
)
list(APPEND PROJECT_INCLUDE_DIRS
2020-09-28 19:08:07 +00:00
${FFMPEG_INCLUDE_DIRS}
2020-12-14 16:47:13 +00:00
)
endif()
if(HAVE_JSON)
list(APPEND PROJECT_INCLUDE_DIRS ${JSON_INCLUDE_DIR})
endif()
if(HAVE_NVIDIA_ARSDK)
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"
)
list(APPEND PROJECT_LIBRARIES
nvARProxy
)
2020-09-28 19:08:07 +00:00
endif()
2020-12-14 16:47:13 +00:00
if(HAVE_NVIDIA_CUDA)
2020-09-28 19:08:07 +00:00
list(APPEND PROJECT_PRIVATE_SOURCE
"source/nvidia/cuda/nvidia-cuda.hpp"
"source/nvidia/cuda/nvidia-cuda.cpp"
"source/nvidia/cuda/nvidia-cuda-context.hpp"
"source/nvidia/cuda/nvidia-cuda-context.cpp"
"source/nvidia/cuda/nvidia-cuda-context-stack.hpp"
"source/nvidia/cuda/nvidia-cuda-context-stack.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"
2020-09-09 03:01:24 +00:00
)
endif()
2020-12-14 16:47:13 +00:00
if(REQUIRE_OBSFE AND HAVE_OBSFE)
list(APPEND PROJECT_LIBRARIES obs-frontend-api)
endif()
if(REQUIRE_QT AND HAVE_QT)
list(APPEND PROJECT_LIBRARIES Qt5::Core Qt5::Widgets)
2020-09-09 03:04:42 +00:00
endif()
2020-12-14 16:47:13 +00:00
################################################################################
# Features
################################################################################
2020-09-28 19:08:07 +00:00
# Core
2020-03-16 19:37:31 +00:00
list(APPEND PROJECT_PRIVATE_SOURCE
2020-04-22 20:58:33 +00:00
"source/configuration.hpp"
"source/configuration.cpp"
2020-04-02 15:02:01 +00:00
"source/common.hpp"
2020-04-22 20:49:09 +00:00
"source/strings.hpp"
2020-03-16 19:37:31 +00:00
"source/plugin.hpp"
"source/plugin.cpp"
2020-07-12 16:41:50 +00:00
"source/util/utility.hpp"
"source/util/utility.cpp"
2020-11-05 05:35:31 +00:00
"source/util/util-bitmask.hpp"
2020-07-12 16:41:50 +00:00
"source/util/util-event.hpp"
2020-08-09 20:47:33 +00:00
"source/util/util-library.cpp"
"source/util/util-library.hpp"
2020-07-12 16:41:50 +00:00
"source/util/util-threadpool.cpp"
"source/util/util-threadpool.hpp"
2020-03-16 19:37:31 +00:00
"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-mipmapper.hpp"
"source/obs/gs/gs-mipmapper.cpp"
"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"
2020-06-14 18:16:26 +00:00
"source/obs/obs-encoder-factory.hpp"
"source/obs/obs-encoder-factory.cpp"
2020-03-16 19:37:31 +00:00
"source/obs/obs-signal-handler.hpp"
"source/obs/obs-signal-handler.cpp"
"source/obs/obs-source.hpp"
"source/obs/obs-source.cpp"
"source/obs/obs-source-factory.hpp"
"source/obs/obs-source-factory.cpp"
"source/obs/obs-source-tracker.hpp"
"source/obs/obs-source-tracker.cpp"
"source/obs/obs-tools.hpp"
"source/obs/obs-tools.cpp"
2018-09-25 23:17:08 +00:00
)
2020-09-28 19:08:07 +00:00
list(APPEND PROJECT_DATA
2021-02-02 21:22:47 +00:00
"data/effects/color_conversion_rgb_hsl.effect"
"data/effects/color_conversion_rgb_hsv.effect"
"data/effects/color_conversion_rgb_yuv.effect"
2020-09-28 19:08:07 +00:00
"data/effects/mipgen.effect"
"data/effects/pack-unpack.effect"
2021-02-02 21:23:10 +00:00
"data/effects/shared.effect"
2020-12-14 16:47:13 +00:00
"data/locale/en-US.ini"
2020-09-28 19:08:07 +00:00
)
2020-12-14 16:47:13 +00:00
list(APPEND PROJECT_INCLUDE_DIRS
"${PROJECT_BINARY_DIR}/generated"
"${PROJECT_SOURCE_DIR}/source"
)
file(GLOB_RECURSE PROJECT_EXAMPLES "data/examples/*")
list(APPEND PROJECT_DATA ${PROJECT_EXAMPLES})
2020-09-09 03:06:15 +00:00
2020-12-14 16:47:13 +00:00
# Encoder/FFmpeg
is_feature_enabled(ENCODER_FFMPEG T_CHECK)
if(T_CHECK)
2020-03-16 19:37:31 +00:00
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"
2021-03-22 21:14:19 +00:00
2020-03-16 19:37:31 +00:00
# Encoders
2020-06-14 20:22:44 +00:00
"source/encoders/encoder-ffmpeg.hpp"
"source/encoders/encoder-ffmpeg.cpp"
2020-03-16 19:37:31 +00:00
# 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"
# Encoders/Handlers
"source/encoders/handlers/handler.hpp"
"source/encoders/handlers/handler.cpp"
"source/encoders/handlers/debug_handler.hpp"
"source/encoders/handlers/debug_handler.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_ENCODER_FFMPEG
)
2020-12-14 16:47:13 +00:00
# AMF
is_feature_enabled(ENCODER_FFMPEG_AMF T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/encoders/handlers/amf_shared.hpp"
"source/encoders/handlers/amf_shared.cpp"
"source/encoders/handlers/amf_h264_handler.hpp"
"source/encoders/handlers/amf_h264_handler.cpp"
"source/encoders/handlers/amf_hevc_handler.hpp"
"source/encoders/handlers/amf_hevc_handler.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_ENCODER_FFMPEG_AMF
)
endif()
2021-03-22 21:14:19 +00:00
2020-12-14 16:47:13 +00:00
# NVENC
is_feature_enabled(ENCODER_FFMPEG_NVENC T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/encoders/handlers/nvenc_shared.hpp"
"source/encoders/handlers/nvenc_shared.cpp"
"source/encoders/handlers/nvenc_h264_handler.hpp"
"source/encoders/handlers/nvenc_h264_handler.cpp"
"source/encoders/handlers/nvenc_hevc_handler.hpp"
"source/encoders/handlers/nvenc_hevc_handler.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_ENCODER_FFMPEG_NVENC
)
endif()
2021-03-22 21:14:19 +00:00
2020-12-14 16:47:13 +00:00
# ProRES
is_feature_enabled(ENCODER_FFMPEG_PRORES T_CHECK)
if(T_CHECK)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/encoders/handlers/prores_aw_handler.hpp"
"source/encoders/handlers/prores_aw_handler.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_ENCODER_FFMPEG_PRORES
)
endif()
2020-03-16 19:37:31 +00:00
endif()
2020-12-14 16:47:13 +00:00
# Filter/Blur
is_feature_enabled(FILTER_BLUR T_CHECK)
if(T_CHECK)
2020-03-16 19:37:31 +00:00
list(APPEND PROJECT_DATA
"data/effects/mask.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"
2020-12-14 16:47:13 +00:00
"source/filters/filter-blur.cpp"
2020-03-16 19:37:31 +00:00
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_BLUR
)
endif()
2020-12-14 16:47:13 +00:00
# Filter/Color Grade
is_feature_enabled(FILTER_COLOR_GRADE T_CHECK)
if(T_CHECK)
2020-03-16 19:37:31 +00:00
list(APPEND PROJECT_DATA
"data/effects/color-grade.effect"
)
list (APPEND PROJECT_PRIVATE_SOURCE
"source/filters/filter-color-grade.hpp"
2021-03-22 21:14:19 +00:00
"source/filters/filter-color-grade.cpp"
2020-03-16 19:37:31 +00:00
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_COLOR_GRADE
)
2021-02-02 21:54:25 +00:00
set(REQUIRE_LUT ON)
2020-03-16 19:37:31 +00:00
endif()
2020-12-14 16:47:13 +00:00
# Filter/Displacement
is_feature_enabled(FILTER_DISPLACEMENT T_CHECK)
if(T_CHECK)
2020-03-16 19:37:31 +00:00
list(APPEND PROJECT_DATA
"data/effects/displace.effect"
)
list (APPEND PROJECT_PRIVATE_SOURCE
"source/filters/filter-displacement.hpp"
"source/filters/filter-displacement.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_DISPLACEMENT
)
endif()
2020-12-14 16:47:13 +00:00
# Filter/Dynamic Mask
is_feature_enabled(FILTER_DYNAMIC_MASK T_CHECK)
if(T_CHECK)
2020-03-16 19:37:31 +00:00
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()
2020-12-14 16:47:13 +00:00
# Filter/NVIDIA Face Tracking
is_feature_enabled(FILTER_NVIDIA_FACE_TRACKING T_CHECK)
if(T_CHECK)
2020-03-25 17:31:22 +00:00
list(APPEND PROJECT_PRIVATE_SOURCE
"source/filters/filter-nv-face-tracking.hpp"
"source/filters/filter-nv-face-tracking.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_NVIDIA_FACE_TRACKING
)
endif()
2020-12-14 16:47:13 +00:00
# Filter/SDF Effects
is_feature_enabled(FILTER_SDF_EFFECTS T_CHECK)
if(T_CHECK)
2020-03-16 19:37:31 +00:00
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()
2020-12-14 16:47:13 +00:00
# Filter/Shader
is_feature_enabled(FILTER_SHADER T_CHECK)
if(T_CHECK)
set(REQUIRE_PART_SHADER ON)
2020-03-16 19:37:31 +00:00
list(APPEND PROJECT_PRIVATE_SOURCE
2020-03-28 17:54:56 +00:00
"source/filters/filter-shader.hpp"
"source/filters/filter-shader.cpp"
2020-03-16 19:37:31 +00:00
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_SHADER
)
endif()
2020-12-14 16:47:13 +00:00
# Filter/Transform
2021-02-14 11:58:32 +00:00
is_feature_enabled(FILTER_TRANSFORM T_CHECK)
2020-12-14 16:47:13 +00:00
if(T_CHECK)
2020-03-16 19:37:31 +00:00
list(APPEND PROJECT_PRIVATE_SOURCE
"source/filters/filter-transform.hpp"
"source/filters/filter-transform.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_FILTER_TRANSFORM
)
endif()
2020-12-14 16:47:13 +00:00
# Source/Mirror
is_feature_enabled(SOURCE_MIRROR T_CHECK)
if(T_CHECK)
2020-03-16 19:37:31 +00:00
list(APPEND PROJECT_PRIVATE_SOURCE
"source/sources/source-mirror.hpp"
"source/sources/source-mirror.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_SOURCE_MIRROR
)
endif()
2020-12-14 16:47:13 +00:00
# Source/Shader
is_feature_enabled(SOURCE_SHADER T_CHECK)
if(T_CHECK)
set(REQUIRE_PART_SHADER ON)
2020-03-16 19:37:31 +00:00
list(APPEND PROJECT_PRIVATE_SOURCE
"source/sources/source-shader.hpp"
"source/sources/source-shader.cpp"
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_SOURCE_SHADER
)
endif()
2020-12-14 16:47:13 +00:00
# Transition/Shader
is_feature_enabled(TRANSITION_SHADER T_CHECK)
if(T_CHECK)
set(REQUIRE_PART_SHADER ON)
2020-03-16 19:37:31 +00:00
list(APPEND PROJECT_PRIVATE_SOURCE
2020-03-28 17:38:45 +00:00
"source/transitions/transition-shader.hpp"
"source/transitions/transition-shader.cpp"
2020-03-16 19:37:31 +00:00
)
list(APPEND PROJECT_DEFINITIONS
ENABLE_TRANSITION_SHADER
)
endif()
2020-12-14 16:47:13 +00:00
# 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)
2020-09-28 19:08:07 +00:00
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"
)
list(APPEND PROJECT_INCLUDE_DIRS
"source/ui"
)
2020-04-25 23:04:04 +00:00
list(APPEND PROJECT_DEFINITIONS
2020-09-28 19:08:07 +00:00
ENABLE_FRONTEND
2020-04-25 23:04:04 +00:00
)
2021-03-22 21:14:19 +00:00
2020-12-14 16:47:13 +00:00
is_feature_enabled(UPDATER T_CHECK)
if(T_CHECK)
2020-09-28 19:08:07 +00:00
list(APPEND PROJECT_UI_SOURCE
"source/ui/ui-updater.hpp"
"source/ui/ui-updater.cpp"
)
list(APPEND PROJECT_UI
"ui/updater.ui"
)
endif()
2020-04-25 23:04:04 +00:00
endif()
2020-12-14 16:47:13 +00:00
################################################################################
# Parts
################################################################################
# Shaders
if(REQUIRE_PART_SHADER)
2020-03-16 19:37:31 +00:00
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()
2020-01-13 00:52:30 +00:00
2021-02-02 21:25:06 +00:00
# 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()
2020-12-14 16:47:13 +00:00
# Windows
if(D_PLATFORM_WINDOWS)
list(APPEND PROJECT_PRIVATE_SOURCE
"source/windll.cpp"
2020-09-28 19:08:07 +00:00
)
2020-12-14 16:47:13 +00:00
list(APPEND PROJECT_LIBRARIES
2020-03-20 22:39:21 +00:00
Delayimp.lib
)
2020-12-14 16:47:13 +00:00
# Disable/Enable a ton of things.
list(APPEND PROJECT_DEFINITIONS
# Microsoft Visual C++
2020-09-28 19:08:07 +00:00
_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
2018-09-25 23:17:08 +00:00
)
2018-12-23 19:49:18 +00:00
endif()
2018-09-25 23:17:08 +00:00
2020-12-14 16:47:13 +00:00
# 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()
################################################################################
# Register Library
################################################################################
# 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}
)
# 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})
# Prevent unwanted files from being built as source.
set_source_files_properties(${PROJECT_DATA} ${PROJECT_TEMPLATES} ${PROJECT_UI} PROPERTIES
HEADER_FILE_ONLY ON
)
# Prevent non-UI files from being Qt'd
if(HAVE_QT)
set_source_files_properties(${PROJECT_DATA} ${PROJECT_TEMPLATES} ${PROJECT_PRIVATE_GENERATED} ${PROJECT_PRIVATE_SOURCE} PROPERTIES
SKIP_AUTOGEN ON
SKIP_AUTOMOC ON
SKIP_AUTORCC ON
SKIP_AUTOUIC ON
)
endif()
# Register the library
add_library(${PROJECT_NAME} MODULE ${PROJECT_FILES}) # We are a module for libOBS.
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_INCLUDE_DIRS})
target_compile_definitions(${PROJECT_NAME} PRIVATE ${PROJECT_DEFINITIONS})
target_link_libraries(${PROJECT_NAME} ${PROJECT_LIBRARIES})
# Set C++ Standard and Extensions
2020-09-28 19:08:07 +00:00
set_target_properties(${PROJECT_NAME} PROPERTIES
2020-12-14 16:47:13 +00:00
CXX_STANDARD 17
2020-09-28 19:08:07 +00:00
CXX_STANDARD_REQUIRED ON
2020-12-14 16:47:13 +00:00
CXX_EXTENSIONS OFF
)
# Remove prefix on other platforms.
set_target_properties(${PROJECT_NAME} PROPERTIES
PREFIX ""
IMPORT_PREFIX ""
2019-04-19 05:15:18 +00:00
)
2020-12-14 16:47:13 +00:00
# Set file version (on anything but MacOS)
if(NOT D_PLATFORM_MAC)
2020-09-28 19:08:07 +00:00
set_target_properties(${PROJECT_NAME} PROPERTIES
2018-09-25 23:17:08 +00:00
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK}
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK}
)
2018-12-23 19:49:18 +00:00
endif()
2018-09-25 23:17:08 +00:00
2020-12-14 16:47:13 +00:00
# Delay-Loading on Microsoft Visual C++
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()
# Enable Qt if needed
if(HAVE_QT)
2020-09-28 19:08:07 +00:00
set_target_properties(${PROJECT_NAME} PROPERTIES
2020-12-14 16:47:13 +00:00
AUTOUIC ON
2020-04-05 08:33:35 +00:00
AUTOUIC_SEARCH_PATHS "${PROJECT_SOURCE_DIR};${PROJECT_SOURCE_DIR}/ui"
2020-12-14 16:47:13 +00:00
AUTOMOC ON
AUTORCC ON
2020-06-11 20:35:44 +00:00
AUTOGEN_BUILD_DIR "${PROJECT_BINARY_DIR}/generated"
2020-04-05 08:33:35 +00:00
)
endif()
2021-02-19 09:59:24 +00:00
# MacOS: Disable automatic Code Signing in Xcode
if(D_PLATFORM_MAC)
set_target_properties(${PROJECT_NAME} PROPERTIES
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO"
)
endif()
2020-12-14 16:47:13 +00:00
################################################################################
# Extra Tools
################################################################################
# Clang
is_feature_enabled(CLANG T_CHECK)
if(T_CHECK AND HAVE_CLANG)
2020-04-18 14:23:08 +00:00
generate_compile_commands_json(
TARGETS ${PROJECT_NAME}
)
clang_tidy(
2020-09-28 19:08:07 +00:00
TARGETS ${PROJECT_NAME}
2020-04-18 14:23:08 +00:00
VERSION 9.0.0
)
2020-04-05 08:33:35 +00:00
clang_format(
TARGETS ${PROJECT_NAME}
DEPENDENCY
VERSION 9.0.0
)
endif()
2021-02-18 19:44:54 +00:00
# Apple otool
if(D_PLATFORM_MAC)
# OBS
2021-03-22 21:14:19 +00:00
mac_get_linker_id(TARGET libobs OUTPUT T_OBS_LINK)
2021-02-18 19:44:54 +00:00
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
2021-03-22 21:14:19 +00:00
COMMAND install_name_tool ARGS -change "${T_OBS_LINK}" "@executable_path/../Frameworks/libobs.0.dylib" $<TARGET_FILE:${PROJECT_NAME}>
2021-02-18 19:44:54 +00:00
)
message(STATUS "${LOGPREFIX} Added post-build step for adjusting libobs linking path.")
# OBS Front-End API
2021-03-22 21:14:19 +00:00
if(REQUIRE_OBSFE AND HAVE_OBSFE)
mac_get_linker_id(TARGET obs-frontend-api OUTPUT T_OBSFE_LINK)
2021-02-18 19:44:54 +00:00
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
2021-03-22 21:14:19 +00:00
COMMAND install_name_tool ARGS -change "${T_OBSFE_LINK}" "@executable_path/../Frameworks/libobs-frontend-api.dylib" $<TARGET_FILE:${PROJECT_NAME}>
2021-02-18 19:44:54 +00:00
)
message(STATUS "${LOGPREFIX} Added post-build step for adjusting libobs-frontend-api linking path.")
endif()
# Qt5
if(REQUIRE_QT AND HAVE_QT)
2021-03-22 21:14:19 +00:00
# Figure out the linker location for Qt5::Core
mac_get_linker_id(TARGET Qt5::Core OUTPUT T_QT5CORE_LINK)
# Figure out the linker location for Qt5::Gui
mac_get_linker_id(TARGET Qt5::Gui OUTPUT T_QT5GUI_LINK)
# Figure out the linker location for Qt5::Widsgets
mac_get_linker_id(TARGET Qt5::Widgets OUTPUT T_QT5WIDGETS_LINK)
2021-02-18 19:44:54 +00:00
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
# - QtCore
2021-03-22 21:14:19 +00:00
COMMAND install_name_tool ARGS -change "${T_QT5CORE_LINK}" "@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore" $<TARGET_FILE:${PROJECT_NAME}>
2021-02-18 19:44:54 +00:00
# - QtGui
2021-03-22 21:14:19 +00:00
COMMAND install_name_tool ARGS -change "${T_QT5GUI_LINK}" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $<TARGET_FILE:${PROJECT_NAME}>
2021-02-18 19:44:54 +00:00
# - QtWidgets
2021-03-22 21:14:19 +00:00
COMMAND install_name_tool ARGS -change "${T_QT5WIDGETS_LINK}" "@executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets" $<TARGET_FILE:${PROJECT_NAME}>
2021-02-18 19:44:54 +00:00
)
2021-03-22 21:14:19 +00:00
message(STATUS "${LOGPREFIX} Added post-build step for adjusting Qt5::Core linking path (Found: ${Qt5_DIR} resolved to ${T_QT5CORE_LINK}).")
message(STATUS "${LOGPREFIX} Added post-build step for adjusting Qt5::Gui linking path (Found: ${Qt5_DIR} resolved to ${T_QT5GUI_LINK}).")
message(STATUS "${LOGPREFIX} Added post-build step for adjusting Qt5::Widgets linking path (Found: ${Qt5_DIR} resolved to ${T_QT5WIDGETS_LINK}).")
2021-02-18 19:44:54 +00:00
endif()
endif()
2017-06-28 21:21:42 +00:00
################################################################################
2018-09-25 23:17:08 +00:00
# Installation
2017-06-28 21:21:42 +00:00
################################################################################
2020-09-28 19:08:07 +00:00
if(${PREFIX}OBS_NATIVE)
2020-12-14 16:47:13 +00:00
# Grouped builds don't offer standalone services.
2018-09-25 23:17:08 +00:00
install_obs_plugin_with_data(${PROJECT_NAME} data)
2018-12-23 19:49:18 +00:00
else()
2021-01-31 21:05:23 +00:00
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()
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()
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)
install(
TARGETS ${PROJECT_NAME}
2021-02-21 03:04:10 +00:00
RUNTIME DESTINATION "${PROJECT_NAME}/bin/" COMPONENT StreamFX
LIBRARY DESTINATION "${PROJECT_NAME}/bin/" COMPONENT StreamFX
2021-01-31 21:05:23 +00:00
PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
)
install(
DIRECTORY "data/"
2021-02-21 03:04:10 +00:00
DESTINATION "${PROJECT_NAME}/data/"
2021-01-31 21:05:23 +00:00
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()
################################################################################
# Packaging
################################################################################
if(NOT ${PREFIX}OBS_NATIVE)
# Packaging
if(NOT PACKAGE_SUFFIX)
set(_PACKAGE_SUFFIX_OVERRIDE "${VERSION_STRING}")
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)
2021-03-15 05:48:24 +00:00
2021-03-28 05:44:16 +00:00
get_filename_component(ISS_PACKAGE_DIR "${PACKAGE_PREFIX}" ABSOLUTE)
2021-01-31 21:05:23 +00:00
file(TO_NATIVE_PATH "${ISS_PACKAGE_DIR}" ISS_PACKAGE_DIR)
2021-03-15 05:48:24 +00:00
2021-01-31 21:05:23 +00:00
get_filename_component(ISS_SOURCE_DIR "${PROJECT_SOURCE_DIR}" ABSOLUTE)
file(TO_NATIVE_PATH "${ISS_SOURCE_DIR}" ISS_SOURCE_DIR)
2021-03-15 05:48:24 +00:00
2021-01-31 21:05:23 +00:00
get_filename_component(ISS_MSVCHELPER_PATH "${msvc-redist-helper_BUILD_DIR}" ABSOLUTE)
file(TO_NATIVE_PATH "${ISS_MSVCHELPER_PATH}" ISS_MSVCHELPER_PATH)
2021-03-15 05:48:24 +00:00
2021-01-31 21:05:23 +00:00
configure_file(
"templates/installer.iss.in"
2021-03-15 05:48:24 +00:00
"installer.iss"
)
endif()
# Apple MacOS
if(D_PLATFORM_MAC)
# .pkg Installer
configure_file(
"templates/installer.pkgproj.in"
"installer.pkgproj"
@ONLY
2021-01-31 21:05:23 +00:00
)
endif()
endif()
2018-12-23 19:49:18 +00:00
endif()