cmake: Refactor component and dependency system

A complete redesign of the component and dependency system is necessary in order to support additional platforms, such as MacOS and other Linux platforms. Additionally it results in a much cleaner code base, which is less confusing overall.

Eventually it might be necessary to push components of StreamFX into their own CMake projects, as it is getting kind of complex now. Especially with the push for a proper plugin manager, things get dicey for big plugins like StreamFX.
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2020-12-14 17:47:13 +01:00
parent b8ff72d6c8
commit 5ac894c59c
4 changed files with 818 additions and 761 deletions

File diff suppressed because it is too large Load diff

View file

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

View file

@ -24,15 +24,24 @@
#include <sstream>
#include "codecs/hevc.hpp"
#include "ffmpeg/tools.hpp"
#include "handlers/amf_h264_handler.hpp"
#include "handlers/amf_hevc_handler.hpp"
#include "handlers/debug_handler.hpp"
#include "handlers/nvenc_h264_handler.hpp"
#include "handlers/nvenc_hevc_handler.hpp"
#include "handlers/prores_aw_handler.hpp"
#include "obs/gs/gs-helper.hpp"
#include "plugin.hpp"
#ifdef ENABLE_ENCODER_FFMPEG_AMF
#include "handlers/amf_h264_handler.hpp"
#include "handlers/amf_hevc_handler.hpp"
#endif
#ifdef ENABLE_ENCODER_FFMPEG_NVENC
#include "handlers/nvenc_h264_handler.hpp"
#include "handlers/nvenc_hevc_handler.hpp"
#endif
#ifdef ENABLE_ENCODER_FFMPEG_PRORES
#include "handlers/prores_aw_handler.hpp"
#endif
extern "C" {
#pragma warning(push)
#pragma warning(disable : 4244)
@ -1114,11 +1123,17 @@ ffmpeg_manager::ffmpeg_manager() : _factories(), _handlers(), _debug_handler()
{
// Handlers
_debug_handler = ::std::make_shared<handler::debug_handler>();
register_handler("prores_aw", ::std::make_shared<handler::prores_aw_handler>());
register_handler("h264_nvenc", ::std::make_shared<handler::nvenc_h264_handler>());
register_handler("hevc_nvenc", ::std::make_shared<handler::nvenc_hevc_handler>());
#ifdef ENABLE_ENCODER_FFMPEG_AMF
register_handler("h264_amf", ::std::make_shared<handler::amf_h264_handler>());
register_handler("hevc_amf", ::std::make_shared<handler::amf_hevc_handler>());
#endif
#ifdef ENABLE_ENCODER_FFMPEG_NVENC
register_handler("h264_nvenc", ::std::make_shared<handler::nvenc_h264_handler>());
register_handler("hevc_nvenc", ::std::make_shared<handler::nvenc_hevc_handler>());
#endif
#ifdef ENABLE_ENCODER_FFMPEG_PRORES
register_handler("prores_aw", ::std::make_shared<handler::prores_aw_handler>());
#endif
}
ffmpeg_manager::~ffmpeg_manager()

View file

@ -20,13 +20,23 @@
// Platform Information
#define D_PLATFORM "@CMAKE_SYSTEM_NAME@"
#define D_PLATFORM_OS "@D_PLATFORM_OS@"
#cmakedefine D_PLATFORM_WINDOWS
#cmakedefine D_PLATFORM_LINUX
#cmakedefine D_PLATFORM_MAC
#cmakedefine D_PLATFORM_UNKNOWN
#define D_PLATFORM_BITS @BITS@
#if D_PLATFORM_BITS == 64
#define D_PLATFORM_64BIT
// Instruction Set
#define D_PLATFORM_INSTR "@D_PLATFORM_INSTR@"
#cmakedefine D_PLATFORM_INSTR_X86
#cmakedefine D_PLATFORM_INSTR_ARM
#cmakedefine D_PLATFORM_INSTR_ITANIUM
// Bitness
#define D_PLATFORM_BITS @D_PLATFORM_BITS@
#define D_PLATFORM_BITS_PTR @D_PLATFORM_BITS_PTR@
#if D_PLATFORM_BITS == 32
#define D_PLATFORM_32BIT
#else
#define D_PLATFORM_32BIT
#define D_PLATFORM_64BIT
#endif