diff --git a/.cmake-format.json b/.cmake-format.json index 7e5f23697..20610be23 100644 --- a/.cmake-format.json +++ b/.cmake-format.json @@ -1,13 +1,46 @@ { - "additional_commands": { - "find_qt": { - "flags": [], - "kwargs": { - "COMPONENTS": "+", - "COMPONENTS_WIN": "+", - "COMPONENTS_MACOS": "+", - "COMPONENTS_LINUX": "+" + "format": { + "line_width": 120, + "tab_size": 2, + "enable_sort": true, + "autosort": true + }, + "additional_commands": { + "find_qt": { + "flags": [], + "kwargs": { + "COMPONENTS": "+", + "COMPONENTS_WIN": "+", + "COMPONENTS_MACOS": "+", + "COMPONENTS_LINUX": "+" + } + }, + "set_target_properties_obs": { + "pargs": 1, + "flags": [], + "kwargs": { + "PROPERTIES": { + "kwargs": { + "PREFIX": 1, + "OUTPUT_NAME": 1, + "FOLDER": 1, + "VERSION": 1, + "SOVERSION": 1, + "FRAMEWORK": 1, + "BUNDLE": 1, + "AUTOMOC": 1, + "AUTOUIC": 1, + "AUTORCC": 1, + "AUTOUIC_SEARCH_PATHS": 1, + "BUILD_RPATH": 1, + "INSTALL_RPATH": 1, + "XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC": 1, + "XCODE_ATTRIBUTE_CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION": 1, + "XCODE_ATTRIBUTE_GCC_WARN_SHADOW":1 , + "LIBRARY_OUTPUT_DIRECTORY": 1 + } } } } + } } diff --git a/.gitignore b/.gitignore index 081abe184..5ecbaf77b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,25 +3,21 @@ *.dll *.dylib *.so +*.plugin +*.framework +*.systemextension #cmake -/cmbuild/ -/build/ -/build32/ -/build64/ -/release/ -/release32/ -/release64/ -/debug/ -/debug32/ -/debug64/ -/builds/ +/build*/ +/release*/ +/debug*/ .vs/ *.o.d *.ninja .ninja* .dirstamp /cmake/.CMakeBuildNumber +.deps #xcode *.xcodeproj/ diff --git a/CMakeLists.txt b/CMakeLists.txt index ddb72ed67..909f35a12 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,44 @@ -cmake_minimum_required(VERSION 3.16...3.21) +cmake_minimum_required(VERSION 3.16...3.25) + +if(OBS_CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.0) + include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/common/bootstrap.cmake") + + project(obs-studio VERSION ${OBS_VERSION_CANONICAL}) + + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/32bit/projects.cmake") + return() + endif() + + include(compilerconfig) + include(defaults) + include(helpers) + + option(ENABLE_RELEASE_BUILD "Enable all options for a release build" OFF) + option(ENABLE_UI "Enable building with UI (requires Qt)" ON) + option(ENABLE_SCRIPTING "Enable scripting support" ON) + option(ENABLE_HEVC "Enable HEVC encoders" ON) + + add_subdirectory(libobs) + if(OS_WINDOWS) + add_subdirectory(libobs-d3d11) + add_subdirectory(libobs-winrt) + endif() + add_subdirectory(libobs-opengl) + add_subdirectory(plugins) + add_subdirectory(UI) + + message_configuration() + return() +endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules") include(VersionConfig) # Prohibit in-source builds if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") - message( - FATAL_ERROR - "OBS: You cannot build in a source directory (or any directory with " - "CMakeLists.txt file). Please make a build subdirectory. Feel free to " - "remove CMakeCache.txt and CMakeFiles.") + message(FATAL_ERROR "OBS: You cannot build in a source directory (or any directory with CMakeLists.txt file)." + "Please make a build subdirectory. Feel free to remove CMakeCache.txt and CMakeFiles.") endif() project(obs-studio VERSION ${OBS_VERSION_CANONICAL}) @@ -25,10 +54,8 @@ include(CompilerConfig) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "RelWithDebInfo" - CACHE STRING - "OBS build type [Release, RelWithDebInfo, Debug, MinSizeRel]" FORCE) - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Release RelWithDebInfo - Debug MinSizeRel) + CACHE STRING "OBS build type [Release, RelWithDebInfo, Debug, MinSizeRel]" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Release RelWithDebInfo Debug MinSizeRel) endif() # Global project options @@ -36,21 +63,15 @@ option(ENABLE_HEVC "Enable HEVC encoders" ON) if(ENABLE_HEVC) add_compile_definitions(ENABLE_HEVC) endif() -option(BUILD_FOR_DISTRIBUTION "Build for distribution (enables optimisations)" - OFF) +option(BUILD_FOR_DISTRIBUTION "Build for distribution (enables optimizations)" OFF) option(ENABLE_UI "Enable building with UI (requires Qt)" ON) option(ENABLE_SCRIPTING "Enable scripting support" ON) option(USE_LIBCXX "Use libc++ instead of libstdc++" ${APPLE}) -option( - BUILD_TESTS - "Build test directory (includes test sources and possibly a platform test executable)" - OFF) +option(BUILD_TESTS "Build test directory (includes test sources and possibly a platform test executable)" OFF) if(OS_WINDOWS) - option( - INSTALLER_RUN - "Build a multiarch installer (needs to run independently after both archs have compiled) (Windows)" - OFF) + option(INSTALLER_RUN + "Build a multiarch installer (needs to run independently after both archs have compiled) (Windows)" OFF) elseif(OS_POSIX) option(LINUX_PORTABLE "Build portable version (Linux)" OFF) diff --git a/UI/CMakeLists.txt b/UI/CMakeLists.txt index b1558c0e8..2e63ebfd5 100644 --- a/UI/CMakeLists.txt +++ b/UI/CMakeLists.txt @@ -1,524 +1,110 @@ +cmake_minimum_required(VERSION 3.16...3.25) + +legacy_check() + add_subdirectory(obs-frontend-api) option(ENABLE_UI "Enable building with UI (requires Qt)" ON) + if(NOT ENABLE_UI) - obs_status(DISABLED "OBS UI") + target_disable_feature(obs "User Interface") return() -endif() - -project(obs) - -# Legacy support -if(TARGET obs-browser - AND NOT TARGET OBS::browser-panels - AND BROWSER_PANEL_SUPPORT_ENABLED) - add_library(obs-browser-panels INTERFACE) - add_library(OBS::browser-panels ALIAS obs-browser-panels) - - target_include_directories( - obs-browser-panels INTERFACE ${CMAKE_SOURCE_DIR}/plugins/obs-browser/panel) -endif() - -set(OAUTH_BASE_URL - "https://auth.obsproject.com/" - CACHE STRING "Default OAuth base URL") - -mark_as_advanced(OAUTH_BASE_URL) - -if(NOT DEFINED TWITCH_CLIENTID - OR "${TWITCH_CLIENTID}" STREQUAL "" - OR NOT DEFINED TWITCH_HASH - OR "${TWITCH_HASH}" STREQUAL "" - OR NOT TARGET OBS::browser-panels) - set(TWITCH_ENABLED OFF) - set(TWITCH_CLIENTID "") - set(TWITCH_HASH "0") else() - set(TWITCH_ENABLED ON) + target_enable_feature(obs "User Interface") endif() -if(NOT DEFINED RESTREAM_CLIENTID - OR "${RESTREAM_CLIENTID}" STREQUAL "" - OR NOT DEFINED RESTREAM_HASH - OR "${RESTREAM_HASH}" STREQUAL "" - OR NOT TARGET OBS::browser-panels) - set(RESTREAM_ENABLED OFF) - set(RESTREAM_CLIENTID "") - set(RESTREAM_HASH "0") -else() - set(RESTREAM_ENABLED ON) -endif() - -if(NOT DEFINED YOUTUBE_CLIENTID - OR "${YOUTUBE_CLIENTID}" STREQUAL "" - OR NOT DEFINED YOUTUBE_SECRET - OR "${YOUTUBE_SECRET}" STREQUAL "" - OR NOT DEFINED YOUTUBE_CLIENTID_HASH - OR "${YOUTUBE_CLIENTID_HASH}" STREQUAL "" - OR NOT DEFINED YOUTUBE_SECRET_HASH - OR "${YOUTUBE_SECRET_HASH}" STREQUAL "") - set(YOUTUBE_ENABLED OFF) -else() - set(YOUTUBE_ENABLED ON) -endif() - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ui-config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/ui-config.h) - find_package(FFmpeg REQUIRED COMPONENTS avcodec avutil avformat) find_package(CURL REQUIRED) -add_subdirectory(frontend-plugins) -add_executable(obs) - -find_qt(COMPONENTS Widgets Network Svg Xml COMPONENTS_LINUX Gui) - -target_link_libraries(obs PRIVATE Qt::Widgets Qt::Svg Qt::Xml Qt::Network) - -set_target_properties( - obs - PROPERTIES AUTOMOC ON - AUTOUIC ON - AUTORCC ON - AUTOUIC_SEARCH_PATHS "forms;forms/source-toolbar") - -if(_QT_VERSION EQUAL 6 AND OS_WINDOWS) - set_target_properties(obs PROPERTIES AUTORCC_OPTIONS "--format-version;1") +if(NOT TARGET OBS::libff-util) + add_subdirectory("${CMAKE_SOURCE_DIR}/deps/libff" "${CMAKE_BINARY_DIR}/deps/libff") endif() -target_include_directories(obs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR}) +if(NOT TARGET OBS::json11) + add_subdirectory("${CMAKE_SOURCE_DIR}/deps/json11" "${CMAKE_BINARY_DIR}/deps/json11") +endif() -target_sources(obs PRIVATE forms/obs.qrc) -target_sources( - obs - PRIVATE forms/AutoConfigFinishPage.ui - forms/AutoConfigStartPage.ui - forms/AutoConfigStartPage.ui - forms/AutoConfigStreamPage.ui - forms/AutoConfigTestPage.ui - forms/AutoConfigVideoPage.ui - forms/ColorSelect.ui - forms/OBSAbout.ui - forms/OBSAdvAudio.ui - forms/OBSBasic.ui - forms/OBSBasicFilters.ui - forms/OBSBasicInteraction.ui - forms/OBSBasicSettings.ui - forms/OBSBasicSourceSelect.ui - forms/OBSBasicTransform.ui - forms/OBSBasicVCamConfig.ui - forms/OBSExtraBrowsers.ui - forms/OBSImporter.ui - forms/OBSLogReply.ui - forms/OBSMissingFiles.ui - forms/OBSRemux.ui - forms/OBSUpdate.ui - forms/OBSYoutubeActions.ui - forms/source-toolbar/browser-source-toolbar.ui - forms/source-toolbar/color-source-toolbar.ui - forms/source-toolbar/device-select-toolbar.ui - forms/source-toolbar/game-capture-toolbar.ui - forms/source-toolbar/image-source-toolbar.ui - forms/source-toolbar/media-controls.ui - forms/source-toolbar/text-source-toolbar.ui) +add_executable(obs-studio) +add_executable(OBS::studio ALIAS obs-studio) + +target_link_libraries( + obs-studio + PRIVATE CURL::libcurl + FFmpeg::avcodec + FFmpeg::avutil + FFmpeg::avformat + OBS::libobs + OBS::frontend-api + OBS::libff-util + OBS::json11) + +include(cmake/ui-qt.cmake) +include(cmake/ui-elements.cmake) +include(cmake/ui-windows.cmake) +include(cmake/feature-importers.cmake) +include(cmake/feature-browserpanels.cmake) + +if(NOT OAUTH_BASE_URL) + set(OAUTH_BASE_URL + "https://auth.obsproject.com/" + CACHE STRING "Default OAuth base URL") + + mark_as_advanced(OAUTH_BASE_URL) +endif() +include(cmake/feature-twitch.cmake) +include(cmake/feature-restream.cmake) +include(cmake/feature-youtube.cmake) +include(cmake/feature-whatsnew.cmake) + +add_subdirectory(frontend-plugins) + +configure_file(ui-config.h.in ui-config.h) target_sources( - obs - PRIVATE auth-oauth.cpp - auth-oauth.hpp + obs-studio + PRIVATE api-interface.cpp + auth-base.cpp + auth-base.hpp auth-listener.cpp auth-listener.hpp + auth-oauth.cpp + auth-oauth.hpp + display-helpers.hpp + multiview.cpp + multiview.hpp obf.c obf.h obs-app.cpp obs-app.hpp obs-proxy-style.cpp obs-proxy-style.hpp - api-interface.cpp - auth-base.cpp - auth-base.hpp - display-helpers.hpp platform.hpp qt-display.cpp qt-display.hpp qt-wrappers.cpp qt-wrappers.hpp + ui-config.h ui-validation.cpp - ui-validation.hpp - multiview.cpp - multiview.hpp - ${CMAKE_SOURCE_DIR}/deps/json11/json11.cpp - ${CMAKE_SOURCE_DIR}/deps/json11/json11.hpp - ${CMAKE_SOURCE_DIR}/deps/libff/libff/ff-util.c - ${CMAKE_SOURCE_DIR}/deps/libff/libff/ff-util.h - ${CMAKE_CURRENT_BINARY_DIR}/ui-config.h) - -target_sources( - obs - PRIVATE adv-audio-control.cpp - adv-audio-control.hpp - audio-encoders.cpp - audio-encoders.hpp - balance-slider.hpp - clickable-label.hpp - double-slider.cpp - double-slider.hpp - horizontal-scroll-area.cpp - horizontal-scroll-area.hpp - item-widget-helpers.cpp - item-widget-helpers.hpp - context-bar-controls.cpp - context-bar-controls.hpp - expand-checkbox.hpp - focus-list.cpp - focus-list.hpp - hotkey-edit.cpp - hotkey-edit.hpp - lineedit-autoresize.cpp - lineedit-autoresize.hpp - locked-checkbox.cpp - locked-checkbox.hpp - log-viewer.cpp - log-viewer.hpp - media-controls.cpp - media-controls.hpp - media-slider.cpp - media-slider.hpp - menu-button.cpp - menu-button.hpp - mute-checkbox.hpp - plain-text-edit.cpp - plain-text-edit.hpp - properties-view.cpp - properties-view.hpp - properties-view.moc.hpp - record-button.cpp - record-button.hpp - remote-text.cpp - remote-text.hpp - scene-tree.cpp - scene-tree.hpp - screenshot-obj.hpp - slider-absoluteset-style.cpp - slider-absoluteset-style.hpp - slider-ignorewheel.cpp - slider-ignorewheel.hpp - source-label.cpp - source-label.hpp - spinbox-ignorewheel.cpp - spinbox-ignorewheel.hpp - source-tree.cpp - source-tree.hpp - url-push-button.cpp - url-push-button.hpp - undo-stack-obs.cpp - undo-stack-obs.hpp - volume-control.cpp - volume-control.hpp - vertical-scroll-area.cpp - vertical-scroll-area.hpp - visibility-checkbox.cpp - visibility-checkbox.hpp - visibility-item-widget.cpp - visibility-item-widget.hpp) - -target_sources( - obs - PRIVATE window-basic-about.cpp - window-basic-about.hpp - window-basic-auto-config.cpp - window-basic-auto-config.hpp - window-basic-auto-config-test.cpp - window-basic-adv-audio.cpp - window-basic-adv-audio.hpp - window-basic-filters.cpp - window-basic-filters.hpp - window-basic-interaction.cpp - window-basic-interaction.hpp - window-basic-main.cpp - window-basic-main.hpp - window-basic-main-browser.cpp - window-basic-main-dropfiles.cpp - window-basic-main-icons.cpp - window-basic-main-outputs.cpp - window-basic-main-outputs.hpp - window-basic-main-profiles.cpp - window-basic-main-scene-collections.cpp - window-basic-main-screenshot.cpp - window-basic-main-transitions.cpp - window-basic-preview.cpp - window-basic-properties.cpp - window-basic-properties.hpp - window-basic-settings.cpp - window-basic-settings.hpp - window-basic-settings-a11y.cpp - window-basic-settings-stream.cpp - window-basic-source-select.cpp - window-basic-source-select.hpp - window-basic-stats.cpp - window-basic-stats.hpp - window-basic-status-bar.cpp - window-basic-status-bar.hpp - window-basic-transform.cpp - window-basic-transform.hpp - window-basic-preview.hpp - window-basic-vcam.hpp - window-basic-vcam-config.cpp - window-basic-vcam-config.hpp - window-dock.cpp - window-dock.hpp - window-importer.cpp - window-importer.hpp - window-log-reply.hpp - window-main.hpp - window-missing-files.cpp - window-missing-files.hpp - window-namedialog.cpp - window-namedialog.hpp - window-log-reply.cpp - window-projector.cpp - window-projector.hpp - window-remux.cpp - window-remux.hpp) - -target_sources( - obs - PRIVATE importers/importers.cpp importers/importers.hpp importers/classic.cpp - importers/sl.cpp importers/studio.cpp importers/xsplit.cpp) - -target_compile_features(obs PRIVATE cxx_std_17) - -target_include_directories(obs PRIVATE ${CMAKE_SOURCE_DIR}/deps/json11 - ${CMAKE_SOURCE_DIR}/deps/libff) - -target_link_libraries( - obs PRIVATE CURL::libcurl FFmpeg::avcodec FFmpeg::avutil FFmpeg::avformat - OBS::libobs OBS::frontend-api) - -set_target_properties(obs PROPERTIES FOLDER "frontend") - -if(TARGET OBS::browser-panels) - get_target_property(_PANEL_INCLUDE_DIRECTORY OBS::browser-panels - INTERFACE_INCLUDE_DIRECTORIES) - target_include_directories(obs PRIVATE ${_PANEL_INCLUDE_DIRECTORY}) - - target_compile_definitions(obs PRIVATE BROWSER_AVAILABLE) - - target_sources( - obs PRIVATE window-dock-browser.cpp window-dock-browser.hpp - window-extra-browsers.cpp window-extra-browsers.hpp) - - if(TWITCH_ENABLED) - target_sources(obs PRIVATE auth-twitch.cpp auth-twitch.hpp) - endif() - - if(RESTREAM_ENABLED) - target_sources(obs PRIVATE auth-restream.cpp auth-restream.hpp) - endif() - - if(OS_WINDOWS OR OS_MACOS) - set(ENABLE_WHATSNEW - ON - CACHE INTERNAL "Enable WhatsNew dialog") - elseif(OS_LINUX) - option(ENABLE_WHATSNEW "Enable WhatsNew dialog" ON) - endif() - - if(ENABLE_WHATSNEW) - target_compile_definitions(obs PRIVATE WHATSNEW_ENABLED) - endif() -endif() - -if(YOUTUBE_ENABLED) - target_sources( - obs - PRIVATE auth-youtube.cpp auth-youtube.hpp youtube-api-wrappers.cpp - youtube-api-wrappers.hpp window-youtube-actions.cpp - window-youtube-actions.hpp) -endif() + ui-validation.hpp) if(OS_WINDOWS) - set_target_properties(obs PROPERTIES WIN32_EXECUTABLE ON OUTPUT_NAME - "obs${_ARCH_SUFFIX}") - - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/obs.rc.in - ${CMAKE_BINARY_DIR}/obs.rc) - - find_package(Detours REQUIRED) - - target_sources( - obs - PRIVATE obs.manifest - platform-windows.cpp - win-dll-blocklist.c - update/update-window.cpp - update/update-window.hpp - update/win-update.cpp - update/win-update.hpp - update/shared-update.cpp - update/shared-update.hpp - update/update-helpers.cpp - update/update-helpers.hpp - update/crypto-helpers-mbedtls.cpp - update/crypto-helpers.hpp - ${CMAKE_BINARY_DIR}/obs.rc) - - if(_QT_VERSION EQUAL 5) - find_qt(COMPONENTS WinExtras) - target_link_libraries(obs PRIVATE Qt::WinExtras) - endif() - - find_package(MbedTLS) - target_link_libraries(obs PRIVATE Mbedtls::Mbedtls OBS::blake2 - Detours::Detours) - - target_compile_features(obs PRIVATE cxx_std_17) - - target_compile_definitions( - obs PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS - _CRT_NONSTDC_NO_WARNINGS PSAPI_VERSION=2) - - if(MSVC) - target_link_options(obs PRIVATE "LINKER:/IGNORE:4098" "LINKER:/IGNORE:4099") - target_link_libraries(obs PRIVATE OBS::w32-pthreads) - - set_source_files_properties( - ${CMAKE_CURRENT_SOURCE_DIR}../deps/libff/libff/ff-util.c - PROPERTIES COMPILE_FLAGS -Dinline=__inline) - endif() - - if(CMAKE_SIZEOF_VOID_P EQUAL 4) - target_link_options(obs PRIVATE /LARGEADDRESSAWARE) - endif() - - add_subdirectory(win-update/updater) - + include(cmake/os-windows.cmake) elseif(OS_MACOS) - set_target_properties( - obs - PROPERTIES OUTPUT_NAME ${OBS_BUNDLE_NAME} - MACOSX_BUNDLE ON - MACOSX_BUNDLE_INFO_PLIST - ${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/Info.plist.in) - - if(XCODE) - set_target_properties( - obs - PROPERTIES XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER - "${MACOSX_BUNDLE_GUI_IDENTIFIER}" - XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon - XCODE_ATTRIBUTE_PRODUCT_NAME "OBS") - - set(APP_ICON_TARGET ${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/Assets.xcassets) - - target_sources(obs PRIVATE ${APP_ICON_TARGET}) - set_source_files_properties(${APP_ICON_TARGET} - PROPERTIES MACOSX_PACKAGE_LOCATION Resources) - else() - set(APP_ICON_TARGET ${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/AppIcon.iconset) - set(APP_ICON_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/AppIcon.icns) - - add_custom_command( - OUTPUT ${APP_ICON_OUTPUT} COMMAND iconutil -c icns "${APP_ICON_TARGET}" - -o "${APP_ICON_OUTPUT}") - - set(MACOSX_BUNDLE_ICON_FILE AppIcon.icns) - target_sources(obs PRIVATE ${APP_ICON_OUTPUT} - ${CMAKE_CURRENT_SOURCE_DIR}/../AUTHORS) - - set_source_files_properties(${APP_ICON_OUTPUT} - PROPERTIES MACOSX_PACKAGE_LOCATION Resources) - endif() - - find_library(APPKIT Appkit) - find_library(AVFOUNDATION AVFoundation) - find_library(APPLICATIONSERVICES ApplicationServices) - mark_as_advanced(APPKIT AVFOUNDATION APPLICATIONSERVICES) - - target_link_libraries(obs PRIVATE ${APPKIT} ${AVFOUNDATION} - ${APPLICATIONSERVICES}) - - target_sources(obs PRIVATE platform-osx.mm) - target_sources(obs PRIVATE forms/OBSPermissions.ui window-permissions.cpp - window-permissions.hpp) - - if(ENABLE_WHATSNEW) - find_library(SECURITY Security) - mark_as_advanced(SECURITY) - target_link_libraries(obs PRIVATE ${SECURITY} OBS::blake2) - - target_sources( - obs - PRIVATE update/crypto-helpers.hpp update/crypto-helpers-mac.mm - update/shared-update.cpp update/shared-update.hpp - update/update-helpers.cpp update/update-helpers.hpp) - - if(SPARKLE_APPCAST_URL AND SPARKLE_PUBLIC_KEY) - find_library(SPARKLE Sparkle) - mark_as_advanced(SPARKLE) - - target_sources(obs PRIVATE update/mac-update.cpp update/mac-update.hpp - update/sparkle-updater.mm) - target_compile_definitions(obs PRIVATE ENABLE_SPARKLE_UPDATER) - target_link_libraries(obs PRIVATE ${SPARKLE}) - # Enable Automatic Reference Counting for Sparkle wrapper - set_source_files_properties(update/sparkle-updater.mm - PROPERTIES COMPILE_FLAGS -fobjc-arc) - endif() - endif() - - set_source_files_properties(platform-osx.mm PROPERTIES COMPILE_FLAGS - -fobjc-arc) - -elseif(OS_POSIX) - target_sources(obs PRIVATE platform-x11.cpp) - target_link_libraries(obs PRIVATE Qt::GuiPrivate) - - if(TARGET obspython) - find_package(Python REQUIRED COMPONENTS Interpreter Development) - target_link_libraries(obs PRIVATE Python::Python) - target_link_options(obs PRIVATE "LINKER:-no-as-needed") - endif() - - if(NOT LINUX_PORTABLE) - add_subdirectory(xdg-data) - endif() - - if(OS_FREEBSD) - target_link_libraries(obs PRIVATE procstat) - endif() - - if(OS_LINUX AND ENABLE_WHATSNEW) - find_package(MbedTLS) - if(NOT MBEDTLS_FOUND) - obs_status( - FATAL_ERROR - "mbedTLS not found, but required for WhatsNew support on Linux") - endif() - - target_sources( - obs - PRIVATE update/crypto-helpers.hpp update/crypto-helpers-mbedtls.cpp - update/shared-update.cpp update/shared-update.hpp - update/update-helpers.cpp update/update-helpers.hpp) - target_link_libraries(obs PRIVATE Mbedtls::Mbedtls OBS::blake2) - endif() + include(cmake/os-macos.cmake) +elseif(OS_LINUX) + include(cmake/os-linux.cmake) +elseif(OS_FREEBSD) + include(cmake/os-freebsd.cmake) endif() -get_target_property(_SOURCES obs SOURCES) -set(_UI ${_SOURCES}) -list(FILTER _UI INCLUDE REGEX ".*\\.ui?") +foreach(graphics_library IN ITEMS opengl metal d3d11) + string(TOUPPER ${graphics_library} graphics_library_U) + if(TARGET OBS::libobs-${graphics_library}) + target_compile_definitions(obs-studio + PRIVATE DL_${graphics_library_U}="$") + else() + target_compile_definitions(obs-studio PRIVATE DL_${graphics_library_U}="") + endif() +endforeach() -source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}/forms" - PREFIX "UI Files" - FILES ${_UI}) -unset(_SOURCES) -unset(_UI) - -define_graphic_modules(obs) -setup_obs_app(obs) -setup_target_resources(obs obs-studio) -add_target_resource(obs ${CMAKE_CURRENT_SOURCE_DIR}/../AUTHORS - obs-studio/authors) +set_target_properties_obs(obs-studio PROPERTIES FOLDER frontend OUTPUT_NAME obs) diff --git a/UI/cmake/feature-browserpanels.cmake b/UI/cmake/feature-browserpanels.cmake new file mode 100644 index 000000000..5d5049404 --- /dev/null +++ b/UI/cmake/feature-browserpanels.cmake @@ -0,0 +1,8 @@ +if(TARGET OBS::browser-panels) + target_enable_feature(obs-studio "Browser panels" BROWSER_AVAILABLE) + + target_link_libraries(obs-studio PRIVATE OBS::browser-panels) + + target_sources(obs-studio PRIVATE window-dock-browser.cpp window-dock-browser.hpp window-extra-browsers.cpp + window-extra-browsers.hpp) +endif() diff --git a/UI/cmake/feature-importers.cmake b/UI/cmake/feature-importers.cmake new file mode 100644 index 000000000..455306c7a --- /dev/null +++ b/UI/cmake/feature-importers.cmake @@ -0,0 +1,2 @@ +target_sources(obs-studio PRIVATE importers/importers.cpp importers/importers.hpp importers/classic.cpp + importers/sl.cpp importers/studio.cpp importers/xsplit.cpp) diff --git a/UI/cmake/feature-restream.cmake b/UI/cmake/feature-restream.cmake new file mode 100644 index 000000000..d11ab1a72 --- /dev/null +++ b/UI/cmake/feature-restream.cmake @@ -0,0 +1,10 @@ +if(RESTREAM_CLIENTID + AND RESTREAM_HASH + AND TARGET OBS::browser-panels) + target_sources(obs-studio PRIVATE auth-restream.cpp auth-restream.hpp) + target_enable_feature(obs-studio "Restream API connection" RESTREAM_ENABLED) +else() + target_disable_feature(obs-studio "Restream API connection") + set(RESTREAM_CLIENTID "") + set(RESTREAM_HASH "0") +endif() diff --git a/UI/cmake/feature-sparkle.cmake b/UI/cmake/feature-sparkle.cmake new file mode 100644 index 000000000..d6a518e10 --- /dev/null +++ b/UI/cmake/feature-sparkle.cmake @@ -0,0 +1,12 @@ +if(SPARKLE_APPCAST_URL AND SPARKLE_PUBLIC_KEY) + find_library(SPARKLE Sparkle) + mark_as_advanced(SPARKLE) + + target_sources(obs-studio PRIVATE update/mac-update.cpp update/mac-update.hpp update/sparkle-updater.mm) + set_source_files_properties(update/sparkle-updater.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) + target_link_libraries(obs-studio PRIVATE ${SPARKLE}) + + target_enable_feature(obs-studio "Sparkle updater" ENABLE_SPARKLE_UPDATER) +else() + target_disable_feature(obs-studio "Sparkle updater") +endif() diff --git a/UI/cmake/feature-twitch.cmake b/UI/cmake/feature-twitch.cmake new file mode 100644 index 000000000..5a0312397 --- /dev/null +++ b/UI/cmake/feature-twitch.cmake @@ -0,0 +1,10 @@ +if(TWITCH_CLIENTID + AND TWITCH_HASH + AND TARGET OBS::browser-panels) + target_sources(obs-studio PRIVATE auth-twitch.cpp auth-twitch.hpp) + target_enable_feature(obs-studio "Twitch API connection" TWITCH_ENABLED) +else() + target_disable_feature(obs-studio "Twitch API connection") + set(TWITCH_CLIENTID "") + set(TWITCH_HASH "0") +endif() diff --git a/UI/cmake/feature-whatsnew.cmake b/UI/cmake/feature-whatsnew.cmake new file mode 100644 index 000000000..943e205cb --- /dev/null +++ b/UI/cmake/feature-whatsnew.cmake @@ -0,0 +1,29 @@ +option(ENABLE_WHATSNEW "Enable WhatsNew dialog" ON) + +if(NOT TARGET OBS::blake2) + add_subdirectory("${CMAKE_SOURCE_DIR}/deps/blake2" "${CMAKE_BINARY_DIR}/deps/blake2") +endif() + +if(ENABLE_WHATSNEW AND TARGET OBS::browser-panels) + if(OS_MACOS) + + find_library(SECURITY Security) + mark_as_advanced(SECURITY) + + target_sources(obs-studio PRIVATE update/crypto-helpers.hpp update/crypto-helpers-mac.mm update/shared-update.cpp + update/shared-update.hpp update/update-helpers.cpp update/update-helpers.hpp) + + target_link_libraries(obs-studio PRIVATE ${SECURITY} OBS::blake2) + + include(cmake/feature-sparkle.cmake) + elseif(OS_LINUX) + find_package(MbedTLS REQUIRED) + target_link_libraries(obs-studio PRIVATE MbedTLS::MbedTLS OBS::blake2) + + target_sources( + obs-studio PRIVATE update/crypto-helpers.hpp update/crypto-helpers-mbedtls.cpp update/shared-update.cpp + update/shared-update.hpp update/update-helpers.cpp update/update-helpers.hpp) + endif() + + target_enable_feature(obs-studio "What's New panel" WHATSNEW_ENABLED) +endif() diff --git a/UI/cmake/feature-youtube.cmake b/UI/cmake/feature-youtube.cmake new file mode 100644 index 000000000..1fbdd0f74 --- /dev/null +++ b/UI/cmake/feature-youtube.cmake @@ -0,0 +1,13 @@ +if(YOUTUBE_CLIENTID + AND YOUTUBE_SECRET + AND YOUTUBE_CLIENTID_HASH + AND YOUTUBE_SECRET_HASH) + target_sources(obs-studio PRIVATE auth-youtube.cpp auth-youtube.hpp youtube-api-wrappers.cpp youtube-api-wrappers.hpp + window-youtube-actions.cpp window-youtube-actions.hpp) + + target_enable_feature(obs-studio "YouTube API connection" YOUTUBE_ENABLED) +else() + target_disable_feature(obs-studio "YouTube API connection") + set(YOUTUBE_SECRET_HASH 0) + set(YOUTUBE_CLIENTID_HASH 0) +endif() diff --git a/UI/cmake/legacy.cmake b/UI/cmake/legacy.cmake new file mode 100644 index 000000000..23b4723b6 --- /dev/null +++ b/UI/cmake/legacy.cmake @@ -0,0 +1,489 @@ +add_subdirectory(obs-frontend-api) + +option(ENABLE_UI "Enable building with UI (requires Qt)" ON) +if(NOT ENABLE_UI) + obs_status(DISABLED "OBS UI") + return() +endif() + +project(obs) + +# Legacy support +if(TARGET obs-browser + AND NOT TARGET OBS::browser-panels + AND BROWSER_PANEL_SUPPORT_ENABLED) + add_library(obs-browser-panels INTERFACE) + add_library(OBS::browser-panels ALIAS obs-browser-panels) + + target_include_directories(obs-browser-panels INTERFACE ${CMAKE_SOURCE_DIR}/plugins/obs-browser/panel) +endif() + +set(OAUTH_BASE_URL + "https://auth.obsproject.com/" + CACHE STRING "Default OAuth base URL") + +mark_as_advanced(OAUTH_BASE_URL) + +if(NOT DEFINED TWITCH_CLIENTID + OR "${TWITCH_CLIENTID}" STREQUAL "" + OR NOT DEFINED TWITCH_HASH + OR "${TWITCH_HASH}" STREQUAL "" + OR NOT TARGET OBS::browser-panels) + set(TWITCH_ENABLED OFF) + set(TWITCH_CLIENTID "") + set(TWITCH_HASH "0") +else() + set(TWITCH_ENABLED ON) +endif() + +if(NOT DEFINED RESTREAM_CLIENTID + OR "${RESTREAM_CLIENTID}" STREQUAL "" + OR NOT DEFINED RESTREAM_HASH + OR "${RESTREAM_HASH}" STREQUAL "" + OR NOT TARGET OBS::browser-panels) + set(RESTREAM_ENABLED OFF) + set(RESTREAM_CLIENTID "") + set(RESTREAM_HASH "0") +else() + set(RESTREAM_ENABLED ON) +endif() + +if(NOT DEFINED YOUTUBE_CLIENTID + OR "${YOUTUBE_CLIENTID}" STREQUAL "" + OR NOT DEFINED YOUTUBE_SECRET + OR "${YOUTUBE_SECRET}" STREQUAL "" + OR NOT DEFINED YOUTUBE_CLIENTID_HASH + OR "${YOUTUBE_CLIENTID_HASH}" STREQUAL "" + OR NOT DEFINED YOUTUBE_SECRET_HASH + OR "${YOUTUBE_SECRET_HASH}" STREQUAL "") + set(YOUTUBE_SECRET_HASH "0") + set(YOUTUBE_CLIENTID_HASH "0") + set(YOUTUBE_ENABLED OFF) +else() + set(YOUTUBE_ENABLED ON) +endif() + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ui-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/ui-config.h) + +find_package(FFmpeg REQUIRED COMPONENTS avcodec avutil avformat) +find_package(CURL REQUIRED) + +add_subdirectory(frontend-plugins) +add_executable(obs) + +find_qt(COMPONENTS Widgets Network Svg Xml COMPONENTS_LINUX Gui) + +target_link_libraries(obs PRIVATE Qt::Widgets Qt::Svg Qt::Xml Qt::Network) + +set_target_properties( + obs + PROPERTIES AUTOMOC ON + AUTOUIC ON + AUTORCC ON + AUTOUIC_SEARCH_PATHS "forms;forms/source-toolbar") + +if(_QT_VERSION EQUAL 6 AND OS_WINDOWS) + set_target_properties(obs PROPERTIES AUTORCC_OPTIONS "--format-version;1") +endif() + +target_include_directories(obs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + +target_sources(obs PRIVATE forms/obs.qrc) +target_sources( + obs + PRIVATE forms/AutoConfigFinishPage.ui + forms/AutoConfigStartPage.ui + forms/AutoConfigStartPage.ui + forms/AutoConfigStreamPage.ui + forms/AutoConfigTestPage.ui + forms/AutoConfigVideoPage.ui + forms/ColorSelect.ui + forms/OBSAbout.ui + forms/OBSAdvAudio.ui + forms/OBSBasic.ui + forms/OBSBasicFilters.ui + forms/OBSBasicInteraction.ui + forms/OBSBasicSettings.ui + forms/OBSBasicSourceSelect.ui + forms/OBSBasicTransform.ui + forms/OBSBasicVCamConfig.ui + forms/OBSExtraBrowsers.ui + forms/OBSImporter.ui + forms/OBSLogReply.ui + forms/OBSMissingFiles.ui + forms/OBSRemux.ui + forms/OBSUpdate.ui + forms/OBSYoutubeActions.ui + forms/source-toolbar/browser-source-toolbar.ui + forms/source-toolbar/color-source-toolbar.ui + forms/source-toolbar/device-select-toolbar.ui + forms/source-toolbar/game-capture-toolbar.ui + forms/source-toolbar/image-source-toolbar.ui + forms/source-toolbar/media-controls.ui + forms/source-toolbar/text-source-toolbar.ui) + +target_sources( + obs + PRIVATE auth-oauth.cpp + auth-oauth.hpp + auth-listener.cpp + auth-listener.hpp + obf.c + obf.h + obs-app.cpp + obs-app.hpp + obs-proxy-style.cpp + obs-proxy-style.hpp + api-interface.cpp + auth-base.cpp + auth-base.hpp + display-helpers.hpp + platform.hpp + qt-display.cpp + qt-display.hpp + qt-wrappers.cpp + qt-wrappers.hpp + ui-validation.cpp + ui-validation.hpp + multiview.cpp + multiview.hpp + ${CMAKE_SOURCE_DIR}/deps/json11/json11.cpp + ${CMAKE_SOURCE_DIR}/deps/json11/json11.hpp + ${CMAKE_SOURCE_DIR}/deps/libff/libff/ff-util.c + ${CMAKE_SOURCE_DIR}/deps/libff/libff/ff-util.h + ${CMAKE_CURRENT_BINARY_DIR}/ui-config.h) + +target_sources( + obs + PRIVATE adv-audio-control.cpp + adv-audio-control.hpp + audio-encoders.cpp + audio-encoders.hpp + balance-slider.hpp + clickable-label.hpp + double-slider.cpp + double-slider.hpp + horizontal-scroll-area.cpp + horizontal-scroll-area.hpp + item-widget-helpers.cpp + item-widget-helpers.hpp + context-bar-controls.cpp + context-bar-controls.hpp + expand-checkbox.hpp + focus-list.cpp + focus-list.hpp + hotkey-edit.cpp + hotkey-edit.hpp + lineedit-autoresize.cpp + lineedit-autoresize.hpp + locked-checkbox.cpp + locked-checkbox.hpp + log-viewer.cpp + log-viewer.hpp + media-controls.cpp + media-controls.hpp + media-slider.cpp + media-slider.hpp + menu-button.cpp + menu-button.hpp + mute-checkbox.hpp + plain-text-edit.cpp + plain-text-edit.hpp + properties-view.cpp + properties-view.hpp + properties-view.moc.hpp + record-button.cpp + record-button.hpp + remote-text.cpp + remote-text.hpp + scene-tree.cpp + scene-tree.hpp + screenshot-obj.hpp + slider-absoluteset-style.cpp + slider-absoluteset-style.hpp + slider-ignorewheel.cpp + slider-ignorewheel.hpp + source-label.cpp + source-label.hpp + spinbox-ignorewheel.cpp + spinbox-ignorewheel.hpp + source-tree.cpp + source-tree.hpp + url-push-button.cpp + url-push-button.hpp + undo-stack-obs.cpp + undo-stack-obs.hpp + volume-control.cpp + volume-control.hpp + vertical-scroll-area.cpp + vertical-scroll-area.hpp + visibility-checkbox.cpp + visibility-checkbox.hpp + visibility-item-widget.cpp + visibility-item-widget.hpp) + +target_sources( + obs + PRIVATE window-basic-about.cpp + window-basic-about.hpp + window-basic-auto-config.cpp + window-basic-auto-config.hpp + window-basic-auto-config-test.cpp + window-basic-adv-audio.cpp + window-basic-adv-audio.hpp + window-basic-filters.cpp + window-basic-filters.hpp + window-basic-interaction.cpp + window-basic-interaction.hpp + window-basic-main.cpp + window-basic-main.hpp + window-basic-main-browser.cpp + window-basic-main-dropfiles.cpp + window-basic-main-icons.cpp + window-basic-main-outputs.cpp + window-basic-main-outputs.hpp + window-basic-main-profiles.cpp + window-basic-main-scene-collections.cpp + window-basic-main-screenshot.cpp + window-basic-main-transitions.cpp + window-basic-preview.cpp + window-basic-properties.cpp + window-basic-properties.hpp + window-basic-settings.cpp + window-basic-settings.hpp + window-basic-settings-a11y.cpp + window-basic-settings-stream.cpp + window-basic-source-select.cpp + window-basic-source-select.hpp + window-basic-stats.cpp + window-basic-stats.hpp + window-basic-status-bar.cpp + window-basic-status-bar.hpp + window-basic-transform.cpp + window-basic-transform.hpp + window-basic-preview.hpp + window-basic-vcam.hpp + window-basic-vcam-config.cpp + window-basic-vcam-config.hpp + window-dock.cpp + window-dock.hpp + window-importer.cpp + window-importer.hpp + window-log-reply.hpp + window-main.hpp + window-missing-files.cpp + window-missing-files.hpp + window-namedialog.cpp + window-namedialog.hpp + window-log-reply.cpp + window-projector.cpp + window-projector.hpp + window-remux.cpp + window-remux.hpp) + +target_sources(obs PRIVATE importers/importers.cpp importers/importers.hpp importers/classic.cpp importers/sl.cpp + importers/studio.cpp importers/xsplit.cpp) + +target_compile_features(obs PRIVATE cxx_std_17) + +target_include_directories(obs PRIVATE ${CMAKE_SOURCE_DIR}/deps/json11 ${CMAKE_SOURCE_DIR}/deps/libff) + +target_link_libraries(obs PRIVATE CURL::libcurl FFmpeg::avcodec FFmpeg::avutil FFmpeg::avformat OBS::libobs + OBS::frontend-api) + +set_target_properties(obs PROPERTIES FOLDER "frontend") + +if(TARGET OBS::browser-panels) + get_target_property(_PANEL_INCLUDE_DIRECTORY OBS::browser-panels INTERFACE_INCLUDE_DIRECTORIES) + target_include_directories(obs PRIVATE ${_PANEL_INCLUDE_DIRECTORY}) + + target_compile_definitions(obs PRIVATE BROWSER_AVAILABLE) + + target_sources(obs PRIVATE window-dock-browser.cpp window-dock-browser.hpp window-extra-browsers.cpp + window-extra-browsers.hpp) + + if(TWITCH_ENABLED) + target_sources(obs PRIVATE auth-twitch.cpp auth-twitch.hpp) + endif() + + if(RESTREAM_ENABLED) + target_sources(obs PRIVATE auth-restream.cpp auth-restream.hpp) + endif() + + if(OS_WINDOWS OR OS_MACOS) + set(ENABLE_WHATSNEW + ON + CACHE INTERNAL "Enable WhatsNew dialog") + elseif(OS_LINUX) + option(ENABLE_WHATSNEW "Enable WhatsNew dialog" ON) + endif() + + if(ENABLE_WHATSNEW) + target_compile_definitions(obs PRIVATE WHATSNEW_ENABLED) + endif() +endif() + +if(YOUTUBE_ENABLED) + target_sources(obs PRIVATE auth-youtube.cpp auth-youtube.hpp youtube-api-wrappers.cpp youtube-api-wrappers.hpp + window-youtube-actions.cpp window-youtube-actions.hpp) +endif() + +if(OS_WINDOWS) + set_target_properties(obs PROPERTIES WIN32_EXECUTABLE ON OUTPUT_NAME "obs${_ARCH_SUFFIX}") + + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/obs.rc.in ${CMAKE_BINARY_DIR}/obs.rc) + + find_package(Detours REQUIRED) + + target_sources( + obs + PRIVATE obs.manifest + platform-windows.cpp + win-dll-blocklist.c + update/update-window.cpp + update/update-window.hpp + update/win-update.cpp + update/win-update.hpp + update/shared-update.cpp + update/shared-update.hpp + update/update-helpers.cpp + update/update-helpers.hpp + update/crypto-helpers-mbedtls.cpp + update/crypto-helpers.hpp + ${CMAKE_BINARY_DIR}/obs.rc) + + if(_QT_VERSION EQUAL 5) + find_qt(COMPONENTS WinExtras) + target_link_libraries(obs PRIVATE Qt::WinExtras) + endif() + + find_package(MbedTLS) + target_link_libraries(obs PRIVATE Mbedtls::Mbedtls OBS::blake2 Detours::Detours) + + target_compile_features(obs PRIVATE cxx_std_17) + + target_compile_definitions(obs PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS + PSAPI_VERSION=2) + + if(MSVC) + target_link_options(obs PRIVATE "LINKER:/IGNORE:4098" "LINKER:/IGNORE:4099") + target_link_libraries(obs PRIVATE OBS::w32-pthreads) + + set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}../deps/libff/libff/ff-util.c PROPERTIES COMPILE_FLAGS + -Dinline=__inline) + endif() + + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + target_link_options(obs PRIVATE /LARGEADDRESSAWARE) + endif() + + add_subdirectory(win-update/updater) + +elseif(OS_MACOS) + set_target_properties( + obs + PROPERTIES OUTPUT_NAME ${OBS_BUNDLE_NAME} + MACOSX_BUNDLE ON + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/Info.plist.in) + + if(XCODE) + set_target_properties( + obs + PROPERTIES XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${MACOSX_BUNDLE_GUI_IDENTIFIER}" + XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon + XCODE_ATTRIBUTE_PRODUCT_NAME "OBS") + + set(APP_ICON_TARGET ${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/Assets.xcassets) + + target_sources(obs PRIVATE ${APP_ICON_TARGET}) + set_source_files_properties(${APP_ICON_TARGET} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + else() + set(APP_ICON_TARGET ${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/AppIcon.iconset) + set(APP_ICON_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/AppIcon.icns) + + add_custom_command(OUTPUT ${APP_ICON_OUTPUT} COMMAND iconutil -c icns "${APP_ICON_TARGET}" -o "${APP_ICON_OUTPUT}") + + set(MACOSX_BUNDLE_ICON_FILE AppIcon.icns) + target_sources(obs PRIVATE ${APP_ICON_OUTPUT} ${CMAKE_CURRENT_SOURCE_DIR}/../AUTHORS) + + set_source_files_properties(${APP_ICON_OUTPUT} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + endif() + + find_library(APPKIT Appkit) + find_library(AVFOUNDATION AVFoundation) + find_library(APPLICATIONSERVICES ApplicationServices) + mark_as_advanced(APPKIT AVFOUNDATION APPLICATIONSERVICES) + + target_link_libraries(obs PRIVATE ${APPKIT} ${AVFOUNDATION} ${APPLICATIONSERVICES}) + + target_sources(obs PRIVATE platform-osx.mm) + target_sources(obs PRIVATE forms/OBSPermissions.ui window-permissions.cpp window-permissions.hpp) + + if(ENABLE_WHATSNEW) + find_library(SECURITY Security) + mark_as_advanced(SECURITY) + target_link_libraries(obs PRIVATE ${SECURITY} OBS::blake2) + + target_sources(obs PRIVATE update/crypto-helpers.hpp update/crypto-helpers-mac.mm update/shared-update.cpp + update/shared-update.hpp update/update-helpers.cpp update/update-helpers.hpp) + + if(SPARKLE_APPCAST_URL AND SPARKLE_PUBLIC_KEY) + find_library(SPARKLE Sparkle) + mark_as_advanced(SPARKLE) + + target_sources(obs PRIVATE update/mac-update.cpp update/mac-update.hpp update/sparkle-updater.mm) + target_compile_definitions(obs PRIVATE ENABLE_SPARKLE_UPDATER) + target_link_libraries(obs PRIVATE ${SPARKLE}) + # Enable Automatic Reference Counting for Sparkle wrapper + set_source_files_properties(update/sparkle-updater.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) + endif() + endif() + + set_source_files_properties(platform-osx.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) + +elseif(OS_POSIX) + target_sources(obs PRIVATE platform-x11.cpp) + target_link_libraries(obs PRIVATE Qt::GuiPrivate) + + target_compile_definitions(obs PRIVATE OBS_INSTALL_PREFIX="${OBS_INSTALL_PREFIX}") + if(TARGET obspython) + find_package(Python REQUIRED COMPONENTS Interpreter Development) + target_link_libraries(obs PRIVATE Python::Python) + target_link_options(obs PRIVATE "LINKER:-no-as-needed") + endif() + + if(NOT LINUX_PORTABLE) + add_subdirectory(xdg-data) + endif() + + if(OS_FREEBSD) + target_link_libraries(obs PRIVATE procstat) + endif() + + if(OS_LINUX AND ENABLE_WHATSNEW) + find_package(MbedTLS) + if(NOT MBEDTLS_FOUND) + obs_status(FATAL_ERROR "mbedTLS not found, but required for WhatsNew support on Linux") + endif() + + target_sources(obs PRIVATE update/crypto-helpers.hpp update/crypto-helpers-mbedtls.cpp update/shared-update.cpp + update/shared-update.hpp update/update-helpers.cpp update/update-helpers.hpp) + target_link_libraries(obs PRIVATE Mbedtls::Mbedtls OBS::blake2) + endif() +endif() + +get_target_property(_SOURCES obs SOURCES) +set(_UI ${_SOURCES}) +list(FILTER _UI INCLUDE REGEX ".*\\.ui?") + +source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}/forms" + PREFIX "UI Files" + FILES ${_UI}) +unset(_SOURCES) +unset(_UI) + +define_graphic_modules(obs) +setup_obs_app(obs) +setup_target_resources(obs obs-studio) +add_target_resource(obs ${CMAKE_CURRENT_SOURCE_DIR}/../AUTHORS obs-studio/authors) diff --git a/UI/cmake/linux/com.obsproject.Studio.appdata.xml.in b/UI/cmake/linux/com.obsproject.Studio.appdata.xml.in new file mode 100644 index 000000000..b11b1afa0 --- /dev/null +++ b/UI/cmake/linux/com.obsproject.Studio.appdata.xml.in @@ -0,0 +1,46 @@ + + + com.obsproject.Studio + com.obsproject.Studio.desktop + CC0-1.0 + GPL-2.0 + OBS Studio + OBS Project + Live streaming and video recording software + +

Free and open source software for video capturing, recording, and live streaming.

+

Features:

+
    +
  • High performance real time video/audio capturing and mixing. Create scenes made up of multiple sources including window captures, images, text, browser windows, webcams, capture cards and more.
  • +
  • Set up an unlimited number of scenes you can switch between seamlessly via custom transitions.
  • +
  • Intuitive audio mixer with per-source filters such as noise gate, noise suppression, and gain. Take full control with VST plugin support.
  • +
  • Powerful and easy to use configuration options. Add new Sources, duplicate existing ones, and adjust their properties effortlessly.
  • +
  • Streamlined Settings panel gives you access to a wide array of configuration options to tweak every aspect of your broadcast or recording.
  • +
  • Modular 'Dock' UI allows you to rearrange the layout exactly as you like. You can even pop out each individual Dock to its own window.
  • +
+

Create Professional Productions:

+
    +
  • Choose from a number of different and customizable transitions for when you switch between your scenes or add your own stinger video files.
  • +
  • Set hotkeys for nearly every sort of action, such as switching between scenes, starting/stopping streams or recordings, muting audio sources, push to talk, and more.
  • +
  • Studio Mode lets you preview your scenes and sources before pushing them live. Adjust your scenes and sources or create new ones and ensure they're perfect before your viewers ever see them.
  • +
  • Get a high level view of your production using the Multiview. Monitor 8 different scenes and easily cue or transition to any of them with merely a single or double click.
  • +
+
+ https://obsproject.com + https://github.com/obsproject/obs-studio/issues + https://obsproject.com/contribute + https://crowdin.com/project/obs-studio + + + https://obsproject.com/assets/images/OBSDemoApp2610.png + + + + + ModernToolkit + HiDpiIcon + + + + +
diff --git a/UI/cmake/linux/com.obsproject.Studio.desktop b/UI/cmake/linux/com.obsproject.Studio.desktop new file mode 100644 index 000000000..95b07a891 --- /dev/null +++ b/UI/cmake/linux/com.obsproject.Studio.desktop @@ -0,0 +1,97 @@ +[Desktop Entry] +Version=1.0 +Name=OBS Studio +GenericName=Streaming/Recording Software +Comment=Free and Open Source Streaming/Recording Software +Exec=obs +Icon=com.obsproject.Studio +Terminal=false +Type=Application +Categories=AudioVideo;Recorder; +StartupNotify=true +StartupWMClass=obs + +GenericName[an_ES]=Programa de retransmisión/gravación +Comment[an_ES]=Program de retransmisión/gravación libre y de codigo ubierto +GenericName[ar_SA]=برامج البث / التسجيل +Comment[ar_SA]=برنامج بث / تسجيل مجاني ومفتوح المصدر +GenericName[bn_BD]=স্ট্রিমিং/রেকর্ডিং সফটওয়্যার +Comment[bn_BD]=ফ্রি এবং মুক্ত সোর্স স্ট্রিমিং/রেকর্ডিং সফ্টওয়্যার +GenericName[ca_ES]=Programa de retransmissió/enregistrament +Comment[ca_ES]=Programa de retransmissió/enregistrament de codi lliure i gratuït +GenericName[cs_CZ]=Software pro vysílání a nahrávání +Comment[cs_CZ]=Svobodný software pro vysílání a nahrávání +GenericName[da_DK]=Streaming-/optagelsessoftware +Comment[da_DK]=Gratis og open-source streaming-/optagelsessoftware +GenericName[de_DE]=Streaming-/Aufnahme-Software +Comment[de_DE]=Freie und Open-Source-Streaming-/Aufnahme-Software +GenericName[el_GR]=Λογισμικό Ροής/Καταγραφής +Comment[el_GR]=Δωρεαν Λογισμικό Streaming/Kαταγραφή ανοιχτου κωδικα +GenericName[en_GB]=Streaming/Recording Software +Comment[en_GB]=Free and Open Source Streaming/Recording Software +GenericName[es_ES]=Disfusion digital/ Software de grabacion +Comment[es_ES]=Difusion Digital/Software de grabacion Gratis y con Fuentes Abiertas +GenericName[et_EE]=Video voogesituse ja salvestuse tarkvara +Comment[et_EE]=Tasuta ja avatud lähtekoodiga video voogesituse ja salvestuse tarkvara +GenericName[fa_IR]=نرم افزار جریان/ضبط +Comment[fa_IR]=نرم افزار منبع باز و رایگان جریان/ضبط +GenericName[fi_FI]=Striimaus-/tallennusohjelmisto +Comment[fi_FI]=Ilmainen ja avoimen lähdekoodin striimaus-/tallennusohjelmisto +GenericName[fil_PH]=Software para sa Streaming/Recording +Comment[fil_PH]=Libre at Open Source na Streaming/Recording Software +GenericName[fr_FR]=Logiciel de diffusion/enregistrement +Comment[fr_FR]=Logiciel de diffusion/enregistrement gratuit et Open Source +GenericName[gd_GB]=Bathar-bog sruthaidh/clàraidh +Comment[gd_GB]=Bathar-bog sruthaidh/clàraidh saor le bun-tùs fosgailte +GenericName[he_IL]=תוכנה לשידורים חיים והקלטה +Comment[he_IL]=תכנה חינמית בקוד פתוח לשידורים חיים ולהקלטה +GenericName[hi_IN]=स्ट्रीमिंग/रिकॉर्डिंग सॉफ्टवेयर +Comment[hi_IN]=स्वतंत्र एवं खुले स्रोत वाला स्ट्रीमिंग/रिकॉर्डिंग सॉफ्टवेयर +GenericName[hr_HR]=Softver za emitiranje/snimanje +Comment[hr_HR]=Slobodan softver otvorenog koda za emitiranje/snimanje +GenericName[hu_HU]=Közvetítő/rögzítő szoftver +Comment[hu_HU]=Szabad és nyílt forráskódú közvetítő/rögzítő szoftver +GenericName[id_ID]=Perangkat Lunak Streaming/Perekaman +Comment[id_ID]=Perangkat Lunak Streaming/Perekaman Gratis dan Sumber Terbuka +GenericName[it_IT]=Software per dirette e registrazione schermo +Comment[it_IT]=Software Libero e Open Source Streaming/Registrazione +GenericName[ja_JP]=配信/録画ソフトウェア +Comment[ja_JP]=無料のオープンソース配信/録画ソフトウェア +GenericName[ka_GE]=ვიდეოს ეთერში გამშვები/ჩამწერი პროგრამა +Comment[ka_GE]=თავისუფალი და ღია წყაროს მქონე, ვიდეოს ეთერში გამშვები/ჩამწერი პროგრამა +GenericName[kmr_TR]=Nermalava weşandin/tomarkirin-ê +Comment[kmr_TR]=Nermalava weşandin/tomarkirin-ê belaş û çavkaniya azad +GenericName[ko_KR]=방송 및 녹화 프로그램 +Comment[ko_KR]=무료 오픈소스 방송 및 녹화 프로그램 +GenericName[ms_MY]=Perisian Penstriman/Rakaman +Comment[ms_MY]=Perisian Penstriman/Rakaman Bersumber Terbuka dan Bebas +GenericName[nb_NO]=Strømming- og Opptaksprogramvare +Comment[nb_NO]=Gratis Strømming- og Opptaksprogramvare med Åpen Kildekode +GenericName[nl_NL]=Streaming/Opname Software +Comment[nl_NL]=Vrij en Open Source Streaming/Opname Sofware +GenericName[pl_PL]=Oprogramowanie do transmisji strumieniowej/nagrywania +Comment[pl_PL]=Darmowe i otwarte oprogramowanie do transmisji strumieniowej/nagrywania +GenericName[pt_BR]=Software de Streaming/Gravação +Comment[pt_BR]=Software de Streaming/Gravação de Código Aberto e Livre +GenericName[pt_PT]=Programa de transmissão/gravação +Comment[pt_PT]=Programa de transmissão/gravação livre e de código aberto +GenericName[ro_RO]=Program de Streaming/Înregistrare +Comment[ro_RO]=Program de streaming / înregistrare gratuit și open source +GenericName[ru_RU]=Программа для видеостриминга и видеозаписи +Comment[ru_RU]=Свободное и открытое ПО для видеостриминга и видеозаписи +GenericName[sk_SK]=Streamovací/Nahrávací Software +Comment[sk_SK]=Bezplatný a otvorený streamovací/nahrávací software +GenericName[sl_SI]=Pretočna/snemalna programska oprema +Comment[sl_SI]=Brezplačni in odprtokodna programska oprema za pretakanje/snemanje +GenericName[sv_SE]=Programvara för strömning/inspelning +Comment[sv_SE]=Fri programvara för strömning/inspelning med öppen källkod +GenericName[tr_TR]=Yayın/Kayıt Yazılımı +Comment[tr_TR]=Ücretsiz ve Açık Kaynaklı Yayın/Kayıt Yazılımı +GenericName[uk_UA]=Програма для трансляцій/запису +Comment[uk_UA]=Вільне та відкрите програмне забезпечення для трансляцій/запису +GenericName[vi_VN]=Phần mềm ghi hình/phát luồng +Comment[vi_VN]=Phần mềm ghi hình / phát luồng mở và miễn phí +GenericName[zh_CN]=直播/录像软件 +Comment[zh_CN]=自由且开源的用于直播串流以及视频录制的软件 +GenericName[zh_TW]=串流與錄影軟體 +Comment[zh_TW]=免費,開源的串流與錄影軟體 diff --git a/UI/cmake/linux/icons/obs-logo-128.png b/UI/cmake/linux/icons/obs-logo-128.png new file mode 100644 index 000000000..f8c688da2 Binary files /dev/null and b/UI/cmake/linux/icons/obs-logo-128.png differ diff --git a/UI/cmake/linux/icons/obs-logo-256.png b/UI/cmake/linux/icons/obs-logo-256.png new file mode 100644 index 000000000..aa445cdf6 Binary files /dev/null and b/UI/cmake/linux/icons/obs-logo-256.png differ diff --git a/UI/cmake/linux/icons/obs-logo-512.png b/UI/cmake/linux/icons/obs-logo-512.png new file mode 100644 index 000000000..a536f57a1 Binary files /dev/null and b/UI/cmake/linux/icons/obs-logo-512.png differ diff --git a/UI/cmake/linux/icons/obs-logo-scalable.svg b/UI/cmake/linux/icons/obs-logo-scalable.svg new file mode 100644 index 000000000..8fe847880 --- /dev/null +++ b/UI/cmake/linux/icons/obs-logo-scalable.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/Contents.json b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..64dc11ee7 --- /dev/null +++ b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "filename" : "icon_16x16.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "filename" : "icon_16x16@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "filename" : "icon_32x32.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "filename" : "icon_32x32@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "filename" : "icon_128x128.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "filename" : "icon_128x128@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "filename" : "icon_256x256.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "filename" : "icon_256x256@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "filename" : "icon_512x512.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "filename" : "icon_512x512@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_128x128.png b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_128x128.png new file mode 100644 index 000000000..9e3f1c345 Binary files /dev/null and b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_128x128.png differ diff --git a/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png new file mode 100644 index 000000000..029dff2d6 Binary files /dev/null and b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png differ diff --git a/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_16x16.png b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_16x16.png new file mode 100644 index 000000000..77be12380 Binary files /dev/null and b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_16x16.png differ diff --git a/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png new file mode 100644 index 000000000..97f34d8a6 Binary files /dev/null and b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png differ diff --git a/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_256x256.png b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_256x256.png new file mode 100644 index 000000000..2b264dde0 Binary files /dev/null and b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_256x256.png differ diff --git a/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png new file mode 100644 index 000000000..bbe8f7d94 Binary files /dev/null and b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png differ diff --git a/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_32x32.png b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_32x32.png new file mode 100644 index 000000000..d04efcd37 Binary files /dev/null and b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_32x32.png differ diff --git a/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png new file mode 100644 index 000000000..f542313e0 Binary files /dev/null and b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png differ diff --git a/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_512x512.png b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_512x512.png new file mode 100644 index 000000000..920f8d8dc Binary files /dev/null and b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_512x512.png differ diff --git a/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png new file mode 100644 index 000000000..8dbac08ae Binary files /dev/null and b/UI/cmake/macos/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png differ diff --git a/UI/cmake/macos/Assets.xcassets/Contents.json b/UI/cmake/macos/Assets.xcassets/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/UI/cmake/macos/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/UI/cmake/macos/Info.plist.in b/UI/cmake/macos/Info.plist.in new file mode 100644 index 000000000..f38ed5f49 --- /dev/null +++ b/UI/cmake/macos/Info.plist.in @@ -0,0 +1,44 @@ + + + + + CFBundleExecutable + OBS + CFBundleIconFile + AppIcon + CFBundleIdentifier + com.obsproject.obs-studio + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + OBS + CFBundleDisplayName + OBS Studio + CFBundlePackageType + APPL + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleSupportedPlatforms + + MacOSX + + NSHighResolutionCapable + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + LSAppNapIsDisabled + + NSCameraUsageDescription + OBS needs to access the camera to enable camera sources to work. + NSMicrophoneUsageDescription + OBS needs to access the microphone to enable audio input. + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + SUFeedURL + ${SPARKLE_APPCAST_URL} + SUPublicEDKey + ${SPARKLE_PUBLIC_KEY} + + diff --git a/UI/cmake/macos/OBSPublicDSAKey.pem b/UI/cmake/macos/OBSPublicDSAKey.pem new file mode 100644 index 000000000..91adb402f --- /dev/null +++ b/UI/cmake/macos/OBSPublicDSAKey.pem @@ -0,0 +1,36 @@ +-----BEGIN PUBLIC KEY----- +MIIGPDCCBC4GByqGSM44BAEwggQhAoICAQCZZZ2y7H2GJmMfP4KQihJTJOoiGNUw +mue6sqMbH+utRykRnSKBZux6R665eRFMpNgrgFO1TLLGbdD2U31KiGtCvFJOmOl3 ++QP055BuXjEG36NU7AWEFLAlbDlr/2D3oumq3Ib3iMnnr9RrVztJ2VFOvVio1eWr +ZxboVwKPK8D6BqsWiv15vbYlJnTC4Fls6ySmdjVBxwoPlTaMu1ysi5DfbIZ93s5u +aQt1FvXuWtPBWjyVUORcNbcWf49E5R2pV0OSBK95Hw2/wXz4vmj+w92dTePGnVaW +Me4CoF5PIeZILwp6DCLStX4eW2WG1NChJTC8zeQ/3bMMoGyKM/MadyvrDqMywsKY +caxkIwHrDKOEdXXGo80dIwZMMLipPA8DKhx5ojphfkeXjIhKSx+49knXT3ED5okE +Wai7tGUXj/8D8sGh+7b+AVsdujvr4v8WQaZiKUOZ2IIHOg3VLz9T9v0zet1Yt987 +KNymFcp2CHeJ6KnDP/ZGQ6Nl0HsPxUgscsXV+R2FEc8Q1j0Ukkuxnopa0E4/huUu +gjyRzpXD734qFMDf7LcXca6qNjBor6gVj5sRyRKCpZ+KQfMUlr8jp506ztYSyeJu +dxJV30tQgztwkbrs02CqOt4Z3Peo6sdht7hWKSPVwmja3tq8/TfUSSoo6wKYN9/w +Mf3dVeRF8hCzJQIVAJnzuzmzQhCKPiQnl3jh5qGII2XfAoICAQCCVATAff89ceHj +ROHEbHTQFpVxJ/kRZPfxnU46DSw79Tih7tthV68oakPSOTP3cx/Tga0GwogarZ9N +F2VVan5w9OQSSewXsr5UDT5bnmJF+h+JB7TMy+sXZBYobUqjlUd5VtKc8RsN86P4 +s7xbK0mA+hfe+27r18JT81/eH3xUfh7UOUGSdMN2Ch9f7RFSMZIgUAZUzu2K3ODp +hPgtc2QJ8QVAp7GLvQgw8ZUME/ChZslyBIyJvYgUIxfxlgRWYro5pQT7/ngkgdXo +wlghHKkldwMuY3zaFdhPnFNuEUEtc18ILsbz0+AnagCUd6n+3safskCRqLIHMOY6 +iLBSZPX9hJQhVCqSqz1VNDDww8FNa/fojJ1Lr/TI0I+0Ib2pCiY2LChXUqGY5SLZ +2KNs5qFsyZP+I0L8YsGwqvUYyFwk7Ok224n0NtaOwqpLCrtXd/i6DaDNiaoJuwJC +1ELCfaZivorgkC5rhBt2H7qWUAR+EtrFE/gb0k/G5EIhjYql7onGbX+G2re38vQA +fg1pzguhig2dafP/BxMLZrn1Gg61xzmEYPuS9gclktaf675srv8GVb46VkOxXL+D +YvTmpJPP7UUOVlmAMCo4j4y09MW3jq9TDp42VTLeZVubyjslGnavlnq1O+ZyXUye +1FMeby65sIbSHHHwoFnRv3hLSEXI5gOCAgYAAoICAQCUkYnZkPfHfOJZI403xUYP +CE/bLpkza074Xo6EXElsWRnpQgNTx+JFOvItgj3v0OkIqDin9UredKOwfkiftslV +jxUVKA6I5kwnGvCpvTpQMLyLjq+VQr+J2D6eId6tV/iajhdu5r4JThU8KllT7Ywb +NAur34ftLNCVAMRUaDNeEoHfePgderW384e+lbvpmtifmBluammGSxxRtUsdjvJZ +BFkhaJu86CKxcU7D1lbPVOtV/jaxz6d16VdGcfBdi2LzXZzZtYpT9XGPX3NF+xii +spAURWsoe11LTRXF+eJhgCm5iIDN3kh1HEQKYKAVpmrcM0aFzk/NpS+tFyU72vaq +IRSSJw/aa1oELOAakG5oPldc4RcYWl32sbnVwXHO7TZvgTrBSC10o65MAC5CHP/s +b07heDYAIt7re7szvOYq+c/9zAMAlu3pcO8MqaXYMmybdHBXHQ2b+DdJWHmIUWcX +CbUzr09vzGkJAvqsXqbmJPr8aixrO75DhT0iDTILLWe/GWK51nf+Tg0pNxVgGyAl +BqvRqqo7SSDu9FMkwQesFFHhuoHLyEHwVPJ+sMQTNwQcm9c6YuW8EYDRSkeKLWYk +3fkjG+Pe9uVE8a1taDg3FjSY0UqjUT6XMw+i0Lajyus2L6wFBwrrGM6E4xa6x1CC +MGjmuSOlPA1umQsToIcO4g== +-----END PUBLIC KEY----- diff --git a/UI/cmake/macos/entitlements.plist b/UI/cmake/macos/entitlements.plist new file mode 100644 index 000000000..9931d62e0 --- /dev/null +++ b/UI/cmake/macos/entitlements.plist @@ -0,0 +1,14 @@ + + + + + com.apple.security.cs.allow-unsigned-executable-memory + + com.apple.security.device.camera + + com.apple.security.device.audio-input + + com.apple.security.cs.disable-library-validation + + + diff --git a/UI/cmake/macos/qt.conf b/UI/cmake/macos/qt.conf new file mode 100644 index 000000000..64d729736 --- /dev/null +++ b/UI/cmake/macos/qt.conf @@ -0,0 +1,2 @@ +[Paths] +Plugins = PlugIns diff --git a/UI/cmake/os-freebsd.cmake b/UI/cmake/os-freebsd.cmake new file mode 100644 index 000000000..df7bdfa0d --- /dev/null +++ b/UI/cmake/os-freebsd.cmake @@ -0,0 +1,9 @@ +target_sources(obs-studio PRIVATE platform-x11.cpp) +target_compile_definitions(obs-studio PRIVATE OBS_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}") +target_link_libraries(obs-studio PRIVATE Qt::GuiPrivate procstat) + +if(TARGET OBS::python) + find_package(Python REQUIRED COMPONENTS Interpreter Development) + target_link_libraries(obs-studio PRIVATE Python::Python) + target_link_options(obs-studio PRIVATE LINKER:-no-as-needed) +endif() diff --git a/UI/cmake/os-linux.cmake b/UI/cmake/os-linux.cmake new file mode 100644 index 000000000..e674f6d8e --- /dev/null +++ b/UI/cmake/os-linux.cmake @@ -0,0 +1,50 @@ +target_sources(obs-studio PRIVATE platform-x11.cpp) +target_compile_definitions(obs-studio PRIVATE OBS_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}") +target_link_libraries(obs-studio PRIVATE Qt::GuiPrivate) + +if(TARGET OBS::python) + find_package(Python REQUIRED COMPONENTS Interpreter Development) + target_link_libraries(obs-studio PRIVATE Python::Python) + target_link_options(obs-studio PRIVATE LINKER:-no-as-needed) +endif() + +if(NOT DEFINED APPDATA_RELEASE_DATE) + if(EXISTS "${CMAKE_SOURCE_DIR}/.git") + execute_process( + COMMAND git log --tags -1 --pretty=%cd --date=short + OUTPUT_VARIABLE APPDATA_RELEASE_DATE + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_STRIP_TRAILING_WHITESPACE) + elseif(EXISTS "${CMAKE_SOURCE_DIR}/cmake/.CMakeBuildNumber") + file(TIMESTAMP "${CMAKE_SOURCE_DIR}/cmake/.CMakeBuildNumber" APPDATA_RELEASE_DATE "%Y-%m-%d") + else() + file(TIMESTAMP "${CMAKE_SOURCE_DIR}/CMakeLists.txt" APPDATA_RELEASE_DATE "%Y-%m-%d") + endif() +endif() + +configure_file(cmake/linux/com.obsproject.Studio.appdata.xml.in com.obsproject.Studio.appdata.xml) + +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/com.obsproject.Studio.appdata.xml" + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo") + +install(FILES cmake/linux/com.obsproject.Studio.desktop DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications") + +install( + FILES cmake/linux/icons/obs-logo-128.png + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps" + RENAME com.obsproject.Studio.png) + +install( + FILES cmake/linux/icons/obs-logo-256.png + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps" + RENAME com.obsproject.Studio.png) + +install( + FILES cmake/linux/icons/obs-logo-512.png + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/512x512/apps" + RENAME com.obsproject.Studio.png) + +install( + FILES cmake/linux/icons/obs-logo-scalable.svg + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps" + RENAME com.obsproject.Studio.svg) diff --git a/UI/cmake/os-macos.cmake b/UI/cmake/os-macos.cmake new file mode 100644 index 000000000..f7fa1314b --- /dev/null +++ b/UI/cmake/os-macos.cmake @@ -0,0 +1,17 @@ +if(NOT XCODE) + target_add_resource(obs-studio "${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos/Assets.xcassets") +endif() + +find_library(APPKIT Appkit) +find_library(AVFOUNDATION AVFoundation) +find_library(APPLICATIONSERVICES ApplicationServices) +mark_as_advanced(APPKIT AVFOUNDATION APPLICATIONSERVICES) + +target_sources(obs-studio PRIVATE platform-osx.mm forms/OBSPermissions.ui window-permissions.cpp window-permissions.hpp) + +set_source_files_properties(platform-osx.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) + +target_link_libraries(obs-studio PRIVATE ${APPKIT} ${AVFOUNDATION} ${APPLICATIONSERVICES}) + +target_compile_options(obs-studio PRIVATE -Wno-error=float-conversion -Wno-error=implicit-int-conversion + -Wno-error=shorten-64-to-32) diff --git a/UI/cmake/os-windows.cmake b/UI/cmake/os-windows.cmake new file mode 100644 index 000000000..381e19190 --- /dev/null +++ b/UI/cmake/os-windows.cmake @@ -0,0 +1,55 @@ +if(NOT TARGET OBS::blake2) + add_subdirectory("${CMAKE_SOURCE_DIR}/deps/blake2" "${CMAKE_BINARY_DIR}/deps/blake2") +endif() + +if(NOT TARGET OBS::w32-pthreads) + add_subdirectory("${CMAKE_SOURCE_DIR}/deps/w32-pthreads" "${CMAKE_BINARY_DIR}/deps/w32-pthreads") +endif() + +find_package(MbedTLS) +find_package(Detours REQUIRED) + +configure_file(cmake/windows/obs.rc.in obs.rc) + +target_sources( + obs-studio + PRIVATE obs.rc + platform-windows.cpp + win-dll-blocklist.c + cmake/windows/obs.manifest + update/crypto-helpers-mbedtls.cpp + update/crypto-helpers.hpp + update/shared-update.cpp + update/shared-update.hpp + update/update-helpers.cpp + update/update-helpers.hpp + update/update-window.cpp + update/update-window.hpp + update/win-update.cpp + update/win-update.hpp) + +target_link_libraries(obs-studio PRIVATE crypt32 OBS::blake2 OBS::w32-pthreads MbedTLS::MbedTLS Detours::Detours) +target_compile_options(obs-studio PRIVATE PSAPI_VERSION=2) +target_link_options(obs-studio PRIVATE /IGNORE:4098 /IGNORE:4099) + +add_library(obs-update-helpers INTERFACE EXCLUDE_FROM_ALL) +add_library(OBS::update-helpers ALIAS obs-update-helpers) + +target_sources(obs-update-helpers INTERFACE win-update/win-update-helpers.cpp win-update/win-update-helpers.hpp) +target_include_directories(obs-update-helpers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/win-update") + +add_subdirectory(win-update/updater) + +set_property( + TARGET obs-studio + APPEND + PROPERTY AUTORCC_OPTIONS --format-version 1) + +set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT obs-studio) +set_target_properties( + obs-studio + PROPERTIES + WIN32_EXECUTABLE TRUE + VS_DEBUGGER_COMMAND + "${CMAKE_BINARY_DIR}/rundir/$/$<$:bin/>$" + VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/rundir/$$<$:/bin>") diff --git a/UI/cmake/ui-elements.cmake b/UI/cmake/ui-elements.cmake new file mode 100644 index 000000000..121536899 --- /dev/null +++ b/UI/cmake/ui-elements.cmake @@ -0,0 +1,68 @@ +target_sources( + obs-studio + PRIVATE adv-audio-control.cpp + adv-audio-control.hpp + audio-encoders.cpp + audio-encoders.hpp + balance-slider.hpp + clickable-label.hpp + double-slider.cpp + double-slider.hpp + horizontal-scroll-area.cpp + horizontal-scroll-area.hpp + item-widget-helpers.cpp + item-widget-helpers.hpp + context-bar-controls.cpp + context-bar-controls.hpp + expand-checkbox.hpp + focus-list.cpp + focus-list.hpp + hotkey-edit.cpp + hotkey-edit.hpp + lineedit-autoresize.cpp + lineedit-autoresize.hpp + locked-checkbox.cpp + locked-checkbox.hpp + log-viewer.cpp + log-viewer.hpp + media-controls.cpp + media-controls.hpp + media-slider.cpp + media-slider.hpp + menu-button.cpp + menu-button.hpp + mute-checkbox.hpp + plain-text-edit.cpp + plain-text-edit.hpp + properties-view.cpp + properties-view.hpp + properties-view.moc.hpp + record-button.cpp + record-button.hpp + remote-text.cpp + remote-text.hpp + scene-tree.cpp + scene-tree.hpp + screenshot-obj.hpp + slider-absoluteset-style.cpp + slider-absoluteset-style.hpp + slider-ignorewheel.cpp + slider-ignorewheel.hpp + source-label.cpp + source-label.hpp + spinbox-ignorewheel.cpp + spinbox-ignorewheel.hpp + source-tree.cpp + source-tree.hpp + url-push-button.cpp + url-push-button.hpp + undo-stack-obs.cpp + undo-stack-obs.hpp + volume-control.cpp + volume-control.hpp + vertical-scroll-area.cpp + vertical-scroll-area.hpp + visibility-checkbox.cpp + visibility-checkbox.hpp + visibility-item-widget.cpp + visibility-item-widget.hpp) diff --git a/UI/cmake/ui-qt.cmake b/UI/cmake/ui-qt.cmake new file mode 100644 index 000000000..ddee93daf --- /dev/null +++ b/UI/cmake/ui-qt.cmake @@ -0,0 +1,56 @@ +find_qt(COMPONENTS Widgets Network Svg Xml COMPONENTS_LINUX Gui) + +target_link_libraries(obs-studio PRIVATE Qt::Widgets Qt::Svg Qt::Xml Qt::Network) + +set_target_properties( + obs-studio + PROPERTIES AUTOMOC ON + AUTOUIC ON + AUTORCC ON) + +set_property( + TARGET obs-studio + APPEND + PROPERTY AUTOUIC_SEARCH_PATHS forms forms/source-toolbar) + +set(_qt_sources + forms/obs.qrc + forms/AutoConfigFinishPage.ui + forms/AutoConfigStartPage.ui + forms/AutoConfigStartPage.ui + forms/AutoConfigStreamPage.ui + forms/AutoConfigTestPage.ui + forms/AutoConfigVideoPage.ui + forms/ColorSelect.ui + forms/OBSAbout.ui + forms/OBSAdvAudio.ui + forms/OBSBasic.ui + forms/OBSBasicFilters.ui + forms/OBSBasicInteraction.ui + forms/OBSBasicSettings.ui + forms/OBSBasicSourceSelect.ui + forms/OBSBasicTransform.ui + forms/OBSBasicVCamConfig.ui + forms/OBSExtraBrowsers.ui + forms/OBSImporter.ui + forms/OBSLogReply.ui + forms/OBSMissingFiles.ui + forms/OBSRemux.ui + forms/OBSUpdate.ui + forms/OBSYoutubeActions.ui + forms/source-toolbar/browser-source-toolbar.ui + forms/source-toolbar/color-source-toolbar.ui + forms/source-toolbar/device-select-toolbar.ui + forms/source-toolbar/game-capture-toolbar.ui + forms/source-toolbar/image-source-toolbar.ui + forms/source-toolbar/media-controls.ui + forms/source-toolbar/text-source-toolbar.ui) + +target_sources(obs-studio PRIVATE ${_qt_sources}) + +source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}/forms" + PREFIX "UI Files" + FILES ${_qt_sources}) + +unset(_qt_sources) diff --git a/UI/cmake/ui-windows.cmake b/UI/cmake/ui-windows.cmake new file mode 100644 index 000000000..9d6864de9 --- /dev/null +++ b/UI/cmake/ui-windows.cmake @@ -0,0 +1,58 @@ +target_sources( + obs-studio + PRIVATE window-basic-about.cpp + window-basic-about.hpp + window-basic-adv-audio.cpp + window-basic-adv-audio.hpp + window-basic-auto-config.cpp + window-basic-auto-config.hpp + window-basic-auto-config-test.cpp + window-basic-filters.cpp + window-basic-filters.hpp + window-basic-interaction.cpp + window-basic-interaction.hpp + window-basic-main.cpp + window-basic-main.hpp + window-basic-main-browser.cpp + window-basic-main-dropfiles.cpp + window-basic-main-icons.cpp + window-basic-main-outputs.cpp + window-basic-main-outputs.hpp + window-basic-main-profiles.cpp + window-basic-main-scene-collections.cpp + window-basic-main-screenshot.cpp + window-basic-main-transitions.cpp + window-basic-preview.cpp + window-basic-properties.cpp + window-basic-properties.hpp + window-basic-settings.cpp + window-basic-settings.hpp + window-basic-settings-a11y.cpp + window-basic-settings-stream.cpp + window-basic-source-select.cpp + window-basic-source-select.hpp + window-basic-stats.cpp + window-basic-stats.hpp + window-basic-status-bar.cpp + window-basic-status-bar.hpp + window-basic-transform.cpp + window-basic-transform.hpp + window-basic-preview.hpp + window-basic-vcam.hpp + window-basic-vcam-config.cpp + window-basic-vcam-config.hpp + window-dock.cpp + window-dock.hpp + window-importer.cpp + window-importer.hpp + window-main.hpp + window-missing-files.cpp + window-missing-files.hpp + window-namedialog.cpp + window-namedialog.hpp + window-log-reply.cpp + window-log-reply.hpp + window-projector.cpp + window-projector.hpp + window-remux.cpp + window-remux.hpp) diff --git a/UI/frontend-plugins/CMakeLists.txt b/UI/frontend-plugins/CMakeLists.txt index f6e5a2ce8..fdaf40b63 100644 --- a/UI/frontend-plugins/CMakeLists.txt +++ b/UI/frontend-plugins/CMakeLists.txt @@ -1,4 +1,4 @@ +add_subdirectory(aja-output-ui) +add_subdirectory(decklink-captions) add_subdirectory(decklink-output-ui) add_subdirectory(frontend-tools) -add_subdirectory(decklink-captions) -add_subdirectory(aja-output-ui) diff --git a/UI/frontend-plugins/aja-output-ui/CMakeLists.txt b/UI/frontend-plugins/aja-output-ui/CMakeLists.txt index 7bb1b207c..24de08c3c 100644 --- a/UI/frontend-plugins/aja-output-ui/CMakeLists.txt +++ b/UI/frontend-plugins/aja-output-ui/CMakeLists.txt @@ -1,109 +1,89 @@ -project(aja-output-ui) +cmake_minimum_required(VERSION 3.16...3.25) + +legacy_check() if(NOT ENABLE_AJA) + target_disable(aja-output-ui) return() endif() find_package(LibAJANTV2 REQUIRED) +find_qt(COMPONENTS Widgets COMPONENTS_LINUX Gui) add_library(aja-output-ui MODULE) add_library(OBS::aja-output-ui ALIAS aja-output-ui) -find_qt(COMPONENTS Widgets COMPONENTS_LINUX Gui) - -set_target_properties( - aja-output-ui - PROPERTIES AUTOMOC ON - AUTOUIC ON - AUTORCC ON - AUTOUIC_SEARCH_PATHS "forms") - -if(_QT_VERSION EQUAL 6 AND OS_WINDOWS) - set_target_properties(aja-output-ui PROPERTIES AUTORCC_OPTIONS - "--format-version;1") -endif() - -target_sources(aja-output-ui PRIVATE forms/output.ui) - target_sources( aja-output-ui PRIVATE AJAOutputUI.h AJAOutputUI.cpp aja-ui-main.cpp aja-ui-main.h - ${CMAKE_SOURCE_DIR}/plugins/aja/aja-card-manager.cpp - ${CMAKE_SOURCE_DIR}/plugins/aja/aja-card-manager.hpp - ${CMAKE_SOURCE_DIR}/plugins/aja/aja-common.cpp - ${CMAKE_SOURCE_DIR}/plugins/aja/aja-common.hpp - ${CMAKE_SOURCE_DIR}/plugins/aja/aja-enums.hpp - ${CMAKE_SOURCE_DIR}/plugins/aja/aja-presets.cpp - ${CMAKE_SOURCE_DIR}/plugins/aja/aja-presets.hpp - ${CMAKE_SOURCE_DIR}/plugins/aja/aja-props.cpp - ${CMAKE_SOURCE_DIR}/plugins/aja/aja-props.hpp - ${CMAKE_SOURCE_DIR}/plugins/aja/aja-routing.cpp - ${CMAKE_SOURCE_DIR}/plugins/aja/aja-routing.hpp - ${CMAKE_SOURCE_DIR}/plugins/aja/aja-ui-props.hpp - ${CMAKE_SOURCE_DIR}/plugins/aja/aja-vpid-data.cpp - ${CMAKE_SOURCE_DIR}/plugins/aja/aja-vpid-data.hpp - ${CMAKE_SOURCE_DIR}/plugins/aja/aja-widget-io.cpp - ${CMAKE_SOURCE_DIR}/plugins/aja/aja-widget-io.hpp - ${CMAKE_SOURCE_DIR}/UI/double-slider.cpp - ${CMAKE_SOURCE_DIR}/UI/double-slider.hpp - ${CMAKE_SOURCE_DIR}/UI/plain-text-edit.hpp - ${CMAKE_SOURCE_DIR}/UI/plain-text-edit.cpp - ${CMAKE_SOURCE_DIR}/UI/properties-view.hpp - ${CMAKE_SOURCE_DIR}/UI/properties-view.cpp - ${CMAKE_SOURCE_DIR}/UI/properties-view.moc.hpp - ${CMAKE_SOURCE_DIR}/UI/qt-wrappers.cpp - ${CMAKE_SOURCE_DIR}/UI/qt-wrappers.hpp - ${CMAKE_SOURCE_DIR}/UI/spinbox-ignorewheel.cpp - ${CMAKE_SOURCE_DIR}/UI/spinbox-ignorewheel.hpp - ${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.cpp - ${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.hpp - ${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.cpp - ${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.hpp) + "${CMAKE_SOURCE_DIR}/plugins/aja/aja-card-manager.cpp" + "${CMAKE_SOURCE_DIR}/plugins/aja/aja-card-manager.hpp" + "${CMAKE_SOURCE_DIR}/plugins/aja/aja-common.cpp" + "${CMAKE_SOURCE_DIR}/plugins/aja/aja-common.hpp" + "${CMAKE_SOURCE_DIR}/plugins/aja/aja-enums.hpp" + "${CMAKE_SOURCE_DIR}/plugins/aja/aja-presets.cpp" + "${CMAKE_SOURCE_DIR}/plugins/aja/aja-presets.hpp" + "${CMAKE_SOURCE_DIR}/plugins/aja/aja-props.cpp" + "${CMAKE_SOURCE_DIR}/plugins/aja/aja-props.hpp" + "${CMAKE_SOURCE_DIR}/plugins/aja/aja-routing.cpp" + "${CMAKE_SOURCE_DIR}/plugins/aja/aja-routing.hpp" + "${CMAKE_SOURCE_DIR}/plugins/aja/aja-ui-props.hpp" + "${CMAKE_SOURCE_DIR}/plugins/aja/aja-vpid-data.cpp" + "${CMAKE_SOURCE_DIR}/plugins/aja/aja-vpid-data.hpp" + "${CMAKE_SOURCE_DIR}/plugins/aja/aja-widget-io.cpp" + "${CMAKE_SOURCE_DIR}/plugins/aja/aja-widget-io.hpp" + "${CMAKE_SOURCE_DIR}/UI/double-slider.cpp" + "${CMAKE_SOURCE_DIR}/UI/double-slider.hpp" + "${CMAKE_SOURCE_DIR}/UI/plain-text-edit.hpp" + "${CMAKE_SOURCE_DIR}/UI/plain-text-edit.cpp" + "${CMAKE_SOURCE_DIR}/UI/properties-view.hpp" + "${CMAKE_SOURCE_DIR}/UI/properties-view.cpp" + "${CMAKE_SOURCE_DIR}/UI/properties-view.moc.hpp" + "${CMAKE_SOURCE_DIR}/UI/qt-wrappers.cpp" + "${CMAKE_SOURCE_DIR}/UI/qt-wrappers.hpp" + "${CMAKE_SOURCE_DIR}/UI/spinbox-ignorewheel.cpp" + "${CMAKE_SOURCE_DIR}/UI/spinbox-ignorewheel.hpp" + "${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.cpp" + "${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.hpp" + "${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.cpp" + "${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.hpp") -target_link_libraries(aja-output-ui PRIVATE OBS::libobs OBS::frontend-api - Qt::Widgets AJA::LibAJANTV2) +target_sources(aja-output-ui PRIVATE forms/output.ui) -if(OS_MACOS) +target_link_libraries(aja-output-ui PRIVATE OBS::libobs OBS::frontend-api Qt::Widgets AJA::LibAJANTV2) + +if(OS_WINDOWS) + configure_file(cmake/windows/obs-module.rc.in aja-output-ui.rc) + target_sources(aja-output-ui PRIVATE aja-output-ui.rc) + target_compile_options(aja-output-ui PRIVATE /wd4996) + + target_link_libraries(aja-output-ui PRIVATE ws2_32.lib setupapi.lib Winmm.lib netapi32.lib Shlwapi.lib) + target_link_options(aja-output-ui PRIVATE /IGNORE:4099) + + set_property( + TARGET aja-output-ui + APPEND + PROPERTY AUTORCC_OPTIONS --format-version 1) +elseif(OS_MACOS) find_library(IOKIT_FRAMEWORK Iokit) find_library(COREFOUNDATION_LIBRARY CoreFoundation) find_library(APPKIT_FRAMEWORK AppKit) - target_link_libraries(aja-output-ui PRIVATE ${IOKIT} ${COREFOUNDATION} - ${APPKIT}) -elseif(OS_WINDOWS) - set(MODULE_DESCRIPTION "OBS AJA Output UI") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - aja-output-ui.rc) - target_sources(aja-output-ui PRIVATE aja-output-ui.rc) - - target_compile_options(aja-output-ui PRIVATE /wd4996) - target_link_libraries(aja-output-ui PRIVATE ws2_32.lib setupapi.lib Winmm.lib - netapi32.lib Shlwapi.lib) - target_link_options(aja-output-ui PRIVATE "LINKER:/IGNORE:4099") -else() + target_link_libraries(aja-output-ui PRIVATE ${IOKIT} ${COREFOUNDATION} ${APPKIT}) + target_compile_options(aja-output-ui PRIVATE -Wno-error=deprecated-declarations) +elseif(OS_LINUX OR OS_FREEBSD) find_package(X11 REQUIRED) target_link_libraries(aja-output-ui PRIVATE X11::X11 Qt::GuiPrivate) endif() -if(NOT MSVC) - target_compile_options(aja-output-ui - PRIVATE -Wno-error=deprecated-declarations) -endif() - -set_target_properties(aja-output-ui PROPERTIES FOLDER "frontend" PREFIX "") - -get_target_property(_SOURCES aja-output-ui SOURCES) -set(_UI ${_SOURCES}) -list(FILTER _UI INCLUDE REGEX ".*\\.ui?") - -source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}/forms" - PREFIX "UI Files" - FILES ${_UI}) -unset(_SOURCES) -unset(_UI) - -setup_plugin_target(aja-output-ui) +set_target_properties_obs( + aja-output-ui + PROPERTIES FOLDER frontend + PREFIX "" + AUTOMOC ON + AUTOUIC ON + AUTORCC ON + AUTOUIC_SEARCH_PATHS forms) diff --git a/UI/frontend-plugins/aja-output-ui/cmake/legacy.cmake b/UI/frontend-plugins/aja-output-ui/cmake/legacy.cmake new file mode 100644 index 000000000..1cdc54459 --- /dev/null +++ b/UI/frontend-plugins/aja-output-ui/cmake/legacy.cmake @@ -0,0 +1,103 @@ +project(aja-output-ui) + +if(NOT ENABLE_AJA) + return() +endif() + +find_package(LibAJANTV2 REQUIRED) + +add_library(aja-output-ui MODULE) +add_library(OBS::aja-output-ui ALIAS aja-output-ui) + +find_qt(COMPONENTS Widgets COMPONENTS_LINUX Gui) + +set_target_properties( + aja-output-ui + PROPERTIES AUTOMOC ON + AUTOUIC ON + AUTORCC ON + AUTOUIC_SEARCH_PATHS "forms") + +if(_QT_VERSION EQUAL 6 AND OS_WINDOWS) + set_target_properties(aja-output-ui PROPERTIES AUTORCC_OPTIONS "--format-version;1") +endif() + +target_sources(aja-output-ui PRIVATE forms/output.ui) + +target_sources( + aja-output-ui + PRIVATE AJAOutputUI.h + AJAOutputUI.cpp + aja-ui-main.cpp + aja-ui-main.h + ${CMAKE_SOURCE_DIR}/plugins/aja/aja-card-manager.cpp + ${CMAKE_SOURCE_DIR}/plugins/aja/aja-card-manager.hpp + ${CMAKE_SOURCE_DIR}/plugins/aja/aja-common.cpp + ${CMAKE_SOURCE_DIR}/plugins/aja/aja-common.hpp + ${CMAKE_SOURCE_DIR}/plugins/aja/aja-enums.hpp + ${CMAKE_SOURCE_DIR}/plugins/aja/aja-presets.cpp + ${CMAKE_SOURCE_DIR}/plugins/aja/aja-presets.hpp + ${CMAKE_SOURCE_DIR}/plugins/aja/aja-props.cpp + ${CMAKE_SOURCE_DIR}/plugins/aja/aja-props.hpp + ${CMAKE_SOURCE_DIR}/plugins/aja/aja-routing.cpp + ${CMAKE_SOURCE_DIR}/plugins/aja/aja-routing.hpp + ${CMAKE_SOURCE_DIR}/plugins/aja/aja-ui-props.hpp + ${CMAKE_SOURCE_DIR}/plugins/aja/aja-vpid-data.cpp + ${CMAKE_SOURCE_DIR}/plugins/aja/aja-vpid-data.hpp + ${CMAKE_SOURCE_DIR}/plugins/aja/aja-widget-io.cpp + ${CMAKE_SOURCE_DIR}/plugins/aja/aja-widget-io.hpp + ${CMAKE_SOURCE_DIR}/UI/double-slider.cpp + ${CMAKE_SOURCE_DIR}/UI/double-slider.hpp + ${CMAKE_SOURCE_DIR}/UI/plain-text-edit.hpp + ${CMAKE_SOURCE_DIR}/UI/plain-text-edit.cpp + ${CMAKE_SOURCE_DIR}/UI/properties-view.hpp + ${CMAKE_SOURCE_DIR}/UI/properties-view.cpp + ${CMAKE_SOURCE_DIR}/UI/properties-view.moc.hpp + ${CMAKE_SOURCE_DIR}/UI/qt-wrappers.cpp + ${CMAKE_SOURCE_DIR}/UI/qt-wrappers.hpp + ${CMAKE_SOURCE_DIR}/UI/spinbox-ignorewheel.cpp + ${CMAKE_SOURCE_DIR}/UI/spinbox-ignorewheel.hpp + ${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.cpp + ${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.hpp + ${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.cpp + ${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.hpp) + +target_link_libraries(aja-output-ui PRIVATE OBS::libobs OBS::frontend-api Qt::Widgets AJA::LibAJANTV2) + +if(OS_MACOS) + find_library(IOKIT_FRAMEWORK Iokit) + find_library(COREFOUNDATION_LIBRARY CoreFoundation) + find_library(APPKIT_FRAMEWORK AppKit) + + target_link_libraries(aja-output-ui PRIVATE ${IOKIT} ${COREFOUNDATION} ${APPKIT}) +elseif(OS_WINDOWS) + set(MODULE_DESCRIPTION "OBS AJA Output UI") + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in aja-output-ui.rc) + target_sources(aja-output-ui PRIVATE aja-output-ui.rc) + + target_compile_options(aja-output-ui PRIVATE /wd4996) + target_link_libraries(aja-output-ui PRIVATE ws2_32.lib setupapi.lib Winmm.lib netapi32.lib Shlwapi.lib) + target_link_options(aja-output-ui PRIVATE "LINKER:/IGNORE:4099") +else() + find_package(X11 REQUIRED) + target_link_libraries(aja-output-ui PRIVATE X11::X11 Qt::GuiPrivate) +endif() + +if(NOT MSVC) + target_compile_options(aja-output-ui PRIVATE -Wno-error=deprecated-declarations) +endif() + +set_target_properties(aja-output-ui PROPERTIES FOLDER "frontend" PREFIX "") + +get_target_property(_SOURCES aja-output-ui SOURCES) +set(_UI ${_SOURCES}) +list(FILTER _UI INCLUDE REGEX ".*\\.ui?") + +source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}/forms" + PREFIX "UI Files" + FILES ${_UI}) +unset(_SOURCES) +unset(_UI) + +setup_plugin_target(aja-output-ui) diff --git a/UI/frontend-plugins/aja-output-ui/cmake/macos/Info.plist.in b/UI/frontend-plugins/aja-output-ui/cmake/macos/Info.plist.in new file mode 100644 index 000000000..fdf293c5d --- /dev/null +++ b/UI/frontend-plugins/aja-output-ui/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + aja-output-ui + CFBundleIdentifier + com.obsproject.aja-output-ui + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + aja-output-ui + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/UI/frontend-plugins/aja-output-ui/cmake/windows/obs-module.rc.in b/UI/frontend-plugins/aja-output-ui/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..ea3d24228 --- /dev/null +++ b/UI/frontend-plugins/aja-output-ui/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS AJA Output UI" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "aja-output-ui" + VALUE "OriginalFilename", "aja-output-ui" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/UI/frontend-plugins/decklink-captions/CMakeLists.txt b/UI/frontend-plugins/decklink-captions/CMakeLists.txt index 8c8f50437..1c2017df5 100644 --- a/UI/frontend-plugins/decklink-captions/CMakeLists.txt +++ b/UI/frontend-plugins/decklink-captions/CMakeLists.txt @@ -1,66 +1,43 @@ -project(decklink-captions) +cmake_minimum_required(VERSION 3.16...3.25) + +legacy_check() if(NOT ENABLE_DECKLINK) + target_disable(decklink-captions) return() endif() +find_qt(COMPONENTS Widgets) + add_library(decklink-captions MODULE) add_library(OBS::decklink-captions ALIAS decklink-captions) -find_qt(COMPONENTS Widgets) +target_sources(decklink-captions PRIVATE decklink-captions.cpp decklink-captions.h forms/captions.ui) +target_link_libraries(decklink-captions PRIVATE OBS::frontend-api OBS::libobs Qt::Widgets) -target_link_libraries(decklink-captions PRIVATE Qt::Widgets) +if(OS_WINDOWS) + configure_file(cmake/windows/obs-module.rc.in decklink-captions.rc) + target_sources(decklink-captions PRIVATE decklink-captions.rc) -set_target_properties( - decklink-captions - PROPERTIES AUTOMOC ON - AUTOUIC ON - AUTORCC ON - AUTOUIC_SEARCH_PATHS "forms") - -if(_QT_VERSION EQUAL 6 AND OS_WINDOWS) - set_target_properties(decklink-captions PROPERTIES AUTORCC_OPTIONS - "--format-version;1") -endif() - -target_compile_features(decklink-captions PRIVATE cxx_std_17) - -target_sources(decklink-captions PRIVATE forms/captions.ui) - -target_sources(decklink-captions PRIVATE decklink-captions.cpp - decklink-captions.h) - -target_link_libraries(decklink-captions PRIVATE OBS::frontend-api OBS::libobs) - -if(OS_MACOS) + set_property( + TARGET decklink-captions + APPEND + PROPERTY AUTORCC_OPTIONS --format-version 1) +elseif(OS_MACOS) find_library(COCOA Cocoa) mark_as_advanced(COCOA) target_link_libraries(decklink-captions PRIVATE ${COCOA}) - -elseif(OS_POSIX) +elseif(OS_LINUX OR OS_FREEBSD) find_package(X11 REQUIRED) mark_as_advanced(X11) target_link_libraries(decklink-captions PRIVATE X11::X11) -elseif(OS_WINDOWS) - set(MODULE_DESCRIPTION "OBS DeckLink Captions module") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - decklink-captions.rc) - - target_sources(decklink-captions PRIVATE decklink-captions.rc) endif() -set_target_properties(decklink-captions PROPERTIES FOLDER "plugins/decklink" - PREFIX "") - -get_target_property(_SOURCES decklink-captions SOURCES) -set(_UI ${_SOURCES}) -list(FILTER _UI INCLUDE REGEX ".*\\.ui?") - -source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}/forms" - PREFIX "UI Files" - FILES ${_UI}) -unset(_SOURCES) -unset(_UI) - -setup_plugin_target(decklink-captions) +set_target_properties_obs( + decklink-captions + PROPERTIES FOLDER plugins/decklink + PREFIX "" + AUTOMOC ON + AUTOUIC ON + AUTORCC ON + AUTOUIC_SEARCH_PATHS forms) diff --git a/UI/frontend-plugins/decklink-captions/cmake/legacy.cmake b/UI/frontend-plugins/decklink-captions/cmake/legacy.cmake new file mode 100644 index 000000000..f914a7f85 --- /dev/null +++ b/UI/frontend-plugins/decklink-captions/cmake/legacy.cmake @@ -0,0 +1,62 @@ +project(decklink-captions) + +if(NOT ENABLE_DECKLINK) + return() +endif() + +add_library(decklink-captions MODULE) +add_library(OBS::decklink-captions ALIAS decklink-captions) + +find_qt(COMPONENTS Widgets) + +target_link_libraries(decklink-captions PRIVATE Qt::Widgets) + +set_target_properties( + decklink-captions + PROPERTIES AUTOMOC ON + AUTOUIC ON + AUTORCC ON + AUTOUIC_SEARCH_PATHS "forms") + +if(_QT_VERSION EQUAL 6 AND OS_WINDOWS) + set_target_properties(decklink-captions PROPERTIES AUTORCC_OPTIONS "--format-version;1") +endif() + +target_compile_features(decklink-captions PRIVATE cxx_std_17) + +target_sources(decklink-captions PRIVATE forms/captions.ui) + +target_sources(decklink-captions PRIVATE decklink-captions.cpp decklink-captions.h) + +target_link_libraries(decklink-captions PRIVATE OBS::frontend-api OBS::libobs) + +if(OS_MACOS) + find_library(COCOA Cocoa) + mark_as_advanced(COCOA) + target_link_libraries(decklink-captions PRIVATE ${COCOA}) + +elseif(OS_POSIX) + find_package(X11 REQUIRED) + mark_as_advanced(X11) + target_link_libraries(decklink-captions PRIVATE X11::X11) +elseif(OS_WINDOWS) + set(MODULE_DESCRIPTION "OBS DeckLink Captions module") + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in decklink-captions.rc) + + target_sources(decklink-captions PRIVATE decklink-captions.rc) +endif() + +set_target_properties(decklink-captions PROPERTIES FOLDER "plugins/decklink" PREFIX "") + +get_target_property(_SOURCES decklink-captions SOURCES) +set(_UI ${_SOURCES}) +list(FILTER _UI INCLUDE REGEX ".*\\.ui?") + +source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}/forms" + PREFIX "UI Files" + FILES ${_UI}) +unset(_SOURCES) +unset(_UI) + +setup_plugin_target(decklink-captions) diff --git a/UI/frontend-plugins/decklink-captions/cmake/macos/Info.plist.in b/UI/frontend-plugins/decklink-captions/cmake/macos/Info.plist.in new file mode 100644 index 000000000..a00c8d4b6 --- /dev/null +++ b/UI/frontend-plugins/decklink-captions/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + decklink-captions + CFBundleIdentifier + com.obsproject.decklink-captions + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + decklink-captions + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/UI/frontend-plugins/decklink-captions/cmake/windows/obs-module.rc.in b/UI/frontend-plugins/decklink-captions/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..8a3e87935 --- /dev/null +++ b/UI/frontend-plugins/decklink-captions/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS DeckLink Captions module" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "decklink-captions" + VALUE "OriginalFilename", "decklink-captions" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/UI/frontend-plugins/decklink-output-ui/CMakeLists.txt b/UI/frontend-plugins/decklink-output-ui/CMakeLists.txt index 64e9ae72f..8d7650706 100644 --- a/UI/frontend-plugins/decklink-output-ui/CMakeLists.txt +++ b/UI/frontend-plugins/decklink-output-ui/CMakeLists.txt @@ -1,25 +1,16 @@ -project(decklink-output-ui) +cmake_minimum_required(VERSION 3.16...3.25) + +legacy_check() if(NOT ENABLE_DECKLINK) + target_disable(decklink-output-ui) return() endif() -add_library(decklink-output-ui MODULE) -add_library(OBS::decklink-output-ui ALIAS decklink-output-ui) - find_qt(COMPONENTS Widgets COMPONENTS_LINUX Gui) -set_target_properties( - decklink-output-ui - PROPERTIES AUTOMOC ON - AUTOUIC ON - AUTORCC ON - AUTOUIC_SEARCH_PATHS "forms") - -if(_QT_VERSION EQUAL 6 AND OS_WINDOWS) - set_target_properties(decklink-output-ui PROPERTIES AUTORCC_OPTIONS - "--format-version;1") -endif() +add_library(decklink-output-ui MODULE) +add_library(OBS::decklink-output-ui ALIAS decklink-output-ui) target_sources(decklink-output-ui PRIVATE forms/output.ui) @@ -29,56 +20,47 @@ target_sources( DecklinkOutputUI.h decklink-ui-main.cpp decklink-ui-main.h - ${CMAKE_SOURCE_DIR}/UI/double-slider.cpp - ${CMAKE_SOURCE_DIR}/UI/double-slider.hpp - ${CMAKE_SOURCE_DIR}/UI/plain-text-edit.hpp - ${CMAKE_SOURCE_DIR}/UI/plain-text-edit.cpp - ${CMAKE_SOURCE_DIR}/UI/properties-view.hpp - ${CMAKE_SOURCE_DIR}/UI/properties-view.cpp - ${CMAKE_SOURCE_DIR}/UI/properties-view.moc.hpp - ${CMAKE_SOURCE_DIR}/UI/qt-wrappers.hpp - ${CMAKE_SOURCE_DIR}/UI/qt-wrappers.cpp - ${CMAKE_SOURCE_DIR}/UI/spinbox-ignorewheel.cpp - ${CMAKE_SOURCE_DIR}/UI/spinbox-ignorewheel.hpp - ${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.cpp - ${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.hpp - ${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.hpp - ${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.cpp) + "${CMAKE_SOURCE_DIR}/UI/double-slider.cpp" + "${CMAKE_SOURCE_DIR}/UI/double-slider.hpp" + "${CMAKE_SOURCE_DIR}/UI/plain-text-edit.hpp" + "${CMAKE_SOURCE_DIR}/UI/plain-text-edit.cpp" + "${CMAKE_SOURCE_DIR}/UI/properties-view.hpp" + "${CMAKE_SOURCE_DIR}/UI/properties-view.cpp" + "${CMAKE_SOURCE_DIR}/UI/properties-view.moc.hpp" + "${CMAKE_SOURCE_DIR}/UI/qt-wrappers.hpp" + "${CMAKE_SOURCE_DIR}/UI/qt-wrappers.cpp" + "${CMAKE_SOURCE_DIR}/UI/spinbox-ignorewheel.cpp" + "${CMAKE_SOURCE_DIR}/UI/spinbox-ignorewheel.hpp" + "${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.cpp" + "${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.hpp" + "${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.hpp" + "${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.cpp") -target_link_libraries(decklink-output-ui PRIVATE OBS::libobs OBS::frontend-api - Qt::Widgets) - -target_compile_features(decklink-output-ui PRIVATE cxx_std_17) - -set_target_properties(decklink-output-ui PROPERTIES FOLDER "frontend" PREFIX "") +target_link_libraries(decklink-output-ui PRIVATE OBS::libobs OBS::frontend-api Qt::Widgets) if(OS_WINDOWS) - set(MODULE_DESCRIPTION "OBS Decklink Output UI") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - decklink-output-ui.rc) - + configure_file(cmake/windows/obs-module.rc.in decklink-output-ui.rc) target_sources(decklink-output-ui PRIVATE decklink-output-ui.rc) + set_property( + TARGET decklink-output-ui + APPEND + PROPERTY AUTORCC_OPTIONS --format-version 1) elseif(OS_MACOS) find_library(COCOA Cocoa) mark_as_advanced(COCOA) target_link_libraries(decklink-output-ui PRIVATE ${COCOA}) - -elseif(OS_POSIX) +elseif(OS_LINUX OR OS_FREEBSD) find_package(X11 REQUIRED) target_link_libraries(decklink-output-ui PRIVATE X11::X11 Qt::GuiPrivate) endif() -get_target_property(_SOURCES decklink-output-ui SOURCES) -set(_UI ${_SOURCES}) -list(FILTER _UI INCLUDE REGEX ".*\\.ui?") - -source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}/forms" - PREFIX "UI Files" - FILES ${_UI}) -unset(_SOURCES) -unset(_UI) - -setup_plugin_target(decklink-output-ui) +set_target_properties_obs( + decklink-output-ui + PROPERTIES FOLDER frontend + PREFIX "" + AUTOMOC ON + AUTOUIC ON + AUTORCC ON + AUTOUIC_SEARCH_PATHS forms) diff --git a/UI/frontend-plugins/decklink-output-ui/cmake/legacy.cmake b/UI/frontend-plugins/decklink-output-ui/cmake/legacy.cmake new file mode 100644 index 000000000..924766135 --- /dev/null +++ b/UI/frontend-plugins/decklink-output-ui/cmake/legacy.cmake @@ -0,0 +1,81 @@ +project(decklink-output-ui) + +if(NOT ENABLE_DECKLINK) + return() +endif() + +add_library(decklink-output-ui MODULE) +add_library(OBS::decklink-output-ui ALIAS decklink-output-ui) + +find_qt(COMPONENTS Widgets COMPONENTS_LINUX Gui) + +set_target_properties( + decklink-output-ui + PROPERTIES AUTOMOC ON + AUTOUIC ON + AUTORCC ON + AUTOUIC_SEARCH_PATHS "forms") + +if(_QT_VERSION EQUAL 6 AND OS_WINDOWS) + set_target_properties(decklink-output-ui PROPERTIES AUTORCC_OPTIONS "--format-version;1") +endif() + +target_sources(decklink-output-ui PRIVATE forms/output.ui) + +target_sources( + decklink-output-ui + PRIVATE DecklinkOutputUI.cpp + DecklinkOutputUI.h + decklink-ui-main.cpp + decklink-ui-main.h + ${CMAKE_SOURCE_DIR}/UI/double-slider.cpp + ${CMAKE_SOURCE_DIR}/UI/double-slider.hpp + ${CMAKE_SOURCE_DIR}/UI/plain-text-edit.hpp + ${CMAKE_SOURCE_DIR}/UI/plain-text-edit.cpp + ${CMAKE_SOURCE_DIR}/UI/properties-view.hpp + ${CMAKE_SOURCE_DIR}/UI/properties-view.cpp + ${CMAKE_SOURCE_DIR}/UI/properties-view.moc.hpp + ${CMAKE_SOURCE_DIR}/UI/qt-wrappers.hpp + ${CMAKE_SOURCE_DIR}/UI/qt-wrappers.cpp + ${CMAKE_SOURCE_DIR}/UI/spinbox-ignorewheel.cpp + ${CMAKE_SOURCE_DIR}/UI/spinbox-ignorewheel.hpp + ${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.cpp + ${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.hpp + ${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.hpp + ${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.cpp) + +target_link_libraries(decklink-output-ui PRIVATE OBS::libobs OBS::frontend-api Qt::Widgets) + +target_compile_features(decklink-output-ui PRIVATE cxx_std_17) + +set_target_properties(decklink-output-ui PROPERTIES FOLDER "frontend" PREFIX "") + +if(OS_WINDOWS) + set(MODULE_DESCRIPTION "OBS Decklink Output UI") + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in decklink-output-ui.rc) + + target_sources(decklink-output-ui PRIVATE decklink-output-ui.rc) + +elseif(OS_MACOS) + find_library(COCOA Cocoa) + mark_as_advanced(COCOA) + + target_link_libraries(decklink-output-ui PRIVATE ${COCOA}) + +elseif(OS_POSIX) + find_package(X11 REQUIRED) + target_link_libraries(decklink-output-ui PRIVATE X11::X11 Qt::GuiPrivate) +endif() + +get_target_property(_SOURCES decklink-output-ui SOURCES) +set(_UI ${_SOURCES}) +list(FILTER _UI INCLUDE REGEX ".*\\.ui?") + +source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}/forms" + PREFIX "UI Files" + FILES ${_UI}) +unset(_SOURCES) +unset(_UI) + +setup_plugin_target(decklink-output-ui) diff --git a/UI/frontend-plugins/decklink-output-ui/cmake/macos/Info.plist.in b/UI/frontend-plugins/decklink-output-ui/cmake/macos/Info.plist.in new file mode 100644 index 000000000..3eae8b91d --- /dev/null +++ b/UI/frontend-plugins/decklink-output-ui/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + decklink-output-ui + CFBundleIdentifier + com.obsproject.decklink-output-ui + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + decklink-output-ui + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/UI/frontend-plugins/decklink-output-ui/cmake/windows/obs-module.rc.in b/UI/frontend-plugins/decklink-output-ui/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..4555d089f --- /dev/null +++ b/UI/frontend-plugins/decklink-output-ui/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS Decklink Output UI" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "decklink-output-ui" + VALUE "OriginalFilename", "decklink-output-ui" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/UI/frontend-plugins/frontend-tools/CMakeLists.txt b/UI/frontend-plugins/frontend-tools/CMakeLists.txt index 2dc7235eb..62899511f 100644 --- a/UI/frontend-plugins/frontend-tools/CMakeLists.txt +++ b/UI/frontend-plugins/frontend-tools/CMakeLists.txt @@ -1,25 +1,11 @@ -project(frontend-tools) +cmake_minimum_required(VERSION 3.16...3.25) -add_library(frontend-tools MODULE) -add_library(OBS::frontend-tools ALIAS frontend-tools) +legacy_check() find_qt(COMPONENTS Widgets COMPONENTS_LINUX Gui) -set_target_properties( - frontend-tools - PROPERTIES AUTOMOC ON - AUTOUIC ON - AUTORCC ON - AUTOUIC_SEARCH_PATHS "forms") - -if(_QT_VERSION EQUAL 6 AND OS_WINDOWS) - set_target_properties(frontend-tools PROPERTIES AUTORCC_OPTIONS - "--format-version;1") -endif() - -target_sources( - frontend-tools PRIVATE forms/auto-scene-switcher.ui forms/captions.ui - forms/output-timer.ui forms/scripts.ui) +add_library(frontend-tools MODULE) +add_library(OBS::frontend-tools ALIAS frontend-tools) target_sources( frontend-tools @@ -29,56 +15,40 @@ target_sources( output-timer.hpp tool-helpers.hpp output-timer.cpp - ${CMAKE_SOURCE_DIR}/UI/double-slider.cpp - ${CMAKE_SOURCE_DIR}/UI/double-slider.hpp - ${CMAKE_SOURCE_DIR}/UI/horizontal-scroll-area.cpp - ${CMAKE_SOURCE_DIR}/UI/horizontal-scroll-area.hpp - ${CMAKE_SOURCE_DIR}/UI/properties-view.cpp - ${CMAKE_SOURCE_DIR}/UI/properties-view.hpp - ${CMAKE_SOURCE_DIR}/UI/properties-view.moc.hpp - ${CMAKE_SOURCE_DIR}/UI/qt-wrappers.cpp - ${CMAKE_SOURCE_DIR}/UI/qt-wrappers.hpp - ${CMAKE_SOURCE_DIR}/UI/spinbox-ignorewheel.cpp - ${CMAKE_SOURCE_DIR}/UI/spinbox-ignorewheel.hpp - ${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.cpp - ${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.hpp - ${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.hpp - ${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.cpp - ${CMAKE_SOURCE_DIR}/UI/plain-text-edit.cpp - ${CMAKE_SOURCE_DIR}/UI/plain-text-edit.hpp) + "${CMAKE_SOURCE_DIR}/UI/double-slider.cpp" + "${CMAKE_SOURCE_DIR}/UI/double-slider.hpp" + "${CMAKE_SOURCE_DIR}/UI/horizontal-scroll-area.cpp" + "${CMAKE_SOURCE_DIR}/UI/horizontal-scroll-area.hpp" + "${CMAKE_SOURCE_DIR}/UI/properties-view.cpp" + "${CMAKE_SOURCE_DIR}/UI/properties-view.hpp" + "${CMAKE_SOURCE_DIR}/UI/properties-view.moc.hpp" + "${CMAKE_SOURCE_DIR}/UI/qt-wrappers.cpp" + "${CMAKE_SOURCE_DIR}/UI/qt-wrappers.hpp" + "${CMAKE_SOURCE_DIR}/UI/spinbox-ignorewheel.cpp" + "${CMAKE_SOURCE_DIR}/UI/spinbox-ignorewheel.hpp" + "${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.cpp" + "${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.hpp" + "${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.hpp" + "${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.cpp" + "${CMAKE_SOURCE_DIR}/UI/plain-text-edit.cpp" + "${CMAKE_SOURCE_DIR}/UI/plain-text-edit.hpp") -target_compile_features(frontend-tools PRIVATE cxx_std_17) +target_sources(frontend-tools PRIVATE forms/auto-scene-switcher.ui forms/captions.ui forms/output-timer.ui + forms/scripts.ui) -target_link_libraries(frontend-tools PRIVATE OBS::frontend-api OBS::libobs - Qt::Widgets) +target_link_libraries(frontend-tools PRIVATE OBS::frontend-api OBS::libobs Qt::Widgets + $<$:Qt::GuiPrivate>) -if(OS_POSIX AND NOT OS_MACOS) - target_link_libraries(frontend-tools PRIVATE Qt::GuiPrivate) -endif() +add_subdirectory("${CMAKE_SOURCE_DIR}/deps/obs-scripting" "${CMAKE_BINARY_DIR}/deps/obs-scripting") if(ENABLE_SCRIPTING AND TARGET OBS::scripting) - target_compile_definitions(frontend-tools PRIVATE ENABLE_SCRIPTING) - target_sources(frontend-tools PRIVATE scripts.cpp scripts.hpp) - target_link_libraries(frontend-tools PRIVATE OBS::scripting) - - if(TARGET obslua) - target_compile_definitions(frontend-tools PRIVATE LUAJIT_FOUND) - endif() - - if(TARGET obspython) - target_compile_definitions(frontend-tools PRIVATE Python_FOUND) - endif() + target_enable_feature(frontend-tools "Scripting Support (Frontend)" ENABLE_SCRIPTING) endif() -set_target_properties(frontend-tools PROPERTIES FOLDER "frontend" PREFIX "") - if(OS_WINDOWS) - set(MODULE_DESCRIPTION "OBS Frontend Tools") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - frontend-tools.rc) - + configure_file(cmake/windows/obs-module.rc.in frontend-tools.rc) target_sources( frontend-tools PRIVATE auto-scene-switcher-win.cpp @@ -92,32 +62,32 @@ if(OS_WINDOWS) captions-mssapi-stream.cpp captions-mssapi-stream.hpp) + set_property( + TARGET frontend-tools + APPEND + PROPERTY AUTORCC_OPTIONS --format-version 1) elseif(OS_MACOS) find_library(COCOA Cocoa) mark_as_advanced(COCOA) target_link_libraries(frontend-tools PRIVATE ${COCOA}) target_sources(frontend-tools PRIVATE auto-scene-switcher-osx.mm) - set_source_files_properties(auto-scene-switcher-osx.mm - PROPERTIES COMPILE_FLAGS -fobjc-arc) - -elseif(OS_POSIX) + set_target_properties(frontend-tools PROPERTIES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES) + if(NOT XCODE) + set_source_files_properties(auto-scene-switcher-osx.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) + endif() +elseif(OS_LINUX OR OS_FREEBSD) find_package(X11 REQUIRED) target_link_libraries(frontend-tools PRIVATE X11::X11) - target_sources(frontend-tools PRIVATE auto-scene-switcher-nix.cpp) endif() -get_target_property(_SOURCES frontend-tools SOURCES) -set(_UI ${_SOURCES}) -list(FILTER _UI INCLUDE REGEX ".*\\.ui?") - -source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}/forms" - PREFIX "UI Files" - FILES ${_UI}) -unset(_SOURCES) -unset(_UI) - -setup_plugin_target(frontend-tools) +set_target_properties_obs( + frontend-tools + PROPERTIES FOLDER frontend + PREFIX "" + AUTOMOC ON + AUTOUIC ON + AUTORCC ON + AUTOUIC_SEARCH_PATHS forms) diff --git a/UI/frontend-plugins/frontend-tools/cmake/legacy.cmake b/UI/frontend-plugins/frontend-tools/cmake/legacy.cmake new file mode 100644 index 000000000..575138efe --- /dev/null +++ b/UI/frontend-plugins/frontend-tools/cmake/legacy.cmake @@ -0,0 +1,118 @@ +project(frontend-tools) + +add_library(frontend-tools MODULE) +add_library(OBS::frontend-tools ALIAS frontend-tools) + +find_qt(COMPONENTS Widgets COMPONENTS_LINUX Gui) + +set_target_properties( + frontend-tools + PROPERTIES AUTOMOC ON + AUTOUIC ON + AUTORCC ON + AUTOUIC_SEARCH_PATHS "forms") + +if(_QT_VERSION EQUAL 6 AND OS_WINDOWS) + set_target_properties(frontend-tools PROPERTIES AUTORCC_OPTIONS "--format-version;1") +endif() + +target_sources(frontend-tools PRIVATE forms/auto-scene-switcher.ui forms/captions.ui forms/output-timer.ui + forms/scripts.ui) + +target_sources( + frontend-tools + PRIVATE frontend-tools.c + auto-scene-switcher.hpp + auto-scene-switcher.cpp + output-timer.hpp + tool-helpers.hpp + output-timer.cpp + ${CMAKE_SOURCE_DIR}/UI/double-slider.cpp + ${CMAKE_SOURCE_DIR}/UI/double-slider.hpp + ${CMAKE_SOURCE_DIR}/UI/horizontal-scroll-area.cpp + ${CMAKE_SOURCE_DIR}/UI/horizontal-scroll-area.hpp + ${CMAKE_SOURCE_DIR}/UI/properties-view.cpp + ${CMAKE_SOURCE_DIR}/UI/properties-view.hpp + ${CMAKE_SOURCE_DIR}/UI/properties-view.moc.hpp + ${CMAKE_SOURCE_DIR}/UI/qt-wrappers.cpp + ${CMAKE_SOURCE_DIR}/UI/qt-wrappers.hpp + ${CMAKE_SOURCE_DIR}/UI/spinbox-ignorewheel.cpp + ${CMAKE_SOURCE_DIR}/UI/spinbox-ignorewheel.hpp + ${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.cpp + ${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.hpp + ${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.hpp + ${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.cpp + ${CMAKE_SOURCE_DIR}/UI/plain-text-edit.cpp + ${CMAKE_SOURCE_DIR}/UI/plain-text-edit.hpp) + +target_compile_features(frontend-tools PRIVATE cxx_std_17) + +target_link_libraries(frontend-tools PRIVATE OBS::frontend-api OBS::libobs Qt::Widgets) + +if(OS_POSIX AND NOT OS_MACOS) + target_link_libraries(frontend-tools PRIVATE Qt::GuiPrivate) +endif() + +if(ENABLE_SCRIPTING AND TARGET OBS::scripting) + target_compile_definitions(frontend-tools PRIVATE ENABLE_SCRIPTING) + + target_sources(frontend-tools PRIVATE scripts.cpp scripts.hpp) + + target_link_libraries(frontend-tools PRIVATE OBS::scripting) + + if(TARGET obslua) + target_compile_definitions(frontend-tools PRIVATE LUAJIT_FOUND) + endif() + + if(TARGET obspython) + target_compile_definitions(frontend-tools PRIVATE Python_FOUND) + endif() +endif() + +set_target_properties(frontend-tools PROPERTIES FOLDER "frontend" PREFIX "") + +if(OS_WINDOWS) + set(MODULE_DESCRIPTION "OBS Frontend Tools") + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in frontend-tools.rc) + + target_sources( + frontend-tools + PRIVATE auto-scene-switcher-win.cpp + frontend-tools.rc + captions.cpp + captions.hpp + captions-handler.cpp + captions-handler.hpp + captions-mssapi.cpp + captions-mssapi.hpp + captions-mssapi-stream.cpp + captions-mssapi-stream.hpp) + +elseif(OS_MACOS) + find_library(COCOA Cocoa) + mark_as_advanced(COCOA) + target_link_libraries(frontend-tools PRIVATE ${COCOA}) + + target_sources(frontend-tools PRIVATE auto-scene-switcher-osx.mm) + set_source_files_properties(auto-scene-switcher-osx.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) + +elseif(OS_POSIX) + find_package(X11 REQUIRED) + + target_link_libraries(frontend-tools PRIVATE X11::X11) + + target_sources(frontend-tools PRIVATE auto-scene-switcher-nix.cpp) +endif() + +get_target_property(_SOURCES frontend-tools SOURCES) +set(_UI ${_SOURCES}) +list(FILTER _UI INCLUDE REGEX ".*\\.ui?") + +source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}/forms" + PREFIX "UI Files" + FILES ${_UI}) +unset(_SOURCES) +unset(_UI) + +setup_plugin_target(frontend-tools) diff --git a/UI/frontend-plugins/frontend-tools/cmake/macos/Info.plist.in b/UI/frontend-plugins/frontend-tools/cmake/macos/Info.plist.in new file mode 100644 index 000000000..df3568c23 --- /dev/null +++ b/UI/frontend-plugins/frontend-tools/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + frontend-tools + CFBundleIdentifier + com.obsproject.frontend-tools + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + frontend-tools + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/UI/frontend-plugins/frontend-tools/cmake/windows/obs-module.rc.in b/UI/frontend-plugins/frontend-tools/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..daa50ce70 --- /dev/null +++ b/UI/frontend-plugins/frontend-tools/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS Frontend Tools" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "frontend-tools" + VALUE "OriginalFilename", "frontend-tools" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/UI/obs-frontend-api/CMakeLists.txt b/UI/obs-frontend-api/CMakeLists.txt index 26f94dd5c..3ed6dbd5f 100644 --- a/UI/obs-frontend-api/CMakeLists.txt +++ b/UI/obs-frontend-api/CMakeLists.txt @@ -1,40 +1,23 @@ -if(POLICY CMP0090) - cmake_policy(SET CMP0090 NEW) -endif() +cmake_minimum_required(VERSION 3.16...3.25) -project(obs-frontend-api) +legacy_check() add_library(obs-frontend-api SHARED) add_library(OBS::frontend-api ALIAS obs-frontend-api) -target_sources(obs-frontend-api PRIVATE obs-frontend-api.h obs-frontend-api.cpp - obs-frontend-internal.hpp) +target_sources(obs-frontend-api PRIVATE obs-frontend-api.h obs-frontend-api.cpp obs-frontend-internal.hpp) target_link_libraries(obs-frontend-api PRIVATE OBS::libobs) -target_compile_features(obs-frontend-api PUBLIC cxx_auto_type cxx_std_17 - c_std_11) - -target_include_directories( - obs-frontend-api PUBLIC $ - $) - -set_target_properties( - obs-frontend-api - PROPERTIES FOLDER "frontend" - VERSION "${OBS_VERSION_MAJOR}" - SOVERSION "0" - PUBLIC_HEADER obs-frontend-api.h) +target_include_directories(obs-frontend-api PUBLIC "$") if(OS_WINDOWS) - set(MODULE_DESCRIPTION "OBS Frontend API") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - obs-frontend-api.rc) - + configure_file(cmake/windows/obs-module.rc.in obs-frontend-api.rc) target_sources(obs-frontend-api PRIVATE obs-frontend-api.rc) elseif(OS_MACOS) - set_target_properties(obs-frontend-api PROPERTIES SOVERSION "1") + set_target_properties(obs-frontend-api PROPERTIES SOVERSION 1) endif() -setup_binary_target(obs-frontend-api) -export_target(obs-frontend-api) +set_target_properties_obs(obs-frontend-api PROPERTIES FOLDER frontend PREFIX "" PUBLIC_HEADER obs-frontend-api.h) + +target_export(obs-frontend-api) diff --git a/UI/obs-frontend-api/cmake/legacy.cmake b/UI/obs-frontend-api/cmake/legacy.cmake new file mode 100644 index 000000000..d29b46b85 --- /dev/null +++ b/UI/obs-frontend-api/cmake/legacy.cmake @@ -0,0 +1,36 @@ +if(POLICY CMP0090) + cmake_policy(SET CMP0090 NEW) +endif() + +project(obs-frontend-api) + +add_library(obs-frontend-api SHARED) +add_library(OBS::frontend-api ALIAS obs-frontend-api) + +target_sources(obs-frontend-api PRIVATE obs-frontend-api.h obs-frontend-api.cpp obs-frontend-internal.hpp) + +target_link_libraries(obs-frontend-api PRIVATE OBS::libobs) + +target_compile_features(obs-frontend-api PUBLIC cxx_auto_type cxx_std_17 c_std_11) + +target_include_directories(obs-frontend-api PUBLIC $ + $) + +set_target_properties( + obs-frontend-api + PROPERTIES FOLDER "frontend" + VERSION "${OBS_VERSION_MAJOR}" + SOVERSION "0" + PUBLIC_HEADER obs-frontend-api.h) + +if(OS_WINDOWS) + set(MODULE_DESCRIPTION "OBS Frontend API") + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in obs-frontend-api.rc) + + target_sources(obs-frontend-api PRIVATE obs-frontend-api.rc) +elseif(OS_MACOS) + set_target_properties(obs-frontend-api PROPERTIES SOVERSION "1") +endif() + +setup_binary_target(obs-frontend-api) +export_target(obs-frontend-api) diff --git a/UI/obs-frontend-api/cmake/obs-frontend-apiConfig.cmake.in b/UI/obs-frontend-api/cmake/obs-frontend-apiConfig.cmake.in index 38bbde7b3..f3d2cb8c0 100644 --- a/UI/obs-frontend-api/cmake/obs-frontend-apiConfig.cmake.in +++ b/UI/obs-frontend-api/cmake/obs-frontend-apiConfig.cmake.in @@ -1,4 +1,8 @@ @PACKAGE_INIT@ +include(CMakeFindDependencyMacro) + +find_dependency(OBS::libobs REQUIRED) + include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake") check_required_components("@PROJECT_NAME@") diff --git a/UI/obs-frontend-api/cmake/windows/obs-module.rc.in b/UI/obs-frontend-api/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..880ed4a1c --- /dev/null +++ b/UI/obs-frontend-api/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS Frontend API" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "obs-frontend-api" + VALUE "OriginalFilename", "obs-frontend-api" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/UI/ui-config.h.in b/UI/ui-config.h.in index d7dd09b59..3e40f75b4 100644 --- a/UI/ui-config.h.in +++ b/UI/ui-config.h.in @@ -1,34 +1,15 @@ #pragma once -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef ON -#define ON 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef OFF -#define OFF 0 -#endif - #cmakedefine USE_XDG #define OAUTH_BASE_URL "@OAUTH_BASE_URL@" -#define TWITCH_ENABLED @TWITCH_ENABLED@ #define TWITCH_CLIENTID "@TWITCH_CLIENTID@" #define TWITCH_HASH 0x@TWITCH_HASH@ -#define RESTREAM_ENABLED @RESTREAM_ENABLED@ #define RESTREAM_CLIENTID "@RESTREAM_CLIENTID@" #define RESTREAM_HASH 0x@RESTREAM_HASH@ -#define YOUTUBE_ENABLED @YOUTUBE_ENABLED@ #define YOUTUBE_CLIENTID "@YOUTUBE_CLIENTID@" #define YOUTUBE_SECRET "@YOUTUBE_SECRET@" #define YOUTUBE_CLIENTID_HASH 0x@YOUTUBE_CLIENTID_HASH@ diff --git a/UI/win-update/updater/CMakeLists.txt b/UI/win-update/updater/CMakeLists.txt index 54fe6f8dd..ddff7d15b 100644 --- a/UI/win-update/updater/CMakeLists.txt +++ b/UI/win-update/updater/CMakeLists.txt @@ -1,44 +1,42 @@ -project(updater) +cmake_minimum_required(VERSION 3.24...3.25) + +legacy_check() option(ENABLE_UPDATER "Build with Windows updater" ON) if(NOT ENABLE_UPDATER) - message(STATUS "OBS: DISABLED Windows updater") + target_disable_feature(obs "Windows updater") return() endif() find_package(zstd) +if(NOT TARGET OBS::json11) + add_subdirectory("${CMAKE_SOURCE_DIR}/deps/json11" "${CMAKE_BINARY_DIR}/deps/json11") +endif() + add_executable(updater WIN32) target_sources( updater - PRIVATE updater.cpp - updater.hpp - patch.cpp - http.cpp - hash.cpp - resource.h - updater.rc - init-hook-files.c - updater.manifest + PRIVATE hash.cpp helpers.cpp helpers.hpp - ${CMAKE_SOURCE_DIR}/deps/json11/json11.hpp - ${CMAKE_SOURCE_DIR}/deps/json11/json11.cpp) - -target_include_directories(updater PRIVATE ${CMAKE_SOURCE_DIR}/libobs - ${CMAKE_SOURCE_DIR}/deps/json11) + http.cpp + init-hook-files.c + patch.cpp + resource.h + updater.cpp + updater.hpp + updater.manifest + updater.rc) +target_compile_options(updater PRIVATE $,/MTd,/MT> "/utf-8") target_compile_definitions(updater PRIVATE NOMINMAX "PSAPI_VERSION=2") -if(MSVC) - target_compile_options(updater PRIVATE $,/MTd,/MT>) - target_compile_options(updater PRIVATE "/utf-8") - target_link_options(updater PRIVATE "LINKER:/IGNORE:4098") -endif() +target_include_directories(updater PRIVATE "${CMAKE_SOURCE_DIR}/libobs" "${CMAKE_SOURCE_DIR}/UI/win-update") -target_link_libraries(updater PRIVATE OBS::blake2 zstd::libzstd_static comctl32 - shell32 winhttp) +target_link_libraries(updater PRIVATE OBS::blake2 OBS::json11 zstd::libzstd_static comctl32 shell32 winhttp) +target_link_options(updater PRIVATE /IGNORE:4098) -set_target_properties(updater PROPERTIES FOLDER "frontend") +set_target_properties_obs(updater PROPERTIES FOLDER frontend OUTPUT_NAME updater) diff --git a/UI/win-update/updater/cmake/legacy.cmake b/UI/win-update/updater/cmake/legacy.cmake new file mode 100644 index 000000000..6af1f7b2b --- /dev/null +++ b/UI/win-update/updater/cmake/legacy.cmake @@ -0,0 +1,42 @@ +project(updater) + +option(ENABLE_UPDATER "Build with Windows updater" ON) + +if(NOT ENABLE_UPDATER) + message(STATUS "OBS: DISABLED Windows updater") + return() +endif() + +find_package(zstd) + +add_executable(updater WIN32) + +target_sources( + updater + PRIVATE updater.cpp + updater.hpp + patch.cpp + http.cpp + hash.cpp + resource.h + updater.rc + init-hook-files.c + updater.manifest + helpers.cpp + helpers.hpp + ${CMAKE_SOURCE_DIR}/deps/json11/json11.hpp + ${CMAKE_SOURCE_DIR}/deps/json11/json11.cpp) + +target_include_directories(updater PRIVATE ${CMAKE_SOURCE_DIR}/libobs ${CMAKE_SOURCE_DIR}/deps/json11) + +target_compile_definitions(updater PRIVATE NOMINMAX "PSAPI_VERSION=2") + +if(MSVC) + target_compile_options(updater PRIVATE $,/MTd,/MT>) + target_compile_options(updater PRIVATE "/utf-8") + target_link_options(updater PRIVATE "LINKER:/IGNORE:4098") +endif() + +target_link_libraries(updater PRIVATE OBS::blake2 zstd::libzstd_static comctl32 shell32 winhttp) + +set_target_properties(updater PROPERTIES FOLDER "frontend") diff --git a/UI/xdg-data/CMakeLists.txt b/UI/xdg-data/CMakeLists.txt index 1d348fad5..a18135db7 100644 --- a/UI/xdg-data/CMakeLists.txt +++ b/UI/xdg-data/CMakeLists.txt @@ -6,8 +6,7 @@ if(NOT DEFINED APPDATA_RELEASE_DATE) WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_STRIP_TRAILING_WHITESPACE) else() - file(TIMESTAMP "${CMAKE_SOURCE_DIR}/CMakeLists.txt" APPDATA_RELEASE_DATE - "%Y-%m-%d") + file(TIMESTAMP "${CMAKE_SOURCE_DIR}/CMakeLists.txt" APPDATA_RELEASE_DATE "%Y-%m-%d") endif() endif() @@ -23,14 +22,12 @@ if(NOT DEFINED GIT_HASH) endif() endif() -configure_file(com.obsproject.Studio.appdata.xml.in - com.obsproject.Studio.appdata.xml) +configure_file(com.obsproject.Studio.appdata.xml.in com.obsproject.Studio.appdata.xml) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/com.obsproject.Studio.appdata.xml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo) -install(FILES com.obsproject.Studio.desktop - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) +install(FILES com.obsproject.Studio.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) install( FILES icons/obs-logo-128.png diff --git a/cmake/Modules/CompilerConfig.cmake b/cmake/Modules/CompilerConfig.cmake index d51536849..4fcbae372 100644 --- a/cmake/Modules/CompilerConfig.cmake +++ b/cmake/Modules/CompilerConfig.cmake @@ -11,21 +11,17 @@ if(OS_WINDOWS AND MSVC) file( GENERATE OUTPUT "${CMAKE_BINARY_DIR}/ALL_BUILD.vcxproj.user" - INPUT "${CMAKE_SOURCE_DIR}/cmake/bundle/windows/ALL_BUILD.vcxproj.user.in" - ) + INPUT "${CMAKE_SOURCE_DIR}/cmake/bundle/windows/ALL_BUILD.vcxproj.user.in") endif() - # CMake 3.24 introduces a bug mistakenly interpreting MSVC as supporting - # `-pthread` + # CMake 3.24 introduces a bug mistakenly interpreting MSVC as supporting `-pthread` if(${CMAKE_VERSION} VERSION_EQUAL "3.24.0") set(THREADS_HAVE_PTHREAD_ARG OFF) endif() # Check for Win SDK version 10.0.20348 or above - obs_status( - STATUS "Windows API version is ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") - string(REPLACE "." ";" WINAPI_VER - "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") + obs_status(STATUS "Windows API version is ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") + string(REPLACE "." ";" WINAPI_VER "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") list(GET WINAPI_VER 0 WINAPI_VER_MAJOR) list(GET WINAPI_VER 1 WINAPI_VER_MINOR) @@ -45,10 +41,8 @@ if(OS_WINDOWS AND MSVC) endif() if(NOT WINAPI_COMPATIBLE) - obs_status( - FATAL_ERROR - "OBS requires Windows 10 SDK version 10.0.20348.0 and above to compile.\n" - "Please download the most recent Windows 10 SDK in order to compile.") + obs_status(FATAL_ERROR "OBS requires Windows 10 SDK version 10.0.20348.0 and above to compile.\n" + "Please download the most recent Windows 10 SDK in order to compile.") endif() add_compile_options( @@ -76,12 +70,8 @@ if(OS_WINDOWS AND MSVC) /std:c17) add_link_options( - "LINKER:/Brepro" - "LINKER:/OPT:REF" - "LINKER:/WX" - "$<$>:LINKER\:/SAFESEH\:NO>" - "$<$:LINKER\:/INCREMENTAL\:NO>" - "$<$:LINKER\:/INCREMENTAL\:NO;/OPT:ICF>") + "LINKER:/Brepro" "LINKER:/OPT:REF" "LINKER:/WX" "$<$>:LINKER\:/SAFESEH\:NO>" + "$<$:LINKER\:/INCREMENTAL\:NO>" "$<$:LINKER\:/INCREMENTAL\:NO;/OPT:ICF>") else() find_program(CCACHE_PROGRAM "ccache") set(CCACHE_SUPPORT @@ -147,8 +137,7 @@ else() string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_SYSTEM_PROCESSOR) endif() -if(LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES - "(i[3-6]86|x86|x64|x86_64|amd64|e2k)") +if(LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86|x64|x86_64|amd64|e2k)") if(NOT MSVC AND NOT CMAKE_OSX_ARCHITECTURES STREQUAL "arm64") set(ARCH_SIMD_FLAGS -mmmx -msse -msse2) endif() @@ -156,15 +145,12 @@ elseif(LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64(le)?") set(ARCH_SIMD_DEFINES -DNO_WARN_X86_INTRINSICS) set(ARCH_SIMD_FLAGS -mvsx) else() - if(CMAKE_C_COMPILER_ID MATCHES "^(Apple)?Clang|GNU" - OR CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang|GNU") + if(CMAKE_C_COMPILER_ID MATCHES "^(Apple)?Clang|GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang|GNU") check_c_compiler_flag("-fopenmp-simd" C_COMPILER_SUPPORTS_OPENMP_SIMD) check_cxx_compiler_flag("-fopenmp-simd" CXX_COMPILER_SUPPORTS_OPENMP_SIMD) set(ARCH_SIMD_FLAGS - -DSIMDE_ENABLE_OPENMP - "$<$,$>:-fopenmp-simd>" - "$<$,$>:-fopenmp-simd>" - ) + -DSIMDE_ENABLE_OPENMP "$<$,$>:-fopenmp-simd>" + "$<$,$>:-fopenmp-simd>") endif() endif() @@ -178,15 +164,13 @@ if(LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "e2k") "-Wno-sign-compare" "-Wno-bad-return-value-type" "-Wno-maybe-uninitialized") - check_c_compiler_flag(${TEST_C_FLAG} - C_COMPILER_SUPPORTS_FLAG_${TEST_C_FLAG}) + check_c_compiler_flag(${TEST_C_FLAG} C_COMPILER_SUPPORTS_FLAG_${TEST_C_FLAG}) if(C_COMPILER_SUPPORTS_FLAG_${TEST_C_FLAG}) set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} ${TEST_C_FLAG}) endif() endforeach() foreach(TEST_CXX_FLAG "-Wno-invalid-offsetof" "-Wno-maybe-uninitialized") - check_cxx_compiler_flag(${TEST_CXX_FLAG} - CXX_COMPILER_SUPPORTS_FLAG_${TEST_CXX_FLAG}) + check_cxx_compiler_flag(${TEST_CXX_FLAG} CXX_COMPILER_SUPPORTS_FLAG_${TEST_CXX_FLAG}) if(CXX_COMPILER_SUPPORTS_FLAG_${TEST_CXX_FLAG}) set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${TEST_CXX_FLAG}) endif() diff --git a/cmake/Modules/CopyMSVCBins.cmake b/cmake/Modules/CopyMSVCBins.cmake index fe8217be9..60e896386 100644 --- a/cmake/Modules/CopyMSVCBins.cmake +++ b/cmake/Modules/CopyMSVCBins.cmake @@ -89,13 +89,9 @@ file( "${FFMPEG_avcodec_INCLUDE_DIR}/bin${_bin_suffix}/libbz2*.dll" "${FFMPEG_avcodec_INCLUDE_DIR}/bin${_bin_suffix}/zlib*.dll") -file( - GLOB - X264_BIN_FILES - "${X264_INCLUDE_DIR}/../bin${_bin_suffix}/libx264-*.dll" - "${X264_INCLUDE_DIR}/../bin/libx264-*.dll" - "${X264_INCLUDE_DIR}/bin/libx264-*.dll" - "${X264_INCLUDE_DIR}/bin${_bin_suffix}/libx264-*.dll") +file(GLOB X264_BIN_FILES "${X264_INCLUDE_DIR}/../bin${_bin_suffix}/libx264-*.dll" + "${X264_INCLUDE_DIR}/../bin/libx264-*.dll" "${X264_INCLUDE_DIR}/bin/libx264-*.dll" + "${X264_INCLUDE_DIR}/bin${_bin_suffix}/libx264-*.dll") file( GLOB @@ -111,13 +107,9 @@ file( "${FREETYPE_INCLUDE_DIR_ft2build}/../bin${_bin_suffix}/freetype.dll" "${FREETYPE_INCLUDE_DIR_ft2build}/../bin/freetype.dll") -file( - GLOB - LIBFDK_BIN_FILES - "${Libfdk_INCLUDE_DIR}/../bin${_bin_suffix}/libfdk*-*.dll" - "${Libfdk_INCLUDE_DIR}/../bin/libfdk*-*.dll" - "${Libfdk_INCLUDE_DIR}/bin/libfdk*-*.dll" - "${Libfdk_INCLUDE_DIR}/bin${_bin_suffix}/libfdk*-*.dll") +file(GLOB LIBFDK_BIN_FILES "${Libfdk_INCLUDE_DIR}/../bin${_bin_suffix}/libfdk*-*.dll" + "${Libfdk_INCLUDE_DIR}/../bin/libfdk*-*.dll" "${Libfdk_INCLUDE_DIR}/bin/libfdk*-*.dll" + "${Libfdk_INCLUDE_DIR}/bin${_bin_suffix}/libfdk*-*.dll") file( GLOB @@ -132,8 +124,7 @@ file( "${SSL_INCLUDE_DIR}/bin/libeay32*.dll") if(NOT DEFINED CURL_INCLUDE_DIR AND TARGET CURL::libcurl) - get_target_property(CURL_INCLUDE_DIR CURL::libcurl - INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(CURL_INCLUDE_DIR CURL::libcurl INTERFACE_INCLUDE_DIRECTORIES) endif() file( @@ -166,17 +157,11 @@ endif() file(GLOB ZLIB_BIN_FILES "${ZLIB_BIN_PATH}/zlib*.dll") if(NOT ZLIB_BIN_FILES) - file( - GLOB - ZLIB_BIN_FILES - "${ZLIB_INCLUDE_DIR}/../bin${_bin_suffix}/zlib*.dll" - "${ZLIB_INCLUDE_DIR}/../bin/zlib*.dll" - "${ZLIB_INCLUDE_DIR}/bin${_bin_suffix}/zlib*.dll" - "${ZLIB_INCLUDE_DIR}/bin/zlib*.dll") + file(GLOB ZLIB_BIN_FILES "${ZLIB_INCLUDE_DIR}/../bin${_bin_suffix}/zlib*.dll" "${ZLIB_INCLUDE_DIR}/../bin/zlib*.dll" + "${ZLIB_INCLUDE_DIR}/bin${_bin_suffix}/zlib*.dll" "${ZLIB_INCLUDE_DIR}/bin/zlib*.dll") endif() -file(GLOB RNNOISE_BIN_FILES - "${RNNOISE_INCLUDE_DIR}/../bin${_bin_suffix}/rnnoise*.dll" +file(GLOB RNNOISE_BIN_FILES "${RNNOISE_INCLUDE_DIR}/../bin${_bin_suffix}/rnnoise*.dll" "${RNNOISE_INCLUDE_DIR}/../bin/rnnoise*.dll") set(QtCore_DIR "${Qt${_QT_VERSION}Core_DIR}") @@ -198,18 +183,11 @@ file( "${QtCore_BIN_DIR}/Qt${_QT_VERSION}Networkd.dll" "${QtCore_BIN_DIR}/libGLESv2d.dll" "${QtCore_BIN_DIR}/libEGLd.dll") -file(GLOB QT_DEBUG_PLAT_BIN_FILES - "${QtCore_PLUGIN_DIR}/platforms/qwindowsd.dll") -file(GLOB QT_DEBUG_STYLES_BIN_FILES - "${QtCore_PLUGIN_DIR}/styles/qwindowsvistastyled.dll") -file(GLOB QT_DEBUG_ICONENGINE_BIN_FILES - "${QtCore_PLUGIN_DIR}/iconengines/qsvgicond.dll") -file( - GLOB - QT_DEBUG_IMAGEFORMATS_BIN_FILES - "${QtCore_PLUGIN_DIR}/imageformats/qsvgd.dll" - "${QtCore_PLUGIN_DIR}/imageformats/qgifd.dll" - "${QtCore_PLUGIN_DIR}/imageformats/qjpegd.dll") +file(GLOB QT_DEBUG_PLAT_BIN_FILES "${QtCore_PLUGIN_DIR}/platforms/qwindowsd.dll") +file(GLOB QT_DEBUG_STYLES_BIN_FILES "${QtCore_PLUGIN_DIR}/styles/qwindowsvistastyled.dll") +file(GLOB QT_DEBUG_ICONENGINE_BIN_FILES "${QtCore_PLUGIN_DIR}/iconengines/qsvgicond.dll") +file(GLOB QT_DEBUG_IMAGEFORMATS_BIN_FILES "${QtCore_PLUGIN_DIR}/imageformats/qsvgd.dll" + "${QtCore_PLUGIN_DIR}/imageformats/qgifd.dll" "${QtCore_PLUGIN_DIR}/imageformats/qjpegd.dll") file( GLOB @@ -224,14 +202,10 @@ file( "${QtCore_BIN_DIR}/libGLESv2.dll" "${QtCore_BIN_DIR}/libEGL.dll") file(GLOB QT_PLAT_BIN_FILES "${QtCore_PLUGIN_DIR}/platforms/qwindows.dll") -file(GLOB QT_STYLES_BIN_FILES - "${QtCore_PLUGIN_DIR}/styles/qwindowsvistastyle.dll") -file(GLOB QT_ICONENGINE_BIN_FILES - "${QtCore_PLUGIN_DIR}/iconengines/qsvgicon.dll") -file( - GLOB QT_IMAGEFORMATS_BIN_FILES "${QtCore_PLUGIN_DIR}/imageformats/qsvg.dll" - "${QtCore_PLUGIN_DIR}/imageformats/qgif.dll" - "${QtCore_PLUGIN_DIR}/imageformats/qjpeg.dll") +file(GLOB QT_STYLES_BIN_FILES "${QtCore_PLUGIN_DIR}/styles/qwindowsvistastyle.dll") +file(GLOB QT_ICONENGINE_BIN_FILES "${QtCore_PLUGIN_DIR}/iconengines/qsvgicon.dll") +file(GLOB QT_IMAGEFORMATS_BIN_FILES "${QtCore_PLUGIN_DIR}/imageformats/qsvg.dll" + "${QtCore_PLUGIN_DIR}/imageformats/qgif.dll" "${QtCore_PLUGIN_DIR}/imageformats/qjpeg.dll") file(GLOB QT_ICU_BIN_FILES "${QtCore_BIN_DIR}/icu*.dll") @@ -302,8 +276,7 @@ obs_status(STATUS "Qt Debug files: ${QT_DEBUG_BIN_FILES}") obs_status(STATUS "Qt Debug Platform files: ${QT_DEBUG_PLAT_BIN_FILES}") obs_status(STATUS "Qt Debug Styles files: ${QT_DEBUG_STYLES_BIN_FILES}") obs_status(STATUS "Qt Debug Iconengine files: ${QT_DEBUG_ICONENGINE_BIN_FILES}") -obs_status(STATUS - "Qt Debug Imageformat files: ${QT_DEBUG_IMAGEFORMATS_BIN_FILES}") +obs_status(STATUS "Qt Debug Imageformat files: ${QT_DEBUG_IMAGEFORMATS_BIN_FILES}") obs_status(STATUS "Qt Release files: ${QT_BIN_FILES}") obs_status(STATUS "Qt Release Platform files: ${QT_PLAT_BIN_FILES}") obs_status(STATUS "Qt Release Styles files: ${QT_STYLES_BIN_FILES}") @@ -312,166 +285,80 @@ obs_status(STATUS "Qt Release Imageformat files: ${QT_IMAGEFORMATS_BIN_FILES}") obs_status(STATUS "Qt ICU files: ${QT_ICU_BIN_FILES}") foreach(BinFile ${ALL_BASE_BIN_FILES}) - obs_status( - STATUS - "copying ${BinFile} to ${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}" - ) - file( - COPY "${BinFile}" - DESTINATION - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/") + obs_status(STATUS "copying ${BinFile} to ${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}") + file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/") endforeach() foreach(BinFile ${ALL_REL_BIN_FILES}) - obs_status( - STATUS - "copying ${BinFile} to ${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r" - ) - file( - COPY "${BinFile}" - DESTINATION - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/") + obs_status(STATUS "copying ${BinFile} to ${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r") + file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/") endforeach() foreach(BinFile ${ALL_DBG_BIN_FILES}) - obs_status( - STATUS - "copying ${BinFile} to ${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d" - ) - file( - COPY "${BinFile}" - DESTINATION - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/") + obs_status(STATUS "copying ${BinFile} to ${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d") + file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/") endforeach() foreach(BinFile ${ALL_PLATFORM_BIN_FILES}) - make_directory( - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/platforms") - file( - COPY "${BinFile}" - DESTINATION - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/platforms/" - ) + make_directory("${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/platforms") + file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/platforms/") endforeach() foreach(BinFile ${ALL_PLATFORM_REL_BIN_FILES}) - make_directory( - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/platforms" - ) - file( - COPY "${BinFile}" - DESTINATION - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/platforms/" - ) + make_directory("${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/platforms") + file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/platforms/") endforeach() foreach(BinFile ${ALL_PLATFORM_DBG_BIN_FILES}) - make_directory( - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/platforms" - ) - file( - COPY "${BinFile}" - DESTINATION - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/platforms/" - ) + make_directory("${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/platforms") + file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/platforms/") endforeach() foreach(BinFile ${ALL_STYLES_BIN_FILES}) - make_directory( - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/styles") - file( - COPY "${BinFile}" - DESTINATION - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/styles/") + make_directory("${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/styles") + file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/styles/") endforeach() foreach(BinFile ${ALL_STYLES_REL_BIN_FILES}) - make_directory( - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/styles") - file( - COPY "${BinFile}" - DESTINATION - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/styles/" - ) + make_directory("${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/styles") + file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/styles/") endforeach() foreach(BinFile ${ALL_STYLES_DBG_BIN_FILES}) - make_directory( - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/styles") - file( - COPY "${BinFile}" - DESTINATION - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/styles/" - ) + make_directory("${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/styles") + file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/styles/") endforeach() foreach(BinFile ${ALL_ICONENGINE_BIN_FILES}) - make_directory( - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/iconengines" - ) - file( - COPY "${BinFile}" - DESTINATION - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/iconengines/" - ) + make_directory("${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/iconengines") + file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/iconengines/") endforeach() foreach(BinFile ${ALL_ICONENGINE_REL_BIN_FILES}) - make_directory( - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/iconengines" - ) - file( - COPY "${BinFile}" - DESTINATION - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/iconengines/" - ) + make_directory("${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/iconengines") + file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/iconengines/") endforeach() foreach(BinFile ${ALL_ICONENGINE_DBG_BIN_FILES}) - make_directory( - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/iconengines" - ) - file( - COPY "${BinFile}" - DESTINATION - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/iconengines/" - ) + make_directory("${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/iconengines") + file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/iconengines/") endforeach() foreach(BinFile ${ALL_IMAGEFORMATS_BIN_FILES}) - make_directory( - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/imageformats" - ) - file( - COPY "${BinFile}" - DESTINATION - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/imageformats/" - ) + make_directory("${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/imageformats") + file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/imageformats/") endforeach() foreach(BinFile ${ALL_IMAGEFORMATS_REL_BIN_FILES}) - make_directory( - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/imageformats" - ) - file( - COPY "${BinFile}" - DESTINATION - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/imageformats/" - ) + make_directory("${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/imageformats") + file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/imageformats/") endforeach() foreach(BinFile ${ALL_IMAGEFORMATS_DBG_BIN_FILES}) - make_directory( - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/imageformats" - ) - file( - COPY "${BinFile}" - DESTINATION - "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/imageformats/" - ) + make_directory("${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/imageformats") + file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/imageformats/") endforeach() set(COPIED_DEPENDENCIES TRUE - CACHE BOOL "Dependencies have been copied, set to false to copy again" - FORCE) + CACHE BOOL "Dependencies have been copied, set to false to copy again" FORCE) diff --git a/cmake/Modules/DeprecationHelpers.cmake b/cmake/Modules/DeprecationHelpers.cmake index f17503b4b..6d1f8d9ed 100644 --- a/cmake/Modules/DeprecationHelpers.cmake +++ b/cmake/Modules/DeprecationHelpers.cmake @@ -155,16 +155,14 @@ endfunction() function(install_obs_plugin) obs_status( DEPRECATION - "The install_obs_plugin command is deprecated and will be removed soon. Use 'setup_plugin_target' instead." - ) + "The install_obs_plugin command is deprecated and will be removed soon. Use 'setup_plugin_target' instead.") _install_obs_plugin(${ARGV}) endfunction() function(install_obs_datatarget) obs_status( DEPRECATION - "The install_obs_datatarget function is deprecated and will be removed soon. Use 'setup_target_resources' instead." - ) + "The install_obs_datatarget function is deprecated and will be removed soon. Use 'setup_target_resources' instead.") _install_obs_datatarget(${ARGV}) endfunction() @@ -176,10 +174,7 @@ endfunction() function(__deprecated_feature VAR ACCESS) if(ACCESS STREQUAL "UNKNOWN_READ_ACCESS") - obs_status( - DEPRECATION - "The feature enabled by '${VAR}' is deprecated and will soon be removed from OBS." - ) + obs_status(DEPRECATION "The feature enabled by '${VAR}' is deprecated and will soon be removed from OBS.") endif() endfunction() diff --git a/cmake/Modules/FindAMF.cmake b/cmake/Modules/FindAMF.cmake index 46852f293..b67c31a26 100644 --- a/cmake/Modules/FindAMF.cmake +++ b/cmake/Modules/FindAMF.cmake @@ -48,12 +48,9 @@ if(EXISTS "${AMF_INCLUDE_DIR}/AMF/core/Version.h") file(STRINGS "${AMF_INCLUDE_DIR}/AMF/core/Version.h" _version_string REGEX "^.*VERSION_(MAJOR|MINOR|RELEASE|BUILD_NUM)[ \t]+[0-9]+[ \t]*$") - string(REGEX REPLACE ".*VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" _version_major - "${_version_string}") - string(REGEX REPLACE ".*VERSION_MINOR[ \t]+([0-9]+).*" "\\1" _version_minor - "${_version_string}") - string(REGEX REPLACE ".*VERSION_RELEASE[ \t]+([0-9]+).*" "\\1" - _version_release "${_version_string}") + string(REGEX REPLACE ".*VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" _version_major "${_version_string}") + string(REGEX REPLACE ".*VERSION_MINOR[ \t]+([0-9]+).*" "\\1" _version_minor "${_version_string}") + string(REGEX REPLACE ".*VERSION_RELEASE[ \t]+([0-9]+).*" "\\1" _version_release "${_version_string}") set(AMF_VERSION "${_version_major}.${_version_minor}.${_version_release}") unset(_version_major) @@ -67,11 +64,9 @@ else() endif() if(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin|Windows") - set(AMF_ERROR_REASON - "Ensure that obs-deps is provided as part of CMAKE_PREFIX_PATH.") + set(AMF_ERROR_REASON "Ensure that obs-deps is provided as part of CMAKE_PREFIX_PATH.") elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|FreeBSD") - set(AMF_ERROR_REASON - "Ensure AMF headers are available in local library paths.") + set(AMF_ERROR_REASON "Ensure AMF headers are available in local library paths.") endif() find_package_handle_standard_args( @@ -84,8 +79,7 @@ unset(AMF_ERROR_REASON) if(AMF_FOUND) if(NOT TARGET AMF::AMF) add_library(AMF::AMF INTERFACE IMPORTED) - set_target_properties(AMF::AMF PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${AMF_INCLUDE_DIR}") + set_target_properties(AMF::AMF PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${AMF_INCLUDE_DIR}") endif() endif() diff --git a/cmake/Modules/FindAsio.cmake b/cmake/Modules/FindAsio.cmake index ef2ca2e3c..78229f96c 100644 --- a/cmake/Modules/FindAsio.cmake +++ b/cmake/Modules/FindAsio.cmake @@ -53,19 +53,11 @@ find_path( if(PC_Asio_VERSION VERSION_GREATER 0) set(Asio_VERSION ${PC_Asio_VERSION}) elseif(EXISTS "${Asio_INCLUDE_DIR}/asio/version.hpp") - file( - STRINGS "${Asio_INCLUDE_DIR}/asio/version.hpp" _version_string - REGEX - "#define[ \t]+ASIO_VERSION[ \t]+[0-9]+[ \t]+\/\/[ \t][0-9]+\.[0-9]+\.[0-9]+" - ) + file(STRINGS "${Asio_INCLUDE_DIR}/asio/version.hpp" _version_string + REGEX "#define[ \t]+ASIO_VERSION[ \t]+[0-9]+[ \t]+\/\/[ \t][0-9]+\.[0-9]+\.[0-9]+") - string( - REGEX - REPLACE - "#define[ \t]+ASIO_VERSION[ \t]+[0-9]+[ \t]+\/\/[ \t]([0-9]+\.[0-9]+\.[0-9]+)" - "\\1" - Asio_VERSION - "${_version_string}") + string(REGEX REPLACE "#define[ \t]+ASIO_VERSION[ \t]+[0-9]+[ \t]+\/\/[ \t]([0-9]+\.[0-9]+\.[0-9]+)" "\\1" + Asio_VERSION "${_version_string}") else() if(NOT Asio_FIND_QUIETLY) message(AUTHOR_WARNING "Failed to find Asio version.") @@ -74,11 +66,9 @@ else() endif() if(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin|Windows") - set(Asio_ERROR_REASON - "Ensure that obs-deps is provided as part of CMAKE_PREFIX_PATH.") + set(Asio_ERROR_REASON "Ensure that obs-deps is provided as part of CMAKE_PREFIX_PATH.") elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|FreeBSD") - set(Asio_ERROR_REASON - "Ensure Asio library is available in local include paths.") + set(Asio_ERROR_REASON "Ensure Asio library is available in local include paths.") endif() find_package_handle_standard_args( @@ -91,8 +81,7 @@ unset(Asio_ERROR_REASON) if(Asio_FOUND) if(NOT TARGET Asio::Asio) add_library(Asio::Asio INTERFACE IMPORTED) - set_target_properties(Asio::Asio PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${Asio_INCLUDE_DIR}") + set_target_properties(Asio::Asio PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Asio_INCLUDE_DIR}") endif() endif() diff --git a/cmake/Modules/FindCEF.cmake b/cmake/Modules/FindCEF.cmake index 3c4da4706..e39a5ed97 100644 --- a/cmake/Modules/FindCEF.cmake +++ b/cmake/Modules/FindCEF.cmake @@ -8,8 +8,7 @@ if(NOT DEFINED CEF_ROOT_DIR OR CEF_ROOT_DIR STREQUAL "") message( FATAL_ERROR "CEF_ROOT_DIR is not set - if ENABLE_BROWSER is enabled, a CEF distribution with compiled wrapper library is required.\n" - "Please download a CEF distribution for your appropriate architecture and specify CEF_ROOT_DIR to its location" - ) + "Please download a CEF distribution for your appropriate architecture and specify CEF_ROOT_DIR to its location") endif() find_path(CEF_INCLUDE_DIR "include/cef_version.h" HINTS ${CEF_ROOT_DIR}) @@ -25,10 +24,8 @@ if(OS_MACOS) CEFWRAPPER_LIBRARY NAMES cef_dll_wrapper libcef_dll_wrapper NO_DEFAULT_PATH - PATHS ${CEF_ROOT_DIR}/build/libcef_dll/Release - ${CEF_ROOT_DIR}/build/libcef_dll_wrapper/Release - ${CEF_ROOT_DIR}/build/libcef_dll - ${CEF_ROOT_DIR}/build/libcef_dll_wrapper) + PATHS ${CEF_ROOT_DIR}/build/libcef_dll/Release ${CEF_ROOT_DIR}/build/libcef_dll_wrapper/Release + ${CEF_ROOT_DIR}/build/libcef_dll ${CEF_ROOT_DIR}/build/libcef_dll_wrapper) elseif(OS_POSIX) find_library( @@ -41,8 +38,7 @@ elseif(OS_POSIX) CEFWRAPPER_LIBRARY NAMES libcef_dll_wrapper.a NO_DEFAULT_PATH - PATHS ${CEF_ROOT_DIR}/build/libcef_dll_wrapper - ${CEF_ROOT_DIR}/libcef_dll_wrapper) + PATHS ${CEF_ROOT_DIR}/build/libcef_dll_wrapper ${CEF_ROOT_DIR}/libcef_dll_wrapper) else() find_library( @@ -53,43 +49,32 @@ else() find_library( CEFWRAPPER_LIBRARY NAMES cef_dll_wrapper libcef_dll_wrapper - PATHS ${CEF_ROOT_DIR}/build/libcef_dll/Release - ${CEF_ROOT_DIR}/build/libcef_dll_wrapper/Release - ${CEF_ROOT_DIR}/build/libcef_dll - ${CEF_ROOT_DIR}/build/libcef_dll_wrapper) + PATHS ${CEF_ROOT_DIR}/build/libcef_dll/Release ${CEF_ROOT_DIR}/build/libcef_dll_wrapper/Release + ${CEF_ROOT_DIR}/build/libcef_dll ${CEF_ROOT_DIR}/build/libcef_dll_wrapper) if(OS_WINDOWS) find_library( CEFWRAPPER_LIBRARY_DEBUG NAMES cef_dll_wrapper libcef_dll_wrapper - PATHS ${CEF_ROOT_DIR}/build/libcef_dll/Debug - ${CEF_ROOT_DIR}/build/libcef_dll_wrapper/Debug) + PATHS ${CEF_ROOT_DIR}/build/libcef_dll/Debug ${CEF_ROOT_DIR}/build/libcef_dll_wrapper/Debug) endif() endif() mark_as_advanced(CEFWRAPPER_LIBRARY CEFWRAPPER_LIBRARY_DEBUG) if(NOT CEF_LIBRARY) - message( - WARNING - "Could NOT find Chromium Embedded Framework library (missing: CEF_LIBRARY)" - ) + message(WARNING "Could NOT find Chromium Embedded Framework library (missing: CEF_LIBRARY)") set(CEF_FOUND FALSE) return() endif() if(NOT CEFWRAPPER_LIBRARY) - message( - WARNING - "Could NOT find Chromium Embedded Framework wrapper library (missing: CEFWRAPPER_LIBRARY)" - ) + message(WARNING "Could NOT find Chromium Embedded Framework wrapper library (missing: CEFWRAPPER_LIBRARY)") set(CEF_FOUND FALSE) return() endif() -message( - STATUS - "Found Chromium Embedded Framework: ${CEF_LIBRARY};${CEF_WRAPPER_LIBRARY}") +message(STATUS "Found Chromium Embedded Framework: ${CEF_LIBRARY};${CEF_WRAPPER_LIBRARY}") if(OS_WINDOWS) set(CEF_LIBRARIES ${CEF_LIBRARY} ${CEFWRAPPER_LIBRARY}) @@ -108,8 +93,7 @@ else() endif() endif() -find_package_handle_standard_args(CEF DEFAULT_MSG CEF_LIBRARY - CEFWRAPPER_LIBRARY CEF_INCLUDE_DIR) +find_package_handle_standard_args(CEF DEFAULT_MSG CEF_LIBRARY CEFWRAPPER_LIBRARY CEF_INCLUDE_DIR) mark_as_advanced(CEF_LIBRARY CEF_WRAPPER_LIBRARY CEF_LIBRARIES CEF_INCLUDE_DIR) @@ -118,35 +102,27 @@ if(NOT TARGET CEF::Wrapper) add_library(CEF::Wrapper UNKNOWN IMPORTED) add_library(CEF::Library UNKNOWN IMPORTED) - set_target_properties(CEF::Wrapper PROPERTIES IMPORTED_LOCATION - ${CEFWRAPPER_LIBRARY}) + set_target_properties(CEF::Wrapper PROPERTIES IMPORTED_LOCATION ${CEFWRAPPER_LIBRARY}) - set_target_properties(CEF::Library PROPERTIES IMPORTED_LOCATION - ${CEF_LIBRARY}) + set_target_properties(CEF::Library PROPERTIES IMPORTED_LOCATION ${CEF_LIBRARY}) if(DEFINED CEFWRAPPER_LIBRARY_DEBUG) - set_target_properties(CEF::Wrapper PROPERTIES IMPORTED_LOCATION_DEBUG - ${CEFWRAPPER_LIBRARY_DEBUG}) + set_target_properties(CEF::Wrapper PROPERTIES IMPORTED_LOCATION_DEBUG ${CEFWRAPPER_LIBRARY_DEBUG}) endif() else() add_library(CEF::Wrapper INTERFACE IMPORTED) add_library(CEF::Library INTERFACE IMPORTED) - set_target_properties(CEF::Wrapper PROPERTIES IMPORTED_LIBNAME - ${CEFWRAPPER_LIBRARY}) + set_target_properties(CEF::Wrapper PROPERTIES IMPORTED_LIBNAME ${CEFWRAPPER_LIBRARY}) - set_target_properties(CEF::Library PROPERTIES IMPORTED_LIBNAME - ${CEF_LIBRARY}) + set_target_properties(CEF::Library PROPERTIES IMPORTED_LIBNAME ${CEF_LIBRARY}) if(DEFINED CEFWRAPPER_LIBRARY_DEBUG) - set_target_properties(CEF::Wrapper PROPERTIES IMPORTED_LIBNAME_DEBUG - ${CEFWRAPPER_LIBRARY_DEBUG}) + set_target_properties(CEF::Wrapper PROPERTIES IMPORTED_LIBNAME_DEBUG ${CEFWRAPPER_LIBRARY_DEBUG}) endif() endif() - set_target_properties(CEF::Wrapper PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${CEF_INCLUDE_DIR}") + set_target_properties(CEF::Wrapper PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CEF_INCLUDE_DIR}") - set_target_properties(CEF::Library PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${CEF_INCLUDE_DIR}") + set_target_properties(CEF::Library PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CEF_INCLUDE_DIR}") endif() diff --git a/cmake/Modules/FindDetours.cmake b/cmake/Modules/FindDetours.cmake index 1eb66e1c1..1c661c255 100644 --- a/cmake/Modules/FindDetours.cmake +++ b/cmake/Modules/FindDetours.cmake @@ -22,16 +22,14 @@ endif() find_path( DETOURS_INCLUDE_DIR NAMES detours.h - HINTS ENV DETOURS_PATH ${DETOURS_PATH} ${CMAKE_SOURCE_DIR}/${DETOURS_PATH} - ${_DETOURS_INCLUDE_DIRS} + HINTS ENV DETOURS_PATH ${DETOURS_PATH} ${CMAKE_SOURCE_DIR}/${DETOURS_PATH} ${_DETOURS_INCLUDE_DIRS} PATHS /usr/include /usr/local/include /opt/local/include /sw/include PATH_SUFFIXES include) find_library( DETOURS_LIB NAMES ${_DETOURS_LIBRARIES} detours - HINTS ENV DETOURS_PATH ${DETOURS_PATH} ${CMAKE_SOURCE_DIR}/${DETOURS_PATH} - ${_DETOURS_LIBRARY_DIRS} + HINTS ENV DETOURS_PATH ${DETOURS_PATH} ${CMAKE_SOURCE_DIR}/${DETOURS_PATH} ${_DETOURS_LIBRARY_DIRS} PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib PATH_SUFFIXES lib${_lib_suffix} @@ -48,8 +46,7 @@ find_library( ../bin) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Detours DEFAULT_MSG DETOURS_LIB - DETOURS_INCLUDE_DIR) +find_package_handle_standard_args(Detours DEFAULT_MSG DETOURS_LIB DETOURS_INCLUDE_DIR) mark_as_advanced(DETOURS_INCLUDE_DIR DETOURS_LIB) if(DETOURS_FOUND) @@ -59,17 +56,13 @@ if(DETOURS_FOUND) if(NOT TARGET Detours::Detours) if(IS_ABSOLUTE "${DETOURS_LIBRARIES}") add_library(Detours::Detours UNKNOWN IMPORTED) - set_target_properties(Detours::Detours PROPERTIES IMPORTED_LOCATION - "${DETOURS_LIBRARIES}") + set_target_properties(Detours::Detours PROPERTIES IMPORTED_LOCATION "${DETOURS_LIBRARIES}") else() add_library(Detours::Detours INTERFACE IMPORTED) - set_target_properties(Detours::Detours PROPERTIES IMPORTED_LIBNAME - "${DETOURS_LIBRARIES}") + set_target_properties(Detours::Detours PROPERTIES IMPORTED_LIBNAME "${DETOURS_LIBRARIES}") endif() - set_target_properties( - Detours::Detours PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${DETOURS_INCLUDE_DIRS}") + set_target_properties(Detours::Detours PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${DETOURS_INCLUDE_DIRS}") endif() endif() diff --git a/cmake/Modules/FindFFmpeg.cmake b/cmake/Modules/FindFFmpeg.cmake index 3bd89af67..6c78827b7 100644 --- a/cmake/Modules/FindFFmpeg.cmake +++ b/cmake/Modules/FindFFmpeg.cmake @@ -1,3 +1,4 @@ +# cmake-format: off # # This module defines the following variables: # @@ -17,6 +18,7 @@ # FFMPEG__VERSION_MICRO - The components micro version # # is the uppercase name of the component +# cmake-format: on find_package(PkgConfig QUIET) @@ -42,16 +44,14 @@ function(find_ffmpeg_library component header) find_path( FFMPEG_${component}_INCLUDE_DIR NAMES "lib${component}/${header}" "lib${component}/version.h" - HINTS ENV FFMPEG_PATH ${FFMPEG_PATH} ${CMAKE_SOURCE_DIR}/${FFMPEG_PATH} - ${PC_FFMPEG_${component}_INCLUDE_DIRS} + HINTS ENV FFMPEG_PATH ${FFMPEG_PATH} ${CMAKE_SOURCE_DIR}/${FFMPEG_PATH} ${PC_FFMPEG_${component}_INCLUDE_DIRS} PATHS /usr/include /usr/local/include /opt/local/include /sw/include PATH_SUFFIXES ffmpeg libav include) find_library( FFMPEG_${component}_LIBRARY NAMES "${component}" "lib${component}" - HINTS ENV FFMPEG_PATH ${FFMPEG_PATH} ${CMAKE_SOURCE_DIR}/${FFMPEG_PATH} - ${PC_FFMPEG_${component}_LIBRARY_DIRS} + HINTS ENV FFMPEG_PATH ${FFMPEG_PATH} ${CMAKE_SOURCE_DIR}/${FFMPEG_PATH} ${PC_FFMPEG_${component}_LIBRARY_DIRS} PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib PATH_SUFFIXES lib${_lib_suffix} @@ -102,14 +102,10 @@ function(find_ffmpeg_library component header) set(_vfile "${FFMPEG_${component}_INCLUDE_DIR}/lib${component}/version.h") if(EXISTS "${_vfile}") - file(STRINGS "${_vfile}" _version_parse - REGEX "^.*VERSION_(MAJOR|MINOR|MICRO)[ \t]+[0-9]+[ \t]*$") - string(REGEX REPLACE ".*VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" _major - "${_version_parse}") - string(REGEX REPLACE ".*VERSION_MINOR[ \t]+([0-9]+).*" "\\1" _minor - "${_version_parse}") - string(REGEX REPLACE ".*VERSION_MICRO[ \t]+([0-9]+).*" "\\1" _micro - "${_version_parse}") + file(STRINGS "${_vfile}" _version_parse REGEX "^.*VERSION_(MAJOR|MINOR|MICRO)[ \t]+[0-9]+[ \t]*$") + string(REGEX REPLACE ".*VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" _major "${_version_parse}") + string(REGEX REPLACE ".*VERSION_MINOR[ \t]+([0-9]+).*" "\\1" _minor "${_version_parse}") + string(REGEX REPLACE ".*VERSION_MICRO[ \t]+([0-9]+).*" "\\1" _micro "${_version_parse}") set(FFMPEG_${component_u}_VERSION_MAJOR "${_major}" @@ -168,8 +164,7 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args( FFmpeg FOUND_VAR FFMPEG_FOUND - REQUIRED_VARS FFMPEG_${_first_comp}_LIBRARIES - FFMPEG_${_first_comp}_INCLUDE_DIRS + REQUIRED_VARS FFMPEG_${_first_comp}_LIBRARIES FFMPEG_${_first_comp}_INCLUDE_DIRS VERSION_VAR FFMPEG_${_first_comp}_VERSION_STRING HANDLE_COMPONENTS) @@ -180,20 +175,14 @@ if(FFMPEG_FOUND) if(FFMPEG_${component_u}_FOUND) if(IS_ABSOLUTE "${FFMPEG_${component_u}_LIBRARIES}") add_library(FFmpeg::${component} UNKNOWN IMPORTED) - set_target_properties( - FFmpeg::${component} - PROPERTIES IMPORTED_LOCATION "${FFMPEG_${component_u}_LIBRARIES}") + set_target_properties(FFmpeg::${component} PROPERTIES IMPORTED_LOCATION "${FFMPEG_${component_u}_LIBRARIES}") else() add_library(FFmpeg::${component} INTERFACE IMPORTED) - set_target_properties( - FFmpeg::${component} - PROPERTIES IMPORTED_LIBNAME "${FFMPEG_${component_u}_LIBRARIES}") + set_target_properties(FFmpeg::${component} PROPERTIES IMPORTED_LIBNAME "${FFMPEG_${component_u}_LIBRARIES}") endif() - set_target_properties( - FFmpeg::${component} - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${FFMPEG_${component_u}_INCLUDE_DIRS}") + set_target_properties(FFmpeg::${component} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${FFMPEG_${component_u}_INCLUDE_DIRS}") endif() endif() endforeach() diff --git a/cmake/Modules/FindGio.cmake b/cmake/Modules/FindGio.cmake index 1f606185d..aa8d1d07d 100644 --- a/cmake/Modules/FindGio.cmake +++ b/cmake/Modules/FindGio.cmake @@ -1,3 +1,4 @@ +# cmake-format: off # * Try to find Gio Once done this will define # # GIO_FOUND - system has Gio GIO_INCLUDE_DIRS - the Gio include directory @@ -6,6 +7,7 @@ # Use pkg-config to get the directories and then use these values in the # find_path() and find_library() calls +# cmake-format: on find_package(PkgConfig QUIET) if(PKG_CONFIG_FOUND) @@ -36,17 +38,14 @@ if(GIO_FOUND) if(NOT TARGET GIO::GIO) if(IS_ABSOLUTE "${GIO_LIBRARIES}") add_library(GIO::GIO UNKNOWN IMPORTED) - set_target_properties(GIO::GIO PROPERTIES IMPORTED_LOCATION - "${GIO_LIBRARIES}") + set_target_properties(GIO::GIO PROPERTIES IMPORTED_LOCATION "${GIO_LIBRARIES}") else() add_library(GIO::GIO INTERFACE IMPORTED) - set_target_properties(GIO::GIO PROPERTIES IMPORTED_LIBNAME - "${GIO_LIBRARIES}") + set_target_properties(GIO::GIO PROPERTIES IMPORTED_LIBNAME "${GIO_LIBRARIES}") endif() # Special case for gio, as both the - set_target_properties(GIO::GIO PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${_GIO_INCLUDE_DIRS}") + set_target_properties(GIO::GIO PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_GIO_INCLUDE_DIRS}") target_compile_options(GIO::GIO INTERFACE ${_GIO_CFLAGS}) endif() diff --git a/cmake/Modules/FindJack.cmake b/cmake/Modules/FindJack.cmake index 80a49b47f..3ff3bd615 100644 --- a/cmake/Modules/FindJack.cmake +++ b/cmake/Modules/FindJack.cmake @@ -1,3 +1,4 @@ +# cmake-format: off # * Try to find jack-2.6 Once done this will define # # JACK_FOUND - system has jack JACK_INCLUDE_DIRS - the jack include directory @@ -10,13 +11,13 @@ # Redistribution and use is allowed according to the terms of the New BSD # license. For details see the accompanying COPYING-CMAKE-SCRIPTS file. # +# cmake-format: on if(JACK_LIBRARIES AND JACK_INCLUDE_DIRS) # in cache already set(JACK_FOUND TRUE) else(JACK_LIBRARIES AND JACK_INCLUDE_DIRS) - # use pkg-config to get the directories and then use these values in the - # FIND_PATH() and FIND_LIBRARY() calls + # use pkg-config to get the directories and then use these values in the FIND_PATH() and FIND_LIBRARY() calls if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) include(UsePkgConfig) pkgconfig(jack _JACK_INCLUDEDIR _JACK_LIBDIR _JACK_LDFLAGS _JACK_CFLAGS) @@ -29,8 +30,7 @@ else(JACK_LIBRARIES AND JACK_INCLUDE_DIRS) find_path( JACK_INCLUDE_DIR NAMES jack/jack.h - PATHS ${_JACK_INCLUDE_DIRS} /usr/include /usr/local/include - /opt/local/include /sw/include) + PATHS ${_JACK_INCLUDE_DIRS} /usr/include /usr/local/include /opt/local/include /sw/include) find_library( JACK_LIBRARY @@ -54,16 +54,13 @@ else(JACK_LIBRARIES AND JACK_INCLUDE_DIRS) if(NOT TARGET Jack::Jack) if(IS_ABSOLUTE "${JACK_LIBRARIES}") add_library(Jack::Jack UNKNOWN IMPORTED) - set_target_properties(Jack::Jack PROPERTIES IMPORTED_LOCATION - "${JACK_LIBRARIES}") + set_target_properties(Jack::Jack PROPERTIES IMPORTED_LOCATION "${JACK_LIBRARIES}") else() add_library(Jack::Jack INTERFACE IMPORTED) - set_target_properties(Jack::Jack PROPERTIES IMPORTED_LIBNAME - "${JACK_LIBRARIES}") + set_target_properties(Jack::Jack PROPERTIES IMPORTED_LIBNAME "${JACK_LIBRARIES}") endif() - set_target_properties(Jack::Jack PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${JACK_INCLUDE_DIRS}") + set_target_properties(Jack::Jack PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${JACK_INCLUDE_DIRS}") endif() else(JACK_FOUND) if(JACK_FIND_REQUIRED) @@ -71,8 +68,7 @@ else(JACK_LIBRARIES AND JACK_INCLUDE_DIRS) endif(JACK_FIND_REQUIRED) endif(JACK_FOUND) - # show the JACK_INCLUDE_DIRS and JACK_LIBRARIES variables only in the advanced - # view + # show the JACK_INCLUDE_DIRS and JACK_LIBRARIES variables only in the advanced view mark_as_advanced(JACK_INCLUDE_DIRS JACK_LIBRARIES) endif(JACK_LIBRARIES AND JACK_INCLUDE_DIRS) diff --git a/cmake/Modules/FindJansson.cmake b/cmake/Modules/FindJansson.cmake index d310b084f..f3224f0e2 100644 --- a/cmake/Modules/FindJansson.cmake +++ b/cmake/Modules/FindJansson.cmake @@ -16,15 +16,13 @@ endif() find_path( Jansson_INCLUDE_DIR NAMES jansson.h - HINTS ENV JANSSON_PATH ${JANSSON_PATH} ${CMAKE_SOURCE_DIR}/${JANSSON_PATH} - ${_JANSSON_INCLUDE_DIRS} + HINTS ENV JANSSON_PATH ${JANSSON_PATH} ${CMAKE_SOURCE_DIR}/${JANSSON_PATH} ${_JANSSON_INCLUDE_DIRS} PATHS /usr/include /usr/local/include /opt/local/include /sw/include) find_library( Jansson_LIB NAMES ${_JANSSON_LIBRARIES} jansson libjansson - HINTS ENV JANSSON_PATH ${JANSSON_PATH} ${CMAKE_SOURCE_DIR}/${JANSSON_PATH} - ${_JANSSON_LIBRARY_DIRS} + HINTS ENV JANSSON_PATH ${JANSSON_PATH} ${CMAKE_SOURCE_DIR}/${JANSSON_PATH} ${_JANSSON_LIBRARY_DIRS} PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib PATH_SUFFIXES lib${_lib_suffix} @@ -45,10 +43,9 @@ if(JANSSON_VERSION) elseif(_JANSSON_FOUND AND _JANSSON_VERSION) set(_JANSSON_VERSION_STRING "${_JANSSON_VERSION}") elseif(EXISTS "${Jansson_INCLUDE_DIR}/jansson.h") - file(STRINGS "${Jansson_INCLUDE_DIR}/jansson.h" _jansson_version_parse - REGEX "#define[ \t]+JANSSON_VERSION[ \t]+.+") - string(REGEX REPLACE ".*#define[ \t]+JANSSON_VERSION[ \t]+\"(.+)\".*" "\\1" - _JANSSON_VERSION_STRING "${_jansson_version_parse}") + file(STRINGS "${Jansson_INCLUDE_DIR}/jansson.h" _jansson_version_parse REGEX "#define[ \t]+JANSSON_VERSION[ \t]+.+") + string(REGEX REPLACE ".*#define[ \t]+JANSSON_VERSION[ \t]+\"(.+)\".*" "\\1" _JANSSON_VERSION_STRING + "${_jansson_version_parse}") else() if(NOT Jansson_FIND_QUIETLY) message(WARNING "Failed to find Jansson version") @@ -72,16 +69,12 @@ if(JANSSON_FOUND) if(NOT TARGET Jansson::Jansson) if(IS_ABSOLUTE "${JANSSON_LIBRARIES}") add_library(Jansson::Jansson UNKNOWN IMPORTED GLOBAL) - set_target_properties(Jansson::Jansson PROPERTIES IMPORTED_LOCATION - "${JANSSON_LIBRARIES}") + set_target_properties(Jansson::Jansson PROPERTIES IMPORTED_LOCATION "${JANSSON_LIBRARIES}") else() add_library(Jansson::Jansson INTERFACE IMPORTED GLOBAL) - set_target_properties(Jansson::Jansson PROPERTIES IMPORTED_LIBNAME - "${JANSSON_LIBRARIES}") + set_target_properties(Jansson::Jansson PROPERTIES IMPORTED_LIBNAME "${JANSSON_LIBRARIES}") endif() - set_target_properties( - Jansson::Jansson PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${JANSSON_INCLUDE_DIRS}") + set_target_properties(Jansson::Jansson PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${JANSSON_INCLUDE_DIRS}") endif() endif() diff --git a/cmake/Modules/FindLibAJANTV2.cmake b/cmake/Modules/FindLibAJANTV2.cmake index feb15b5e5..3ce91deed 100644 --- a/cmake/Modules/FindLibAJANTV2.cmake +++ b/cmake/Modules/FindLibAJANTV2.cmake @@ -95,16 +95,14 @@ find_library( ../bin) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(LibAJANTV2 DEFAULT_MSG - AJA_LIBRARIES_INCLUDE_DIR AJA_NTV2_LIB) +find_package_handle_standard_args(LibAJANTV2 DEFAULT_MSG AJA_LIBRARIES_INCLUDE_DIR AJA_NTV2_LIB) mark_as_advanced(AJA_LIBRARIES_INCLUDE_DIR AJA_NTV2_LIB) if(LIBAJANTV2_FOUND) set(AJA_LIBRARIES_INCLUDE_DIR ${AJA_LIBRARIES_INCLUDE_DIR}/ajalibraries) set(AJA_LIBRARIES_INCLUDE_DIRS - ${AJA_LIBRARIES_INCLUDE_DIR} ${AJA_LIBRARIES_INCLUDE_DIR}/ajaanc - ${AJA_LIBRARIES_INCLUDE_DIR}/ajabase ${AJA_LIBRARIES_INCLUDE_DIR}/ajantv2 - ${AJA_LIBRARIES_INCLUDE_DIR}/ajantv2/includes) + ${AJA_LIBRARIES_INCLUDE_DIR} ${AJA_LIBRARIES_INCLUDE_DIR}/ajaanc ${AJA_LIBRARIES_INCLUDE_DIR}/ajabase + ${AJA_LIBRARIES_INCLUDE_DIR}/ajantv2 ${AJA_LIBRARIES_INCLUDE_DIR}/ajantv2/includes) set(LIBAJANTV2_LIBRARIES ${AJA_NTV2_LIB}) if(AJA_NTV2_DEBUG_LIB STREQUAL "AJA_NTV2_DEBUG_LIB-NOTFOUND") @@ -117,35 +115,26 @@ if(LIBAJANTV2_FOUND) if(NOT TARGET AJA::LibAJANTV2) if(IS_ABSOLUTE "${LIBAJANTV2_LIBRARIES}") add_library(AJA::LibAJANTV2 UNKNOWN IMPORTED) - set_target_properties( - AJA::LibAJANTV2 PROPERTIES IMPORTED_LOCATION "${LIBAJANTV2_LIBRARIES}") + set_target_properties(AJA::LibAJANTV2 PROPERTIES IMPORTED_LOCATION "${LIBAJANTV2_LIBRARIES}") if(DEFINED LIBAJANTV2_DEBUG_LIBRARIES) - set_target_properties( - AJA::LibAJANTV2 PROPERTIES IMPORTED_LOCATION_DEBUG - "${LIBAJANTV2_DEBUG_LIBRARIES}") + set_target_properties(AJA::LibAJANTV2 PROPERTIES IMPORTED_LOCATION_DEBUG "${LIBAJANTV2_DEBUG_LIBRARIES}") endif() else() add_library(AJA::LibAJANTV2 INTERFACE IMPORTED) - set_target_properties( - AJA::LibAJANTV2 PROPERTIES IMPORTED_LIBNAME "${LIBAJANTV2_LIBRARIES}") + set_target_properties(AJA::LibAJANTV2 PROPERTIES IMPORTED_LIBNAME "${LIBAJANTV2_LIBRARIES}") if(DEFINED LIBAJANTV2_DEBUG_LIBRARIES) - set_target_properties( - AJA::LibAJANTV2 PROPERTIES IMPORTED_LIBNAME_DEBUG - "${LIBAJANTV2_DEBUG_LIBRARIES}") + set_target_properties(AJA::LibAJANTV2 PROPERTIES IMPORTED_LIBNAME_DEBUG "${LIBAJANTV2_DEBUG_LIBRARIES}") endif() endif() - set_target_properties( - AJA::LibAJANTV2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${LIBAJANTV2_INCLUDE_DIRS}") + set_target_properties(AJA::LibAJANTV2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBAJANTV2_INCLUDE_DIRS}") target_compile_definitions( AJA::LibAJANTV2 INTERFACE "$<$:AJA_WINDOWS;_WINDOWS;WIN32;MSWindows>" "$<$,$>:_DEBUG;_NDEBUG>" - "$<$:AJAMac;AJA_MAC>" - "$<$:AJA_LINUX;AJALinux>") + "$<$:AJAMac;AJA_MAC>" "$<$:AJA_LINUX;AJALinux>") endif() endif() diff --git a/cmake/Modules/FindLibUUID.cmake b/cmake/Modules/FindLibUUID.cmake index 5e56f246c..2b28f9891 100644 --- a/cmake/Modules/FindLibUUID.cmake +++ b/cmake/Modules/FindLibUUID.cmake @@ -1,8 +1,8 @@ # Stripped down version of # https://gitlab.kitware.com/cmake/cmake/blob/e1409101c99f7a3487990e9927e8bd0e275f564f/Source/Modules/FindLibUUID.cmake # -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or +# https://cmake.org/licensing for details. # # Once done these will be defined: # @@ -26,9 +26,7 @@ if(LibUUID_FOUND) set(LibUUID_LIBRARIES ${LibUUID_LIBRARY}) if(NOT TARGET LibUUID::LibUUID) add_library(LibUUID::LibUUID UNKNOWN IMPORTED) - set_target_properties( - LibUUID::LibUUID - PROPERTIES IMPORTED_LOCATION "${LibUUID_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${LibUUID_INCLUDE_DIRS}") + set_target_properties(LibUUID::LibUUID PROPERTIES IMPORTED_LOCATION "${LibUUID_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${LibUUID_INCLUDE_DIRS}") endif() endif() diff --git a/cmake/Modules/FindLibVLC.cmake b/cmake/Modules/FindLibVLC.cmake index 38791cf00..63fbd64ea 100644 --- a/cmake/Modules/FindLibVLC.cmake +++ b/cmake/Modules/FindLibVLC.cmake @@ -17,16 +17,14 @@ endif() find_path( VLC_INCLUDE_DIR NAMES libvlc.h - HINTS ENV VLC_PATH ${VLC_PATH} ${CMAKE_SOURCE_DIR}/${VLC_PATH} - ${_VLC_INCLUDE_DIRS} + HINTS ENV VLC_PATH ${VLC_PATH} ${CMAKE_SOURCE_DIR}/${VLC_PATH} ${_VLC_INCLUDE_DIRS} PATHS /usr/include /usr/local/include /opt/local/include /sw/include PATH_SUFFIXES vlc include/vlc include) find_library( VLC_LIB NAMES ${_VLC_LIBRARIES} VLC libVLC - HINTS ENV VLC_PATH ${VLC_PATH} ${CMAKE_SOURCE_DIR}/${VLC_PATH} - ${_VLC_LIBRARY_DIRS} + HINTS ENV VLC_PATH ${VLC_PATH} ${CMAKE_SOURCE_DIR}/${VLC_PATH} ${_VLC_LIBRARY_DIRS} PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib PATH_SUFFIXES lib${_lib_suffix} @@ -53,7 +51,6 @@ if(LIBVLC_FOUND) if(NOT TARGET VLC::LibVLC) add_library(VLC::LibVLC INTERFACE IMPORTED) - set_target_properties(VLC::LibVLC PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${LIBVLC_INCLUDE_DIRS}") + set_target_properties(VLC::LibVLC PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBVLC_INCLUDE_DIRS}") endif() endif() diff --git a/cmake/Modules/FindLibdrm.cmake b/cmake/Modules/FindLibdrm.cmake index b23d8ffdc..56ea43e3a 100644 --- a/cmake/Modules/FindLibdrm.cmake +++ b/cmake/Modules/FindLibdrm.cmake @@ -20,8 +20,7 @@ find_library( PATHS /usr/lib /usr/local/lib /opt/local/lib) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Libdrm DEFAULT_MSG LIBDRM_LIB - LIBDRM_INCLUDE_DIR) +find_package_handle_standard_args(Libdrm DEFAULT_MSG LIBDRM_LIB LIBDRM_INCLUDE_DIR) mark_as_advanced(LIBDRM_INCLUDE_DIR LIBDRM_LIB) if(LIBDRM_FOUND) @@ -30,8 +29,6 @@ if(LIBDRM_FOUND) if(NOT TARGET Libdrm::Libdrm) add_library(Libdrm::Libdrm INTERFACE IMPORTED) - set_target_properties( - Libdrm::Libdrm PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${LIBDRM_INCLUDE_DIRS}") + set_target_properties(Libdrm::Libdrm PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBDRM_INCLUDE_DIRS}") endif() endif() diff --git a/cmake/Modules/FindLibfdk.cmake b/cmake/Modules/FindLibfdk.cmake index 924ed90f8..938cda185 100644 --- a/cmake/Modules/FindLibfdk.cmake +++ b/cmake/Modules/FindLibfdk.cmake @@ -20,16 +20,14 @@ endif() find_path( Libfdk_INCLUDE_DIR NAMES fdk-aac/aacenc_lib.h - HINTS ENV LIBFDK_PATH ${LIBFDK_PATH} ${CMAKE_SOURCE_DIR}/${LIBFDK_PATH} - ${_LIBFDK_INCLUDE_DIRS} + HINTS ENV LIBFDK_PATH ${LIBFDK_PATH} ${CMAKE_SOURCE_DIR}/${LIBFDK_PATH} ${_LIBFDK_INCLUDE_DIRS} PATHS /usr/include /usr/local/include /opt/local/include /sw/include PATH_SUFFIXES include) find_library( Libfdk_LIB NAMES ${_LIBFDK_LIBRARIES} fdk-aac libfdk-aac - HINTS ENV LIBFDK_PATH ${LIBFDK_PATH} ${CMAKE_SOURCE_DIR}/${LIBFDK_PATH} - ${_LIBFDK_LIBRARY_DIRS} + HINTS ENV LIBFDK_PATH ${LIBFDK_PATH} ${CMAKE_SOURCE_DIR}/${LIBFDK_PATH} ${_LIBFDK_LIBRARY_DIRS} PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib PATH_SUFFIXES lib${_lib_suffix} @@ -46,8 +44,7 @@ find_library( ../bin) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Libfdk DEFAULT_MSG Libfdk_LIB - Libfdk_INCLUDE_DIR) +find_package_handle_standard_args(Libfdk DEFAULT_MSG Libfdk_LIB Libfdk_INCLUDE_DIR) mark_as_advanced(Libfdk_INCLUDE_DIR Libfdk_LIB) if(LIBFDK_FOUND) @@ -57,17 +54,13 @@ if(LIBFDK_FOUND) if(NOT TARGET LibFDK::LibFDK) if(IS_ABSOLUTE "${LIBFDK_LIBRARIES}") add_library(LibFDK::LibFDK UNKNOWN IMPORTED) - set_target_properties(LibFDK::LibFDK PROPERTIES IMPORTED_LOCATION - "${LIBFDK_LIBRARIES}") + set_target_properties(LibFDK::LibFDK PROPERTIES IMPORTED_LOCATION "${LIBFDK_LIBRARIES}") else() add_library(LibFDK::LibFDK INTERFACE IMPORTED) - set_target_properties(LibFDK::LibFDK PROPERTIES IMPORTED_LIBNAME - "${LIBFDK_LIBRARIES}") + set_target_properties(LibFDK::LibFDK PROPERTIES IMPORTED_LIBNAME "${LIBFDK_LIBRARIES}") endif() - set_target_properties( - LibFDK::LibFDK PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${LIBFDK_INCLUDE_DIRS}") + set_target_properties(LibFDK::LibFDK PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBFDK_INCLUDE_DIRS}") endif() endif() diff --git a/cmake/Modules/FindLibpci.cmake b/cmake/Modules/FindLibpci.cmake index 09b0f26e9..cb7760c1d 100644 --- a/cmake/Modules/FindLibpci.cmake +++ b/cmake/Modules/FindLibpci.cmake @@ -1,3 +1,4 @@ +# cmake-format: off # * Try to find Libpci Once done this will define # # * LIBPCI_FOUND - system has Libpci @@ -7,6 +8,7 @@ # Use pkg-config to get the directories and then use these values in the # find_path() and find_library() calls +# cmake-format: on find_package(PkgConfig QUIET) if(PKG_CONFIG_FOUND) @@ -27,8 +29,7 @@ find_library( PATHS /usr/lib /usr/local/lib /opt/local/lib) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Libpci REQUIRED_VARS LIBPCI_LIB - LIBPCI_INCLUDE_DIR) +find_package_handle_standard_args(Libpci REQUIRED_VARS LIBPCI_LIB LIBPCI_INCLUDE_DIR) mark_as_advanced(LIBPCI_INCLUDE_DIR LIBPCI_LIB) if(LIBPCI_FOUND) @@ -38,12 +39,10 @@ if(LIBPCI_FOUND) if(NOT TARGET LIBPCI::LIBPCI) if(IS_ABSOLUTE "${LIBPCI_LIBRARIES}") add_library(LIBPCI::LIBPCI UNKNOWN IMPORTED) - set_target_properties(LIBPCI::LIBPCI PROPERTIES IMPORTED_LOCATION - "${LIBPCI_LIBRARIES}") + set_target_properties(LIBPCI::LIBPCI PROPERTIES IMPORTED_LOCATION "${LIBPCI_LIBRARIES}") else() add_library(LIBPCI::LIBPCI INTERFACE IMPORTED) - set_target_properties(LIBPCI::LIBPCI PROPERTIES IMPORTED_LIBNAME - "${LIBPCI_LIBRARIES}") + set_target_properties(LIBPCI::LIBPCI PROPERTIES IMPORTED_LIBNAME "${LIBPCI_LIBRARIES}") endif() endif() endif() diff --git a/cmake/Modules/FindLibrist.cmake b/cmake/Modules/FindLibrist.cmake index e46c20b1e..ddcb495b1 100644 --- a/cmake/Modules/FindLibrist.cmake +++ b/cmake/Modules/FindLibrist.cmake @@ -20,16 +20,14 @@ endif() find_path( LIBRIST_INCLUDE_DIR NAMES librist.h librist/librist.h - HINTS ENV LIBRIST_PATH ${LIBRIST_PATH} ${CMAKE_SOURCE_DIR}/${LIBRIST_PATH} - ${_LIBRIST_INCLUDE_DIRS} ${DepsPath} + HINTS ENV LIBRIST_PATH ${LIBRIST_PATH} ${CMAKE_SOURCE_DIR}/${LIBRIST_PATH} ${_LIBRIST_INCLUDE_DIRS} ${DepsPath} PATHS /usr/include /usr/local/include /opt/local/include /sw/include PATH_SUFFIXES include) find_library( LIBRIST_LIB NAMES ${_LIBRIST_LIBRARIES} librist rist - HINTS ENV LIBRIST_PATH ${LIBRIST_PATH} ${CMAKE_SOURCE_DIR}/${LIBRIST_PATH} - ${_LIBRIST_LIBRARY_DIRS} ${DepsPath} + HINTS ENV LIBRIST_PATH ${LIBRIST_PATH} ${CMAKE_SOURCE_DIR}/${LIBRIST_PATH} ${_LIBRIST_LIBRARY_DIRS} ${DepsPath} PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib PATH_SUFFIXES lib${_lib_suffix} @@ -46,8 +44,7 @@ find_library( ../bin) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Librist DEFAULT_MSG LIBRIST_LIB - LIBRIST_INCLUDE_DIR) +find_package_handle_standard_args(Librist DEFAULT_MSG LIBRIST_LIB LIBRIST_INCLUDE_DIR) mark_as_advanced(LIBRIST_INCLUDE_DIR LIBRIST_LIB) if(LIBRIST_FOUND) @@ -57,17 +54,13 @@ if(LIBRIST_FOUND) if(NOT TARGET Librist::Librist) if(IS_ABSOLUTE "${LIBRIST_LIBRARIES}") add_library(Librist::Librist UNKNOWN IMPORTED) - set_target_properties(Librist::Librist PROPERTIES IMPORTED_LOCATION - "${LIBRIST_LIBRARIES}") + set_target_properties(Librist::Librist PROPERTIES IMPORTED_LOCATION "${LIBRIST_LIBRARIES}") else() add_library(Librist::Librist INTERFACE IMPORTED) - set_target_properties(Librist::Librist PROPERTIES IMPORTED_LIBNAME - "${LIBRIST_LIBRARIES}") + set_target_properties(Librist::Librist PROPERTIES IMPORTED_LIBNAME "${LIBRIST_LIBRARIES}") endif() - set_target_properties( - Librist::Librist PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${LIBRIST_INCLUDE_DIRS}") + set_target_properties(Librist::Librist PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBRIST_INCLUDE_DIRS}") endif() else() message(STATUS "librist library not found") diff --git a/cmake/Modules/FindLibrnnoise.cmake b/cmake/Modules/FindLibrnnoise.cmake index dac39c731..9cf981236 100644 --- a/cmake/Modules/FindLibrnnoise.cmake +++ b/cmake/Modules/FindLibrnnoise.cmake @@ -20,16 +20,14 @@ endif() find_path( RNNOISE_INCLUDE_DIR NAMES rnnoise.h - HINTS ENV RNNOISE_PATH ${RNNOISE_PATH} ${CMAKE_SOURCE_DIR}/${RNNOISE_PATH} - ${_RNNOISE_INCLUDE_DIRS} + HINTS ENV RNNOISE_PATH ${RNNOISE_PATH} ${CMAKE_SOURCE_DIR}/${RNNOISE_PATH} ${_RNNOISE_INCLUDE_DIRS} PATHS /usr/include /usr/local/include /opt/local/include /sw/include PATH_SUFFIXES include) find_library( RNNOISE_LIB NAMES ${_RNNOISE_LIBRARIES} rnnoise - HINTS ENV RNNOISE_PATH ${RNNOISE_PATH} ${CMAKE_SOURCE_DIR}/${RNNOISE_PATH} - ${_RNNOISE_LIBRARY_DIRS} + HINTS ENV RNNOISE_PATH ${RNNOISE_PATH} ${CMAKE_SOURCE_DIR}/${RNNOISE_PATH} ${_RNNOISE_LIBRARY_DIRS} PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib PATH_SUFFIXES lib${_lib_suffix} @@ -46,8 +44,7 @@ find_library( ../bin) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Librnnoise DEFAULT_MSG RNNOISE_LIB - RNNOISE_INCLUDE_DIR) +find_package_handle_standard_args(Librnnoise DEFAULT_MSG RNNOISE_LIB RNNOISE_INCLUDE_DIR) mark_as_advanced(RNNOISE_INCLUDE_DIR RNNOISE_LIB) if(LIBRNNOISE_FOUND) @@ -57,18 +54,12 @@ if(LIBRNNOISE_FOUND) if(NOT TARGET Librnnoise::Librnnoise) if(IS_ABSOLUTE "${LIBRNNOISE_LIBRARIES}") add_library(Librnnoise::Librnnoise UNKNOWN IMPORTED) - set_target_properties( - Librnnoise::Librnnoise PROPERTIES IMPORTED_LOCATION - "${LIBRNNOISE_LIBRARIES}") + set_target_properties(Librnnoise::Librnnoise PROPERTIES IMPORTED_LOCATION "${LIBRNNOISE_LIBRARIES}") else() add_library(Librnnoise::Librnnoise INTERFACE IMPORTED) - set_target_properties( - Librnnoise::Librnnoise PROPERTIES IMPORTED_LIBNAME - "${LIBRNNOISE_LIBRARIES}") + set_target_properties(Librnnoise::Librnnoise PROPERTIES IMPORTED_LIBNAME "${LIBRNNOISE_LIBRARIES}") endif() - set_target_properties( - Librnnoise::Librnnoise PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${LIBRNNOISE_INCLUDE_DIRS}") + set_target_properties(Librnnoise::Librnnoise PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBRNNOISE_INCLUDE_DIRS}") endif() endif() diff --git a/cmake/Modules/FindLibspeexdsp.cmake b/cmake/Modules/FindLibspeexdsp.cmake index 447a0c4c4..817e2750f 100644 --- a/cmake/Modules/FindLibspeexdsp.cmake +++ b/cmake/Modules/FindLibspeexdsp.cmake @@ -20,16 +20,14 @@ endif() find_path( SPEEXDSP_INCLUDE_DIR NAMES speex/speex_preprocess.h - HINTS ENV SPEEX_PATH ${SPEEX_PATH} ${CMAKE_SOURCE_DIR}/${SPEEX_PATH} - ${_SPEEXDSP_INCLUDE_DIRS} + HINTS ENV SPEEX_PATH ${SPEEX_PATH} ${CMAKE_SOURCE_DIR}/${SPEEX_PATH} ${_SPEEXDSP_INCLUDE_DIRS} PATHS /usr/include /usr/local/include /opt/local/include /sw/include PATH_SUFFIXES include) find_library( SPEEXDSP_LIB NAMES ${_SPEEXDSP_LIBRARIES} speexdsp libspeexdsp - HINTS ENV SPEEX_PATH ${SPEEX_PATH} ${CMAKE_SOURCE_DIR}/${SPEEX_PATH} - ${_SPEEXDSP_LIBRARY_DIRS} + HINTS ENV SPEEX_PATH ${SPEEX_PATH} ${CMAKE_SOURCE_DIR}/${SPEEX_PATH} ${_SPEEXDSP_LIBRARY_DIRS} PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib PATH_SUFFIXES lib${_lib_suffix} @@ -46,8 +44,7 @@ find_library( ../bin) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Libspeexdsp DEFAULT_MSG SPEEXDSP_LIB - SPEEXDSP_INCLUDE_DIR) +find_package_handle_standard_args(Libspeexdsp DEFAULT_MSG SPEEXDSP_LIB SPEEXDSP_INCLUDE_DIR) mark_as_advanced(SPEEXDSP_INCLUDE_DIR SPEEXDSP_LIB) if(LIBSPEEXDSP_FOUND) @@ -57,18 +54,13 @@ if(LIBSPEEXDSP_FOUND) if(NOT TARGET LibspeexDSP::LibspeexDSP) if(IS_ABSOLUTE "${LIBSPEEXDSP_LIBRARIES}") add_library(LibspeexDSP::LibspeexDSP UNKNOWN IMPORTED) - set_target_properties( - LibspeexDSP::LibspeexDSP PROPERTIES IMPORTED_LOCATION - "${LIBSPEEXDSP_LIBRARIES}") + set_target_properties(LibspeexDSP::LibspeexDSP PROPERTIES IMPORTED_LOCATION "${LIBSPEEXDSP_LIBRARIES}") else() add_library(LibspeexDSP::LibspeexDSP INTERFACE IMPORTED) - set_target_properties( - LibspeexDSP::LibspeexDSP PROPERTIES IMPORTED_LIBNAME - "${LIBSPEEXDSP_LIBRARIES}") + set_target_properties(LibspeexDSP::LibspeexDSP PROPERTIES IMPORTED_LIBNAME "${LIBSPEEXDSP_LIBRARIES}") endif() - set_target_properties( - LibspeexDSP::LibspeexDSP PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${LIBSPEEXDSP_INCLUDE_DIRS}") + set_target_properties(LibspeexDSP::LibspeexDSP PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${LIBSPEEXDSP_INCLUDE_DIRS}") endif() endif() diff --git a/cmake/Modules/FindLibsrt.cmake b/cmake/Modules/FindLibsrt.cmake index a812df87f..50112c3eb 100644 --- a/cmake/Modules/FindLibsrt.cmake +++ b/cmake/Modules/FindLibsrt.cmake @@ -20,16 +20,14 @@ endif() find_path( LIBSRT_INCLUDE_DIR NAMES srt.h srt/srt.h - HINTS ENV LIBSRT_PATH ${LIBSRT_PATH} ${CMAKE_SOURCE_DIR}/${LIBSRT_PATH} - ${_LIBSRT_INCLUDE_DIRS} ${DepsPath} + HINTS ENV LIBSRT_PATH ${LIBSRT_PATH} ${CMAKE_SOURCE_DIR}/${LIBSRT_PATH} ${_LIBSRT_INCLUDE_DIRS} ${DepsPath} PATHS /usr/include /usr/local/include /opt/local/include /sw/include PATH_SUFFIXES include) find_library( LIBSRT_LIB NAMES ${_LIBSRT_LIBRARIES} srt libsrt - HINTS ENV LIBSRT_PATH ${LIBSRT_PATH} ${CMAKE_SOURCE_DIR}/${LIBSRT_PATH} - ${_LIBSRT_LIBRARY_DIRS} ${DepsPath} + HINTS ENV LIBSRT_PATH ${LIBSRT_PATH} ${CMAKE_SOURCE_DIR}/${LIBSRT_PATH} ${_LIBSRT_LIBRARY_DIRS} ${DepsPath} PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib PATH_SUFFIXES lib${_lib_suffix} @@ -46,8 +44,7 @@ find_library( ../bin) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Libsrt DEFAULT_MSG LIBSRT_LIB - LIBSRT_INCLUDE_DIR) +find_package_handle_standard_args(Libsrt DEFAULT_MSG LIBSRT_LIB LIBSRT_INCLUDE_DIR) mark_as_advanced(LIBSRT_INCLUDE_DIR LIBSRT_LIB) if(LIBSRT_FOUND) @@ -57,17 +54,13 @@ if(LIBSRT_FOUND) if(NOT TARGET Libsrt::Libsrt) if(IS_ABSOLUTE "${LIBSRT_LIBRARIES}") add_library(Libsrt::Libsrt UNKNOWN IMPORTED) - set_target_properties(Libsrt::Libsrt PROPERTIES IMPORTED_LOCATION - "${LIBSRT_LIBRARIES}") + set_target_properties(Libsrt::Libsrt PROPERTIES IMPORTED_LOCATION "${LIBSRT_LIBRARIES}") else() add_library(Libsrt::Libsrt INTERFACE IMPORTED) - set_target_properties(Libsrt::Libsrt PROPERTIES IMPORTED_LIBNAME - "${LIBSRT_LIBRARIES}") + set_target_properties(Libsrt::Libsrt PROPERTIES IMPORTED_LIBNAME "${LIBSRT_LIBRARIES}") endif() - set_target_properties( - Libsrt::Libsrt PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${LIBSRT_INCLUDE_DIRS}") + set_target_properties(Libsrt::Libsrt PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBSRT_INCLUDE_DIRS}") endif() else() message(STATUS "libsrt library not found") diff --git a/cmake/Modules/FindLibv4l2.cmake b/cmake/Modules/FindLibv4l2.cmake index d3721298e..da35a0735 100644 --- a/cmake/Modules/FindLibv4l2.cmake +++ b/cmake/Modules/FindLibv4l2.cmake @@ -30,16 +30,12 @@ if(LIBV4L2_FOUND) if(NOT TARGET LIB4L2::LIB4L2) if(IS_ABSOLUTE "${LIBV4L2_LIBRARIES}") add_library(LIB4L2::LIB4L2 UNKNOWN IMPORTED) - set_target_properties(LIB4L2::LIB4L2 PROPERTIES IMPORTED_LOCATION - "${LIBV4L2_LIBRARIES}") + set_target_properties(LIB4L2::LIB4L2 PROPERTIES IMPORTED_LOCATION "${LIBV4L2_LIBRARIES}") else() add_library(LIB4L2::LIB4L2 INTERFACE IMPORTED) - set_target_properties(LIB4L2::LIB4L2 PROPERTIES IMPORTED_LIBNAME - "${LIBV4L2_LIBRARIES}") + set_target_properties(LIB4L2::LIB4L2 PROPERTIES IMPORTED_LIBNAME "${LIBV4L2_LIBRARIES}") endif() - set_target_properties( - LIB4L2::LIB4L2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${LIBV4L2_INCLUDE_DIRS}") + set_target_properties(LIB4L2::LIB4L2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBV4L2_INCLUDE_DIRS}") endif() endif() diff --git a/cmake/Modules/FindLibva.cmake b/cmake/Modules/FindLibva.cmake index 0e49cb42e..5097a346c 100644 --- a/cmake/Modules/FindLibva.cmake +++ b/cmake/Modules/FindLibva.cmake @@ -1,3 +1,4 @@ +# cmake-format: off # # This module defines the following variables: # @@ -8,6 +9,7 @@ # Use pkg-config to get the directories and then use these values in the # find_path() and find_library() calls +# cmake-format: on find_package(PkgConfig QUIET) if(PKG_CONFIG_FOUND) @@ -34,8 +36,7 @@ find_library( PATHS /usr/lib /usr/local/lib /opt/local/lib) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Libva REQUIRED_VARS LIBVA_INCLUDE_DIR - LIBVA_LIB LIBVA_DRM_LIB) +find_package_handle_standard_args(Libva REQUIRED_VARS LIBVA_INCLUDE_DIR LIBVA_LIB LIBVA_DRM_LIB) mark_as_advanced(LIBVA_INCLUDE_DIR LIBVA_LIB LIBVA_DRM_LIB) if(LIBVA_FOUND) @@ -46,30 +47,24 @@ if(LIBVA_FOUND) if(NOT TARGET Libva::va) if(IS_ABSOLUTE "${LIBVA_LIBRARIES}") add_library(Libva::va UNKNOWN IMPORTED) - set_target_properties(Libva::va PROPERTIES IMPORTED_LOCATION - "${LIBVA_LIBRARIES}") + set_target_properties(Libva::va PROPERTIES IMPORTED_LOCATION "${LIBVA_LIBRARIES}") else() add_library(Libva::va INTERFACE IMPORTED) - set_target_properties(Libva::va PROPERTIES IMPORTED_LIBNAME - "${LIBVA_LIBRARIES}") + set_target_properties(Libva::va PROPERTIES IMPORTED_LIBNAME "${LIBVA_LIBRARIES}") endif() - set_target_properties(Libva::va PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${LIBVA_INCLUDE_DIRS}") + set_target_properties(Libva::va PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBVA_INCLUDE_DIRS}") endif() if(NOT TARGET Libva::drm) if(IS_ABSOLUTE "${LIBVA_DRM_LIBRARIES}") add_library(Libva::drm UNKNOWN IMPORTED) - set_target_properties(Libva::drm PROPERTIES IMPORTED_LOCATION - "${LIBVA_DRM_LIBRARIES}") + set_target_properties(Libva::drm PROPERTIES IMPORTED_LOCATION "${LIBVA_DRM_LIBRARIES}") else() add_library(Libva::drm INTERFACE IMPORTED) - set_target_properties(Libva::drm PROPERTIES IMPORTED_LIBNAME - "${LIBVA_DRM_LIBRARIES}") + set_target_properties(Libva::drm PROPERTIES IMPORTED_LIBNAME "${LIBVA_DRM_LIBRARIES}") endif() - set_target_properties(Libva::drm PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${LIBVA_INCLUDE_DIRS}") + set_target_properties(Libva::drm PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBVA_INCLUDE_DIRS}") endif() endif() diff --git a/cmake/Modules/FindLibx264.cmake b/cmake/Modules/FindLibx264.cmake index 8d78585fe..8d025de6c 100644 --- a/cmake/Modules/FindLibx264.cmake +++ b/cmake/Modules/FindLibx264.cmake @@ -20,16 +20,14 @@ endif() find_path( X264_INCLUDE_DIR NAMES x264.h - HINTS ENV X264_PATH ${X264_PATH} ${CMAKE_SOURCE_DIR}/${X264_PATH} - ${_X264_INCLUDE_DIRS} + HINTS ENV X264_PATH ${X264_PATH} ${CMAKE_SOURCE_DIR}/${X264_PATH} ${_X264_INCLUDE_DIRS} PATHS /usr/include /usr/local/include /opt/local/include /sw/include PATH_SUFFIXES include) find_library( X264_LIB NAMES ${_X264_LIBRARIES} x264 libx264 - HINTS ENV X264_PATH ${X264_PATH} ${CMAKE_SOURCE_DIR}/${X264_PATH} - ${_X264_LIBRARY_DIRS} + HINTS ENV X264_PATH ${X264_PATH} ${CMAKE_SOURCE_DIR}/${X264_PATH} ${_X264_LIBRARY_DIRS} PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib PATH_SUFFIXES lib${_lib_suffix} @@ -56,16 +54,12 @@ if(LIBX264_FOUND) if(NOT TARGET LIBX264::LIBX264) if(IS_ABSOLUTE "${LIBX264_LIBRARIES}") add_library(LIBX264::LIBX264 UNKNOWN IMPORTED) - set_target_properties(LIBX264::LIBX264 PROPERTIES IMPORTED_LOCATION - "${LIBX264_LIBRARIES}") + set_target_properties(LIBX264::LIBX264 PROPERTIES IMPORTED_LOCATION "${LIBX264_LIBRARIES}") else() add_library(LIBX264::LIBX264 INTERFACE IMPORTED) - set_target_properties(LIBX264::LIBX264 PROPERTIES IMPORTED_LIBNAME - "${LIBX264_LIBRARIES}") + set_target_properties(LIBX264::LIBX264 PROPERTIES IMPORTED_LIBNAME "${LIBX264_LIBRARIES}") endif() - set_target_properties( - LIBX264::LIBX264 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${LIBX264_INCLUDE_DIRS}") + set_target_properties(LIBX264::LIBX264 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBX264_INCLUDE_DIRS}") endif() endif() diff --git a/cmake/Modules/FindLuajit.cmake b/cmake/Modules/FindLuajit.cmake index ccce574d7..a2ee5a5ca 100644 --- a/cmake/Modules/FindLuajit.cmake +++ b/cmake/Modules/FindLuajit.cmake @@ -15,8 +15,7 @@ endif() find_path( LUAJIT_INCLUDE_DIR NAMES lua.h lualib.h - HINTS ENV LUAJIT_PATH ${LUAJIT_PATH} ${CMAKE_SOURCE_DIR}/${LUAJIT_PATH} - ${_LUAJIT_INCLUDE_DIRS} + HINTS ENV LUAJIT_PATH ${LUAJIT_PATH} ${CMAKE_SOURCE_DIR}/${LUAJIT_PATH} ${_LUAJIT_INCLUDE_DIRS} PATHS /usr/include /usr/local/include /opt/local/include @@ -42,8 +41,7 @@ find_path( find_library( LUAJIT_LIB NAMES ${_LUAJIT_LIBRARIES} luajit luajit-51 luajit-5.1 lua51 - HINTS ENV LUAJIT_PATH ${LUAJIT_PATH} ${CMAKE_SOURCE_DIR}/${LUAJIT_PATH} - ${_LUAJIT_LIBRARY_DIRS} + HINTS ENV LUAJIT_PATH ${LUAJIT_PATH} ${CMAKE_SOURCE_DIR}/${LUAJIT_PATH} ${_LUAJIT_LIBRARY_DIRS} PATHS /usr/lib /usr/local/lib /opt/local/lib @@ -66,8 +64,7 @@ find_library( ../bin) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Luajit DEFAULT_MSG LUAJIT_LIB - LUAJIT_INCLUDE_DIR) +find_package_handle_standard_args(Luajit DEFAULT_MSG LUAJIT_LIB LUAJIT_INCLUDE_DIR) mark_as_advanced(LUAJIT_INCLUDE_DIR LUAJIT_LIB) if(LUAJIT_FOUND) @@ -77,16 +74,12 @@ if(LUAJIT_FOUND) if(NOT TARGET Luajit::Luajit) if(IS_ABSOLUTE "${LUAJIT_LIBRARIES}") add_library(Luajit::Luajit UNKNOWN IMPORTED) - set_target_properties(Luajit::Luajit PROPERTIES IMPORTED_LOCATION - "${LUAJIT_LIBRARIES}") + set_target_properties(Luajit::Luajit PROPERTIES IMPORTED_LOCATION "${LUAJIT_LIBRARIES}") else() add_library(Luajit::Luajit INTERFACE IMPORTED) - set_target_properties(Luajit::Luajit PROPERTIES IMPORTED_LIBNAME - "${LUAJIT_LIBRARIES}") + set_target_properties(Luajit::Luajit PROPERTIES IMPORTED_LIBNAME "${LUAJIT_LIBRARIES}") endif() - set_target_properties( - Luajit::Luajit PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${LUAJIT_INCLUDE_DIRS}") + set_target_properties(Luajit::Luajit PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LUAJIT_INCLUDE_DIRS}") endif() endif() diff --git a/cmake/Modules/FindMbedTLS.cmake b/cmake/Modules/FindMbedTLS.cmake index efcc1eb39..435e30f73 100644 --- a/cmake/Modules/FindMbedTLS.cmake +++ b/cmake/Modules/FindMbedTLS.cmake @@ -26,16 +26,14 @@ endif() find_path( MBEDTLS_INCLUDE_DIR NAMES mbedtls/ssl.h - HINTS ENV MBEDTLS_PATH ${MBEDTLS_PATH} ${CMAKE_SOURCE_DIR}/${MBEDTLS_PATH} - ${_MBEDTLS_INCLUDE_DIRS} + HINTS ENV MBEDTLS_PATH ${MBEDTLS_PATH} ${CMAKE_SOURCE_DIR}/${MBEDTLS_PATH} ${_MBEDTLS_INCLUDE_DIRS} PATHS /usr/include /usr/local/include /opt/local/include /sw/include PATH_SUFFIXES include) find_library( MBEDTLS_LIB NAMES ${_MBEDTLS_LIBRARIES} mbedtls libmbedtls - HINTS ENV MBEDTLS_PATH ${MBEDTLS_PATH} ${CMAKE_SOURCE_DIR}/${MBEDTLS_PATH} - ${_MBEDTLS_LIBRARY_DIRS} + HINTS ENV MBEDTLS_PATH ${MBEDTLS_PATH} ${CMAKE_SOURCE_DIR}/${MBEDTLS_PATH} ${_MBEDTLS_LIBRARY_DIRS} PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib PATH_SUFFIXES lib${_lib_suffix} @@ -54,8 +52,7 @@ find_library( find_library( MBEDCRYPTO_LIB NAMES ${_MBEDCRYPTO_LIBRARIES} mbedcrypto libmbedcrypto - HINTS ENV MBEDCRYPTO_PATH ${MBEDCRYPTO_PATH} - ${CMAKE_SOURCE_DIR}/${MBEDCRYPTO_PATH} ${_MBEDCRYPTO_LIBRARY_DIRS} + HINTS ENV MBEDCRYPTO_PATH ${MBEDCRYPTO_PATH} ${CMAKE_SOURCE_DIR}/${MBEDCRYPTO_PATH} ${_MBEDCRYPTO_LIBRARY_DIRS} PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib PATH_SUFFIXES lib${_lib_suffix} @@ -74,8 +71,7 @@ find_library( find_library( MBEDX509_LIB NAMES ${_MBEDX509_LIBRARIES} mbedx509 libmbedx509 - HINTS ENV MBEDX509_PATH ${MBEDX509_PATH} ${CMAKE_SOURCE_DIR}/${MBEDX509_PATH} - ${_MBEDX509_LIBRARY_DIRS} + HINTS ENV MBEDX509_PATH ${MBEDX509_PATH} ${CMAKE_SOURCE_DIR}/${MBEDX509_PATH} ${_MBEDX509_LIBRARY_DIRS} PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib PATH_SUFFIXES lib${_lib_suffix} @@ -91,17 +87,15 @@ find_library( ../bin${_lib_suffix} ../bin) -# Sometimes mbedtls is split between three libs, and sometimes it isn't. If it -# isn't, let's check if the symbols we need are all in MBEDTLS_LIB. +# Sometimes mbedtls is split between three libs, and sometimes it isn't. If it isn't, let's check if the symbols we need +# are all in MBEDTLS_LIB. if(MBEDTLS_LIB AND NOT MBEDCRYPTO_LIB AND NOT MBEDX509_LIB) set(CMAKE_REQUIRED_LIBRARIES ${MBEDTLS_LIB}) set(CMAKE_REQUIRED_INCLUDES ${MBEDTLS_INCLUDE_DIR}) - check_symbol_exists(mbedtls_x509_crt_init "mbedtls/x509_crt.h" - MBEDTLS_INCLUDES_X509) - check_symbol_exists(mbedtls_sha256_init "mbedtls/sha256.h" - MBEDTLS_INCLUDES_CRYPTO) + check_symbol_exists(mbedtls_x509_crt_init "mbedtls/x509_crt.h" MBEDTLS_INCLUDES_X509) + check_symbol_exists(mbedtls_sha256_init "mbedtls/sha256.h" MBEDTLS_INCLUDES_CRYPTO) unset(CMAKE_REQUIRED_INCLUDES) unset(CMAKE_REQUIRED_LIBRARIES) endif() @@ -117,31 +111,24 @@ if(MBEDTLS_LIB if(NOT TARGET Mbedtls::${component} AND MBED${component}_LIB) if(IS_ABSOLUTE "${MBED${component}_LIB}") add_library(Mbedtls::${component} UNKNOWN IMPORTED) - set_target_properties( - Mbedtls::${component} PROPERTIES IMPORTED_LOCATION - "${MBED${component}_LIB}") + set_target_properties(Mbedtls::${component} PROPERTIES IMPORTED_LOCATION "${MBED${component}_LIB}") else() add_library(Mbedtls::${component} INTERFACE IMPORTED) - set_target_properties( - Mbedtls::${component} PROPERTIES IMPORTED_LIBNAME - "${MBED${component}_LIB}") + set_target_properties(Mbedtls::${component} PROPERTIES IMPORTED_LIBNAME "${MBED${component}_LIB}") endif() - set_target_properties( - Mbedtls::${component} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${MBED${component}_INCLUDE_DIR}") + set_target_properties(Mbedtls::${component} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${MBED${component}_INCLUDE_DIR}") endif() endforeach() if(NOT TARGET Mbedtls::Mbedtls) add_library(Mbedtls::Mbedtls INTERFACE IMPORTED) - target_link_libraries(Mbedtls::Mbedtls - INTERFACE Mbedtls::TLS Mbedtls::CRYPTO Mbedtls::X509) + target_link_libraries(Mbedtls::Mbedtls INTERFACE Mbedtls::TLS Mbedtls::CRYPTO Mbedtls::X509) endif() - # Otherwise, if we find MBEDTLS_LIB, and it has both CRYPTO and x509 within - # the single lib (i.e. a windows build environment), then also feel free to go - # ahead. + # Otherwise, if we find MBEDTLS_LIB, and it has both CRYPTO and x509 within the single lib (i.e. a windows build + # environment), then also feel free to go ahead. elseif( MBEDTLS_LIB AND MBEDTLS_INCLUDES_CRYPTO @@ -152,22 +139,17 @@ elseif( if(NOT TARGET Mbedtls::Mbedtls) if(IS_ABSOLUTE "${MBED${component}_LIB}") add_library(Mbedtls::${component} UNKNOWN IMPORTED) - set_target_properties(Mbedtls::${component} - PROPERTIES IMPORTED_LOCATION "${MBEDTLS_LIBRARIES}") + set_target_properties(Mbedtls::${component} PROPERTIES IMPORTED_LOCATION "${MBEDTLS_LIBRARIES}") else() add_library(Mbedtls::${component} INTERFACE IMPORTED) - set_target_properties(Mbedtls::${component} - PROPERTIES IMPORTED_LIBNAME "${MBEDTLS_LIBRARIES}") + set_target_properties(Mbedtls::${component} PROPERTIES IMPORTED_LIBNAME "${MBEDTLS_LIBRARIES}") endif() - set_target_properties( - Mbedtls::${component} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${MBEDTLS_INCLUDE_DIRS}") + set_target_properties(Mbedtls::${component} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${MBEDTLS_INCLUDE_DIRS}") endif() endif() # Now we've accounted for the 3-vs-1 library case: include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(MbedTLS DEFAULT_MSG MBEDTLS_LIBRARIES - MBEDTLS_INCLUDE_DIRS) +find_package_handle_standard_args(MbedTLS DEFAULT_MSG MBEDTLS_LIBRARIES MBEDTLS_INCLUDE_DIRS) mark_as_advanced(MBEDTLS_INCLUDE_DIR MBEDTLS_LIB MBEDCRYPTO_LIB MBEDX509_LIB) diff --git a/cmake/Modules/FindOSS.cmake b/cmake/Modules/FindOSS.cmake index e0121c6d3..0474a013b 100644 --- a/cmake/Modules/FindOSS.cmake +++ b/cmake/Modules/FindOSS.cmake @@ -1,8 +1,10 @@ +# cmake-format: off # Try to find OSS on a *nix system # # OSS_FOUND - True if OSS is available OSS_INCLUDE_DIR - Include # directory of OSS header OSS_HEADER_NAME - OSS header file name # +# cmake-format: on if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") set(OSS_HEADER_NAME "sys/soundcard.h") @@ -10,8 +12,7 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly") set(OSS_HEADER_NAME "sys/soundcard.h") endif() -find_path(OSS_INCLUDE_DIR "${OSS_HEADER_NAME}" "/usr/include" - "/usr/local/include") +find_path(OSS_INCLUDE_DIR "${OSS_HEADER_NAME}" "/usr/include" "/usr/local/include") if(OSS_INCLUDE_DIR) set(OSS_FOUND True) @@ -31,6 +32,5 @@ mark_as_advanced(OSS_FOUND OSS_INCLUDE_DIR OSS_HEADER_NAME) if(OSS_FOUND AND NOT TARGET OSS::OSS) add_library(OSS::OSS INTERFACE IMPORTED) - set_target_properties(OSS::OSS PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${OSS_INCLUDE_DIR}") + set_target_properties(OSS::OSS PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${OSS_INCLUDE_DIR}") endif() diff --git a/cmake/Modules/FindPipeWire.cmake b/cmake/Modules/FindPipeWire.cmake index 29bf7f433..868acf5ec 100644 --- a/cmake/Modules/FindPipeWire.cmake +++ b/cmake/Modules/FindPipeWire.cmake @@ -1,3 +1,4 @@ +# cmake-format: off # .rst: FindPipeWire # ------- # @@ -48,9 +49,9 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # ============================================================================= +# cmake-format: on -# Use pkg-config to get the directories and then use these values in the -# FIND_PATH() and FIND_LIBRARY() calls +# Use pkg-config to get the directories and then use these values in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig QUIET) pkg_search_module(PKG_PIPEWIRE QUIET libpipewire-0.3) @@ -87,8 +88,7 @@ if(PIPEWIRE_FOUND AND NOT TARGET PipeWire::PipeWire) PipeWire::PipeWire PROPERTIES IMPORTED_LOCATION "${PIPEWIRE_LIBRARIES}" INTERFACE_COMPILE_OPTIONS "${PIPEWIRE_COMPILE_FLAGS}" - INTERFACE_INCLUDE_DIRECTORIES - "${PIPEWIRE_INCLUDE_DIRS};${SPA_INCLUDE_DIRS}") + INTERFACE_INCLUDE_DIRECTORIES "${PIPEWIRE_INCLUDE_DIRS};${SPA_INCLUDE_DIRS}") endif() mark_as_advanced(PIPEWIRE_LIBRARIES PIPEWIRE_INCLUDE_DIRS) diff --git a/cmake/Modules/FindPythonWindows.cmake b/cmake/Modules/FindPythonWindows.cmake index 0d7656c56..84a4fafd0 100644 --- a/cmake/Modules/FindPythonWindows.cmake +++ b/cmake/Modules/FindPythonWindows.cmake @@ -37,8 +37,7 @@ find_library( ../bin) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(PythonWindows DEFAULT_MSG PYTHON_LIB - PYTHON_INCLUDE_DIR) +find_package_handle_standard_args(PythonWindows DEFAULT_MSG PYTHON_LIB PYTHON_INCLUDE_DIR) mark_as_advanced(PYTHON_INCLUDE_DIR PYTHON_LIB) if(PYTHONWINDOWS_FOUND) @@ -50,16 +49,12 @@ if(PYTHONWINDOWS_FOUND) if(NOT TARGET Python::Python) if(IS_ABSOLUTE "${Python_LIBRARIES}") add_library(Python::Python UNKNOWN IMPORTED) - set_target_properties(Python::Python PROPERTIES IMPORTED_LOCATION - "${Python_LIBRARIES}") + set_target_properties(Python::Python PROPERTIES IMPORTED_LOCATION "${Python_LIBRARIES}") else() add_library(Python::Python INTERFACE IMPORTED) - set_target_properties(Python::Python PROPERTIES IMPORTED_LIBNAME - "${Python_LIBRARIES}") + set_target_properties(Python::Python PROPERTIES IMPORTED_LIBNAME "${Python_LIBRARIES}") endif() - set_target_properties( - Python::Python PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${Python_INCLUDE_DIRS}") + set_target_properties(Python::Python PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Python_INCLUDE_DIRS}") endif() endif() diff --git a/cmake/Modules/FindSndio.cmake b/cmake/Modules/FindSndio.cmake index 5478a9c49..19db1145a 100644 --- a/cmake/Modules/FindSndio.cmake +++ b/cmake/Modules/FindSndio.cmake @@ -1,3 +1,4 @@ +# cmake-format: off # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. @@ -40,6 +41,7 @@ The following cache variables may also be set: The path to the Sndio library. #]=======================================================================] +# cmake-format: on find_path(Sndio_INCLUDE_DIR sndio.h) find_library(Sndio_LIBRARY sndio) @@ -57,10 +59,8 @@ endif() if(Sndio_FOUND AND NOT TARGET Sndio::Sndio) add_library(Sndio::Sndio UNKNOWN IMPORTED) - set_target_properties( - Sndio::Sndio - PROPERTIES IMPORTED_LOCATION "${Sndio_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${Sndio_INCLUDE_DIR}") + set_target_properties(Sndio::Sndio PROPERTIES IMPORTED_LOCATION "${Sndio_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES + "${Sndio_INCLUDE_DIR}") endif() mark_as_advanced(Sndio_INCLUDE_DIR Sndio_LIBRARY) diff --git a/cmake/Modules/FindSysinfo.cmake b/cmake/Modules/FindSysinfo.cmake index 4447b0149..5da583095 100644 --- a/cmake/Modules/FindSysinfo.cmake +++ b/cmake/Modules/FindSysinfo.cmake @@ -13,8 +13,7 @@ find_library( PATHS /usr/lib /usr/local/lib /opt/local/lib) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Sysinfo DEFAULT_MSG SYSINFO_LIB - SYSINFO_INCLUDE_DIR) +find_package_handle_standard_args(Sysinfo DEFAULT_MSG SYSINFO_LIB SYSINFO_INCLUDE_DIR) mark_as_advanced(SYSINFO_INCLUDE_DIR SYSINFO_LIB) if(SYSINFO_FOUND) @@ -24,16 +23,12 @@ if(SYSINFO_FOUND) if(NOT TARGET Sysinfo::Sysinfo) if(IS_ABSOLUTE "${SYSINFO_LIBRARIES}") add_library(Sysinfo::Sysinfo UNKNOWN IMPORTED) - set_target_properties(Sysinfo::Sysinfo PROPERTIES IMPORTED_LOCATION - "${SYSINFO_LIBRARIES}") + set_target_properties(Sysinfo::Sysinfo PROPERTIES IMPORTED_LOCATION "${SYSINFO_LIBRARIES}") else() add_library(Sysinfo::Sysinfo INTERFACE IMPORTED) - set_target_properties(Sysinfo::Sysinfo PROPERTIES IMPORTED_LIBNAME - "${SYSINFO_LIBRARIES}") + set_target_properties(Sysinfo::Sysinfo PROPERTIES IMPORTED_LIBNAME "${SYSINFO_LIBRARIES}") endif() - set_target_properties( - Sysinfo::Sysinfo PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${SYSINFO_INCLUDE_DIRS}") + set_target_properties(Sysinfo::Sysinfo PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SYSINFO_INCLUDE_DIRS}") endif() endif() diff --git a/cmake/Modules/FindUdev.cmake b/cmake/Modules/FindUdev.cmake index 153614b47..fca8c4308 100644 --- a/cmake/Modules/FindUdev.cmake +++ b/cmake/Modules/FindUdev.cmake @@ -30,15 +30,12 @@ if(UDEV_FOUND) if(NOT TARGET Udev::Udev) if(IS_ABSOLUTE "${UDEV_LIBRARIES}") add_library(Udev::Udev UNKNOWN IMPORTED) - set_target_properties(Udev::Udev PROPERTIES IMPORTED_LOCATION - "${UDEV_LIBRARIES}") + set_target_properties(Udev::Udev PROPERTIES IMPORTED_LOCATION "${UDEV_LIBRARIES}") else() add_library(Udev::Udev INTERFACE IMPORTED) - set_target_properties(Udev::Udev PROPERTIES IMPORTED_LIBNAME - "${UDEV_LIBRARIES}") + set_target_properties(Udev::Udev PROPERTIES IMPORTED_LIBNAME "${UDEV_LIBRARIES}") endif() - set_target_properties(Udev::Udev PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${UDEV_INCLUDE_DIRS}") + set_target_properties(Udev::Udev PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${UDEV_INCLUDE_DIRS}") endif() endif() diff --git a/cmake/Modules/FindWayland.cmake b/cmake/Modules/FindWayland.cmake index ef827ea72..b674a0ba3 100644 --- a/cmake/Modules/FindWayland.cmake +++ b/cmake/Modules/FindWayland.cmake @@ -1,3 +1,4 @@ +# cmake-format: off # Try to find Wayland on a Unix system # # This will define: @@ -21,9 +22,10 @@ # Use pkg-config to get the directories and then use these values in the # find_path() and find_library() calls +# cmake-format: on + find_package(PkgConfig) -pkg_check_modules(PKG_WAYLAND QUIET wayland-client wayland-server wayland-egl - wayland-cursor) +pkg_check_modules(PKG_WAYLAND QUIET wayland-client wayland-server wayland-egl wayland-cursor) set(WAYLAND_COMPILE_FLAGS ${PKG_WAYLAND_CFLAGS}) @@ -87,11 +89,10 @@ else() endif() mark_as_advanced(WAYLAND_SERVER_INCLUDE_DIRS WAYLAND_SERVER_LIBRARIES) -set(WAYLAND_INCLUDE_DIRS - ${WAYLAND_CLIENT_INCLUDE_DIRS} ${WAYLAND_SERVER_INCLUDE_DIRS} - ${WAYLAND_EGL_INCLUDE_DIRS} ${WAYLAND_CURSOR_INCLUDE_DIRS}) -set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} - ${WAYLAND_EGL_LIBRARIES} ${WAYLAND_CURSOR_LIBRARIES}) +set(WAYLAND_INCLUDE_DIRS ${WAYLAND_CLIENT_INCLUDE_DIRS} ${WAYLAND_SERVER_INCLUDE_DIRS} ${WAYLAND_EGL_INCLUDE_DIRS} + ${WAYLAND_CURSOR_INCLUDE_DIRS}) +set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES} + ${WAYLAND_CURSOR_LIBRARIES}) mark_as_advanced(WAYLAND_INCLUDE_DIRS WAYLAND_LIBRARIES) list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIRS) @@ -109,24 +110,16 @@ foreach(component "Client" "Server" "EGL" "Cursor") if(Wayland_${component}_FOUND) if(IS_ABSOLUTE "${WAYLAND_${component_u}_LIBRARIES}") add_library(Wayland::${component} UNKNOWN IMPORTED) - set_target_properties( - Wayland::${component} - PROPERTIES IMPORTED_LOCATION "${WAYLAND_${component_u}_LIBRARIES}") + set_target_properties(Wayland::${component} PROPERTIES IMPORTED_LOCATION "${WAYLAND_${component_u}_LIBRARIES}") else() add_library(Wayland::${component} INTERFACE IMPORTED) - set_target_properties( - Wayland::${component} - PROPERTIES IMPORTED_LIBNAME "${WAYLAND_${component_u}_LIBRARIES}") + set_target_properties(Wayland::${component} PROPERTIES IMPORTED_LIBNAME "${WAYLAND_${component_u}_LIBRARIES}") endif() - set_target_properties( - Wayland::${component} - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${WAYLAND_${component_u}_INCLUDE_DIRS}") + set_target_properties(Wayland::${component} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${WAYLAND_${component_u}_INCLUDE_DIRS}") - set_target_properties( - Wayland::${component} PROPERTIES INTERFACE_COMPILE_OPTIONS - "${WAYLAND_COMPILE_FLAGS}") + set_target_properties(Wayland::${component} PROPERTIES INTERFACE_COMPILE_OPTIONS "${WAYLAND_COMPILE_FLAGS}") endif() endif() endforeach() diff --git a/cmake/Modules/FindWebsocketpp.cmake b/cmake/Modules/FindWebsocketpp.cmake index 1c56d18ca..edbd1f64c 100644 --- a/cmake/Modules/FindWebsocketpp.cmake +++ b/cmake/Modules/FindWebsocketpp.cmake @@ -45,19 +45,14 @@ find_path( DOC "WebSocket++ include directory") if(EXISTS "${Websocketpp_INCLUDE_DIR}/websocketpp/version.hpp") - file(STRINGS "${Websocketpp_INCLUDE_DIR}/websocketpp/version.hpp" - _version_string + file(STRINGS "${Websocketpp_INCLUDE_DIR}/websocketpp/version.hpp" _version_string REGEX "^.*(major|minor|patch)_version[ \t]+=[ \t]+[0-9]+") - string(REGEX REPLACE ".*major_version[ \t]+=[ \t]+([0-9]+).*" "\\1" - _version_major "${_version_string}") - string(REGEX REPLACE ".*minor_version[ \t]+=[ \t]+([0-9]+).*" "\\1" - _version_minor "${_version_string}") - string(REGEX REPLACE ".*patch_version[ \t]+=[ \t]+([0-9]+).*" "\\1" - _version_patch "${_version_string}") + string(REGEX REPLACE ".*major_version[ \t]+=[ \t]+([0-9]+).*" "\\1" _version_major "${_version_string}") + string(REGEX REPLACE ".*minor_version[ \t]+=[ \t]+([0-9]+).*" "\\1" _version_minor "${_version_string}") + string(REGEX REPLACE ".*patch_version[ \t]+=[ \t]+([0-9]+).*" "\\1" _version_patch "${_version_string}") - set(Websocketpp_VERSION - "${_version_major}.${_version_minor}.${_version_patch}") + set(Websocketpp_VERSION "${_version_major}.${_version_minor}.${_version_patch}") unset(_version_major) unset(_version_minor) unset(_version_patch) @@ -69,27 +64,23 @@ else() endif() if(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin|Windows") - set(Websocketpp_ERROR_REASON - "Ensure that obs-deps is provided as part of CMAKE_PREFIX_PATH.") + set(Websocketpp_ERROR_REASON "Ensure that obs-deps is provided as part of CMAKE_PREFIX_PATH.") elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|FreeBSD") - set(Websocketpp_ERROR_REASON - "Ensure WebSocket++ library is available in local include paths.") + set(Websocketpp_ERROR_REASON "Ensure WebSocket++ library is available in local include paths.") endif() find_package_handle_standard_args( Websocketpp REQUIRED_VARS Websocketpp_INCLUDE_DIR - VERSION_VAR Websocketpp_VERSION REASON_FAILURE_MESSAGE - "${Websocketpp_ERROR_REASON}") + VERSION_VAR Websocketpp_VERSION REASON_FAILURE_MESSAGE "${Websocketpp_ERROR_REASON}") mark_as_advanced(Websocketpp_INCLUDE_DIR) unset(Websocketpp_ERROR_REASON) if(Websocketpp_FOUND) if(NOT TARGET Websocketpp::Websocketpp) add_library(Websocketpp::Websocketpp INTERFACE IMPORTED) - set_target_properties( - Websocketpp::Websocketpp PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${Websocketpp_INCLUDE_DIR}") + set_target_properties(Websocketpp::Websocketpp PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${Websocketpp_INCLUDE_DIR}") endif() endif() @@ -97,6 +88,4 @@ include(FeatureSummary) set_package_properties( Websocketpp PROPERTIES URL "https://www.zaphoyd.com/websocketpp/" - DESCRIPTION - "WebSocket++ is a header only C++ library that implements RFC6455 The WebSocket Protocol." -) + DESCRIPTION "WebSocket++ is a header only C++ library that implements RFC6455 The WebSocket Protocol.") diff --git a/cmake/Modules/FindX11_XCB.cmake b/cmake/Modules/FindX11_XCB.cmake index a88d89b5e..bf6ab5029 100644 --- a/cmake/Modules/FindX11_XCB.cmake +++ b/cmake/Modules/FindX11_XCB.cmake @@ -1,19 +1,20 @@ +# cmake-format: off # * Try to find libX11-xcb Once done this will define # -# X11_XCB_FOUND - system has libX11-xcb X11_XCB_LIBRARIES - Link these to use -# libX11-xcb X11_XCB_INCLUDE_DIR - the libX11-xcb include dir +# X11_XCB_FOUND - system has libX11-xcb +# X11_XCB_LIBRARIES - Link these to use libX11-xcb +# X11_XCB_INCLUDE_DIR - the libX11-xcb include dir # X11_XCB_DEFINITIONS - compiler switches required for using libX11-xcb -# Copyright (c) 2011 Fredrik Höglund Copyright (c) 2008 Helio -# Chissini de Castro, Copyright (c) 2007 Matthias Kretz, -# +# Copyright (c) 2011 Fredrik Höglund +# Copyright (c) 2008 Helio Chissini de Castro, +# Copyright (c) 2007 Matthias Kretz, # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# Redistribution and use is allowed according to the terms of the BSD license. For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# cmake-format: on if(NOT WIN32) - # use pkg-config to get the directories and then use these values in the - # FIND_PATH() and FIND_LIBRARY() calls + # use pkg-config to get the directories and then use these values in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) pkg_check_modules(PKG_X11_XCB QUIET x11-xcb) @@ -29,8 +30,7 @@ if(NOT WIN32) HINTS ${PKG_X11_XCB_LIBRARY_DIRS}) include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(X11_XCB DEFAULT_MSG X11_XCB_LIBRARIES - X11_XCB_INCLUDE_DIR) + find_package_handle_standard_args(X11_XCB DEFAULT_MSG X11_XCB_LIBRARIES X11_XCB_INCLUDE_DIR) mark_as_advanced(X11_XCB_INCLUDE_DIR X11_XCB_LIBRARIES) diff --git a/cmake/Modules/FindXCB.cmake b/cmake/Modules/FindXCB.cmake index 5ad6db226..23579b437 100644 --- a/cmake/Modules/FindXCB.cmake +++ b/cmake/Modules/FindXCB.cmake @@ -1,3 +1,4 @@ +# cmake-format: off # Try to find XCB on a Unix system # # This will define: @@ -33,6 +34,7 @@ # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# cmake-format: on set(knownComponents XCB @@ -68,8 +70,7 @@ else() set(comps ${knownComponents}) endif() -# iterate through the list of requested components, and check that we know them -# all. If not, fail. +# iterate through the list of requested components, and check that we know them all. If not, fail. foreach(comp ${comps}) list(FIND knownComponents ${comp} index) if("${index}" STREQUAL "-1") @@ -221,8 +222,7 @@ macro(_XCB_HANDLE_COMPONENT _comp) endmacro() if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - # Use pkg-config to get the directories and then use these values in the - # FIND_PATH() and FIND_LIBRARY() calls + # Use pkg-config to get the directories and then use these values in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) pkg_check_modules(PKG_XCB QUIET ${pkgConfigModules}) @@ -253,19 +253,14 @@ if(XCB_FOUND AND NOT TARGET XCB::XCB) if(XCB_${component_u}_FOUND) if(IS_ABSOLUTE "${XCB_${component_u}_LIBRARY}") add_library(XCB::${component} UNKNOWN IMPORTED) - set_target_properties( - XCB::${component} PROPERTIES IMPORTED_LOCATION - "${XCB_${component_u}_LIBRARY}") + set_target_properties(XCB::${component} PROPERTIES IMPORTED_LOCATION "${XCB_${component_u}_LIBRARY}") else() add_library(XCB::${component} INTERFACE IMPORTED) - set_target_properties( - XCB::${component} PROPERTIES IMPORTED_LIBNAME - "${XCB_${component_u}_LIBRARY}") + set_target_properties(XCB::${component} PROPERTIES IMPORTED_LIBNAME "${XCB_${component_u}_LIBRARY}") endif() - set_target_properties( - XCB::${component} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${XCB_${component_u}_INCLUDE_DIR}") + set_target_properties(XCB::${component} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${XCB_${component_u}_INCLUDE_DIR}") endif() endif() endforeach() diff --git a/cmake/Modules/FindXkbcommon.cmake b/cmake/Modules/FindXkbcommon.cmake index 763d688c0..e2205eaa6 100644 --- a/cmake/Modules/FindXkbcommon.cmake +++ b/cmake/Modules/FindXkbcommon.cmake @@ -20,8 +20,7 @@ find_library( PATHS /usr/lib /usr/local/lib /opt/local/lib) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Xkbcommon DEFAULT_MSG XKBCOMMON_LIB - XKBCOMMON_INCLUDE_DIR) +find_package_handle_standard_args(Xkbcommon DEFAULT_MSG XKBCOMMON_LIB XKBCOMMON_INCLUDE_DIR) mark_as_advanced(XKBCOMMON_INCLUDE_DIR XKBCOMMON_LIB) if(XKBCOMMON_FOUND) @@ -31,18 +30,12 @@ if(XKBCOMMON_FOUND) if(NOT TARGET Xkbcommon::Xkbcommon) if(IS_ABSOLUTE "${XKBCOMMON_LIBRARIES}") add_library(Xkbcommon::Xkbcommon UNKNOWN IMPORTED) - set_target_properties( - Xkbcommon::Xkbcommon PROPERTIES IMPORTED_LOCATION - "${XKBCOMMON_LIBRARIES}") + set_target_properties(Xkbcommon::Xkbcommon PROPERTIES IMPORTED_LOCATION "${XKBCOMMON_LIBRARIES}") else() add_library(Xkbcommon::Xkbcommon INTERFACE IMPORTED) - set_target_properties( - Xkbcommon::Xkbcommon PROPERTIES IMPORTED_LIBNAME - "${XKBCOMMON_LIBRARIES}") + set_target_properties(Xkbcommon::Xkbcommon PROPERTIES IMPORTED_LIBNAME "${XKBCOMMON_LIBRARIES}") endif() - set_target_properties( - Xkbcommon::Xkbcommon PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${XKBCOMMON_INCLUDE_DIRS}") + set_target_properties(Xkbcommon::Xkbcommon PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${XKBCOMMON_INCLUDE_DIRS}") endif() endif() diff --git a/cmake/Modules/IDLFileHelper.cmake b/cmake/Modules/IDLFileHelper.cmake index 1c38cb63f..594481b51 100644 --- a/cmake/Modules/IDLFileHelper.cmake +++ b/cmake/Modules/IDLFileHelper.cmake @@ -20,10 +20,8 @@ macro(add_idl_files_base generated_files with_tlb) add_custom_command( OUTPUT ${bin_file_h} ${bin_file_c} DEPENDS ${filename} - COMMAND - midl /h ${file_h} /iid ${file_c} ${tlb_opt} - $,/win64,/win32> - ${CMAKE_CURRENT_SOURCE_DIR}/${filename} + COMMAND midl /h ${file_h} /iid ${file_c} ${tlb_opt} $,/win64,/win32> + ${CMAKE_CURRENT_SOURCE_DIR}/${filename} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) else() execute_process( @@ -53,15 +51,13 @@ macro(add_idl_files_base generated_files with_tlb) add_custom_command( OUTPUT ${file_h} DEPENDS ${filename} - COMMAND ${CMAKE_WIDL} ${include_params} -h -o ${file_h} - ${CMAKE_CURRENT_SOURCE_DIR}/${filename} + COMMAND ${CMAKE_WIDL} ${include_params} -h -o ${file_h} ${CMAKE_CURRENT_SOURCE_DIR}/${filename} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) file(WRITE ${bin_file_c} "#include \n#include <${file_h}>\n") endif() - set_source_files_properties(${bin_file_h} ${bin_file_c} PROPERTIES GENERATED - TRUE) + set_source_files_properties(${bin_file_h} ${bin_file_c} PROPERTIES GENERATED TRUE) set(${generated_files} ${${generated_file}} ${bin_file_h} ${bin_file_c}) diff --git a/cmake/Modules/ObsDefaults_macOS.cmake b/cmake/Modules/ObsDefaults_macOS.cmake index 374f9134b..e61d64d65 100644 --- a/cmake/Modules/ObsDefaults_macOS.cmake +++ b/cmake/Modules/ObsDefaults_macOS.cmake @@ -17,11 +17,9 @@ endif() if(NOT CMAKE_OSX_ARCHITECTURES) set(CMAKE_OSX_ARCHITECTURES "${CMAKE_HOST_SYSTEM_PROCESSOR}" - CACHE STRING - "OBS build architecture for macOS - x86_64 required at least" FORCE) + CACHE STRING "OBS build architecture for macOS - x86_64 required at least" FORCE) endif() -set_property(CACHE CMAKE_OSX_ARCHITECTURES PROPERTY STRINGS arm64 x86_64 - "x86_64;arm64") +set_property(CACHE CMAKE_OSX_ARCHITECTURES PROPERTY STRINGS arm64 x86_64 "x86_64;arm64") if(NOT CMAKE_OSX_DEPLOYMENT_TARGET) set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET[arch=arm64] "11.0") @@ -38,8 +36,7 @@ if(NOT CMAKE_OSX_DEPLOYMENT_TARGET) CACHE STRING "OBS deployment target for macOS - 10.15+ required" FORCE) unset(_MACOS_DEPLOYMENT_TARGET) endif() -set_property(CACHE CMAKE_OSX_DEPLOYMENT_TARGET PROPERTY STRINGS 10.15 11.0 12.0 - 13.0) +set_property(CACHE CMAKE_OSX_DEPLOYMENT_TARGET PROPERTY STRINGS 10.15 11.0 12.0 13.0) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX @@ -49,22 +46,19 @@ endif() if(NOT DEFINED CMAKE_PREFIX_PATH) message( - WARNING - "No CMAKE_PREFIX_PATH set: OBS supplies pre-built dependencies for building on macOS.\n" - "While OBS can be built using packages installed via Homebrew, pre-built dependencies " - "contain beneficial patches and fixes for use within OBS and is the suggested source " - "of these dependencies.\n" - "You can download the appropriate obs-deps package for your " - "architecture and set CMAKE_PREFIX_PATH to this directory:\n" - "CMAKE_PREFIX_PATH=\"\"\n" - "Download pre-built OBS dependencies at https://github.com/obsproject/obs-deps/releases\n" - ) + WARNING "No CMAKE_PREFIX_PATH set: OBS supplies pre-built dependencies for building on macOS.\n" + "While OBS can be built using packages installed via Homebrew, pre-built dependencies " + "contain beneficial patches and fixes for use within OBS and is the suggested source " + "of these dependencies.\n" + "You can download the appropriate obs-deps package for your " + "architecture and set CMAKE_PREFIX_PATH to this directory:\n" + "CMAKE_PREFIX_PATH=\"\"\n" + "Download pre-built OBS dependencies at https://github.com/obsproject/obs-deps/releases\n") endif() -# SWIG hard codes the directory to its library directory at compile time. As -# obs-deps need to be relocatable, we need to force SWIG to look for its files -# in a directory relative to the PREFIX_PATH. The best way to ensure this is to -# set the SWIG_LIB environment variable. +# SWIG hard codes the directory to its library directory at compile time. As obs-deps need to be relocatable, we need to +# force SWIG to look for its files in a directory relative to the PREFIX_PATH. The best way to ensure this is to set the +# SWIG_LIB environment variable. if(NOT DEFINED ENV{SWIG_LIB} AND EXISTS "${CMAKE_PREFIX_PATH}/bin/swig") set(ENV{SWIG_LIB} "${CMAKE_PREFIX_PATH}/share/swig/CURRENT") @@ -83,8 +77,7 @@ macro(setup_obs_project) "-" CACHE STRING "OBS code signing identity for macOS" FORCE) endif() - set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY - "${OBS_BUNDLE_CODESIGN_IDENTITY}") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "${OBS_BUNDLE_CODESIGN_IDENTITY}") else() set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_STYLE "Automatic") set(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "${OBS_BUNDLE_CODESIGN_TEAM}") @@ -97,9 +90,8 @@ macro(setup_obs_project) ON CACHE BOOL "Enable linker code-signing on macOS (macOS 11+ required)") - # Tell Xcode to pretend the linker signed binaries so that editing with - # install_name_tool preserves ad-hoc signatures. This option is supported by - # codesign on macOS 11 or higher. See CMake Issue 21854: + # Tell Xcode to pretend the linker signed binaries so that editing with install_name_tool preserves ad-hoc signatures. + # This option is supported by codesign on macOS 11 or higher. See CMake Issue 21854: # https://gitlab.kitware.com/cmake/cmake/-/issues/21854 if(OBS_CODESIGN_LINKER) @@ -154,24 +146,18 @@ macro(setup_obs_project) set(CPACK_ARCH_SUFFIX "Universal") endif() - set(CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-macOS-${CPACK_ARCH_SUFFIX}" - ) + set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-macOS-${CPACK_ARCH_SUFFIX}") - set(CPACK_COMPONENTS_ALL obs_app obs_frameworks obs_plugins - obs_scripting_plugins obs_resources) + set(CPACK_COMPONENTS_ALL obs_app obs_frameworks obs_plugins obs_scripting_plugins obs_resources) set(CPACK_COMPONENT_OBS_APP_DISPLAY_NAME "OBS Studio") set(CPACK_COMPONENT_OBS_FRAMEWORKS_DISPLAY_NAME "OBS Frameworks") set(CPACK_COMPONENT_OBS_PLUGINS_DISPLAY_NAME "OBS Plugins") - set(CPACK_COMPONENT_OBS_SCRIPTING_PLUGINS_DISPLAY_NAME - "OBS Scripting Plugins") + set(CPACK_COMPONENT_OBS_SCRIPTING_PLUGINS_DISPLAY_NAME "OBS Scripting Plugins") set(CPACK_COMPONENT_OBS_RESOURCES_DISPLAY_NAME "OBS Resources") - set(CPACK_DMG_BACKGROUND_IMAGE - "${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/background.tiff") + set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/background.tiff") set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/AppIcon.icns") - get_filename_component(CPACK_DMG_BACKGROUND_FILENAME - ${CPACK_DMG_BACKGROUND_IMAGE} NAME) + get_filename_component(CPACK_DMG_BACKGROUND_FILENAME ${CPACK_DMG_BACKGROUND_IMAGE} NAME) set(CPACK_DMG_FORMAT "UDZO") set(CPACK_DMG_FILESYSTEM "APFS") set(CPACK_DMG_DS_STORE_SETUP_SCRIPT "${CMAKE_BINARY_DIR}/package.applescript") diff --git a/cmake/Modules/ObsHelpers_Linux.cmake b/cmake/Modules/ObsHelpers_Linux.cmake index a4c663eb9..ced6c9ba3 100644 --- a/cmake/Modules/ObsHelpers_Linux.cmake +++ b/cmake/Modules/ObsHelpers_Linux.cmake @@ -2,16 +2,13 @@ function(setup_binary_target target) set_target_properties( ${target} - PROPERTIES - BUILD_RPATH - "${OBS_OUTPUT_DIR}/$/${OBS_EXECUTABLE_DESTINATION}$<$:/${_ARCH_SUFFIX}bit>" - ) + PROPERTIES BUILD_RPATH + "${OBS_OUTPUT_DIR}/$/${OBS_EXECUTABLE_DESTINATION}$<$:/${_ARCH_SUFFIX}bit>") _setup_binary_target(${target}) endfunction() -# Helper function to export target to build and install tree Allows usage of -# `find_package(libobs)` by other build trees +# Helper function to export target to build and install tree Allows usage of `find_package(libobs)` by other build trees function(export_target target) _export_target(${ARGV}) @@ -23,14 +20,12 @@ endfunction() # Helper function to build pkgconfig file for target function(export_target_pkgconf target) get_target_property(_TARGET_DEPENDENCIES ${target} INTERFACE_LINK_LIBRARIES) - get_target_property(_TARGET_DEFINITIONS ${target} - INTERFACE_COMPILE_DEFINITIONS) + get_target_property(_TARGET_DEFINITIONS ${target} INTERFACE_COMPILE_DEFINITIONS) get_target_property(_TARGET_OPTIONS ${target} INTERFACE_COMPILE_OPTIONS) foreach(_LIBRARY IN LISTS _TARGET_DEPENDENCIES) get_target_property(_LINK_LIBRARY ${_LIBRARY} INTERFACE_LINK_LIBRARIES) - get_target_property(_LINK_DEFINITIONS ${_LIBRARY} - INTERFACE_COMPILE_DEFINITIONS) + get_target_property(_LINK_DEFINITIONS ${_LIBRARY} INTERFACE_COMPILE_DEFINITIONS) get_target_property(_LINK_OPTIONS ${_LIBRARY} INTERFACE_COMPILE_OPTIONS) if(NOT "${_LINK_LIBRARY}" STREQUAL "_LINK_LIBRARY-NOTFOUND") @@ -63,11 +58,9 @@ function(export_target_pkgconf target) set(_TARGET_OPTIONS "") endif() - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/${target}.pc.in" - "${target}.pc" @ONLY) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/${target}.pc.in" "${target}.pc" @ONLY) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${target}.pc" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${target}.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") endfunction() # Helper function to install header files @@ -90,8 +83,7 @@ function(install_headers target) if(ENABLE_PULSEAUDIO) install( - FILES - "${CMAKE_CURRENT_SOURCE_DIR}/audio-monitoring/pulse/pulseaudio-wrapper.h" + FILES "${CMAKE_CURRENT_SOURCE_DIR}/audio-monitoring/pulse/pulseaudio-wrapper.h" DESTINATION "${OBS_INCLUDE_DESTINATION}/audio-monitoring/pulse/" COMPONENT obs_libraries) endif() diff --git a/cmake/Modules/ObsHelpers_Windows.cmake b/cmake/Modules/ObsHelpers_Windows.cmake index d65622fa3..71ac4deb3 100644 --- a/cmake/Modules/ObsHelpers_Windows.cmake +++ b/cmake/Modules/ObsHelpers_Windows.cmake @@ -5,10 +5,9 @@ function(setup_binary_target target) if(DEFINED ENV{OBS_InstallerTempDir}) install( TARGETS ${target} - RUNTIME - DESTINATION $ENV{OBS_InstallerTempDir}/${OBS_EXECUTABLE_DESTINATION} - COMPONENT obs_${target} - EXCLUDE_FROM_ALL + RUNTIME DESTINATION $ENV{OBS_InstallerTempDir}/${OBS_EXECUTABLE_DESTINATION} + COMPONENT obs_${target} + EXCLUDE_FROM_ALL LIBRARY DESTINATION $ENV{OBS_InstallerTempDir}/${OBS_LIBRARY_DESTINATION} COMPONENT obs_${target} EXCLUDE_FROM_ALL @@ -29,8 +28,7 @@ function(setup_binary_target target) endif() if(MSVC) - target_link_options(${target} PRIVATE - /PDBALTPATH:$) + target_link_options(${target} PRIVATE /PDBALTPATH:$) install( FILES $ @@ -59,8 +57,7 @@ function(setup_plugin_target target) _setup_plugin_target(${ARGV}) if(MSVC) - target_link_options(${target} PRIVATE - /PDBALTPATH:$) + target_link_options(${target} PRIVATE /PDBALTPATH:$) install( FILES $ @@ -103,8 +100,7 @@ function(setup_script_plugin_target target) _setup_script_plugin_target(${ARGV}) if(MSVC) - target_link_options(${target} PRIVATE - /PDBALTPATH:$) + target_link_options(${target} PRIVATE /PDBALTPATH:$) install( FILES $ @@ -117,14 +113,12 @@ function(setup_script_plugin_target target) if(DEFINED ENV{OBS_InstallerTempDir}) install( TARGETS ${target} - RUNTIME - DESTINATION $ENV{OBS_InstallerTempDir}/${OBS_SCRIPT_PLUGIN_DESTINATION} - COMPONENT obs_${target} - EXCLUDE_FROM_ALL - LIBRARY - DESTINATION $ENV{OBS_InstallerTempDir}/${OBS_SCRIPT_PLUGIN_DESTINATION} - COMPONENT obs_${target} - EXCLUDE_FROM_ALL) + RUNTIME DESTINATION $ENV{OBS_InstallerTempDir}/${OBS_SCRIPT_PLUGIN_DESTINATION} + COMPONENT obs_${target} + EXCLUDE_FROM_ALL + LIBRARY DESTINATION $ENV{OBS_InstallerTempDir}/${OBS_SCRIPT_PLUGIN_DESTINATION} + COMPONENT obs_${target} + EXCLUDE_FROM_ALL) if(MSVC) install( @@ -137,8 +131,7 @@ function(setup_script_plugin_target target) if(${target} STREQUAL "obspython" AND ${_ARCH_SUFFIX} EQUAL 64) install( - FILES - "$/$.py" + FILES "$/$.py" DESTINATION $ENV{OBS_InstallerTempDir}/${OBS_SCRIPT_PLUGIN_DESTINATION} COMPONENT obs_${target} EXCLUDE_FROM_ALL) @@ -155,8 +148,7 @@ function(setup_target_resources target destination) install( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/ - DESTINATION - $ENV{OBS_InstallerTempDir}/${OBS_DATA_DESTINATION}/${destination} + DESTINATION $ENV{OBS_InstallerTempDir}/${OBS_DATA_DESTINATION}/${destination} USE_SOURCE_PERMISSIONS COMPONENT obs_${target} EXCLUDE_FROM_ALL) @@ -190,8 +182,7 @@ function(add_target_resource) if(DEFINED ENV{OBS_InstallerTempDir}) install( FILES ${resource} - DESTINATION - $ENV{OBS_InstallerTempDir}/${OBS_DATA_DESTINATION}/${destination} + DESTINATION $ENV{OBS_InstallerTempDir}/${OBS_DATA_DESTINATION}/${destination} COMPONENT obs_${target} ${optional} EXCLUDE_FROM_ALL) endif() @@ -204,14 +195,12 @@ function(setup_obs_app target) if(MSVC) target_compile_options(obs-browser PRIVATE $,/MTd,/MT>) - target_compile_options(obs-browser-page - PRIVATE $,/MTd,/MT>) + target_compile_options(obs-browser-page PRIVATE $,/MTd,/MT>) endif() target_link_options(obs-browser PRIVATE "LINKER:/IGNORE:4099") - target_link_options(obs-browser-page PRIVATE "LINKER:/IGNORE:4099" - "LINKER:/SUBSYSTEM:WINDOWS") + target_link_options(obs-browser-page PRIVATE "LINKER:/IGNORE:4099" "LINKER:/SUBSYSTEM:WINDOWS") endif() _setup_obs_app(${ARGV}) @@ -221,8 +210,8 @@ function(setup_obs_app target) endif() endfunction() -# Helper function to export target to build and install tree. Allows usage of -# `find_package(libobs)` by other build trees +# Helper function to export target to build and install tree. Allows usage of `find_package(libobs)` by other build +# trees function(export_target target) set(CMAKE_EXPORT_PACKAGE_REGISTRY OFF) @@ -255,17 +244,14 @@ function(export_target target) endif() include(GenerateExportHeader) - generate_export_header(${target} EXPORT_FILE_NAME - "${CMAKE_CURRENT_BINARY_DIR}/${target}_EXPORT.h") + generate_export_header(${target} EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/${target}_EXPORT.h") - target_sources(${target} - PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/${target}_EXPORT.h") + target_sources(${target} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/${target}_EXPORT.h") set(TARGETS_EXPORT_NAME "${target}Targets") include(CMakePackageConfigHelpers) configure_package_config_file( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/${target}Config.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/${target}Config.cmake" + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/${target}Config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/${target}Config.cmake" INSTALL_DESTINATION ${OBS_CMAKE_DESTINATION} PATH_VARS OBS_PLUGIN_DESTINATION OBS_DATA_DESTINATION) @@ -290,8 +276,7 @@ function(export_target target) EXCLUDE_FROM_ALL) install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/${target}Config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${target}ConfigVersion.cmake + FILES ${CMAKE_CURRENT_BINARY_DIR}/${target}Config.cmake ${CMAKE_CURRENT_BINARY_DIR}/${target}ConfigVersion.cmake DESTINATION ${OBS_CMAKE_DESTINATION} COMPONENT obs_libraries EXCLUDE_FROM_ALL) @@ -330,8 +315,7 @@ function(setup_target_browser target) foreach(_ADDITIONAL_BROWSER_FILE IN LISTS _ADDITIONAL_BROWSER_FILES) list(REMOVE_ITEM _ADDITIONAL_BROWSER_FILES "${_ADDITIONAL_BROWSER_FILE}") if(EXISTS "${CEF_ROOT_DIR}/Release/${_ADDITIONAL_BROWSER_FILE}") - list(APPEND _ADDITIONAL_BROWSER_FILES - "${CEF_ROOT_DIR}/Release/${_ADDITIONAL_BROWSER_FILE}") + list(APPEND _ADDITIONAL_BROWSER_FILES "${CEF_ROOT_DIR}/Release/${_ADDITIONAL_BROWSER_FILE}") endif() endforeach() @@ -364,8 +348,7 @@ function(setup_libobs_target target) endif() if(NOT INSTALLER_RUN) - list(APPEND _LIBOBS_FIXUPS "misc:." "data:${OBS_DATA_DESTINATION}" - "libs${_ARCH_SUFFIX}:${OBS_LIBRARY_DESTINATION}" + list(APPEND _LIBOBS_FIXUPS "misc:." "data:${OBS_DATA_DESTINATION}" "libs${_ARCH_SUFFIX}:${OBS_LIBRARY_DESTINATION}" "exec${_ARCH_SUFFIX}:${OBS_EXECUTABLE_DESTINATION}") else() list( @@ -420,12 +403,9 @@ endfunction() # Helper function to compile artifacts for multi-architecture installer function(generate_multiarch_installer) - if(NOT DEFINED ENV{OBS_InstallerTempDir} AND NOT DEFINED - ENV{obsInstallerTempDir}) - obs_status( - FATAL_ERROR - "Function generate_multiarch_installer requires environment variable 'OBS_InstallerTempDir' to be set" - ) + if(NOT DEFINED ENV{OBS_InstallerTempDir} AND NOT DEFINED ENV{obsInstallerTempDir}) + obs_status(FATAL_ERROR + "Function generate_multiarch_installer requires environment variable 'OBS_InstallerTempDir' to be set") endif() add_custom_target(installer_files ALL) diff --git a/cmake/Modules/ObsHelpers_macOS.cmake b/cmake/Modules/ObsHelpers_macOS.cmake index 3d4514bca..91a7af183 100644 --- a/cmake/Modules/ObsHelpers_macOS.cmake +++ b/cmake/Modules/ObsHelpers_macOS.cmake @@ -2,10 +2,8 @@ function(setup_binary_target target) set_target_properties( ${target} - PROPERTIES XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER - "com.obsproject.${target}" - XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS - "${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/entitlements.plist") + PROPERTIES XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.obsproject.${target}" + XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/entitlements.plist") set(MACOSX_PLUGIN_BUNDLE_NAME "${target}" @@ -26,8 +24,7 @@ function(setup_binary_target target) if(${target} STREQUAL libobs) setup_framework_target(${target}) set_property(GLOBAL APPEND PROPERTY OBS_FRAMEWORK_LIST "${target}") - elseif(NOT ${target} STREQUAL obs-ffmpeg-mux AND NOT ${target} STREQUAL - mac-dal-plugin) + elseif(NOT ${target} STREQUAL obs-ffmpeg-mux AND NOT ${target} STREQUAL mac-dal-plugin) set_property(GLOBAL APPEND PROPERTY OBS_FRAMEWORK_LIST "${target}") endif() endfunction() @@ -40,10 +37,8 @@ function(setup_framework_target target) FRAMEWORK_VERSION A OUTPUT_NAME "${target}" MACOSX_FRAMEWORK_IDENTIFIER "com.obsproject.${target}" - MACOSX_FRAMEWORK_INFO_PLIST - "${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/Plugin-Info.plist.in" - XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER - "com.obsproject.${target}") + MACOSX_FRAMEWORK_INFO_PLIST "${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/Plugin-Info.plist.in" + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.obsproject.${target}") install( TARGETS ${target} @@ -54,8 +49,7 @@ function(setup_framework_target target) INCLUDES DESTINATION Frameworks/$.framework/Headers PUBLIC_HEADER - DESTINATION - Frameworks/$.framework/Headers + DESTINATION Frameworks/$.framework/Headers COMPONENT obs_libraries EXCLUDE_FROM_ALL) endfunction() @@ -86,12 +80,9 @@ function(setup_plugin_target target) PROPERTIES BUNDLE ON BUNDLE_EXTENSION "plugin" OUTPUT_NAME "${target}" - MACOSX_BUNDLE_INFO_PLIST - "${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/Plugin-Info.plist.in" - XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER - "com.obsproject.${target}" - XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS - "${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/entitlements.plist") + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/Plugin-Info.plist.in" + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.obsproject.${target}" + XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/entitlements.plist") set_property(GLOBAL APPEND PROPERTY OBS_MODULE_LIST "${target}") obs_status(ENABLED "${target}") @@ -103,10 +94,8 @@ endfunction() function(setup_script_plugin_target target) set_target_properties( ${target} - PROPERTIES XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER - "com.obsproject.${target}" - XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS - "${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/entitlements.plist") + PROPERTIES XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.obsproject.${target}" + XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/entitlements.plist") set_property(GLOBAL APPEND PROPERTY OBS_SCRIPTING_MODULE_LIST "${target}") obs_status(ENABLED "${target}") @@ -122,13 +111,10 @@ function(install_bundle_resources target) if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/data") file(GLOB_RECURSE _DATA_FILES "${CMAKE_CURRENT_SOURCE_DIR}/data/*") foreach(_DATA_FILE IN LISTS _DATA_FILES) - file(RELATIVE_PATH _RELATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/data/ - ${_DATA_FILE}) + file(RELATIVE_PATH _RELATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/data/ ${_DATA_FILE}) get_filename_component(_RELATIVE_PATH "${_RELATIVE_PATH}" PATH) target_sources(${target} PRIVATE ${_DATA_FILE}) - set_source_files_properties( - ${_DATA_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION - "Resources/${_RELATIVE_PATH}") + set_source_files_properties(${_DATA_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/${_RELATIVE_PATH}") string(REPLACE "\\" "\\\\" _GROUP_NAME "${_RELATIVE_PATH}") source_group("Resources\\${_GROUP_NAME}" FILES ${_DATA_FILE}) endforeach() @@ -138,8 +124,7 @@ endfunction() # Helper function to set up specific resource files for targets function(add_target_resource target resource destination) target_sources(${target} PRIVATE ${resource}) - set_source_files_properties(${resource} PROPERTIES MACOSX_PACKAGE_LOCATION - Resources) + set_source_files_properties(${resource} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) endfunction() # Helper function to set up OBS app target @@ -147,8 +132,7 @@ function(setup_obs_app target) set_target_properties( ${target} PROPERTIES BUILD_WITH_INSTALL_RPATH OFF - XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS - "${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/entitlements.plist" + XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/entitlements.plist" XCODE_SCHEME_ENVIRONMENT "PYTHONDONTWRITEBYTECODE=1") install(TARGETS ${target} BUNDLE DESTINATION "." COMPONENT obs_app) @@ -173,21 +157,19 @@ function(setup_target_browser target) COMPONENT obs_browser_dev EXCLUDE_FROM_ALL) - foreach(_CEF_LIBRARY IN ITEMS "libEGL" "libswiftshader_libEGL" "libGLESv2" - "libswiftshader_libGLESv2" "libvk_swiftshader") + foreach(_CEF_LIBRARY IN ITEMS "libEGL" "libswiftshader_libEGL" "libGLESv2" "libswiftshader_libGLESv2" + "libvk_swiftshader") set(_COMMAND "/usr/bin/codesign --force --sign \\\"${OBS_BUNDLE_CODESIGN_IDENTITY}\\\" $<$:--options linker-signed > \\\"\${CMAKE_INSTALL_PREFIX}/Frameworks/${_CEF_FRAMEWORK_NAME}/Libraries/${_CEF_LIBRARY}.dylib\\\"" ) - list(APPEND _CEF_CODESIGN_COMMANDS - "execute_process(COMMAND /bin/sh -c \"${_COMMAND}\")") + list(APPEND _CEF_CODESIGN_COMMANDS "execute_process(COMMAND /bin/sh -c \"${_COMMAND}\")") endforeach() set(_COMMAND "/usr/bin/codesign --force --sign \\\"${OBS_BUNDLE_CODESIGN_IDENTITY}\\\" $<$:--options linker-signed > --deep \\\"\${CMAKE_INSTALL_PREFIX}/Frameworks/${_CEF_FRAMEWORK_NAME}/Chromium Embedded Framework\\\"" ) - list(APPEND _CEF_CODESIGN_COMMANDS - "execute_process(COMMAND /bin/sh -c \"${_COMMAND}\")") + list(APPEND _CEF_CODESIGN_COMMANDS "execute_process(COMMAND /bin/sh -c \"${_COMMAND}\")") string(REPLACE ";" "\n " _CEF_CODESIGN_COMMANDS "${_CEF_CODESIGN_COMMANDS}") install( CODE "${_CEF_CODESIGN_COMMANDS}" @@ -221,10 +203,8 @@ function(setup_target_browser target) add_custom_command( TARGET ${target} POST_BUILD - COMMAND - "${CMAKE_COMMAND}" --install . --config $ --prefix - $ --component obs_browser_dev > - /dev/null + COMMAND "${CMAKE_COMMAND}" --install . --config $ --prefix $ + --component obs_browser_dev > /dev/null COMMENT "Installing Chromium Embedded Framework for development" VERBATIM) endfunction() @@ -234,15 +214,9 @@ function(setup_obs_frameworks target) get_property(OBS_FRAMEWORK_LIST GLOBAL PROPERTY OBS_FRAMEWORK_LIST) install( TARGETS ${OBS_FRAMEWORK_LIST} - RUNTIME - DESTINATION "$.app/Contents/Frameworks/" - COMPONENT obs_frameworks - LIBRARY - DESTINATION "$.app/Contents/Frameworks/" - COMPONENT obs_frameworks - FRAMEWORK - DESTINATION "$.app/Contents/Frameworks/" - COMPONENT obs_frameworks + RUNTIME DESTINATION "$.app/Contents/Frameworks/" COMPONENT obs_frameworks + LIBRARY DESTINATION "$.app/Contents/Frameworks/" COMPONENT obs_frameworks + FRAMEWORK DESTINATION "$.app/Contents/Frameworks/" COMPONENT obs_frameworks PUBLIC_HEADER DESTINATION "${OBS_INCLUDE_DESTINATION}" COMPONENT obs_libraries @@ -265,14 +239,12 @@ function(setup_obs_modules target) install( TARGETS ${OBS_MODULE_LIST} - LIBRARY - DESTINATION $.app/Contents/PlugIns - COMPONENT obs_plugins - NAMELINK_COMPONENT ${target}_Development) + LIBRARY DESTINATION $.app/Contents/PlugIns + COMPONENT obs_plugins + NAMELINK_COMPONENT ${target}_Development) endif() - get_property(OBS_SCRIPTING_MODULE_LIST GLOBAL - PROPERTY OBS_SCRIPTING_MODULE_LIST) + get_property(OBS_SCRIPTING_MODULE_LIST GLOBAL PROPERTY OBS_SCRIPTING_MODULE_LIST) list(LENGTH OBS_SCRIPTING_MODULE_LIST _LEN) if(_LEN GREATER 0) add_dependencies(${target} ${OBS_SCRIPTING_MODULE_LIST}) @@ -291,18 +263,15 @@ function(setup_obs_modules target) EXCLUDE_FROM_ALL) endif() - install( - TARGETS ${OBS_SCRIPTING_MODULE_LIST} - LIBRARY DESTINATION $.app/Contents/PlugIns - COMPONENT obs_scripting_plugins) + install(TARGETS ${OBS_SCRIPTING_MODULE_LIST} LIBRARY DESTINATION $.app/Contents/PlugIns + COMPONENT obs_scripting_plugins) endif() if(TARGET obs-ffmpeg-mux) add_dependencies(${target} obs-ffmpeg-mux) - install(TARGETS obs-ffmpeg-mux - RUNTIME DESTINATION $.app/Contents/MacOS - COMPONENT obs_plugins) + install(TARGETS obs-ffmpeg-mux RUNTIME DESTINATION $.app/Contents/MacOS + COMPONENT obs_plugins) install( PROGRAMS $ @@ -334,10 +303,8 @@ function(setup_obs_modules target) add_custom_command( TARGET ${target} POST_BUILD - COMMAND - "${CMAKE_COMMAND}" --install .. --config $ --prefix - $ --component obs_plugin_dev > - /dev/null + COMMAND "${CMAKE_COMMAND}" --install .. --config $ --prefix $ + --component obs_plugin_dev > /dev/null COMMENT "Installing OBS plugins for development" VERBATIM) endfunction() @@ -389,12 +356,10 @@ function(setup_obs_bundle target) "$/Resources/themes/Rachni.qss" "$/Resources/themes/Yami.qss") - install(SCRIPT "${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/bundleutils.cmake" - COMPONENT obs_resources) + install(SCRIPT "${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/bundleutils.cmake" COMPONENT obs_resources) endfunction() -# Helper function to export target to build and install tree Allows usage of -# `find_package(libobs)` by other build trees +# Helper function to export target to build and install tree Allows usage of `find_package(libobs)` by other build trees function(export_target target) get_target_property(_IS_FRAMEWORK ${target} FRAMEWORK) @@ -406,9 +371,7 @@ function(export_target target) else() _export_target(${ARGV}) endif() - set_target_properties( - ${target} PROPERTIES PUBLIC_HEADER - "${CMAKE_CURRENT_BINARY_DIR}/${target}_EXPORT.h") + set_target_properties(${target} PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_BINARY_DIR}/${target}_EXPORT.h") endfunction() # Helper function to export macOS framework targets @@ -416,17 +379,14 @@ function(export_framework_target) set(CMAKE_EXPORT_PACKAGE_REGISTRY OFF) include(GenerateExportHeader) - generate_export_header(${target} EXPORT_FILE_NAME - "${CMAKE_CURRENT_BINARY_DIR}/${target}_EXPORT.h") + generate_export_header(${target} EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/${target}_EXPORT.h") - target_sources(${target} - PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/${target}_EXPORT.h") + target_sources(${target} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/${target}_EXPORT.h") set(TARGETS_EXPORT_NAME "${target}Targets") include(CMakePackageConfigHelpers) configure_package_config_file( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/${target}Config.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/${target}Config.cmake" + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/${target}Config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/${target}Config.cmake" INSTALL_DESTINATION Frameworks/${target}.framework/Resources/cmake PATH_VARS OBS_PLUGIN_DESTINATION OBS_DATA_DESTINATION) @@ -451,10 +411,8 @@ function(export_framework_target) EXCLUDE_FROM_ALL) install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/${target}Config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${target}ConfigVersion.cmake - DESTINATION - Frameworks/$.framework/Resources/cmake + FILES ${CMAKE_CURRENT_BINARY_DIR}/${target}Config.cmake ${CMAKE_CURRENT_BINARY_DIR}/${target}ConfigVersion.cmake + DESTINATION Frameworks/$.framework/Resources/cmake COMPONENT obs_libraries EXCLUDE_FROM_ALL) endfunction() diff --git a/cmake/Modules/VersionConfig.cmake b/cmake/Modules/VersionConfig.cmake index 0334c36d9..33f4d5e5e 100644 --- a/cmake/Modules/VersionConfig.cmake +++ b/cmake/Modules/VersionConfig.cmake @@ -1,8 +1,7 @@ set(OBS_COMPANY_NAME "OBS Project") set(OBS_PRODUCT_NAME "OBS Studio") set(OBS_WEBSITE "https://www.obsproject.com") -set(OBS_COMMENTS - "Free and open source software for video recording and live streaming") +set(OBS_COMMENTS "Free and open source software for video recording and live streaming") set(OBS_LEGAL_COPYRIGHT "(C) Hugh Bailey") # Configure default version strings @@ -43,15 +42,13 @@ if(NOT DEFINED OBS_VERSION_OVERRIDE) endif() endif() - # Set release candidate version information Must be a string in the format of - # "x.x.x-rcx" + # Set release candidate version information Must be a string in the format of "x.x.x-rcx" if(DEFINED RELEASE_CANDIDATE) string(REPLACE "-rc" "." _OBS_RELEASE_CANDIDATE ${RELEASE_CANDIDATE}) string(REPLACE "." ";" _OBS_VERSION ${RELEASE_CANDIDATE}) string(REPLACE "." ";" _OBS_RELEASE_CANDIDATE ${_OBS_RELEASE_CANDIDATE}) list(GET _OBS_RELEASE_CANDIDATE 0 1 2 _OBS_VERSION_CANONICAL) - # Set beta version information Must be a string in the format of - # "x.x.x-betax" + # Set beta version information Must be a string in the format of "x.x.x-betax" elseif(DEFINED BETA) string(REPLACE "-beta" "." _OBS_BETA ${BETA}) string(REPLACE "." ";" _OBS_VERSION ${BETA}) @@ -88,15 +85,13 @@ if(OBS_RELEASE_CANDIDATE GREATER 0) AUTHOR_WARNING "******************************************************************************\n" " + OBS-Studio - Release candidate detected, OBS_VERSION is now: ${OBS_VERSION}\n" - "******************************************************************************" - ) + "******************************************************************************") elseif(OBS_BETA GREATER 0) message( AUTHOR_WARNING "******************************************************************************\n" " + OBS-Studio - Beta detected, OBS_VERSION is now: ${OBS_VERSION}\n" - "******************************************************************************" - ) + "******************************************************************************") endif() # Define build number cache file @@ -113,7 +108,4 @@ elseif(NOT DEFINED OBS_BUILD_NUMBER) endif() file(WRITE ${BUILD_NUMBER_CACHE} "${OBS_BUILD_NUMBER}") -message( - STATUS - "OBS: Application Version: ${OBS_VERSION} - Build Number: ${OBS_BUILD_NUMBER}" -) +message(STATUS "OBS: Application Version: ${OBS_VERSION} - Build Number: ${OBS_BUILD_NUMBER}") diff --git a/cmake/bundle/macOS/bundleutils.cmake b/cmake/bundle/macOS/bundleutils.cmake index 780506d7d..a5b0df468 100644 --- a/cmake/bundle/macOS/bundleutils.cmake +++ b/cmake/bundle/macOS/bundleutils.cmake @@ -9,8 +9,7 @@ if(POLICY CMP0011) endif() # Add additional search paths for dylibbundler -list(APPEND _FIXUP_BUNDLES - "-s \"${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/Frameworks\"") +list(APPEND _FIXUP_BUNDLES "-s \"${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/Frameworks\"") list(APPEND _FIXUP_BUNDLES "-s \"${CMAKE_INSTALL_PREFIX}/lib\"") list(APPEND _FIXUP_BUNDLES "-s \"${CMAKE_INSTALL_PREFIX}/Frameworks\"") @@ -27,25 +26,17 @@ endforeach() # Unlinked modules need to be supplied manually to dylibbundler # Find all modules (plugin and standalone) -file(GLOB _OBS_PLUGINS - "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/PlugIns/*.plugin") -file(GLOB _OBS_SCRIPTING_PLUGINS - "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/PlugIns/*.so") +file(GLOB _OBS_PLUGINS "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/PlugIns/*.plugin") +file(GLOB _OBS_SCRIPTING_PLUGINS "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/PlugIns/*.so") # Add modules to fixups foreach(_OBS_PLUGIN IN LISTS _OBS_PLUGINS) get_filename_component(PLUGIN_NAME "${_OBS_PLUGIN}" NAME_WLE) - list(APPEND _FIXUP_BUNDLES - "-x \"${_OBS_PLUGIN}/Contents/MacOS/${PLUGIN_NAME}\"") + list(APPEND _FIXUP_BUNDLES "-x \"${_OBS_PLUGIN}/Contents/MacOS/${PLUGIN_NAME}\"") endforeach() -if(EXISTS - "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/MacOS/obs-ffmpeg-mux") - list( - APPEND - _FIXUP_BUNDLES - "-x \"${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/MacOS/obs-ffmpeg-mux\"" - ) +if(EXISTS "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/MacOS/obs-ffmpeg-mux") + list(APPEND _FIXUP_BUNDLES "-x \"${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/MacOS/obs-ffmpeg-mux\"") endif() # Add scripting modules to fixups @@ -72,27 +63,16 @@ execute_process( ${_QUIET_FLAG}) # Find all dylibs, frameworks and other code elements inside bundle -file(GLOB _DYLIBS - "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/Frameworks/*.dylib") -file(GLOB _FRAMEWORKS - "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/Frameworks/*.framework") -file(GLOB_RECURSE _QT_PLUGINS - "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/PlugIns/*.dylib") +file(GLOB _DYLIBS "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/Frameworks/*.dylib") +file(GLOB _FRAMEWORKS "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/Frameworks/*.framework") +file(GLOB_RECURSE _QT_PLUGINS "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/PlugIns/*.dylib") -if(EXISTS - "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/MacOS/obs-ffmpeg-mux") - list(APPEND _OTHER_BINARIES - "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/MacOS/obs-ffmpeg-mux") +if(EXISTS "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/MacOS/obs-ffmpeg-mux") + list(APPEND _OTHER_BINARIES "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/MacOS/obs-ffmpeg-mux") endif() -if(EXISTS - "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/Resources/obs-mac-virtualcam.plugin" -) - list( - APPEND - _OTHER_BINARIES - "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/Resources/obs-mac-virtualcam.plugin" - ) +if(EXISTS "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/Resources/obs-mac-virtualcam.plugin") + list(APPEND _OTHER_BINARIES "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/Resources/obs-mac-virtualcam.plugin") endif() # Create libobs symlink for legacy plugin support @@ -102,21 +82,16 @@ execute_process( "cd \"${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/Frameworks\" && ln -fs libobs.framework/Versions/Current/libobs libobs.0.dylib && ln -fsv libobs.framework/Versions/Current/libobs libobs.dylib" ${_QUIET_FLAG}) -# Python potentially leaves __pycache__ directories inside the bundle which will -# break codesigning +# Python potentially leaves __pycache__ directories inside the bundle which will break codesigning if(EXISTS "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/PlugIns/__pycache__") - file(REMOVE_RECURSE - "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/PlugIns/__pycache__") + file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/PlugIns/__pycache__") endif() # Codesign all binaries inside-out message(STATUS "OBS: Codesign dependencies") -if(EXISTS - "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/Frameworks/Chromium Embedded Framework.framework" -) +if(EXISTS "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/Frameworks/Chromium Embedded Framework.framework") set(CEF_HELPER_OUTPUT_NAME "OBS Helper") - set(CEF_HELPER_APP_SUFFIXES ":" " (GPU):.gpu" " (Plugin):.plugin" - " (Renderer):.renderer") + set(CEF_HELPER_APP_SUFFIXES ":" " (GPU):.gpu" " (Plugin):.plugin" " (Renderer):.renderer") foreach(_SUFFIXES ${CEF_HELPER_APP_SUFFIXES}) string(REPLACE ":" ";" _SUFFIXES ${_SUFFIXES}) @@ -129,38 +104,31 @@ if(EXISTS execute_process( COMMAND /usr/bin/codesign --remove-signature - "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/Frameworks/OBS Helper${_NAME_SUFFIX}.app" - ${_VERBOSE_FLAG} ${_QUIET_FLAG}) + "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/Frameworks/OBS Helper${_NAME_SUFFIX}.app" ${_VERBOSE_FLAG} + ${_QUIET_FLAG}) execute_process( COMMAND - /usr/bin/codesign --force --sign "${_CODESIGN_IDENTITY}" --deep - --options runtime --entitlements + /usr/bin/codesign --force --sign "${_CODESIGN_IDENTITY}" --deep --options runtime --entitlements "${_CODESIGN_ENTITLEMENTS}/entitlements-helper${_PLIST_SUFFIX}.plist" - "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/Frameworks/OBS Helper${_NAME_SUFFIX}.app" - ${_VERBOSE_FLAG} ${_QUIET_FLAG}) + "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}/Contents/Frameworks/OBS Helper${_NAME_SUFFIX}.app" ${_VERBOSE_FLAG} + ${_QUIET_FLAG}) endforeach() endif() -foreach(_DEPENDENCY IN LISTS _OTHER_BINARIES _DYLIBS _FRAMEWORKS _OBS_PLUGINS - _OBS_SCRIPTING_PLUGINS _QT_PLUGINS) +foreach(_DEPENDENCY IN LISTS _OTHER_BINARIES _DYLIBS _FRAMEWORKS _OBS_PLUGINS _OBS_SCRIPTING_PLUGINS _QT_PLUGINS) if(NOT IS_SYMLINK "${_DEPENDENCY}") - execute_process(COMMAND /usr/bin/codesign --remove-signature - "${_DEPENDENCY}" ${_VERBOSE_FLAG} ${_QUIET_FLAG}) + execute_process(COMMAND /usr/bin/codesign --remove-signature "${_DEPENDENCY}" ${_VERBOSE_FLAG} ${_QUIET_FLAG}) execute_process( - COMMAND - /usr/bin/codesign --force --sign "${_CODESIGN_IDENTITY}" --options - runtime --entitlements "${_CODESIGN_ENTITLEMENTS}/entitlements.plist" - "${_DEPENDENCY}" ${_VERBOSE_FLAG} ${_QUIET_FLAG}) + COMMAND /usr/bin/codesign --force --sign "${_CODESIGN_IDENTITY}" --options runtime --entitlements + "${_CODESIGN_ENTITLEMENTS}/entitlements.plist" "${_DEPENDENCY}" ${_VERBOSE_FLAG} ${_QUIET_FLAG}) endif() endforeach() # Codesign main app message(STATUS "OBS: Codesign main app") +execute_process(COMMAND /usr/bin/codesign --remove-signature "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}" ${_VERBOSE_FLAG} + ${_QUIET_FLAG}) execute_process( COMMAND - /usr/bin/codesign --remove-signature - "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}" ${_VERBOSE_FLAG} ${_QUIET_FLAG}) -execute_process( - COMMAND - /usr/bin/codesign --force --sign "${_CODESIGN_IDENTITY}" --options runtime - --entitlements "${_CODESIGN_ENTITLEMENTS}/entitlements.plist" - "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}" ${_VERBOSE_FLAG} ${_QUIET_FLAG}) + /usr/bin/codesign --force --sign "${_CODESIGN_IDENTITY}" --options runtime --entitlements + "${_CODESIGN_ENTITLEMENTS}/entitlements.plist" "${CMAKE_INSTALL_PREFIX}/${_BUNDLENAME}" ${_VERBOSE_FLAG} + ${_QUIET_FLAG}) diff --git a/cmake/external/ObsPluginHelpers.cmake b/cmake/external/ObsPluginHelpers.cmake index da2cdee4c..811c4aadb 100644 --- a/cmake/external/ObsPluginHelpers.cmake +++ b/cmake/external/ObsPluginHelpers.cmake @@ -17,8 +17,8 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") set(OS_POSIX OFF) endif() -# Old-Style plugin detected, find "modern" libobs variant instead and set global -# include directories to fix "bad" plugin behavior +# Old-Style plugin detected, find "modern" libobs variant instead and set global include directories to fix "bad" plugin +# behavior if(DEFINED LIBOBS_INCLUDE_DIR AND NOT TARGET OBS::libobs) message( DEPRECATION @@ -43,19 +43,15 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND (OS_WINDOWS OR OS_MACOS)) CACHE STRING "Directory to install OBS plugin after building" FORCE) endif() -# Set default build type to RelWithDebInfo and specify allowed alternative -# values +# Set default build type to RelWithDebInfo and specify allowed alternative values if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "RelWithDebInfo" - CACHE STRING - "OBS build type [Release, RelWithDebInfo, Debug, MinSizeRel]" FORCE) - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Release RelWithDebInfo - Debug MinSizeRel) + CACHE STRING "OBS build type [Release, RelWithDebInfo, Debug, MinSizeRel]" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Release RelWithDebInfo Debug MinSizeRel) endif() -# Set default Qt version to AUTO, preferring an available Qt6 with a fallback to -# Qt5 +# Set default Qt version to AUTO, preferring an available Qt6 with a fallback to Qt5 if(NOT QT_VERSION) set(QT_VERSION AUTO @@ -67,16 +63,14 @@ endif() # # * Use QT_VERSION value as a hint for desired Qt version # * If "AUTO" was specified, prefer Qt6 over Qt5 -# * Creates versionless targets of desired component if none had been created by -# Qt itself (Qt versions < 5.15) +# * Creates versionless targets of desired component if none had been created by Qt itself (Qt versions < 5.15) # macro(find_qt) set(multiValueArgs COMPONENTS COMPONENTS_WIN COMPONENTS_MAC COMPONENTS_LINUX) - cmake_parse_arguments(FIND_QT "" "${oneValueArgs}" "${multiValueArgs}" - ${ARGN}) + cmake_parse_arguments(FIND_QT "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - # Do not use versionless targets in the first step to avoid Qt::Core being - # clobbered by later opportunistic find_package runs + # Do not use versionless targets in the first step to avoid Qt::Core being clobbered by later opportunistic + # find_package runs set(QT_NO_CREATE_VERSIONLESS_TARGETS ON) # Loop until _QT_VERSION is set (or FATAL_ERROR aborts script execution early) @@ -132,59 +126,44 @@ macro(find_qt) list(APPEND _QT_COMPONENTS "GuiPrivate") endif() - # Check for versionless targets of each requested component and create if - # necessary + # Check for versionless targets of each requested component and create if necessary foreach(_COMPONENT IN LISTS _QT_COMPONENTS) if(NOT TARGET Qt::${_COMPONENT} AND TARGET Qt${_QT_VERSION}::${_COMPONENT}) add_library(Qt::${_COMPONENT} INTERFACE IMPORTED) - set_target_properties( - Qt::${_COMPONENT} PROPERTIES INTERFACE_LINK_LIBRARIES - Qt${_QT_VERSION}::${_COMPONENT}) + set_target_properties(Qt::${_COMPONENT} PROPERTIES INTERFACE_LINK_LIBRARIES Qt${_QT_VERSION}::${_COMPONENT}) endif() endforeach() endmacro() # Set relative path variables for file configurations -file(RELATIVE_PATH RELATIVE_INSTALL_PATH ${CMAKE_SOURCE_DIR} - ${CMAKE_INSTALL_PREFIX}) +file(RELATIVE_PATH RELATIVE_INSTALL_PATH ${CMAKE_SOURCE_DIR} ${CMAKE_INSTALL_PREFIX}) file(RELATIVE_PATH RELATIVE_BUILD_PATH ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) if(OS_POSIX) # Set default GCC/clang compile options: # # * Treat warnings as errors - # * Enable extra warnings, - # https://clang.llvm.org/docs/DiagnosticsReference.html#wextra - # * Warning about usage of variable length array, - # https://clang.llvm.org/docs/DiagnosticsReference.html#wvla - # * Warning about bad format specifiers, - # https://clang.llvm.org/docs/DiagnosticsReference.html#wformat + # * Enable extra warnings, https://clang.llvm.org/docs/DiagnosticsReference.html#wextra + # * Warning about usage of variable length array, https://clang.llvm.org/docs/DiagnosticsReference.html#wvla + # * Warning about bad format specifiers, https://clang.llvm.org/docs/DiagnosticsReference.html#wformat # * Warning about non-strings used as format strings, # https://clang.llvm.org/docs/DiagnosticsReference.html#wformat-security - # * Warning about non-exhaustive switch blocks, - # https://clang.llvm.org/docs/DiagnosticsReference.html#wswitch - # * Warning about unused parameters, - # https://clang.llvm.org/docs/DiagnosticsReference.html#wunused-parameter - # * DISABLE warning about unused functions, - # https://clang.llvm.org/docs/DiagnosticsReference.html#wunused-function + # * Warning about non-exhaustive switch blocks, https://clang.llvm.org/docs/DiagnosticsReference.html#wswitch + # * Warning about unused parameters, https://clang.llvm.org/docs/DiagnosticsReference.html#wunused-parameter + # * DISABLE warning about unused functions, https://clang.llvm.org/docs/DiagnosticsReference.html#wunused-function # * DISABLE warning about missing field initializers, # https://clang.llvm.org/docs/DiagnosticsReference.html#wmissing-field-initializers # * DISABLE strict aliasing optimisations - # * C ONLY - treat implicit function declarations (use before declare) as - # errors, + # * C ONLY - treat implicit function declarations (use before declare) as errors, # https://clang.llvm.org/docs/DiagnosticsReference.html#wimplicit-function-declaration - # * C ONLY - DISABLE warning about missing braces around subobject - # initalizers, + # * C ONLY - DISABLE warning about missing braces around subobject initalizers, # https://clang.llvm.org/docs/DiagnosticsReference.html#wmissing-braces - # * C ONLY, Clang ONLY - Warning about implicit conversion of NULL to another - # type, + # * C ONLY, Clang ONLY - Warning about implicit conversion of NULL to another type, # https://clang.llvm.org/docs/DiagnosticsReference.html#wnull-conversion - # * C & C++, Clang ONLY - Disable warning about integer conversion losing - # precision, + # * C & C++, Clang ONLY - Disable warning about integer conversion losing precision, # https://clang.llvm.org/docs/DiagnosticsReference.html#wshorten-64-to-32 # * C++, GCC ONLY - Warning about implicit conversion of NULL to another type - # * Enable color diagnostics on Clang (CMAKE_COLOR_DIAGNOSTICS available in - # CMake 3.24) + # * Enable color diagnostics on Clang (CMAKE_COLOR_DIAGNOSTICS available in CMake 3.24) target_compile_options( ${CMAKE_PROJECT_NAME} PRIVATE @@ -204,12 +183,10 @@ if(OS_POSIX) "$<$:-Wconversion-null>" "$<$:-DDEBUG=1;-D_DEBUG=1>") - # GCC 12.1.0 has a regression bug which trigger maybe-uninitialized warnings - # where there is not. (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105562) - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION - VERSION_EQUAL "12.1.0") - target_compile_options(${CMAKE_PROJECT_NAME} - PRIVATE -Wno-error=maybe-uninitialized) + # GCC 12.1.0 has a regression bug which trigger maybe-uninitialized warnings where there is not. + # (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105562) + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "12.1.0") + target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE -Wno-error=maybe-uninitialized) endif() if(NOT CCACHE_SET) @@ -254,15 +231,12 @@ else() string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} _HOST_ARCH) endif() -if(_HOST_ARCH MATCHES "i[3-6]86|x86|x64|x86_64|amd64" - AND NOT CMAKE_OSX_ARCHITECTURES STREQUAL "arm64") - # Enable MMX, SSE and SSE2 on compatible host systems (assuming no - # cross-compile) +if(_HOST_ARCH MATCHES "i[3-6]86|x86|x64|x86_64|amd64" AND NOT CMAKE_OSX_ARCHITECTURES STREQUAL "arm64") + # Enable MMX, SSE and SSE2 on compatible host systems (assuming no cross-compile) set(ARCH_SIMD_FLAGS -mmmx -msse -msse2) elseif(_HOST_ARCH MATCHES "arm64|arm64e|aarch64") # Enable available built-in SIMD support in Clang and GCC - if(CMAKE_C_COMPILER_ID MATCHES "^(Apple)?Clang|GNU" - OR CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang|GNU") + if(CMAKE_C_COMPILER_ID MATCHES "^(Apple)?Clang|GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang|GNU") include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) @@ -270,22 +244,17 @@ elseif(_HOST_ARCH MATCHES "arm64|arm64e|aarch64") check_cxx_compiler_flag("-fopenmp-simd" CXX_COMPILER_SUPPORTS_OPENMP_SIMD) target_compile_options( ${CMAKE_PROJECT_NAME} - PRIVATE - -DSIMDE_ENABLE_OPENMP - "$<$,$>:-fopenmp-simd>" - "$<$,$>:-fopenmp-simd>" - ) + PRIVATE -DSIMDE_ENABLE_OPENMP + "$<$,$>:-fopenmp-simd>" + "$<$,$>:-fopenmp-simd>") endif() endif() # macOS specific settings if(OS_MACOS) # Set macOS-specific C++ standard library - target_compile_options( - ${CMAKE_PROJECT_NAME} - PRIVATE - "$<$:-fcolor-diagnostics>" - -stdlib=libc++) + target_compile_options(${CMAKE_PROJECT_NAME} + PRIVATE "$<$:-fcolor-diagnostics>" -stdlib=libc++) # Set build architecture to host architecture by default if(NOT CMAKE_OSX_ARCHITECTURES) @@ -293,11 +262,9 @@ if(OS_MACOS) ${CMAKE_HOST_SYSTEM_PROCESSOR} CACHE STRING "Build architecture for macOS" FORCE) endif() - set_property(CACHE CMAKE_OSX_ARCHITECTURES PROPERTY STRINGS arm64 x86_64 - "arm64;x86_64") + set_property(CACHE CMAKE_OSX_ARCHITECTURES PROPERTY STRINGS arm64 x86_64 "arm64;x86_64") - # Set deployment target to 11.0 for Apple Silicon or 10.15 for Intel and - # Universal builds + # Set deployment target to 11.0 for Apple Silicon or 10.15 for Intel and Universal builds if(NOT CMAKE_OSX_DEPLOYMENT_TARGET) set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET[arch=arm64] "11.0") set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET[arch=x86_64] "10.15") @@ -310,15 +277,11 @@ if(OS_MACOS) set(CMAKE_OSX_DEPLOYMENT_TARGET ${_MACOS_DEPLOYMENT_TARGET} - CACHE - STRING - "Minimum macOS version to target for deployment (at runtime); newer APIs weak linked" - FORCE) + CACHE STRING "Minimum macOS version to target for deployment (at runtime); newer APIs weak linked" FORCE) unset(_MACOS_DEPLOYMENT_TARGET) endif() - set_property(CACHE CMAKE_OSX_DEPLOYMENT_TARGET PROPERTY STRINGS 13.0 12.0 - 11.0 10.15) + set_property(CACHE CMAKE_OSX_DEPLOYMENT_TARGET PROPERTY STRINGS 13.0 12.0 11.0 10.15) # Override macOS install directory if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) @@ -327,19 +290,16 @@ if(OS_MACOS) CACHE STRING "Directory to install OBS to after building" FORCE) endif() - # Set up codesigning for Xcode builds with team IDs or standalone builds with - # developer identity + # Set up codesigning for Xcode builds with team IDs or standalone builds with developer identity if(NOT OBS_BUNDLE_CODESIGN_TEAM) if(NOT OBS_BUNDLE_CODESIGN_IDENTITY) set(OBS_BUNDLE_CODESIGN_IDENTITY "-" CACHE STRING "OBS code signing identity for macOS" FORCE) endif() - set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY - ${OBS_BUNDLE_CODESIGN_IDENTITY}) + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ${OBS_BUNDLE_CODESIGN_IDENTITY}) else() - # Team ID specified, warn if Xcode generator is not used and fall back to - # ad-hoc signing + # Team ID specified, warn if Xcode generator is not used and fall back to ad-hoc signing if(NOT XCODE) message( WARNING @@ -352,27 +312,25 @@ if(OS_MACOS) endif() else() unset(OBS_BUNDLE_CODESIGN_IDENTITY) - set_property(CACHE OBS_BUNDLE_CODESIGN_TEAM - PROPERTY HELPSTRING "OBS code signing team for macOS") + set_property(CACHE OBS_BUNDLE_CODESIGN_TEAM PROPERTY HELPSTRING "OBS code signing team for macOS") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_STYLE Automatic) set(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM ${OBS_BUNDLE_CODESIGN_TEAM}) endif() endif() - # Set path to entitlements property list for codesigning. Entitlements should - # match the host binary, in this case OBS.app. + # Set path to entitlements property list for codesigning. Entitlements should match the host binary, in this case + # OBS.app. set(OBS_CODESIGN_ENTITLEMENTS ${CMAKE_SOURCE_DIR}/cmake/bundle/macos/entitlements.plist CACHE INTERNAL "Path to codesign entitlements plist") - # Enable linker codesigning by default. Building OBS or plugins on host - # systems older than macOS 10.15 is not supported + # Enable linker codesigning by default. Building OBS or plugins on host systems older than macOS 10.15 is not + # supported set(OBS_CODESIGN_LINKER ON CACHE BOOL "Enable linker codesigning on macOS (macOS 11+ required)") - # Tell Xcode to pretend the linker signed binaries so that editing with - # install_name_tool preserves ad-hoc signatures. This option is supported by - # codesign on macOS 11 or higher. See CMake Issue 21854: + # Tell Xcode to pretend the linker signed binaries so that editing with install_name_tool preserves ad-hoc signatures. + # This option is supported by codesign on macOS 11 or higher. See CMake Issue 21854: # https://gitlab.kitware.com/cmake/cmake/-/issues/21854 if(OBS_CODESIGN_LINKER) set(CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS "-o linker-signed") @@ -402,8 +360,7 @@ if(OS_MACOS) if(NOT DEFINED MACOSX_PLUGIN_BUNDLE_VERSION) message( FATAL_ERROR - "No 'MACOSX_PLUGIN_BUNDLE_VERSION' set, but is required to build plugin bundles on macOS - example: '25'" - ) + "No 'MACOSX_PLUGIN_BUNDLE_VERSION' set, but is required to build plugin bundles on macOS - example: '25'") endif() if(NOT DEFINED MACOSX_PLUGIN_SHORT_VERSION_STRING) @@ -438,42 +395,36 @@ if(OS_MACOS) NAMELINK_COMPONENT ${target}_Development) if(TARGET Qt::Core) - # Framework version has changed between Qt5 (uses wrong numerical version) - # and Qt6 (uses correct alphabetical version) + # Framework version has changed between Qt5 (uses wrong numerical version) and Qt6 (uses correct alphabetical + # version) if(${_QT_VERSION} EQUAL 5) set(_QT_FW_VERSION "${QT_VERSION}") else() set(_QT_FW_VERSION "A") endif() - # Set up install-time command to fix Qt library references to point into - # OBS.app bundle + # Set up install-time command to fix Qt library references to point into OBS.app bundle set(_COMMAND "${CMAKE_INSTALL_NAME_TOOL} \\ -change ${CMAKE_PREFIX_PATH}/lib/QtWidgets.framework/Versions/${QT_VERSION}/QtWidgets @rpath/QtWidgets.framework/Versions/${_QT_FW_VERSION}/QtWidgets \\ -change ${CMAKE_PREFIX_PATH}/lib/QtCore.framework/Versions/${QT_VERSION}/QtCore @rpath/QtCore.framework/Versions/${_QT_FW_VERSION}/QtCore \\ -change ${CMAKE_PREFIX_PATH}/lib/QtGui.framework/Versions/${QT_VERSION}/QtGui @rpath/QtGui.framework/Versions/${_QT_FW_VERSION}/QtGui \\ - \\\"\${CMAKE_INSTALL_PREFIX}/${target}.plugin/Contents/MacOS/${target}\\\"" - ) - install(CODE "execute_process(COMMAND /bin/sh -c \"${_COMMAND}\")" - COMPONENT obs_plugins) + \\\"\${CMAKE_INSTALL_PREFIX}/${target}.plugin/Contents/MacOS/${target}\\\"") + install(CODE "execute_process(COMMAND /bin/sh -c \"${_COMMAND}\")" COMPONENT obs_plugins) unset(_QT_FW_VERSION) endif() # Set macOS bundle properties set_target_properties( ${target} - PROPERTIES - PREFIX "" - BUNDLE ON - BUNDLE_EXTENSION "plugin" - OUTPUT_NAME ${target} - MACOSX_BUNDLE_INFO_PLIST - "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/bundle/macOS/Plugin-Info.plist.in" - XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER - "${MACOSX_PLUGIN_GUI_IDENTIFIER}" - XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS - "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/bundle/macOS/entitlements.plist") + PROPERTIES PREFIX "" + BUNDLE ON + BUNDLE_EXTENSION "plugin" + OUTPUT_NAME ${target} + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/bundle/macOS/Plugin-Info.plist.in" + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${MACOSX_PLUGIN_GUI_IDENTIFIER}" + XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS + "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/bundle/macOS/entitlements.plist") # If not building with Xcode, manually code-sign the plugin if(NOT XCODE) @@ -483,8 +434,7 @@ if(OS_MACOS) --options runtime \\ --entitlements \\\"${CMAKE_CURRENT_FUNCTION_LIST_DIR}/bundle/macOS/entitlements.plist\\\" \\ \\\"\${CMAKE_INSTALL_PREFIX}/${target}.plugin\\\"") - install(CODE "execute_process(COMMAND /bin/sh -c \"${_COMMAND}\")" - COMPONENT obs_plugins) + install(CODE "execute_process(COMMAND /bin/sh -c \"${_COMMAND}\")" COMPONENT obs_plugins) endif() install_bundle_resources(${target}) @@ -495,13 +445,10 @@ if(OS_MACOS) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/data) file(GLOB_RECURSE _DATA_FILES "${CMAKE_CURRENT_SOURCE_DIR}/data/*") foreach(_DATA_FILE IN LISTS _DATA_FILES) - file(RELATIVE_PATH _RELATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/data/ - ${_DATA_FILE}) + file(RELATIVE_PATH _RELATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/data/ ${_DATA_FILE}) get_filename_component(_RELATIVE_PATH ${_RELATIVE_PATH} PATH) target_sources(${target} PRIVATE ${_DATA_FILE}) - set_source_files_properties( - ${_DATA_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION - Resources/${_RELATIVE_PATH}) + set_source_files_properties(${_DATA_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/${_RELATIVE_PATH}) string(REPLACE "\\" "\\\\" _GROUP_NAME ${_RELATIVE_PATH}) source_group("Resources\\${_GROUP_NAME}" FILES ${_DATA_FILE}) endforeach() @@ -518,8 +465,7 @@ else() # Unix specific settings if(OS_POSIX) - # Paths to binaries and plugins differ between portable and non-portable - # builds on Linux + # Paths to binaries and plugins differ between portable and non-portable builds on Linux option(LINUX_PORTABLE "Build portable version (Linux)" ON) if(NOT LINUX_PORTABLE) set(OBS_LIBRARY_DESTINATION ${CMAKE_INSTALL_LIBDIR}) @@ -529,8 +475,7 @@ else() else() set(OBS_LIBRARY_DESTINATION bin/${_ARCH_SUFFIX}bit) set(OBS_PLUGIN_DESTINATION obs-plugins/${_ARCH_SUFFIX}bit) - set(CMAKE_INSTALL_RPATH - "$ORIGIN/" "${CMAKE_INSTALL_PREFIX}/${OBS_LIBRARY_DESTINATION}") + set(CMAKE_INSTALL_RPATH "$ORIGIN/" "${CMAKE_INSTALL_PREFIX}/${OBS_LIBRARY_DESTINATION}") set(OBS_DATA_DESTINATION "data") endif() @@ -539,13 +484,11 @@ else() set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}") set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${LINUX_MAINTAINER_EMAIL}") set(CPACK_PACKAGE_VERSION "${CMAKE_PROJECT_VERSION}") - set(CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-linux-x86_64") + set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-linux-x86_64") set(CPACK_GENERATOR "DEB") set(CPACK_DEBIAN_PACKAGE_DEPENDS - "obs-studio (>= 27.0.0), libqt5core5a (>= 5.9.0~beta), libqt5gui5 (>= 5.3.0), libqt5widgets5 (>= 5.7.0)" - ) + "obs-studio (>= 27.0.0), libqt5core5a (>= 5.9.0~beta), libqt5gui5 (>= 5.3.0), libqt5widgets5 (>= 5.7.0)") set(CPACK_OUTPUT_FILE_PREFIX ${CMAKE_SOURCE_DIR}/release) @@ -574,8 +517,7 @@ else() # https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level?view=msvc-170 # * Enable treating all warnings as errors, # https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level?view=msvc-170 - # * RelWithDebInfo ONLY - Enable expanding of all functions not explicitly - # marked for no inlining, + # * RelWithDebInfo ONLY - Enable expanding of all functions not explicitly marked for no inlining, # https://docs.microsoft.com/en-us/cpp/build/reference/ob-inline-function-expansion?view=msvc-170 # * Enable UNICODE support, # https://docs.microsoft.com/en-us/windows/win32/learnwin32/working-with-strings#unicode-and-ansi-functions @@ -608,8 +550,7 @@ else() # https://docs.microsoft.com/en-us/cpp/build/reference/safeseh-image-has-safe-exception-handlers?view=msvc-170 # * Debug ONLY - DISABLE incremental linking, # https://docs.microsoft.com/en-us/cpp/build/reference/incremental-link-incrementally?view=msvc-170 - # * RelWithDebInfo ONLY - Disable incremental linking, but enable COMDAT - # folding, + # * RelWithDebInfo ONLY - Disable incremental linking, but enable COMDAT folding, # https://docs.microsoft.com/en-us/cpp/build/reference/opt-optimizations?view=msvc-170 target_link_options( ${CMAKE_PROJECT_NAME} @@ -624,15 +565,13 @@ else() # Helper function for plugin targets (Windows and Linux version) function(setup_plugin_target target) - # Set prefix to empty string to avoid automatic naming of generated library, - # i.e. "lib" + # Set prefix to empty string to avoid automatic naming of generated library, i.e. "lib" set_target_properties(${target} PROPERTIES PREFIX "") # Set install directories install( TARGETS ${target} - RUNTIME DESTINATION "${OBS_PLUGIN_DESTINATION}" - COMPONENT ${target}_Runtime + RUNTIME DESTINATION "${OBS_PLUGIN_DESTINATION}" COMPONENT ${target}_Runtime LIBRARY DESTINATION "${OBS_PLUGIN_DESTINATION}" COMPONENT ${target}_Runtime NAMELINK_COMPONENT ${target}_Development) @@ -674,11 +613,8 @@ else() add_custom_command( TARGET ${target} POST_BUILD - COMMAND - "${CMAKE_COMMAND}" -DCMAKE_INSTALL_PREFIX=${OBS_OUTPUT_DIR} - -DCMAKE_INSTALL_COMPONENT=obs_rundir - -DCMAKE_INSTALL_CONFIG_NAME=$ -P - ${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake + COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_PREFIX=${OBS_OUTPUT_DIR} -DCMAKE_INSTALL_COMPONENT=obs_rundir + -DCMAKE_INSTALL_CONFIG_NAME=$ -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake COMMENT "Installing to plugin rundir" VERBATIM) endfunction() @@ -702,11 +638,10 @@ else() endfunction() if(OS_WINDOWS) - # Additional Windows-only helper function to copy plugin to existing OBS - # development directory: + # Additional Windows-only helper function to copy plugin to existing OBS development directory: # - # Copies plugin with associated PDB symbol files as well as contents of data - # directory into the OBS rundir as specified by "OBS_BUILD_DIR". + # Copies plugin with associated PDB symbol files as well as contents of data directory into the OBS rundir as + # specified by "OBS_BUILD_DIR". function(setup_target_for_testing target destination) install( FILES $ @@ -731,11 +666,8 @@ else() add_custom_command( TARGET ${target} POST_BUILD - COMMAND - "${CMAKE_COMMAND}" -DCMAKE_INSTALL_PREFIX=${OBS_BUILD_DIR}/rundir - -DCMAKE_INSTALL_COMPONENT=obs_testing - -DCMAKE_INSTALL_CONFIG_NAME=$ -P - ${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake + COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_PREFIX=${OBS_BUILD_DIR}/rundir -DCMAKE_INSTALL_COMPONENT=obs_testing + -DCMAKE_INSTALL_CONFIG_NAME=$ -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake COMMENT "Installing to OBS test directory" VERBATIM) endfunction() diff --git a/cmake/finders/.cmake-format.json b/cmake/finders/.cmake-format.json deleted file mode 100644 index 75fd03ad3..000000000 --- a/cmake/finders/.cmake-format.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "format": { - "line_width": 120, - "tab_size": 2, - "dangle_parens": false, - "enable_sort": true, - "autosort": true - }, - "additional_commands": { - "find_qt": { - "flags": [], - "kwargs": { - "COMPONENTS": "+", - "COMPONENTS_WIN": "+", - "COMPONENTS_MACOS": "+", - "COMPONENTS_LINUX": "+" - } - }, - "set_target_properties_obs": { - "pargs": 1, - "flags": [], - "kwargs": { - "PROPERTIES": { - "kwargs": { - "PREFIX": 1, - "OUTPUT_NAME": 1, - "FOLDER": 1, - "VERSION": 1, - "SOVERSION": 1, - "FRAMEWORK": 1, - "BUNDLE": 1, - "AUTOMOC": 1, - "AUTOUIC": 1, - "AUTORCC": 1, - "AUTOUIC_SEARCH_PATHS": 1 - } - } - } - } - } -} diff --git a/cmake/finders/FindAsio.cmake b/cmake/finders/FindAsio.cmake new file mode 100644 index 000000000..355ce09d4 --- /dev/null +++ b/cmake/finders/FindAsio.cmake @@ -0,0 +1,94 @@ +#[=======================================================================[.rst +FindAsio +-------- + +FindModule for Asio and the associated library + +Imported Targets +^^^^^^^^^^^^^^^^ + +.. versionadded:: 2.0 + +This module defines the :prop_tgt:`IMPORTED` target ``Asio::Asio``. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module sets the following variables: + +``Asio_FOUND`` + True, if the library was found. +``Asio_VERSION`` + Detected version of found Asio library. + +Cache variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``Asio_INCLUDE_DIR`` + Directory containing ``asio.hpp``. + +#]=======================================================================] + +# cmake-format: off +# cmake-lint: disable=C0103 +# cmake-lint: disable=C0301 +# cmake-format: on + +include(FindPackageHandleStandardArgs) + +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_search_module(PC_Asio QUIET asio) +endif() + +find_path( + Asio_INCLUDE_DIR + NAMES asio.hpp + HINTS ${PC_Asio_INCLUDE_DIRS} + PATHS /usr/include /usr/local/include + DOC "Asio include directory") + +if(PC_Asio_VERSION VERSION_GREATER 0) + set(Asio_VERSION ${PC_Asio_VERSION}) +elseif(EXISTS "${Asio_INCLUDE_DIR}/asio/version.hpp") + file(STRINGS "${Asio_INCLUDE_DIR}/asio/version.hpp" _version_string + REGEX "#define[ \t]+ASIO_VERSION[ \t]+[0-9]+[ \t]+\\/\\/[ \t][0-9]+\\.[0-9]+\\.[0-9]+") + + string(REGEX REPLACE "#define[ \t]+ASIO_VERSION[ \t]+[0-9]+[ \t]+\\/\\/[ \t]([0-9]+\\.[0-9]+\\.[0-9]+)" "\\1" + Asio_VERSION "${_version_string}") +else() + if(NOT Asio_FIND_QUIETLY) + message(AUTHOR_WARNING "Failed to find Asio version.") + endif() + set(Asio_VERSION 0.0.0) +endif() + +if(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin|Windows") + set(Asio_ERROR_REASON "Ensure that obs-deps is provided as part of CMAKE_PREFIX_PATH.") +elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|FreeBSD") + set(Asio_ERROR_REASON "Ensure Asio library is available in local include paths.") +endif() + +find_package_handle_standard_args( + Asio + REQUIRED_VARS Asio_INCLUDE_DIR + VERSION_VAR Asio_VERSION REASON_FAILURE_MESSAGE "${Asio_ERROR_REASON}") +mark_as_advanced(Asio_INCLUDE_DIR) +unset(Asio_ERROR_REASON) + +if(Asio_FOUND) + if(NOT TARGET Asio::Asio) + add_library(Asio::Asio INTERFACE IMPORTED) + set_target_properties(Asio::Asio PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Asio_INCLUDE_DIR}") + endif() +endif() + +include(FeatureSummary) +set_package_properties( + Asio PROPERTIES + URL "http://think-async.com/Asio" + DESCRIPTION + "Asio is a cross-platform C++ library for network and low-level I/O programming that provides developers with a consistent asynchronous model using a modern C++ approach." +) diff --git a/cmake/finders/FindWebsocketpp.cmake b/cmake/finders/FindWebsocketpp.cmake new file mode 100644 index 000000000..0806438a6 --- /dev/null +++ b/cmake/finders/FindWebsocketpp.cmake @@ -0,0 +1,91 @@ +#[=======================================================================[.rst +FindWebsocketpp +--------------- + +FindModule for WebSocket++ and the associated library + +Imported Targets +^^^^^^^^^^^^^^^^ + +.. versionadded:: 2.0 + +This module defines the :prop_tgt:`IMPORTED` target ``Websocketpp::Websocketpp``. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module sets the following variables: + +``Websocketpp_FOUND`` + True, if the library was found. +``Websocketpp_VERSION`` + Detected version of found Websocketpp library. + +Cache variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``Websocketpp_INCLUDE_DIR`` + Directory containing ``websocketpp/client.hpp``. + +#]=======================================================================] + +# cmake-format: off +# cmake-lint: disable=C0103 +# cmake-lint: disable=C0301 +# cmake-format: on + +include(FindPackageHandleStandardArgs) + +find_path( + Websocketpp_INCLUDE_DIR + NAMES websocketpp/client.hpp + PATHS /usr/include /usr/local/include + DOC "WebSocket++ include directory") + +if(EXISTS "${Websocketpp_INCLUDE_DIR}/websocketpp/version.hpp") + file(STRINGS "${Websocketpp_INCLUDE_DIR}/websocketpp/version.hpp" _version_string + REGEX "^.*(major|minor|patch)_version[ \t]+=[ \t]+[0-9]+") + + string(REGEX REPLACE ".*major_version[ \t]+=[ \t]+([0-9]+).*" "\\1" _version_major "${_version_string}") + string(REGEX REPLACE ".*minor_version[ \t]+=[ \t]+([0-9]+).*" "\\1" _version_minor "${_version_string}") + string(REGEX REPLACE ".*patch_version[ \t]+=[ \t]+([0-9]+).*" "\\1" _version_patch "${_version_string}") + + set(Websocketpp_VERSION "${_version_major}.${_version_minor}.${_version_patch}") + unset(_version_major) + unset(_version_minor) + unset(_version_patch) +else() + if(NOT Websocketpp_FIND_QUIETLY) + message(AUTHOR_WARNING "Failed to find WebSocket++ version.") + endif() + set(Websocketpp_VERSION 0.0.0) +endif() + +if(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin|Windows") + set(Websocketpp_ERROR_REASON "Ensure that obs-deps is provided as part of CMAKE_PREFIX_PATH.") +elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|FreeBSD") + set(Websocketpp_ERROR_REASON "Ensure WebSocket++ library is available in local include paths.") +endif() + +find_package_handle_standard_args( + Websocketpp + REQUIRED_VARS Websocketpp_INCLUDE_DIR + VERSION_VAR Websocketpp_VERSION REASON_FAILURE_MESSAGE "${Websocketpp_ERROR_REASON}") +mark_as_advanced(Websocketpp_INCLUDE_DIR) +unset(Websocketpp_ERROR_REASON) + +if(Websocketpp_FOUND) + if(NOT TARGET Websocketpp::Websocketpp) + add_library(Websocketpp::Websocketpp INTERFACE IMPORTED) + set_target_properties(Websocketpp::Websocketpp PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${Websocketpp_INCLUDE_DIR}") + endif() +endif() + +include(FeatureSummary) +set_package_properties( + Websocketpp PROPERTIES + URL "https://www.zaphoyd.com/websocketpp/" + DESCRIPTION "WebSocket++ is a header only C++ library that implements RFC6455 The WebSocket Protocol.") diff --git a/cmake/macos/.cmake-format.json b/cmake/macos/.cmake-format.json deleted file mode 100644 index 75fd03ad3..000000000 --- a/cmake/macos/.cmake-format.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "format": { - "line_width": 120, - "tab_size": 2, - "dangle_parens": false, - "enable_sort": true, - "autosort": true - }, - "additional_commands": { - "find_qt": { - "flags": [], - "kwargs": { - "COMPONENTS": "+", - "COMPONENTS_WIN": "+", - "COMPONENTS_MACOS": "+", - "COMPONENTS_LINUX": "+" - } - }, - "set_target_properties_obs": { - "pargs": 1, - "flags": [], - "kwargs": { - "PROPERTIES": { - "kwargs": { - "PREFIX": 1, - "OUTPUT_NAME": 1, - "FOLDER": 1, - "VERSION": 1, - "SOVERSION": 1, - "FRAMEWORK": 1, - "BUNDLE": 1, - "AUTOMOC": 1, - "AUTOUIC": 1, - "AUTORCC": 1, - "AUTOUIC_SEARCH_PATHS": 1 - } - } - } - } - } -} diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 90ceeb6be..9e92bb114 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -1,3 +1,7 @@ +if(OBS_CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.0) + return() +endif() + if(OS_WINDOWS) if(NOT MINGW) add_subdirectory(w32-pthreads) diff --git a/deps/blake2/CMakeLists.txt b/deps/blake2/CMakeLists.txt index 393efa8d9..dbdc9cbb4 100644 --- a/deps/blake2/CMakeLists.txt +++ b/deps/blake2/CMakeLists.txt @@ -1,18 +1,18 @@ -project(blake2) +cmake_minimum_required(VERSION 3.16...3.25) -add_library(blake2 STATIC) +add_library(blake2 STATIC EXCLUDE_FROM_ALL ) add_library(OBS::blake2 ALIAS blake2) target_sources(blake2 PRIVATE src/blake2b-ref.c src/blake2.h src/blake2-impl.h) -target_include_directories(blake2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) +target_include_directories(blake2 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src") +set_source_files_properties( + src/blake2b-ref.c PROPERTIES COMPILE_OPTIONS + "$<$:-Wno-error=implicit-int-conversion>") if(OS_WINDOWS) - if(MSVC) - target_compile_options(blake2 PRIVATE "$,/MTd,/MT>" /Zl) - endif() - + target_compile_options(blake2 PRIVATE $,/MTd,/MT> /Zl) target_compile_definitions(blake2 PRIVATE inline=_inline restrict=__restrict) endif() -set_target_properties(blake2 PROPERTIES FOLDER "deps") +set_target_properties(blake2 PROPERTIES FOLDER deps) diff --git a/deps/file-updater/CMakeLists.txt b/deps/file-updater/CMakeLists.txt index 3ac04deeb..870f7952f 100644 --- a/deps/file-updater/CMakeLists.txt +++ b/deps/file-updater/CMakeLists.txt @@ -1,17 +1,12 @@ -project(file-updater) +cmake_minimum_required(VERSION 3.22...3.25) find_package(CURL REQUIRED) -add_library(file-updater INTERFACE) +add_library(file-updater INTERFACE EXCLUDE_FROM_ALL) add_library(OBS::file-updater ALIAS file-updater) -target_sources(file-updater INTERFACE file-updater/file-updater.c - file-updater/file-updater.h) +target_sources(file-updater INTERFACE file-updater/file-updater.c file-updater/file-updater.h) -target_link_libraries(file-updater INTERFACE CURL::libcurl) +target_link_libraries(file-updater INTERFACE CURL::libcurl $<$:OBS::w32-pthreads>) -target_include_directories(file-updater INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) - -if(OS_WINDOWS AND NOT MINGW) - target_link_libraries(file-updater INTERFACE OBS::w32-pthreads) -endif() +target_include_directories(file-updater INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") diff --git a/deps/glad/CMakeLists.txt b/deps/glad/CMakeLists.txt index 0e49e1d8d..ccfca1c87 100644 --- a/deps/glad/CMakeLists.txt +++ b/deps/glad/CMakeLists.txt @@ -1,47 +1,28 @@ -project(glad) +cmake_minimum_required(VERSION 3.16...3.25) find_package(OpenGL REQUIRED) -add_library(glad SHARED) -add_library(OBS::obsglad ALIAS glad) +add_library(obsglad STATIC EXCLUDE_FROM_ALL ) +add_library(OBS::glad ALIAS obsglad) -target_sources(glad PRIVATE src/glad.c include/glad/glad.h) +if(OBS_CMAKE_VERSION VERSION_LESS 3.0.0) + add_library(OBS::obsglad ALIAS obsglad) +endif() -target_include_directories(glad PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_sources(obsglad PRIVATE src/glad.c include/glad/glad.h) -target_compile_definitions(glad PRIVATE GLAD_GLAPI_EXPORT_BUILD) +target_include_directories(obsglad PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") -target_link_libraries(glad PUBLIC OpenGL::GL) - -set_target_properties( - glad - PROPERTIES OUTPUT_NAME obsglad - FOLDER "deps" - VERSION "${OBS_VERSION_MAJOR}" - SOVERSION "1") +target_link_libraries(obsglad PUBLIC OpenGL::GL) if(OS_WINDOWS) - set(MODULE_DESCRIPTION "Glad OpenGL Loading Library") - - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - obsglad.rc) - - target_sources(glad PRIVATE src/glad_wgl.c include/glad/glad_wgl.h obsglad.rc) - -elseif(OS_POSIX AND NOT OS_MACOS) - find_package(OpenGL REQUIRED) - + target_sources(obsglad PRIVATE src/glad_wgl.c include/glad/glad_wgl.h) +elseif(OS_LINUX OR OS_FREEBSD) if(TARGET OpenGL::EGL) - target_sources(glad PRIVATE src/glad_egl.c include/EGL/eglplatform.h - include/glad/glad_egl.h) + target_sources(obsglad PRIVATE src/glad_egl.c include/EGL/eglplatform.h include/glad/glad_egl.h) - target_link_libraries(glad PRIVATE OpenGL::EGL) + target_link_libraries(obsglad PRIVATE OpenGL::EGL) endif() - endif() -if(NOT MSVC) - target_compile_options(glad PRIVATE -fvisibility=hidden) -endif() - -setup_binary_target(glad) +set_target_properties(obsglad PROPERTIES FOLDER deps POSITION_INDEPENDENT_CODE TRUE) diff --git a/deps/glad/include/glad/glad.h b/deps/glad/include/glad/glad.h index 26ee8ee6f..369bdd5b7 100644 --- a/deps/glad/include/glad/glad.h +++ b/deps/glad/include/glad/glad.h @@ -33,8 +33,6 @@ extern "C" { typedef void* (* GLADloadproc)(const char *name); -#define GLAD_GLAPI_EXPORT - #ifndef GLAPI # if defined(GLAD_GLAPI_EXPORT) # if defined(WIN32) || defined(__CYGWIN__) diff --git a/deps/glad/include/glad/glad_egl.h b/deps/glad/include/glad/glad_egl.h index 227cae397..0424e4862 100644 --- a/deps/glad/include/glad/glad_egl.h +++ b/deps/glad/include/glad/glad_egl.h @@ -57,8 +57,6 @@ extern "C" { typedef void* (* GLADloadproc)(const char *name); -#define GLAD_GLAPI_EXPORT - #ifndef GLAPI # if defined(GLAD_GLAPI_EXPORT) # if defined(_WIN32) || defined(__CYGWIN__) diff --git a/deps/glad/include/glad/glad_wgl.h b/deps/glad/include/glad/glad_wgl.h index 27b6fafd4..19f2351b3 100644 --- a/deps/glad/include/glad/glad_wgl.h +++ b/deps/glad/include/glad/glad_wgl.h @@ -30,8 +30,6 @@ extern "C" { typedef void* (* GLADloadproc)(const char *name); -#define GLAD_GLAPI_EXPORT - #ifndef GLAPI # if defined(GLAD_GLAPI_EXPORT) # if defined(WIN32) || defined(__CYGWIN__) diff --git a/deps/ipc-util/CMakeLists.txt b/deps/ipc-util/CMakeLists.txt index 8250503a5..1742d0f6e 100644 --- a/deps/ipc-util/CMakeLists.txt +++ b/deps/ipc-util/CMakeLists.txt @@ -5,19 +5,16 @@ add_library(OBS::ipc-util ALIAS ipc-util) target_sources(ipc-util PRIVATE ipc-util/pipe.h) -set_target_properties(ipc-util PROPERTIES FOLDER "deps" - POSITION_INDEPENDENT_CODE ON) +set_target_properties(ipc-util PROPERTIES FOLDER "deps" POSITION_INDEPENDENT_CODE ON) target_include_directories(ipc-util PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) if(OS_WINDOWS) if(MSVC) - target_compile_options(ipc-util PRIVATE "$,/MTd,/MT>" - /Zl) + target_compile_options(ipc-util PRIVATE "$,/MTd,/MT>" /Zl) endif() - target_sources(ipc-util PRIVATE ipc-util/pipe-windows.c - ipc-util/pipe-windows.h) + target_sources(ipc-util PRIVATE ipc-util/pipe-windows.c ipc-util/pipe-windows.h) else() target_sources(ipc-util PRIVATE ipc-util/pipe-posix.c ipc-util/pipe-posic.h) endif() diff --git a/deps/json11/CMakeLists.txt b/deps/json11/CMakeLists.txt new file mode 100644 index 000000000..7b738ff3e --- /dev/null +++ b/deps/json11/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.16...3.25) + +add_library(json11 INTERFACE EXCLUDE_FROM_ALL) +add_library(OBS::json11 ALIAS json11) + +target_include_directories(json11 INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") + +target_sources(json11 INTERFACE json11.cpp json11.hpp) diff --git a/deps/libcaption/CMakeLists.txt b/deps/libcaption/CMakeLists.txt index 2d1653655..a5e1c546f 100644 --- a/deps/libcaption/CMakeLists.txt +++ b/deps/libcaption/CMakeLists.txt @@ -1,46 +1,35 @@ -project(libcaption) +cmake_minimum_required(VERSION 3.16...3.25) -add_library(caption STATIC) +add_library(caption STATIC EXCLUDE_FROM_ALL ) add_library(OBS::caption ALIAS caption) target_sources( caption PRIVATE src/caption.c - src/utf8.c - caption/utf8.h + src/cea708.c + src/eia608.c + src/eia608_charmap.c + src/eia608_from_utf8.c + src/mpeg.c src/srt.c src/scc.c - caption/scc.h - src/mpeg.c - caption/mpeg.h - src/cea708.c - caption/cea708.h + src/utf8.c src/xds.c - src/eia608.c caption/eia608.h - src/eia608_from_utf8.c - src/eia608_charmap.c caption/eia608_charmap.h + caption/cea708.h + caption/mpeg.h + caption/scc.h + caption/utf8.h PUBLIC caption/caption.h) -target_compile_definitions( - caption PRIVATE __STDC_CONSTANT_MACROS - $<$:_CRT_SECURE_NO_WARNINGS>) +target_compile_definitions(caption PRIVATE __STDC_CONSTANT_MACROS $<$:_CRT_SECURE_NO_WARNINGS>) -target_compile_options( - caption - PRIVATE - $<$,$,$>:-Wno-unused-but-set-parameter> -) +target_compile_options(caption PRIVATE $<$:-Wno-unused-but-set-parameter>) target_include_directories( caption - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/caption - PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + PRIVATE caption + PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") -set_target_properties( - caption - PROPERTIES FOLDER "deps" - VERSION "0" - SOVERSION "0" - POSITION_INDEPENDENT_CODE ON) +set_target_properties(caption PROPERTIES FOLDER deps POSITION_INDEPENDENT_CODE ON) diff --git a/deps/libcaption/cmake/legacy.cmake b/deps/libcaption/cmake/legacy.cmake new file mode 100644 index 000000000..eff25bb9c --- /dev/null +++ b/deps/libcaption/cmake/legacy.cmake @@ -0,0 +1,44 @@ +project(libcaption) + +add_library(caption STATIC) +add_library(OBS::caption ALIAS caption) + +target_sources( + caption + PRIVATE src/caption.c + src/utf8.c + caption/utf8.h + src/srt.c + src/scc.c + caption/scc.h + src/mpeg.c + caption/mpeg.h + src/cea708.c + caption/cea708.h + src/xds.c + src/eia608.c + caption/eia608.h + src/eia608_from_utf8.c + src/eia608_charmap.c + caption/eia608_charmap.h + PUBLIC caption/caption.h) + +target_compile_definitions(caption PRIVATE __STDC_CONSTANT_MACROS $<$:_CRT_SECURE_NO_WARNINGS>) + +target_compile_options( + caption + PRIVATE + $<$,$,$>:-Wno-unused-but-set-parameter> +) + +target_include_directories( + caption + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/caption + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +set_target_properties( + caption + PROPERTIES FOLDER "deps" + VERSION "0" + SOVERSION "0" + POSITION_INDEPENDENT_CODE ON) diff --git a/deps/libff/CMakeLists.txt b/deps/libff/CMakeLists.txt index 6425075e6..c8fa4b066 100644 --- a/deps/libff/CMakeLists.txt +++ b/deps/libff/CMakeLists.txt @@ -1,57 +1,14 @@ -cmake_minimum_required(VERSION 2.8.12) -project(libff) +cmake_minimum_required(VERSION 3.16...3.25) -find_package( - FFmpeg REQUIRED - COMPONENTS avcodec - avfilter - avdevice - avutil - swscale - avformat - swresample) +add_library(libff-util INTERFACE EXCLUDE_FROM_ALL) +add_library(OBS::libff-util ALIAS libff-util) -include_directories(${FFMPEG_INCLUDE_DIRS}) +target_sources(libff-util INTERFACE libff/ff-util.c libff/ff-util.h) +target_include_directories(libff-util INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") -if(WIN32 AND NOT MINGW) - include_directories(../w32-pthreads) - add_definitions(-Dinline=__inline) -endif(WIN32 AND NOT MINGW) - -set(libff_HEADERS - libff/ff-callbacks.h - libff/ff-circular-queue.h - libff/ff-clock.h - libff/ff-frame.h - libff/ff-packet-queue.h - libff/ff-threading.h - libff/ff-timer.h - libff/ff-util.h - libff/ff-demuxer.h - libff/ff-decoder.h) - -set(libff_SOURCES - libff/ff-callbacks.c - libff/ff-circular-queue.c - libff/ff-clock.c - libff/ff-packet-queue.c - libff/ff-timer.c - libff/ff-util.c - libff/ff-demuxer.c - libff/ff-decoder.c - libff/ff-audio-decoder.c - libff/ff-video-decoder.c) - -if(WIN32) - list(APPEND libff_SOURCES libff/ff-threading-windows.c) -else(WIN32) - list(APPEND libff_SOURCES libff/ff-threading-posix.c) -endif(WIN32) - -add_library(libff STATIC ${libff_HEADERS} ${libff_SOURCES}) -set_target_properties(libff PROPERTIES FOLDER "deps" POSITION_INDEPENDENT_CODE - ON) - -target_include_directories(libff PUBLIC .) - -target_link_libraries(libff ${FFMPEG_LIBRARIES}) +if(OS_WINDOWS) + set_property( + SOURCE libff/ff-util.c + APPEND + PROPERTY COMPILE_FLAGS -Dinline=__inline) +endif() diff --git a/deps/media-playback/CMakeLists.txt b/deps/media-playback/CMakeLists.txt index 729675306..935afa3e3 100644 --- a/deps/media-playback/CMakeLists.txt +++ b/deps/media-playback/CMakeLists.txt @@ -1,10 +1,8 @@ -project(media-playback) - -option(ENABLE_SIMDE "Enable non-native SSE2 SIMD support" ON) +cmake_minimum_required(VERSION 3.16...3.25) find_package(FFmpeg REQUIRED COMPONENTS avcodec avdevice avutil avformat) -add_library(media-playback INTERFACE) +add_library(media-playback INTERFACE EXCLUDE_FROM_ALL) add_library(OBS::media-playback ALIAS media-playback) target_sources( @@ -19,11 +17,8 @@ target_sources( media-playback/media-playback.h media-playback/closest-format.h) -target_link_libraries(media-playback INTERFACE FFmpeg::avcodec FFmpeg::avdevice - FFmpeg::avutil FFmpeg::avformat) - -target_include_directories(media-playback INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) - +target_include_directories(media-playback INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") target_compile_options(media-playback INTERFACE ${ARCH_SIMD_FLAGS}) - target_compile_definitions(media-playback INTERFACE ${ARCH_SIMD_DEFINES}) + +target_link_libraries(media-playback INTERFACE FFmpeg::avcodec FFmpeg::avdevice FFmpeg::avutil FFmpeg::avformat) diff --git a/deps/obs-scripting/CMakeLists.txt b/deps/obs-scripting/CMakeLists.txt index a91951416..cc9d87e48 100644 --- a/deps/obs-scripting/CMakeLists.txt +++ b/deps/obs-scripting/CMakeLists.txt @@ -1,183 +1,50 @@ -option(ENABLE_SCRIPTING_LUA "Enable Lua scripting support" ON) -option(ENABLE_SCRIPTING_PYTHON "Enable Python scripting support" ON) +cmake_minimum_required(VERSION 3.16...3.25) + +legacy_check() if(NOT ENABLE_SCRIPTING) - obs_status(DISABLED "obs-scripting") + target_disable_feature(obs-scripting "Scripting support") return() endif() -project(obs-scripting) +add_library(obs-cstrcache INTERFACE EXCLUDE_FROM_ALL) +add_library(OBS::cstrcache ALIAS obs-cstrcache) -if(ENABLE_SCRIPTING_LUA) - add_subdirectory(obslua) - find_package(Luajit) +target_sources(obs-cstrcache INTERFACE cstrcache.cpp cstrcache.h) +target_include_directories(obs-cstrcache INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") - if(NOT TARGET Luajit::Luajit) - obs_status(FATAL_ERROR "obs-scripting -> Luajit not found.") - return() - else() - obs_status(STATUS "obs-scripting -> Luajit found.") - endif() -else() - obs_status(DISABLED "Luajit support") -endif() - -if(ENABLE_SCRIPTING_PYTHON) - add_subdirectory(obspython) - if(OS_WINDOWS) - find_package(PythonWindows) - else() - find_package(Python COMPONENTS Interpreter Development) - endif() - - if(NOT TARGET Python::Python) - obs_status(FATAL_ERROR "obs-scripting -> Python not found.") - return() - else() - obs_status(STATUS "obs-scripting -> Python ${Python_VERSION} found.") - endif() -else() - obs_status(DISABLED "Python support") -endif() - -if(NOT TARGET Luajit::Luajit AND NOT TARGET Python::Python) - obs_status(WARNING "obs-scripting -> No supported scripting libraries found.") - return() -endif() - -if(OS_MACOS) - find_package(SWIG 4 REQUIRED) -elseif(OS_POSIX) - find_package(SWIG 3 REQUIRED) -elseif(OS_WINDOWS) - find_package(SwigWindows 3 REQUIRED) -endif() +find_package(SWIG 4 REQUIRED) add_library(obs-scripting SHARED) add_library(OBS::scripting ALIAS obs-scripting) +include(cmake/lua.cmake) +include(cmake/python.cmake) + +if(NOT ENABLE_SCRIPTING_LUA AND NOT ENABLE_SCRIPTING_PYTHON) + target_disable_feature(obs-scripting "Scripting support") + return() +else() + target_enable_feature(obs-scripting "Scripting support") +endif() + target_sources( obs-scripting PUBLIC obs-scripting.h - PRIVATE obs-scripting.c cstrcache.cpp cstrcache.h obs-scripting-logging.c - obs-scripting-callback.h) - -target_link_libraries(obs-scripting PRIVATE OBS::libobs) + PRIVATE obs-scripting.c obs-scripting-logging.c obs-scripting-callback.h + $<$:obs-scripting-python-frontend.c> $<$:obs-scripting-lua-frontend.c>) +target_compile_definitions(obs-scripting PRIVATE SCRIPT_DIR="${OBS_SCRIPT_PLUGIN_PATH}" + $<$:ENABLE_UI>) target_compile_features(obs-scripting PRIVATE cxx_auto_type) +target_include_directories(obs-scripting PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) -target_include_directories(obs-scripting PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_BINARY_DIR}/config) +target_link_libraries(obs-scripting PRIVATE OBS::libobs OBS::cstrcache $<$:OBS::frontend-api> + $<$:OBS::w32-pthreads> $<$:objc>) if(OS_WINDOWS) - set(MODULE_DESCRIPTION "OBS Studio scripting module") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - obs-scripting.rc) - + configure_file(cmake/windows/obs-module.rc.in obs-scripting.rc) target_sources(obs-scripting PRIVATE obs-scripting.rc) - - target_link_libraries(obs-scripting PRIVATE OBS::w32-pthreads) - -elseif(OS_MACOS) - target_link_libraries(obs-scripting PRIVATE objc) endif() -set_target_properties( - obs-scripting - PROPERTIES FOLDER "scripting" - VERSION "${OBS_VERSION_MAJOR}" - SOVERSION "1") - -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/swig) - -if(TARGET Luajit::Luajit) - add_custom_command( - OUTPUT swig/swigluarun.h - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E env "SWIG_LIB=${SWIG_DIR}" ${SWIG_EXECUTABLE} - -lua -external-runtime swig/swigluarun.h - COMMENT "obs-scripting - generating Luajit SWIG interface headers") - - set_source_files_properties(swig/swigluarun.h PROPERTIES GENERATED ON) - - target_link_libraries(obs-scripting PRIVATE Luajit::Luajit) - - target_sources( - obs-scripting - PRIVATE obs-scripting-lua.c obs-scripting-lua.h obs-scripting-lua-source.c - ${CMAKE_CURRENT_BINARY_DIR}/swig/swigluarun.h) - - target_include_directories(obs-scripting PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) - - if(ENABLE_UI) - target_link_libraries(obs-scripting PRIVATE OBS::frontend-api) - - target_sources(obs-scripting PRIVATE obs-scripting-lua-frontend.c) - - target_compile_definitions(obs-scripting PRIVATE UI_ENABLED=ON) - endif() - -endif() - -if(TARGET Python::Python) - add_custom_command( - OUTPUT swig/swigpyrun.h - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - PRE_BUILD - COMMAND - ${CMAKE_COMMAND} -E env "SWIG_LIB=${SWIG_DIR}" ${SWIG_EXECUTABLE} -python - $,$>>,-py3,-py3-stable-abi> - -external-runtime swig/swigpyrun.h - COMMENT "obs-scripting - generating Python 3 SWIG interface headers") - - set_source_files_properties(swig/swigpyrun.h PROPERTIES GENERATED ON) - - target_sources( - obs-scripting - PRIVATE obs-scripting-python.c obs-scripting-python.h - obs-scripting-python-import.h - ${CMAKE_CURRENT_BINARY_DIR}/swig/swigpyrun.h) - - target_include_directories(obs-scripting PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) - - get_filename_component(_PYTHON_PATH "${Python_LIBRARIES}" PATH) - get_filename_component(_PYTHON_FILE "${Python_LIBRARIES}" NAME) - - string(REGEX REPLACE "\\.[^.]*$" "" _PYTHON_FILE ${_PYTHON_FILE}) - - if(OS_WINDOWS) - string(REGEX REPLACE "_d" "" _PYTHON_FILE ${_PYTHON_FILE}) - endif() - set(OBS_SCRIPT_PYTHON_PATH "${_PYTHON_FILE}") - - unset(_PYTHON_FILE) - unset(_PYTHON_PATH) - - if(OS_WINDOWS OR OS_MACOS) - target_include_directories(obs-scripting PRIVATE ${Python_INCLUDE_DIRS}) - - target_sources(obs-scripting PRIVATE obs-scripting-python-import.c) - if(OS_MACOS) - target_link_options(obs-scripting PRIVATE -undefined dynamic_lookup) - endif() - else() - target_link_libraries(obs-scripting PRIVATE Python::Python) - endif() - - if(ENABLE_UI) - target_link_libraries(obs-scripting PRIVATE OBS::frontend-api) - - target_sources(obs-scripting PRIVATE obs-scripting-python-frontend.c) - - target_compile_definitions(obs-scripting PRIVATE UI_ENABLED=ON) - endif() -endif() - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/obs-scripting-config.h.in - ${CMAKE_BINARY_DIR}/config/obs-scripting-config.h) - -target_sources(obs-scripting - PUBLIC ${CMAKE_BINARY_DIR}/config/obs-scripting-config.h) - -setup_binary_target(obs-scripting) +set_target_properties_obs(obs-scripting PROPERTIES FOLDER scripting PREFIX "") diff --git a/deps/obs-scripting/cmake/legacy.cmake b/deps/obs-scripting/cmake/legacy.cmake new file mode 100644 index 000000000..bf4d9a4ef --- /dev/null +++ b/deps/obs-scripting/cmake/legacy.cmake @@ -0,0 +1,178 @@ +option(ENABLE_SCRIPTING_LUA "Enable Lua scripting support" ON) +option(ENABLE_SCRIPTING_PYTHON "Enable Python scripting support" ON) + +if(NOT ENABLE_SCRIPTING) + obs_status(DISABLED "obs-scripting") + return() +endif() + +project(obs-scripting) + +if(ENABLE_SCRIPTING_LUA) + add_subdirectory(obslua) + find_package(Luajit) + + if(NOT TARGET Luajit::Luajit) + obs_status(FATAL_ERROR "obs-scripting -> Luajit not found.") + return() + else() + obs_status(STATUS "obs-scripting -> Luajit found.") + endif() +else() + obs_status(DISABLED "Luajit support") +endif() + +if(ENABLE_SCRIPTING_PYTHON) + add_subdirectory(obspython) + if(OS_WINDOWS) + find_package(PythonWindows) + else() + find_package(Python COMPONENTS Interpreter Development) + endif() + + if(NOT TARGET Python::Python) + obs_status(FATAL_ERROR "obs-scripting -> Python not found.") + return() + else() + obs_status(STATUS "obs-scripting -> Python ${Python_VERSION} found.") + endif() +else() + obs_status(DISABLED "Python support") +endif() + +if(NOT TARGET Luajit::Luajit AND NOT TARGET Python::Python) + obs_status(WARNING "obs-scripting -> No supported scripting libraries found.") + return() +endif() + +if(OS_MACOS) + find_package(SWIG 4 REQUIRED) +elseif(OS_POSIX) + find_package(SWIG 3 REQUIRED) +elseif(OS_WINDOWS) + find_package(SwigWindows 3 REQUIRED) +endif() + +add_library(obs-scripting SHARED) +add_library(OBS::scripting ALIAS obs-scripting) + +target_sources( + obs-scripting + PUBLIC obs-scripting.h + PRIVATE obs-scripting.c cstrcache.cpp cstrcache.h obs-scripting-logging.c obs-scripting-callback.h) + +target_link_libraries(obs-scripting PRIVATE OBS::libobs) + +target_compile_features(obs-scripting PRIVATE cxx_auto_type) + +target_include_directories(obs-scripting PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +if(OS_WINDOWS) + set(MODULE_DESCRIPTION "OBS Studio scripting module") + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in obs-scripting.rc) + + target_sources(obs-scripting PRIVATE obs-scripting.rc) + + target_link_libraries(obs-scripting PRIVATE OBS::w32-pthreads) + +elseif(OS_MACOS) + target_link_libraries(obs-scripting PRIVATE objc) +endif() + +set_target_properties( + obs-scripting + PROPERTIES FOLDER "scripting" + VERSION "${OBS_VERSION_MAJOR}" + SOVERSION "1") + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/swig) + +if(TARGET Luajit::Luajit) + add_custom_command( + OUTPUT swig/swigluarun.h + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E env "SWIG_LIB=${SWIG_DIR}" ${SWIG_EXECUTABLE} -lua -external-runtime swig/swigluarun.h + COMMENT "obs-scripting - generating Luajit SWIG interface headers") + + set_source_files_properties(swig/swigluarun.h PROPERTIES GENERATED ON) + + target_link_libraries(obs-scripting PRIVATE Luajit::Luajit) + + target_compile_definitions(obs-scripting PUBLIC LUAJIT_FOUND) + + target_sources(obs-scripting PRIVATE obs-scripting-lua.c obs-scripting-lua.h obs-scripting-lua-source.c + ${CMAKE_CURRENT_BINARY_DIR}/swig/swigluarun.h) + + target_include_directories(obs-scripting PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + + if(ENABLE_UI) + target_link_libraries(obs-scripting PRIVATE OBS::frontend-api) + + target_sources(obs-scripting PRIVATE obs-scripting-lua-frontend.c) + + target_compile_definitions(obs-scripting PRIVATE UI_ENABLED=ON) + endif() + +endif() + +if(TARGET Python::Python) + add_custom_command( + OUTPUT swig/swigpyrun.h + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + PRE_BUILD + COMMAND + ${CMAKE_COMMAND} -E env "SWIG_LIB=${SWIG_DIR}" ${SWIG_EXECUTABLE} -python + $,$>>,-py3,-py3-stable-abi> -external-runtime + swig/swigpyrun.h + COMMENT "obs-scripting - generating Python 3 SWIG interface headers") + + set_source_files_properties(swig/swigpyrun.h PROPERTIES GENERATED ON) + + target_sources(obs-scripting PRIVATE obs-scripting-python.c obs-scripting-python.h obs-scripting-python-import.h + ${CMAKE_CURRENT_BINARY_DIR}/swig/swigpyrun.h) + + target_compile_definitions( + obs-scripting + PRIVATE ENABLE_SCRIPTING PYTHON_LIB="$" + PUBLIC Python_FOUND) + + target_include_directories(obs-scripting PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + + get_filename_component(_PYTHON_PATH "${Python_LIBRARIES}" PATH) + get_filename_component(_PYTHON_FILE "${Python_LIBRARIES}" NAME) + + string(REGEX REPLACE "\\.[^.]*$" "" _PYTHON_FILE ${_PYTHON_FILE}) + + if(OS_WINDOWS) + string(REGEX REPLACE "_d" "" _PYTHON_FILE ${_PYTHON_FILE}) + endif() + set(OBS_SCRIPT_PYTHON_PATH "${_PYTHON_FILE}") + + unset(_PYTHON_FILE) + unset(_PYTHON_PATH) + + if(OS_WINDOWS OR OS_MACOS) + target_include_directories(obs-scripting PRIVATE ${Python_INCLUDE_DIRS}) + + target_sources(obs-scripting PRIVATE obs-scripting-python-import.c) + if(OS_MACOS) + target_link_options(obs-scripting PRIVATE -undefined dynamic_lookup) + endif() + else() + target_link_libraries(obs-scripting PRIVATE Python::Python) + endif() + + if(ENABLE_UI) + target_link_libraries(obs-scripting PRIVATE OBS::frontend-api) + + target_sources(obs-scripting PRIVATE obs-scripting-python-frontend.c) + + target_compile_definitions(obs-scripting PRIVATE UI_ENABLED=ON) + endif() +endif() + +target_compile_definitions(obs-scripting PRIVATE SCRIPT_DIR="${OBS_SCRIPT_PLUGIN_PATH}" + $<$:ENABLE_UI>) + +setup_binary_target(obs-scripting) diff --git a/deps/obs-scripting/cmake/lua.cmake b/deps/obs-scripting/cmake/lua.cmake new file mode 100644 index 000000000..dd837409d --- /dev/null +++ b/deps/obs-scripting/cmake/lua.cmake @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.22...3.25) + +option(ENABLE_SCRIPTING_LUA "Enable Lua scripting support" ON) + +if(ENABLE_SCRIPTING_LUA) + add_subdirectory(obslua) + find_package(Luajit REQUIRED) +else() + target_disable_feature(obs-scripting "Lua scripting support") +endif() + +target_sources(obs-scripting PRIVATE obs-scripting-lua.c obs-scripting-lua.h obs-scripting-lua-source.c) +target_compile_definitions(obs-scripting PUBLIC LUAJIT_FOUND) + +add_custom_command( + OUTPUT swig/swigluarun.h + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory swig + COMMAND ${CMAKE_COMMAND} -E env "SWIG_LIB=${SWIG_DIR}" ${SWIG_EXECUTABLE} -lua -external-runtime swig/swigluarun.h + COMMENT "obs-scripting - generating Luajit SWIG interface headers") + +target_sources(obs-scripting PRIVATE swig/swigluarun.h) +set_source_files_properties(swig/swigluarun.h PROPERTIES GENERATED ON) +set_source_files_properties( + obs-scripting-lua.c obs-scripting-lua-source.c + PROPERTIES COMPILE_OPTIONS "$<$:-Wno-error=shorten-64-to-32;-Wno-error=shadow>") + +target_link_libraries(obs-scripting PRIVATE Luajit::Luajit) diff --git a/deps/obs-scripting/cmake/python.cmake b/deps/obs-scripting/cmake/python.cmake new file mode 100644 index 000000000..aa32db340 --- /dev/null +++ b/deps/obs-scripting/cmake/python.cmake @@ -0,0 +1,45 @@ +cmake_minimum_required(VERSION 3.22...3.25) + +option(ENABLE_SCRIPTING_PYTHON "Enable Python scripting support" ON) + +if(ENABLE_SCRIPTING_PYTHON) + add_subdirectory(obspython) + find_package(Python 3.8...<3.12 COMPONENTS Interpreter Development) +else() + target_disable_feature(obs-scripting "Python scripting support") +endif() + +target_sources(obs-scripting PRIVATE obs-scripting-python.c obs-scripting-python.h obs-scripting-python-import.h) + +target_compile_definitions( + obs-scripting + PRIVATE ENABLE_SCRIPTING PYTHON_LIB="$" + PUBLIC Python_FOUND) + +add_custom_command( + OUTPUT swig/swigpyrun.h + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory swig + COMMAND ${CMAKE_COMMAND} -E env "SWIG_LIB=${SWIG_DIR}" ${SWIG_EXECUTABLE} -python + $,-py3,-py3-stable-abi> -external-runtime swig/swigpyrun.h + COMMENT "obs-scripting - generating Python 3 SWIG interface headers") + +target_sources(obs-scripting PRIVATE swig/swigpyrun.h) +set_source_files_properties(swig/swigpyrun.h PROPERTIES GENERATED ON) + +if(OS_WINDOWS) + target_sources(obs-scripting PRIVATE obs-scripting-python-import.c) + + get_target_property(_python_include_directory Python::Python INTERFACE_INCLUDE_DIRECTORIES) + target_include_directories(obs-scripting PRIVATE ${_python_include_directory}) +elseif(OS_MACOS) + target_sources(obs-scripting PRIVATE obs-scripting-python-import.c) + + get_target_property(_python_include_directory Python::Python INTERFACE_INCLUDE_DIRECTORIES) + target_include_directories(obs-scripting PRIVATE ${_python_include_directory}) + + target_link_options(obs-scripting PRIVATE LINKER:-undefined LINKER:dynamic_lookup) +elseif(OS_LINUX OR OS_FREEBSD) + target_link_libraries(obs-scripting PRIVATE Python::Python) +endif() diff --git a/deps/obs-scripting/cmake/windows/obs-module.rc.in b/deps/obs-scripting/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..3bac84fbb --- /dev/null +++ b/deps/obs-scripting/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS Studio scripting module" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "obs-scripting" + VALUE "OriginalFilename", "obs-scripting" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/deps/obs-scripting/obs-scripting-config.h.in b/deps/obs-scripting/obs-scripting-config.h.in index 3525d06e7..09bb9da0b 100644 --- a/deps/obs-scripting/obs-scripting-config.h.in +++ b/deps/obs-scripting/obs-scripting-config.h.in @@ -16,8 +16,12 @@ #define OFF 0 #endif +#ifndef LUAJIT_FOUND #cmakedefine LUAJIT_FOUND +#endif +#ifndef Python_FOUND #cmakedefine Python_FOUND +#endif #define SCRIPT_DIR "@OBS_SCRIPT_PLUGIN_PATH@" #define PYTHON_LIB "@OBS_SCRIPT_PYTHON_PATH@" diff --git a/deps/obs-scripting/obs-scripting-lua.c b/deps/obs-scripting/obs-scripting-lua.c index 1d2484f67..c78d665df 100644 --- a/deps/obs-scripting/obs-scripting-lua.c +++ b/deps/obs-scripting/obs-scripting-lua.c @@ -16,7 +16,6 @@ ******************************************************************************/ #include "obs-scripting-lua.h" -#include "obs-scripting-config.h" #include #include #include @@ -77,7 +76,7 @@ static void add_hook_functions(lua_State *script); static int obs_lua_remove_tick_callback(lua_State *script); static int obs_lua_remove_main_render_callback(lua_State *script); -#if UI_ENABLED +#ifdef ENABLE_UI void add_lua_frontend_funcs(lua_State *script); #endif @@ -118,7 +117,7 @@ static bool load_lua_script(struct obs_lua_script *data) add_lua_source_functions(script); add_hook_functions(script); -#if UI_ENABLED +#ifdef ENABLE_UI add_lua_frontend_funcs(script); #endif diff --git a/deps/obs-scripting/obs-scripting-python-import.c b/deps/obs-scripting/obs-scripting-python-import.c index 86776b8bd..7efac9678 100644 --- a/deps/obs-scripting/obs-scripting-python-import.c +++ b/deps/obs-scripting/obs-scripting-python-import.c @@ -20,7 +20,6 @@ #define NO_REDEFS #include "obs-scripting-python-import.h" -#include "obs-scripting-config.h" #ifdef _MSC_VER #pragma warning(disable : 4152) diff --git a/deps/obs-scripting/obs-scripting-python.c b/deps/obs-scripting/obs-scripting-python.c index 0f3073707..a3b3b3c20 100644 --- a/deps/obs-scripting/obs-scripting-python.c +++ b/deps/obs-scripting/obs-scripting-python.c @@ -17,7 +17,6 @@ ******************************************************************************/ #include "obs-scripting-python.h" -#include "obs-scripting-config.h" #include #include #include diff --git a/deps/obs-scripting/obs-scripting.c b/deps/obs-scripting/obs-scripting.c index 7e84f6e03..83a45ae25 100644 --- a/deps/obs-scripting/obs-scripting.c +++ b/deps/obs-scripting/obs-scripting.c @@ -23,7 +23,6 @@ #include "obs-scripting-internal.h" #include "obs-scripting-callback.h" -#include "obs-scripting-config.h" #if defined(LUAJIT_FOUND) extern obs_script_t *obs_lua_script_create(const char *path, diff --git a/deps/obs-scripting/obslua/CMakeLists.txt b/deps/obs-scripting/obslua/CMakeLists.txt index 13f0f6133..984ebb1dd 100644 --- a/deps/obs-scripting/obslua/CMakeLists.txt +++ b/deps/obs-scripting/obslua/CMakeLists.txt @@ -1,68 +1,49 @@ -if(POLICY CMP0086) - cmake_policy(SET CMP0086 NEW) -endif() +cmake_minimum_required(VERSION 3.16...3.25) + +legacy_check() if(POLICY CMP0078) cmake_policy(SET CMP0078 NEW) endif() -project(obslua) +if(POLICY CMP0086) + cmake_policy(SET CMP0086 NEW) +endif() find_package(Luajit REQUIRED) -if(OS_MACOS) - find_package(SWIG 4 REQUIRED) -elseif(OS_POSIX) - find_package(SWIG 3 REQUIRED) -elseif(OS_WINDOWS) - find_package(SwigWindows 3 REQUIRED) -endif() +find_package(SWIG 4 REQUIRED) + include(UseSWIG) -set_source_files_properties(obslua.i PROPERTIES USE_TARGET_INCLUDE_DIRECTORIES - TRUE) - +set_source_files_properties(obslua.i PROPERTIES USE_TARGET_INCLUDE_DIRECTORIES TRUE) swig_add_library( obslua LANGUAGE lua TYPE MODULE - SOURCES obslua.i ../cstrcache.cpp ../cstrcache.h) + SOURCES obslua.i) -target_link_libraries(obslua PRIVATE OBS::scripting OBS::libobs Luajit::Luajit) +add_library(OBS::lua ALIAS obslua) -list(APPEND _SWIG_DEFINITIONS "SWIG_TYPE_TABLE=obslua" - "SWIG_LUA_INTERPRETER_NO_DEBUG") +target_compile_options(obslua PRIVATE "$<$:-Wno-error=shorten-64-to-32>") +target_compile_definitions(obslua PRIVATE SWIG_TYPE_TABLE=obslua SWIG_LUA_INTERPRETER_NO_DEBUG + $<$:ENABLE_UI>) -set_target_properties( - obslua - PROPERTIES FOLDER "scripting" - VERSION "${OBS_VERSION_MAJOR}" - SOVERSION "${OBS_VERSION_CANONICAL}") - -target_compile_definitions(obslua PRIVATE SWIG_TYPE_TABLE=obslua - SWIG_LUA_INTERPRETER_NO_DEBUG) - -if(ENABLE_UI) - list(APPEND _SWIG_DEFINITIONS "ENABLE_UI") - target_link_libraries(obslua PRIVATE OBS::frontend-api) - - target_compile_definitions(obslua PRIVATE ENABLE_UI) -endif() - -set_target_properties(obslua PROPERTIES SWIG_COMPILE_DEFINITIONS - "${_SWIG_DEFINITIONS}") +target_link_libraries(obslua PRIVATE OBS::scripting OBS::cstrcache OBS::libobs Luajit::Luajit + $<$:OBS::frontend-api>) if(OS_WINDOWS) - if(MSVC) - target_compile_options(obslua PRIVATE /wd4054 /wd4197 /wd4244 /wd4267) - endif() + target_compile_options(obslua PRIVATE /wd4054 /wd4197 /wd4244 /wd4267) elseif(OS_MACOS) - set_target_properties(obslua PROPERTIES MACHO_CURRENT_VERSION 0 - MACHO_COMPATIBILITY_VERSION 0) -endif() - -if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND SWIG_VERSION VERSION_LESS "4.1") + set_property(TARGET obslua PROPERTY XCODE_ATTRIBUTE_STRIP_STYLE non-global) +elseif(OS_LINUX OR OS_FREEBSD) target_compile_options(obslua PRIVATE -Wno-maybe-uninitialized) endif() -setup_script_plugin_target(obslua) +set_property( + TARGET obslua + APPEND + PROPERTY SWIG_COMPILE_DEFINITIONS "SWIG_TYPE_TABLE=obslua" "SWIG_LUA_INTERPRETER_NO_DEBUG" + "$<$:ENABLE_UI>") + +set_target_properties_obs(obslua PROPERTIES FOLDER scripting) diff --git a/deps/obs-scripting/obslua/cmake/legacy.cmake b/deps/obs-scripting/obslua/cmake/legacy.cmake new file mode 100644 index 000000000..d032a47b1 --- /dev/null +++ b/deps/obs-scripting/obslua/cmake/legacy.cmake @@ -0,0 +1,63 @@ +if(POLICY CMP0086) + cmake_policy(SET CMP0086 NEW) +endif() + +if(POLICY CMP0078) + cmake_policy(SET CMP0078 NEW) +endif() + +project(obslua) + +find_package(Luajit REQUIRED) + +if(OS_MACOS) + find_package(SWIG 4 REQUIRED) +elseif(OS_POSIX) + find_package(SWIG 3 REQUIRED) +elseif(OS_WINDOWS) + find_package(SwigWindows 3 REQUIRED) +endif() +include(UseSWIG) + +set_source_files_properties(obslua.i PROPERTIES USE_TARGET_INCLUDE_DIRECTORIES TRUE) + +swig_add_library( + obslua + LANGUAGE lua + TYPE MODULE + SOURCES obslua.i ../cstrcache.cpp ../cstrcache.h) + +target_link_libraries(obslua PRIVATE OBS::scripting OBS::libobs Luajit::Luajit) + +list(APPEND _SWIG_DEFINITIONS "SWIG_TYPE_TABLE=obslua" "SWIG_LUA_INTERPRETER_NO_DEBUG") + +set_target_properties( + obslua + PROPERTIES FOLDER "scripting" + VERSION "${OBS_VERSION_MAJOR}" + SOVERSION "${OBS_VERSION_CANONICAL}") + +target_compile_definitions(obslua PRIVATE SWIG_TYPE_TABLE=obslua SWIG_LUA_INTERPRETER_NO_DEBUG) + +if(ENABLE_UI) + list(APPEND _SWIG_DEFINITIONS "ENABLE_UI") + target_link_libraries(obslua PRIVATE OBS::frontend-api) + + target_compile_definitions(obslua PRIVATE ENABLE_UI) +endif() + +set_target_properties(obslua PROPERTIES SWIG_COMPILE_DEFINITIONS "${_SWIG_DEFINITIONS}") + +if(OS_WINDOWS) + if(MSVC) + target_compile_options(obslua PRIVATE /wd4054 /wd4197 /wd4244 /wd4267) + endif() +elseif(OS_MACOS) + set_target_properties(obslua PROPERTIES MACHO_CURRENT_VERSION 0 MACHO_COMPATIBILITY_VERSION 0) +endif() + +if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND SWIG_VERSION VERSION_LESS "4.1") + target_compile_options(obslua PRIVATE -Wno-maybe-uninitialized) +endif() + +setup_script_plugin_target(obslua) diff --git a/deps/obs-scripting/obslua/obslua.i b/deps/obs-scripting/obslua/obslua.i index dc7e97804..681a440ad 100644 --- a/deps/obs-scripting/obslua/obslua.i +++ b/deps/obs-scripting/obslua/obslua.i @@ -23,7 +23,6 @@ #include #include #include "cstrcache.h" -#include "obs-scripting-config.h" #include #if defined(ENABLE_UI) @@ -92,7 +91,6 @@ static inline void wrap_blog(int log_level, const char *message) %include "graphics/matrix3.h" %include "graphics/quat.h" %include "graphics/image-file.h" -%include "obs-scripting-config.h" %include "obs-data.h" %include "obs-source.h" %include "obs-properties.h" diff --git a/deps/obs-scripting/obspython/CMakeLists.txt b/deps/obs-scripting/obspython/CMakeLists.txt index 8c6b8fdcb..39565ad43 100644 --- a/deps/obs-scripting/obspython/CMakeLists.txt +++ b/deps/obs-scripting/obspython/CMakeLists.txt @@ -1,3 +1,7 @@ +cmake_minimum_required(VERSION 3.16...3.25) + +legacy_check() + if(POLICY CMP0078) cmake_policy(SET CMP0078 NEW) endif() @@ -6,107 +10,68 @@ if(POLICY CMP0086) cmake_policy(SET CMP0086 NEW) endif() -project(obspython) - -if(OS_MACOS) - find_package(Python REQUIRED COMPONENTS Interpreter Development) - find_package(SWIG 4 REQUIRED) -elseif(OS_POSIX) - find_package(Python REQUIRED COMPONENTS Interpreter Development) - find_package(SWIG 3 REQUIRED) -elseif(OS_WINDOWS) - find_package(PythonWindows REQUIRED) - find_package(SwigWindows 3 REQUIRED) +if(POLICY CMP0094) + cmake_policy(SET CMP0094 NEW) endif() + +find_package(Python 3.8...<3.11 REQUIRED Interpreter Development) +find_package(SWIG 4 REQUIRED) + include(UseSWIG) -set_source_files_properties( - obspython.i - PROPERTIES - USE_TARGET_INCLUDE_DIRECTORIES TRUE - SWIG_FLAGS - "$,$>>,-py3,-py3-stable-abi>" -) +set_source_files_properties(obspython.i PROPERTIES USE_TARGET_INCLUDE_DIRECTORIES TRUE + SWIG_FLAGS "$,-py3,-py3-stable-abi>") swig_add_library( obspython LANGUAGE python TYPE MODULE - SOURCES obspython.i ../cstrcache.cpp ../cstrcache.h) + SOURCES obspython.i) -target_link_libraries(obspython PRIVATE OBS::scripting OBS::libobs) +add_library(OBS::python ALIAS obspython) -list(APPEND _SWIG_DEFINITIONS "SWIG_TYPE_TABLE=obspython" "Py_ENABLE_SHARED=1" - "SWIG_PYTHON_INTERPRETER_NO_DEBUG") +file( + GENERATE + OUTPUT $<$:$/>obspython.h + CONTENT "#pragma once\n\n#define PYTHON_LIB \"$\"\n") -target_compile_features(obspython PRIVATE cxx_auto_type c_std_11) +target_include_directories(obspython PRIVATE "$<$:${CMAKE_CURRENT_BINARY_DIR}/$>") -target_compile_definitions( - obspython PRIVATE SWIG_TYPE_TABLE=obspython Py_ENABLE_SHARED=1 - SWIG_PYTHON_INTERPRETER_NO_DEBUG) +list(APPEND _SWIG_DEFINITIONS "SWIG_TYPE_TABLE=obspython" "Py_ENABLE_SHARED=1" "SWIG_PYTHON_INTERPRETER_NO_DEBUG") -if(ENABLE_UI) - list(APPEND _SWIG_DEFINITIONS "ENABLE_UI") - target_link_libraries(obspython PRIVATE OBS::frontend-api) +target_compile_definitions(obspython PRIVATE SWIG_TYPE_TABLE=obspython Py_ENABLE_SHARED=1 + SWIG_PYTHON_INTERPRETER_NO_DEBUG $<$:ENABLE_UI>) - target_compile_definitions(obspython PRIVATE ENABLE_UI) -endif() - -set_target_properties(obspython PROPERTIES SWIG_COMPILE_DEFINITIONS - "${_SWIG_DEFINITIONS}") +target_link_libraries(obspython PRIVATE OBS::scripting OBS::cstrcache OBS::libobs + $<$:OBS::frontend-api>) if(OS_WINDOWS) - set_target_properties( - obspython PROPERTIES SWIG_COMPILE_DEFINITIONS - "${_SWIG_DEFINITIONS};MS_NO_COREDLL") - target_link_libraries(obspython PRIVATE Python::Python) - target_compile_options(obspython PRIVATE /wd4100 /wd4197) - - if(MSVC) - add_custom_command( - TARGET obspython - POST_BUILD - COMMAND - "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_BINARY_DIR}/obspython.py" - "${CMAKE_CURRENT_BINARY_DIR}/$/obspython.py" - VERBATIM) - endif() - elseif(OS_MACOS) - get_target_property(_PYTHON_INCLUDE_DIRECTORY Python::Python - INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(_python_include_directory Python::Python INTERFACE_INCLUDE_DIRECTORIES) + target_include_directories(obspython PRIVATE ${_python_include_directory}) + target_compile_options(obspython PRIVATE -Wno-unused-parameter -Wno-error=macro-redefined) + target_link_options(obspython PUBLIC LINKER:-undefined,dynamic_lookup) - target_include_directories(obspython PRIVATE ${_PYTHON_INCLUDE_DIRECTORY}) - - target_link_options(obspython PRIVATE -undefined dynamic_lookup) - - target_compile_options(obspython PRIVATE -Wno-unused-parameter) - - if(XCODE) - add_custom_command( - TARGET obspython - POST_BUILD - COMMAND - "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_BINARY_DIR}/obspython.py" - "${CMAKE_CURRENT_BINARY_DIR}/$/obspython.py" - VERBATIM) - endif() - - set_target_properties(obspython PROPERTIES MACHO_CURRENT_VERSION 0 - MACHO_COMPATIBILITY_VERSION 0) -elseif(OS_POSIX) + set_property(TARGET obspython PROPERTY XCODE_ATTRIBUTE_STRIP_STYLE non-global) +elseif(OS_LINUX OR OS_FREEBSD) target_link_libraries(obspython PRIVATE Python::Python) - - target_compile_options(obspython PRIVATE -Wno-unused-parameter) - endif() -set_target_properties( - obspython - PROPERTIES FOLDER "scripting" - VERSION "${OBS_VERSION_MAJOR}" - SOVERSION "${OBS_VERSION_CANONICAL}") +if(MSVC OR XCODE) + add_custom_command( + TARGET obspython + POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_BINARY_DIR}/obspython.py" + "${CMAKE_CURRENT_BINARY_DIR}/$/obspython.py" + VERBATIM) +endif() -setup_script_plugin_target(obspython) +set_property( + TARGET obspython + APPEND + PROPERTY SWIG_COMPILE_DEFINITIONS "SWIG_TYPE_TABLE=obspython" "Py_ENABLE_SHARED=1" "SWIG_PYTHON_INTERPRETER_NO_DEBUG" + "$<$:ENABLE_UI>" "$<$:MS_NO_COREDLL>") + +set_target_properties_obs(obspython PROPERTIES FOLDER scripting PREFIX "_") diff --git a/deps/obs-scripting/obspython/cmake/legacy.cmake b/deps/obs-scripting/obspython/cmake/legacy.cmake new file mode 100644 index 000000000..572ec0546 --- /dev/null +++ b/deps/obs-scripting/obspython/cmake/legacy.cmake @@ -0,0 +1,107 @@ +if(POLICY CMP0078) + cmake_policy(SET CMP0078 NEW) +endif() + +if(POLICY CMP0086) + cmake_policy(SET CMP0086 NEW) +endif() + +project(obspython) + +if(OS_MACOS) + find_package(Python REQUIRED COMPONENTS Interpreter Development) + find_package(SWIG 4 REQUIRED) +elseif(OS_POSIX) + find_package(Python REQUIRED COMPONENTS Interpreter Development) + find_package(SWIG 3 REQUIRED) +elseif(OS_WINDOWS) + find_package(PythonWindows REQUIRED) + find_package(SwigWindows 3 REQUIRED) +endif() +include(UseSWIG) + +set_source_files_properties( + obspython.i PROPERTIES USE_TARGET_INCLUDE_DIRECTORIES TRUE + SWIG_FLAGS "$,$>>,-py3,-py3-stable-abi>") + +swig_add_library( + obspython + LANGUAGE python + TYPE MODULE + SOURCES obspython.i ../cstrcache.cpp ../cstrcache.h) + +file( + GENERATE + OUTPUT $<$:$/>obspython.h + CONTENT "#pragma once\n\n#define PYTHON_LIB \"$\"") + +target_include_directories(obspython PRIVATE "$<$:${CMAKE_CURRENT_BINARY_DIR}/$>" + "${CMAKE_CURRENT_BINARY_DIR}") + +target_link_libraries(obspython PRIVATE OBS::scripting OBS::libobs) + +list(APPEND _SWIG_DEFINITIONS "SWIG_TYPE_TABLE=obspython" "Py_ENABLE_SHARED=1" "SWIG_PYTHON_INTERPRETER_NO_DEBUG") + +target_compile_features(obspython PRIVATE cxx_auto_type c_std_11) + +target_compile_definitions(obspython PRIVATE SWIG_TYPE_TABLE=obspython Py_ENABLE_SHARED=1 + SWIG_PYTHON_INTERPRETER_NO_DEBUG) + +if(ENABLE_UI) + list(APPEND _SWIG_DEFINITIONS "ENABLE_UI") + target_link_libraries(obspython PRIVATE OBS::frontend-api) + + target_compile_definitions(obspython PRIVATE ENABLE_UI) +endif() + +set_target_properties(obspython PROPERTIES SWIG_COMPILE_DEFINITIONS "${_SWIG_DEFINITIONS}") + +if(OS_WINDOWS) + set_target_properties(obspython PROPERTIES SWIG_COMPILE_DEFINITIONS "${_SWIG_DEFINITIONS};MS_NO_COREDLL") + + target_link_libraries(obspython PRIVATE Python::Python) + + target_compile_options(obspython PRIVATE /wd4100 /wd4197) + + if(MSVC) + add_custom_command( + TARGET obspython + POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_BINARY_DIR}/obspython.py" + "${CMAKE_CURRENT_BINARY_DIR}/$/obspython.py" + VERBATIM) + endif() + +elseif(OS_MACOS) + get_target_property(_PYTHON_INCLUDE_DIRECTORY Python::Python INTERFACE_INCLUDE_DIRECTORIES) + + target_include_directories(obspython PRIVATE ${_PYTHON_INCLUDE_DIRECTORY}) + + target_link_options(obspython PRIVATE -undefined dynamic_lookup) + + target_compile_options(obspython PRIVATE -Wno-unused-parameter -Wno-error=macro-redefined) + + if(XCODE) + add_custom_command( + TARGET obspython + POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_BINARY_DIR}/obspython.py" + "${CMAKE_CURRENT_BINARY_DIR}/$/obspython.py" + VERBATIM) + endif() + + set_target_properties(obspython PROPERTIES MACHO_CURRENT_VERSION 0 MACHO_COMPATIBILITY_VERSION 0) +elseif(OS_POSIX) + target_link_libraries(obspython PRIVATE Python::Python) + + target_compile_options(obspython PRIVATE -Wno-unused-parameter) + +endif() + +set_target_properties( + obspython + PROPERTIES FOLDER "scripting" + VERSION "${OBS_VERSION_MAJOR}" + SOVERSION "${OBS_VERSION_CANONICAL}") + +setup_script_plugin_target(obspython) diff --git a/deps/obs-scripting/obspython/obspython.i b/deps/obs-scripting/obspython/obspython.i index e3d32f953..55cb7595d 100644 --- a/deps/obs-scripting/obspython/obspython.i +++ b/deps/obs-scripting/obspython/obspython.i @@ -23,7 +23,7 @@ #include #include #include -#include "obs-scripting-config.h" +#include "obspython.h" #include #if defined(ENABLE_UI) @@ -38,7 +38,6 @@ #undef SWIG_PYTHON_INITIALIZE_THREADS #define SWIG_PYTHON_INITIALIZE_THREADS #endif - %} %feature("python:annotations", "c"); @@ -113,7 +112,7 @@ static inline void wrap_blog(int log_level, const char *message) %include "graphics/matrix4.h" %include "graphics/matrix3.h" %include "graphics/quat.h" -%include "obs-scripting-config.h" +%include "obspython.h" %include "obs-data.h" %include "obs-source.h" %include "obs-properties.h" diff --git a/deps/opts-parser/CMakeLists.txt b/deps/opts-parser/CMakeLists.txt index 92d36332a..c6da004f3 100644 --- a/deps/opts-parser/CMakeLists.txt +++ b/deps/opts-parser/CMakeLists.txt @@ -1,10 +1,9 @@ -project(opts-parser) +cmake_minimum_required(VERSION 3.16...3.25) -add_library(opts-parser INTERFACE) +add_library(opts-parser INTERFACE EXCLUDE_FROM_ALL) add_library(OBS::opts-parser ALIAS opts-parser) target_sources(opts-parser INTERFACE opts-parser.c opts-parser.h) +target_include_directories(opts-parser INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") target_link_libraries(opts-parser INTERFACE OBS::libobs) - -target_include_directories(opts-parser INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/deps/uthash/CMakeLists.txt b/deps/uthash/CMakeLists.txt index 7817c7433..19f262a36 100644 --- a/deps/uthash/CMakeLists.txt +++ b/deps/uthash/CMakeLists.txt @@ -1,7 +1,8 @@ -project(uthash) +cmake_minimum_required(VERSION 3.16...3.25) add_library(uthash INTERFACE) add_library(OBS::uthash ALIAS uthash) -set_target_properties(uthash PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${CMAKE_CURRENT_SOURCE_DIR}") -set_target_properties(uthash PROPERTIES FOLDER "deps") + +target_sources(uthash INTERFACE uthash/uthash.h) + +set_target_properties(uthash PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}") diff --git a/deps/w32-pthreads/CMakeLists.txt b/deps/w32-pthreads/CMakeLists.txt index 86802fc65..3b7e26fc4 100644 --- a/deps/w32-pthreads/CMakeLists.txt +++ b/deps/w32-pthreads/CMakeLists.txt @@ -1,26 +1,20 @@ -if(POLICY CMP0090) - cmake_policy(SET CMP0090 NEW) -endif() +cmake_minimum_required(VERSION 3.24...3.25) -project(w32-pthreads) +legacy_check() -add_library(w32-pthreads SHARED) +add_library(w32-pthreads SHARED EXCLUDE_FROM_ALL ) add_library(OBS::w32-pthreads ALIAS w32-pthreads) -target_sources(w32-pthreads PRIVATE implement.h pthread.c pthread.h sched.h - semaphore.h w32-pthreads.rc) - -set(MODULE_DESCRIPTION "POSIX Threads for Windows") -configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - w32-pthreads.rc) - +target_sources(w32-pthreads PRIVATE implement.h pthread.c pthread.h sched.h semaphore.h w32-pthreads.rc) target_compile_definitions(w32-pthreads PRIVATE __CLEANUP_C PTW32_BUILD) +target_include_directories(w32-pthreads PUBLIC "$") -target_include_directories( - w32-pthreads PUBLIC "$") +configure_file(cmake/windows/obs-module.rc.in w32-pthreads.rc) -set_target_properties(w32-pthreads PROPERTIES FOLDER "deps" PUBLIC_HEADER - "pthread.h;sched.h") +set_target_properties_obs(w32-pthreads PROPERTIES FOLDER deps) -setup_binary_target(w32-pthreads) -export_target(w32-pthreads) +set_property( + TARGET w32-pthreads + APPEND + PROPERTY PUBLIC_HEADER pthread.h sched.h) +target_export(w32-pthreads) diff --git a/deps/w32-pthreads/cmake/legacy.cmake b/deps/w32-pthreads/cmake/legacy.cmake new file mode 100644 index 000000000..e08987cba --- /dev/null +++ b/deps/w32-pthreads/cmake/legacy.cmake @@ -0,0 +1,22 @@ +if(POLICY CMP0090) + cmake_policy(SET CMP0090 NEW) +endif() + +project(w32-pthreads) + +add_library(w32-pthreads SHARED) +add_library(OBS::w32-pthreads ALIAS w32-pthreads) + +target_sources(w32-pthreads PRIVATE implement.h pthread.c pthread.h sched.h semaphore.h w32-pthreads.rc) + +set(MODULE_DESCRIPTION "POSIX Threads for Windows") +configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in w32-pthreads.rc) + +target_compile_definitions(w32-pthreads PRIVATE __CLEANUP_C PTW32_BUILD) + +target_include_directories(w32-pthreads PUBLIC "$") + +set_target_properties(w32-pthreads PROPERTIES FOLDER "deps" PUBLIC_HEADER "pthread.h;sched.h") + +setup_binary_target(w32-pthreads) +export_target(w32-pthreads) diff --git a/deps/w32-pthreads/cmake/windows/obs-module.rc.in b/deps/w32-pthreads/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..d85693ab5 --- /dev/null +++ b/deps/w32-pthreads/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "POSIX Threads for Windows" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "w32-pthreads" + VALUE "OriginalFilename", "w32-pthreads" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/libobs-d3d11/CMakeLists.txt b/libobs-d3d11/CMakeLists.txt index 8e67d6593..e881ee784 100644 --- a/libobs-d3d11/CMakeLists.txt +++ b/libobs-d3d11/CMakeLists.txt @@ -21,8 +21,7 @@ target_sources( d3d11-zstencilbuffer.cpp) set(MODULE_DESCRIPTION "OBS Library D3D11 wrapper") -configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - libobs-d3d11.rc) +configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in libobs-d3d11.rc) target_include_directories(libobs-d3d11 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) @@ -30,19 +29,14 @@ target_sources(libobs-d3d11 PRIVATE libobs-d3d11.rc) target_compile_features(libobs-d3d11 PRIVATE cxx_std_17) -target_compile_definitions( - libobs-d3d11 PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS - _CRT_NONSTDC_NO_WARNINGS) +target_compile_definitions(libobs-d3d11 PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS) if(NOT DEFINED GPU_PRIORITY_VAL OR "x${GPU_PRIORITY_VAL}x" STREQUAL "xx" OR "${GPU_PRIORITY_VAL}" STREQUAL "0") - target_compile_definitions(libobs-d3d11 PRIVATE USE_GPU_PRIORITY=FALSE - GPU_PRIORITY_VAL=0) + target_compile_definitions(libobs-d3d11 PRIVATE USE_GPU_PRIORITY=FALSE GPU_PRIORITY_VAL=0) else() - target_compile_definitions( - libobs-d3d11 PRIVATE USE_GPU_PRIORITY=TRUE - GPU_PRIORITY_VAL=${GPU_PRIORITY_VAL}) + target_compile_definitions(libobs-d3d11 PRIVATE USE_GPU_PRIORITY=TRUE GPU_PRIORITY_VAL=${GPU_PRIORITY_VAL}) endif() target_link_libraries(libobs-d3d11 PRIVATE OBS::libobs d3d9 d3d11 dxgi shcore) diff --git a/libobs-opengl/.gitignore b/libobs-opengl/.gitignore deleted file mode 100644 index e69de29bb..000000000 diff --git a/libobs-opengl/CMakeLists.txt b/libobs-opengl/CMakeLists.txt index 78642d8bf..641f5cc4a 100644 --- a/libobs-opengl/CMakeLists.txt +++ b/libobs-opengl/CMakeLists.txt @@ -1,8 +1,14 @@ -project(libobs-opengl) +cmake_minimum_required(VERSION 3.16...3.25) + +legacy_check() add_library(libobs-opengl SHARED) add_library(OBS::libobs-opengl ALIAS libobs-opengl) +if(NOT TARGET OBS::glad) + add_subdirectory("${CMAKE_SOURCE_DIR}/deps/glad" "${CMAKE_BINARY_DIR}/deps/glad") +endif() + target_sources( libobs-opengl PRIVATE gl-helpers.c @@ -20,53 +26,50 @@ target_sources( gl-vertexbuffer.c gl-zstencil.c) -target_link_libraries(libobs-opengl PRIVATE OBS::libobs OBS::obsglad) - -set_target_properties( - libobs-opengl - PROPERTIES FOLDER "core" - VERSION "${OBS_VERSION_MAJOR}" - SOVERSION "1") +target_link_libraries(libobs-opengl PRIVATE OBS::libobs OBS::glad) if(OS_WINDOWS) - set(MODULE_DESCRIPTION "OBS Library OpenGL wrapper") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - libobs-opengl.rc) + configure_file(cmake/windows/obs-module.rc.in libobs-opengl.rc) target_sources(libobs-opengl PRIVATE gl-windows.c libobs-opengl.rc) - elseif(OS_MACOS) find_library(COCOA Cocoa) find_library(IOSURF IOSurface) target_sources(libobs-opengl PRIVATE gl-cocoa.m) + target_compile_definitions(libobs-opengl PRIVATE GL_SILENCE_DEPRECATION) target_link_libraries(libobs-opengl PRIVATE ${COCOA} ${IOSURF}) - - set_target_properties(libobs-opengl PROPERTIES PREFIX "") - -elseif(OS_POSIX) +elseif(OS_LINUX OR OS_FREEBSD) find_package(X11 REQUIRED) - find_package(XCB COMPONENTS XCB) - find_package(X11_XCB REQUIRED) + find_package( + xcb + COMPONENTS xcb + REQUIRED) + find_package(x11-xcb REQUIRED) target_sources(libobs-opengl PRIVATE gl-egl-common.c gl-nix.c gl-x11-egl.c) - - target_link_libraries(libobs-opengl PRIVATE XCB::XCB X11::X11_xcb) - - set_target_properties(libobs-opengl PROPERTIES PREFIX "") + target_link_libraries(libobs-opengl PRIVATE xcb::xcb X11::x11-xcb) if(ENABLE_WAYLAND) find_package( OpenGL COMPONENTS EGL REQUIRED) + find_package(Wayland REQUIRED) target_sources(libobs-opengl PRIVATE gl-wayland-egl.c) - target_link_libraries(libobs-opengl PRIVATE OpenGL::EGL Wayland::EGL) endif() + endif() -setup_binary_target(libobs-opengl) +target_enable_feature(libobs "OpenGL renderer") + +set_target_properties_obs( + libobs-opengl + PROPERTIES FOLDER core + VERSION 0 + PREFIX "" + SOVERSION "${OBS_VERSION_MAJOR}") diff --git a/libobs-opengl/cmake/legacy.cmake b/libobs-opengl/cmake/legacy.cmake new file mode 100644 index 000000000..f54087647 --- /dev/null +++ b/libobs-opengl/cmake/legacy.cmake @@ -0,0 +1,71 @@ +project(libobs-opengl) + +add_library(libobs-opengl SHARED) +add_library(OBS::libobs-opengl ALIAS libobs-opengl) + +target_sources( + libobs-opengl + PRIVATE gl-helpers.c + gl-helpers.h + gl-indexbuffer.c + gl-shader.c + gl-shaderparser.c + gl-shaderparser.h + gl-stagesurf.c + gl-subsystem.c + gl-subsystem.h + gl-texture2d.c + gl-texture3d.c + gl-texturecube.c + gl-vertexbuffer.c + gl-zstencil.c) + +target_link_libraries(libobs-opengl PRIVATE OBS::libobs OBS::obsglad) + +set_target_properties( + libobs-opengl + PROPERTIES FOLDER "core" + VERSION "${OBS_VERSION_MAJOR}" + SOVERSION "1") + +if(OS_WINDOWS) + set(MODULE_DESCRIPTION "OBS Library OpenGL wrapper") + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in libobs-opengl.rc) + + target_sources(libobs-opengl PRIVATE gl-windows.c libobs-opengl.rc) + +elseif(OS_MACOS) + find_library(COCOA Cocoa) + find_library(IOSURF IOSurface) + + target_sources(libobs-opengl PRIVATE gl-cocoa.m) + target_compile_definitions(libobs-opengl PRIVATE GL_SILENCE_DEPRECATION) + + target_link_libraries(libobs-opengl PRIVATE ${COCOA} ${IOSURF}) + set_target_properties(libobs-opengl PROPERTIES PREFIX "") + +elseif(OS_POSIX) + find_package(X11 REQUIRED) + find_package(XCB COMPONENTS XCB) + find_package(X11_XCB REQUIRED) + + target_sources(libobs-opengl PRIVATE gl-egl-common.c gl-nix.c gl-x11-egl.c) + + target_link_libraries(libobs-opengl PRIVATE XCB::XCB X11::X11_xcb) + + set_target_properties(libobs-opengl PROPERTIES PREFIX "") + + if(ENABLE_WAYLAND) + find_package( + OpenGL + COMPONENTS EGL + REQUIRED) + find_package(Wayland REQUIRED) + + target_sources(libobs-opengl PRIVATE gl-wayland-egl.c) + + target_link_libraries(libobs-opengl PRIVATE OpenGL::EGL Wayland::EGL) + endif() +endif() + +setup_binary_target(libobs-opengl) diff --git a/libobs-opengl/cmake/windows/obs-module.rc.in b/libobs-opengl/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..a18fc9c57 --- /dev/null +++ b/libobs-opengl/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS Library OpenGL wrapper" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "libobs-opengl" + VALUE "OriginalFilename", "libobs-opengl" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/libobs-opengl/gl-cocoa.m b/libobs-opengl/gl-cocoa.m index 78711e6c1..1dec0b2ae 100644 --- a/libobs-opengl/gl-cocoa.m +++ b/libobs-opengl/gl-cocoa.m @@ -16,7 +16,6 @@ ******************************************************************************/ #include "gl-subsystem.h" -#define GL_SILENCE_DEPRECATION #include #import diff --git a/libobs-winrt/CMakeLists.txt b/libobs-winrt/CMakeLists.txt index 00215b3e8..86f439ec7 100644 --- a/libobs-winrt/CMakeLists.txt +++ b/libobs-winrt/CMakeLists.txt @@ -3,8 +3,7 @@ project(libobs-winrt) add_library(libobs-winrt MODULE) add_library(OBS::libobs-winrt ALIAS libobs-winrt) -target_sources(libobs-winrt PRIVATE winrt-capture.cpp winrt-capture.h - winrt-dispatch.cpp winrt-dispatch.h) +target_sources(libobs-winrt PRIVATE winrt-capture.cpp winrt-capture.h winrt-dispatch.cpp winrt-dispatch.h) target_precompile_headers( libobs-winrt diff --git a/libobs/CMakeLists.txt b/libobs/CMakeLists.txt index c69557e3e..d78e9e425 100644 --- a/libobs/CMakeLists.txt +++ b/libobs/CMakeLists.txt @@ -1,24 +1,21 @@ -if(POLICY CMP0090) - cmake_policy(SET CMP0090 NEW) -endif() +cmake_minimum_required(VERSION 3.16...3.25) -project(libobs) +legacy_check() + +add_library(libobs SHARED) +add_library(OBS::libobs ALIAS libobs) find_package(Threads REQUIRED) -find_package( - FFmpeg REQUIRED - COMPONENTS avformat avutil swscale swresample - OPTIONAL_COMPONENTS avcodec) +find_package(FFmpeg REQUIRED avformat avutil swscale swresample OPTIONAL_COMPONENTS avcodec) find_package(ZLIB REQUIRED) if(ENABLE_UI) find_qt(COMPONENTS Core) -else() - set(_QT_VERSION 0) endif() -add_library(libobs SHARED) -add_library(OBS::libobs ALIAS libobs) +find_package(jansson REQUIRED) +add_subdirectory("${CMAKE_SOURCE_DIR}/deps/libcaption" "${CMAKE_BINARY_DIR}/deps/libcaption") +add_subdirectory("${CMAKE_SOURCE_DIR}/deps/uthash" "${CMAKE_BINARY_DIR}/deps/uthash") target_sources( libobs @@ -66,7 +63,56 @@ target_sources( obs-video.c obs-video-gpu-encode.c obs-view.c - obs-config.h) + $<$:obs-hevc.c> + $<$:obs-hevc.h>) + +target_sources( + libobs + PRIVATE util/array-serializer.c + util/array-serializer.h + util/base.c + util/base.h + util/bitstream.c + util/bitstream.h + util/bmem.h + util/bmem.c + util/c99defs.h + util/cf-lexer.c + util/cf-lexer.h + util/cf-parser.c + util/cf-parser.h + util/circlebuf.h + util/config-file.c + util/config-file.h + util/crc32.c + util/crc32.h + util/darray.h + util/dstr.c + util/dstr.h + util/file-serializer.c + util/file-serializer.h + util/lexer.c + util/lexer.h + util/pipe.h + util/platform.c + util/platform.h + util/profiler.c + util/profiler.h + util/profiler.hpp + util/serializer.h + util/sse-intrin.h + util/task.c + util/task.h + util/text-lookup.c + util/text-lookup.h + util/threading.h + util/utf8.c + util/utf8.h + util/util.hpp + util/uthash.h + util/util_uint64.h + util/util_uint128.h + util/curl/curl-helper.h) target_sources( libobs @@ -96,48 +142,6 @@ target_sources( callback/proc.c callback/proc.h) -target_sources( - libobs - PRIVATE graphics/graphics.c - graphics/graphics.h - graphics/graphics-imports.c - graphics/graphics-internal.h - graphics/axisang.c - graphics/axisang.h - graphics/bounds.c - graphics/bounds.h - graphics/device-exports.h - graphics/effect.c - graphics/effect.h - graphics/effect-parser.c - graphics/effect-parser.h - graphics/half.h - graphics/image-file.c - graphics/image-file.h - graphics/math-extra.c - graphics/math-extra.h - graphics/matrix3.c - graphics/matrix3.h - graphics/matrix4.c - graphics/matrix4.h - graphics/plane.c - graphics/plane.h - graphics/quat.c - graphics/quat.h - graphics/shader-parser.c - graphics/shader-parser.h - graphics/srgb.h - graphics/texture-render.c - graphics/vec2.c - graphics/vec2.h - graphics/vec3.c - graphics/vec3.h - graphics/vec4.c - graphics/vec4.h - graphics/libnsgif/libnsgif.c - graphics/libnsgif/libnsgif.h - graphics/graphics-ffmpeg.c) - target_sources( libobs PRIVATE media-io/audio-io.c @@ -162,330 +166,146 @@ target_sources( target_sources( libobs - PRIVATE util/array-serializer.c - util/array-serializer.h - util/base.c - util/base.h - util/bitstream.c - util/bitstream.h - util/bmem.c - util/bmem.h - util/c99defs.h - util/cf-lexer.c - util/cf-lexer.h - util/cf-parser.c - util/cf-parser.h - util/circlebuf.h - util/config-file.c - util/config-file.h - util/crc32.c - util/crc32.h - util/dstr.c - util/dstr.h - util/file-serializer.c - util/file-serializer.h - util/lexer.c - util/lexer.h - util/platform.c - util/platform.h - util/profiler.c - util/profiler.h - util/profiler.hpp - util/pipe.h - util/serializer.h - util/sse-intrin.h - util/task.c - util/task.h - util/text-lookup.c - util/text-lookup.h - util/threading.h - util/utf8.c - util/utf8.h - util/uthash.h - util/util_uint64.h - util/util_uint128.h - util/curl/curl-helper.h - util/darray.h - util/util.hpp) + PRIVATE graphics/axisang.c + graphics/axisang.h + graphics/bounds.c + graphics/bounds.h + graphics/device-exports.h + graphics/effect.c + graphics/effect.h + graphics/effect-parser.c + graphics/effect-parser.h + graphics/image-file.c + graphics/graphics.c + graphics/graphics.h + graphics/graphics-ffmpeg.c + graphics/graphics-imports.c + graphics/graphics-internal.h + graphics/half.h + graphics/image-file.h + graphics/math-extra.c + graphics/math-extra.h + graphics/matrix3.c + graphics/matrix3.h + graphics/matrix4.c + graphics/matrix4.h + graphics/plane.c + graphics/plane.h + graphics/quat.c + graphics/quat.h + graphics/shader-parser.c + graphics/shader-parser.h + graphics/srgb.h + graphics/texture-render.c + graphics/vec2.c + graphics/vec2.h + graphics/vec3.c + graphics/vec3.h + graphics/vec4.c + graphics/vec4.h + graphics/libnsgif/libnsgif.c + graphics/libnsgif/libnsgif.h) -if(ENABLE_HEVC) - target_sources(libobs PRIVATE obs-hevc.c obs-hevc.h) -endif() - -# Contents of "data" dir already automatically added to bundles on macOS -if(NOT OS_MACOS) - target_sources( - libobs - PRIVATE data/area.effect - data/bicubic_scale.effect - data/bilinear_lowres_scale.effect - data/color.effect - data/default.effect - data/default_rect.effect - data/deinterlace_base.effect - data/deinterlace_blend.effect - data/deinterlace_blend_2x.effect - data/deinterlace_discard.effect - data/deinterlace_discard_2x.effect - data/deinterlace_linear.effect - data/deinterlace_linear_2x.effect - data/deinterlace_yadif.effect - data/deinterlace_yadif_2x.effect - data/format_conversion.effect - data/lanczos_scale.effect - data/opaque.effect - data/premultiplied_alpha.effect - data/repeat.effect - data/solid.effect) -endif() +target_compile_features(libobs PUBLIC $) +target_compile_options(libobs PUBLIC ${ARCH_SIMD_FLAGS}) +target_compile_definitions( + libobs + PRIVATE IS_LIBOBS + PUBLIC ${ARCH_SIMD_DEFINES} $:ENABLE_HEVC>> + $:SHOW_SUBPROCESSES>>) target_link_libraries( libobs - PRIVATE FFmpeg::avcodec + PRIVATE OBS::caption + OBS::uthash + FFmpeg::avcodec FFmpeg::avformat FFmpeg::avutil FFmpeg::swscale FFmpeg::swresample - Jansson::Jansson - OBS::caption - OBS::uthash + jansson::jansson ZLIB::ZLIB PUBLIC Threads::Threads) -set_target_properties( - libobs - PROPERTIES OUTPUT_NAME obs - FOLDER "core" - VERSION "${OBS_VERSION_MAJOR}" - SOVERSION "0") - -target_compile_definitions( - libobs - PUBLIC ${ARCH_SIMD_DEFINES} - PRIVATE IS_LIBOBS) - -target_compile_features(libobs PRIVATE cxx_alias_templates) - -target_compile_options(libobs PUBLIC ${ARCH_SIMD_FLAGS}) - -target_include_directories( - libobs PUBLIC $ - $) - if(OS_WINDOWS) - set(MODULE_DESCRIPTION "OBS Library") - set(UI_VERSION "${OBS_VERSION_CANONICAL}") - - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - libobs.rc) - - target_sources( - libobs - PRIVATE obs-win-crash-handler.c - obs-windows.c - util/threading-windows.c - util/threading-windows.h - util/pipe-windows.c - util/platform-windows.c - util/windows/device-enum.c - util/windows/device-enum.h - util/windows/obfuscate.c - util/windows/obfuscate.h - util/windows/win-registry.h - util/windows/win-version.h - util/windows/window-helpers.c - util/windows/window-helpers.h - util/windows/ComPtr.hpp - util/windows/CoTaskMemPtr.hpp - util/windows/HRError.hpp - util/windows/WinHandle.hpp - libobs.rc - audio-monitoring/win32/wasapi-output.c - audio-monitoring/win32/wasapi-enum-devices.c - audio-monitoring/win32/wasapi-output.h - audio-monitoring/win32/wasapi-monitoring-available.c) - - target_compile_definitions( - libobs PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS - _CRT_NONSTDC_NO_WARNINGS) - - target_link_libraries(libobs PRIVATE dxgi Avrt Dwmapi winmm Rpcrt4) - - if(MSVC) - target_link_libraries(libobs PUBLIC OBS::w32-pthreads) - - target_compile_options(libobs PRIVATE "$<$:/EHc->" - "$<$:/EHc->") - - target_link_options(libobs PRIVATE "LINKER:/IGNORE:4098" - "LINKER:/SAFESEH:NO") - endif() - + include(cmake/os-windows.cmake) elseif(OS_MACOS) - - find_library(COCOA Cocoa) - find_library(COREAUDIO CoreAudio) - find_library(AUDIOTOOLBOX AudioToolbox) - find_library(AUDIOUNIT AudioUnit) - find_library(APPKIT AppKit) - find_library(IOKIT IOKit) - find_library(CARBON Carbon) - - mark_as_advanced( - COCOA - COREAUDIO - AUDIOTOOLBOX - AUDIOUNIT - APPKIT - IOKIT - CARBON) - - target_link_libraries( - libobs - PRIVATE ${COCOA} - ${COREAUDIO} - ${AUDIOTOOLBOX} - ${AUDIOUNIT} - ${APPKIT} - ${IOKIT} - ${CARBON}) - - target_sources( - libobs - PRIVATE obs-cocoa.m - util/pipe-posix.c - util/platform-cocoa.m - util/platform-nix.c - util/threading-posix.c - util/threading-posix.h - util/apple/cfstring-utils.h - audio-monitoring/osx/coreaudio-enum-devices.c - audio-monitoring/osx/coreaudio-output.c - audio-monitoring/osx/coreaudio-monitoring-available.c - audio-monitoring/osx/mac-helpers.h) - - set_source_files_properties(util/platform-cocoa.m obs-cocoa.m - PROPERTIES COMPILE_FLAGS -fobjc-arc) - - set_target_properties( - libobs PROPERTIES SOVERSION "1" BUILD_RPATH - "$") - -elseif(OS_POSIX) - if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) - target_compile_definitions(libobs PRIVATE ENABLE_DARRAY_TYPE_TEST) - endif() - - find_package(LibUUID REQUIRED) - find_package(X11 REQUIRED) - find_package( - XCB - COMPONENTS XCB - OPTIONAL_COMPONENTS XINPUT - QUIET) - find_package(X11_XCB REQUIRED) - - target_sources( - libobs - PRIVATE obs-nix.c - obs-nix-platform.c - obs-nix-platform.h - obs-nix-x11.c - util/threading-posix.c - util/threading-posix.h - util/pipe-posix.c - util/platform-nix.c) - - target_link_libraries(libobs PRIVATE X11::X11_xcb XCB::XCB LibUUID::LibUUID) - - if(USE_XDG) - target_compile_definitions(libobs PRIVATE USE_XDG) - endif() - - if(ENABLE_PULSEAUDIO) - find_package(PulseAudio REQUIRED) - obs_status(STATUS "-> PulseAudio found - audio monitoring enabled") - target_sources( - libobs - PRIVATE audio-monitoring/pulse/pulseaudio-output.c - audio-monitoring/pulse/pulseaudio-enum-devices.c - audio-monitoring/pulse/pulseaudio-wrapper.c - audio-monitoring/pulse/pulseaudio-wrapper.h - audio-monitoring/pulse/pulseaudio-monitoring-available.c) - - target_link_libraries(libobs PRIVATE ${PULSEAUDIO_LIBRARY}) - else() - obs_status(WARNING "-> No audio backend found - audio monitoring disabled") - target_sources(libobs PRIVATE audio-monitoring/null/null-audio-monitoring.c) - endif() - - find_package(Gio) - if(TARGET GIO::GIO) - target_link_libraries(libobs PRIVATE GIO::GIO) - - target_sources(libobs PRIVATE util/platform-nix-dbus.c - util/platform-nix-portal.c) - endif() - - if(TARGET XCB::XINPUT) - target_link_libraries(libobs PRIVATE XCB::XINPUT) - endif() - - if(ENABLE_WAYLAND) - find_package( - Wayland - COMPONENTS Client - REQUIRED) - find_package(Xkbcommon REQUIRED) - - target_link_libraries(libobs PRIVATE Wayland::Client Xkbcommon::Xkbcommon) - - target_sources(libobs PRIVATE obs-nix-wayland.c) - endif() - - if(OS_LINUX) - target_link_libraries(glad PRIVATE ${CMAKE_DL_LIBS}) - endif() - - if(OS_FREEBSD) - find_package(Sysinfo REQUIRED) - target_link_libraries(libobs PRIVATE Sysinfo::Sysinfo) - endif() - - set_target_properties( - libobs PROPERTIES BUILD_RPATH "$") + include(cmake/os-macos.cmake) +elseif(OS_LINUX) + include(cmake/os-linux.cmake) +elseif(OS_FREEBSD) + include(cmake/os-freebsd.cmake) endif() -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/obsconfig.h.in - ${CMAKE_BINARY_DIR}/config/obsconfig.h) - +configure_file(obsconfig.h.in "${CMAKE_BINARY_DIR}/config/obsconfig.h" @ONLY) +target_include_directories(libobs PUBLIC "$" + "$") target_compile_definitions(libobs PUBLIC HAVE_OBSCONFIG_H) -if(ENABLE_FFMPEG_MUX_DEBUG) - target_compile_definitions(libobs PRIVATE SHOW_SUBPROCESSES) +list( + APPEND + public_headers + obs.h + obs-config.h + obs-defs.h + obs-data.h + obs-interaction.h + obs-internal.h + obs-module.h + obs-properties.h + obs-ui.h + callback/calldata.h + callback/proc.h + callback/signal.h + graphics/graphics.h + graphics/vec2.h + graphics/vec3.h + graphics/vec4.h + media-io/audio-io.h + media-io/frame-rate.h + media-io/video-io.h + media-io/media-io-defs.h + util/base.h + util/bmem.h + util/c99defs.h + util/darray.h + util/profiler.h + util/text-lookup.h + util/util_uint64.h) + +if(ENABLE_HEVC) + list(APPEND public_headers obs-hevc.h) endif() -get_target_property(_OBS_SOURCES libobs SOURCES) -set(_OBS_HEADERS ${_OBS_SOURCES}) -set(_OBS_FILTERS ${_OBS_SOURCES}) -list(FILTER _OBS_HEADERS INCLUDE REGEX ".*\\.h(pp)?") -list(FILTER _OBS_SOURCES INCLUDE REGEX ".*\\.(m|c[cp]?p?)") -list(FILTER _OBS_FILTERS INCLUDE REGEX ".*\\.effect") +if(ARCH_SIMD_FLAGS) + list( + APPEND + public_headers + util/simde/check.h + util/simde/debug-trap.h + util/simde/hedley.h + util/simde/simde-align.h + util/simde/simde-arch.h + util/simde/simde-common.h + util/simde/simde-constify.h + util/simde/simde-detect-clang.h + util/simde/simde-diagnostic.h + util/simde/simde-features.h + util/simde/simde-math.h + util/simde/x86/mmx.h + util/simde/x86/sse2.h + util/simde/x86/sse.h) +endif() -source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}" - PREFIX "Source Files" - FILES ${_OBS_SOURCES}) -source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}" - PREFIX "Header Files" - FILES ${_OBS_HEADERS}) -source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}" - PREFIX "Effect Files" - FILES ${_OBS_FILTERS}) +set_property( + TARGET libobs + APPEND + PROPERTY OBS_PUBLIC_HEADERS ${public_headers}) -setup_binary_target(libobs) -setup_target_resources(libobs libobs) -export_target(libobs) -install_headers(libobs) +set_target_properties_obs( + libobs + PROPERTIES FOLDER core + VERSION 0 + SOVERSION "${OBS_VERSION_MAJOR}") + +target_export(libobs) diff --git a/libobs/cmake/32bit-build.cmake b/libobs/cmake/32bit-build.cmake new file mode 100644 index 000000000..7a621a357 --- /dev/null +++ b/libobs/cmake/32bit-build.cmake @@ -0,0 +1,16 @@ +if(OS_WINDOWS) + add_library(obs-obfuscate INTERFACE EXCLUDE_FROM_ALL) + add_library(OBS::obfuscate ALIAS obs-obfuscate) + target_sources(obs-obfuscate INTERFACE util/windows/obfuscate.c util/windows/obfuscate.h) + target_include_directories(obs-obfuscate INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") + + add_library(obs-comutils INTERFACE EXCLUDE_FROM_ALL) + add_library(OBS::COMutils ALIAS obs-comutils) + target_sources(obs-comutils INTERFACE util/windows/ComPtr.hpp) + target_include_directories(obs-comutils INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") + + add_library(obs-winhandle INTERFACE EXCLUDE_FROM_ALL) + add_library(OBS::winhandle ALIAS obs-winhandle) + target_sources(obs-winhandle INTERFACE util/windows/WinHandle.hpp) + target_include_directories(obs-winhandle INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") +endif() diff --git a/libobs/cmake/legacy.cmake b/libobs/cmake/legacy.cmake new file mode 100644 index 000000000..6cba77fb3 --- /dev/null +++ b/libobs/cmake/legacy.cmake @@ -0,0 +1,481 @@ +if(POLICY CMP0090) + cmake_policy(SET CMP0090 NEW) +endif() + +project(libobs) + +find_package(Threads REQUIRED) +find_package( + FFmpeg REQUIRED + COMPONENTS avformat avutil swscale swresample + OPTIONAL_COMPONENTS avcodec) +find_package(ZLIB REQUIRED) + +if(ENABLE_UI) + find_qt(COMPONENTS Core) +else() + set(_QT_VERSION 0) +endif() + +add_library(libobs SHARED) +add_library(OBS::libobs ALIAS libobs) + +target_sources( + libobs + PRIVATE obs.c + obs.h + obs.hpp + obs-audio.c + obs-audio-controls.c + obs-audio-controls.h + obs-avc.c + obs-avc.h + obs-data.c + obs-data.h + obs-defs.h + obs-display.c + obs-encoder.c + obs-encoder.h + obs-ffmpeg-compat.h + obs-hotkey.c + obs-hotkey.h + obs-hotkeys.h + obs-missing-files.c + obs-missing-files.h + obs-nal.c + obs-nal.h + obs-hotkey-name-map.c + obs-interaction.h + obs-internal.h + obs-module.c + obs-module.h + obs-output.c + obs-output.h + obs-output-delay.c + obs-properties.c + obs-properties.h + obs-service.c + obs-service.h + obs-scene.c + obs-scene.h + obs-source.c + obs-source.h + obs-source-deinterlace.c + obs-source-transition.c + obs-ui.h + obs-video.c + obs-video-gpu-encode.c + obs-view.c + obs-config.h) + +target_sources( + libobs + PRIVATE util/simde/check.h + util/simde/debug-trap.h + util/simde/hedley.h + util/simde/simde-align.h + util/simde/simde-arch.h + util/simde/simde-common.h + util/simde/simde-constify.h + util/simde/simde-detect-clang.h + util/simde/simde-diagnostic.h + util/simde/simde-features.h + util/simde/simde-math.h + util/simde/x86/mmx.h + util/simde/x86/sse2.h + util/simde/x86/sse.h) + +target_sources( + libobs + PRIVATE callback/calldata.c + callback/calldata.h + callback/decl.c + callback/decl.h + callback/signal.c + callback/signal.h + callback/proc.c + callback/proc.h) + +target_sources( + libobs + PRIVATE graphics/graphics.c + graphics/graphics.h + graphics/graphics-imports.c + graphics/graphics-internal.h + graphics/axisang.c + graphics/axisang.h + graphics/bounds.c + graphics/bounds.h + graphics/device-exports.h + graphics/effect.c + graphics/effect.h + graphics/effect-parser.c + graphics/effect-parser.h + graphics/half.h + graphics/image-file.c + graphics/image-file.h + graphics/math-extra.c + graphics/math-extra.h + graphics/matrix3.c + graphics/matrix3.h + graphics/matrix4.c + graphics/matrix4.h + graphics/plane.c + graphics/plane.h + graphics/quat.c + graphics/quat.h + graphics/shader-parser.c + graphics/shader-parser.h + graphics/srgb.h + graphics/texture-render.c + graphics/vec2.c + graphics/vec2.h + graphics/vec3.c + graphics/vec3.h + graphics/vec4.c + graphics/vec4.h + graphics/libnsgif/libnsgif.c + graphics/libnsgif/libnsgif.h + graphics/graphics-ffmpeg.c) + +target_sources( + libobs + PRIVATE media-io/audio-io.c + media-io/audio-io.h + media-io/audio-math.h + media-io/audio-resampler.h + media-io/audio-resampler-ffmpeg.c + media-io/format-conversion.c + media-io/format-conversion.h + media-io/frame-rate.h + media-io/media-remux.c + media-io/media-remux.h + media-io/video-fourcc.c + media-io/video-frame.c + media-io/video-frame.h + media-io/video-io.c + media-io/video-io.h + media-io/media-io-defs.h + media-io/video-matrices.c + media-io/video-scaler-ffmpeg.c + media-io/video-scaler.h) + +target_sources( + libobs + PRIVATE util/array-serializer.c + util/array-serializer.h + util/base.c + util/base.h + util/bitstream.c + util/bitstream.h + util/bmem.c + util/bmem.h + util/c99defs.h + util/cf-lexer.c + util/cf-lexer.h + util/cf-parser.c + util/cf-parser.h + util/circlebuf.h + util/config-file.c + util/config-file.h + util/crc32.c + util/crc32.h + util/dstr.c + util/dstr.h + util/file-serializer.c + util/file-serializer.h + util/lexer.c + util/lexer.h + util/platform.c + util/platform.h + util/profiler.c + util/profiler.h + util/profiler.hpp + util/pipe.h + util/serializer.h + util/sse-intrin.h + util/task.c + util/task.h + util/text-lookup.c + util/text-lookup.h + util/threading.h + util/utf8.c + util/utf8.h + util/uthash.h + util/util_uint64.h + util/util_uint128.h + util/curl/curl-helper.h + util/darray.h + util/util.hpp) + +if(ENABLE_HEVC) + target_sources(libobs PRIVATE obs-hevc.c obs-hevc.h) +endif() + +# Contents of "data" dir already automatically added to bundles on macOS +if(NOT OS_MACOS) + target_sources( + libobs + PRIVATE data/area.effect + data/bicubic_scale.effect + data/bilinear_lowres_scale.effect + data/color.effect + data/default.effect + data/default_rect.effect + data/deinterlace_base.effect + data/deinterlace_blend.effect + data/deinterlace_blend_2x.effect + data/deinterlace_discard.effect + data/deinterlace_discard_2x.effect + data/deinterlace_linear.effect + data/deinterlace_linear_2x.effect + data/deinterlace_yadif.effect + data/deinterlace_yadif_2x.effect + data/format_conversion.effect + data/lanczos_scale.effect + data/opaque.effect + data/premultiplied_alpha.effect + data/repeat.effect + data/solid.effect) +endif() + +target_link_libraries( + libobs + PRIVATE FFmpeg::avcodec + FFmpeg::avformat + FFmpeg::avutil + FFmpeg::swscale + FFmpeg::swresample + Jansson::Jansson + OBS::caption + OBS::uthash + ZLIB::ZLIB + PUBLIC Threads::Threads) + +set_target_properties( + libobs + PROPERTIES OUTPUT_NAME obs + FOLDER "core" + VERSION "${OBS_VERSION_MAJOR}" + SOVERSION "0") + +target_compile_definitions( + libobs + PUBLIC ${ARCH_SIMD_DEFINES} + PRIVATE IS_LIBOBS) + +target_compile_features(libobs PRIVATE cxx_alias_templates) + +target_compile_options(libobs PUBLIC ${ARCH_SIMD_FLAGS}) + +target_include_directories(libobs PUBLIC $ + $) + +if(OS_WINDOWS) + set(MODULE_DESCRIPTION "OBS Library") + set(UI_VERSION "${OBS_VERSION_CANONICAL}") + + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in libobs.rc) + + target_sources( + libobs + PRIVATE obs-win-crash-handler.c + obs-windows.c + util/threading-windows.c + util/threading-windows.h + util/pipe-windows.c + util/platform-windows.c + util/windows/device-enum.c + util/windows/device-enum.h + util/windows/obfuscate.c + util/windows/obfuscate.h + util/windows/win-registry.h + util/windows/win-version.h + util/windows/window-helpers.c + util/windows/window-helpers.h + util/windows/ComPtr.hpp + util/windows/CoTaskMemPtr.hpp + util/windows/HRError.hpp + util/windows/WinHandle.hpp + libobs.rc + audio-monitoring/win32/wasapi-output.c + audio-monitoring/win32/wasapi-enum-devices.c + audio-monitoring/win32/wasapi-output.h + audio-monitoring/win32/wasapi-monitoring-available.c) + + target_compile_definitions(libobs PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS) + + target_link_libraries(libobs PRIVATE dxgi Avrt Dwmapi winmm Rpcrt4) + + if(MSVC) + target_link_libraries(libobs PUBLIC OBS::w32-pthreads) + + target_compile_options(libobs PRIVATE "$<$:/EHc->" "$<$:/EHc->") + + target_link_options(libobs PRIVATE "LINKER:/IGNORE:4098" "LINKER:/SAFESEH:NO") + endif() + +elseif(OS_MACOS) + + find_library(COCOA Cocoa) + find_library(COREAUDIO CoreAudio) + find_library(AUDIOTOOLBOX AudioToolbox) + find_library(AUDIOUNIT AudioUnit) + find_library(APPKIT AppKit) + find_library(IOKIT IOKit) + find_library(CARBON Carbon) + + mark_as_advanced( + COCOA + COREAUDIO + AUDIOTOOLBOX + AUDIOUNIT + APPKIT + IOKIT + CARBON) + + target_link_libraries( + libobs + PRIVATE ${COCOA} + ${COREAUDIO} + ${AUDIOTOOLBOX} + ${AUDIOUNIT} + ${APPKIT} + ${IOKIT} + ${CARBON}) + + target_sources( + libobs + PRIVATE obs-cocoa.m + util/pipe-posix.c + util/platform-cocoa.m + util/platform-nix.c + util/threading-posix.c + util/threading-posix.h + util/apple/cfstring-utils.h + audio-monitoring/osx/coreaudio-enum-devices.c + audio-monitoring/osx/coreaudio-output.c + audio-monitoring/osx/coreaudio-monitoring-available.c + audio-monitoring/osx/mac-helpers.h) + + set_source_files_properties(util/platform-cocoa.m obs-cocoa.m PROPERTIES COMPILE_FLAGS -fobjc-arc) + + set_target_properties(libobs PROPERTIES SOVERSION "1" BUILD_RPATH "$") + +elseif(OS_POSIX) + if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) + target_compile_definitions(libobs PRIVATE ENABLE_DARRAY_TYPE_TEST) + endif() + + find_package(LibUUID REQUIRED) + find_package(X11 REQUIRED) + find_package( + XCB + COMPONENTS XCB + OPTIONAL_COMPONENTS XINPUT + QUIET) + find_package(X11_XCB REQUIRED) + + target_sources( + libobs + PRIVATE obs-nix.c + obs-nix-platform.c + obs-nix-platform.h + obs-nix-x11.c + util/threading-posix.c + util/threading-posix.h + util/pipe-posix.c + util/platform-nix.c) + + target_link_libraries(libobs PRIVATE X11::X11_xcb XCB::XCB LibUUID::LibUUID) + + if(USE_XDG) + target_compile_definitions(libobs PRIVATE USE_XDG) + endif() + + if(ENABLE_PULSEAUDIO) + find_package(PulseAudio REQUIRED) + obs_status(STATUS "-> PulseAudio found - audio monitoring enabled") + target_sources( + libobs + PRIVATE audio-monitoring/pulse/pulseaudio-output.c audio-monitoring/pulse/pulseaudio-enum-devices.c + audio-monitoring/pulse/pulseaudio-wrapper.c audio-monitoring/pulse/pulseaudio-wrapper.h + audio-monitoring/pulse/pulseaudio-monitoring-available.c) + + target_link_libraries(libobs PRIVATE ${PULSEAUDIO_LIBRARY}) + else() + obs_status(WARNING "-> No audio backend found - audio monitoring disabled") + target_sources(libobs PRIVATE audio-monitoring/null/null-audio-monitoring.c) + endif() + + find_package(Gio) + if(TARGET GIO::GIO) + target_link_libraries(libobs PRIVATE GIO::GIO) + + target_sources(libobs PRIVATE util/platform-nix-dbus.c util/platform-nix-portal.c) + endif() + + if(TARGET XCB::XINPUT) + target_link_libraries(libobs PRIVATE XCB::XINPUT) + endif() + + if(ENABLE_WAYLAND) + find_package( + Wayland + COMPONENTS Client + REQUIRED) + find_package(Xkbcommon REQUIRED) + + target_link_libraries(libobs PRIVATE Wayland::Client Xkbcommon::Xkbcommon) + + target_sources(libobs PRIVATE obs-nix-wayland.c) + endif() + + if(OS_LINUX) + target_link_libraries(obsglad PRIVATE ${CMAKE_DL_LIBS}) + endif() + + if(OS_FREEBSD) + find_package(Sysinfo REQUIRED) + target_link_libraries(libobs PRIVATE Sysinfo::Sysinfo) + endif() + + set_target_properties(libobs PROPERTIES BUILD_RPATH "$") +endif() + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/obsconfig.h.in ${CMAKE_BINARY_DIR}/config/obsconfig.h) + +target_compile_definitions( + libobs + PUBLIC HAVE_OBSCONFIG_H + PRIVATE "OBS_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\"" "OBS_QT_VERSION=${_QT_VERSION}" + "$<$:LINUX_PORTABLE>") + +if(ENABLE_FFMPEG_MUX_DEBUG) + target_compile_definitions(libobs PRIVATE SHOW_SUBPROCESSES) +endif() + +get_target_property(_OBS_SOURCES libobs SOURCES) +set(_OBS_HEADERS ${_OBS_SOURCES}) +set(_OBS_FILTERS ${_OBS_SOURCES}) +list(FILTER _OBS_HEADERS INCLUDE REGEX ".*\\.h(pp)?") +list(FILTER _OBS_SOURCES INCLUDE REGEX ".*\\.(m|c[cp]?p?)") +list(FILTER _OBS_FILTERS INCLUDE REGEX ".*\\.effect") + +source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}" + PREFIX "Source Files" + FILES ${_OBS_SOURCES}) +source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}" + PREFIX "Header Files" + FILES ${_OBS_HEADERS}) +source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}" + PREFIX "Effect Files" + FILES ${_OBS_FILTERS}) + +setup_binary_target(libobs) +setup_target_resources(libobs libobs) +export_target(libobs) +install_headers(libobs) diff --git a/libobs/cmake/libobsConfig.cmake.in b/libobs/cmake/libobsConfig.cmake.in index 8e3c31c2e..44e17220d 100644 --- a/libobs/cmake/libobsConfig.cmake.in +++ b/libobs/cmake/libobsConfig.cmake.in @@ -9,8 +9,3 @@ find_dependency(Threads REQUIRED) include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake") check_required_components("@PROJECT_NAME@") - -set(LIBOBS_PLUGIN_DESTINATION "@PACKAGE_OBS_PLUGIN_DESTINATION@") -set(LIBOBS_PLUGIN_DATA_DESTINATION "@PACKAGE_OBS_DATA_DESTINATION@/obs-plugins") - -set(LIBOBS_LIBRARIES libobs) diff --git a/libobs/cmake/macos/Info.plist.in b/libobs/cmake/macos/Info.plist.in new file mode 100644 index 000000000..6d0e507af --- /dev/null +++ b/libobs/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + libobs + CFBundleIdentifier + com.obsproject.libobs + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + libobs + CFBundlePackageType + FMWK + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/libobs/cmake/macos/entitlements.plist b/libobs/cmake/macos/entitlements.plist new file mode 100644 index 000000000..498562fee --- /dev/null +++ b/libobs/cmake/macos/entitlements.plist @@ -0,0 +1,8 @@ + + + + + com.apple.security.cs.disable-library-validation + + + diff --git a/libobs/cmake/os-freebsd.cmake b/libobs/cmake/os-freebsd.cmake new file mode 100644 index 000000000..76c1d1155 --- /dev/null +++ b/libobs/cmake/os-freebsd.cmake @@ -0,0 +1,66 @@ +find_package(X11 REQUIRED) +find_package(x11-xcb REQUIRED) +find_package( + xcb + OPTIONAL_COMPONENTS xcb-xinput + QUIET) +find_package(gio) +find_package(Sysinfo REQUIRED) + +target_link_libraries(libobs PRIVATE X11::x11-xcb xcb::xcb Sysinfo::Sysinfo) + +if(TARGET xcb::xcb-xinput) + target_link_libraries(libobs PRIVATE xcb::xcb-xinput) +endif() + +target_compile_definitions(libobs PRIVATE $<$,$>:ENABLE_DARRAY_TYPE_TEST>) + +target_sources( + libobs + PRIVATE obs-nix.c + obs-nix-platform.c + obs-nix-platform.h + obs-nix-x11.c + util/pipe-posix.c + util/platform-nix.c + util/threading-posix.c + util/threading-posix.h) + +if(ENABLE_PULSEAUDIO) + find_package(PulseAudio REQUIRED) + + target_sources( + libobs + PRIVATE audio-monitoring/pulse/pulseaudio-enum-devices.c audio-monitoring/pulse/pulseaudio-monitoring-available.c + audio-monitoring/pulse/pulseaudio-output.c audio-monitoring/pulse/pulseaudio-wrapper.c + audio-monitoring/pulse/pulseaudio-wrapper.h) + + target_link_libraries(libobs PRIVATE PulseAudio::PulseAudio) + + set_property(GLOBAL APPEND PROPERTY OBS_FEATURES_ENABLED "PulseAudio audio monitoring (Linux)") +else() + target_sources(libobs PRIVATE audio-monitoring/null/null-audio-monitoring.c) + set_property(GLOBAL APPEND PROPERTY OBS_FEATURES_DISABLED "PulseAudio audio monitoring (Linux)") +endif() + +if(TARGET gio::gio) + target_link_libraries(libobs PRIVATE gio::gio) + + target_sources(libobs PRIVATE util/platform-nix-dbus.c util/platform-nix-portal.c) +endif() + +if(ENABLE_WAYLAND) + find_package( + Wayland + COMPONENTS Client + REQUIRED) + find_package(xkbcommon REQUIRED) + + target_link_libraries(libobs PRIVATE Wayland::Client xkbcommon::xkbcommon) + target_sources(libobs PRIVATE obs-nix-wayland.c) + set_property(GLOBAL APPEND PROPERTY OBS_FEATURES_ENABLED "Wayland compositor support (Linux)") +else() + set_property(GLOBAL APPEND PROPERTY OBS_FEATURES_DISABLED "Wayland compositor support (Linux)") +endif() + +set_target_properties(libobs PROPERTIES OUTPUT_NAME obs) diff --git a/libobs/cmake/os-linux.cmake b/libobs/cmake/os-linux.cmake new file mode 100644 index 000000000..4e1f7ea4a --- /dev/null +++ b/libobs/cmake/os-linux.cmake @@ -0,0 +1,70 @@ +cmake_minimum_required(VERSION 3.22...3.25) + +find_package(LibUUID REQUIRED) +find_package(X11 REQUIRED) +find_package(x11-xcb REQUIRED) +find_package( + xcb + COMPONENTS xcb + OPTIONAL_COMPONENTS xcb-xinput + QUIET) +find_package(gio) + +target_link_libraries(libobs PRIVATE X11::x11-xcb xcb::xcb LibUUID::LibUUID ${CMAKE_DL_LIBS}) + +if(TARGET xcb::xcb-xinput) + target_link_libraries(libobs PRIVATE xcb::xcb-xinput) +endif() + +target_compile_definitions(libobs PRIVATE USE_XDG + $<$,$>:ENABLE_DARRAY_TYPE_TEST>) + +target_sources( + libobs + PRIVATE obs-nix.c + obs-nix-platform.c + obs-nix-platform.h + obs-nix-x11.c + util/pipe-posix.c + util/platform-nix.c + util/threading-posix.c + util/threading-posix.h) + +if(ENABLE_PULSEAUDIO) + find_package(PulseAudio REQUIRED) + + target_sources( + libobs + PRIVATE audio-monitoring/pulse/pulseaudio-enum-devices.c audio-monitoring/pulse/pulseaudio-output.c + audio-monitoring/pulse/pulseaudio-monitoring-available.c audio-monitoring/pulse/pulseaudio-wrapper.c + audio-monitoring/pulse/pulseaudio-wrapper.h) + + target_link_libraries(libobs PRIVATE PulseAudio::PulseAudio) + + target_enable_feature(libobs "PulseAudio audio monitoring (Linux)") +else() + target_sources(libobs PRIVATE audio-monitoring/null/null-audio-monitoring.c) + target_disable_feature(libobs "PulseAudio audio monitoring (Linux)") +endif() + +if(TARGET gio::gio) + target_link_libraries(libobs PRIVATE gio::gio) + + target_sources(libobs PRIVATE util/platform-nix-dbus.c util/platform-nix-portal.c) +endif() + +if(ENABLE_WAYLAND) + find_package( + Wayland + COMPONENTS Client + REQUIRED) + find_package(xkbcommon REQUIRED) + + target_link_libraries(libobs PRIVATE Wayland::Client xkbcommon::xkbcommon) + target_sources(libobs PRIVATE obs-nix-wayland.c) + target_enable_feature(libobs "Wayland compositor support (Linux)") +else() + target_disable_feature(libobs "Wayland compositor support (Linux)") +endif() + +set_target_properties(libobs PROPERTIES OUTPUT_NAME obs) diff --git a/libobs/cmake/os-macos.cmake b/libobs/cmake/os-macos.cmake new file mode 100644 index 000000000..82aa6940e --- /dev/null +++ b/libobs/cmake/os-macos.cmake @@ -0,0 +1,43 @@ +find_library(COCOA Cocoa) +find_library(COREAUDIO CoreAudio) +find_library(AUDIOTOOLBOX AudioToolbox) +find_library(AUDIOUNIT AudioUnit) +find_library(APPKIT AppKit) +find_library(IOKIT IOKit) +find_library(CARBON Carbon) + +mark_as_advanced( + COCOA + COREAUDIO + AUDIOTOOLBOX + AUDIOUNIT + APPKIT + IOKIT + CARBON) + +target_link_libraries( + libobs + PRIVATE ${COCOA} + ${COREAUDIO} + ${AUDIOTOOLBOX} + ${AUDIOUNIT} + ${APPKIT} + ${IOKIT} + ${CARBON}) + +target_sources( + libobs + PRIVATE obs-cocoa.m + audio-monitoring/osx/coreaudio-enum-devices.c + audio-monitoring/osx/coreaudio-monitoring-available.c + audio-monitoring/osx/coreaudio-output.c + audio-monitoring/osx/mac-helpers.h + util/pipe-posix.c + util/platform-cocoa.m + util/platform-nix.c + util/threading-posix.c + util/threading-posix.h + util/apple/cfstring-utils.h) + +set_property(SOURCE util/platform-cocoa.m obs-cocoa.m PROPERTY COMPILE_FLAGS -fobjc-arc) +set_property(TARGET libobs PROPERTY FRAMEWORK TRUE) diff --git a/libobs/cmake/os-windows.cmake b/libobs/cmake/os-windows.cmake new file mode 100644 index 000000000..64bab843d --- /dev/null +++ b/libobs/cmake/os-windows.cmake @@ -0,0 +1,58 @@ +configure_file(cmake/windows/obs-module.rc.in libobs.rc) + +add_library(obs-obfuscate INTERFACE EXCLUDE_FROM_ALL) +add_library(OBS::obfuscate ALIAS obs-obfuscate) +target_sources(obs-obfuscate INTERFACE util/windows/obfuscate.c util/windows/obfuscate.h) +target_include_directories(obs-obfuscate INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") + +add_library(obs-comutils INTERFACE EXCLUDE_FROM_ALL) +add_library(OBS::COMutils ALIAS obs-comutils) +target_sources(obs-comutils INTERFACE util/windows/ComPtr.hpp) +target_include_directories(obs-comutils INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") + +add_library(obs-winhandle INTERFACE EXCLUDE_FROM_ALL) +add_library(OBS::winhandle ALIAS obs-winhandle) +target_sources(obs-winhandle INTERFACE util/windows/WinHandle.hpp) +target_include_directories(obs-winhandle INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") + +target_sources( + libobs + PRIVATE libobs.rc + obs-win-crash-handler.c + obs-windows.c + audio-monitoring/win32/wasapi-enum-devices.c + audio-monitoring/win32/wasapi-monitoring-available.c + audio-monitoring/win32/wasapi-output.c + audio-monitoring/win32/wasapi-output.h + util/pipe-windows.c + util/platform-windows.c + util/threading-windows.c + util/threading-windows.h + util/windows/CoTaskMemPtr.hpp + util/windows/device-enum.c + util/windows/device-enum.h + util/windows/HRError.hpp + util/windows/obfuscate.c + util/windows/obfuscate.h + util/windows/win-registry.h + util/windows/win-version.h + util/windows/window-helpers.c + util/windows/window-helpers.h) + +target_compile_options(libobs PRIVATE $<$:/EHc->) + +target_link_libraries( + libobs + PRIVATE Avrt + Dwmapi + Dxgi + winmm + Rpcrt4 + OBS::obfuscate + OBS::winhandle + OBS::COMutils + PUBLIC OBS::w32-pthreads) + +target_link_options(libobs PRIVATE /IGNORE:4098 /SAFESEH:NO) + +set_target_properties(libobs PROPERTIES PREFIX "") diff --git a/libobs/cmake/windows/obs-module.rc.in b/libobs/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..9ae588457 --- /dev/null +++ b/libobs/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS Library" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "libobs" + VALUE "OriginalFilename", "libobs" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/libobs/obs-cocoa.m b/libobs/obs-cocoa.m index b6f7a68e7..b592f471f 100644 --- a/libobs/obs-cocoa.m +++ b/libobs/obs-cocoa.m @@ -68,19 +68,15 @@ char *find_libobs_data_file(const char *file) { struct dstr path; - if (is_in_bundle()) { - NSBundle *frameworkBundle = [NSBundle - bundleWithIdentifier:@"com.obsproject.libobs"]; - NSURL *bundleURL = [frameworkBundle bundleURL]; - NSURL *libobsDataURL = - [bundleURL URLByAppendingPathComponent:@"Resources/"]; - const char *libobsDataPath = [[libobsDataURL path] - cStringUsingEncoding:NSUTF8StringEncoding]; - dstr_init_copy(&path, libobsDataPath); - dstr_cat(&path, "/"); - } else { - dstr_init_copy(&path, OBS_INSTALL_DATA_PATH "/libobs/"); - } + NSBundle *frameworkBundle = + [NSBundle bundleWithIdentifier:@"com.obsproject.libobs"]; + NSURL *bundleURL = [frameworkBundle bundleURL]; + NSURL *libobsDataURL = + [bundleURL URLByAppendingPathComponent:@"Resources/"]; + const char *libobsDataPath = [[libobsDataURL path] + cStringUsingEncoding:NSUTF8StringEncoding]; + dstr_init_copy(&path, libobsDataPath); + dstr_cat(&path, "/"); dstr_cat(&path, file); return path.array; diff --git a/libobs/obsconfig.h.in b/libobs/obsconfig.h.in index 9b93f95f5..d34ab0fe0 100644 --- a/libobs/obsconfig.h.in +++ b/libobs/obsconfig.h.in @@ -1,23 +1,13 @@ - #pragma once -#ifndef ON -#define ON 1 -#endif - -#ifndef OFF -#define OFF 0 -#endif - #define OBS_VERSION "@OBS_VERSION@" -#define OBS_VERSION_CANONICAL "@OBS_VERSION_CANONICAL@" -#define OBS_DATA_PATH "@OBS_DATA_PATH@" -#define OBS_INSTALL_PREFIX "@OBS_INSTALL_PREFIX@" -#define OBS_PLUGIN_DESTINATION "@OBS_PLUGIN_DESTINATION@" -#define OBS_QT_VERSION @_QT_VERSION@ + +#cmakedefine OBS_VERSION_CANONICAL "@OBS_VERSION_CANONICAL@" +#cmakedefine OBS_DATA_PATH "@OBS_DATA_PATH@" +#cmakedefine OBS_PLUGIN_PATH "@OBS_PLUGIN_PATH@" +#cmakedefine OBS_PLUGIN_DESTINATION "@OBS_PLUGIN_DESTINATION@" #cmakedefine OBS_COMMIT "@OBS_COMMIT@" -#cmakedefine LINUX_PORTABLE #cmakedefine GIO_FOUND #cmakedefine PULSEAUDIO_FOUND #cmakedefine XCB_XINPUT_FOUND diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 5541ed52f..a9a15b02f 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -1,4 +1,100 @@ +cmake_minimum_required(VERSION 3.16...3.25) + option(ENABLE_PLUGINS "Enable building OBS plugins" ON) + +if(OBS_CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.0) + + if(NOT ENABLE_PLUGINS) + set_property(GLOBAL APPEND PROPERTY OBS_FEATURES_DISABLED "Plugin Support") + endif() + + set_property(GLOBAL APPEND PROPERTY OBS_FEATURES_ENABLED "Plugin Support") + + macro(check_obs_browser) + if(NOT (OS_WINDOWS AND NOT CMAKE_GENERATOR_PLATFORM MATCHES "(Win32|x64)")) + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/obs-browser/cmake/macos/Info.plist.in") + add_subdirectory(obs-browser) + elseif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/obs-browser/CMakeLists.txt") + message(FATAL_ERROR "Required submodule 'obs-browser' not available.") + endif() + endif() + endmacro() + + macro(check_obs_websocket) + if(OS_WINDOWS + OR OS_MACOS + OR OS_LINUX) + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/obs-websocket/cmake/macos/Info.plist.in") + add_subdirectory(obs-websocket) + elseif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/obs-websocket/CMakeLists.txt") + message(FATAL_ERROR "Required submodule 'obs-websocket' not available.") + endif() + endif() + endmacro() + + # Add plugins in alphabetical order to retain order in IDE projects + add_subdirectory(aja) + if(OS_WINDOWS OR OS_MACOS) + add_subdirectory(coreaudio-encoder) + endif() + if(OS_WINDOWS + OR OS_MACOS + OR OS_LINUX) + add_subdirectory(decklink) + endif() + if(OS_WINDOWS) + add_subdirectory(enc-amf) + endif() + add_subdirectory(image-source) + if(OS_LINUX) + add_subdirectory(linux-alsa) + add_subdirectory(linux-capture) + add_subdirectory(linux-jack) + add_subdirectory(linux-pipewire) + add_subdirectory(linux-pulseaudio) + add_subdirectory(linux-v4l2) + endif() + if(OS_MACOS) + add_subdirectory(mac-avcapture) + add_subdirectory(mac-capture) + add_subdirectory(mac-syphon) + add_subdirectory(mac-videotoolbox) + add_subdirectory(mac-virtualcam) + endif() + check_obs_browser() + add_subdirectory(obs-ffmpeg) + add_subdirectory(obs-filters) + add_subdirectory(obs-outputs) + if(OS_WINDOWS) + add_subdirectory(obs-qsv11) + add_subdirectory(obs-text) + endif() + add_subdirectory(obs-transitions) + if(OS_WINDOWS + OR OS_MACOS + OR OS_LINUX) + add_subdirectory(obs-vst) + endif() + check_obs_websocket() + add_subdirectory(obs-x264) + add_subdirectory(rtmp-services) + if(OS_LINUX) + add_subdirectory(sndio) + endif() + add_subdirectory(text-freetype2) + if(OS_WINDOWS + OR OS_MACOS + OR OS_LINUX) + add_subdirectory(vlc-video) + endif() + if(OS_WINDOWS) + add_subdirectory(win-capture) + add_subdirectory(win-dshow) + add_subdirectory(win-wasapi) + endif() + return() +endif() + if(NOT ENABLE_PLUGINS) obs_status(STATUS "Building with plugins disabled.") return() @@ -12,8 +108,7 @@ function(check_obs_browser) endif() endfunction() -# APPLE/WIN32/UNIX are soft-deprecated: -# https://discourse.cmake.org/t/platform-id-vs-win32-vs-cmake-system-name/1226/2 +# APPLE/WIN32/UNIX are soft-deprecated: https://discourse.cmake.org/t/platform-id-vs-win32-vs-cmake-system-name/1226/2 if(OS_WINDOWS) add_subdirectory(coreaudio-encoder) add_subdirectory(win-wasapi) diff --git a/plugins/aja/CMakeLists.txt b/plugins/aja/CMakeLists.txt index 02bbec614..b0a93e105 100644 --- a/plugins/aja/CMakeLists.txt +++ b/plugins/aja/CMakeLists.txt @@ -1,16 +1,11 @@ -project(aja) +cmake_minimum_required(VERSION 3.16...3.25) + +legacy_check() option(ENABLE_AJA "Build OBS with aja support" ON) -if(NOT ENABLE_AJA) - obs_status(DISABLED "aja") - return() -endif() -if(NOT OS_MACOS AND NOT CMAKE_SIZEOF_VOID_P EQUAL 8) - obs_status(STATUS "aja support not enabled (32-bit not supported).") - set(ENABLE_AJA - OFF - CACHE BOOL "Build OBS with aja support" FORCE) +if(NOT ENABLE_AJA) + set_property(GLOBAL APPEND PROPERTY OBS_MODULES_DISABLED aja) return() endif() @@ -48,29 +43,24 @@ target_sources( target_link_libraries(aja PRIVATE OBS::libobs AJA::LibAJANTV2) -if(OS_MACOS) +if(OS_WINDOWS) + configure_file(cmake/windows/obs-module.rc.in win-aja.rc) + target_sources(aja PRIVATE win-aja.rc) + + target_compile_options(aja PRIVATE /wd4996) + + target_link_libraries(aja PRIVATE ws2_32.lib setupapi.lib Winmm.lib netapi32.lib Shlwapi.lib) + target_link_options(aja PRIVATE /IGNORE:4099) + +elseif(OS_MACOS) find_library(IOKIT IOKit) find_library(COREFOUNDATION CoreFoundation) find_library(APPKIT AppKit) target_link_libraries(aja PRIVATE ${IOKIT} ${COREFOUNDATION} ${APPKIT}) -elseif(OS_WINDOWS) - set(MODULE_DESCRIPTION "OBS AJA Windows module") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - win-aja.rc) - - target_sources(aja PRIVATE win-aja.rc) - - target_compile_options(aja PRIVATE /wd4996) - target_link_libraries(aja PRIVATE ws2_32.lib setupapi.lib Winmm.lib - netapi32.lib Shlwapi.lib) - target_link_options(aja PRIVATE "LINKER:/IGNORE:4099") -endif() - -if(NOT MSVC) + target_compile_options(aja PRIVATE -Wno-error=deprecated-declarations) +elseif(OS_LINUX OR OS_FREEBSD) target_compile_options(aja PRIVATE -Wno-error=deprecated-declarations) endif() -set_target_properties(aja PROPERTIES FOLDER "plugins/aja" PREFIX "") - -setup_plugin_target(aja) +set_target_properties_obs(aja PROPERTIES FOLDER plugins PREFIX "") diff --git a/plugins/aja/cmake/legacy.cmake b/plugins/aja/cmake/legacy.cmake new file mode 100644 index 000000000..35d0f246b --- /dev/null +++ b/plugins/aja/cmake/legacy.cmake @@ -0,0 +1,74 @@ +project(aja) + +option(ENABLE_AJA "Build OBS with aja support" ON) +if(NOT ENABLE_AJA) + obs_status(DISABLED "aja") + return() +endif() + +if(NOT OS_MACOS AND NOT CMAKE_SIZEOF_VOID_P EQUAL 8) + obs_status(STATUS "aja support not enabled (32-bit not supported).") + set(ENABLE_AJA + OFF + CACHE BOOL "Build OBS with aja support" FORCE) + return() +endif() + +find_package(LibAJANTV2 REQUIRED) + +add_library(aja MODULE) +add_library(OBS::aja ALIAS aja) + +target_sources( + aja + PRIVATE main.cpp + aja-card-manager.cpp + aja-common.cpp + aja-common.hpp + aja-output.cpp + aja-enums.hpp + aja-output.hpp + aja-presets.cpp + aja-presets.hpp + aja-props.cpp + aja-props.hpp + aja-routing.cpp + aja-routing.hpp + aja-source.cpp + aja-source.hpp + aja-vpid-data.cpp + aja-vpid-data.hpp + aja-widget-io.cpp + aja-widget-io.hpp + aja-card-manager.hpp + aja-ui-props.hpp + audio-repack.c + audio-repack.h + audio-repack.hpp) + +target_link_libraries(aja PRIVATE OBS::libobs AJA::LibAJANTV2) + +if(OS_MACOS) + find_library(IOKIT IOKit) + find_library(COREFOUNDATION CoreFoundation) + find_library(APPKIT AppKit) + + target_link_libraries(aja PRIVATE ${IOKIT} ${COREFOUNDATION} ${APPKIT}) +elseif(OS_WINDOWS) + set(MODULE_DESCRIPTION "OBS AJA Windows module") + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in win-aja.rc) + + target_sources(aja PRIVATE win-aja.rc) + + target_compile_options(aja PRIVATE /wd4996) + target_link_libraries(aja PRIVATE ws2_32.lib setupapi.lib Winmm.lib netapi32.lib Shlwapi.lib) + target_link_options(aja PRIVATE "LINKER:/IGNORE:4099") +endif() + +if(NOT MSVC) + target_compile_options(aja PRIVATE -Wno-error=deprecated-declarations) +endif() + +set_target_properties(aja PROPERTIES FOLDER "plugins/aja" PREFIX "") + +setup_plugin_target(aja) diff --git a/plugins/aja/cmake/macos/Info.plist.in b/plugins/aja/cmake/macos/Info.plist.in new file mode 100644 index 000000000..40483850f --- /dev/null +++ b/plugins/aja/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + aja + CFBundleIdentifier + com.obsproject.aja + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + aja + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/plugins/aja/cmake/windows/obs-module.rc.in b/plugins/aja/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..9f9163618 --- /dev/null +++ b/plugins/aja/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS AJA Windows module" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "aja" + VALUE "OriginalFilename", "aja" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/plugins/coreaudio-encoder/CMakeLists.txt b/plugins/coreaudio-encoder/CMakeLists.txt index 4fd4c7688..ad0a76682 100644 --- a/plugins/coreaudio-encoder/CMakeLists.txt +++ b/plugins/coreaudio-encoder/CMakeLists.txt @@ -1,10 +1,11 @@ -project(coreaudio-encoder) +cmake_minimum_required(VERSION 3.24...3.25) + +legacy_check() if(OS_WINDOWS) - option(ENABLE_COREAUDIO_ENCODER - "Enable building with CoreAudio encoder (Windows)" ON) + option(ENABLE_COREAUDIO_ENCODER "Enable building with CoreAudio encoder (Windows)" ON) if(NOT ENABLE_COREAUDIO_ENCODER) - obs_status(DISABLED "coreaudio-encoder") + target_disable(coreaudio-encoder) return() endif() endif() @@ -13,41 +14,22 @@ add_library(coreaudio-encoder MODULE) add_library(OBS::coreaudio-encoder ALIAS coreaudio-encoder) target_sources(coreaudio-encoder PRIVATE encoder.cpp) - -set_target_properties( - coreaudio-encoder - PROPERTIES OUTPUT_NAME "coreaudio-encoder" - FOLDER "plugins" - PREFIX "") - -target_compile_features(coreaudio-encoder PRIVATE cxx_std_11) - target_link_libraries(coreaudio-encoder PRIVATE OBS::libobs) -if(OS_MACOS) +if(OS_WINDOWS) + target_compile_definitions(coreaudio-encoder PRIVATE UNICODE _UNICODE) + + configure_file(cmake/windows/obs-module.rc.in coreaudio-encoder.rc) + + target_sources(coreaudio-encoder PRIVATE coreaudio-encoder.rc windows-imports.h) +elseif(OS_MACOS) find_library(COREFOUNDATION CoreFoundation) find_library(COREAUDIO CoreAudio) find_library(AUDIOTOOLBOX AudioToolbox) - mark_as_advanced(AUDIOTOOLBOX COREAUDIO COREFOUNDATION) - target_link_libraries(coreaudio-encoder PRIVATE ${COREFOUNDATION} - ${COREAUDIO} ${AUDIOTOOLBOX}) + target_link_libraries(coreaudio-encoder PRIVATE ${COREFOUNDATION} ${COREAUDIO} ${AUDIOTOOLBOX}) -elseif(OS_WINDOWS) - if(MINGW) - set_source_files_properties(encoder.cpp PROPERTIES COMPILE_FLAGS - -Wno-multichar) - endif() - - target_compile_definitions(coreaudio-encoder PRIVATE UNICODE _UNICODE) - - set(MODULE_DESCRIPTION "OBS CoreAudio encoder") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - coreaudio-encoder.rc) - - target_sources(coreaudio-encoder PRIVATE coreaudio-encoder.rc - windows-imports.h) endif() -setup_plugin_target(coreaudio-encoder) +set_target_properties_obs(coreaudio-encoder PROPERTIES FOLDER plugins PREFIX "") diff --git a/plugins/coreaudio-encoder/cmake/legacy.cmake b/plugins/coreaudio-encoder/cmake/legacy.cmake new file mode 100644 index 000000000..4d4581632 --- /dev/null +++ b/plugins/coreaudio-encoder/cmake/legacy.cmake @@ -0,0 +1,48 @@ +project(coreaudio-encoder) + +if(OS_WINDOWS) + option(ENABLE_COREAUDIO_ENCODER "Enable building with CoreAudio encoder (Windows)" ON) + if(NOT ENABLE_COREAUDIO_ENCODER) + obs_status(DISABLED "coreaudio-encoder") + return() + endif() +endif() + +add_library(coreaudio-encoder MODULE) +add_library(OBS::coreaudio-encoder ALIAS coreaudio-encoder) + +target_sources(coreaudio-encoder PRIVATE encoder.cpp) + +set_target_properties( + coreaudio-encoder + PROPERTIES OUTPUT_NAME "coreaudio-encoder" + FOLDER "plugins" + PREFIX "") + +target_compile_features(coreaudio-encoder PRIVATE cxx_std_11) + +target_link_libraries(coreaudio-encoder PRIVATE OBS::libobs) + +if(OS_MACOS) + find_library(COREFOUNDATION CoreFoundation) + find_library(COREAUDIO CoreAudio) + find_library(AUDIOTOOLBOX AudioToolbox) + + mark_as_advanced(AUDIOTOOLBOX COREAUDIO COREFOUNDATION) + + target_link_libraries(coreaudio-encoder PRIVATE ${COREFOUNDATION} ${COREAUDIO} ${AUDIOTOOLBOX}) + +elseif(OS_WINDOWS) + if(MINGW) + set_source_files_properties(encoder.cpp PROPERTIES COMPILE_FLAGS -Wno-multichar) + endif() + + target_compile_definitions(coreaudio-encoder PRIVATE UNICODE _UNICODE) + + set(MODULE_DESCRIPTION "OBS CoreAudio encoder") + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in coreaudio-encoder.rc) + + target_sources(coreaudio-encoder PRIVATE coreaudio-encoder.rc windows-imports.h) +endif() + +setup_plugin_target(coreaudio-encoder) diff --git a/plugins/coreaudio-encoder/cmake/macos/Info.plist.in b/plugins/coreaudio-encoder/cmake/macos/Info.plist.in new file mode 100644 index 000000000..bfbbcf31e --- /dev/null +++ b/plugins/coreaudio-encoder/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + coreaudio-encoder + CFBundleIdentifier + com.obsproject.coreaudio-encoder + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + coreaudio-encoder + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/plugins/coreaudio-encoder/cmake/windows/obs-module.rc.in b/plugins/coreaudio-encoder/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..ae0d82974 --- /dev/null +++ b/plugins/coreaudio-encoder/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS CoreAudio encoder" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "coreaudio-encoder" + VALUE "OriginalFilename", "coreaudio-encoder" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/plugins/decklink/CMakeLists.txt b/plugins/decklink/CMakeLists.txt index d21f933b4..a90734893 100644 --- a/plugins/decklink/CMakeLists.txt +++ b/plugins/decklink/CMakeLists.txt @@ -1,17 +1,13 @@ -project(decklink) +cmake_minimum_required(VERSION 3.16...3.25) + +legacy_check() option(ENABLE_DECKLINK "Build OBS with Decklink support" ON) if(NOT ENABLE_DECKLINK) - obs_status(DISABLED "decklink") + target_disable(decklink) return() endif() -if(OS_WINDOWS) - include(IDLFileHelper) - add_idl_files(win-decklink-sdk_GENERATED_FILES - win/decklink-sdk/DeckLinkAPI.idl) -endif() - add_library(decklink MODULE) add_library(OBS::decklink ALIAS decklink) @@ -49,27 +45,23 @@ target_sources( util.cpp util.hpp) -target_include_directories(decklink-sdk INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) - target_link_libraries(decklink PRIVATE OBS::libobs OBS::caption Decklink::SDK) -set_target_properties(decklink PROPERTIES FOLDER "plugins/decklink") - if(OS_WINDOWS) - set(MODULE_DESCRIPTION "OBS DeckLink Windows module") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - win-decklink.rc) - + configure_file(cmake/windows/obs-module.rc.in win-decklink.rc) target_sources(decklink PRIVATE win/platform.cpp win-decklink.rc) - target_sources(decklink-sdk INTERFACE win/decklink-sdk/DeckLinkAPIVersion.h - ${win-decklink-sdk_GENERATED_FILES}) + include(idlfilehelper) + target_add_idl_files(decklink win/decklink-sdk/DeckLinkAPI.idl) + + target_sources(decklink-sdk INTERFACE win/decklink-sdk/DeckLinkAPIVersion.h) elseif(OS_MACOS) find_library(COREFOUNDATION CoreFoundation) mark_as_advanced(COREFOUNDATION) target_sources(decklink PRIVATE mac/platform.cpp) + target_link_libraries(decklink PRIVATE ${COREFOUNDATION}) target_sources( decklink-sdk @@ -82,11 +74,7 @@ elseif(OS_MACOS) mac/decklink-sdk/DeckLinkAPIStreaming.h mac/decklink-sdk/DeckLinkAPITypes.h mac/decklink-sdk/DeckLinkAPIVersion.h) - - target_link_libraries(decklink PRIVATE ${COREFOUNDATION}) - - target_compile_features(decklink PRIVATE cxx_auto_type) -elseif(OS_POSIX) +elseif(OS_LINUX OR OS_FREEBSD) target_sources(decklink PRIVATE linux/platform.cpp) target_sources( @@ -102,5 +90,4 @@ elseif(OS_POSIX) linux/decklink-sdk/LinuxCOM.h) endif() -setup_plugin_target(decklink) -setup_target_resources(decklink "obs-plugins/decklink") +set_target_properties_obs(decklink PROPERTIES FOLDER plugins/decklink PREFIX "") diff --git a/plugins/decklink/cmake/legacy.cmake b/plugins/decklink/cmake/legacy.cmake new file mode 100644 index 000000000..c618e8b0b --- /dev/null +++ b/plugins/decklink/cmake/legacy.cmake @@ -0,0 +1,103 @@ +project(decklink) + +option(ENABLE_DECKLINK "Build OBS with Decklink support" ON) +if(NOT ENABLE_DECKLINK) + obs_status(DISABLED "decklink") + return() +endif() + +if(OS_WINDOWS) + include(IDLFileHelper) + add_idl_files(win-decklink-sdk_GENERATED_FILES win/decklink-sdk/DeckLinkAPI.idl) +endif() + +add_library(decklink MODULE) +add_library(OBS::decklink ALIAS decklink) + +add_library(decklink-sdk INTERFACE) +add_library(Decklink::SDK ALIAS decklink-sdk) + +target_sources( + decklink + PRIVATE OBSVideoFrame.cpp + OBSVideoFrame.h + audio-repack.c + audio-repack.h + audio-repack.hpp + const.h + decklink-device.cpp + decklink-device.hpp + decklink-devices.cpp + decklink-devices.hpp + decklink-device-discovery.cpp + decklink-device-discovery.hpp + decklink-device-instance.cpp + decklink-device-instance.hpp + decklink-device-mode.cpp + decklink-device-mode.hpp + decklink-output.cpp + decklink-source.cpp + DecklinkBase.cpp + DecklinkBase.h + DecklinkInput.cpp + DecklinkInput.hpp + DecklinkOutput.cpp + DecklinkOutput.hpp + platform.hpp + plugin-main.cpp + util.cpp + util.hpp) + +target_include_directories(decklink-sdk INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) + +target_link_libraries(decklink PRIVATE OBS::libobs OBS::caption Decklink::SDK) + +set_target_properties(decklink PROPERTIES FOLDER "plugins/decklink") + +if(OS_WINDOWS) + set(MODULE_DESCRIPTION "OBS DeckLink Windows module") + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in win-decklink.rc) + + target_sources(decklink PRIVATE win/platform.cpp win-decklink.rc) + + target_sources(decklink-sdk INTERFACE win/decklink-sdk/DeckLinkAPIVersion.h ${win-decklink-sdk_GENERATED_FILES}) + +elseif(OS_MACOS) + find_library(COREFOUNDATION CoreFoundation) + mark_as_advanced(COREFOUNDATION) + + target_sources(decklink PRIVATE mac/platform.cpp) + + target_sources( + decklink-sdk + INTERFACE mac/decklink-sdk/DeckLinkAPIDispatch.cpp + mac/decklink-sdk/DeckLinkAPI.h + mac/decklink-sdk/DeckLinkAPIConfiguration.h + mac/decklink-sdk/DeckLinkAPIDeckControl.h + mac/decklink-sdk/DeckLinkAPIDiscovery.h + mac/decklink-sdk/DeckLinkAPIModes.h + mac/decklink-sdk/DeckLinkAPIStreaming.h + mac/decklink-sdk/DeckLinkAPITypes.h + mac/decklink-sdk/DeckLinkAPIVersion.h) + + target_link_libraries(decklink PRIVATE ${COREFOUNDATION}) + + target_compile_features(decklink PRIVATE cxx_auto_type) +elseif(OS_POSIX) + target_sources(decklink PRIVATE linux/platform.cpp) + + target_sources( + decklink-sdk + INTERFACE linux/decklink-sdk/DeckLinkAPIDispatch.cpp + linux/decklink-sdk/DeckLinkAPI.h + linux/decklink-sdk/DeckLinkAPIConfiguration.h + linux/decklink-sdk/DeckLinkAPIDeckControl.h + linux/decklink-sdk/DeckLinkAPIDiscovery.h + linux/decklink-sdk/DeckLinkAPIModes.h + linux/decklink-sdk/DeckLinkAPITypes.h + linux/decklink-sdk/DeckLinkAPIVersion.h + linux/decklink-sdk/LinuxCOM.h) +endif() + +setup_plugin_target(decklink) +setup_target_resources(decklink "obs-plugins/decklink") diff --git a/plugins/decklink/cmake/macos/Info.plist.in b/plugins/decklink/cmake/macos/Info.plist.in new file mode 100644 index 000000000..6ad684bdf --- /dev/null +++ b/plugins/decklink/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + decklink + CFBundleIdentifier + com.obsproject.decklink + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + decklink + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/plugins/decklink/cmake/windows/obs-module.rc.in b/plugins/decklink/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..74a16eb83 --- /dev/null +++ b/plugins/decklink/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS DeckLink Windows module" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "decklink" + VALUE "OriginalFilename", "decklink" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/plugins/image-source/CMakeLists.txt b/plugins/image-source/CMakeLists.txt index dc927294e..70c78ec93 100644 --- a/plugins/image-source/CMakeLists.txt +++ b/plugins/image-source/CMakeLists.txt @@ -1,25 +1,19 @@ -project(image-source) +cmake_minimum_required(VERSION 3.16...3.25) + +legacy_check() add_library(image-source MODULE) add_library(OBS::image-source ALIAS image-source) -target_sources(image-source PRIVATE image-source.c color-source.c - obs-slideshow.c) +target_sources(image-source PRIVATE color-source.c image-source.c obs-slideshow.c) target_link_libraries(image-source PRIVATE OBS::libobs) if(OS_WINDOWS) - if(MSVC) - target_link_libraries(image-source PRIVATE OBS::w32-pthreads) - endif() - - set(MODULE_DESCRIPTION "OBS image module") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - image-source.rc) + target_link_libraries(image-source PRIVATE OBS::w32-pthreads) + configure_file(cmake/windows/obs-module.rc.in image-source.rc) target_sources(image-source PRIVATE image-source.rc) endif() -set_target_properties(image-source PROPERTIES FOLDER "plugins" PREFIX "") - -setup_plugin_target(image-source) +set_target_properties_obs(image-source PROPERTIES FOLDER plugins PREFIX "") diff --git a/plugins/image-source/cmake/legacy.cmake b/plugins/image-source/cmake/legacy.cmake new file mode 100644 index 000000000..3dcb0a4d9 --- /dev/null +++ b/plugins/image-source/cmake/legacy.cmake @@ -0,0 +1,23 @@ +project(image-source) + +add_library(image-source MODULE) +add_library(OBS::image-source ALIAS image-source) + +target_sources(image-source PRIVATE image-source.c color-source.c obs-slideshow.c) + +target_link_libraries(image-source PRIVATE OBS::libobs) + +if(OS_WINDOWS) + if(MSVC) + target_link_libraries(image-source PRIVATE OBS::w32-pthreads) + endif() + + set(MODULE_DESCRIPTION "OBS image module") + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in image-source.rc) + + target_sources(image-source PRIVATE image-source.rc) +endif() + +set_target_properties(image-source PROPERTIES FOLDER "plugins" PREFIX "") + +setup_plugin_target(image-source) diff --git a/plugins/image-source/cmake/macos/Info.plist.in b/plugins/image-source/cmake/macos/Info.plist.in new file mode 100644 index 000000000..8c9f2474d --- /dev/null +++ b/plugins/image-source/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + image-source + CFBundleIdentifier + com.obsproject.image-source + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + image-source + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/plugins/image-source/cmake/windows/obs-module.rc.in b/plugins/image-source/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..f3458c312 --- /dev/null +++ b/plugins/image-source/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS image module" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "image-source" + VALUE "OriginalFilename", "image-source" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/plugins/linux-jack/CMakeLists.txt b/plugins/linux-jack/CMakeLists.txt index 25fe06dce..c78418d63 100644 --- a/plugins/linux-jack/CMakeLists.txt +++ b/plugins/linux-jack/CMakeLists.txt @@ -15,7 +15,6 @@ target_sources(linux-jack PRIVATE linux-jack.c jack-wrapper.c jack-input.c) target_link_libraries(linux-jack PRIVATE OBS::libobs Jack::Jack) -set_target_properties(linux-jack PROPERTIES FOLDER "plugins" PROJECT_LABEL - "JACK Audio") +set_target_properties(linux-jack PROPERTIES FOLDER "plugins" PROJECT_LABEL "JACK Audio") setup_plugin_target(linux-jack) diff --git a/plugins/linux-pipewire/CMakeLists.txt b/plugins/linux-pipewire/CMakeLists.txt index 31a55e68b..761cf3ac4 100644 --- a/plugins/linux-pipewire/CMakeLists.txt +++ b/plugins/linux-pipewire/CMakeLists.txt @@ -11,20 +11,11 @@ find_package(Gio QUIET) find_package(Libdrm QUIET) # we require libdrm/drm_fourcc.h to build if(NOT TARGET PipeWire::PipeWire) - obs_status( - FATAL_ERROR - "PipeWire library not found! Please install PipeWire or set ENABLE_PIPEWIRE=OFF." - ) + obs_status(FATAL_ERROR "PipeWire library not found! Please install PipeWire or set ENABLE_PIPEWIRE=OFF.") elseif(NOT TARGET GIO::GIO) - obs_status( - FATAL_ERROR - "Gio library not found! Please install GLib2 (or Gio) or set ENABLE_PIPEWIRE=OFF." - ) + obs_status(FATAL_ERROR "Gio library not found! Please install GLib2 (or Gio) or set ENABLE_PIPEWIRE=OFF.") elseif(NOT TARGET Libdrm::Libdrm) - obs_status( - FATAL_ERROR - "libdrm headers not found! Please install libdrm or set ENABLE_PIPEWIRE=OFF." - ) + obs_status(FATAL_ERROR "libdrm headers not found! Please install libdrm or set ENABLE_PIPEWIRE=OFF.") endif() add_library(linux-pipewire MODULE) @@ -40,9 +31,7 @@ target_sources( screencast-portal.c screencast-portal.h) -target_link_libraries( - linux-pipewire PRIVATE OBS::libobs OBS::obsglad PipeWire::PipeWire GIO::GIO - Libdrm::Libdrm) +target_link_libraries(linux-pipewire PRIVATE OBS::libobs OBS::obsglad PipeWire::PipeWire GIO::GIO Libdrm::Libdrm) set_target_properties(linux-pipewire PROPERTIES FOLDER "plugins") diff --git a/plugins/linux-pulseaudio/CMakeLists.txt b/plugins/linux-pulseaudio/CMakeLists.txt index 81ab17cd5..59d0d5d97 100644 --- a/plugins/linux-pulseaudio/CMakeLists.txt +++ b/plugins/linux-pulseaudio/CMakeLists.txt @@ -10,13 +10,11 @@ find_package(PulseAudio REQUIRED) add_library(linux-pulseaudio MODULE) add_library(OBS::pulseaudio ALIAS linux-pulseaudio) -target_sources(linux-pulseaudio PRIVATE linux-pulseaudio.c pulse-wrapper.c - pulse-input.c) +target_sources(linux-pulseaudio PRIVATE linux-pulseaudio.c pulse-wrapper.c pulse-input.c) target_include_directories(linux-pulseaudio PRIVATE ${PULSEAUDIO_INCLUDE_DIR}) -target_link_libraries(linux-pulseaudio PRIVATE OBS::libobs - ${PULSEAUDIO_LIBRARY}) +target_link_libraries(linux-pulseaudio PRIVATE OBS::libobs ${PULSEAUDIO_LIBRARY}) set_target_properties(linux-pulseaudio PROPERTIES FOLDER "plugins") diff --git a/plugins/linux-v4l2/CMakeLists.txt b/plugins/linux-v4l2/CMakeLists.txt index c26357663..90db5d46e 100644 --- a/plugins/linux-v4l2/CMakeLists.txt +++ b/plugins/linux-v4l2/CMakeLists.txt @@ -14,12 +14,9 @@ find_package(FFmpeg REQUIRED COMPONENTS avcodec avutil avformat) add_library(linux-v4l2 MODULE) add_library(OBS::v4l2 ALIAS linux-v4l2) -target_sources(linux-v4l2 PRIVATE linux-v4l2.c v4l2-controls.c v4l2-input.c - v4l2-helpers.c v4l2-output.c v4l2-decoder.c) +target_sources(linux-v4l2 PRIVATE linux-v4l2.c v4l2-controls.c v4l2-input.c v4l2-helpers.c v4l2-output.c v4l2-decoder.c) -target_link_libraries( - linux-v4l2 PRIVATE OBS::libobs LIB4L2::LIB4L2 FFmpeg::avcodec - FFmpeg::avformat FFmpeg::avutil) +target_link_libraries(linux-v4l2 PRIVATE OBS::libobs LIB4L2::LIB4L2 FFmpeg::avcodec FFmpeg::avformat FFmpeg::avutil) set_target_properties(linux-v4l2 PROPERTIES FOLDER "plugins") diff --git a/plugins/mac-avcapture/CMakeLists.txt b/plugins/mac-avcapture/CMakeLists.txt index 8d6a4d421..244de3675 100644 --- a/plugins/mac-avcapture/CMakeLists.txt +++ b/plugins/mac-avcapture/CMakeLists.txt @@ -1,4 +1,6 @@ -project(mac-avcapture) +cmake_minimum_required(VERSION 3.22...3.25) + +legacy_check() find_library(AVFOUNDATION AVFoundation) find_library(COCOA Cocoa) @@ -6,19 +8,16 @@ find_library(COREFOUNDATION CoreFoundation) find_library(COREMEDIA CoreMedia) find_library(COREVIDEO CoreVideo) find_library(COREMEDIAIO CoreMediaIO) - -mark_as_advanced(AVFOUNDATION COCOA COREFOUNDATION COREMEDIA COREMEDIAIO - COREVIDEO) +mark_as_advanced(AVFOUNDATION COCOA COREFOUNDATION COREMEDIA COREMEDIAIO COREVIDEO) add_library(mac-avcapture MODULE) add_library(OBS::avcapture ALIAS mac-avcapture) -target_sources(mac-avcapture PRIVATE av-capture.mm left-right.hpp - scope-guard.hpp) +target_sources(mac-avcapture PRIVATE av-capture.mm left-right.hpp scope-guard.hpp) -target_compile_features(mac-avcapture PRIVATE cxx_std_11) - -set_source_files_properties(av-capture.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) +if(NOT XCODE) + set_source_files_properties(av-capture.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) +endif() target_link_libraries( mac-avcapture @@ -30,6 +29,10 @@ target_link_libraries( ${COREVIDEO} ${COREMEDIAIO}) -set_target_properties(mac-avcapture PROPERTIES FOLDER "plugins" PREFIX "") - -setup_plugin_target(mac-avcapture) +set_target_properties_obs( + mac-avcapture + PROPERTIES FOLDER plugins + PREFIX "" + XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES + XCODE_ATTRIBUTE_CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION YES + XCODE_ATTRIBUTE_GCC_WARN_SHADOW YES) diff --git a/plugins/mac-avcapture/cmake/legacy.cmake b/plugins/mac-avcapture/cmake/legacy.cmake new file mode 100644 index 000000000..e4842de46 --- /dev/null +++ b/plugins/mac-avcapture/cmake/legacy.cmake @@ -0,0 +1,33 @@ +project(mac-avcapture) + +find_library(AVFOUNDATION AVFoundation) +find_library(COCOA Cocoa) +find_library(COREFOUNDATION CoreFoundation) +find_library(COREMEDIA CoreMedia) +find_library(COREVIDEO CoreVideo) +find_library(COREMEDIAIO CoreMediaIO) + +mark_as_advanced(AVFOUNDATION COCOA COREFOUNDATION COREMEDIA COREMEDIAIO COREVIDEO) + +add_library(mac-avcapture MODULE) +add_library(OBS::avcapture ALIAS mac-avcapture) + +target_sources(mac-avcapture PRIVATE av-capture.mm left-right.hpp scope-guard.hpp) + +target_compile_features(mac-avcapture PRIVATE cxx_std_11) + +set_source_files_properties(av-capture.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) + +target_link_libraries( + mac-avcapture + PRIVATE OBS::libobs + ${AVFOUNDATION} + ${COCOA} + ${COREFOUNDATION} + ${COREMEDIA} + ${COREVIDEO} + ${COREMEDIAIO}) + +set_target_properties(mac-avcapture PROPERTIES FOLDER "plugins" PREFIX "") + +setup_plugin_target(mac-avcapture) diff --git a/plugins/mac-avcapture/cmake/macos/Info.plist.in b/plugins/mac-avcapture/cmake/macos/Info.plist.in new file mode 100644 index 000000000..a67e7d6aa --- /dev/null +++ b/plugins/mac-avcapture/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + mac-avcapture + CFBundleIdentifier + com.obsproject.mac-avcapture + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + mac-avcapture + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/plugins/mac-capture/CMakeLists.txt b/plugins/mac-capture/CMakeLists.txt index 2dabcb04d..5ee636e24 100644 --- a/plugins/mac-capture/CMakeLists.txt +++ b/plugins/mac-capture/CMakeLists.txt @@ -1,4 +1,6 @@ -project(mac-capture) +cmake_minimum_required(VERSION 3.22...3.25) + +legacy_check() find_library(COREAUDIO CoreAudio) find_library(AUDIOUNIT AudioUnit) @@ -24,18 +26,20 @@ target_sources( window-utils.m window-utils.h) -target_link_libraries(mac-capture PRIVATE OBS::libobs ${COREAUDIO} ${AUDIOUNIT} - ${COREFOUNDATION} ${IOSURF} ${COCOA}) +target_link_libraries(mac-capture PRIVATE OBS::libobs ${COREAUDIO} ${AUDIOUNIT} ${COREFOUNDATION} ${IOSURF} ${COCOA}) if(SCREENCAPTUREKIT) - target_link_libraries(mac-capture PRIVATE OBS::libobs ${COREVIDEO} - ${COREMEDIA}) - - target_link_options(mac-capture PRIVATE SHELL:-weak_framework - ScreenCaptureKit) - target_link_options(libobs PRIVATE SHELL:-weak_framework ScreenCaptureKit) + target_link_libraries(mac-capture PRIVATE OBS::libobs ${COREVIDEO} ${COREMEDIA} + "$") endif() -set_target_properties(mac-capture PROPERTIES FOLDER "plugins" PREFIX "") +set_target_properties_obs( + mac-capture + PROPERTIES FOLDER plugins + PREFIX "" + XCODE_ATTRIBUTE_CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION YES + XCODE_ATTRIBUTE_GCC_WARN_SHADOW YES) -setup_plugin_target(mac-capture) +if(CMAKE_VERSION VERSION_LESS_EQUAL 3.25.0) + set_property(TARGET mac-capture PROPERTY XCODE_LINK_BUILD_PHASE_MODE BUILT_ONLY) +endif() diff --git a/plugins/mac-capture/cmake/legacy.cmake b/plugins/mac-capture/cmake/legacy.cmake new file mode 100644 index 000000000..764b3f297 --- /dev/null +++ b/plugins/mac-capture/cmake/legacy.cmake @@ -0,0 +1,38 @@ +project(mac-capture) + +find_library(COREAUDIO CoreAudio) +find_library(AUDIOUNIT AudioUnit) +find_library(COREFOUNDATION CoreFoundation) +find_library(IOSURF IOSurface) +find_library(COCOA Cocoa) +find_library(COREVIDEO CoreVideo) +find_library(COREMEDIA CoreMedia) +find_library(SCREENCAPTUREKIT ScreenCaptureKit) + +add_library(mac-capture MODULE) +add_library(OBS::capture ALIAS mac-capture) + +target_sources( + mac-capture + PRIVATE plugin-main.c + audio-device-enum.c + audio-device-enum.h + mac-audio.c + mac-display-capture.m + mac-screen-capture.m + mac-window-capture.m + window-utils.m + window-utils.h) + +target_link_libraries(mac-capture PRIVATE OBS::libobs ${COREAUDIO} ${AUDIOUNIT} ${COREFOUNDATION} ${IOSURF} ${COCOA}) + +if(SCREENCAPTUREKIT) + target_link_libraries(mac-capture PRIVATE OBS::libobs ${COREVIDEO} ${COREMEDIA}) + + target_link_options(mac-capture PRIVATE SHELL:-weak_framework ScreenCaptureKit) + target_link_options(libobs PRIVATE SHELL:-weak_framework ScreenCaptureKit) +endif() + +set_target_properties(mac-capture PROPERTIES FOLDER "plugins" PREFIX "") + +setup_plugin_target(mac-capture) diff --git a/plugins/mac-capture/cmake/macos/Info.plist.in b/plugins/mac-capture/cmake/macos/Info.plist.in new file mode 100644 index 000000000..79a87cb77 --- /dev/null +++ b/plugins/mac-capture/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + mac-capture + CFBundleIdentifier + com.obsproject.mac-capture + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + mac-capture + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/plugins/mac-syphon/CMakeLists.txt b/plugins/mac-syphon/CMakeLists.txt index c3a7d8819..173e2bef1 100644 --- a/plugins/mac-syphon/CMakeLists.txt +++ b/plugins/mac-syphon/CMakeLists.txt @@ -1,21 +1,24 @@ -project(mac-syphon) +cmake_minimum_required(VERSION 3.22...3.25) -find_package(OpenGL REQUIRED) +legacy_check() + +option(ENABLE_SYPHON "Enable Syphon sharing support" ON) +if(NOT ENABLE_SYPHON) + target_disable(mac-syphon) + target_disable_feature(mac-syphon "Syphon sharing support") + return() +else() + target_enable_feature(mac-syphon "Syphon sharing support") +endif() find_library(COCOA Cocoa) find_library(IOSURF IOSurface) find_library(SCRIPTINGBRIDGE ScriptingBridge) - mark_as_advanced(COCOA IOSURF SCRIPTINGBRIDGE) -add_library(mac-syphon MODULE) -add_library(OBS::syphon ALIAS mac-syphon) - -add_library(syphon-framework STATIC) +add_library(syphon-framework STATIC EXCLUDE_FROM_ALL ) add_library(Syphon::Framework ALIAS syphon-framework) -target_sources(mac-syphon PRIVATE syphon.m plugin-main.c) - target_sources( syphon-framework PRIVATE syphon-framework/Syphon_Prefix.pch @@ -58,29 +61,30 @@ target_sources( syphon-framework/SyphonServerDirectory.m syphon-framework/SyphonServerDirectory.h) -target_link_libraries(mac-syphon PRIVATE OBS::libobs Syphon::Framework - ${SCRIPTINGBRIDGE}) +target_compile_options( + syphon-framework + PRIVATE -include "${CMAKE_CURRENT_SOURCE_DIR}/syphon-framework/Syphon_Prefix.pch" -Wno-error=deprecated-declarations + PUBLIC -Wno-error=newline-eof -Wno-error=deprecated-implementations) + +target_compile_definitions(syphon-framework PUBLIC "SYPHON_UNIQUE_CLASS_NAME_PREFIX=OBS_") target_link_libraries(syphon-framework PUBLIC OpenGL::GL ${COCOA} ${IOSURF}) -target_compile_options( +set_target_properties(syphon-framework PROPERTIES FOLDER "plugins/mac-syphon" PREFIX "") + +add_library(mac-syphon MODULE) +add_library(OBS::syphon ALIAS mac-syphon) + +target_sources(mac-syphon PRIVATE syphon.m plugin-main.c) + +target_compile_options(mac-syphon PRIVATE -include "${CMAKE_CURRENT_SOURCE_DIR}/syphon-framework/Syphon_Prefix.pch" + -fobjc-arc) + +target_link_libraries(mac-syphon PRIVATE OBS::libobs Syphon::Framework ${SCRIPTINGBRIDGE}) + +set_target_properties_obs( mac-syphon - PRIVATE -include - ${CMAKE_CURRENT_SOURCE_DIR}/syphon-framework/Syphon_Prefix.pch - -fobjc-arc) - -target_compile_options( - syphon-framework - PRIVATE -include - ${CMAKE_CURRENT_SOURCE_DIR}/syphon-framework/Syphon_Prefix.pch - -Wno-deprecated-declarations) - -target_compile_definitions(syphon-framework - PUBLIC "SYPHON_UNIQUE_CLASS_NAME_PREFIX=OBS_") - -set_target_properties(mac-syphon PROPERTIES FOLDER "plugins" PREFIX "") - -set_target_properties(syphon-framework PROPERTIES FOLDER "plugins/mac-syphon" - PREFIX "") - -setup_plugin_target(mac-syphon) + PROPERTIES FOLDER "plugins" + PREFIX "" + XCODE_ATTRIBUTE_CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION YES + XCODE_ATTRIBUTE_GCC_WARN_SHADOW YES) diff --git a/plugins/mac-syphon/cmake/legacy.cmake b/plugins/mac-syphon/cmake/legacy.cmake new file mode 100644 index 000000000..b2fd1df81 --- /dev/null +++ b/plugins/mac-syphon/cmake/legacy.cmake @@ -0,0 +1,77 @@ +project(mac-syphon) + +find_package(OpenGL REQUIRED) + +find_library(COCOA Cocoa) +find_library(IOSURF IOSurface) +find_library(SCRIPTINGBRIDGE ScriptingBridge) + +mark_as_advanced(COCOA IOSURF SCRIPTINGBRIDGE) + +add_library(mac-syphon MODULE) +add_library(OBS::syphon ALIAS mac-syphon) + +add_library(syphon-framework STATIC) +add_library(Syphon::Framework ALIAS syphon-framework) + +target_sources(mac-syphon PRIVATE syphon.m plugin-main.c) + +target_sources( + syphon-framework + PRIVATE syphon-framework/Syphon_Prefix.pch + syphon-framework/Syphon.h + syphon-framework/SyphonBuildMacros.h + syphon-framework/SyphonCFMessageReceiver.m + syphon-framework/SyphonCFMessageReceiver.h + syphon-framework/SyphonCFMessageSender.h + syphon-framework/SyphonCFMessageSender.m + syphon-framework/SyphonClient.m + syphon-framework/SyphonClient.h + syphon-framework/SyphonClientConnectionManager.m + syphon-framework/SyphonClientConnectionManager.h + syphon-framework/SyphonDispatch.c + syphon-framework/SyphonDispatch.h + syphon-framework/SyphonIOSurfaceImage.m + syphon-framework/SyphonIOSurfaceImage.h + syphon-framework/SyphonImage.m + syphon-framework/SyphonImage.h + syphon-framework/SyphonMachMessageReceiver.m + syphon-framework/SyphonMachMessageReceiver.h + syphon-framework/SyphonMachMessageSender.m + syphon-framework/SyphonMachMessageSender.h + syphon-framework/SyphonMessageQueue.m + syphon-framework/SyphonMessageQueue.h + syphon-framework/SyphonMessageReceiver.m + syphon-framework/SyphonMessageReceiver.h + syphon-framework/SyphonMessageSender.m + syphon-framework/SyphonMessageSender.h + syphon-framework/SyphonMessaging.m + syphon-framework/SyphonMessaging.h + syphon-framework/SyphonOpenGLFunctions.c + syphon-framework/SyphonOpenGLFunctions.h + syphon-framework/SyphonPrivate.m + syphon-framework/SyphonPrivate.h + syphon-framework/SyphonServer.m + syphon-framework/SyphonServer.h + syphon-framework/SyphonServerConnectionManager.m + syphon-framework/SyphonServerConnectionManager.h + syphon-framework/SyphonServerDirectory.m + syphon-framework/SyphonServerDirectory.h) + +target_link_libraries(mac-syphon PRIVATE OBS::libobs Syphon::Framework ${SCRIPTINGBRIDGE}) + +target_link_libraries(syphon-framework PUBLIC OpenGL::GL ${COCOA} ${IOSURF}) + +target_compile_options(mac-syphon PRIVATE -include ${CMAKE_CURRENT_SOURCE_DIR}/syphon-framework/Syphon_Prefix.pch + -fobjc-arc) + +target_compile_options(syphon-framework PRIVATE -include ${CMAKE_CURRENT_SOURCE_DIR}/syphon-framework/Syphon_Prefix.pch + -Wno-deprecated-declarations) + +target_compile_definitions(syphon-framework PUBLIC "SYPHON_UNIQUE_CLASS_NAME_PREFIX=OBS_") + +set_target_properties(mac-syphon PROPERTIES FOLDER "plugins" PREFIX "") + +set_target_properties(syphon-framework PROPERTIES FOLDER "plugins/mac-syphon" PREFIX "") + +setup_plugin_target(mac-syphon) diff --git a/plugins/mac-syphon/cmake/macos/Info.plist.in b/plugins/mac-syphon/cmake/macos/Info.plist.in new file mode 100644 index 000000000..e5be1da2f --- /dev/null +++ b/plugins/mac-syphon/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + mac-syphon + CFBundleIdentifier + com.obsproject.mac-syphon + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + mac-syphon + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/plugins/mac-videotoolbox/CMakeLists.txt b/plugins/mac-videotoolbox/CMakeLists.txt index 1165dbddf..4deea8651 100644 --- a/plugins/mac-videotoolbox/CMakeLists.txt +++ b/plugins/mac-videotoolbox/CMakeLists.txt @@ -1,4 +1,6 @@ -project(mac-videotoolbox) +cmake_minimum_required(VERSION 3.22...3.25) + +legacy_check() find_library(AVFOUNDATION AVFoundation) find_library(COCOA Cocoa) @@ -7,8 +9,7 @@ find_library(COREVIDEO CoreVideo) find_library(VIDEOTOOLBOX VideoToolbox) find_library(COREMEDIA CoreMedia) -mark_as_advanced(AVFOUNDATION COCOA COREFOUNDATION COREVIDEO VIDEOTOOLBOX - COREMEDIA) +mark_as_advanced(AVFOUNDATION COCOA COREFOUNDATION COREVIDEO VIDEOTOOLBOX COREMEDIA) add_library(mac-videotoolbox MODULE) add_library(OBS::mac-videotoolbox ALIAS mac-videotoolbox) @@ -25,6 +26,9 @@ target_link_libraries( ${VIDEOTOOLBOX} ${COREMEDIA}) -set_target_properties(mac-videotoolbox PROPERTIES FOLDER "plugins" PREFIX "") - -setup_plugin_target(mac-videotoolbox) +set_target_properties_obs( + mac-videotoolbox + PROPERTIES FOLDER plugins + PREFIX "" + XCODE_ATTRIBUTE_CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION YES + XCODE_ATTRIBUTE_GCC_WARN_SHADOW YES) diff --git a/plugins/mac-videotoolbox/cmake/legacy.cmake b/plugins/mac-videotoolbox/cmake/legacy.cmake new file mode 100644 index 000000000..e7da86b4f --- /dev/null +++ b/plugins/mac-videotoolbox/cmake/legacy.cmake @@ -0,0 +1,29 @@ +project(mac-videotoolbox) + +find_library(AVFOUNDATION AVFoundation) +find_library(COCOA Cocoa) +find_library(COREFOUNDATION CoreFoundation) +find_library(COREVIDEO CoreVideo) +find_library(VIDEOTOOLBOX VideoToolbox) +find_library(COREMEDIA CoreMedia) + +mark_as_advanced(AVFOUNDATION COCOA COREFOUNDATION COREVIDEO VIDEOTOOLBOX COREMEDIA) + +add_library(mac-videotoolbox MODULE) +add_library(OBS::mac-videotoolbox ALIAS mac-videotoolbox) + +target_sources(mac-videotoolbox PRIVATE encoder.c) + +target_link_libraries( + mac-videotoolbox + PRIVATE OBS::libobs + ${AVFOUNDATION} + ${COCOA} + ${COREFOUNDATION} + ${COREVIDEO} + ${VIDEOTOOLBOX} + ${COREMEDIA}) + +set_target_properties(mac-videotoolbox PROPERTIES FOLDER "plugins" PREFIX "") + +setup_plugin_target(mac-videotoolbox) diff --git a/plugins/mac-videotoolbox/cmake/macos/Info.plist.in b/plugins/mac-videotoolbox/cmake/macos/Info.plist.in new file mode 100644 index 000000000..f317311a8 --- /dev/null +++ b/plugins/mac-videotoolbox/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + mac-videotoolbox + CFBundleIdentifier + com.obsproject.mac-videotoolbox + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + mac-videotoolbox + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/plugins/mac-virtualcam/CMakeLists.txt b/plugins/mac-virtualcam/CMakeLists.txt index 2ac3d6ddc..afc054724 100644 --- a/plugins/mac-virtualcam/CMakeLists.txt +++ b/plugins/mac-virtualcam/CMakeLists.txt @@ -1,9 +1,21 @@ +cmake_minimum_required(VERSION 3.22...3.25) + +legacy_check() + option(ENABLE_VIRTUALCAM "Build OBS Virtualcam" ON) if(NOT ENABLE_VIRTUALCAM) - obs_status(DISABLED "mac-virtualcam") + target_disable_feature(mac-virtualcam "macOS Virtual Camera support") return() endif() +target_enable_feature(mac-virtualcam "macOS Virtual Camera support") + +add_library(obs-mach-protocol INTERFACE EXCLUDE_FROM_ALL) +add_library(OBS::mach-protocol ALIAS obs-mach-protocol) + +target_sources(obs-mach-protocol INTERFACE src/common/MachProtocol.h src/common/data/placeholder.png) +target_include_directories(obs-mach-protocol INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/src/common") + add_subdirectory(src/obs-plugin) add_subdirectory(src/dal-plugin) diff --git a/plugins/mac-virtualcam/cmake/legacy.cmake b/plugins/mac-virtualcam/cmake/legacy.cmake new file mode 100644 index 000000000..2ac3d6ddc --- /dev/null +++ b/plugins/mac-virtualcam/cmake/legacy.cmake @@ -0,0 +1,9 @@ +option(ENABLE_VIRTUALCAM "Build OBS Virtualcam" ON) + +if(NOT ENABLE_VIRTUALCAM) + obs_status(DISABLED "mac-virtualcam") + return() +endif() + +add_subdirectory(src/obs-plugin) +add_subdirectory(src/dal-plugin) diff --git a/plugins/mac-virtualcam/src/common/data/placeholder.png b/plugins/mac-virtualcam/src/common/data/placeholder.png new file mode 100644 index 000000000..707213003 Binary files /dev/null and b/plugins/mac-virtualcam/src/common/data/placeholder.png differ diff --git a/plugins/mac-virtualcam/src/dal-plugin/CMakeLists.txt b/plugins/mac-virtualcam/src/dal-plugin/CMakeLists.txt index 655fbd76c..c6a68aa2b 100644 --- a/plugins/mac-virtualcam/src/dal-plugin/CMakeLists.txt +++ b/plugins/mac-virtualcam/src/dal-plugin/CMakeLists.txt @@ -1,18 +1,19 @@ -project(mac-dal-plugin) +cmake_minimum_required(VERSION 3.22...3.25) + +legacy_check() find_library(COCOA Cocoa) find_library(COREMEDIA CoreMedia) find_library(COREMEDIAIO CoreMediaIO) find_library(COREVIDEO CoreVideo) find_library(IOSURFACE IOSurface) - mark_as_advanced(COCOA COREMEDIA COREMEDIAIO COREVIDEO IOSURFACE) -add_library(mac-dal-plugin MODULE) -add_library(OBS::mac-dal-plugin ALIAS mac-dal-plugin) +add_library(obs-dal-plugin MODULE) +add_library(OBS::dal-plugin ALIAS obs-dal-plugin) target_sources( - mac-dal-plugin + obs-dal-plugin PRIVATE OBSDALPlugIn.mm OBSDALPlugIn.h OBSDALPlugInMain.mm @@ -29,39 +30,34 @@ target_sources( OBSDALStream.h CMSampleBufferUtils.h Defines.h - Logging.h - ${CMAKE_CURRENT_SOURCE_DIR}/../common/MachProtocol.h) + Logging.h) -target_include_directories( - mac-dal-plugin - PRIVATE "$/../common") +if(NOT XCODE) + target_compile_options(obs-dal-plugin PRIVATE -fobjc-arc -fobjc-weak) +endif() -target_compile_options(mac-dal-plugin PRIVATE -fobjc-arc -fobjc-weak) +set(_placeholder_location "${CMAKE_CURRENT_SOURCE_DIR}/../common/data/placeholder.png") -target_link_libraries( - mac-dal-plugin PRIVATE ${COCOA} ${COREMEDIA} ${COREMEDIAIO} ${COREVIDEO} - ${IOSURFACE}) +set_property(SOURCE "${_placeholder_location}" PROPERTY MACOSX_PACKAGE_LOCATION "Resources") +source_group("Resources" FILES "${_placeholder_location}") -set(MACOSX_PLUGIN_BUNDLE_TYPE "BNDL") -target_sources(mac-dal-plugin PRIVATE placeholder.png) -set_source_files_properties(placeholder.png PROPERTIES MACOSX_PACKAGE_LOCATION - "Resources") -source_group("Resources" FILES placeholder.png) +target_link_libraries(obs-dal-plugin PRIVATE OBS::mach-protocol ${COCOA} ${COREMEDIA} ${COREMEDIAIO} ${COREVIDEO} + ${IOSURFACE}) + +set_target_properties_obs( + obs-dal-plugin + PROPERTIES OUTPUT_NAME obs-mac-virtualcam + FOLDER plugins + PREFIX "") set_target_properties( - mac-dal-plugin + obs-dal-plugin PROPERTIES BUNDLE ON - BUNDLE_EXTENSION "plugin" - OUTPUT_NAME "obs-mac-virtualcam" - FOLDER "plugins" - VERSION "0" - SOVERSION "0" - # Force the DAL plugin to be built for arm64e as well. Note that - # we cannot build OBS for arm64e, since its libraries are not - # built for this architecture at the moment. + BUNDLE_EXTENSION plugin OSX_ARCHITECTURES "x86_64;arm64;arm64e" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../" - MACOSX_BUNDLE_INFO_PLIST - "${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/Virtualcam-Info.plist.in") - -setup_binary_target(mac-dal-plugin) + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos/Info.plist.in" + XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.obsproject.obs-mac-virtualcam + XCODE_ATTRIBUTE_CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION YES + XCODE_ATTRIBUTE_GCC_WARN_SHADOW YES) diff --git a/plugins/mac-virtualcam/src/dal-plugin/cmake/legacy.cmake b/plugins/mac-virtualcam/src/dal-plugin/cmake/legacy.cmake new file mode 100644 index 000000000..f96ca70dd --- /dev/null +++ b/plugins/mac-virtualcam/src/dal-plugin/cmake/legacy.cmake @@ -0,0 +1,61 @@ +project(mac-dal-plugin) + +find_library(COCOA Cocoa) +find_library(COREMEDIA CoreMedia) +find_library(COREMEDIAIO CoreMediaIO) +find_library(COREVIDEO CoreVideo) +find_library(IOSURFACE IOSurface) + +mark_as_advanced(COCOA COREMEDIA COREMEDIAIO COREVIDEO IOSURFACE) + +add_library(mac-dal-plugin MODULE) +add_library(OBS::mac-dal-plugin ALIAS mac-dal-plugin) + +target_sources( + mac-dal-plugin + PRIVATE OBSDALPlugIn.mm + OBSDALPlugIn.h + OBSDALPlugInMain.mm + OBSDALPlugInInterface.mm + OBSDALPlugInInterface.h + OBSDALObjectStore.mm + OBSDALObjectStore.h + OBSDALDevice.mm + OBSDALDevice.h + OBSDALMachClient.mm + OBSDALMachClient.h + CMSampleBufferUtils.mm + OBSDALStream.mm + OBSDALStream.h + CMSampleBufferUtils.h + Defines.h + Logging.h + ${CMAKE_CURRENT_SOURCE_DIR}/../common/MachProtocol.h) + +target_include_directories(mac-dal-plugin PRIVATE "$/../common") + +target_compile_options(mac-dal-plugin PRIVATE -fobjc-arc -fobjc-weak) + +target_link_libraries(mac-dal-plugin PRIVATE ${COCOA} ${COREMEDIA} ${COREMEDIAIO} ${COREVIDEO} ${IOSURFACE}) + +set(MACOSX_PLUGIN_BUNDLE_TYPE "BNDL") +target_sources(mac-dal-plugin PRIVATE placeholder.png) +set_source_files_properties(placeholder.png PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") +source_group("Resources" FILES placeholder.png) + +set_target_properties( + mac-dal-plugin + PROPERTIES BUNDLE ON + BUNDLE_EXTENSION "plugin" + OUTPUT_NAME "obs-mac-virtualcam" + FOLDER "plugins" + VERSION "0" + SOVERSION "0" + # Force the DAL plugin to be built for arm64e as well. Note that + # we cannot build OBS for arm64e, since its libraries are not + # built for this architecture at the moment. + OSX_ARCHITECTURES "x86_64;arm64;arm64e" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../" + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/Virtualcam-Info.plist.in") + +setup_binary_target(mac-dal-plugin) diff --git a/plugins/mac-virtualcam/src/dal-plugin/cmake/macos/Info.plist.in b/plugins/mac-virtualcam/src/dal-plugin/cmake/macos/Info.plist.in new file mode 100644 index 000000000..181549079 --- /dev/null +++ b/plugins/mac-virtualcam/src/dal-plugin/cmake/macos/Info.plist.in @@ -0,0 +1,44 @@ + + + + + CFBundleName + obs-mac-virtualcam + CFBundleIdentifier + com.obsproject.obs-mac-virtualcam + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleExecutable + obs-mac-virtualcam + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + CFPlugInFactories + + 7E950B8C-5E49-4B9E-B7D0-B3608A08E8F6 + PlugInMain + + CFPlugInTypes + + 30010C1C-93BF-11D8-8B5B-000A95AF9C6A + + 7E950B8C-5E49-4B9E-B7D0-B3608A08E8F6 + + + CMIOHardwareAssistantServiceNames + + com.obsproject.obs-mac-virtualcam.server + + + diff --git a/plugins/mac-virtualcam/src/obs-plugin/CMakeLists.txt b/plugins/mac-virtualcam/src/obs-plugin/CMakeLists.txt index 3818c5a55..c0279097b 100644 --- a/plugins/mac-virtualcam/src/obs-plugin/CMakeLists.txt +++ b/plugins/mac-virtualcam/src/obs-plugin/CMakeLists.txt @@ -1,35 +1,29 @@ -project(mac-virtualcam) +cmake_minimum_required(VERSION 3.22...3.25) + +legacy_check() find_library(APPKIT AppKit) find_library(COREVIDEO CoreVideo) find_library(IOSURFACE IOSurface) - mark_as_advanced(APPKIT COREVIDEO IOSURFACE) add_library(mac-virtualcam MODULE) add_library(OBS::virtualcam ALIAS mac-virtualcam) -target_sources( - mac-virtualcam PRIVATE Defines.h plugin-main.mm OBSDALMachServer.mm - OBSDALMachServer.h ../common/MachProtocol.h) +target_sources(mac-virtualcam PRIVATE Defines.h plugin-main.mm OBSDALMachServer.mm OBSDALMachServer.h) +target_compile_features(mac-virtualcam PRIVATE cxx_deleted_functions cxx_rvalue_references cxx_std_17) +if(NOT XCODE) + target_compile_options(mac-virtualcam PRIVATE -fobjc-arc -fobjc-weak) +endif() -target_include_directories( +target_link_libraries(mac-virtualcam PRIVATE OBS::mach-protocol OBS::libobs OBS::frontend-api ${APPKIT} ${COREVIDEO} + ${IOSURFACE}) + +set_target_properties_obs( mac-virtualcam - PRIVATE "$/../common") - -target_link_libraries( - mac-virtualcam PRIVATE OBS::libobs OBS::frontend-api ${APPKIT} ${COREVIDEO} - ${IOSURFACE}) - -target_compile_features(mac-virtualcam PRIVATE cxx_deleted_functions - cxx_rvalue_references cxx_std_17) - -target_compile_options(mac-virtualcam PRIVATE -fobjc-arc -fobjc-weak) - -set_target_properties( - mac-virtualcam - PROPERTIES FOLDER "plugins" + PROPERTIES FOLDER plugins PREFIX "" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../") - -setup_plugin_target(mac-virtualcam) + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../" + XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES + XCODE_ATTRIBUTE_CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION YES + XCODE_ATTRIBUTE_GCC_WARN_SHADOW YES) diff --git a/plugins/mac-virtualcam/src/obs-plugin/cmake/legacy.cmake b/plugins/mac-virtualcam/src/obs-plugin/cmake/legacy.cmake new file mode 100644 index 000000000..3f574ce1e --- /dev/null +++ b/plugins/mac-virtualcam/src/obs-plugin/cmake/legacy.cmake @@ -0,0 +1,29 @@ +project(mac-virtualcam) + +find_library(APPKIT AppKit) +find_library(COREVIDEO CoreVideo) +find_library(IOSURFACE IOSurface) + +mark_as_advanced(APPKIT COREVIDEO IOSURFACE) + +add_library(mac-virtualcam MODULE) +add_library(OBS::virtualcam ALIAS mac-virtualcam) + +target_sources(mac-virtualcam PRIVATE Defines.h plugin-main.mm OBSDALMachServer.mm OBSDALMachServer.h + ../common/MachProtocol.h) + +target_include_directories(mac-virtualcam PRIVATE "$/../common") + +target_link_libraries(mac-virtualcam PRIVATE OBS::libobs OBS::frontend-api ${APPKIT} ${COREVIDEO} ${IOSURFACE}) + +target_compile_features(mac-virtualcam PRIVATE cxx_deleted_functions cxx_rvalue_references cxx_std_17) + +target_compile_options(mac-virtualcam PRIVATE -fobjc-arc -fobjc-weak) + +set_target_properties( + mac-virtualcam + PROPERTIES FOLDER "plugins" + PREFIX "" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../") + +setup_plugin_target(mac-virtualcam) diff --git a/plugins/mac-virtualcam/src/obs-plugin/cmake/macos/Info.plist.in b/plugins/mac-virtualcam/src/obs-plugin/cmake/macos/Info.plist.in new file mode 100644 index 000000000..1e60ecb8c --- /dev/null +++ b/plugins/mac-virtualcam/src/obs-plugin/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + mac-virtualcam + CFBundleIdentifier + com.obsproject.mac-virtualcam + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + mac-virtualcam + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/plugins/obs-ffmpeg/CMakeLists.txt b/plugins/obs-ffmpeg/CMakeLists.txt index 04dc78a74..31ddfba7c 100644 --- a/plugins/obs-ffmpeg/CMakeLists.txt +++ b/plugins/obs-ffmpeg/CMakeLists.txt @@ -1,4 +1,6 @@ -project(obs-ffmpeg) +cmake_minimum_required(VERSION 3.16...3.25) + +legacy_check() option(ENABLE_FFMPEG_LOGGING "Enables obs-ffmpeg logging" OFF) option(ENABLE_NEW_MPEGTS_OUTPUT "Use native SRT/RIST mpegts output" ON) @@ -13,34 +15,18 @@ find_package( avformat swresample) +if(NOT TARGET OBS::media-playback) + add_subdirectory("${CMAKE_SOURCE_DIR}/deps/media-playback" "${CMAKE_BINARY_DIR}/deps/media-playback") +endif() + +if(NOT TARGET OBS::opts-parser) + add_subdirectory("${CMAKE_SOURCE_DIR}/deps/opts-parser" "${CMAKE_BINARY_DIR}/deps/opts-parser") +endif() + add_library(obs-ffmpeg MODULE) add_library(OBS::ffmpeg ALIAS obs-ffmpeg) add_subdirectory(ffmpeg-mux) -if(ENABLE_NEW_MPEGTS_OUTPUT) - find_package(Librist QUIET) - find_package(Libsrt QUIET) - - if(NOT TARGET Librist::Librist AND NOT TARGET Libsrt::Libsrt) - obs_status( - FATAL_ERROR - "SRT and RIST libraries not found! Please install SRT and RIST libraries or set ENABLE_NEW_MPEGTS_OUTPUT=OFF." - ) - elseif(NOT TARGET Libsrt::Libsrt) - obs_status( - FATAL_ERROR - "SRT library not found! Please install SRT library or set ENABLE_NEW_MPEGTS_OUTPUT=OFF." - ) - elseif(NOT TARGET Librist::Librist) - obs_status( - FATAL_ERROR - "RIST library not found! Please install RIST library or set ENABLE_NEW_MPEGTS_OUTPUT=OFF." - ) - endif() -endif() - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/obs-ffmpeg-config.h.in - ${CMAKE_BINARY_DIR}/config/obs-ffmpeg-config.h) target_sources( obs-ffmpeg @@ -56,9 +42,8 @@ target_sources( obs-ffmpeg-source.c obs-ffmpeg-compat.h obs-ffmpeg-formats.h - ${CMAKE_BINARY_DIR}/config/obs-ffmpeg-config.h) - -target_include_directories(obs-ffmpeg PRIVATE ${CMAKE_BINARY_DIR}/config) + $<$:obs-ffmpeg-logging.c>) +target_compile_definitions(obs-ffmpeg PRIVATE $<$:ENABLE_FFMPEG_LOGGING>) target_link_libraries( obs-ffmpeg @@ -74,38 +59,45 @@ target_link_libraries( FFmpeg::swresample) if(ENABLE_NEW_MPEGTS_OUTPUT) - target_sources(obs-ffmpeg PRIVATE obs-ffmpeg-mpegts.c obs-ffmpeg-srt.h - obs-ffmpeg-rist.h obs-ffmpeg-url.h) + find_package(Librist QUIET) + find_package(Libsrt QUIET) - target_link_libraries(obs-ffmpeg PRIVATE Librist::Librist Libsrt::Libsrt) - if(OS_WINDOWS) - target_link_libraries(obs-ffmpeg PRIVATE ws2_32.lib) + foreach(_output_lib IN ITEMS Librist Libsrt) + if(NOT TARGET ${_output_lib}::${_output_lib}) + list(APPEND _error_messages "MPEGTS output library ${_output_lib} not found.") + endif() + endforeach() + + if(_error_messages) + list(JOIN "\n" _error_string _error_string) + message( + FATAL_ERROR + "${_error_string}\n Disable this error by setting ENABLE_NEW_MPEGTS_OUTPUT to OFF or providing the build system with required SRT and Rist libraries." + ) endif() + + target_sources(obs-ffmpeg PRIVATE obs-ffmpeg-mpegts.c obs-ffmpeg-srt.h obs-ffmpeg-rist.h obs-ffmpeg-url.h) + target_link_libraries(obs-ffmpeg PRIVATE Librist::Librist Libsrt::Libsrt) target_compile_definitions(obs-ffmpeg PRIVATE NEW_MPEGTS_OUTPUT) endif() -if(ENABLE_FFMPEG_LOGGING) - target_sources(obs-ffmpeg PRIVATE obs-ffmpeg-logging.c) -endif() - -set_target_properties(obs-ffmpeg PROPERTIES FOLDER "plugins/obs-ffmpeg" PREFIX - "") - if(OS_WINDOWS) find_package(AMF 1.4.29 REQUIRED) + add_library(nvenc-headers INTERFACE EXCLUDE_FROM_ALL) + add_library(OBS::nvenc-headers ALIAS nvenc-headers) + + target_sources(nvenc-headers INTERFACE external/nvEncodeAPI.h jim-nvenc-ver.h) + + target_include_directories(nvenc-headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}/external") + add_subdirectory(obs-amf-test) add_subdirectory(obs-nvenc-test) - if(MSVC) - target_link_libraries(obs-ffmpeg PRIVATE OBS::w32-pthreads) - endif() - target_link_libraries(obs-ffmpeg PRIVATE AMF::AMF) - - set(MODULE_DESCRIPTION "OBS FFmpeg module") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - obs-ffmpeg.rc) + target_link_libraries(obs-ffmpeg PRIVATE OBS::w32-pthreads AMF::AMF ws2_32) + configure_file(cmake/windows/obs-module.rc.in obs-ffmpeg.rc) target_sources( obs-ffmpeg PRIVATE texture-amf.cpp @@ -115,13 +107,12 @@ if(OS_WINDOWS) jim-nvenc-helpers.c jim-nvenc-ver.h obs-ffmpeg.rc) - -elseif(OS_POSIX AND NOT OS_MACOS) +elseif(OS_LINUX OR OS_FREEBSD) find_package(Libva REQUIRED) find_package(Libpci REQUIRED) - target_sources(obs-ffmpeg PRIVATE obs-ffmpeg-vaapi.c vaapi-utils.c - vaapi-utils.h) - target_link_libraries(obs-ffmpeg PRIVATE Libva::va Libva::drm LIBPCI::LIBPCI) + + target_sources(obs-ffmpeg PRIVATE obs-ffmpeg-vaapi.c vaapi-utils.c vaapi-utils.h) + target_link_libraries(obs-ffmpeg PRIVATE Libva::va Libva::drm Libpci::pci) endif() -setup_plugin_target(obs-ffmpeg) +set_target_properties_obs(obs-ffmpeg PROPERTIES FOLDER plugins/obs-ffmpeg PREFIX "") diff --git a/plugins/obs-ffmpeg/cmake/legacy.cmake b/plugins/obs-ffmpeg/cmake/legacy.cmake new file mode 100644 index 000000000..5540676ea --- /dev/null +++ b/plugins/obs-ffmpeg/cmake/legacy.cmake @@ -0,0 +1,115 @@ +project(obs-ffmpeg) + +option(ENABLE_FFMPEG_LOGGING "Enables obs-ffmpeg logging" OFF) +option(ENABLE_NEW_MPEGTS_OUTPUT "Use native SRT/RIST mpegts output" ON) + +find_package( + FFmpeg REQUIRED + COMPONENTS avcodec + avfilter + avdevice + avutil + swscale + avformat + swresample) + +add_library(obs-ffmpeg MODULE) +add_library(OBS::ffmpeg ALIAS obs-ffmpeg) + +add_subdirectory(ffmpeg-mux) +if(ENABLE_NEW_MPEGTS_OUTPUT) + find_package(Librist QUIET) + find_package(Libsrt QUIET) + + if(NOT TARGET Librist::Librist AND NOT TARGET Libsrt::Libsrt) + obs_status( + FATAL_ERROR + "SRT and RIST libraries not found! Please install SRT and RIST libraries or set ENABLE_NEW_MPEGTS_OUTPUT=OFF.") + elseif(NOT TARGET Libsrt::Libsrt) + obs_status(FATAL_ERROR "SRT library not found! Please install SRT library or set ENABLE_NEW_MPEGTS_OUTPUT=OFF.") + elseif(NOT TARGET Librist::Librist) + obs_status(FATAL_ERROR "RIST library not found! Please install RIST library or set ENABLE_NEW_MPEGTS_OUTPUT=OFF.") + endif() +endif() + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/obs-ffmpeg-config.h.in ${CMAKE_BINARY_DIR}/config/obs-ffmpeg-config.h) + +target_sources( + obs-ffmpeg + PRIVATE obs-ffmpeg.c + obs-ffmpeg-video-encoders.c + obs-ffmpeg-audio-encoders.c + obs-ffmpeg-av1.c + obs-ffmpeg-nvenc.c + obs-ffmpeg-output.c + obs-ffmpeg-mux.c + obs-ffmpeg-mux.h + obs-ffmpeg-hls-mux.c + obs-ffmpeg-source.c + obs-ffmpeg-compat.h + obs-ffmpeg-formats.h + ${CMAKE_BINARY_DIR}/config/obs-ffmpeg-config.h) + +target_include_directories(obs-ffmpeg PRIVATE ${CMAKE_BINARY_DIR}/config) + +target_link_libraries( + obs-ffmpeg + PRIVATE OBS::libobs + OBS::media-playback + OBS::opts-parser + FFmpeg::avcodec + FFmpeg::avfilter + FFmpeg::avformat + FFmpeg::avdevice + FFmpeg::avutil + FFmpeg::swscale + FFmpeg::swresample) + +if(ENABLE_NEW_MPEGTS_OUTPUT) + target_sources(obs-ffmpeg PRIVATE obs-ffmpeg-mpegts.c obs-ffmpeg-srt.h obs-ffmpeg-rist.h obs-ffmpeg-url.h) + + target_link_libraries(obs-ffmpeg PRIVATE Librist::Librist Libsrt::Libsrt) + if(OS_WINDOWS) + target_link_libraries(obs-ffmpeg PRIVATE ws2_32.lib) + endif() + target_compile_definitions(obs-ffmpeg PRIVATE NEW_MPEGTS_OUTPUT) +endif() + +if(ENABLE_FFMPEG_LOGGING) + target_sources(obs-ffmpeg PRIVATE obs-ffmpeg-logging.c) +endif() + +set_target_properties(obs-ffmpeg PROPERTIES FOLDER "plugins/obs-ffmpeg" PREFIX "") + +if(OS_WINDOWS) + find_package(AMF 1.4.29 REQUIRED) + + add_subdirectory(obs-amf-test) + add_subdirectory(obs-nvenc-test) + + if(MSVC) + target_link_libraries(obs-ffmpeg PRIVATE OBS::w32-pthreads) + endif() + target_link_libraries(obs-ffmpeg PRIVATE AMF::AMF) + + set(MODULE_DESCRIPTION "OBS FFmpeg module") + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in obs-ffmpeg.rc) + + target_sources( + obs-ffmpeg + PRIVATE texture-amf.cpp + texture-amf-opts.hpp + jim-nvenc.c + jim-nvenc.h + jim-nvenc-helpers.c + jim-nvenc-ver.h + obs-ffmpeg.rc) + +elseif(OS_POSIX AND NOT OS_MACOS) + find_package(Libva REQUIRED) + find_package(Libpci REQUIRED) + target_sources(obs-ffmpeg PRIVATE obs-ffmpeg-vaapi.c vaapi-utils.c vaapi-utils.h) + target_link_libraries(obs-ffmpeg PRIVATE Libva::va Libva::drm LIBPCI::LIBPCI) +endif() + +setup_plugin_target(obs-ffmpeg) diff --git a/plugins/obs-ffmpeg/cmake/macos/Info.plist.in b/plugins/obs-ffmpeg/cmake/macos/Info.plist.in new file mode 100644 index 000000000..068ccaf07 --- /dev/null +++ b/plugins/obs-ffmpeg/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + obs-ffmpeg + CFBundleIdentifier + com.obsproject.obs-ffmpeg + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + obs-ffmpeg + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/plugins/obs-ffmpeg/cmake/windows/obs-module.rc.in b/plugins/obs-ffmpeg/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..3acd9e1e0 --- /dev/null +++ b/plugins/obs-ffmpeg/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS FFmpeg module" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "obs-ffmpeg" + VALUE "OriginalFilename", "obs-ffmpeg" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/plugins/obs-ffmpeg/ffmpeg-mux/CMakeLists.txt b/plugins/obs-ffmpeg/ffmpeg-mux/CMakeLists.txt index a86c79dec..f57a9791b 100644 --- a/plugins/obs-ffmpeg/ffmpeg-mux/CMakeLists.txt +++ b/plugins/obs-ffmpeg/ffmpeg-mux/CMakeLists.txt @@ -1,4 +1,6 @@ -project(obs-ffmpeg-mux) +cmake_minimum_required(VERSION 3.16...3.25) + +legacy_check() option(ENABLE_FFMPEG_MUX_DEBUG "Enable FFmpeg-mux debugging" OFF) @@ -9,16 +11,9 @@ add_executable(OBS::ffmpeg-mux ALIAS obs-ffmpeg-mux) target_sources(obs-ffmpeg-mux PRIVATE ffmpeg-mux.c ffmpeg-mux.h) -target_link_libraries(obs-ffmpeg-mux PRIVATE OBS::libobs FFmpeg::avcodec - FFmpeg::avutil FFmpeg::avformat) -if(OS_WINDOWS) - target_link_libraries(obs-ffmpeg-mux PRIVATE OBS::w32-pthreads) -endif() +target_link_libraries(obs-ffmpeg-mux PRIVATE OBS::libobs FFmpeg::avcodec FFmpeg::avutil FFmpeg::avformat + $<$:OBS::w32-pthreads>) -if(ENABLE_FFMPEG_MUX_DEBUG) - target_compile_definitions(obs-ffmpeg-mux PRIVATE ENABLE_FFMPEG_MUX_DEBUG) -endif() +target_compile_definitions(obs-ffmpeg-mux PRIVATE $<$:ENABLE_FFMPEG_MUX_DEBUG>) -set_target_properties(obs-ffmpeg-mux PROPERTIES FOLDER "plugins/obs-ffmpeg") - -setup_binary_target(obs-ffmpeg-mux) +set_target_properties_obs(obs-ffmpeg-mux PROPERTIES FOLDER plugins/obs-ffmpeg) diff --git a/plugins/obs-ffmpeg/ffmpeg-mux/cmake/legacy.cmake b/plugins/obs-ffmpeg/ffmpeg-mux/cmake/legacy.cmake new file mode 100644 index 000000000..469f57525 --- /dev/null +++ b/plugins/obs-ffmpeg/ffmpeg-mux/cmake/legacy.cmake @@ -0,0 +1,23 @@ +project(obs-ffmpeg-mux) + +option(ENABLE_FFMPEG_MUX_DEBUG "Enable FFmpeg-mux debugging" OFF) + +find_package(FFmpeg REQUIRED COMPONENTS avcodec avutil avformat) + +add_executable(obs-ffmpeg-mux) +add_executable(OBS::ffmpeg-mux ALIAS obs-ffmpeg-mux) + +target_sources(obs-ffmpeg-mux PRIVATE ffmpeg-mux.c ffmpeg-mux.h) + +target_link_libraries(obs-ffmpeg-mux PRIVATE OBS::libobs FFmpeg::avcodec FFmpeg::avutil FFmpeg::avformat) +if(OS_WINDOWS) + target_link_libraries(obs-ffmpeg-mux PRIVATE OBS::w32-pthreads) +endif() + +if(ENABLE_FFMPEG_MUX_DEBUG) + target_compile_definitions(obs-ffmpeg-mux PRIVATE ENABLE_FFMPEG_MUX_DEBUG) +endif() + +set_target_properties(obs-ffmpeg-mux PROPERTIES FOLDER "plugins/obs-ffmpeg") + +setup_binary_target(obs-ffmpeg-mux) diff --git a/plugins/obs-ffmpeg/obs-ffmpeg.c b/plugins/obs-ffmpeg/obs-ffmpeg.c index b64d648f2..da0b2c2b4 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg.c +++ b/plugins/obs-ffmpeg/obs-ffmpeg.c @@ -5,8 +5,6 @@ #include #include -#include "obs-ffmpeg-config.h" - #ifdef _WIN32 #include #include diff --git a/plugins/obs-ffmpeg/texture-amf.cpp b/plugins/obs-ffmpeg/texture-amf.cpp index 28094b1d8..e7d8e7750 100644 --- a/plugins/obs-ffmpeg/texture-amf.cpp +++ b/plugins/obs-ffmpeg/texture-amf.cpp @@ -3,8 +3,6 @@ #include #include -#include "obs-ffmpeg-config.h" - #include #include #include diff --git a/plugins/obs-filters/CMakeLists.txt b/plugins/obs-filters/CMakeLists.txt index 9e1bfac6f..1e7f47efb 100644 --- a/plugins/obs-filters/CMakeLists.txt +++ b/plugins/obs-filters/CMakeLists.txt @@ -1,125 +1,10 @@ -project(obs-filters) +cmake_minimum_required(VERSION 3.16...3.25) -option(ENABLE_SPEEXDSP - "Enable building with SpeexDSP-based noise suppression filter" ON) -option(ENABLE_RNNOISE "Enable building with RNNoise noise supression filter" ON) - -if(OS_WINDOWS) - option( - ENABLE_NVAFX - "Enable building with NVIDIA Audio Effects SDK (requires redistributable to be installed)" - ON) - option( - ENABLE_NVVFX - "Enable building with NVIDIA Video Effects SDK (requires redistributable to be installed)" - ON) -endif() +legacy_check() add_library(obs-filters MODULE) add_library(OBS::filters ALIAS obs-filters) -set(HAS_NOISEREDUCTION OFF) - -if(NOT ENABLE_SPEEXDSP) - obs_status(DISABLED "SpeexDSP") -else() - find_package(Libspeexdsp REQUIRED) - - target_sources(obs-filters PRIVATE noise-suppress-filter.c) - - target_link_libraries(obs-filters PRIVATE LibspeexDSP::LibspeexDSP) - - target_compile_definitions(obs-filters PRIVATE LIBSPEEXDSP_ENABLED) - - if(OS_WINDOWS) - target_link_options(obs-filters PRIVATE "LINKER:/LTCG" - "LINKER:/IGNORE:4098" "LINKER:/IGNORE:4099") - endif() -endif() - -if(NOT ENABLE_RNNOISE) - obs_status(DISABLED "SpeexDSP") -else() - find_package(Librnnoise QUIET) - - if(NOT TARGET Librnnoise::Librnnoise) - obs_status(STATUS "obs-filters -> using bundled RNNoise library") - add_library(obs-rnnoise INTERFACE) - add_library(Librnnoise::Librnnoise ALIAS obs-rnnoise) - - set(_RNNOISE_SOURCES - rnnoise/src/arch.h - rnnoise/src/celt_lpc.c - rnnoise/src/celt_lpc.h - rnnoise/src/common.h - rnnoise/src/denoise.c - rnnoise/src/kiss_fft.c - rnnoise/src/kiss_fft.h - rnnoise/src/opus_types.h - rnnoise/src/pitch.c - rnnoise/src/pitch.h - rnnoise/src/rnn_data.c - rnnoise/src/rnn_data.h - rnnoise/src/rnn_reader.c - rnnoise/src/rnn.c - rnnoise/src/rnn.h - rnnoise/src/tansig_table.h - rnnoise/src/_kiss_fft_guts.h - rnnoise/include/rnnoise.h) - - target_sources(obs-rnnoise INTERFACE ${_RNNOISE_SOURCES}) - - target_include_directories( - obs-rnnoise INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/rnnoise/include") - - target_compile_definitions(obs-rnnoise INTERFACE COMPILE_OPUS) - - target_compile_options( - obs-rnnoise - INTERFACE - "$<$:-Wno-null-dereference>") - - if(OS_LINUX) - set_property(SOURCE ${_RNNOISE_SOURCES} PROPERTY COMPILE_FLAGS - -fvisibility=hidden) - endif() - - source_group("rnnoise" FILES ${_RNNOISE_SOURCES}) - endif() - - target_sources(obs-filters PRIVATE noise-suppress-filter.c) - - target_link_libraries(obs-filters PRIVATE Librnnoise::Librnnoise) - - target_compile_definitions(obs-filters PRIVATE LIBRNNOISE_ENABLED) -endif() - -if(NOT ENABLE_NVAFX) - obs_status(DISABLED "NVIDIA Audio FX support") - set(LIBNVAFX_FOUND OFF) -else() - obs_status(ENABLED "NVIDIA Audio FX support") - - target_compile_definitions(obs-filters PRIVATE LIBNVAFX_ENABLED) - - set(LIBNVAFX_FOUND ON) -endif() - -if(NOT ENABLE_NVVFX) - obs_status(DISABLED "NVIDIA Video FX support") - set(LIBNVVFX_FOUND OFF) -else() - obs_status(ENABLED "NVIDIA Video FX support") - set(LIBNVVFX_FOUND ON) - target_compile_definitions(obs-filters PRIVATE LIBNVVFX_ENABLED) -endif() - -if(TARGET Librnnoise::Librnnoise - OR TARGET LibspeexDSP::LibspeexDSP - OR LIBNVAFX_FOUND) - target_compile_definitions(obs-filters PRIVATE HAS_NOISEREDUCTION) -endif() - target_sources( obs-filters PRIVATE obs-filters.c @@ -144,63 +29,17 @@ target_sources( expander-filter.c luma-key-filter.c) -if(NOT OS_MACOS) - target_sources( - obs-filters - PRIVATE data/blend_add_filter.effect - data/blend_mul_filter.effect - data/blend_sub_filter.effect - data/chroma_key_filter.effect - data/chroma_key_filter_v2.effect - data/color.effect - data/color_correction_filter.effect - data/color_grade_filter.effect - data/color_key_filter.effect - data/color_key_filter_v2.effect - data/crop_filter.effect - data/hdr_tonemap_filter.effect - data/luma_key_filter.effect - data/luma_key_filter_v2.effect - data/mask_alpha_filter.effect - data/mask_color_filter.effect - data/sharpness.effect - data/rtx_greenscreen.effect) - - get_target_property(_SOURCES obs-filters SOURCES) - set(_FILTERS ${_SOURCES}) - list(FILTER _FILTERS INCLUDE REGEX ".*\\.effect") - - source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}" - PREFIX "Effect Files" - FILES ${_FILTERS}) -endif() - -if(LIBNVVFX_FOUND) - target_sources(obs-filters PRIVATE nvidia-greenscreen-filter.c) - obs_status( - STATUS - "NVIDIA Video FX support enabled; requires redist to be installed by end-user" - ) -endif() - -target_include_directories( - obs-filters PRIVATE $) - target_link_libraries(obs-filters PRIVATE OBS::libobs) -set_target_properties(obs-filters PROPERTIES FOLDER "plugins" PREFIX "") +include(cmake/speexdsp.cmake) +include(cmake/rnnoise.cmake) +include(cmake/nvidia.cmake) if(OS_WINDOWS) - if(MSVC) - target_link_libraries(obs-filters PRIVATE OBS::w32-pthreads) - endif() - - set(MODULE_DESCRIPTION "OBS A/V Filters") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - obs-filters.rc) + target_link_libraries(obs-filters PRIVATE OBS::w32-pthreads) + configure_file(cmake/windows/obs-module.rc.in obs-filters.rc) target_sources(obs-filters PRIVATE obs-filters.rc) endif() -setup_plugin_target(obs-filters) +set_target_properties_obs(obs-filters PROPERTIES FOLDER plugins PREFIX "") diff --git a/plugins/obs-filters/cmake/legacy.cmake b/plugins/obs-filters/cmake/legacy.cmake new file mode 100644 index 000000000..8c408dd29 --- /dev/null +++ b/plugins/obs-filters/cmake/legacy.cmake @@ -0,0 +1,188 @@ +project(obs-filters) + +option(ENABLE_SPEEXDSP "Enable building with SpeexDSP-based noise suppression filter" ON) +option(ENABLE_RNNOISE "Enable building with RNNoise noise supression filter" ON) + +if(OS_WINDOWS) + option(ENABLE_NVAFX "Enable building with NVIDIA Audio Effects SDK (requires redistributable to be installed)" ON) + option(ENABLE_NVVFX "Enable building with NVIDIA Video Effects SDK (requires redistributable to be installed)" ON) +endif() + +add_library(obs-filters MODULE) +add_library(OBS::filters ALIAS obs-filters) + +set(HAS_NOISEREDUCTION OFF) + +if(NOT ENABLE_SPEEXDSP) + obs_status(DISABLED "SpeexDSP") +else() + find_package(Libspeexdsp REQUIRED) + + target_sources(obs-filters PRIVATE noise-suppress-filter.c) + + target_link_libraries(obs-filters PRIVATE LibspeexDSP::LibspeexDSP) + + target_compile_definitions(obs-filters PRIVATE LIBSPEEXDSP_ENABLED) + + if(OS_WINDOWS) + target_link_options(obs-filters PRIVATE "LINKER:/LTCG" "LINKER:/IGNORE:4098" "LINKER:/IGNORE:4099") + endif() +endif() + +if(NOT ENABLE_RNNOISE) + obs_status(DISABLED "SpeexDSP") +else() + find_package(Librnnoise QUIET) + + if(NOT TARGET Librnnoise::Librnnoise) + obs_status(STATUS "obs-filters -> using bundled RNNoise library") + add_library(obs-rnnoise INTERFACE) + add_library(Librnnoise::Librnnoise ALIAS obs-rnnoise) + + set(_RNNOISE_SOURCES + rnnoise/src/arch.h + rnnoise/src/celt_lpc.c + rnnoise/src/celt_lpc.h + rnnoise/src/common.h + rnnoise/src/denoise.c + rnnoise/src/kiss_fft.c + rnnoise/src/kiss_fft.h + rnnoise/src/opus_types.h + rnnoise/src/pitch.c + rnnoise/src/pitch.h + rnnoise/src/rnn_data.c + rnnoise/src/rnn_data.h + rnnoise/src/rnn_reader.c + rnnoise/src/rnn.c + rnnoise/src/rnn.h + rnnoise/src/tansig_table.h + rnnoise/src/_kiss_fft_guts.h + rnnoise/include/rnnoise.h) + + target_sources(obs-rnnoise INTERFACE ${_RNNOISE_SOURCES}) + + target_include_directories(obs-rnnoise INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/rnnoise/include") + + target_compile_definitions(obs-rnnoise INTERFACE COMPILE_OPUS) + + target_compile_options(obs-rnnoise INTERFACE "$<$:-Wno-null-dereference>") + + if(OS_LINUX) + set_property(SOURCE ${_RNNOISE_SOURCES} PROPERTY COMPILE_FLAGS -fvisibility=hidden) + endif() + + source_group("rnnoise" FILES ${_RNNOISE_SOURCES}) + endif() + + target_sources(obs-filters PRIVATE noise-suppress-filter.c) + + target_link_libraries(obs-filters PRIVATE Librnnoise::Librnnoise) + + target_compile_definitions(obs-filters PRIVATE LIBRNNOISE_ENABLED) +endif() + +if(NOT ENABLE_NVAFX) + obs_status(DISABLED "NVIDIA Audio FX support") + set(LIBNVAFX_FOUND OFF) +else() + obs_status(ENABLED "NVIDIA Audio FX support") + + target_compile_definitions(obs-filters PRIVATE LIBNVAFX_ENABLED) + + set(LIBNVAFX_FOUND ON) +endif() + +if(NOT ENABLE_NVVFX) + obs_status(DISABLED "NVIDIA Video FX support") + set(LIBNVVFX_FOUND OFF) +else() + obs_status(ENABLED "NVIDIA Video FX support") + set(LIBNVVFX_FOUND ON) + target_compile_definitions(obs-filters PRIVATE LIBNVVFX_ENABLED) +endif() + +if(TARGET Librnnoise::Librnnoise + OR TARGET LibspeexDSP::LibspeexDSP + OR LIBNVAFX_FOUND) + target_compile_definitions(obs-filters PRIVATE HAS_NOISEREDUCTION) +endif() + +target_sources( + obs-filters + PRIVATE obs-filters.c + color-correction-filter.c + async-delay-filter.c + gpu-delay.c + hdr-tonemap-filter.c + crop-filter.c + scale-filter.c + scroll-filter.c + chroma-key-filter.c + color-key-filter.c + color-grade-filter.c + sharpness-filter.c + eq-filter.c + gain-filter.c + noise-gate-filter.c + mask-filter.c + invert-audio-polarity.c + compressor-filter.c + limiter-filter.c + expander-filter.c + luma-key-filter.c) + +if(NOT OS_MACOS) + target_sources( + obs-filters + PRIVATE data/blend_add_filter.effect + data/blend_mul_filter.effect + data/blend_sub_filter.effect + data/chroma_key_filter.effect + data/chroma_key_filter_v2.effect + data/color.effect + data/color_correction_filter.effect + data/color_grade_filter.effect + data/color_key_filter.effect + data/color_key_filter_v2.effect + data/crop_filter.effect + data/hdr_tonemap_filter.effect + data/luma_key_filter.effect + data/luma_key_filter_v2.effect + data/mask_alpha_filter.effect + data/mask_color_filter.effect + data/sharpness.effect + data/rtx_greenscreen.effect) + + get_target_property(_SOURCES obs-filters SOURCES) + set(_FILTERS ${_SOURCES}) + list(FILTER _FILTERS INCLUDE REGEX ".*\\.effect") + + source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}" + PREFIX "Effect Files" + FILES ${_FILTERS}) +endif() + +if(LIBNVVFX_FOUND) + target_sources(obs-filters PRIVATE nvidia-greenscreen-filter.c) + obs_status(STATUS "NVIDIA Video FX support enabled; requires redist to be installed by end-user") +endif() + +target_include_directories(obs-filters PRIVATE $) + +target_link_libraries(obs-filters PRIVATE OBS::libobs) + +set_target_properties(obs-filters PROPERTIES FOLDER "plugins" PREFIX "") + +if(OS_WINDOWS) + if(MSVC) + target_link_libraries(obs-filters PRIVATE OBS::w32-pthreads) + endif() + + set(MODULE_DESCRIPTION "OBS A/V Filters") + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in obs-filters.rc) + + target_sources(obs-filters PRIVATE obs-filters.rc) +endif() + +setup_plugin_target(obs-filters) diff --git a/plugins/obs-filters/cmake/macos/Info.plist.in b/plugins/obs-filters/cmake/macos/Info.plist.in new file mode 100644 index 000000000..550fafc13 --- /dev/null +++ b/plugins/obs-filters/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + obs-filters + CFBundleIdentifier + com.obsproject.obs-filters + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + obs-filters + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/plugins/obs-filters/cmake/nvidia.cmake b/plugins/obs-filters/cmake/nvidia.cmake new file mode 100644 index 000000000..63b36f8f7 --- /dev/null +++ b/plugins/obs-filters/cmake/nvidia.cmake @@ -0,0 +1,17 @@ +if(OS_WINDOWS) + option(ENABLE_NVAFX "Enable building with NVIDIA Audio Effects SDK (requires redistributable to be installed)" ON) + option(ENABLE_NVVFX "Enable building with NVIDIA Video Effects SDK (requires redistributable to be installed)" ON) +endif() + +if(ENABLE_NVAFX) + target_enable_feature(obs-filters "NVIDIA Audio FX support" LIBNVAFX_ENABLED HAS_NOISEREDUCTION) +else() + target_disable_feature(obs-filters "NVIDIA Audio FX support") +endif() + +if(ENABLE_NVVFX) + target_enable_feature(obs-filters "NVIDIA Video FX support" LIBNVVFX_ENABLED) + target_sources(obs-filters PRIVATE nvidia-greenscreen-filter.c) +else() + target_disable_feature(obs-filters "NVIDIA Video FX support") +endif() diff --git a/plugins/obs-filters/cmake/rnnoise.cmake b/plugins/obs-filters/cmake/rnnoise.cmake new file mode 100644 index 000000000..5f1bf29db --- /dev/null +++ b/plugins/obs-filters/cmake/rnnoise.cmake @@ -0,0 +1,46 @@ +option(ENABLE_RNNOISE "Enable building with RNNoise noise supression filter" ON) + +if(ENABLE_RNNOISE) + if(OS_WINDOWS OR OS_MACOS) + find_package(Librnnoise REQUIRED) + + target_sources(obs-filters PRIVATE noise-suppress-filter.c) + elseif(OS_LINUX OR OS_FREEBSD) + add_library( + obs-rnnoise + INTERFACE + rnnoise/src/arch.h + rnnoise/src/celt_lpc.c + rnnoise/src/celt_lpc.h + rnnoise/src/common.h + rnnoise/src/denoise.c + rnnoise/src/kiss_fft.c + rnnoise/src/kiss_fft.h + rnnoise/src/opus_types.h + rnnoise/src/pitch.c + rnnoise/src/pitch.h + rnnoise/src/rnn_data.c + rnnoise/src/rnn_data.h + rnnoise/src/rnn_reader.c + rnnoise/src/rnn.c + rnnoise/src/rnn.h + rnnoise/src/tansig_table.h + rnnoise/src/_kiss_fft_guts.h + rnnoise/include/rnnoise.h) + + add_library(Librnnoise::Librnnoise ALIAS obs-rnnoise) + + target_include_directories(obs-rnnoise INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/rnnoise/include") + + target_compile_definitions(obs-rnnoise INTERFACE COMPILE_OPUS) + + set_target_properties(obs-rnnoise PROPERTIES FOLDER plugins/obs-filters/rnnoise) + endif() + + target_compile_definitions(obs-filters PRIVATE LIBRNNOISE_ENABLED) + + target_link_libraries(obs-filters PRIVATE Librnnoise::Librnnoise) + target_enable_feature(obs-filters "RNNoise noise suppression" LIBRRNOISE_ENABLED HAS_NOISEREDUCTION) +else() + target_disable_feature(obs-filters "RNNoise noise suppression") +endif() diff --git a/plugins/obs-filters/cmake/speexdsp.cmake b/plugins/obs-filters/cmake/speexdsp.cmake new file mode 100644 index 000000000..6b0838b5e --- /dev/null +++ b/plugins/obs-filters/cmake/speexdsp.cmake @@ -0,0 +1,15 @@ +option(ENABLE_SPEEXDSP "Enable building with SpeexDSP-based noise suppression filter" ON) + +if(ENABLE_SPEEXDSP) + find_package(Libspeexdsp REQUIRED) + + target_sources(obs-filters PRIVATE noise-suppress-filter.c) + target_link_libraries(obs-filters PRIVATE SpeexDSP::Libspeexdsp) + target_compile_definitions(obs-filters PRIVATE LIBSPEEXDSP_ENABLED) + target_link_options(obs-filters PRIVATE $<$:/LTCG> $<$:/IGNORE:4098> + $<$:/IGNORE:4099>) + + target_enable_feature(obs-filters "SpeexDSP noise suppression" HAS_NOISEREDUCTION) +else() + target_disable_feature(obs-filters "SpeexDSP noise suppression") +endif() diff --git a/plugins/obs-filters/cmake/windows/obs-module.rc.in b/plugins/obs-filters/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..2dda790cc --- /dev/null +++ b/plugins/obs-filters/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS A/V Filters" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "obs-filters" + VALUE "OriginalFilename", "obs-filters" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/plugins/obs-outputs/CMakeLists.txt b/plugins/obs-outputs/CMakeLists.txt index 4ecfff8b9..c1b5b19a3 100644 --- a/plugins/obs-outputs/CMakeLists.txt +++ b/plugins/obs-outputs/CMakeLists.txt @@ -1,15 +1,9 @@ -project(obs-outputs) +cmake_minimum_required(VERSION 3.16...3.25) -if(NOT DEFINED ENABLE_RTMPS) - set(ENABLE_RTMPS - AUTO - CACHE STRING "Enable RTMPS support with mbedTLS" FORCE) - set_property(CACHE ENABLE_RTMPS PROPERTY STRINGS AUTO ON OFF) -endif() +legacy_check() -option(ENABLE_STATIC_MBEDTLS "Enable statically linking mbedTLS into binary" - OFF) -mark_as_advanced(ENABLE_STATIC_MBEDTLS) +find_package(MbedTLS REQUIRED) +find_package(ZLIB REQUIRED) add_library(obs-outputs MODULE) add_library(OBS::outputs ALIAS obs-outputs) @@ -46,162 +40,29 @@ target_sources( librtmp/parseurl.c librtmp/rtmp.c librtmp/rtmp.h - librtmp/rtmp_sys.h) + librtmp/rtmp_sys.h + "$<$:rtmp-hevc.c>" + "$<$:rtmp-hevc.h>") -if(ENABLE_HEVC) - target_sources(obs-outputs PRIVATE rtmp-hevc.c rtmp-hevc.h) -endif() +target_link_libraries(obs-outputs PRIVATE OBS::libobs MbedTLS::MbedTLS ZLIB::ZLIB) -target_link_libraries(obs-outputs PRIVATE OBS::libobs) - -set_target_properties(obs-outputs PROPERTIES FOLDER "plugins" PREFIX "") +target_compile_definitions(obs-outputs PRIVATE USE_MBEDTLS CRYPTO) if(OS_WINDOWS) - set(MODULE_DESCRIPTION "OBS output module") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - obs-outputs.rc) + target_link_libraries(obs-outputs PRIVATE OBS::w32-pthreads ws2_32 winmm Iphlpapi crypt32) + target_link_options(obs-outputs PRIVATE /IGNORE:4098 /IGNORE:4099) + + configure_file(cmake/windows/obs-module.rc.in obs-outputs.rc) target_sources(obs-outputs PRIVATE obs-outputs.rc) +elseif(OS_MACOS) + find_library(FOUNDATION_FRAMEWORK Foundation) + find_library(SECURITY_FRAMEWORK Security) + mark_as_advanced(FOUNDATION_FRAMEWORK SECURITY_FRAMEWORK) - if(MSVC) - target_link_libraries(obs-outputs PRIVATE OBS::w32-pthreads) - target_link_options(obs-outputs PRIVATE "LINKER:/IGNORE:4098" - "LINKER:/IGNORE:4099") - endif() - - target_link_libraries(obs-outputs PRIVATE ws2_32 winmm Iphlpapi) + target_link_libraries(obs-outputs PRIVATE ${FOUNDATION_FRAMEWORK} ${SECURITY_FRAMEWORK}) endif() -if(ENABLE_RTMPS STREQUAL "AUTO" OR ENABLE_RTMPS STREQUAL "ON") - find_package(MbedTLS) - find_package(ZLIB) - if(NOT MBEDTLS_FOUND OR NOT ZLIB_FOUND) - if(ENABLE_RTMPS STREQUAL "ON") - obs_status(FATAL_ERROR - "mbedTLS or zlib not found, but required for RTMPS support.") - return() - else() - obs_status( - WARNING - "mbedTLS or zlib was not found, RTMPS will be automatically disabled.") - target_compile_definitions(obs-outputs PRIVATE NO_CRYPTO) - endif() - else() - target_compile_definitions(obs-outputs PRIVATE USE_MBEDTLS CRYPTO) +include(cmake/ftl.cmake) - target_link_libraries(obs-outputs PRIVATE Mbedtls::Mbedtls ZLIB::ZLIB) - - if(OS_WINDOWS) - target_link_libraries(obs-outputs PRIVATE crypt32) - - elseif(OS_MACOS) - find_library(FOUNDATION_FRAMEWORK Foundation) - find_library(SECURITY_FRAMEWORK Security) - mark_as_advanced(FOUNDATION_FRAMEWORK SECURITY_FRAMEWORK) - - target_link_libraries(obs-outputs PRIVATE ${FOUNDATION_FRAMEWORK} - ${SECURITY_FRAMEWORK}) - set_target_properties(obs-outputs PROPERTIES CXX_VISIBILITY_PRESET hidden) - set_target_properties(obs-outputs PROPERTIES C_VISIBILITY_PRESET hidden) - - elseif(OS_POSIX) - set_target_properties(obs-outputs PROPERTIES CXX_VISIBILITY_PRESET hidden) - set_target_properties(obs-outputs PROPERTIES C_VISIBILITY_PRESET hidden) - endif() - endif() -else() - target_compile_definitions(obs-outputs PRIVATE NO_CRYPTO) -endif() - -find_package(PkgConfig QUIET) -if(PKG_CONFIG_FOUND) - pkg_check_modules(FTL QUIET libftl) -endif() - -if(FTL_FOUND) - find_package(CURL REQUIRED) - obs_status(ENABLED "ftl outputs (system ftl-sdk)") - - target_sources(obs-outputs PRIVATE ftl-stream.c) - - target_include_directories(obs-outputs PRIVATE ${FTL_INCLUDE_DIRS}) - - target_link_libraries(obs-outputs PRIVATE ${FTL_LIBRARIES} CURL::libcurl) - - target_compile_features(obs-outputs PRIVATE c_std_11) - - target_compile_definitions(obs-outputs PRIVATE FTL_FOUND) - -elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/CMakeLists.txt") - find_package(CURL REQUIRED) - obs_status(ENABLED "ftl ouputs (bundled ftl-sdk)") - - target_compile_definitions(obs-outputs PRIVATE FTL_STATIC_COMPILE) - - target_compile_features(obs-outputs PRIVATE c_std_11) - - target_link_libraries(obs-outputs PRIVATE Jansson::Jansson CURL::libcurl) - - target_sources( - obs-outputs - PRIVATE ftl-stream.c - ftl-sdk/libftl/ftl.h - ftl-sdk/libftl/ftl_private.h - ftl-sdk/libftl/hmac/hmac.c - ftl-sdk/libftl/hmac/hmac.h - ftl-sdk/libftl/hmac/sha2.c - ftl-sdk/libftl/hmac/sha2.h - ftl-sdk/libftl/ftl-sdk.c - ftl-sdk/libftl/handshake.c - ftl-sdk/libftl/ingest.c - ftl-sdk/libftl/ftl_helpers.c - ftl-sdk/libftl/media.c - ftl-sdk/libftl/gettimeofday/gettimeofday.c - ftl-sdk/libftl/logging.c) - - target_include_directories(obs-outputs - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/libftl) - - if(OS_WINDOWS) - target_sources( - obs-outputs - PRIVATE ftl-sdk/libftl/gettimeofday/gettimeofday.c - ftl-sdk/libftl/gettimeofday/gettimeofday.h - ftl-sdk/libftl/win32/socket.c - ftl-sdk/libftl/win32/threads.c - ftl-sdk/libftl/win32/threads.h) - - target_include_directories( - obs-outputs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/libftl/win32) - elseif(OS_POSIX) - target_sources( - obs-outputs - PRIVATE ftl-sdk/libftl/posix/socket.c ftl-sdk/libftl/posix/threads.c - ftl-sdk/libftl/posix/threads.h) - - target_include_directories( - obs-outputs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/libftl/posix) - endif() - - if(NOT MSVC) - target_compile_options( - obs-outputs - PRIVATE - -Wno-error=extra - -Wno-error=sign-compare - -Wno-error=incompatible-pointer-types - -Wno-error=int-conversion - -Wno-error=unused-parameter - -Wno-error=deprecated-declarations - "$<$:-Wno-error=maybe-uninitialized>" - "$<$:-Wno-error=pointer-sign>") - if((NOT CMAKE_C_COMPILER_ID STREQUAL "GNU") OR CMAKE_C_COMPILER_VERSION - VERSION_GREATER_EQUAL "10") - target_compile_options(obs-outputs PRIVATE -Wno-error=enum-conversion) - endif() - endif() - - target_compile_definitions(obs-outputs PRIVATE FTL_FOUND) -endif() - -setup_plugin_target(obs-outputs) +set_target_properties_obs(obs-outputs PROPERTIES FOLDER plugins PREFIX "") diff --git a/plugins/obs-outputs/cmake/ftl.cmake b/plugins/obs-outputs/cmake/ftl.cmake new file mode 100644 index 000000000..0d456b3c1 --- /dev/null +++ b/plugins/obs-outputs/cmake/ftl.cmake @@ -0,0 +1,76 @@ +find_package(CURL REQUIRED) +find_package(jansson REQUIRED) + +add_library(ftl-sdk INTERFACE EXCLUDE_FROM_ALL) +add_library(OBS::ftl-sdk ALIAS ftl-sdk) + +target_compile_definitions(ftl-sdk INTERFACE FTL_STATIC_COMPILE FTL_FOUND) + +target_link_libraries(ftl-sdk INTERFACE jansson::jansson CURL::libcurl) + +target_sources( + ftl-sdk + INTERFACE ftl-stream.c + ftl-sdk/libftl/ftl.h + ftl-sdk/libftl/ftl_private.h + ftl-sdk/libftl/hmac/hmac.c + ftl-sdk/libftl/hmac/hmac.h + ftl-sdk/libftl/hmac/sha2.c + ftl-sdk/libftl/hmac/sha2.h + ftl-sdk/libftl/ftl-sdk.c + ftl-sdk/libftl/handshake.c + ftl-sdk/libftl/ingest.c + ftl-sdk/libftl/ftl_helpers.c + ftl-sdk/libftl/media.c + ftl-sdk/libftl/gettimeofday/gettimeofday.c + ftl-sdk/libftl/logging.c) + +target_include_directories(ftl-sdk INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/libftl") + +if(OS_WINDOWS) + target_sources( + ftl-sdk INTERFACE ftl-sdk/libftl/gettimeofday/gettimeofday.c ftl-sdk/libftl/gettimeofday/gettimeofday.h + ftl-sdk/libftl/win32/socket.c ftl-sdk/libftl/win32/threads.c ftl-sdk/libftl/win32/threads.h) + + target_include_directories(ftl-sdk INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/libftl/win32") +else() + target_sources(ftl-sdk INTERFACE ftl-sdk/libftl/posix/socket.c ftl-sdk/libftl/posix/threads.c + ftl-sdk/libftl/posix/threads.h) + + target_include_directories(ftl-sdk INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/libftl/posix") +endif() + +target_link_libraries(obs-outputs PRIVATE ftl-sdk) + +target_enable_feature(obs-outputs "FTL protocol support") + +get_target_property(target_sources ftl-sdk INTERFACE_SOURCES) +list( + APPEND + silence_ftl + -Wno-error=unused-parameter + -Wno-error=unused-variable + -Wno-error=sign-compare + -Wno-error=pointer-sign + -Wno-error=int-conversion) + +if(CMAKE_C_COMPILER_ID STREQUAL AppleClang OR CMAKE_C_COMPILER_ID STREQUAL Clang) + list(APPEND silence_ftl -Wno-error=incompatible-function-pointer-types -Wno-error=implicit-int-conversion + -Wno-error=shorten-64-to-32 -Wno-error=macro-redefined) +elseif(CMAKE_C_COMPILER_ID STREQUAL GNU) + list(APPEND silence_ftl -Wno-error=extra -Wno-error=incompatible-pointer-types -Wno-error=int-conversion + -Wno-error=builtin-macro-redefined) +endif() + +if((NOT CMAKE_C_COMPILER_ID STREQUAL GNU) OR CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10) + list(APPEND silence_ftl -Wno-error=enum-conversion) +endif() + +set_source_files_properties(${target_sources} PROPERTIES COMPILE_OPTIONS "${silence_ftl}") + +set(target_headers ${target_sources}) +list(FILTER target_sources INCLUDE REGEX ".+ftl-sdk/.+\\.(m|c[cp]?p?|swift)") +list(FILTER target_headers INCLUDE REGEX ".+ftl-sdk/.+\\.h(pp)?") + +source_group("ftl-sdk\\Source Files" FILES ${target_sources}) +source_group("ftl-sdk\\Header Files" FILES ${target_headers}) diff --git a/plugins/obs-outputs/cmake/legacy.cmake b/plugins/obs-outputs/cmake/legacy.cmake new file mode 100644 index 000000000..98f9e11b4 --- /dev/null +++ b/plugins/obs-outputs/cmake/legacy.cmake @@ -0,0 +1,189 @@ +project(obs-outputs) + +if(NOT DEFINED ENABLE_RTMPS) + set(ENABLE_RTMPS + AUTO + CACHE STRING "Enable RTMPS support with mbedTLS" FORCE) + set_property(CACHE ENABLE_RTMPS PROPERTY STRINGS AUTO ON OFF) +endif() + +option(ENABLE_STATIC_MBEDTLS "Enable statically linking mbedTLS into binary" OFF) +mark_as_advanced(ENABLE_STATIC_MBEDTLS) + +add_library(obs-outputs MODULE) +add_library(OBS::outputs ALIAS obs-outputs) + +target_sources( + obs-outputs + PRIVATE obs-outputs.c + obs-output-ver.h + flv-mux.c + flv-mux.h + flv-output.c + net-if.c + net-if.h + null-output.c + rtmp-helpers.h + rtmp-stream.c + rtmp-stream.h + rtmp-windows.c + rtmp-av1.c + rtmp-av1.h + utils.h + librtmp/amf.c + librtmp/amf.h + librtmp/bytes.h + librtmp/cencode.c + librtmp/cencode.h + librtmp/handshake.h + librtmp/hashswf.c + librtmp/http.h + librtmp/log.c + librtmp/log.h + librtmp/md5.c + librtmp/md5.h + librtmp/parseurl.c + librtmp/rtmp.c + librtmp/rtmp.h + librtmp/rtmp_sys.h) + +if(ENABLE_HEVC) + target_sources(obs-outputs PRIVATE rtmp-hevc.c rtmp-hevc.h) +endif() + +target_link_libraries(obs-outputs PRIVATE OBS::libobs) + +set_target_properties(obs-outputs PROPERTIES FOLDER "plugins" PREFIX "") + +if(OS_WINDOWS) + set(MODULE_DESCRIPTION "OBS output module") + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in obs-outputs.rc) + + target_sources(obs-outputs PRIVATE obs-outputs.rc) + + if(MSVC) + target_link_libraries(obs-outputs PRIVATE OBS::w32-pthreads) + target_link_options(obs-outputs PRIVATE "LINKER:/IGNORE:4098" "LINKER:/IGNORE:4099") + endif() + + target_link_libraries(obs-outputs PRIVATE ws2_32 winmm Iphlpapi) +endif() + +if(ENABLE_RTMPS STREQUAL "AUTO" OR ENABLE_RTMPS STREQUAL "ON") + find_package(MbedTLS) + find_package(ZLIB) + if(NOT MBEDTLS_FOUND OR NOT ZLIB_FOUND) + if(ENABLE_RTMPS STREQUAL "ON") + obs_status(FATAL_ERROR "mbedTLS or zlib not found, but required for RTMPS support.") + return() + else() + obs_status(WARNING "mbedTLS or zlib was not found, RTMPS will be automatically disabled.") + target_compile_definitions(obs-outputs PRIVATE NO_CRYPTO) + endif() + else() + target_compile_definitions(obs-outputs PRIVATE USE_MBEDTLS CRYPTO) + + target_link_libraries(obs-outputs PRIVATE Mbedtls::Mbedtls ZLIB::ZLIB) + + if(OS_WINDOWS) + target_link_libraries(obs-outputs PRIVATE crypt32) + + elseif(OS_MACOS) + find_library(FOUNDATION_FRAMEWORK Foundation) + find_library(SECURITY_FRAMEWORK Security) + mark_as_advanced(FOUNDATION_FRAMEWORK SECURITY_FRAMEWORK) + + target_link_libraries(obs-outputs PRIVATE ${FOUNDATION_FRAMEWORK} ${SECURITY_FRAMEWORK}) + set_target_properties(obs-outputs PROPERTIES CXX_VISIBILITY_PRESET hidden) + set_target_properties(obs-outputs PROPERTIES C_VISIBILITY_PRESET hidden) + + elseif(OS_POSIX) + set_target_properties(obs-outputs PROPERTIES CXX_VISIBILITY_PRESET hidden) + set_target_properties(obs-outputs PROPERTIES C_VISIBILITY_PRESET hidden) + endif() + endif() +else() + target_compile_definitions(obs-outputs PRIVATE NO_CRYPTO) +endif() + +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_check_modules(FTL QUIET libftl) +endif() + +if(FTL_FOUND) + find_package(CURL REQUIRED) + obs_status(ENABLED "ftl outputs (system ftl-sdk)") + + target_sources(obs-outputs PRIVATE ftl-stream.c) + + target_include_directories(obs-outputs PRIVATE ${FTL_INCLUDE_DIRS}) + + target_link_libraries(obs-outputs PRIVATE ${FTL_LIBRARIES} CURL::libcurl) + + target_compile_features(obs-outputs PRIVATE c_std_11) + + target_compile_definitions(obs-outputs PRIVATE FTL_FOUND) + +elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/CMakeLists.txt") + find_package(CURL REQUIRED) + obs_status(ENABLED "ftl ouputs (bundled ftl-sdk)") + + target_compile_definitions(obs-outputs PRIVATE FTL_STATIC_COMPILE) + + target_compile_features(obs-outputs PRIVATE c_std_11) + + target_link_libraries(obs-outputs PRIVATE Jansson::Jansson CURL::libcurl) + + target_sources( + obs-outputs + PRIVATE ftl-stream.c + ftl-sdk/libftl/ftl.h + ftl-sdk/libftl/ftl_private.h + ftl-sdk/libftl/hmac/hmac.c + ftl-sdk/libftl/hmac/hmac.h + ftl-sdk/libftl/hmac/sha2.c + ftl-sdk/libftl/hmac/sha2.h + ftl-sdk/libftl/ftl-sdk.c + ftl-sdk/libftl/handshake.c + ftl-sdk/libftl/ingest.c + ftl-sdk/libftl/ftl_helpers.c + ftl-sdk/libftl/media.c + ftl-sdk/libftl/gettimeofday/gettimeofday.c + ftl-sdk/libftl/logging.c) + + target_include_directories(obs-outputs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/libftl) + + if(OS_WINDOWS) + target_sources( + obs-outputs PRIVATE ftl-sdk/libftl/gettimeofday/gettimeofday.c ftl-sdk/libftl/gettimeofday/gettimeofday.h + ftl-sdk/libftl/win32/socket.c ftl-sdk/libftl/win32/threads.c ftl-sdk/libftl/win32/threads.h) + + target_include_directories(obs-outputs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/libftl/win32) + elseif(OS_POSIX) + target_sources(obs-outputs PRIVATE ftl-sdk/libftl/posix/socket.c ftl-sdk/libftl/posix/threads.c + ftl-sdk/libftl/posix/threads.h) + + target_include_directories(obs-outputs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/libftl/posix) + endif() + + if(NOT MSVC) + target_compile_options( + obs-outputs + PRIVATE -Wno-error=extra + -Wno-error=sign-compare + -Wno-error=incompatible-pointer-types + -Wno-error=int-conversion + -Wno-error=unused-parameter + -Wno-error=deprecated-declarations + "$<$:-Wno-error=maybe-uninitialized>" + "$<$:-Wno-error=pointer-sign>") + if((NOT CMAKE_C_COMPILER_ID STREQUAL "GNU") OR CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "10") + target_compile_options(obs-outputs PRIVATE -Wno-error=enum-conversion) + endif() + endif() + + target_compile_definitions(obs-outputs PRIVATE FTL_FOUND) +endif() + +setup_plugin_target(obs-outputs) diff --git a/plugins/obs-outputs/cmake/macos/Info.plist.in b/plugins/obs-outputs/cmake/macos/Info.plist.in new file mode 100644 index 000000000..5294581f9 --- /dev/null +++ b/plugins/obs-outputs/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + obs-outputs + CFBundleIdentifier + com.obsproject.obs-outputs + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + obs-outputs + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/plugins/obs-outputs/cmake/windows/obs-module.rc.in b/plugins/obs-outputs/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..3b7b2843c --- /dev/null +++ b/plugins/obs-outputs/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS output module" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "obs-outputs" + VALUE "OriginalFilename", "obs-outputs" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/plugins/obs-qsv11/CMakeLists.txt b/plugins/obs-qsv11/CMakeLists.txt index ded4ceeda..3d3777961 100644 --- a/plugins/obs-qsv11/CMakeLists.txt +++ b/plugins/obs-qsv11/CMakeLists.txt @@ -57,9 +57,8 @@ target_sources( libmfx/include/mfx_win_reg_key.h libmfx/include/mfxaudio_exposed_functions_list.h) -target_include_directories( - libmfx INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/libmfx/include/msdk/include - ${CMAKE_CURRENT_SOURCE_DIR}/libmfx/include) +target_include_directories(libmfx INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/libmfx/include/msdk/include + ${CMAKE_CURRENT_SOURCE_DIR}/libmfx/include) target_sources( obs-qsv11 @@ -97,22 +96,17 @@ if(OS_WINDOWS) add_subdirectory(obs-qsv-test) set(MODULE_DESCRIPTION "OBS QSV encoder") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - obs-qsv11.rc) + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in obs-qsv11.rc) target_sources(obs-qsv11 PRIVATE obs-qsv11.rc) - target_compile_definitions( - obs-qsv11 PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS - _CRT_NONSTDC_NO_WARNINGS) + target_compile_definitions(obs-qsv11 PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS) endif() set_target_properties(obs-qsv11 PROPERTIES FOLDER "plugins/obs-qsv11") -file(GLOB _OBS_QSV11_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.c - ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) -file(GLOB _OBS_QSV11_HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h - ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) +file(GLOB _OBS_QSV11_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) +file(GLOB _OBS_QSV11_HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) source_group("obs-qsv11\\Source Files" FILES ${_OBS_QSV11_SOURCE_FILES}) source_group("obs-qsv11\\Header Files" FILES ${_OBS_QSV11_HEADER_FILES}) diff --git a/plugins/obs-text/CMakeLists.txt b/plugins/obs-text/CMakeLists.txt index d956041e0..0bca288ba 100644 --- a/plugins/obs-text/CMakeLists.txt +++ b/plugins/obs-text/CMakeLists.txt @@ -8,15 +8,12 @@ target_link_libraries(obs-text PRIVATE OBS::libobs) set_target_properties(obs-text PROPERTIES FOLDER "plugins") set(MODULE_DESCRIPTION "OBS GDI+ text module") -configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - obs-text.rc) +configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in obs-text.rc) target_sources(obs-text PRIVATE gdiplus/obs-text.cpp obs-text.rc) target_link_libraries(obs-text PRIVATE gdiplus) -target_compile_definitions( - obs-text PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS - _CRT_NONSTDC_NO_WARNINGS) +target_compile_definitions(obs-text PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS) setup_plugin_target(obs-text) diff --git a/plugins/obs-transitions/CMakeLists.txt b/plugins/obs-transitions/CMakeLists.txt index 8f7c1e39a..ab46e3bb6 100644 --- a/plugins/obs-transitions/CMakeLists.txt +++ b/plugins/obs-transitions/CMakeLists.txt @@ -1,4 +1,6 @@ -project(obs-transitions) +cmake_minimum_required(VERSION 3.16...3.25) + +legacy_check() add_library(obs-transitions MODULE) add_library(OBS::transition ALIAS obs-transitions) @@ -14,34 +16,11 @@ target_sources( transition-luma-wipe.c transition-stinger.c) -if(NOT OS_MACOS) - target_sources( - obs-transitions - PRIVATE data/fade_to_color_transition.effect data/fade_transition.effect - data/luma_wipe_transition.effect data/slide_transition.effect - data/stinger_matte_transition.effect data/swipe_transition.effect) - - get_target_property(_SOURCES obs-transitions SOURCES) - set(_FILTERS ${_SOURCES}) - list(FILTER _FILTERS INCLUDE REGEX ".*\\.effect") - - source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}" - PREFIX "Effect Files" - FILES ${_FILTERS}) -endif() - target_link_libraries(obs-transitions PRIVATE OBS::libobs) if(OS_WINDOWS) - set(MODULE_DESCRIPTION "OBS Transitions module") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - obs-transitions.rc) - + configure_file(cmake/windows/obs-module.rc.in obs-transitions.rc) target_sources(obs-transitions PRIVATE obs-transitions.rc) - endif() -set_target_properties(obs-transitions PROPERTIES FOLDER "plugins" PREFIX "") - -setup_plugin_target(obs-transitions) +set_target_properties_obs(obs-transitions PROPERTIES FOLDER plugins PREFIX "") diff --git a/plugins/obs-transitions/cmake/legacy.cmake b/plugins/obs-transitions/cmake/legacy.cmake new file mode 100644 index 000000000..6153ad784 --- /dev/null +++ b/plugins/obs-transitions/cmake/legacy.cmake @@ -0,0 +1,45 @@ +project(obs-transitions) + +add_library(obs-transitions MODULE) +add_library(OBS::transition ALIAS obs-transitions) + +target_sources( + obs-transitions + PRIVATE obs-transitions.c + transition-slide.c + transition-swipe.c + transition-fade.c + transition-cut.c + transition-fade-to-color.c + transition-luma-wipe.c + transition-stinger.c) + +if(NOT OS_MACOS) + target_sources( + obs-transitions + PRIVATE data/fade_to_color_transition.effect data/fade_transition.effect data/luma_wipe_transition.effect + data/slide_transition.effect data/stinger_matte_transition.effect data/swipe_transition.effect) + + get_target_property(_SOURCES obs-transitions SOURCES) + set(_FILTERS ${_SOURCES}) + list(FILTER _FILTERS INCLUDE REGEX ".*\\.effect") + + source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}" + PREFIX "Effect Files" + FILES ${_FILTERS}) +endif() + +target_link_libraries(obs-transitions PRIVATE OBS::libobs) + +if(OS_WINDOWS) + set(MODULE_DESCRIPTION "OBS Transitions module") + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in obs-transitions.rc) + + target_sources(obs-transitions PRIVATE obs-transitions.rc) + +endif() + +set_target_properties(obs-transitions PROPERTIES FOLDER "plugins" PREFIX "") + +setup_plugin_target(obs-transitions) diff --git a/plugins/obs-transitions/cmake/macos/Info.plist.in b/plugins/obs-transitions/cmake/macos/Info.plist.in new file mode 100644 index 000000000..543fca2be --- /dev/null +++ b/plugins/obs-transitions/cmake/macos/Info.plist.in @@ -0,0 +1,44 @@ + + + + + CFBundleExecutable + obs-transitions + CFBundleIconFile + AppIcon + CFBundleIdentifier + com.obsproject.obs-transitions + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + OBS + CFBundleDisplayName + OBS Studio + CFBundlePackageType + APPL + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleSupportedPlatforms + + MacOSX + + NSHighResolutionCapable + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + LSAppNapIsDisabled + + NSCameraUsageDescription + OBS needs to access the camera to enable camera sources to work. + NSMicrophoneUsageDescription + OBS needs to access the microphone to enable audio input. + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + SUFeedURL + ${OBS_SPARKLE_FEED_URL} + SUPublicDSAKeyFile + ${OBS_PUBLIC_KEY_NAME} + + diff --git a/plugins/obs-transitions/cmake/windows/obs-module.rc.in b/plugins/obs-transitions/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..5234b856c --- /dev/null +++ b/plugins/obs-transitions/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS Transitions module" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "${PROJECT_NAME}" + VALUE "OriginalFilename", "${PROJECT_NAME}" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/plugins/obs-vst/CMakeLists.txt b/plugins/obs-vst/CMakeLists.txt index df52be4e3..fdb969116 100644 --- a/plugins/obs-vst/CMakeLists.txt +++ b/plugins/obs-vst/CMakeLists.txt @@ -1,90 +1,56 @@ -project(obs-vst) +cmake_minimum_required(VERSION 3.16...3.25) + +legacy_check() option(ENABLE_VST "Enable building OBS with VST plugin" ON) if(NOT ENABLE_VST) - message(STATUS "OBS: DISABLED obs-vst") + target_disable(obs-vst) return() endif() -option(ENABLE_VST_BUNDLED_HEADERS "Build with Bundled Headers" ON) -mark_as_advanced(ENABLE_VST_BUNDLED_HEADERS) - add_library(obs-vst MODULE) add_library(OBS::vst ALIAS obs-vst) find_qt(COMPONENTS Widgets) -set_target_properties( - obs-vst - PROPERTIES AUTOMOC ON - AUTOUIC ON - AUTORCC ON) - -if(_QT_VERSION EQUAL 6 AND OS_WINDOWS) - set_target_properties(obs-vst PROPERTIES AUTORCC_OPTIONS "--format-version;1") -endif() - -target_include_directories(obs-vst PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR}) - target_sources( obs-vst - PRIVATE obs-vst.cpp VSTPlugin.cpp EditorWidget.cpp - headers/vst-plugin-callbacks.hpp headers/EditorWidget.h - headers/VSTPlugin.h) + PRIVATE obs-vst.cpp + VSTPlugin.cpp + EditorWidget.cpp + headers/vst-plugin-callbacks.hpp + headers/EditorWidget.h + headers/VSTPlugin.h + vst_header/aeffectx.h) +target_include_directories(obs-vst PRIVATE vst_header) target_link_libraries(obs-vst PRIVATE OBS::libobs Qt::Widgets) -target_include_directories(obs-vst PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/headers) - -target_compile_features(obs-vst PRIVATE cxx_std_17) - -if(ENABLE_VST_BUNDLED_HEADERS) - message(STATUS "OBS: - obs-vst uses bundled VST headers") - - target_sources(obs-vst PRIVATE vst_header/aeffectx.h) - - target_include_directories(obs-vst - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/vst_header) -else() - set(VST_INCLUDE_DIR - "" - CACHE PATH - "Path to Steinburg headers (e.g. C:/VST3 SDK/pluginterfaces/vst2.x)" - FORCE) - mark_as_advanced(VST_INCLUDE_DIR) - - message( - WARNING - "OBS: You should only use the Steinburg headers for debugging or local builds. " - "It is illegal to distribute the Steinburg headers with anything, and " - "possibly against the GPL to distribute the binaries from the resultant compile." - ) - - target_sources(obs-vst PRIVATE ${VST_INCLUDE_DIR}/aeffectx.h) -endif() - if(OS_MACOS) find_library(FOUNDATION Foundation) find_library(COCOA Cocoa) mark_as_advanced(COCOA FOUNDATION) target_sources(obs-vst PRIVATE mac/VSTPlugin-osx.mm mac/EditorWidget-osx.mm) - target_link_libraries(obs-vst PRIVATE ${COCOA} ${FOUNDATION}) elseif(OS_WINDOWS) target_sources(obs-vst PRIVATE win/VSTPlugin-win.cpp win/EditorWidget-win.cpp) - target_compile_definitions(obs-vst PRIVATE UNICODE _UNICODE) + set_property( + TARGET obs-vst + APPEND + PROPERTY AUTORCC_OPTIONS --format-version 1) elseif(OS_POSIX) - target_sources(obs-vst PRIVATE linux/VSTPlugin-linux.cpp - linux/EditorWidget-linux.cpp) - + target_sources(obs-vst PRIVATE linux/VSTPlugin-linux.cpp linux/EditorWidget-linux.cpp) endif() -set_target_properties(obs-vst PROPERTIES FOLDER "plugins" PREFIX "") - -setup_plugin_target(obs-vst) +set_target_properties_obs( + obs-vst + PROPERTIES FOLDER plugins + PREFIX "" + AUTOMOC ON + AUTOUIC ON + AUTORCC ON) diff --git a/plugins/obs-vst/cmake/legacy.cmake b/plugins/obs-vst/cmake/legacy.cmake new file mode 100644 index 000000000..c5e886aaa --- /dev/null +++ b/plugins/obs-vst/cmake/legacy.cmake @@ -0,0 +1,79 @@ +project(obs-vst) + +option(ENABLE_VST "Enable building OBS with VST plugin" ON) + +if(NOT ENABLE_VST) + message(STATUS "OBS: DISABLED obs-vst") + return() +endif() + +option(ENABLE_VST_BUNDLED_HEADERS "Build with Bundled Headers" ON) +mark_as_advanced(ENABLE_VST_BUNDLED_HEADERS) + +add_library(obs-vst MODULE) +add_library(OBS::vst ALIAS obs-vst) + +find_qt(COMPONENTS Widgets) + +set_target_properties( + obs-vst + PROPERTIES AUTOMOC ON + AUTOUIC ON + AUTORCC ON) + +if(_QT_VERSION EQUAL 6 AND OS_WINDOWS) + set_target_properties(obs-vst PROPERTIES AUTORCC_OPTIONS "--format-version;1") +endif() + +target_include_directories(obs-vst PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + +target_sources(obs-vst PRIVATE obs-vst.cpp VSTPlugin.cpp EditorWidget.cpp headers/vst-plugin-callbacks.hpp + headers/EditorWidget.h headers/VSTPlugin.h) + +target_link_libraries(obs-vst PRIVATE OBS::libobs Qt::Widgets) + +target_include_directories(obs-vst PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/headers) + +target_compile_features(obs-vst PRIVATE cxx_std_17) + +if(ENABLE_VST_BUNDLED_HEADERS) + message(STATUS "OBS: - obs-vst uses bundled VST headers") + + target_sources(obs-vst PRIVATE vst_header/aeffectx.h) + + target_include_directories(obs-vst PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/vst_header) +else() + set(VST_INCLUDE_DIR + "" + CACHE PATH "Path to Steinburg headers (e.g. C:/VST3 SDK/pluginterfaces/vst2.x)" FORCE) + mark_as_advanced(VST_INCLUDE_DIR) + + message(WARNING "OBS: You should only use the Steinburg headers for debugging or local builds. " + "It is illegal to distribute the Steinburg headers with anything, and " + "possibly against the GPL to distribute the binaries from the resultant compile.") + + target_sources(obs-vst PRIVATE ${VST_INCLUDE_DIR}/aeffectx.h) +endif() + +if(OS_MACOS) + find_library(FOUNDATION Foundation) + find_library(COCOA Cocoa) + mark_as_advanced(COCOA FOUNDATION) + + target_sources(obs-vst PRIVATE mac/VSTPlugin-osx.mm mac/EditorWidget-osx.mm) + + target_link_libraries(obs-vst PRIVATE ${COCOA} ${FOUNDATION}) + +elseif(OS_WINDOWS) + target_sources(obs-vst PRIVATE win/VSTPlugin-win.cpp win/EditorWidget-win.cpp) + + target_compile_definitions(obs-vst PRIVATE UNICODE _UNICODE) + +elseif(OS_POSIX) + target_sources(obs-vst PRIVATE linux/VSTPlugin-linux.cpp linux/EditorWidget-linux.cpp) + +endif() + +set_target_properties(obs-vst PROPERTIES FOLDER "plugins" PREFIX "") + +setup_plugin_target(obs-vst) diff --git a/plugins/obs-vst/cmake/macos/Info.plist.in b/plugins/obs-vst/cmake/macos/Info.plist.in new file mode 100644 index 000000000..66bb94ef9 --- /dev/null +++ b/plugins/obs-vst/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + obs-vst + CFBundleIdentifier + com.obsproject.obs-vst + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + obs-vst + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/plugins/obs-x264/CMakeLists.txt b/plugins/obs-x264/CMakeLists.txt index 09db3f814..9ea1d6cb4 100644 --- a/plugins/obs-x264/CMakeLists.txt +++ b/plugins/obs-x264/CMakeLists.txt @@ -1,31 +1,24 @@ -project(obs-x264) +cmake_minimum_required(VERSION 3.16...3.25) + +legacy_check() find_package(Libx264 REQUIRED) -add_library(obs-x264 MODULE) -add_library(OBS::x264 ALIAS obs-x264) -add_executable(obs-x264-test) - -target_sources(obs-x264-test PRIVATE obs-x264-test.c) - -target_link_libraries(obs-x264-test PRIVATE OBS::opts-parser) - -target_sources(obs-x264 PRIVATE obs-x264.c obs-x264-plugin-main.c) - -target_link_libraries(obs-x264 PRIVATE LIBX264::LIBX264 OBS::opts-parser) - -set_target_properties(obs-x264 PROPERTIES FOLDER "plugins" PREFIX "") - -if(OS_WINDOWS) - set(MODULE_DESCRIPTION "OBS x264 encoder") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - obs-x264.rc) - - target_sources(obs-x264 PRIVATE obs-x264.rc) - +if(NOT TARGET OBS::opts-parser) + add_subdirectory("${CMAKE_SOURCE_DIR}/deps/opts-parser" "${CMAKE_BINARY_DIR}/deps/opts-parser") endif() -set_target_properties(obs-x264-test PROPERTIES FOLDER "plugins") -add_test(NAME obs-x264-test COMMAND obs-x264-test) +add_library(obs-x264 MODULE) +add_library(OBS::x264 ALIAS obs-x264) -setup_plugin_target(obs-x264) +target_sources(obs-x264 PRIVATE obs-x264.c obs-x264-plugin-main.c) +target_link_libraries(obs-x264 PRIVATE Libx264::Libx264 OBS::opts-parser) + +if(OS_WINDOWS) + configure_file(cmake/windows/obs-module.rc.in obs-x264.rc) + target_sources(obs-x264 PRIVATE obs-x264.rc) +endif() + +set_target_properties_obs(obs-x264 PROPERTIES FOLDER plugins/obs-x264 PREFIX "") + +include(cmake/x264-test.cmake) diff --git a/plugins/obs-x264/cmake/legacy.cmake b/plugins/obs-x264/cmake/legacy.cmake new file mode 100644 index 000000000..a7049c1d8 --- /dev/null +++ b/plugins/obs-x264/cmake/legacy.cmake @@ -0,0 +1,30 @@ +project(obs-x264) + +find_package(Libx264 REQUIRED) + +add_library(obs-x264 MODULE) +add_library(OBS::x264 ALIAS obs-x264) +add_executable(obs-x264-test) + +target_sources(obs-x264-test PRIVATE obs-x264-test.c) + +target_link_libraries(obs-x264-test PRIVATE OBS::opts-parser) + +target_sources(obs-x264 PRIVATE obs-x264.c obs-x264-plugin-main.c) + +target_link_libraries(obs-x264 PRIVATE LIBX264::LIBX264 OBS::opts-parser) + +set_target_properties(obs-x264 PROPERTIES FOLDER "plugins" PREFIX "") + +if(OS_WINDOWS) + set(MODULE_DESCRIPTION "OBS x264 encoder") + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in obs-x264.rc) + + target_sources(obs-x264 PRIVATE obs-x264.rc) + +endif() + +set_target_properties(obs-x264-test PROPERTIES FOLDER "plugins") +add_test(NAME obs-x264-test COMMAND obs-x264-test) + +setup_plugin_target(obs-x264) diff --git a/plugins/obs-x264/cmake/macos/Info.plist.in b/plugins/obs-x264/cmake/macos/Info.plist.in new file mode 100644 index 000000000..ec7320973 --- /dev/null +++ b/plugins/obs-x264/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + obs-x264 + CFBundleIdentifier + com.obsproject.obs-x264 + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + obs-x264 + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/plugins/obs-x264/cmake/windows/obs-module.rc.in b/plugins/obs-x264/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..acf751f94 --- /dev/null +++ b/plugins/obs-x264/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS x264 encoder" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "obs-x264" + VALUE "OriginalFilename", "obs-x264" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/plugins/obs-x264/cmake/x264-test.cmake b/plugins/obs-x264/cmake/x264-test.cmake new file mode 100644 index 000000000..049bdef38 --- /dev/null +++ b/plugins/obs-x264/cmake/x264-test.cmake @@ -0,0 +1,8 @@ +add_executable(obs-x264-test) + +target_sources(obs-x264-test PRIVATE obs-x264-test.c) +target_link_libraries(obs-x264-test PRIVATE OBS::opts-parser) + +add_test(NAME obs-x264-test COMMAND obs-x264-test) + +set_target_properties(obs-x264-test PROPERTIES FOLDER plugins/obs-x264) diff --git a/plugins/rtmp-services/CMakeLists.txt b/plugins/rtmp-services/CMakeLists.txt index 39e50993f..f4aee787b 100644 --- a/plugins/rtmp-services/CMakeLists.txt +++ b/plugins/rtmp-services/CMakeLists.txt @@ -1,19 +1,23 @@ -project(rtmp-services) +cmake_minimum_required(VERSION 3.16...3.25) + +legacy_check() option(ENABLE_SERVICE_UPDATES "Checks for service updates" OFF) set(RTMP_SERVICES_URL "https://obsproject.com/obs2_update/rtmp-services" CACHE STRING "Default services package URL" FORCE) - mark_as_advanced(RTMP_SERVICES_URL) +if(NOT TARGET OBS::file-updater) + add_subdirectory("${CMAKE_SOURCE_DIR}/deps/file-updater" "${CMAKE_BINARY_DIR}/deps/file-updater") +endif() + +find_package(jansson REQUIRED) + add_library(rtmp-services MODULE) add_library(OBS::rtmp-services ALIAS rtmp-services) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lookup-config.h.in - ${CMAKE_BINARY_DIR}/config/lookup-config.h) - target_sources( rtmp-services PRIVATE service-specific/twitch.c @@ -29,26 +33,17 @@ target_sources( rtmp-common.c rtmp-custom.c rtmp-services-main.c - rtmp-format-ver.h - ${CMAKE_BINARY_DIR}/config/lookup-config.h) + rtmp-format-ver.h) -target_include_directories(rtmp-services PRIVATE ${CMAKE_BINARY_DIR}/config) +target_compile_definitions(rtmp-services PRIVATE RTMP_SERVICES_URL="${RTMP_SERVICES_URL}" + $<$:ENABLE_SERVICE_UPDATES>) -target_link_libraries(rtmp-services PRIVATE OBS::libobs OBS::file-updater - Jansson::Jansson) +target_link_libraries(rtmp-services PRIVATE OBS::libobs OBS::file-updater jansson::jansson) if(OS_WINDOWS) - set(MODULE_DESCRIPTION "OBS RTMP Services") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - rtmp-services.rc) - + configure_file(cmake/windows/obs-module.rc.in rtmp-services.rc) target_sources(rtmp-services PRIVATE rtmp-services.rc) - - if(MSVC) - target_link_options(rtmp-services PRIVATE "LINKER:/IGNORE:4098") - endif() + target_link_options(rtmp-services PRIVATE /IGNORE:4098) endif() -set_target_properties(rtmp-services PROPERTIES FOLDER "plugins" PREFIX "") - -setup_plugin_target(rtmp-services) +set_target_properties_obs(rtmp-services PROPERTIES FOLDER plugins PREFIX "") diff --git a/plugins/rtmp-services/cmake/legacy.cmake b/plugins/rtmp-services/cmake/legacy.cmake new file mode 100644 index 000000000..addac0f1c --- /dev/null +++ b/plugins/rtmp-services/cmake/legacy.cmake @@ -0,0 +1,51 @@ +project(rtmp-services) + +option(ENABLE_SERVICE_UPDATES "Checks for service updates" OFF) + +set(RTMP_SERVICES_URL + "https://obsproject.com/obs2_update/rtmp-services" + CACHE STRING "Default services package URL" FORCE) + +mark_as_advanced(RTMP_SERVICES_URL) + +add_library(rtmp-services MODULE) +add_library(OBS::rtmp-services ALIAS rtmp-services) + +target_sources( + rtmp-services + PRIVATE service-specific/twitch.c + service-specific/twitch.h + service-specific/younow.c + service-specific/younow.h + service-specific/nimotv.c + service-specific/nimotv.h + service-specific/showroom.c + service-specific/showroom.h + service-specific/dacast.c + service-specific/dacast.h + rtmp-common.c + rtmp-custom.c + rtmp-services-main.c + rtmp-format-ver.h) + +target_compile_definitions(rtmp-services PRIVATE RTMP_SERVICES_URL="${RTMP_SERVICES_URL}" + $<$:ENABLE_SERVICE_UPDATES>) + +target_include_directories(rtmp-services PRIVATE ${CMAKE_BINARY_DIR}/config) + +target_link_libraries(rtmp-services PRIVATE OBS::libobs OBS::file-updater Jansson::Jansson) + +if(OS_WINDOWS) + set(MODULE_DESCRIPTION "OBS RTMP Services") + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in rtmp-services.rc) + + target_sources(rtmp-services PRIVATE rtmp-services.rc) + + if(MSVC) + target_link_options(rtmp-services PRIVATE "LINKER:/IGNORE:4098") + endif() +endif() + +set_target_properties(rtmp-services PROPERTIES FOLDER "plugins" PREFIX "") + +setup_plugin_target(rtmp-services) diff --git a/plugins/rtmp-services/cmake/macos/Info.plist.in b/plugins/rtmp-services/cmake/macos/Info.plist.in new file mode 100644 index 000000000..1eab50939 --- /dev/null +++ b/plugins/rtmp-services/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + rtmp-services + CFBundleIdentifier + com.obsproject.rtmp-services + CFBundleVersion + ${MACOSX_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + rtmp-services + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/plugins/rtmp-services/cmake/windows/obs-module.rc.in b/plugins/rtmp-services/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..fb045d675 --- /dev/null +++ b/plugins/rtmp-services/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS RTMP Services" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "rtmp-services" + VALUE "OriginalFilename", "rtmp-services" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/plugins/rtmp-services/rtmp-services-main.c b/plugins/rtmp-services/rtmp-services-main.c index 56ddf0616..eeb75d78f 100644 --- a/plugins/rtmp-services/rtmp-services-main.c +++ b/plugins/rtmp-services/rtmp-services-main.c @@ -6,7 +6,6 @@ #include #include "rtmp-format-ver.h" -#include "lookup-config.h" #include "service-specific/showroom.h" #include "service-specific/dacast.h" diff --git a/plugins/text-freetype2/CMakeLists.txt b/plugins/text-freetype2/CMakeLists.txt index 3e6a26059..65ca8fd20 100644 --- a/plugins/text-freetype2/CMakeLists.txt +++ b/plugins/text-freetype2/CMakeLists.txt @@ -1,9 +1,11 @@ -project(text-freetype2) +cmake_minimum_required(VERSION 3.16...3.25) + +legacy_check() option(ENABLE_FREETYPE "Enable FreeType text plugin" ON) if(NOT ENABLE_FREETYPE) - obs_status(DISABLED "text-freetype2") + target_disable(text-freetype2) return() endif() @@ -12,40 +14,26 @@ find_package(Freetype REQUIRED) add_library(text-freetype2 MODULE) add_library(OBS::text-freetype2 ALIAS text-freetype2) -target_sources( - text-freetype2 PRIVATE find-font.h obs-convenience.c text-functionality.c - text-freetype2.c obs-convenience.h text-freetype2.h) - +target_sources(text-freetype2 PRIVATE find-font.h obs-convenience.c text-functionality.c text-freetype2.c + obs-convenience.h text-freetype2.h) target_link_libraries(text-freetype2 PRIVATE OBS::libobs Freetype::Freetype) -set_target_properties(text-freetype2 PROPERTIES FOLDER "plugins" PREFIX "") - if(OS_WINDOWS) - set(MODULE_DESCRIPTION "OBS FreeType text module") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - text-freetype2.rc) - - target_sources(text-freetype2 PRIVATE find-font.c find-font-windows.c - text-freetype2.rc) - target_link_options(text-freetype2 PRIVATE "LINKER:/IGNORE:4098" - "LINKER:/IGNORE:4099") - + configure_file(cmake/windows/obs-module.rc.in text-freetype2.rc) + target_sources(text-freetype2 PRIVATE find-font.c find-font-windows.c text-freetype2.rc) + target_link_options(text-freetype2 PRIVATE /IGNORE:4098 /IGNORE:4099) elseif(OS_MACOS) find_package(Iconv REQUIRED) find_library(COCOA Cocoa) mark_as_advanced(COCOA) - target_sources(text-freetype2 PRIVATE find-font.c find-font-cocoa.m - find-font-iconv.c) - + target_sources(text-freetype2 PRIVATE find-font.c find-font-cocoa.m find-font-iconv.c) target_link_libraries(text-freetype2 PRIVATE Iconv::Iconv ${COCOA}) - -elseif(OS_POSIX) +elseif(OS_LINUX OR OS_FREEBSD) find_package(Fontconfig REQUIRED) target_sources(text-freetype2 PRIVATE find-font-unix.c) - target_link_libraries(text-freetype2 PRIVATE Fontconfig::Fontconfig) endif() -setup_plugin_target(text-freetype2) +set_target_properties_obs(text-freetype2 PROPERTIES FOLDER plugins PREFIX "") diff --git a/plugins/text-freetype2/cmake/legacy.cmake b/plugins/text-freetype2/cmake/legacy.cmake new file mode 100644 index 000000000..598ef81a9 --- /dev/null +++ b/plugins/text-freetype2/cmake/legacy.cmake @@ -0,0 +1,46 @@ +project(text-freetype2) + +option(ENABLE_FREETYPE "Enable FreeType text plugin" ON) + +if(NOT ENABLE_FREETYPE) + obs_status(DISABLED "text-freetype2") + return() +endif() + +find_package(Freetype REQUIRED) + +add_library(text-freetype2 MODULE) +add_library(OBS::text-freetype2 ALIAS text-freetype2) + +target_sources(text-freetype2 PRIVATE find-font.h obs-convenience.c text-functionality.c text-freetype2.c + obs-convenience.h text-freetype2.h) + +target_link_libraries(text-freetype2 PRIVATE OBS::libobs Freetype::Freetype) + +set_target_properties(text-freetype2 PROPERTIES FOLDER "plugins" PREFIX "") + +if(OS_WINDOWS) + set(MODULE_DESCRIPTION "OBS FreeType text module") + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in text-freetype2.rc) + + target_sources(text-freetype2 PRIVATE find-font.c find-font-windows.c text-freetype2.rc) + target_link_options(text-freetype2 PRIVATE "LINKER:/IGNORE:4098" "LINKER:/IGNORE:4099") + +elseif(OS_MACOS) + find_package(Iconv REQUIRED) + find_library(COCOA Cocoa) + mark_as_advanced(COCOA) + + target_sources(text-freetype2 PRIVATE find-font.c find-font-cocoa.m find-font-iconv.c) + + target_link_libraries(text-freetype2 PRIVATE Iconv::Iconv ${COCOA}) + +elseif(OS_POSIX) + find_package(Fontconfig REQUIRED) + + target_sources(text-freetype2 PRIVATE find-font-unix.c) + + target_link_libraries(text-freetype2 PRIVATE Fontconfig::Fontconfig) +endif() + +setup_plugin_target(text-freetype2) diff --git a/plugins/text-freetype2/cmake/macos/Info.plist.in b/plugins/text-freetype2/cmake/macos/Info.plist.in new file mode 100644 index 000000000..75942aecc --- /dev/null +++ b/plugins/text-freetype2/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + text-freetype2 + CFBundleIdentifier + com.obsproject.text-freetype2 + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + text-freetype2 + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/plugins/text-freetype2/cmake/windows/obs-module.rc.in b/plugins/text-freetype2/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..fcac97dd2 --- /dev/null +++ b/plugins/text-freetype2/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS FreeType text module" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "text-freetype2" + VALUE "OriginalFilename", "text-freetype2" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/plugins/text-freetype2/find-font.h b/plugins/text-freetype2/find-font.h index 43a003fe0..3b4eba208 100644 --- a/plugins/text-freetype2/find-font.h +++ b/plugins/text-freetype2/find-font.h @@ -7,6 +7,7 @@ #include #include +#include struct font_path_info { char *face_and_style; diff --git a/plugins/vlc-video/CMakeLists.txt b/plugins/vlc-video/CMakeLists.txt index f1f66c98a..fb4e5b0b1 100644 --- a/plugins/vlc-video/CMakeLists.txt +++ b/plugins/vlc-video/CMakeLists.txt @@ -1,38 +1,44 @@ -project(vlc-video) +cmake_minimum_required(VERSION 3.16...3.25) -option(ENABLE_VLC "Build OBS with VLC plugin support" ${OS_LINUX}) +legacy_check() + +macro(check_vlc_path) + if(OS_WINDOWS OR OS_MACOS) + if(NOT EXISTS "${VLC_PATH}/include/vlc/libvlc.h") + message(FATAL_ERROR "Unable to find libvlc.h. Check if VLC_PATH set correctly.") + endif() + + target_include_directories(vlc-video PRIVATE "${VLC_PATH}/include/vlc") + elseif(OS_LINUX OR OS_FREEBSD) + find_package(PkgConfig QUIET) + if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_Libvlc QUIET libvlc) + endif() + + if(PC_Libvlc_INCLUDEDIR) + target_include_directories(vlc-video PRIVATE "${PC_Libvlc_INCLUDEDIR}/vlc") + endif() + endif() +endmacro() + +option(ENABLE_VLC "Build OBS with VLC plugin support" ON) if(NOT ENABLE_VLC) - obs_status(DISABLED "vlc-video") - obs_status( - WARNING - "VLC plugin supported is not enabled by default - please switch ENABLE_VLC to ON to enable this functionality." - ) + target_disable(vlc-video) return() endif() -find_package(LibVLC REQUIRED) - add_library(vlc-video MODULE) add_library(OBS::vlc-video ALIAS vlc-video) -target_sources(vlc-video PRIVATE vlc-video-plugin.c vlc-video-plugin.h - vlc-video-source.c) - -target_link_libraries(vlc-video PRIVATE OBS::libobs VLC::LibVLC) +target_sources(vlc-video PRIVATE vlc-video-plugin.c vlc-video-plugin.h vlc-video-source.c) +target_link_libraries(vlc-video PRIVATE OBS::libobs) +check_vlc_path() if(OS_WINDOWS) - if(MSVC) - target_link_libraries(vlc-video PRIVATE OBS::w32-pthreads) - endif() - - set(MODULE_DESCRIPTION "OBS VLC Plugin") - configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - vlc-video.rc) + target_link_libraries(vlc-video PRIVATE OBS::w32-pthreads) + configure_file(cmake/windows/obs-module.rc.in vlc-video.rc) target_sources(vlc-video PRIVATE vlc-video.rc) - endif() -set_target_properties(vlc-video PROPERTIES FOLDER "plugins" PREFIX "") - -setup_plugin_target(vlc-video) +set_target_properties_obs(vlc-video PROPERTIES FOLDER plugins PREFIX "") diff --git a/plugins/vlc-video/cmake/legacy.cmake b/plugins/vlc-video/cmake/legacy.cmake new file mode 100644 index 000000000..c7fd1bdc0 --- /dev/null +++ b/plugins/vlc-video/cmake/legacy.cmake @@ -0,0 +1,35 @@ +project(vlc-video) + +option(ENABLE_VLC "Build OBS with VLC plugin support" ${OS_LINUX}) +if(NOT ENABLE_VLC) + obs_status(DISABLED "vlc-video") + obs_status( + WARNING + "VLC plugin supported is not enabled by default - please switch ENABLE_VLC to ON to enable this functionality.") + return() +endif() + +find_package(LibVLC REQUIRED) + +add_library(vlc-video MODULE) +add_library(OBS::vlc-video ALIAS vlc-video) + +target_sources(vlc-video PRIVATE vlc-video-plugin.c vlc-video-plugin.h vlc-video-source.c) + +target_link_libraries(vlc-video PRIVATE OBS::libobs VLC::LibVLC) + +if(OS_WINDOWS) + if(MSVC) + target_link_libraries(vlc-video PRIVATE OBS::w32-pthreads) + endif() + + set(MODULE_DESCRIPTION "OBS VLC Plugin") + configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in vlc-video.rc) + + target_sources(vlc-video PRIVATE vlc-video.rc) + +endif() + +set_target_properties(vlc-video PROPERTIES FOLDER "plugins" PREFIX "") + +setup_plugin_target(vlc-video) diff --git a/plugins/vlc-video/cmake/macos/Info.plist.in b/plugins/vlc-video/cmake/macos/Info.plist.in new file mode 100644 index 000000000..4d37677e1 --- /dev/null +++ b/plugins/vlc-video/cmake/macos/Info.plist.in @@ -0,0 +1,28 @@ + + + + + CFBundleName + vlc-video + CFBundleIdentifier + com.obsproject.vlc-video + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + vlc-video + CFBundlePackageType + BNDL + CFBundleSupportedPlatforms + + MacOSX + + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + (c) 2012-${CURRENT_YEAR} Hugh Bailey + + diff --git a/plugins/vlc-video/cmake/windows/obs-module.rc.in b/plugins/vlc-video/cmake/windows/obs-module.rc.in new file mode 100644 index 000000000..1ed464afe --- /dev/null +++ b/plugins/vlc-video/cmake/windows/obs-module.rc.in @@ -0,0 +1,24 @@ +1 VERSIONINFO +FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${OBS_COMPANY_NAME}" + VALUE "FileDescription", "OBS VLC Plugin" + VALUE "FileVersion", "${OBS_VERSION_CANONICAL}" + VALUE "ProductName", "${OBS_PRODUCT_NAME}" + VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}" + VALUE "Comments", "${OBS_COMMENTS}" + VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}" + VALUE "InternalName", "vlc-video" + VALUE "OriginalFilename", "vlc-video" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END diff --git a/plugins/win-capture/CMakeLists.txt b/plugins/win-capture/CMakeLists.txt index db0cd7594..b366835b5 100644 --- a/plugins/win-capture/CMakeLists.txt +++ b/plugins/win-capture/CMakeLists.txt @@ -11,8 +11,7 @@ mark_as_advanced(COMPAT_URL) add_library(win-capture MODULE) add_library(OBS::capture ALIAS win-capture) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/compat-config.h.in - ${CMAKE_BINARY_DIR}/config/compat-config.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/compat-config.h.in ${CMAKE_BINARY_DIR}/config/compat-config.h) target_sources( win-capture @@ -43,8 +42,7 @@ target_sources( ../../libobs/util/windows/obfuscate.h ${CMAKE_BINARY_DIR}/config/compat-config.h) -target_link_libraries(win-capture PRIVATE OBS::libobs OBS::ipc-util - OBS::file-updater Jansson::Jansson) +target_link_libraries(win-capture PRIVATE OBS::libobs OBS::ipc-util OBS::file-updater Jansson::Jansson) set_target_properties(win-capture PROPERTIES FOLDER "plugins/win-capture") @@ -53,9 +51,7 @@ if(MSVC) target_link_options(win-capture PRIVATE "LINKER:/IGNORE:4098") endif() -target_compile_definitions( - win-capture PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS - _CRT_NONSTDC_NO_WARNINGS) +target_compile_definitions(win-capture PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS) set_property(GLOBAL APPEND PROPERTY OBS_MODULE_LIST "win-capture") diff --git a/plugins/win-capture/get-graphics-offsets/CMakeLists.txt b/plugins/win-capture/get-graphics-offsets/CMakeLists.txt index 8e0bbb92d..18afdc3e5 100644 --- a/plugins/win-capture/get-graphics-offsets/CMakeLists.txt +++ b/plugins/win-capture/get-graphics-offsets/CMakeLists.txt @@ -12,23 +12,17 @@ target_sources( ../graphics-hook-info.h ../hook-helpers.h) -target_include_directories(get-graphics-offsets - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..) +target_include_directories(get-graphics-offsets PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..) target_link_libraries(get-graphics-offsets d3d9.lib dxgi.lib d3d11.lib) if(MSVC) - target_compile_options(get-graphics-offsets - PRIVATE "$,/MTd,/MT>") + target_compile_options(get-graphics-offsets PRIVATE "$,/MTd,/MT>") endif() -set_target_properties(get-graphics-offsets PROPERTIES FOLDER - "plugins/win-capture") -set_target_properties( - get-graphics-offsets - PROPERTIES OUTPUT_NAME - "get-graphics-offsets$,64,32>" -) +set_target_properties(get-graphics-offsets PROPERTIES FOLDER "plugins/win-capture") +set_target_properties(get-graphics-offsets + PROPERTIES OUTPUT_NAME "get-graphics-offsets$,64,32>") set(OBS_PLUGIN_DESTINATION "${OBS_DATA_DESTINATION}/obs-plugins/win-capture/") setup_plugin_target(get-graphics-offsets) diff --git a/plugins/win-capture/graphics-hook/CMakeLists.txt b/plugins/win-capture/graphics-hook/CMakeLists.txt index 10cf8762a..fcc833aac 100644 --- a/plugins/win-capture/graphics-hook/CMakeLists.txt +++ b/plugins/win-capture/graphics-hook/CMakeLists.txt @@ -28,19 +28,15 @@ target_sources( target_include_directories(graphics-hook PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..) -target_link_libraries(graphics-hook PRIVATE OBS::ipc-util Detours::Detours - dxguid) +target_link_libraries(graphics-hook PRIVATE OBS::ipc-util Detours::Detours dxguid) target_link_options(graphics-hook PRIVATE "LINKER:/IGNORE:4099") if(MSVC) target_compile_options(graphics-hook PRIVATE "$,/MTd,/MT>") endif() -set_target_properties( - graphics-hook - PROPERTIES FOLDER "plugins/win-capture" - OUTPUT_NAME - "graphics-hook$,64,32>") +set_target_properties(graphics-hook PROPERTIES FOLDER "plugins/win-capture" + OUTPUT_NAME "graphics-hook$,64,32>") target_compile_definitions(graphics-hook PRIVATE COMPILE_D3D12_HOOK) @@ -51,12 +47,8 @@ if(TARGET Vulkan::Vulkan) target_compile_definitions(graphics-hook PRIVATE COMPILE_VULKAN_HOOK) - add_target_resource( - graphics-hook "${CMAKE_CURRENT_SOURCE_DIR}/obs-vulkan64.json" - "obs-plugins/win-capture/") - add_target_resource( - graphics-hook "${CMAKE_CURRENT_SOURCE_DIR}/obs-vulkan32.json" - "obs-plugins/win-capture/") + add_target_resource(graphics-hook "${CMAKE_CURRENT_SOURCE_DIR}/obs-vulkan64.json" "obs-plugins/win-capture/") + add_target_resource(graphics-hook "${CMAKE_CURRENT_SOURCE_DIR}/obs-vulkan32.json" "obs-plugins/win-capture/") endif() set(OBS_PLUGIN_DESTINATION "${OBS_DATA_DESTINATION}/obs-plugins/win-capture/") diff --git a/plugins/win-capture/inject-helper/CMakeLists.txt b/plugins/win-capture/inject-helper/CMakeLists.txt index 5094260f9..b212bc237 100644 --- a/plugins/win-capture/inject-helper/CMakeLists.txt +++ b/plugins/win-capture/inject-helper/CMakeLists.txt @@ -2,11 +2,8 @@ project(inject-helper) add_executable(inject-helper) -target_sources( - inject-helper - PRIVATE inject-helper.c ../inject-library.c ../inject-library.h - ../../../libobs/util/windows/obfuscate.c - ../../../libobs/util/windows/obfuscate.h) +target_sources(inject-helper PRIVATE inject-helper.c ../inject-library.c ../inject-library.h + ../../../libobs/util/windows/obfuscate.c ../../../libobs/util/windows/obfuscate.h) target_include_directories(inject-helper PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..) @@ -14,11 +11,8 @@ if(MSVC) target_compile_options(inject-helper PRIVATE "$,/MTd,/MT>") endif() -set_target_properties( - inject-helper - PROPERTIES FOLDER "plugins/win-capture" - OUTPUT_NAME - "inject-helper$,64,32>") +set_target_properties(inject-helper PROPERTIES FOLDER "plugins/win-capture" + OUTPUT_NAME "inject-helper$,64,32>") set(OBS_PLUGIN_DESTINATION "${OBS_DATA_DESTINATION}/obs-plugins/win-capture/") setup_plugin_target(inject-helper) diff --git a/plugins/win-dshow/CMakeLists.txt b/plugins/win-dshow/CMakeLists.txt index 2ad0b8d0e..d39b273f5 100644 --- a/plugins/win-dshow/CMakeLists.txt +++ b/plugins/win-dshow/CMakeLists.txt @@ -1,8 +1,5 @@ if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libdshowcapture/dshowcapture.hpp") - obs_status( - FATAL_ERROR - "libdshowcapture submodule not found! Please fetch submodules. win-dshow plugin disabled." - ) + obs_status(FATAL_ERROR "libdshowcapture submodule not found! Please fetch submodules. win-dshow plugin disabled.") return() endif() @@ -26,9 +23,8 @@ find_package(FFmpeg REQUIRED COMPONENTS avcodec avutil) add_library(win-dshow MODULE) add_library(OBS::dshow ALIAS win-dshow) -target_sources( - win-dshow PRIVATE encode-dstr.hpp win-dshow.cpp win-dshow-encoder.cpp - dshow-plugin.cpp ffmpeg-decode.c ffmpeg-decode.h) +target_sources(win-dshow PRIVATE encode-dstr.hpp win-dshow.cpp win-dshow-encoder.cpp dshow-plugin.cpp ffmpeg-decode.c + ffmpeg-decode.h) add_library(libdshowcapture-external INTERFACE) add_library(libdshowcapture INTERFACE) @@ -37,12 +33,10 @@ add_library(OBS::libdshowcapture ALIAS libdshowcapture) target_sources( libdshowcapture-external - INTERFACE - libdshowcapture/external/capture-device-support/Library/EGAVResult.cpp - libdshowcapture/external/capture-device-support/Library/ElgatoUVCDevice.cpp - libdshowcapture/external/capture-device-support/Library/win/EGAVHIDImplementation.cpp - libdshowcapture/external/capture-device-support/SampleCode/DriverInterface.cpp -) + INTERFACE libdshowcapture/external/capture-device-support/Library/EGAVResult.cpp + libdshowcapture/external/capture-device-support/Library/ElgatoUVCDevice.cpp + libdshowcapture/external/capture-device-support/Library/win/EGAVHIDImplementation.cpp + libdshowcapture/external/capture-device-support/SampleCode/DriverInterface.cpp) target_sources( libdshowcapture @@ -75,11 +69,8 @@ target_sources( libdshowcapture/source/external/IVideoCaptureFilter.h) target_include_directories( - libdshowcapture - INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR}/libdshowcapture - ${CMAKE_CURRENT_SOURCE_DIR}/libdshowcapture/external/capture-device-support/Library -) + libdshowcapture INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/libdshowcapture + ${CMAKE_CURRENT_SOURCE_DIR}/libdshowcapture/external/capture-device-support/Library) target_compile_definitions(libdshowcapture-external INTERFACE _UP_WINDOWS=1) target_compile_definitions(libdshowcapture INTERFACE _UP_WINDOWS=1) @@ -87,22 +78,16 @@ target_compile_options(libdshowcapture-external INTERFACE /wd4018) set(MODULE_DESCRIPTION "OBS DirectShow module") -configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - win-dshow.rc) +configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in win-dshow.rc) target_sources(win-dshow PRIVATE win-dshow.rc) -target_compile_definitions( - win-dshow PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS - _CRT_NONSTDC_NO_WARNINGS) +target_compile_definitions(win-dshow PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS) set(VIRTUALCAM_AVAILABLE OFF) if(ENABLE_VIRTUALCAM) if(VIRTUALCAM_GUID STREQUAL "") - obs_status( - WARNING - "Windows Virtual Camera - GUID not set - specify as 'VIRTUALCAM_GUID' to enable." - ) + obs_status(WARNING "Windows Virtual Camera - GUID not set. Specify as 'VIRTUALCAM_GUID' to enable.") else() set(INVALID_GUID ON) @@ -167,12 +152,10 @@ target_link_libraries( source_group( "libdshowcapture-external\\Source Files" - FILES - libdshowcapture/external/capture-device-support/Library/EGAVResult.cpp - libdshowcapture/external/capture-device-support/Library/ElgatoUVCDevice.cpp - libdshowcapture/external/capture-device-support/Library/win/EGAVHIDImplementation.cpp - libdshowcapture/external/capture-device-support/SampleCode/DriverInterface.cpp -) + FILES libdshowcapture/external/capture-device-support/Library/EGAVResult.cpp + libdshowcapture/external/capture-device-support/Library/ElgatoUVCDevice.cpp + libdshowcapture/external/capture-device-support/Library/win/EGAVHIDImplementation.cpp + libdshowcapture/external/capture-device-support/SampleCode/DriverInterface.cpp) source_group( "libdshowcapture\\Source Files" FILES libdshowcapture/source/capture-filter.cpp @@ -210,33 +193,23 @@ set_target_properties(win-dshow PROPERTIES FOLDER "plugins/win-dshow") setup_plugin_target(win-dshow) if(ENABLE_VIRTUALCAM AND VIRTUALCAM_AVAILABLE) - target_sources( - win-dshow PRIVATE tiny-nv12-scale.c tiny-nv12-scale.h shared-memory-queue.c - shared-memory-queue.h virtualcam.c) + target_sources(win-dshow PRIVATE tiny-nv12-scale.c tiny-nv12-scale.h shared-memory-queue.c shared-memory-queue.h + virtualcam.c) target_compile_definitions(win-dshow PRIVATE VIRTUALCAM_AVAILABLE) - target_include_directories(win-dshow - PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/config) + target_include_directories(win-dshow PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/config) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/virtualcam-guid.h.in - ${CMAKE_CURRENT_BINARY_DIR}/config/virtualcam-guid.h) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/virtualcam-guid.h.in ${CMAKE_CURRENT_BINARY_DIR}/config/virtualcam-guid.h) - target_sources(win-dshow - PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/config/virtualcam-guid.h) + target_sources(win-dshow PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/config/virtualcam-guid.h) - configure_file(virtualcam-install.bat.in - "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-install.bat") + configure_file(virtualcam-install.bat.in "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-install.bat") - configure_file(virtualcam-uninstall.bat.in - "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-uninstall.bat") + configure_file(virtualcam-uninstall.bat.in "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-uninstall.bat") - add_target_resource( - win-dshow "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-install.bat" - "obs-plugins/win-dshow/") - add_target_resource( - win-dshow "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-uninstall.bat" - "obs-plugins/win-dshow/") + add_target_resource(win-dshow "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-install.bat" "obs-plugins/win-dshow/") + add_target_resource(win-dshow "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-uninstall.bat" "obs-plugins/win-dshow/") add_subdirectory(virtualcam-module) endif() diff --git a/plugins/win-dshow/virtualcam-module/CMakeLists.txt b/plugins/win-dshow/virtualcam-module/CMakeLists.txt index 390c3a034..6898c74c7 100644 --- a/plugins/win-dshow/virtualcam-module/CMakeLists.txt +++ b/plugins/win-dshow/virtualcam-module/CMakeLists.txt @@ -24,51 +24,36 @@ target_sources( ../tiny-nv12-scale.c ../tiny-nv12-scale.h) -target_include_directories(obs-virtualcam-module - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..) +target_include_directories(obs-virtualcam-module PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..) set(MODULE_DESCRIPTION "OBS Virtual Camera output module") -configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - virtualcam-module.rc) +configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in virtualcam-module.rc) target_sources(obs-virtualcam-module PRIVATE virtualcam-module.rc) -target_link_libraries( - obs-virtualcam-module - PRIVATE OBS::libdshowcapture OBS::libdshowcapture-external setupapi winmm - strmiids gdiplus) +target_link_libraries(obs-virtualcam-module PRIVATE OBS::libdshowcapture OBS::libdshowcapture-external setupapi winmm + strmiids gdiplus) target_link_options(obs-virtualcam-module PRIVATE "LINKER:/ignore:4104") -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/virtualcam-module.def.in - ${CMAKE_CURRENT_BINARY_DIR}/virtualcam-module.def) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/virtualcam-module.def.in ${CMAKE_CURRENT_BINARY_DIR}/virtualcam-module.def) -target_sources(obs-virtualcam-module - PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/virtualcam-module.def) +target_sources(obs-virtualcam-module PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/virtualcam-module.def) -target_include_directories(obs-virtualcam-module - PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../config) +target_include_directories(obs-virtualcam-module PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../config) -target_compile_definitions( - obs-virtualcam-module - PRIVATE VIRTUALCAM_AVAILABLE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS - _CRT_NONSTDC_NO_WARNINGS) +target_compile_definitions(obs-virtualcam-module PRIVATE VIRTUALCAM_AVAILABLE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS + _CRT_NONSTDC_NO_WARNINGS) if(MSVC) - target_compile_options(obs-virtualcam-module - PRIVATE "$,/MTd,/MT>") - add_target_resource(win-dshow "$" - "obs-plugins/win-dshow/" OPTIONAL) + target_compile_options(obs-virtualcam-module PRIVATE "$,/MTd,/MT>") + add_target_resource(win-dshow "$" "obs-plugins/win-dshow/" OPTIONAL) endif() -set_target_properties(obs-virtualcam-module PROPERTIES FOLDER - "plugins/win-dshow") +set_target_properties(obs-virtualcam-module PROPERTIES FOLDER "plugins/win-dshow") -set_target_properties( - obs-virtualcam-module PROPERTIES OUTPUT_NAME - "obs-virtualcam-module${_output_suffix}") +set_target_properties(obs-virtualcam-module PROPERTIES OUTPUT_NAME "obs-virtualcam-module${_output_suffix}") -add_target_resource(win-dshow "$" - "obs-plugins/win-dshow/") +add_target_resource(win-dshow "$" "obs-plugins/win-dshow/") diff --git a/plugins/win-wasapi/CMakeLists.txt b/plugins/win-wasapi/CMakeLists.txt index f60392bc7..bed4677cc 100644 --- a/plugins/win-wasapi/CMakeLists.txt +++ b/plugins/win-wasapi/CMakeLists.txt @@ -3,13 +3,11 @@ project(win-wasapi) add_library(win-wasapi MODULE) add_library(OBS::wasapi ALIAS win-wasapi) -target_sources(win-wasapi PRIVATE win-wasapi.cpp enum-wasapi.cpp - enum-wasapi.hpp plugin-main.cpp) +target_sources(win-wasapi PRIVATE win-wasapi.cpp enum-wasapi.cpp enum-wasapi.hpp plugin-main.cpp) set(MODULE_DESCRIPTION "OBS WASAPI module") -configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in - win-wasapi.rc) +configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in win-wasapi.rc) target_sources(win-wasapi PRIVATE win-wasapi.rc)