UI: Update CMakeLists.txt for main OBS app

master
PatTheMav 2022-03-16 23:11:58 +01:00
parent 1fd7770548
commit 1f0f2be15e
No known key found for this signature in database
GPG Key ID: CEFD5D83C12A66B3
21 changed files with 853 additions and 1020 deletions

View File

@ -1,502 +1,413 @@
if(DISABLE_UI)
message(STATUS "UI disabled")
return()
elseif(ENABLE_UI)
set(FIND_MODE REQUIRED)
else()
set(FIND_MODE QUIET)
endif()
if(BROWSER_AVAILABLE_INTERNAL)
add_definitions(-DBROWSER_AVAILABLE)
endif()
add_subdirectory(obs-frontend-api) add_subdirectory(obs-frontend-api)
# ---------------------------------------------------------------------------- option(ENABLE_UI "Enable building with UI (requires Qt)" ON)
if(NOT ENABLE_UI)
message(STATUS "OBS: DISABLED OBS UI")
return()
endif()
if(NOT QT_VERSION)
set(QT_VERSION
"5"
CACHE STRING "OBS Qt version [5, 6]" FORCE)
set_property(CACHE QT_VERSION PROPERTY STRINGS 5 6)
endif()
project(obs) project(obs)
set(DISABLE_UPDATE_MODULE TRUE CACHE BOOL "Disables building the update module") # 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)
if(NOT DEFINED TWITCH_CLIENTID OR "${TWITCH_CLIENTID}" STREQUAL "" OR target_include_directories(
NOT DEFINED TWITCH_HASH OR "${TWITCH_HASH}" STREQUAL "" OR obs-browser-panels INTERFACE ${CMAKE_SOURCE_DIR}/plugins/obs-browser/panel)
NOT BROWSER_AVAILABLE_INTERNAL) endif()
set(TWITCH_ENABLED FALSE)
set(TWITCH_CLIENTID "") if(NOT DEFINED TWITCH_CLIENTID
set(TWITCH_HASH "0") 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() else()
set(TWITCH_ENABLED TRUE) set(TWITCH_ENABLED ON)
endif() endif()
if(NOT DEFINED RESTREAM_CLIENTID OR "${RESTREAM_CLIENTID}" STREQUAL "" OR if(NOT DEFINED RESTREAM_CLIENTID
NOT DEFINED RESTREAM_HASH OR "${RESTREAM_HASH}" STREQUAL "" OR OR "${RESTREAM_CLIENTID}" STREQUAL ""
NOT BROWSER_AVAILABLE_INTERNAL) OR NOT DEFINED RESTREAM_HASH
set(RESTREAM_ENABLED FALSE) OR "${RESTREAM_HASH}" STREQUAL ""
set(RESTREAM_CLIENTID "") OR NOT TARGET OBS::browser-panels)
set(RESTREAM_HASH "0") set(RESTREAM_ENABLED OFF)
set(RESTREAM_CLIENTID "")
set(RESTREAM_HASH "0")
else() else()
set(RESTREAM_ENABLED TRUE) set(RESTREAM_ENABLED ON)
endif() endif()
if(DEFINED ENV{YOUTUBE_CLIENTID} AND NOT DEFINED YOUTUBE_CLIENTID) if(NOT DEFINED YOUTUBE_CLIENTID
set(YOUTUBE_CLIENTID "$ENV{YOUTUBE_CLIENTID}") OR "${YOUTUBE_CLIENTID}" STREQUAL ""
endif() OR NOT DEFINED YOUTUBE_SECRET
if(DEFINED ENV{YOUTUBE_CLIENTID_HASH} AND NOT DEFINED YOUTUBE_CLIENTID_HASH) OR "${YOUTUBE_SECRET}" STREQUAL ""
set(YOUTUBE_CLIENTID_HASH "$ENV{YOUTUBE_CLIENTID_HASH}") OR NOT DEFINED YOUTUBE_CLIENTID_HASH
endif() OR "${YOUTUBE_CLIENTID_HASH}" STREQUAL ""
if(DEFINED ENV{YOUTUBE_SECRET} AND NOT DEFINED YOUTUBE_SECRET) OR NOT DEFINED YOUTUBE_SECRET_HASH
set(YOUTUBE_SECRET "$ENV{YOUTUBE_SECRET}") OR "${YOUTUBE_SECRET_HASH}" STREQUAL "")
endif() set(YOUTUBE_ENABLED OFF)
if(DEFINED ENV{YOUTUBE_SECRET_HASH} AND NOT DEFINED YOUTUBE_SECRET_HASH)
set(YOUTUBE_SECRET_HASH "$ENV{YOUTUBE_SECRET_HASH}")
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 FALSE)
else() else()
set(YOUTUBE_ENABLED TRUE) set(YOUTUBE_ENABLED ON)
endif() endif()
configure_file( configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ui-config.h.in
"${CMAKE_CURRENT_SOURCE_DIR}/ui-config.h.in" ${CMAKE_CURRENT_BINARY_DIR}/ui-config.h)
"${CMAKE_CURRENT_BINARY_DIR}/ui-config.h")
set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
set(CMAKE_AUTOMOC TRUE)
find_package(Threads REQUIRED)
find_package(Qt5Network ${FIND_MODE})
find_package(Qt5Widgets ${FIND_MODE})
find_package(Qt5Svg ${FIND_MODE})
if(WIN32 AND (Qt5Widgets_VERSION VERSION_LESS 6.0.0))
find_package(Qt5WinExtras ${FIND_MODE})
endif()
find_package(Qt5Xml ${FIND_MODE})
find_package(FFmpeg REQUIRED COMPONENTS avcodec avutil avformat) find_package(FFmpeg REQUIRED COMPONENTS avcodec avutil avformat)
find_package(CURL REQUIRED)
if(NOT Qt5Widgets_FOUND) add_subdirectory(frontend-plugins)
if (ENABLE_UI) add_executable(obs)
message(FATAL_ERROR "Failed to find Qt5")
else()
message(STATUS "Qt5 not found - UI disabled")
return()
endif()
endif()
find_qt(
VERSION ${QT_VERSION}
COMPONENTS Widgets Network Svg Xml
COMPONENTS_WIN WinExtras
COMPONENTS_LINUX Gui)
include_directories(${FFMPEG_INCLUDE_DIRS}) target_link_libraries(obs PRIVATE Qt::Widgets Qt::Svg Qt::Xml Qt::Network)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(SYSTEM "obs-frontend-api")
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/libobs")
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/deps/libff")
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/deps/json11")
if(BROWSER_AVAILABLE_INTERNAL)
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/plugins/obs-browser/panel")
endif()
find_package(Libcurl REQUIRED) set_target_properties(
include_directories(${LIBCURL_INCLUDE_DIRS}) obs
add_definitions(${LIBCURL_DEFINITIONS}) PROPERTIES AUTOMOC ON
AUTOUIC ON
AUTORCC ON
AUTOUIC_SEARCH_PATHS "forms;forms/source-toolbar")
if(WIN32) target_include_directories(obs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
include_directories(${BLAKE2_INCLUDE_DIR}) ${CMAKE_CURRENT_BINARY_DIR})
set(obs_PLATFORM_SOURCES target_sources(obs PRIVATE forms/obs.qrc)
platform-windows.cpp
win-update/update-window.cpp
win-update/win-update.cpp
win-update/win-update-helpers.cpp
${obs-studio_BINARY_DIR}/obs.rc)
set(obs_PLATFORM_HEADERS
win-update/update-window.hpp
win-update/win-update.hpp
win-update/win-update-helpers.hpp)
set(obs_PLATFORM_LIBRARIES
crypt32
blake2)
if(CMAKE_SIZEOF_VOID_P EQUAL 4) target_sources(
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") obs
endif() PRIVATE auth-oauth.cpp
elseif(APPLE) auth-oauth.hpp
set(obs_PLATFORM_SOURCES auth-listener.cpp
platform-osx.mm) 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
crash-report.cpp
crash-report.hpp
display-helpers.hpp
platform.hpp
qt-display.cpp
qt-display.hpp
qt-wrappers.cpp
qt-wrappers.hpp
ui-validation.cpp
ui-validation.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)
find_package(AppKit REQUIRED) target_sources(
set(obs_PLATFORM_LIBRARIES ${APPKIT_LIBRARIES}) obs
PRIVATE adv-audio-control.cpp
adv-audio-control.hpp
audio-encoders.cpp
audio-encoders.hpp
balance-slider.hpp
combobox-ignorewheel.cpp
combobox-ignorewheel.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
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
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)
add_definitions(-fobjc-arc) 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-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-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)
option(ENABLE_SPARKLE_UPDATER "Enables updates via the Sparkle framework (don't forget to update the Info.plist for your .app)" OFF) target_sources(
if(ENABLE_SPARKLE_UPDATER) obs
find_library(SPARKLE Sparkle) PRIVATE importers/importers.cpp importers/importers.hpp importers/classic.cpp
include_directories(${SPARKLE}) importers/sl.cpp importers/studio.cpp importers/xsplit.cpp)
set(obs_PLATFORM_SOURCES
${obs_PLATFORM_SOURCES}
sparkle-updater.mm)
set(obs_PLATFORM_LIBRARIES
${obs_PLATFORM_LIBRARIES}
${SPARKLE})
add_definitions(-DUPDATE_SPARKLE=1)
endif()
elseif(UNIX) target_compile_features(obs PRIVATE cxx_std_17)
find_package(Qt5Gui REQUIRED)
find_package(PythonDeps QUIET)
include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS}) target_include_directories(obs PRIVATE ${CMAKE_SOURCE_DIR}/deps/json11
${CMAKE_SOURCE_DIR}/deps/libff)
set(obs_PLATFORM_SOURCES target_link_libraries(
platform-x11.cpp) obs PRIVATE CURL::libcurl FFmpeg::avcodec FFmpeg::avutil FFmpeg::avformat
OBS::libobs OBS::frontend-api)
set(obs_PLATFORM_LIBRARIES
${obs_PLATFORM_LIBRARIES}
Qt5::Gui
Qt5::GuiPrivate)
if("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
list(APPEND obs_PLATFORM_LIBRARIES
procstat)
endif()
endif()
if(BROWSER_AVAILABLE_INTERNAL)
list(APPEND obs_PLATFORM_SOURCES
window-dock-browser.cpp
window-extra-browsers.cpp
)
list(APPEND obs_PLATFORM_HEADERS
window-dock-browser.hpp
window-extra-browsers.hpp
)
if(TWITCH_ENABLED)
list(APPEND obs_PLATFORM_SOURCES
auth-twitch.cpp
)
list(APPEND obs_PLATFORM_HEADERS
auth-twitch.hpp
)
endif()
if(RESTREAM_ENABLED)
list(APPEND obs_PLATFORM_SOURCES
auth-restream.cpp
)
list(APPEND obs_PLATFORM_HEADERS
auth-restream.hpp
)
endif()
endif()
if(YOUTUBE_ENABLED)
list(APPEND obs_PLATFORM_SOURCES
auth-youtube.cpp
youtube-api-wrappers.cpp
)
list(APPEND obs_PLATFORM_HEADERS
auth-youtube.hpp
youtube-api-wrappers.hpp
)
endif()
set(obs_libffutil_SOURCES
../deps/libff/libff/ff-util.c
)
set(obs_libffutil_HEADERS
../deps/libff/libff/ff-util.h
)
if(MSVC)
set_source_files_properties(
../deps/libff/libff/ff-util.c
PROPERTIES COMPILE_FLAGS -Dinline=__inline
)
set(obs_PLATFORM_LIBRARIES
${obs_PLATFORM_LIBRARIES}
w32-pthreads)
endif()
set(obs_SOURCES
${obs_PLATFORM_SOURCES}
${obs_libffutil_SOURCES}
../deps/json11/json11.cpp
obs-app.cpp
window-dock.cpp
api-interface.cpp
window-basic-main.cpp
window-basic-stats.cpp
window-basic-filters.cpp
window-basic-settings.cpp
window-basic-interaction.cpp
window-basic-properties.cpp
window-basic-auto-config.cpp
window-basic-main-outputs.cpp
window-basic-source-select.cpp
window-basic-settings-stream.cpp
window-basic-main-screenshot.cpp
window-basic-auto-config-test.cpp
window-basic-main-scene-collections.cpp
window-basic-main-transitions.cpp
window-basic-main-dropfiles.cpp
window-basic-main-profiles.cpp
window-basic-main-browser.cpp
window-basic-main-icons.cpp
window-basic-status-bar.cpp
window-basic-adv-audio.cpp
window-basic-transform.cpp
window-basic-preview.cpp
window-basic-about.cpp
window-importer.cpp
media-controls.cpp
window-namedialog.cpp
window-log-reply.cpp
window-projector.cpp
window-remux.cpp
window-missing-files.cpp
auth-base.cpp
auth-oauth.cpp
auth-listener.cpp
obf.c
source-tree.cpp
scene-tree.cpp
properties-view.cpp
focus-list.cpp
menu-button.cpp
double-slider.cpp
slider-ignorewheel.cpp
combobox-ignorewheel.cpp
spinbox-ignorewheel.cpp
record-button.cpp
ui-validation.cpp
url-push-button.cpp
volume-control.cpp
adv-audio-control.cpp
item-widget-helpers.cpp
context-bar-controls.cpp
horizontal-scroll-area.cpp
vertical-scroll-area.cpp
visibility-item-widget.cpp
slider-absoluteset-style.cpp
qt-display.cpp
crash-report.cpp
hotkey-edit.cpp
source-label.cpp
remote-text.cpp
audio-encoders.cpp
qt-wrappers.cpp
log-viewer.cpp
obs-proxy-style.cpp
locked-checkbox.cpp
visibility-checkbox.cpp
media-slider.cpp
undo-stack-obs.cpp)
set(obs_HEADERS
${obs_PLATFORM_HEADERS}
${obs_libffutil_HEADERS}
../deps/json11/json11.hpp
obs-app.hpp
platform.hpp
window-dock.hpp
window-main.hpp
window-basic-main.hpp
window-basic-stats.hpp
window-basic-filters.hpp
window-basic-settings.hpp
window-basic-interaction.hpp
window-basic-properties.hpp
window-basic-auto-config.hpp
window-basic-main-outputs.hpp
window-basic-source-select.hpp
window-basic-about.hpp
window-basic-status-bar.hpp
window-basic-adv-audio.hpp
window-basic-transform.hpp
window-basic-preview.hpp
window-importer.hpp
media-controls.hpp
window-namedialog.hpp
window-log-reply.hpp
window-projector.hpp
window-remux.hpp
window-missing-files.hpp
auth-base.hpp
auth-oauth.hpp
auth-listener.hpp
obf.h
source-tree.hpp
scene-tree.hpp
properties-view.hpp
properties-view.moc.hpp
display-helpers.hpp
balance-slider.hpp
double-slider.hpp
slider-ignorewheel.hpp
combobox-ignorewheel.hpp
spinbox-ignorewheel.hpp
focus-list.hpp
menu-button.hpp
mute-checkbox.hpp
record-button.hpp
ui-validation.hpp
screenshot-obj.hpp
url-push-button.hpp
volume-control.hpp
adv-audio-control.hpp
item-widget-helpers.hpp
visibility-checkbox.hpp
context-bar-controls.hpp
locked-checkbox.hpp
horizontal-scroll-area.hpp
expand-checkbox.hpp
vertical-scroll-area.hpp
visibility-item-widget.hpp
slider-absoluteset-style.hpp
qt-display.hpp
crash-report.hpp
hotkey-edit.hpp
source-label.hpp
remote-text.hpp
audio-encoders.hpp
qt-wrappers.hpp
clickable-label.hpp
log-viewer.hpp
obs-proxy-style.hpp
obs-proxy-style.hpp
media-slider.hpp
undo-stack-obs.hpp)
set(obs_importers_HEADERS
importers/importers.hpp)
set(obs_importers_SOURCES
importers/importers.cpp
importers/classic.cpp
importers/sl.cpp
importers/studio.cpp
importers/xsplit.cpp)
source_group("importers\\Source Files" FILES ${obs_importers_SOURCES})
source_group("importers\\Header Files" FILES ${obs_importers_HEADERS})
set(obs_UI
forms/source-toolbar/browser-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/color-source-toolbar.ui
forms/source-toolbar/text-source-toolbar.ui
forms/source-toolbar/media-controls.ui
forms/AutoConfigStartPage.ui
forms/AutoConfigVideoPage.ui
forms/AutoConfigStreamPage.ui
forms/AutoConfigTestPage.ui
forms/ColorSelect.ui
forms/OBSLogReply.ui
forms/OBSBasic.ui
forms/OBSBasicTransform.ui
forms/OBSBasicFilters.ui
forms/OBSBasicSettings.ui
forms/OBSBasicSourceSelect.ui
forms/OBSBasicInteraction.ui
forms/OBSExtraBrowsers.ui
forms/OBSUpdate.ui
forms/OBSRemux.ui
forms/OBSImporter.ui
forms/OBSMissingFiles.ui
forms/OBSAbout.ui)
set(obs_QRC
forms/obs.qrc)
if(YOUTUBE_ENABLED)
list(APPEND obs_SOURCES
window-youtube-actions.cpp
)
list(APPEND obs_HEADERS
window-youtube-actions.hpp
)
list(APPEND obs_UI
forms/OBSYoutubeActions.ui
)
endif()
qt5_wrap_ui(obs_UI_HEADERS ${obs_UI})
qt5_add_resources(obs_QRC_SOURCES ${obs_QRC})
add_executable(obs WIN32
obs.manifest
${obs_SOURCES}
${obs_HEADERS}
${obs_importers_SOURCES}
${obs_importers_HEADERS}
${obs_UI_HEADERS}
${obs_QRC_SOURCES})
if(WIN32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_output_suffix "64")
else()
set(_output_suffix "32")
endif()
set_target_properties(obs
PROPERTIES
OUTPUT_NAME "obs${_output_suffix}")
if(Qt5Widgets_VERSION VERSION_LESS 6.0.0)
target_link_libraries(obs
Qt5::WinExtras)
endif()
endif()
target_link_libraries(obs
libobs
Threads::Threads
Qt5::Network
Qt5::Widgets
Qt5::Svg
Qt5::Xml
obs-frontend-api
${FFMPEG_LIBRARIES}
${LIBCURL_LIBRARIES}
${obs_PLATFORM_LIBRARIES})
set_target_properties(obs PROPERTIES FOLDER "frontend") 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()
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)
target_sources(
obs
PRIVATE obs.manifest
platform-windows.cpp
win-update/update-window.cpp
win-update/update-window.hpp
win-update/win-update.cpp
win-update/win-update.hpp
win-update/win-update-helpers.cpp
win-update/win-update-helpers.hpp
${CMAKE_BINARY_DIR}/obs.rc)
target_link_libraries(obs PRIVATE crypt32 OBS::blake2 Qt::WinExtras)
target_compile_features(obs PRIVATE cxx_std_17)
target_compile_definitions(
obs PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS
_CRT_NONSTDC_NO_WARNINGS)
if(MSVC)
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)
mark_as_advanced(APPKIT)
target_link_libraries(obs PRIVATE ${APPKIT})
if(ENABLE_SPARKLE_UPDATER)
find_library(SPARKLE Sparkle)
mark_as_advanced(SPARKLE)
target_sources(obs PRIVATE sparkle-updater.mm)
target_compile_definitions(obs PRIVATE ENABLE_SPARKLE_UPDATER)
target_link_libraries(obs PRIVATE ${SPARKLE})
endif()
target_sources(obs PRIVATE platform-osx.mm)
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${QT_VERSION}::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()
endif()
define_graphic_modules(obs) define_graphic_modules(obs)
setup_obs_app(obs)
install_obs_core(obs) setup_target_resources(obs obs-studio)
install_obs_data(obs data obs-studio) add_target_resource(obs ${CMAKE_CURRENT_SOURCE_DIR}/../AUTHORS
install_obs_data_file(obs ../AUTHORS obs-studio/authors) obs-studio/authors)
if (UNIX AND UNIX_STRUCTURE AND NOT APPLE)
add_subdirectory(xdg-data)
endif()
if (UNIX AND NOT APPLE)
# python symbols must be in the global symbol table
# so we link the main executable to python if we expect
# obs-scripting python support to be enabled.
# see: https://github.com/obsproject/obs-studio/issues/2222 and https://bugs.python.org/issue36721
if(NOT DISABLE_PYTHON AND PYTHONLIBS_FOUND)
target_link_libraries(obs ${PYTHON_LIBRARIES})
set_target_properties(obs PROPERTIES LINK_FLAGS "-Wl,--no-as-needed")
# Use this after cmake 3.13 aka we drop ubuntu 18.04.
# target_link_options(obs PRIVATE "LINKER:-no-as-needed")
endif()
endif()
add_subdirectory(frontend-plugins)
if(WIN32)
add_subdirectory(win-update/updater)
endif()

