mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-10 22:05:06 +00:00
cmake: Add support for OBS Frontend API and Qt UI
This commit is contained in:
parent
cd5acd42f4
commit
57dcdcd393
2 changed files with 97 additions and 26 deletions
3
.github/workflows/main.yml
vendored
3
.github/workflows/main.yml
vendored
|
@ -97,6 +97,9 @@ jobs:
|
||||||
libavutil-dev \
|
libavutil-dev \
|
||||||
libswresample-dev \
|
libswresample-dev \
|
||||||
libswscale-dev \
|
libswscale-dev \
|
||||||
|
qtbase5-dev \
|
||||||
|
libqt5x11extras5-dev \
|
||||||
|
libqt5svg5-dev \
|
||||||
libgl1-mesa-dev \
|
libgl1-mesa-dev \
|
||||||
pkg-config
|
pkg-config
|
||||||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc }} 800 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.gcc }}
|
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc }} 800 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.gcc }}
|
||||||
|
|
120
CMakeLists.txt
120
CMakeLists.txt
|
@ -167,6 +167,11 @@ mark_as_advanced(FORCE OBS_NATIVE OBS_PACKAGE OBS_REFERENCE OBS_DOWNLOAD)
|
||||||
if(TARGET libobs)
|
if(TARGET libobs)
|
||||||
message(STATUS "${PROJECT_NAME}: Using native obs-studio.")
|
message(STATUS "${PROJECT_NAME}: Using native obs-studio.")
|
||||||
CacheSet(${PropertyPrefix}OBS_NATIVE TRUE)
|
CacheSet(${PropertyPrefix}OBS_NATIVE TRUE)
|
||||||
|
if (TARGET obs-frontend-api)
|
||||||
|
CacheSet(${PropertyPrefix}_ENABLE_UI TRUE)
|
||||||
|
else()
|
||||||
|
CacheSet(${PropertyPrefix}_ENABLE_UI FALSE)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
message(STATUS "${PROJECT_NAME}: Using packaged or remote obs-studio.")
|
message(STATUS "${PROJECT_NAME}: Using packaged or remote obs-studio.")
|
||||||
CacheSet(${PropertyPrefix}OBS_NATIVE FALSE)
|
CacheSet(${PropertyPrefix}OBS_NATIVE FALSE)
|
||||||
|
@ -290,27 +295,31 @@ endif()
|
||||||
if(${PropertyPrefix}OBS_DOWNLOAD)
|
if(${PropertyPrefix}OBS_DOWNLOAD)
|
||||||
include("DownloadProject")
|
include("DownloadProject")
|
||||||
|
|
||||||
set(OBS_DOWNLOAD_VERSION "25.0.3")
|
set(OBS_DOWNLOAD_VERSION "25.0.3-fe-ci")
|
||||||
set(OBS_DEPENDENCIES_VERSION "25.0.0")
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
# Windows
|
# Windows
|
||||||
|
set(OBS_DEPENDENCIES_VERSION "25.0.0")
|
||||||
|
set(OBS_QT_VERSION "5.10.1")
|
||||||
|
|
||||||
download_project(
|
download_project(
|
||||||
PROJ libobs
|
PROJ libobs
|
||||||
URL https://github.com/Xaymar/obs-studio/releases/download/${OBS_DOWNLOAD_VERSION}-ci/obs-studio-${ARCH}-0.0.0.0-vs2019.7z
|
URL https://github.com/Xaymar/obs-studio/releases/download/${OBS_DOWNLOAD_VERSION}/obs-studio-${ARCH}-0.0.0.0-vs2019.7z
|
||||||
UPDATE_DISCONNECTED 1
|
UPDATE_DISCONNECTED 1
|
||||||
)
|
)
|
||||||
|
|
||||||
download_project(
|
download_project(
|
||||||
PROJ obsdeps
|
PROJ obsdeps
|
||||||
URL https://cdn.xaymar.com/obs/dependencies_${OBS_DEPENDENCIES_VERSION}.zip
|
URL https://cdn.xaymar.com/obs/dependencies_${OBS_DEPENDENCIES_VERSION}.7z
|
||||||
UPDATE_DISCONNECTED 1
|
UPDATE_DISCONNECTED 1
|
||||||
)
|
)
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
# Unix, Linux
|
# Unix, Linux
|
||||||
download_project(
|
download_project(
|
||||||
PROJ libobs
|
PROJ libobs
|
||||||
URL https://github.com/Xaymar/obs-studio/releases/download/${OBS_DOWNLOAD_VERSION}-ci/obs-studio-${ARCH}-0.0.0.0-ubuntu1804.7z
|
URL https://github.com/Xaymar/obs-studio/releases/download/${OBS_DOWNLOAD_VERSION}/obs-studio-${ARCH}-0.0.0.0-ubuntu1804.7z
|
||||||
UPDATE_DISCONNECTED 1
|
UPDATE_DISCONNECTED 1
|
||||||
)
|
)
|
||||||
|
|
||||||
# Dependencies must be installed like normal OBS Studio
|
# Dependencies must be installed like normal OBS Studio
|
||||||
message("Linux builds require your install the necessary development packages, take a look at the obs-studio build guide for them.")
|
message("Linux builds require your install the necessary development packages, take a look at the obs-studio build guide for them.")
|
||||||
else()
|
else()
|
||||||
|
@ -322,16 +331,47 @@ endif()
|
||||||
# Load OBS Studio & Dependencies
|
# Load OBS Studio & Dependencies
|
||||||
if(${PropertyPrefix}OBS_PACKAGE)
|
if(${PropertyPrefix}OBS_PACKAGE)
|
||||||
include("${OBS_STUDIO_DIR}/cmake/LibObs/LibObsConfig.cmake")
|
include("${OBS_STUDIO_DIR}/cmake/LibObs/LibObsConfig.cmake")
|
||||||
|
if (EXISTS "${OBS_STUDIO_DIR}/cmake/obs-frontend-api/obs-frontend-apiConfig.cmake")
|
||||||
|
include("${OBS_STUDIO_DIR}/cmake/obs-frontend-api/obs-frontend-apiConfig.cmake")
|
||||||
|
set(HAVE_OBS_FRONTEND TRUE)
|
||||||
|
endif()
|
||||||
elseif(${PropertyPrefix}OBS_REFERENCE)
|
elseif(${PropertyPrefix}OBS_REFERENCE)
|
||||||
set(obsPath "${OBS_STUDIO_DIR}")
|
set(obsPath "${OBS_STUDIO_DIR}")
|
||||||
include("${OBS_STUDIO_DIR}/cmake/external/FindLibobs.cmake")
|
include("${OBS_STUDIO_DIR}/cmake/external/FindLibobs.cmake")
|
||||||
elseif(${PropertyPrefix}OBS_DOWNLOAD)
|
elseif(${PropertyPrefix}OBS_DOWNLOAD)
|
||||||
|
set(_INCLUDE_PREFIX "")
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
include("${libobs_SOURCE_DIR}/cmake/LibObs/LibObsConfig.cmake")
|
set(_INCLUDE_PREFIX "${libobs_SOURCE_DIR}/cmake")
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
include("${libobs_SOURCE_DIR}/usr/local/lib/cmake/LibObs/LibObsConfig.cmake")
|
set(_INCLUDE_PREFIX "${libobs_SOURCE_DIR}/usr/local/lib/cmake")
|
||||||
else()
|
else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
include("${_INCLUDE_PREFIX}/LibObs/LibObsConfig.cmake")
|
||||||
|
if (EXISTS "${_INCLUDE_PREFIX}/obs-frontend-api/obs-frontend-apiConfig.cmake")
|
||||||
|
include("${_INCLUDE_PREFIX}/obs-frontend-api/obs-frontend-apiConfig.cmake")
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
download_project(
|
||||||
|
PROJ qt
|
||||||
|
URL https://cdn.xaymar.com/obs/qt_${OBS_QT_VERSION}.7z
|
||||||
|
UPDATE_DISCONNECTED 1
|
||||||
|
)
|
||||||
|
|
||||||
|
set(Qt5_DIR "${qt_SOURCE_DIR}" CACHE STRING "Path to Qt5")
|
||||||
|
if("${BITS}" STREQUAL "32")
|
||||||
|
CacheSet(Qt5_DIR "${qt_SOURCE_DIR}/msvc2017/lib/cmake/Qt5/")
|
||||||
|
else()
|
||||||
|
CacheSet(Qt5_DIR "${qt_SOURCE_DIR}/msvc2017_64/lib/cmake/Qt5/")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
set(HAVE_OBS_FRONTEND TRUE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# QT5
|
||||||
|
if(HAVE_OBS_FRONTEND)
|
||||||
|
find_package(Qt5 COMPONENTS Core Widgets REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -342,10 +382,12 @@ set(PROJECT_DATA_EFFECTS )
|
||||||
set(PROJECT_DATA_SHADERS )
|
set(PROJECT_DATA_SHADERS )
|
||||||
set(PROJECT_LIBRARIES )
|
set(PROJECT_LIBRARIES )
|
||||||
set(PROJECT_LIBRARIES_DELAYED )
|
set(PROJECT_LIBRARIES_DELAYED )
|
||||||
|
set(PROJECT_INCLUDE_DIRS )
|
||||||
set(PROJECT_TEMPLATES )
|
set(PROJECT_TEMPLATES )
|
||||||
set(PROJECT_PUBLIC )
|
set(PROJECT_PUBLIC )
|
||||||
set(PROJECT_PRIVATE_GENERATED )
|
set(PROJECT_PRIVATE_GENERATED )
|
||||||
set(PROJECT_PRIVATE_SOURCE )
|
set(PROJECT_PRIVATE_SOURCE )
|
||||||
|
set(PROJECT_UI )
|
||||||
set(PROJECT_DEFINES )
|
set(PROJECT_DEFINES )
|
||||||
|
|
||||||
## OBS Studio
|
## OBS Studio
|
||||||
|
@ -449,6 +491,20 @@ list(APPEND PROJECT_PRIVATE_GENERATED
|
||||||
"${PROJECT_BINARY_DIR}/source/version.hpp"
|
"${PROJECT_BINARY_DIR}/source/version.hpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
## OBS Studio - Frontend/Qt
|
||||||
|
if(HAVE_OBS_FRONTEND)
|
||||||
|
list(APPEND PROJECT_UI
|
||||||
|
)
|
||||||
|
list(APPEND PROJECT_PRIVATE_SOURCE
|
||||||
|
)
|
||||||
|
list(APPEND PROJECT_INCLUDE_DIRS
|
||||||
|
"ui"
|
||||||
|
)
|
||||||
|
list(APPEND PROJECT_DEFINITIONS
|
||||||
|
ENABLE_FRONTEND
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
## Feature - FFmpeg Encoder
|
## Feature - FFmpeg Encoder
|
||||||
if(${PropertyPrefix}ENABLE_ENCODER_FFMPEG)
|
if(${PropertyPrefix}ENABLE_ENCODER_FFMPEG)
|
||||||
if(NOT ${PropertyPrefix}OBS_NATIVE)
|
if(NOT ${PropertyPrefix}OBS_NATIVE)
|
||||||
|
@ -738,26 +794,20 @@ if(REQUIRE_SHADER_CODE)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Combine it all
|
||||||
set(PROJECT_PRIVATE
|
set(PROJECT_PRIVATE
|
||||||
${PROJECT_DATA}
|
${PROJECT_DATA}
|
||||||
${PROJECT_PRIVATE_GENERATED}
|
${PROJECT_PRIVATE_GENERATED}
|
||||||
${PROJECT_PRIVATE_SOURCE}
|
${PROJECT_PRIVATE_SOURCE}
|
||||||
|
${PROJECT_UI}
|
||||||
${PROJECT_TEMPLATES}
|
${PROJECT_TEMPLATES}
|
||||||
)
|
)
|
||||||
|
|
||||||
source_group(TREE "${PROJECT_SOURCE_DIR}/data" PREFIX "Data Files" FILES ${PROJECT_DATA})
|
source_group(TREE "${PROJECT_SOURCE_DIR}/data" PREFIX "Data Files" FILES ${PROJECT_DATA})
|
||||||
|
source_group(TREE "${PROJECT_SOURCE_DIR}/source" PREFIX "Code Files" FILES ${PROJECT_PRIVATE_SOURCE})
|
||||||
source_group(TREE "${PROJECT_BINARY_DIR}/source" PREFIX "Generated Files" FILES ${PROJECT_PRIVATE_GENERATED})
|
source_group(TREE "${PROJECT_BINARY_DIR}/source" PREFIX "Generated Files" FILES ${PROJECT_PRIVATE_GENERATED})
|
||||||
source_group(TREE "${PROJECT_SOURCE_DIR}/cmake" PREFIX "Template Files" FILES ${PROJECT_TEMPLATES})
|
source_group(TREE "${PROJECT_SOURCE_DIR}/cmake" PREFIX "Template Files" FILES ${PROJECT_TEMPLATES})
|
||||||
|
source_group(TREE "${PROJECT_SOURCE_DIR}/ui" PREFIX "User Interface Files" FILES ${PROJECT_UI})
|
||||||
# Filter Sources
|
|
||||||
set(_TMP_SOURCE ${PROJECT_PRIVATE_SOURCE})
|
|
||||||
list(FILTER _TMP_SOURCE INCLUDE REGEX "\.(c|cpp)$")
|
|
||||||
source_group(TREE "${PROJECT_SOURCE_DIR}/source" PREFIX "Source Files" FILES ${_TMP_SOURCE})
|
|
||||||
|
|
||||||
# Filter Headers
|
|
||||||
set(_TMP_HEADER ${PROJECT_PRIVATE_SOURCE})
|
|
||||||
list(FILTER _TMP_HEADER INCLUDE REGEX "\.(h|hpp)$")
|
|
||||||
source_group(TREE "${PROJECT_SOURCE_DIR}/source" PREFIX "Header Files" FILES ${_TMP_HEADER})
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Target
|
# Target
|
||||||
|
@ -774,15 +824,6 @@ set_target_properties(${PROJECT_NAME}
|
||||||
IMPORT_PREFIX ""
|
IMPORT_PREFIX ""
|
||||||
)
|
)
|
||||||
|
|
||||||
# Clang-Format
|
|
||||||
if(HAVE_CLANG)
|
|
||||||
clang_format(
|
|
||||||
TARGETS ${PROJECT_NAME}
|
|
||||||
DEPENDENCY
|
|
||||||
VERSION 9.0.0
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Include Directories
|
# Include Directories
|
||||||
target_include_directories(${PROJECT_NAME}
|
target_include_directories(${PROJECT_NAME}
|
||||||
PUBLIC
|
PUBLIC
|
||||||
|
@ -890,6 +931,33 @@ else()
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# UI
|
||||||
|
if(HAVE_OBS_FRONTEND)
|
||||||
|
target_link_libraries(${PROJECT_NAME}
|
||||||
|
obs-frontend-api
|
||||||
|
Qt5::Core
|
||||||
|
Qt5::Widgets
|
||||||
|
)
|
||||||
|
set_target_properties(
|
||||||
|
${PROJECT_NAME}
|
||||||
|
PROPERTIES
|
||||||
|
AUTOUIC TRUE
|
||||||
|
AUTOUIC_SEARCH_PATHS "${PROJECT_SOURCE_DIR};${PROJECT_SOURCE_DIR}/ui"
|
||||||
|
AUTOMOC TRUE
|
||||||
|
AUTOGEN_BUILD_DIR "${PROJECT_BINARY_DIR}/source"
|
||||||
|
AUTORCC TRUE
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Clang-Format
|
||||||
|
if(HAVE_CLANG)
|
||||||
|
clang_format(
|
||||||
|
TARGETS ${PROJECT_NAME}
|
||||||
|
DEPENDENCY
|
||||||
|
VERSION 9.0.0
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Installation
|
# Installation
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
Loading…
Reference in a new issue