mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Merge pull request #10 from c3r1c3/out-of-tree-builds
Out of tree builds
This commit is contained in:
commit
b7058f97a9
98
.gitignore
vendored
Normal file
98
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
# Prerequisites #
|
||||
#################
|
||||
*.d
|
||||
|
||||
# Object files #
|
||||
################
|
||||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
*.slo
|
||||
*.lo
|
||||
*.obj
|
||||
|
||||
# Linker output #
|
||||
#################
|
||||
*.ilk
|
||||
*.map
|
||||
*.exp
|
||||
|
||||
# Precompiled Headers #
|
||||
#######################
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries #
|
||||
#############
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
*.lai
|
||||
|
||||
# Shared objects (inc. Windows DLLs) #
|
||||
######################################
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables #
|
||||
###############
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
# Debug files #
|
||||
###############
|
||||
*.dSYM/
|
||||
*.su
|
||||
*.idb
|
||||
*.pdb
|
||||
|
||||
# CMake temp files #
|
||||
####################
|
||||
CMakeLists.txt.user
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
Testing
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake_install
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
*.directory
|
||||
|
||||
# backup text files generated by an editor #
|
||||
############################################
|
||||
**/*~
|
||||
|
||||
# Various IDE Files #
|
||||
#####################
|
||||
.classpath
|
||||
.project
|
||||
.settings
|
||||
.idea
|
||||
.metadata
|
||||
*.iml
|
||||
*.ipr
|
||||
*.sublime*
|
||||
|
||||
# Directories #
|
||||
###############
|
||||
build/
|
||||
220
CMakeLists.txt
220
CMakeLists.txt
|
|
@ -1,78 +1,142 @@
|
|||
project(advanced-scene-switcher)
|
||||
|
||||
if(APPLE)
|
||||
find_library(COCOA Cocoa)
|
||||
include_directories(${COCOA})
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(X11 REQUIRED)
|
||||
link_libraries(${X11_LIBRARIES})
|
||||
include_directories(${X11_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
set(advanced-scene-switcher_HEADERS
|
||||
${advanced-scene-switcher_HEADERS}
|
||||
advanced-scene-switcher.hpp
|
||||
switcher-data-structs.hpp
|
||||
utility.hpp
|
||||
)
|
||||
set(advanced-scene-switcher_SOURCES
|
||||
${advanced-scene-switcher_SOURCES}
|
||||
advanced-scene-switcher.cpp
|
||||
advanced-scene-switcher-module.c
|
||||
scene-transitions.cpp
|
||||
screen-region-switch.cpp
|
||||
priority.cpp
|
||||
executable-switch.cpp
|
||||
idle-switch.cpp
|
||||
scene-round-trip.cpp
|
||||
file-switch.cpp
|
||||
window-title-switch.cpp
|
||||
hotkey.cpp
|
||||
general.cpp
|
||||
pause-switch.cpp
|
||||
random.cpp
|
||||
)
|
||||
set(advanced-scene-switcher_UI
|
||||
${advanced-scene-switcher_UI}
|
||||
forms/advanced-scene-switcher.ui
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
set(advanced-scene-switcher_PLATFORM_SOURCES
|
||||
advanced-scene-switcher-win.cpp)
|
||||
|
||||
elseif(APPLE)
|
||||
set(advanced-scene-switcher_PLATFORM_SOURCES
|
||||
advanced-scene-switcher-osx.mm)
|
||||
set_source_files_properties(advanced-scene-switcher-osx.mm
|
||||
PROPERTIES COMPILE_FLAGS "-fobjc-arc")
|
||||
|
||||
set(advanced-scene-switcher_PLATFORM_LIBS
|
||||
${COCOA})
|
||||
else()
|
||||
set(advanced-scene-switcher_PLATFORM_SOURCES
|
||||
advanced-scene-switcher-nix.cpp)
|
||||
set(advanced-scene-switcher_PLATFORM_LIBS
|
||||
Xss)
|
||||
endif()
|
||||
|
||||
qt5_wrap_ui(advanced-scene-switcher_UI_HEADERS
|
||||
${advanced-scene-switcher_UI}
|
||||
${advanced-scene-switcher_PLATFORM_UI})
|
||||
|
||||
add_library(advanced-scene-switcher MODULE
|
||||
${advanced-scene-switcher_HEADERS}
|
||||
${advanced-scene-switcher_SOURCES}
|
||||
${advanced-scene-switcher_UI_HEADERS}
|
||||
${advanced-scene-switcher_PLATFORM_SOURCES}
|
||||
${advanced-scene-switcher_PLATFORM_HEADERS}
|
||||
)
|
||||
target_link_libraries(advanced-scene-switcher
|
||||
${advanced-scene-switcher_PLATFORM_LIBS}
|
||||
obs-frontend-api
|
||||
Qt5::Widgets
|
||||
libobs)
|
||||
|
||||
install_obs_plugin(advanced-scene-switcher data)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(advanced-scene-switcher)
|
||||
|
||||
set(CMAKE_PREFIX_PATH "${QTDIR}")
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/external")
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
|
||||
include(external/FindLibObs.cmake)
|
||||
find_package(LibObs REQUIRED)
|
||||
find_package(Qt5Core REQUIRED)
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
find_path(LIBOBS_FRONTEND_INCLUDE_DIR HINTS ${LIBOBS_INCLUDE_DIRS})
|
||||
find_file(LIBOBS_FRONTEND_API_LIB NAMES libobs-frontend-api.* HINTS ${LIBOBS_LIB} )
|
||||
|
||||
if(APPLE)
|
||||
find_library(COCOA Cocoa)
|
||||
find_package(Qt5MacExtras REQUIRED)
|
||||
include_directories(${COCOA})
|
||||
add_link_options("-v")
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(X11 REQUIRED)
|
||||
link_libraries(${X11_LIBRARIES})
|
||||
include_directories(${X11_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
set(advanced-scene-switcher_HEADERS
|
||||
${advanced-scene-switcher_HEADERS}
|
||||
src/headers/advanced-scene-switcher.hpp
|
||||
src/headers/switcher-data-structs.hpp
|
||||
src/headers/utility.hpp
|
||||
)
|
||||
|
||||
set(advanced-scene-switcher_SOURCES
|
||||
${advanced-scene-switcher_SOURCES}
|
||||
src/advanced-scene-switcher.cpp
|
||||
src/advanced-scene-switcher-module.c
|
||||
src/scene-transitions.cpp
|
||||
src/screen-region-switch.cpp
|
||||
src/priority.cpp
|
||||
src/executable-switch.cpp
|
||||
src/idle-switch.cpp
|
||||
src/scene-round-trip.cpp
|
||||
src/file-switch.cpp
|
||||
src/window-title-switch.cpp
|
||||
src/hotkey.cpp
|
||||
src/general.cpp
|
||||
src/pause-switch.cpp
|
||||
src/random.cpp
|
||||
)
|
||||
|
||||
set(advanced-scene-switcher_UI
|
||||
${advanced-scene-switcher_UI}
|
||||
forms/advanced-scene-switcher.ui
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
set(advanced-scene-switcher_PLATFORM_SOURCES
|
||||
src/win/advanced-scene-switcher-win.cpp)
|
||||
|
||||
elseif(APPLE)
|
||||
set(advanced-scene-switcher_PLATFORM_SOURCES
|
||||
src/osx/advanced-scene-switcher-osx.mm)
|
||||
set_source_files_properties(advanced-scene-switcher-osx.mm
|
||||
PROPERTIES COMPILE_FLAGS "-fobjc-arc")
|
||||
set(advanced-scene-switcher_PLATFORM_LIBS
|
||||
${COCOA})
|
||||
|
||||
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
set(advanced-scene-switcher_PLATFORM_SOURCES
|
||||
src/linux/advanced-scene-switcher-nix.cpp)
|
||||
set(advanced-scene-switcher_PLATFORM_LIBS
|
||||
Xss)
|
||||
endif()
|
||||
|
||||
add_library(advanced-scene-switcher MODULE
|
||||
${advanced-scene-switcher_HEADERS}
|
||||
${advanced-scene-switcher_SOURCES}
|
||||
${advanced-scene-switcher_UI_HEADERS}
|
||||
${advanced-scene-switcher_PLATFORM_SOURCES}
|
||||
${advanced-scene-switcher_PLATFORM_HEADERS}
|
||||
)
|
||||
|
||||
include_directories(
|
||||
"${LIBOBS_INCLUDE_DIRS}"
|
||||
"${LIBOBS_FRONTEND_INCLUDE_DIR}"
|
||||
${Qt5Core_INCLUDES}
|
||||
${Qt5Widgets_INCLUDES})
|
||||
|
||||
target_link_libraries(advanced-scene-switcher
|
||||
${advanced-scene-switcher_PLATFORM_LIBS}
|
||||
${LIBOBS_LIB}
|
||||
${LIBOBS_FRONTEND_API_LIB}
|
||||
Qt5::Core
|
||||
Qt5::Widgets)
|
||||
|
||||
# Additional commands to install the module in the correct place.
|
||||
# Find all the translation files so we can copy them to the correct
|
||||
# place later on.
|
||||
file(GLOB ASS_TRANSLATION_FILES
|
||||
"data/locale/*.ini"
|
||||
)
|
||||
|
||||
# Windows
|
||||
if(WIN32)
|
||||
string(REGEX REPLACE "/RTC(su|[1su])" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
message("${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
|
||||
find_package(w32-pthreads REQUIRED)
|
||||
|
||||
target_link_libraries(advanced-scene-switcher
|
||||
w32-pthreads)
|
||||
endif()
|
||||
|
||||
# OSX
|
||||
if(APPLE)
|
||||
set_target_properties(advanced-scene-switcher PROPERTIES PREFIX "")
|
||||
|
||||
endif()
|
||||
|
||||
# Linux
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(CMAKE_C_FLAGS "-Wall -Wextra -Wvla -Wno-unused-function -Werror-implicit-function-declaration -Wno-missing-braces -Wno-missing-field-initializers ${CMAKE_C_FLAGS} -std=c99 -fno-strict-aliasing")
|
||||
|
||||
if(ARCH EQUAL 64)
|
||||
set(ARCH_NAME "x86_64")
|
||||
else()
|
||||
set(ARCH_NAME "i686")
|
||||
endif()
|
||||
|
||||
set_target_properties(advanced-scene-switcher PROPERTIES PREFIX "")
|
||||
|
||||
install(TARGETS advanced-scene-switcher
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/obs-plugins)
|
||||
install(FILES ${ASS_TRANSLATION_FILES}
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/obs/obs-plugins/advanced-scene-switcher/locale")
|
||||
endif()
|
||||
|
|
|
|||
95
README.md
95
README.md
|
|
@ -4,11 +4,94 @@ An automated scene switcher for OBS Studio
|
|||
More information can be found on https://obsproject.com/forum/resources/automatic-scene-switching.395/
|
||||
|
||||
|
||||
To build it yourself follow these steps (changes / suggestions welcome):
|
||||
1. Download the OBS Studio sources.
|
||||
2. Move the sources of this plugin to the the frontend-plugins folder in the OBS sources ("obs-studio/UI/frontend-plugins/SceneSwitcher" for example).
|
||||
3. Edit the CMakeLists.txt in the frontend-plugins folder to include the SceneSwitcher sources directory by appending the line "add_subdirectory(SceneSwitcher)".
|
||||
4. Build OBS Studio and the plugin library will be located in the respective subdirectory of the rundir inside your build folder. (for example ~/obs-studio/build/rundir/RelWithDebInfo/obs-plugins/64bit/advanced-scene-switcher.so)
|
||||
## Compiling
|
||||
### Prerequisites
|
||||
You'll need CMake and a working development environment for OBS Studio installed
|
||||
on your computer. Once you've done that, do the following:
|
||||
```
|
||||
git clone https://github.com/WarmUpTill/SceneSwitcher.git
|
||||
cd SceneSwitcher
|
||||
mkdir build && cd build
|
||||
```
|
||||
|
||||
### Windows
|
||||
In cmake-gui, you'll have to set these CMake variables :
|
||||
- **LIBOBS_INCLUDE_DIR** (path) : location of the libobs subfolder in the source
|
||||
code of OBS Studio, located at [source_directory]/libobs/.
|
||||
- **LIBOBS_LIB** (filepath) : location of the obs.dll file (usually set to
|
||||
C:\Program Files\obs-studio\bin\64bit\obs.dll)
|
||||
|
||||
NOTE: The linux version of this plugin is dependent on libXScrnSaver.
|
||||
Assuming that you installed Qt via the regular Qt App way:
|
||||
- **Qt5Core_DIR** (path) : C:/Qt/5.10.1/msvc2017_64/lib/cmake/Qt5Core
|
||||
- **Qt5Gui_DIR** (path): C:/Qt/5.10.1/msvc2017_64/lib/cmake/Qt5Gui
|
||||
- **Qt5Widgets_DIR** (path) : C:/Qt/5.10.1/msvc2017_64/lib/cmake/Qt5Widgets
|
||||
|
||||
- **LIBOBS_FRONTEND_API_LIB** (filepath) : location of the libobs-frontend-api.dll
|
||||
file, usually C:/Program Files/obs-studio/bin/64bit/obs-frontend-api.dll
|
||||
(usually in the same place as LIBOBS_LIB)
|
||||
- **LIBOBS_FRONTEND_INCLUDE_DIR** (path) : location of the obs-frontend-api
|
||||
subfolder in the source code of OBS Studio, located at [source_directory]/UI/obs-frontend-api.
|
||||
|
||||
Just keep hitting configure until all the vars are filled out. Then hit generate.
|
||||
|
||||
### Linux
|
||||
Most versions of Linux you can use cmake-gui or the command line.
|
||||
|
||||
**For the command line:**
|
||||
```
|
||||
cmake -DLIBOBS_INCLUDE_DIR="<path to the libobs/ sub-folder in obs-studio's source code>"
|
||||
-DLIBOBS_FRONTEND_INCLUDE_DIR="<path to the UI/obs-frontend-api/ sub-folder in obs-studio's source code>"
|
||||
-DLIBOBS_FRONTEND_API_LIB="< path to the libobs-frontend-api.so file (usually in the same place as LIBOBS_LIB)>"
|
||||
-DCMAKE_INSTALL_PREFIX=/usr ..
|
||||
make -j4
|
||||
sudo make install
|
||||
```
|
||||
|
||||
For cmake-gui you'll have to set the following variables:
|
||||
- **LIBOBS_INCLUDE_DIR** (path) : location of the libobs subfolder in the source
|
||||
code of OBS Studio, located at [source_directory]/libobs/.
|
||||
- **LIBOBS_LIB** (filepath) : location of the libobs.so file (usually CMake finds
|
||||
this, but if not it'll usually be in /usr/lib/libobs.so)
|
||||
|
||||
Assuming that you installed Qt via your system package manager, it should be
|
||||
found automatically. If not, then usually you'll find it in something like:
|
||||
- **Qt5Core_DIR** (path) : /usr/lib64/cmake/Qt5Core
|
||||
- **Qt5Gui_DIR** (path): /usr/lib64/cmake/Qt5Gui
|
||||
- **Qt5Widgets_DIR** (path) : /usr/lib64/cmake/Qt5Widgets
|
||||
|
||||
- **LIBOBS_FRONTEND_API_LIB** (filepath) : location of the libobs-frontend-api.so
|
||||
file (usually in the same place as LIBOBS_LIB)
|
||||
- **LIBOBS_FRONTEND_INCLUDE_DIR** (path) : location of the obs-frontend-api
|
||||
subfolder in the source code of OBS Studio, located at
|
||||
[source_directory]/UI/obs-frontend-api.
|
||||
|
||||
Just keep hitting configure until all the vars are filled out. Then hit generate.
|
||||
|
||||
Then open a terminal in the build folder and type:
|
||||
```
|
||||
make -j4
|
||||
sudo make install
|
||||
```
|
||||
NOTE: The Linux version of this plugin is dependent on libXScrnSaver.
|
||||
|
||||
### OS X
|
||||
In cmake-gui, you'll have to set these CMake variables :
|
||||
- **LIBOBS_INCLUDE_DIR** (path) : location of the libobs subfolder in the source
|
||||
code of OBS Studio, located at [source_directory]/libobs/.
|
||||
- **LIBOBS_LIB** (filepath) : location of the libobs.0.dylib file (usually
|
||||
in /Applications/OBS.app/Contents/Resources/bin/libobs.0.dylib)
|
||||
|
||||
Assuming that you installed Qt via the regular Qt App way:
|
||||
- **Qt5Core_DIR** (path) : Usually /Applications/Qt/5.10.1/clang_64/lib/cmake/Qt5Core
|
||||
- **Qt5Widgets_DIR** (path) : Usually /Applications/Qt/5.10.1/clang_64/lib/cmake/Qt5Widgets
|
||||
- **Qt5MacExtras_DIR** (path) : Usually /Applications/Qt/5.10.1/clang_64/lib/cmake/Qt5MacExtras
|
||||
|
||||
- **LIBOBS_FRONTEND_API_LIB** (filepath) : location of the libobs-frontend-api.0.dylib
|
||||
file (usually in usually in /Applications/OBS.app/Contents/Resources/bin/libobs-frontend-api.0.dylib)
|
||||
- **LIBOBS_FRONTEND_INCLUDE_DIR** (path) : location of the obs-frontend-api subfolder
|
||||
in the source code of OBS Studio, located at [source_directory]/UI/obs-frontend-api.
|
||||
|
||||
Just keep hitting configure until all the vars are filled out. Then hit generate.
|
||||
|
||||
Open xcode (or a terminal, depending on the build type you chose), build and copy
|
||||
the advanced-scene-switcher.so file to /Applications/OBS.app/Contents/Resources/obs-plugins/
|
||||
|
|
|
|||
107
external/FindLibObs.cmake
vendored
Normal file
107
external/FindLibObs.cmake
vendored
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
# This module can be copied and used by external plugins for OBS
|
||||
#
|
||||
# Once done these will be defined:
|
||||
#
|
||||
# LIBOBS_FOUND
|
||||
# LIBOBS_INCLUDE_DIRS
|
||||
# LIBOBS_LIBRARIES
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_OBS QUIET obs libobs)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_lib_suffix 64)
|
||||
else()
|
||||
set(_lib_suffix 32)
|
||||
endif()
|
||||
|
||||
if(DEFINED CMAKE_BUILD_TYPE)
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(_build_type_base "debug")
|
||||
else()
|
||||
set(_build_type_base "release")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_path(LIBOBS_INCLUDE_DIR
|
||||
NAMES obs.h
|
||||
HINTS
|
||||
ENV obsPath${_lib_suffix}
|
||||
ENV obsPath
|
||||
${obsPath}
|
||||
PATHS
|
||||
/usr/include /usr/local/include /opt/local/include /sw/include
|
||||
PATH_SUFFIXES
|
||||
libobs
|
||||
)
|
||||
|
||||
function(find_obs_lib base_name repo_build_path lib_name)
|
||||
string(TOUPPER "${base_name}" base_name_u)
|
||||
|
||||
if(DEFINED _build_type_base)
|
||||
set(_build_type_${repo_build_path} "${_build_type_base}/${repo_build_path}")
|
||||
set(_build_type_${repo_build_path}${_lib_suffix} "${_build_type_base}${_lib_suffix}/${repo_build_path}")
|
||||
endif()
|
||||
|
||||
find_library(${base_name_u}_LIB
|
||||
NAMES ${_${base_name_u}_LIBRARIES} ${lib_name} lib${lib_name}
|
||||
HINTS
|
||||
ENV obsPath${_lib_suffix}
|
||||
ENV obsPath
|
||||
${obsPath}
|
||||
${_${base_name_u}_LIBRARY_DIRS}
|
||||
PATHS
|
||||
/usr/lib /usr/local/lib /opt/local/lib /sw/lib
|
||||
PATH_SUFFIXES
|
||||
lib${_lib_suffix} lib
|
||||
libs${_lib_suffix} libs
|
||||
bin${_lib_suffix} bin
|
||||
../lib${_lib_suffix} ../lib
|
||||
../libs${_lib_suffix} ../libs
|
||||
../bin${_lib_suffix} ../bin
|
||||
# base repo non-msvc-specific search paths
|
||||
${_build_type_${repo_build_path}}
|
||||
${_build_type_${repo_build_path}${_lib_suffix}}
|
||||
build/${repo_build_path}
|
||||
build${_lib_suffix}/${repo_build_path}
|
||||
# base repo msvc-specific search paths on windows
|
||||
build${_lib_suffix}/${repo_build_path}/Debug
|
||||
build${_lib_suffix}/${repo_build_path}/RelWithDebInfo
|
||||
build/${repo_build_path}/Debug
|
||||
build/${repo_build_path}/RelWithDebInfo
|
||||
)
|
||||
endfunction()
|
||||
|
||||
find_obs_lib(LIBOBS libobs obs)
|
||||
|
||||
if(MSVC)
|
||||
find_obs_lib(W32_PTHREADS deps/w32-pthreads w32-pthreads)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libobs DEFAULT_MSG LIBOBS_LIB LIBOBS_INCLUDE_DIR)
|
||||
mark_as_advanced(LIBOBS_INCLUDE_DIR LIBOBS_LIB)
|
||||
|
||||
if(LIBOBS_FOUND)
|
||||
if(MSVC)
|
||||
if (NOT DEFINED W32_PTHREADS_LIB)
|
||||
message(FATAL_ERROR "Could not find the w32-pthreads library" )
|
||||
endif()
|
||||
|
||||
set(W32_PTHREADS_INCLUDE_DIR ${LIBOBS_INCLUDE_DIR}/../deps/w32-pthreads)
|
||||
endif()
|
||||
|
||||
set(LIBOBS_INCLUDE_DIRS ${LIBOBS_INCLUDE_DIR} ${W32_PTHREADS_INCLUDE_DIR})
|
||||
set(LIBOBS_LIBRARIES ${LIBOBS_LIB} ${W32_PTHREADS_LIB})
|
||||
include(${LIBOBS_INCLUDE_DIR}/../cmake/external/ObsPluginHelpers.cmake)
|
||||
|
||||
# allows external plugins to easily use/share common dependencies that are often included with libobs (such as FFmpeg)
|
||||
if(NOT DEFINED INCLUDED_LIBOBS_CMAKE_MODULES)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${LIBOBS_INCLUDE_DIR}/../cmake/Modules/")
|
||||
set(INCLUDED_LIBOBS_CMAKE_MODULES true)
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find the libobs library" )
|
||||
endif()
|
||||
163
external/ObsPluginHelpers.cmake
vendored
Normal file
163
external/ObsPluginHelpers.cmake
vendored
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
# Functions for generating external plugins
|
||||
|
||||
set(EXTERNAL_PLUGIN_OUTPUT_DIR "${CMAKE_BINARY_DIR}/rundir")
|
||||
|
||||
# Fix XCode includes to ignore warnings on system includes
|
||||
function(target_include_directories_system _target)
|
||||
if(XCODE)
|
||||
foreach(_arg ${ARGN})
|
||||
if("${_arg}" STREQUAL "PRIVATE" OR "${_arg}" STREQUAL "PUBLIC" OR "${_arg}" STREQUAL "INTERFACE")
|
||||
set(_scope ${_arg})
|
||||
else()
|
||||
target_compile_options(${_target} ${_scope} -isystem${_arg})
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
target_include_directories(${_target} SYSTEM ${_scope} ${ARGN})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(install_external_plugin_data_internal target source_dir target_dir)
|
||||
install(DIRECTORY ${source_dir}/
|
||||
DESTINATION "${target}/${target_dir}"
|
||||
USE_SOURCE_PERMISSIONS)
|
||||
add_custom_command(TARGET ${target} POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_directory
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${source_dir}" "${EXTERNAL_PLUGIN_OUTPUT_DIR}/$<CONFIGURATION>/${target}/${target_dir}"
|
||||
VERBATIM)
|
||||
endfunction()
|
||||
|
||||
# Installs data
|
||||
# 'target' is the destination target project being installed to
|
||||
# 'data_loc' specifies the directory of the data
|
||||
function(install_external_plugin_data target data_loc)
|
||||
install_external_plugin_data_internal(${target} ${data_loc} "data")
|
||||
endfunction()
|
||||
|
||||
# Installs data in an architecture-specific data directory on windows/linux (data/32bit or data/64bit). Does not apply for mac.
|
||||
# 'target' is the destination target project being installed to
|
||||
# 'data_loc' specifies the directory of the data being installed
|
||||
function(install_external_plugin_arch_data target data_loc)
|
||||
if(APPLE)
|
||||
set(_bit_suffix "")
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_bit_suffix "/64bit")
|
||||
else()
|
||||
set(_bit_suffix "/32bit")
|
||||
endif()
|
||||
|
||||
install_external_plugin_data_internal(${target} ${data_loc} "data${_bit_suffix}")
|
||||
endfunction()
|
||||
|
||||
# Installs data in the target's bin directory
|
||||
# 'target' is the destination target project being installed to
|
||||
# 'data_loc' specifies the directory of the data being installed
|
||||
function(install_external_plugin_data_to_bin target data_loc)
|
||||
if(APPLE)
|
||||
set(_bit_suffix "")
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_bit_suffix "/64bit")
|
||||
else()
|
||||
set(_bit_suffix "/32bit")
|
||||
endif()
|
||||
|
||||
install_external_plugin_data_internal(${target} ${data_loc} "bin${_bit_suffix}")
|
||||
endfunction()
|
||||
|
||||
# Installs an additional binary to a target
|
||||
# 'target' is the destination target project being installed to
|
||||
# 'additional_target' specifies the additional binary
|
||||
function(install_external_plugin_additional target additional_target)
|
||||
if(APPLE)
|
||||
set(_bit_suffix "")
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_bit_suffix "64bit/")
|
||||
else()
|
||||
set(_bit_suffix "32bit/")
|
||||
endif()
|
||||
|
||||
set_target_properties(${additional_target} PROPERTIES
|
||||
PREFIX "")
|
||||
|
||||
install(TARGETS ${additional_target}
|
||||
LIBRARY DESTINATION "bin"
|
||||
RUNTIME DESTINATION "bin")
|
||||
add_custom_command(TARGET ${additional_target} POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy
|
||||
"$<TARGET_FILE:${additional_target}>"
|
||||
"${EXTERNAL_PLUGIN_OUTPUT_DIR}/$<CONFIGURATION>/${target}/bin/${_bit_suffix}$<TARGET_FILE_NAME:${additional_target}>"
|
||||
VERBATIM)
|
||||
endfunction()
|
||||
|
||||
# Installs the binary of the target
|
||||
# 'target' is the target project being installed
|
||||
function(install_external_plugin target)
|
||||
install_external_plugin_additional(${target} ${target})
|
||||
endfunction()
|
||||
|
||||
# Installs the binary and data of the target
|
||||
# 'target' is the destination target project being installed to
|
||||
function(install_external_plugin_with_data target data_loc)
|
||||
install_external_plugin(${target})
|
||||
install_external_plugin_data(${target} ${data_loc})
|
||||
endfunction()
|
||||
|
||||
# Installs an additional binary to the data of a target
|
||||
# 'target' is the destination target project being installed to
|
||||
# 'additional_target' specifies the additional binary
|
||||
function(install_external_plugin_bin_to_data target additional_target)
|
||||
install(TARGETS ${additional_target}
|
||||
LIBRARY DESTINATION "data"
|
||||
RUNTIME DESTINATION "data")
|
||||
add_custom_command(TARGET ${additional_target} POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy
|
||||
"$<TARGET_FILE:${additional_target}>"
|
||||
"${EXTERNAL_PLUGIN_OUTPUT_DIR}/$<CONFIGURATION>/${target}/data/$<TARGET_FILE_NAME:${additional_target}>"
|
||||
VERBATIM)
|
||||
endfunction()
|
||||
|
||||
# Installs an additional binary in an architecture-specific data directory on windows/linux (data/32bit or data/64bit). Does not apply for mac.
|
||||
# 'target' is the destination target project being installed to
|
||||
# 'additional_target' specifies the additional binary
|
||||
function(install_external_plugin_bin_to_arch_data target additional_target)
|
||||
if(APPLE)
|
||||
set(_bit_suffix "")
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_bit_suffix "/64bit")
|
||||
else()
|
||||
set(_bit_suffix "/32bit")
|
||||
endif()
|
||||
|
||||
install(TARGETS ${additional_target}
|
||||
LIBRARY DESTINATION "data${_bit_suffix}"
|
||||
RUNTIME DESTINATION "data${_bit_suffix}")
|
||||
add_custom_command(TARGET ${additional_target} POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy
|
||||
"$<TARGET_FILE:${additional_target}>"
|
||||
"${EXTERNAL_PLUGIN_OUTPUT_DIR}/$<CONFIGURATION>/${target}/data${_bit_suffix}/$<TARGET_FILE_NAME:${additional_target}>"
|
||||
VERBATIM)
|
||||
endfunction()
|
||||
|
||||
# Installs an additional file in an architecture-specific data directory on windows/linux (data/32bit or data/64bit). Does not apply for mac.
|
||||
# 'target' is the destination target project being installed to
|
||||
# 'additional_target' specifies the additional binary
|
||||
function(install_external_plugin_data_file_to_arch_data target additional_target file_target)
|
||||
if(APPLE)
|
||||
set(_bit_suffix "")
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_bit_suffix "/64bit")
|
||||
else()
|
||||
set(_bit_suffix "/32bit")
|
||||
endif()
|
||||
|
||||
get_filename_component(file_target_name ${file_target} NAME)
|
||||
|
||||
install(TARGETS ${additional_target}
|
||||
LIBRARY DESTINATION "data${_bit_suffix}"
|
||||
RUNTIME DESTINATION "data${_bit_suffix}")
|
||||
add_custom_command(TARGET ${additional_target} POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy
|
||||
"${file_target}"
|
||||
"${EXTERNAL_PLUGIN_OUTPUT_DIR}/$<CONFIGURATION>/${target}/data${_bit_suffix}/${file_target_name}"
|
||||
VERBATIM)
|
||||
endfunction()
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
#include <mutex>
|
||||
#include <fstream>
|
||||
|
||||
#include "switcher-data-structs.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "headers/switcher-data-structs.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
|
||||
SwitcherData* switcher = nullptr;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
int SceneSwitcher::executableFindByData(const QString& exe)
|
||||
{
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
#include <QTextStream>
|
||||
#include <QDateTime>
|
||||
#include <obs.hpp>
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include <obs-module.h>
|
||||
|
||||
void SceneSwitcher::on_close_clicked()
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
#include <memory>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "ui_advanced-scene-switcher.h"
|
||||
#include "../../forms/ui_advanced-scene-switcher.h"
|
||||
#include "switcher-data-structs.hpp"
|
||||
|
||||
class QCloseEvent;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include <obs-module.h>
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
void startStopHotkeyFunc(void* data, obs_hotkey_id id, obs_hotkey_t* hotkey, bool pressed)
|
||||
{
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
void SwitcherData::checkIdleSwitch(bool& match, OBSWeakSource& scene, OBSWeakSource& transition)
|
||||
{
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
#undef Status
|
||||
#undef Unsorted
|
||||
#include <util/platform.h>
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "../headers/advanced-scene-switcher.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
#import <Carbon/Carbon.h>
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <util/platform.h>
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "../headers/advanced-scene-switcher.hpp"
|
||||
|
||||
|
||||
void GetWindowList(vector<string> &windows)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
void SceneSwitcher::on_pauseScenesAdd_clicked()
|
||||
{
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include <algorithm>
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
void SceneSwitcher::on_priorityUp_clicked()
|
||||
{
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
void SceneSwitcher::on_randomScenesList_currentRowChanged(int idx)
|
||||
{
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
#include <QTextStream>
|
||||
#include <obs.hpp>
|
||||
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
void SceneSwitcher::on_sceneRoundTripAdd_clicked()
|
||||
{
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
void SceneSwitcher::on_transitionsAdd_clicked()
|
||||
{
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
void SwitcherData::checkScreenRegionSwitch(bool& match, OBSWeakSource& scene, OBSWeakSource& transition)
|
||||
{
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include <windows.h>
|
||||
#include <util/platform.h>
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "../headers/advanced-scene-switcher.hpp"
|
||||
#include <TlHelp32.h>
|
||||
#include <Psapi.h>
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include <obs-module.h>
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
void SceneSwitcher::on_add_clicked()
|
||||
{
|
||||
Loading…
Reference in New Issue
Block a user