View File

@ -1,161 +1,85 @@
project(aja-output-ui) project(aja-output-ui)
if(DISABLE_AJA) if(NOT ENABLE_AJA)
message(STATUS "aja-output-ui plugin disabled") return()
return()
endif() endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 8) find_package(LibAJANTV2 REQUIRED)
find_package(LibAJANTV2)
if (NOT LIBAJANTV2_FOUND) add_library(aja-output-ui MODULE)
message(STATUS "aja-output-ui plugin disabled (deps not found)") add_library(OBS::aja-output-ui ALIAS aja-output-ui)
return()
else() find_qt(VERSION ${QT_VERSION} COMPONENTS Widgets)
message("aja-output-ui includes: ${LIBAJANTV2_INCLUDE_DIRS}")
message("aja-output-ui libs: ${LIBAJANTV2_LIBRARIES}") set_target_properties(
endif() aja-output-ui
PROPERTIES AUTOMOC ON
AUTOUIC ON
AUTORCC ON
AUTOUIC_SEARCH_PATHS "forms")
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/combobox-ignorewheel.cpp
${CMAKE_SOURCE_DIR}/UI/combobox-ignorewheel.hpp
${CMAKE_SOURCE_DIR}/UI/double-slider.cpp
${CMAKE_SOURCE_DIR}/UI/double-slider.hpp
${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_link_libraries(aja-output-ui PRIVATE ws2_32.lib setupapi.lib Winmm.lib
netapi32.lib Shlwapi.lib)
else() else()
message(STATUS "aja-output-ui disabled (32-bit not supported)") find_package(X11 REQUIRED)
return() target_link_libraries(aja-output-ui PRIVATE X11::X11
Qt${QT_VERSION}::GuiPrivate)
endif() endif()
if(APPLE) set_target_properties(aja-output-ui PROPERTIES FOLDER "frontend" PREFIX "")
find_library(COCOA Cocoa)
include_directories(${COCOA})
endif()
if(UNIX AND NOT APPLE) setup_plugin_target(aja-output-ui)
find_package(X11 REQUIRED)
link_libraries(${X11_LIBRARIES})
include_directories(${X11_INCLUDE_DIR})
find_package(Qt5X11Extras REQUIRED)
endif()
set(aja-output-ui_HEADERS
${aja-output-ui_HEADERS}
../../qt-wrappers.hpp
../../properties-view.hpp
../../properties-view.moc.hpp
../../vertical-scroll-area.hpp
../../double-slider.hpp
../../slider-ignorewheel.hpp
../../combobox-ignorewheel.hpp
../../spinbox-ignorewheel.hpp
AJAOutputUI.h
aja-ui-main.h
../../../plugins/aja/aja-card-manager.hpp
../../../plugins/aja/aja-common.hpp
../../../plugins/aja/aja-enums.hpp
../../../plugins/aja/aja-presets.hpp
../../../plugins/aja/aja-props.hpp
../../../plugins/aja/aja-routing.hpp
../../../plugins/aja/aja-ui-props.hpp
../../../plugins/aja/aja-vpid-data.hpp
../../../plugins/aja/aja-widget-io.hpp
)
set(aja-output-ui_SOURCES
${aja-output-ui_SOURCES}
../../qt-wrappers.cpp
../../properties-view.cpp
../../vertical-scroll-area.cpp
../../double-slider.cpp
../../slider-ignorewheel.cpp
../../combobox-ignorewheel.cpp
../../spinbox-ignorewheel.cpp
AJAOutputUI.cpp
aja-ui-main.cpp
../../../plugins/aja/aja-card-manager.cpp
../../../plugins/aja/aja-common.cpp
../../../plugins/aja/aja-presets.cpp
../../../plugins/aja/aja-props.cpp
../../../plugins/aja/aja-routing.cpp
../../../plugins/aja/aja-vpid-data.cpp
../../../plugins/aja/aja-widget-io.cpp
)
set(aja-output-ui_UI
${aja-output-ui_UI}
forms/output.ui)
if(WIN32)
set(MODULE_DESCRIPTION "OBS AJA Output UI")
configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in aja-output-ui.rc)
list(APPEND aja-output-ui_SOURCES
aja-output-ui.rc)
endif()
if(APPLE)
set(aja-output-ui_PLATFORM_LIBS
${COCOA})
endif()
qt5_wrap_ui(aja-output-ui_UI_HEADERS
${aja-output-ui_UI})
add_library(aja-output-ui MODULE
${aja-output-ui_HEADERS}
${aja-output-ui_SOURCES}
${aja-output-ui_UI_HEADERS})
set(aja_LIBRARIES
$<IF:$<CONFIG:Debug>,${LIBAJANTV2_DEBUG_LIBRARIES},${LIBAJANTV2_LIBRARIES}>
libobs)
# macOS
if(APPLE)
set(aja_COMPILE_DEFS
AJAMac
AJA_MAC)
find_library(IOKIT_FRAMEWORK Iokit)
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
find_library(APPKIT_FRAMEWORK AppKit)
list(APPEND aja_LIBRARIES
${IOKIT_FRAMEWORK}
${COREFOUNDATION_LIBRARY}
${APPKIT_FRAMEWORK})
# Windows
elseif(WIN32)
set(aja_COMPILE_DEFS
AJA_WINDOWS
_WINDOWS
WIN32
MSWindows)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
list(APPEND aja_COMPILE_DEFS
_DEBUG)
else()
list(APPEND aja_COMPILE_DEFS
NDEBUG)
endif()
list(APPEND aja_LIBRARIES
ws2_32.lib
setupapi.lib
Winmm.lib
netapi32.lib
Shlwapi.lib)
# Linux
elseif(UNIX AND NOT APPLE)
set(aja_COMPILE_DEFS
AJA_LINUX
AJALinux)
endif()
target_include_directories(aja-output-ui PUBLIC
${LIBAJANTV2_INCLUDE_DIRS})
target_compile_definitions(aja-output-ui PUBLIC ${aja_COMPILE_DEFS})
target_link_libraries(aja-output-ui
${frontend-tools_PLATFORM_LIBS}
${aja_LIBRARIES}
obs-frontend-api
Qt5::Widgets
libobs)
set_target_properties(aja-output-ui PROPERTIES FOLDER "frontend")
install_obs_plugin_with_data(aja-output-ui data)

View File

@ -1,51 +1,48 @@
project(decklink-captions) project(decklink-captions)
if(APPLE) if(NOT ENABLE_DECKLINK)
find_library(COCOA Cocoa) return()
include_directories(${COCOA})
endif() endif()
if(UNIX AND NOT APPLE) add_library(decklink-captions MODULE)
find_package(X11 REQUIRED) add_library(OBS::decklink-captions ALIAS decklink-captions)
link_libraries(${X11_LIBRARIES})
include_directories(${X11_INCLUDE_DIR}) find_qt(VERSION ${QT_VERSION} 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")
target_compile_features(decklink-captions PRIVATE cxx_std_17)
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() endif()
set(decklink-captions_HEADERS set_target_properties(decklink-captions PROPERTIES FOLDER "plugins/decklink"
decklink-captions.h PREFIX "")
)
set(decklink-captions_SOURCES
decklink-captions.cpp
)
set(decklink-captions_UI
forms/captions.ui
)
if(WIN32) setup_plugin_target(decklink-captions)
set(MODULE_DESCRIPTION "OBS DeckLink Captions module")
configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in decklink-captions.rc)
list(APPEND decklink-captions_SOURCES
decklink-captions.rc)
endif()
if(APPLE)
set(decklink-captions_PLATFORM_LIBS
${COCOA})
endif()
qt5_wrap_ui(decklink-captions_UI_HEADERS
${decklink-captions_UI})
add_library(decklink-captions MODULE
${decklink-captions_HEADERS}
${decklink-captions_SOURCES}
${decklink-captions_UI_HEADERS}
)
target_link_libraries(decklink-captions
${frontend-tools_PLATFORM_LIBS}
obs-frontend-api
Qt5::Widgets
libobs)
set_target_properties(decklink-captions PROPERTIES FOLDER "plugins/decklink")
install_obs_plugin_with_data(decklink-captions data)

View File

@ -1,72 +1,104 @@
project(decklink-output-ui) project(decklink-output-ui)
if(APPLE) if(NOT ENABLE_DECKLINK)
find_library(COCOA Cocoa) return()
include_directories(${COCOA})
endif() endif()
if(UNIX AND NOT APPLE) if(NOT COMMAND find_qt)
find_package(X11 REQUIRED) macro(find_qt)
link_libraries(${X11_LIBRARIES}) set(oneValueArgs VERSION)
include_directories(${X11_INCLUDE_DIR}) set(multiValueArgs COMPONENTS COMPONENTS_WIN COMPONENTS_MAC
COMPONENTS_LINUX)
cmake_parse_arguments(FIND_QT "" "${oneValueArgs}" "${multiValueArgs}"
${ARGN})
if(OS_WINDOWS)
find_package(
Qt${FIND_QT_VERSION}
COMPONENTS ${FIND_QT_COMPONENTS} ${FIND_QT_COMPONENTS_WIN}
REQUIRED)
elseif(OS_MACOS)
find_package(
Qt${FIND_QT_VERSION}
COMPONENTS ${FIND_QT_COMPONENTS} ${FIND_QT_COMPONENTS_MAC}
REQUIRED)
else()
find_package(
Qt${FIND_QT_VERSION}
COMPONENTS ${FIND_QT_COMPONENTS} ${FIND_QT_COMPONENTS_LINUX}
REQUIRED)
endif()
foreach(_COMPONENT IN LISTS ${FIND_QT_COMPONENTS})
if(NOT TARGET Qt::${_COMPONENT} AND TARGET
Qt${FIND_QT_VERSION}::${_COMPONENT})
add_library(Qt::${_COMPONENT} ALIAS Qt${FIND_QT_VERSION}::${_COMPONENT})
endif()
endforeach()
endmacro()
endif() endif()
set(decklink-ouput-ui_HEADERS add_library(decklink-output-ui MODULE)
${decklink-ouput-ui_HEADERS} add_library(OBS::decklink-output-ui ALIAS decklink-output-ui)
../../qt-wrappers.hpp
../../properties-view.hpp
../../properties-view.moc.hpp
../../vertical-scroll-area.hpp
../../double-slider.hpp
../../slider-ignorewheel.hpp
../../combobox-ignorewheel.hpp
../../spinbox-ignorewheel.hpp
./DecklinkOutputUI.h
decklink-ui-main.h
)
set(decklink-ouput-ui_SOURCES
${decklink-ouput-ui_SOURCES}
../../qt-wrappers.cpp
../../properties-view.cpp
../../vertical-scroll-area.cpp
../../double-slider.cpp
../../slider-ignorewheel.cpp
../../combobox-ignorewheel.cpp
../../spinbox-ignorewheel.cpp
./DecklinkOutputUI.cpp
decklink-ui-main.cpp
)
set(decklink-ouput-ui_UI
${decklink-ouput-ui_UI}
forms/output.ui
)
if(WIN32) find_qt(
set(MODULE_DESCRIPTION "OBS DeckLink Output UI") VERSION ${QT_VERSION}
configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in decklink-ouput-ui.rc) COMPONENTS Widgets
list(APPEND decklink-ouput-ui_SOURCES COMPONENTS_LINUX Gui)
decklink-ouput-ui.rc)
set_target_properties(
decklink-output-ui
PROPERTIES AUTOMOC ON
AUTOUIC ON
AUTORCC ON
AUTOUIC_SEARCH_PATHS "forms")
target_sources(
decklink-output-ui
PRIVATE DecklinkOutputUI.cpp
DecklinkOutputUI.h
decklink-ui-main.cpp
decklink-ui-main.h
${CMAKE_SOURCE_DIR}/UI/combobox-ignorewheel.cpp
${CMAKE_SOURCE_DIR}/UI/combobox-ignorewheel.hpp
${CMAKE_SOURCE_DIR}/UI/double-slider.cpp
${CMAKE_SOURCE_DIR}/UI/double-slider.hpp
${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${QT_VERSION}::GuiPrivate)
endif() endif()
if(APPLE) setup_plugin_target(decklink-output-ui)
set(decklink-ouput-ui_PLATFORM_LIBS
${COCOA})
endif()
qt5_wrap_ui(decklink-ouput-ui_UI_HEADERS
${decklink-ouput-ui_UI})
add_library(decklink-ouput-ui MODULE
${decklink-ouput-ui_HEADERS}
${decklink-ouput-ui_SOURCES}
${decklink-ouput-ui_UI_HEADERS}
)
target_link_libraries(decklink-ouput-ui
${frontend-tools_PLATFORM_LIBS}
obs-frontend-api
Qt5::Widgets
libobs)
set_target_properties(decklink-ouput-ui PROPERTIES FOLDER "frontend")
install_obs_plugin_with_data(decklink-ouput-ui data)

View File

@ -1,128 +1,106 @@
project(frontend-tools) project(frontend-tools)
if(APPLE) add_library(frontend-tools MODULE)
find_library(COCOA Cocoa) add_library(OBS::frontend-tools ALIAS frontend-tools)
include_directories(${COCOA})
find_qt(
VERSION ${QT_VERSION}
COMPONENTS Widgets
COMPONENTS_LINUX Gui)
set_target_properties(
frontend-tools
PROPERTIES AUTOMOC ON
AUTOUIC ON
AUTORCC ON
AUTOUIC_SEARCH_PATHS "forms")
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/combobox-ignorewheel.cpp
${CMAKE_SOURCE_DIR}/UI/combobox-ignorewheel.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)
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${QT_VERSION}::GuiPrivate)
endif() endif()
if(UNIX AND NOT APPLE) if(ENABLE_SCRIPTING AND TARGET OBS::scripting)
find_package(X11 REQUIRED) target_compile_definitions(frontend-tools PRIVATE ENABLE_SCRIPTING)
link_libraries(${X11_LIBRARIES})
include_directories(${X11_INCLUDE_DIR}) 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() endif()
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/deps/obs-scripting") set_target_properties(frontend-tools PROPERTIES FOLDER "frontend" PREFIX "")
configure_file( if(OS_WINDOWS)
"${CMAKE_CURRENT_SOURCE_DIR}/frontend-tools-config.h.in" set(MODULE_DESCRIPTION "OBS Frontend Tools")
"${CMAKE_BINARY_DIR}/config/frontend-tools-config.h") configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in
frontend-tools.rc)
set(frontend-tools_HEADERS target_sources(
${frontend-tools_HEADERS} frontend-tools
"${CMAKE_BINARY_DIR}/config/frontend-tools-config.h" PRIVATE auto-scene-switcher-win.cpp
auto-scene-switcher.hpp frontend-tools.rc
output-timer.hpp captions.cpp
tool-helpers.hpp captions.hpp
../../properties-view.hpp captions-handler.cpp
../../properties-view.moc.hpp captions-handler.hpp
../../horizontal-scroll-area.hpp captions-mssapi.cpp
../../vertical-scroll-area.hpp captions-mssapi.hpp
../../double-slider.hpp captions-mssapi-stream.cpp
../../slider-ignorewheel.hpp captions-mssapi-stream.hpp)
../../combobox-ignorewheel.hpp
../../spinbox-ignorewheel.hpp
../../qt-wrappers.hpp
)
set(frontend-tools_SOURCES
${frontend-tools_SOURCES}
auto-scene-switcher.cpp
frontend-tools.c
output-timer.cpp
../../properties-view.cpp
../../horizontal-scroll-area.cpp
../../vertical-scroll-area.cpp
../../double-slider.cpp
../../slider-ignorewheel.cpp
../../combobox-ignorewheel.cpp
../../spinbox-ignorewheel.cpp
../../qt-wrappers.cpp
)
set(frontend-tools_UI
${frontend-tools_UI}
forms/auto-scene-switcher.ui
forms/output-timer.ui
)
if(SCRIPTING_ENABLED) elseif(OS_MACOS)
set(frontend-tools_HEADERS find_library(COCOA Cocoa)
${frontend-tools_HEADERS} mark_as_advanced(COCOA)
scripts.hpp target_link_libraries(frontend-tools PRIVATE ${COCOA})
)
set(frontend-tools_SOURCES target_sources(frontend-tools PRIVATE auto-scene-switcher-osx.mm)
${frontend-tools_SOURCES} set_source_files_properties(auto-scene-switcher-osx.mm
scripts.cpp PROPERTIES COMPILE_FLAGS -fobjc-arc)
)
set(frontend-tools_UI elseif(OS_POSIX)
${frontend-tools_UI} find_package(X11 REQUIRED)
forms/scripts.ui
) target_link_libraries(frontend-tools PRIVATE X11::X11)
set(EXTRA_LIBS
${EXTRA_LIBS} target_sources(frontend-tools PRIVATE auto-scene-switcher-nix.cpp)
obs-scripting
)
endif() endif()
if(WIN32) setup_plugin_target(frontend-tools)
set(MODULE_DESCRIPTION "OBS Frontend Tools")
configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in frontend-tools.rc)
set(frontend-tools_PLATFORM_SOURCES
auto-scene-switcher-win.cpp
frontend-tools.rc)
set(frontend-tools_PLATFORM_SOURCES
${frontend-tools_PLATFORM_SOURCES}
captions.cpp
captions-handler.cpp
captions-mssapi.cpp
captions-mssapi-stream.cpp)
set(frontend-tools_PLATFORM_HEADERS
captions.hpp
captions-handler.hpp
captions-mssapi.hpp
captions-mssapi-stream.hpp)
set(frontend-tools_PLATFORM_UI
forms/captions.ui)
elseif(APPLE)
set(frontend-tools_PLATFORM_SOURCES
auto-scene-switcher-osx.mm)
set_source_files_properties(auto-scene-switcher-osx.mm
PROPERTIES COMPILE_FLAGS "-fobjc-arc")
set(frontend-tools_PLATFORM_LIBS
${COCOA})
else()
set(frontend-tools_PLATFORM_SOURCES
auto-scene-switcher-nix.cpp)
endif()
qt5_wrap_ui(frontend-tools_UI_HEADERS
${frontend-tools_UI}
${frontend-tools_PLATFORM_UI})
add_library(frontend-tools MODULE
${frontend-tools_HEADERS}
${frontend-tools_SOURCES}
${frontend-tools_UI_HEADERS}
${frontend-tools_PLATFORM_SOURCES}
${frontend-tools_PLATFORM_HEADERS}
)
target_link_libraries(frontend-tools
${frontend-tools_PLATFORM_LIBS}
${EXTRA_LIBS}
obs-frontend-api
Qt5::Widgets
libobs)
set_target_properties(frontend-tools PROPERTIES FOLDER "frontend")
install_obs_plugin_with_data(frontend-tools data)

View File

@ -16,6 +16,6 @@
#define OFF 0 #define OFF 0
#endif #endif
#define ENABLE_SCRIPTING @SCRIPTING_ENABLED@ #cmakedefine ENABLE_SCRIPTING
#define COMPILE_LUA @COMPILE_LUA@ #cmakedefine LUAJIT_FOUND
#define COMPILE_PYTHON @COMPILE_PYTHON@ #cmakedefine Python_FOUND

View File

@ -1,5 +1,4 @@
#include <obs-module.h> #include <obs-module.h>
#include "frontend-tools-config.h"
OBS_DECLARE_MODULE() OBS_DECLARE_MODULE()
OBS_MODULE_USE_DEFAULT_LOCALE("frontend-tools", "en-US") OBS_MODULE_USE_DEFAULT_LOCALE("frontend-tools", "en-US")
@ -15,7 +14,7 @@ void FreeCaptions();
void InitOutputTimer(); void InitOutputTimer();
void FreeOutputTimer(); void FreeOutputTimer();
#if ENABLE_SCRIPTING #if defined(ENABLE_SCRIPTING)
void InitScripts(); void InitScripts();
void FreeScripts(); void FreeScripts();
#endif #endif
@ -27,7 +26,7 @@ bool obs_module_load(void)
#endif #endif
InitSceneSwitcher(); InitSceneSwitcher();
InitOutputTimer(); InitOutputTimer();
#if ENABLE_SCRIPTING #if defined(ENABLE_SCRIPTING)
InitScripts(); InitScripts();
#endif #endif
return true; return true;
@ -40,7 +39,7 @@ void obs_module_unload(void)
#endif #endif
FreeSceneSwitcher(); FreeSceneSwitcher();
FreeOutputTimer(); FreeOutputTimer();
#if ENABLE_SCRIPTING #if defined(ENABLE_SCRIPTING)
FreeScripts(); FreeScripts();
#endif #endif
} }

View File

@ -1,6 +1,5 @@
#include "obs-module.h" #include "obs-module.h"
#include "scripts.hpp" #include "scripts.hpp"
#include "frontend-tools-config.h"
#include "../../properties-view.hpp" #include "../../properties-view.hpp"
#include "../../qt-wrappers.hpp" #include "../../qt-wrappers.hpp"
@ -33,7 +32,7 @@
#include "ui_scripts.h" #include "ui_scripts.h"
#if COMPILE_PYTHON && (defined(_WIN32) || defined(__APPLE__)) #if defined(Python_FOUND) && (defined(_WIN32) || defined(__APPLE__))
#define PYTHON_UI 1 #define PYTHON_UI 1
#else #else
#define PYTHON_UI 0 #define PYTHON_UI 0

View File

@ -2064,6 +2064,12 @@ static int run_program(fstream &logFile, int argc, char *argv[])
#if __APPLE__ #if __APPLE__
InstallNSApplicationSubclass(); InstallNSApplicationSubclass();
if (!isInBundle()) {
blog(LOG_ERROR,
"OBS cannot be run as a standalone binary on macOS. Run the Application bundle instead.");
return ret;
}
#endif #endif
#if !defined(_WIN32) && !defined(__APPLE__) && defined(USE_XDG) && \ #if !defined(_WIN32) && !defined(__APPLE__) && defined(USE_XDG) && \
@ -2339,13 +2345,13 @@ static void load_debug_privilege(void)
#define CONFIG_PATH BASE_PATH "/config" #define CONFIG_PATH BASE_PATH "/config"
#ifndef OBS_UNIX_STRUCTURE #ifndef LINUX_PORTABLE
#define OBS_UNIX_STRUCTURE 0 #define LINUX_PORTABLE 0
#endif #endif
int GetConfigPath(char *path, size_t size, const char *name) int GetConfigPath(char *path, size_t size, const char *name)
{ {
if (!OBS_UNIX_STRUCTURE && portable_mode) { if (LINUX_PORTABLE && portable_mode) {
if (name && *name) { if (name && *name) {
return snprintf(path, size, CONFIG_PATH "/%s", name); return snprintf(path, size, CONFIG_PATH "/%s", name);
} else { } else {
@ -2358,7 +2364,7 @@ int GetConfigPath(char *path, size_t size, const char *name)
char *GetConfigPathPtr(const char *name) char *GetConfigPathPtr(const char *name)
{ {
if (!OBS_UNIX_STRUCTURE && portable_mode) { if (LINUX_PORTABLE && portable_mode) {
char path[512]; char path[512];
if (snprintf(path, sizeof(path), CONFIG_PATH "/%s", name) > 0) { if (snprintf(path, sizeof(path), CONFIG_PATH "/%s", name) > 0) {
@ -2870,7 +2876,7 @@ int main(int argc, char *argv[])
} }
} }
#if !OBS_UNIX_STRUCTURE #if defined(LINUX_PORTABLE)
if (!portable_mode) { if (!portable_mode) {
portable_mode = portable_mode =
os_file_exists(BASE_PATH "/portable_mode") || os_file_exists(BASE_PATH "/portable_mode") ||

View File

@ -1,41 +1,40 @@
if(POLICY CMP0090)
cmake_policy(SET CMP0090 NEW)
endif()
project(obs-frontend-api) project(obs-frontend-api)
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/libobs") add_library(obs-frontend-api SHARED)
add_library(OBS::frontend-api ALIAS obs-frontend-api)
add_definitions(-DLIBOBS_EXPORTS) target_sources(obs-frontend-api PRIVATE obs-frontend-api.h obs-frontend-api.cpp
obs-frontend-internal.hpp)
set(obs-frontend-api_SOURCES target_link_libraries(obs-frontend-api PRIVATE OBS::libobs)
obs-frontend-api.cpp)
if(WIN32) target_compile_features(obs-frontend-api PUBLIC cxx_auto_type cxx_std_17
set(MODULE_DESCRIPTION "OBS Frontend API") c_std_11)
configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in ./obs-frontend-api.rc)
list(APPEND obs-frontend-api_SOURCES target_include_directories(
obs-frontend-api.rc) obs-frontend-api PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${OBS_INCLUDE_DESTINATION}>)
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() endif()
set(obs-frontend-api_PUBLIC_HEADERS setup_binary_target(obs-frontend-api)
obs-frontend-api.h) export_target(obs-frontend-api)
set(obs-frontend-api_HEADERS
obs-frontend-internal.hpp
${obs-frontend-api_PUBLIC_HEADERS})
add_library(obs-frontend-api SHARED
${obs-frontend-api_SOURCES}
${obs-frontend-api_HEADERS})
target_link_libraries(obs-frontend-api
libobs)
set_target_properties(obs-frontend-api PROPERTIES FOLDER "frontend")
if(UNIX AND NOT APPLE)
set_target_properties(obs-frontend-api
PROPERTIES
OUTPUT_NAME obs-frontend-api
VERSION 0.0
SOVERSION 0
)
endif()
install_obs_core(obs-frontend-api)
install_obs_headers(${obs-frontend-api_PUBLIC_HEADERS})

View File

@ -0,0 +1,4 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
check_required_components("@PROJECT_NAME@")

View File

@ -1,4 +1,4 @@
IDI_ICON1 ICON DISCARDABLE "../cmake/winrc/obs-studio.ico" IDI_ICON1 ICON DISCARDABLE "../cmake/bundle/windows/obs-studio.ico"
1 VERSIONINFO 1 VERSIONINFO
FILEVERSION ${UI_VERSION_MAJOR},${UI_VERSION_MINOR},${UI_VERSION_PATCH},0 FILEVERSION ${UI_VERSION_MAJOR},${UI_VERSION_MINOR},${UI_VERSION_PATCH},0

View File

@ -37,55 +37,21 @@ bool isInBundle()
bool GetDataFilePath(const char *data, string &output) bool GetDataFilePath(const char *data, string &output)
{ {
if (isInBundle()) { NSRunningApplication *app = [NSRunningApplication currentApplication];
NSRunningApplication *app = NSURL *bundleURL = [app bundleURL];
[NSRunningApplication currentApplication]; NSString *path = [NSString
NSURL *bundleURL = [app bundleURL]; stringWithFormat:@"Contents/Resources/%@",
NSString *path = [NSString [NSString stringWithUTF8String:data]];
stringWithFormat:@"Contents/Resources/data/obs-studio/%@", NSURL *dataURL = [bundleURL URLByAppendingPathComponent:path];
[NSString stringWithUTF8String:data]]; output = [[dataURL path] UTF8String];
NSURL *dataURL = [bundleURL URLByAppendingPathComponent:path];
output = [[dataURL path] UTF8String];
} else {
stringstream str;
str << OBS_DATA_PATH "/obs-studio/" << data;
output = str.str();
}
return !access(output.c_str(), R_OK); return !access(output.c_str(), R_OK);
} }
#pragma deprecated(InitApplicationBundle)
bool InitApplicationBundle() bool InitApplicationBundle()
{ {
#ifdef OBS_OSX_BUNDLE
static bool initialized = false;
if (initialized)
return true;
try {
NSBundle *bundle = [NSBundle mainBundle];
if (!bundle)
throw "Could not find main bundle";
NSString *exe_path = [bundle executablePath];
if (!exe_path)
throw "Could not find executable path";
NSString *path = [exe_path stringByDeletingLastPathComponent];
if (chdir([path fileSystemRepresentation]))
throw "Could not change working directory to "
"bundle path";
} catch (const char *error) {
blog(LOG_ERROR, "InitBundle: %s", error);
return false;
}
return initialized = true;
#else
return true; return true;
#endif
} }
void CheckIfAlreadyRunning(bool &already_running) void CheckIfAlreadyRunning(bool &already_running)

View File

@ -28,7 +28,7 @@ class QWidget;
bool GetDataFilePath(const char *data, std::string &path); bool GetDataFilePath(const char *data, std::string &path);
/* Updates the working directory for OSX application bundles */ /* Updates the working directory for OSX application bundles */
bool InitApplicationBundle(); bool OBS_DEPRECATED InitApplicationBundle();
std::string GetDefaultVideoSavePath(); std::string GetDefaultVideoSavePath();
@ -77,6 +77,7 @@ bool IsRunningOnWine();
#ifdef __APPLE__ #ifdef __APPLE__
void EnableOSXVSync(bool enable); void EnableOSXVSync(bool enable);
void EnableOSXDockIcon(bool enable); void EnableOSXDockIcon(bool enable);
bool isInBundle();
void InstallNSApplicationSubclass(); void InstallNSApplicationSubclass();
void disableColorSpaceConversion(QWidget *window); void disableColorSpaceConversion(QWidget *window);
bool ProcessIsRosettaTranslated(); bool ProcessIsRosettaTranslated();

View File

@ -16,6 +16,8 @@
#define OFF 0 #define OFF 0
#endif #endif
#cmakedefine USE_XDG
#define TWITCH_ENABLED @TWITCH_ENABLED@ #define TWITCH_ENABLED @TWITCH_ENABLED@
#define TWITCH_CLIENTID "@TWITCH_CLIENTID@" #define TWITCH_CLIENTID "@TWITCH_CLIENTID@"
#define TWITCH_HASH 0x@TWITCH_HASH@ #define TWITCH_HASH 0x@TWITCH_HASH@

View File

@ -1,52 +1,46 @@
if(DISABLE_UPDATE_MODULE) project(updater)
return()
option(ENABLE_UPDATER "Build with Windows updater" ON)
if(NOT ENABLE_UPDATER)
message(STATUS "OBS: DISABLED Windows updater")
return()
endif() endif()
if(NOT DEFINED STATIC_ZLIB_PATH OR "${STATIC_ZLIB_PATH}" STREQUAL "") if(NOT DEFINED STATIC_ZLIB_PATH OR "${STATIC_ZLIB_PATH}" STREQUAL "")
message(STATUS "STATIC_ZLIB_PATH not set, windows updater disabled") message(STATUS "STATIC_ZLIB_PATH not set, windows updater disabled")
return() return()
endif() endif()
project(updater) add_executable(updater WIN32)
include_directories(${LIBLZMA_INCLUDE_DIRS}) target_sources(
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/deps/json11") updater
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/libobs") PRIVATE updater.cpp
include_directories(${BLAKE2_INCLUDE_DIR}) updater.hpp
patch.cpp
http.cpp
hash.cpp
resource.h
updater.rc
init-hook-files.c
updater.manifest
${CMAKE_SOURCE_DIR}/UI/win-update/win-update-helpers.cpp
${CMAKE_SOURCE_DIR}/UI/win-update/win-update-helpers.hpp
${CMAKE_SOURCE_DIR}/deps/json11/json11.hpp
${CMAKE_SOURCE_DIR}/deps/json11/json11.cpp)
set(updater_HEADERS target_include_directories(
${CMAKE_SOURCE_DIR}/deps/json11/json11.hpp updater PRIVATE ${CMAKE_SOURCE_DIR}/libobs ${CMAKE_SOURCE_DIR}/UI/win-update
../win-update-helpers.hpp ${CMAKE_SOURCE_DIR}/deps/json11)
resource.h
updater.hpp target_compile_definitions(updater PRIVATE NOMINMAX "PSAPI_VERSION=2")
)
set(updater_SOURCES
${CMAKE_SOURCE_DIR}/deps/json11/json11.cpp
../win-update-helpers.cpp
init-hook-files.c
updater.cpp
patch.cpp
http.cpp
hash.cpp
updater.rc
updater.manifest
)
add_definitions(-DNOMINMAX -DUNICODE -D_UNICODE -DPSAPI_VERSION=2)
if(MSVC) if(MSVC)
add_compile_options($<IF:$<CONFIG:Debug>,/MTd,/MT>) target_compile_options(updater PRIVATE $<IF:$<CONFIG:DEBUG>,/MTd,/MT>)
endif() endif()
add_executable(updater WIN32 target_link_libraries(updater PRIVATE OBS::blake2 OBS::lzma ${STATIC_ZLIB_PATH}
${updater_HEADERS} comctl32 shell32 winhttp)
${updater_SOURCES}
)
target_link_libraries(updater
${STATIC_ZLIB_PATH}
lzma
blake2
comctl32
shell32
winhttp
)
set_target_properties(updater PROPERTIES FOLDER "frontend") set_target_properties(updater PROPERTIES FOLDER "frontend")

View File

@ -127,7 +127,7 @@ END
// Icon with lowest ID value placed first to ensure application icon // Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems. // remains consistent on all systems.
IDI_ICON1 ICON "../../../cmake/winrc/obs-studio.ico" IDI_ICON1 ICON "../../../cmake/bundle/windows/obs-studio.ico"
#endif // English (United States) resources #endif // English (United States) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@ -131,7 +131,11 @@ void OBSAbout::ShowAuthors()
QString error = "Error! File could not be read.\n\n \ QString error = "Error! File could not be read.\n\n \
Go to: https://github.com/obsproject/obs-studio/blob/master/AUTHORS"; Go to: https://github.com/obsproject/obs-studio/blob/master/AUTHORS";
#ifdef __APPLE__
if (!GetDataFilePath("AUTHORS", path)) {
#else
if (!GetDataFilePath("authors/AUTHORS", path)) { if (!GetDataFilePath("authors/AUTHORS", path)) {
#endif
ui->textBrowser->setPlainText(error); ui->textBrowser->setPlainText(error);
return; return;
} }

View File

@ -170,21 +170,35 @@ static void AddExtraModulePaths()
string path = base_module_dir; string path = base_module_dir;
#if defined(__APPLE__) #if defined(__APPLE__)
obs_add_module_path((path + "/bin").c_str(), (path + "/data").c_str()); /* System Library Search Path */
obs_add_module_path((path + ".plugin/Contents/MacOS").c_str(),
(path + ".plugin/Contents/Resources").c_str());
BPtr<char> config_bin = /* User Application Support Search Path */
os_get_config_path_ptr("obs-studio/plugins/%module%/bin"); BPtr<char> config_bin = os_get_config_path_ptr(
BPtr<char> config_data = "obs-studio/plugins/%module%.plugin/Contents/MacOS");
os_get_config_path_ptr("obs-studio/plugins/%module%/data"); BPtr<char> config_data = os_get_config_path_ptr(
"obs-studio/plugins/%module%.plugin/Contents/Resources");
obs_add_module_path(config_bin, config_data); obs_add_module_path(config_bin, config_data);
#elif ARCH_BITS == 64 /* Legacy System Library Search Path */
obs_add_module_path((path + "/bin").c_str(), (path + "/data").c_str());
/* Legacy User Application Support Search Path */
BPtr<char> config_bin_legacy =
os_get_config_path_ptr("obs-studio/plugins/%module%/bin");
BPtr<char> config_data_legacy =
os_get_config_path_ptr("obs-studio/plugins/%module%/data");
obs_add_module_path(config_bin_legacy, config_data_legacy);
#else
#if ARCH_BITS == 64
obs_add_module_path((path + "/bin/64bit").c_str(), obs_add_module_path((path + "/bin/64bit").c_str(),
(path + "/data").c_str()); (path + "/data").c_str());
#else #else
obs_add_module_path((path + "/bin/32bit").c_str(), obs_add_module_path((path + "/bin/32bit").c_str(),
(path + "/data").c_str()); (path + "/data").c_str());
#endif #endif
#endif
} }
extern obs_frontend_callbacks *InitializeAPIInterface(OBSBasic *main); extern obs_frontend_callbacks *InitializeAPIInterface(OBSBasic *main);
@ -2115,7 +2129,7 @@ void OBSBasic::ReceivedIntroJson(const QString &text)
int minor = 0; int minor = 0;
sscanf(version.c_str(), "%d.%d", &major, &minor); sscanf(version.c_str(), "%d.%d", &major, &minor);
#if OBS_RELEASE_CANDIDATE > 0 #if defined(OBS_RELEASE_CANDIDATE) && OBS_RELEASE_CANDIDATE > 0
if (major == OBS_RELEASE_CANDIDATE_MAJOR && if (major == OBS_RELEASE_CANDIDATE_MAJOR &&
minor == OBS_RELEASE_CANDIDATE_MINOR && minor == OBS_RELEASE_CANDIDATE_MINOR &&
rc == OBS_RELEASE_CANDIDATE) { rc == OBS_RELEASE_CANDIDATE) {
@ -2136,7 +2150,7 @@ void OBSBasic::ReceivedIntroJson(const QString &text)
return; return;
} }
#if OBS_RELEASE_CANDIDATE > 0 #if defined(OBS_RELEASE_CANDIDATE) && OBS_RELEASE_CANDIDATE > 0
uint32_t lastVersion = config_get_int(App()->GlobalConfig(), "General", uint32_t lastVersion = config_get_int(App()->GlobalConfig(), "General",
"LastRCVersion"); "LastRCVersion");
#elif OBS_BETA > 0 #elif OBS_BETA > 0
@ -2149,7 +2163,7 @@ void OBSBasic::ReceivedIntroJson(const QString &text)
int current_version_increment = -1; int current_version_increment = -1;
#if OBS_RELEASE_CANDIDATE > 0 #if defined(OBS_RELEASE_CANDIDATE) && OBS_RELEASE_CANDIDATE > 0
if (lastVersion < OBS_RELEASE_CANDIDATE_VER) { if (lastVersion < OBS_RELEASE_CANDIDATE_VER) {
#elif OBS_BETA > 0 #elif OBS_BETA > 0
if (lastVersion < OBS_BETA_VER) { if (lastVersion < OBS_BETA_VER) {
@ -2642,7 +2656,7 @@ OBSBasic::~OBSBasic()
config_set_int(App()->GlobalConfig(), "General", "LastVersion", config_set_int(App()->GlobalConfig(), "General", "LastVersion",
LIBOBS_API_VER); LIBOBS_API_VER);
#if OBS_RELEASE_CANDIDATE > 0 #if defined(OBS_RELEASE_CANDIDATE) && OBS_RELEASE_CANDIDATE > 0
config_set_int(App()->GlobalConfig(), "General", "LastRCVersion", config_set_int(App()->GlobalConfig(), "General", "LastRCVersion",
OBS_RELEASE_CANDIDATE_VER); OBS_RELEASE_CANDIDATE_VER);
#elif OBS_BETA > 0 #elif OBS_BETA > 0
@ -3626,7 +3640,7 @@ bool OBSBasic::QueryRemoveSource(obs_source_t *source)
#define UPDATE_CHECK_INTERVAL (60 * 60 * 24 * 4) /* 4 days */ #define UPDATE_CHECK_INTERVAL (60 * 60 * 24 * 4) /* 4 days */
#ifdef UPDATE_SPARKLE #if defined(ENABLE_SPARKLE_UPDATER)
void init_sparkle_updater(bool update_to_undeployed); void init_sparkle_updater(bool update_to_undeployed);
void trigger_sparkle_update(); void trigger_sparkle_update();
#endif #endif
@ -3639,7 +3653,7 @@ void OBSBasic::TimedCheckForUpdates()
"EnableAutoUpdates")) "EnableAutoUpdates"))
return; return;
#ifdef UPDATE_SPARKLE #if defined(ENABLE_SPARKLE_UPDATER)
init_sparkle_updater(config_get_bool(App()->GlobalConfig(), "General", init_sparkle_updater(config_get_bool(App()->GlobalConfig(), "General",
"UpdateToUndeployed")); "UpdateToUndeployed"));
#elif _WIN32 #elif _WIN32
@ -3664,7 +3678,7 @@ void OBSBasic::TimedCheckForUpdates()
void OBSBasic::CheckForUpdates(bool manualUpdate) void OBSBasic::CheckForUpdates(bool manualUpdate)
{ {
#ifdef UPDATE_SPARKLE #if defined(ENABLE_SPARKLE_UPDATER)
trigger_sparkle_update(); trigger_sparkle_update();
#elif _WIN32 #elif _WIN32
ui->actionCheckForUpdates->setEnabled(false); ui->actionCheckForUpdates->setEnabled(false);

View File

@ -640,7 +640,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
delete ui->browserHWAccel; delete ui->browserHWAccel;
delete ui->sourcesGroup; delete ui->sourcesGroup;
#endif #endif
#if defined(__APPLE__) || HAVE_PULSEAUDIO #if defined(__APPLE__) || defined(PULSEAUDIO_FOUND)
delete ui->disableAudioDucking; delete ui->disableAudioDucking;
#endif #endif
ui->rendererLabel = nullptr; ui->rendererLabel = nullptr;
@ -656,7 +656,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
ui->browserHWAccel = nullptr; ui->browserHWAccel = nullptr;
ui->sourcesGroup = nullptr; ui->sourcesGroup = nullptr;
#endif #endif
#if defined(__APPLE__) || HAVE_PULSEAUDIO #if defined(__APPLE__) || defined(PULSEAUDIO_FOUND)
ui->disableAudioDucking = nullptr; ui->disableAudioDucking = nullptr;
#endif #endif
#endif #endif

View File

@ -1,38 +1,41 @@
if(NOT DEFINED APPDATA_RELEASE_DATE) if(NOT DEFINED APPDATA_RELEASE_DATE)
if(EXISTS "${CMAKE_SOURCE_DIR}/.git") if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
execute_process(COMMAND git log --tags -1 --pretty=%cd --date=short execute_process(
OUTPUT_VARIABLE APPDATA_RELEASE_DATE COMMAND git log --tags -1 --pretty=%cd --date=short
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE APPDATA_RELEASE_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE) WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
else() OUTPUT_STRIP_TRAILING_WHITESPACE)
file(TIMESTAMP "${CMAKE_SOURCE_DIR}/CMakeLists.txt" APPDATA_RELEASE_DATE "%Y-%m-%d") else()
endif() file(TIMESTAMP "${CMAKE_SOURCE_DIR}/CMakeLists.txt" APPDATA_RELEASE_DATE
"%Y-%m-%d")
endif()
endif() endif()
configure_file( configure_file(com.obsproject.Studio.appdata.xml.in
com.obsproject.Studio.appdata.xml.in com.obsproject.Studio.appdata.xml)
com.obsproject.Studio.appdata.xml)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/com.obsproject.Studio.appdata.xml install(FILES ${CMAKE_CURRENT_BINARY_DIR}/com.obsproject.Studio.appdata.xml
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo) DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo)
install(FILES com.obsproject.Studio.desktop install(FILES com.obsproject.Studio.desktop
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
# Icons install(
FILES icons/obs-logo-128.png
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps
RENAME com.obsproject.Studio.png)
install(FILES icons/obs-logo-128.png install(
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps FILES icons/obs-logo-256.png
RENAME com.obsproject.Studio.png) DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps
RENAME com.obsproject.Studio.png)
install(FILES icons/obs-logo-256.png install(
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps FILES icons/obs-logo-512.png
RENAME com.obsproject.Studio.png) DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/512x512/apps
RENAME com.obsproject.Studio.png)
install(FILES icons/obs-logo-512.png install(
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/512x512/apps FILES icons/obs-logo-scalable.svg
RENAME com.obsproject.Studio.png) DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps
RENAME com.obsproject.Studio.svg)
install(FILES icons/obs-logo-scalable.svg
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps
RENAME com.obsproject.Studio.svg)