libobs: Update CMakeLists.txt for libobs and associated libraries
Also updates libobs-opengl, libobs-d3d11, libobs-winrtmaster
parent
49e9d49943
commit
1fd7770548
|
@ -1,59 +1,57 @@
|
|||
project(libobs-d3d11)
|
||||
|
||||
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/libobs")
|
||||
add_library(libobs-d3d11 MODULE)
|
||||
add_library(OBS::libobs-d3d11 ALIAS libobs-d3d11)
|
||||
|
||||
add_definitions(-DLIBOBS_EXPORTS)
|
||||
|
||||
set(MODULE_DESCRIPTION "OBS Library D3D11 wrapper")
|
||||
configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in libobs-d3d11.rc)
|
||||
|
||||
if(NOT DEFINED GPU_PRIORITY_VAL OR "${GPU_PRIORITY_VAL}" STREQUAL "" OR
|
||||
"${GPU_PRIORITY_VAL}" STREQUAL "0")
|
||||
set(USE_GPU_PRIORITY FALSE)
|
||||
set(GPU_PRIORITY_VAL "0")
|
||||
else()
|
||||
set(USE_GPU_PRIORITY TRUE)
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/d3d11-config.h.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/d3d11-config.h")
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set(libobs-d3d11_SOURCES
|
||||
d3d11-indexbuffer.cpp
|
||||
target_sources(
|
||||
libobs-d3d11
|
||||
PRIVATE d3d11-indexbuffer.cpp
|
||||
d3d11-samplerstate.cpp
|
||||
d3d11-shader.cpp
|
||||
d3d11-shaderprocessor.cpp
|
||||
d3d11-shaderprocessor.hpp
|
||||
d3d11-stagesurf.cpp
|
||||
d3d11-subsystem.cpp
|
||||
d3d11-subsystem.hpp
|
||||
d3d11-texture2d.cpp
|
||||
d3d11-texture3d.cpp
|
||||
d3d11-vertexbuffer.cpp
|
||||
d3d11-duplicator.cpp
|
||||
d3d11-rebuild.cpp
|
||||
d3d11-zstencilbuffer.cpp
|
||||
intel-nv12-support.hpp)
|
||||
|
||||
set(MODULE_DESCRIPTION "OBS Library D3D11 wrapper")
|
||||
configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in
|
||||
libobs-d3d11.rc)
|
||||
|
||||
set(libobs-d3d11_HEADERS
|
||||
${CMAKE_CURRENT_BINARY_DIR}/d3d11-config.h
|
||||
intel-nv12-support.hpp
|
||||
d3d11-shaderprocessor.hpp
|
||||
d3d11-subsystem.hpp)
|
||||
target_include_directories(libobs-d3d11 PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_library(libobs-d3d11 MODULE
|
||||
${libobs-d3d11_SOURCES}
|
||||
${libobs-d3d11_HEADERS})
|
||||
set_target_properties(libobs-d3d11
|
||||
PROPERTIES
|
||||
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)
|
||||
|
||||
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)
|
||||
else()
|
||||
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)
|
||||
|
||||
set_target_properties(
|
||||
libobs-d3d11
|
||||
PROPERTIES OUTPUT_NAME libobs-d3d11
|
||||
FOLDER "core"
|
||||
OUTPUT_NAME libobs-d3d11
|
||||
PREFIX "")
|
||||
target_link_libraries(libobs-d3d11
|
||||
libobs
|
||||
d3d9
|
||||
d3d11
|
||||
dxgi)
|
||||
|
||||
install_obs_core(libobs-d3d11)
|
||||
setup_binary_target(libobs-d3d11)
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <winternl.h>
|
||||
#include <d3d9.h>
|
||||
#include "d3d11-subsystem.hpp"
|
||||
#include "d3d11-config.h"
|
||||
#include "intel-nv12-support.hpp"
|
||||
|
||||
struct UnsupportedHWError : HRError {
|
||||
|
|
|
@ -1,127 +1,73 @@
|
|||
project(libobs-opengl)
|
||||
|
||||
add_library(libobs-opengl SHARED)
|
||||
add_library(OBS::libobs-opengl ALIAS libobs-opengl)
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
|
||||
add_definitions(-DLIBOBS_EXPORTS)
|
||||
|
||||
if(WIN32)
|
||||
set(MODULE_DESCRIPTION "OBS Library OpenGL wrapper")
|
||||
configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in libobs-opengl.rc)
|
||||
set(libobs-opengl_PLATFORM_SOURCES
|
||||
gl-windows.c
|
||||
libobs-opengl.rc)
|
||||
elseif(APPLE)
|
||||
set(libobs-opengl_PLATFORM_SOURCES
|
||||
gl-cocoa.m)
|
||||
|
||||
find_library(COCOA Cocoa)
|
||||
include_directories(${COCOA})
|
||||
mark_as_advanced(COCOA)
|
||||
|
||||
find_library(IOSURF IOSurface)
|
||||
include_directories(${IOSURF})
|
||||
mark_as_advanced(${IOSURF})
|
||||
|
||||
set(libobs-opengl_PLATFORM_DEPS
|
||||
${COCOA}
|
||||
${IOSURF}
|
||||
${OPENGL_gl_LIBRARY})
|
||||
else()
|
||||
find_package(XCB COMPONENTS XCB REQUIRED)
|
||||
find_package(X11_XCB REQUIRED)
|
||||
|
||||
include_directories(
|
||||
${XCB_INCLUDE_DIRS}
|
||||
${X11_XCB_INCLUDE_DIRS})
|
||||
|
||||
add_definitions(
|
||||
${XCB_DEFINITIONS}
|
||||
${X11_XCB_DEFINITIONS})
|
||||
|
||||
set(libobs-opengl_PLATFORM_DEPS
|
||||
${XCB_LIBRARIES}
|
||||
${X11_XCB_LIBRARIES})
|
||||
|
||||
set(libobs-opengl_PLATFORM_SOURCES
|
||||
gl-egl-common.c
|
||||
gl-nix.c
|
||||
gl-x11-egl.c
|
||||
gl-x11-glx.c)
|
||||
|
||||
if(ENABLE_WAYLAND)
|
||||
find_package(EGL REQUIRED)
|
||||
find_package(Wayland REQUIRED)
|
||||
|
||||
include_directories(
|
||||
${WAYLAND_CLIENT_INCLUDE_DIRS}
|
||||
${WAYLAND_EGL_INCLUDE_DIRS}
|
||||
${EGL_INCLUDE_DIRS})
|
||||
|
||||
add_definitions(
|
||||
${WAYLAND_DEFINITIONS})
|
||||
|
||||
set(libobs-opengl_PLATFORM_DEPS
|
||||
${libobs-opengl_PLATFORM_DEPS}
|
||||
${WAYLAND_CLIENT_LIBRARIES}
|
||||
${WAYLAND_EGL_LIBRARIES}
|
||||
${EGL_LIBRARIES})
|
||||
|
||||
set(libobs-opengl_PLATFORM_SOURCES
|
||||
${libobs-opengl_PLATFORM_SOURCES}
|
||||
gl-wayland-egl.c)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(libobs-opengl_SOURCES
|
||||
${libobs-opengl_PLATFORM_SOURCES}
|
||||
gl-helpers.c
|
||||
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)
|
||||
|
||||
set(libobs-opengl_HEADERS
|
||||
gl-helpers.h
|
||||
gl-shaderparser.h
|
||||
gl-subsystem.h)
|
||||
target_link_libraries(libobs-opengl PRIVATE OBS::libobs OBS::obsglad)
|
||||
|
||||
if(WIN32 OR APPLE)
|
||||
add_library(libobs-opengl MODULE
|
||||
${libobs-opengl_SOURCES}
|
||||
${libobs-opengl_HEADERS})
|
||||
else()
|
||||
add_library(libobs-opengl SHARED
|
||||
${libobs-opengl_SOURCES}
|
||||
${libobs-opengl_HEADERS})
|
||||
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_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
|
||||
gl-x11-glx.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()
|
||||
|
||||
if(WIN32 OR APPLE)
|
||||
set_target_properties(libobs-opengl
|
||||
PROPERTIES
|
||||
FOLDER "core"
|
||||
OUTPUT_NAME libobs-opengl
|
||||
PREFIX "")
|
||||
else()
|
||||
set_target_properties(libobs-opengl
|
||||
PROPERTIES
|
||||
FOLDER "core"
|
||||
OUTPUT_NAME obs-opengl
|
||||
VERSION 0.0
|
||||
SOVERSION 0
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(libobs-opengl
|
||||
libobs
|
||||
glad
|
||||
${libobs-opengl_PLATFORM_DEPS})
|
||||
|
||||
install_obs_core(libobs-opengl)
|
||||
setup_binary_target(libobs-opengl)
|
||||
|
|
|
@ -1,28 +1,13 @@
|
|||
project(libobs-winrt)
|
||||
|
||||
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/libobs")
|
||||
add_library(libobs-winrt MODULE)
|
||||
add_library(OBS::libobs-winrt ALIAS libobs-winrt)
|
||||
|
||||
add_definitions(-DLIBOBS_EXPORTS)
|
||||
target_sources(libobs-winrt PRIVATE winrt-capture.cpp winrt-capture.h
|
||||
winrt-dispatch.cpp winrt-dispatch.h)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set(libobs-winrt_SOURCES
|
||||
winrt-capture.cpp
|
||||
winrt-dispatch.cpp)
|
||||
|
||||
set(libobs-winrt_HEADERS
|
||||
winrt-capture.h
|
||||
winrt-dispatch.h)
|
||||
|
||||
add_library(libobs-winrt MODULE
|
||||
${libobs-winrt_SOURCES}
|
||||
${libobs-winrt_HEADERS})
|
||||
set_target_properties(libobs-winrt
|
||||
PROPERTIES
|
||||
FOLDER "core"
|
||||
OUTPUT_NAME libobs-winrt
|
||||
PREFIX "")
|
||||
target_precompile_headers(libobs-winrt
|
||||
target_precompile_headers(
|
||||
libobs-winrt
|
||||
PRIVATE
|
||||
[["../libobs/util/windows/ComPtr.hpp"]]
|
||||
<obs-module.h>
|
||||
|
@ -33,9 +18,15 @@ target_precompile_headers(libobs-winrt
|
|||
<winrt/Windows.Foundation.Metadata.h>
|
||||
<winrt/Windows.Graphics.Capture.h>
|
||||
<winrt/Windows.System.h>)
|
||||
target_link_libraries(libobs-winrt
|
||||
libobs
|
||||
Dwmapi
|
||||
windowsapp)
|
||||
|
||||
install_obs_core(libobs-winrt)
|
||||
target_link_libraries(libobs-winrt PRIVATE OBS::libobs Dwmapi windowsapp)
|
||||
|
||||
target_compile_features(libobs-winrt PRIVATE cxx_std_17)
|
||||
|
||||
set_target_properties(
|
||||
libobs-winrt
|
||||
PROPERTIES OUTPUT_NAME libobs-winrt
|
||||
FOLDER "core"
|
||||
PREFIX "")
|
||||
|
||||
setup_binary_target(libobs-winrt)
|
||||
|
|
|
@ -1,452 +1,68 @@
|
|||
if(POLICY CMP0090)
|
||||
cmake_policy(SET CMP0090 NEW)
|
||||
endif()
|
||||
|
||||
project(libobs)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
find_package(FFmpeg REQUIRED
|
||||
find_package(
|
||||
FFmpeg REQUIRED
|
||||
COMPONENTS avformat avutil swscale swresample
|
||||
OPTIONAL_COMPONENTS avcodec)
|
||||
include_directories(${FFMPEG_INCLUDE_DIRS})
|
||||
|
||||
if (NOT "${FFMPEG_AVCODEC_LIBRARIES}" STREQUAL "")
|
||||
list(REMOVE_ITEM FFMPEG_LIBRARIES ${FFMPEG_AVCODEC_LIBRARIES})
|
||||
endif()
|
||||
|
||||
add_definitions(-DIS_LIBOBS=1)
|
||||
|
||||
if(DEBUG_FFMPEG_MUX)
|
||||
add_definitions(-DSHOW_SUBPROCESSES)
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
if (NOT APPLE)
|
||||
find_package(X11 REQUIRED)
|
||||
find_package(X11_XCB REQUIRED)
|
||||
find_package(XCB OPTIONAL_COMPONENTS XINPUT)
|
||||
find_package(XCB)
|
||||
find_library(M_LIBRARY NAMES m)
|
||||
find_library(DL_LIBRARY NAMES dl)
|
||||
if (XCB_XINPUT_FOUND)
|
||||
set(USE_XINPUT "1")
|
||||
else()
|
||||
set(USE_XINPUT "0")
|
||||
endif()
|
||||
if (NOT DISABLE_PULSEAUDIO)
|
||||
find_package(PulseAudio REQUIRED)
|
||||
message(STATUS "Found PulseAudio - Audio Monitor enabled")
|
||||
set(HAVE_PULSEAUDIO "1")
|
||||
else()
|
||||
set(HAVE_PULSEAUDIO "0")
|
||||
endif()
|
||||
else()
|
||||
set(HAVE_PULSEAUDIO "0")
|
||||
set(USE_XINPUT "0")
|
||||
endif()
|
||||
find_package(Gio QUIET)
|
||||
else()
|
||||
set(HAVE_DBUS "0")
|
||||
set(HAVE_PULSEAUDIO "0")
|
||||
set(USE_XINPUT "0")
|
||||
endif()
|
||||
|
||||
find_package(ImageMagick QUIET COMPONENTS MagickCore)
|
||||
|
||||
if(NOT ImageMagick_MagickCore_FOUND AND NOT FFMPEG_AVCODEC_FOUND)
|
||||
message(FATAL_ERROR "Either MagickCore or Libavcodec is required, but neither were found.")
|
||||
elseif(NOT ImageMagick_MagickCore_FOUND AND LIBOBS_PREFER_IMAGEMAGICK)
|
||||
message(FATAL_ERROR "ImageMagick support was requested, but was not found.")
|
||||
endif()
|
||||
|
||||
option(LIBOBS_PREFER_IMAGEMAGICK "Prefer ImageMagick over ffmpeg for image loading" OFF)
|
||||
|
||||
if(NOT FFMPEG_AVCODEC_FOUND OR (ImageMagick_MagickCore_FOUND AND LIBOBS_PREFER_IMAGEMAGICK))
|
||||
message(STATUS "Using ImageMagick for image loading in libobs")
|
||||
|
||||
if(${ImageMagick_VERSION_STRING} LESS 7)
|
||||
set(LIBOBS_IMAGEMAGICK_DIR_STYLE LIBOBS_IMAGEMAGICK_DIR_STYLE_6L)
|
||||
elseif(${ImageMagick_VERSION_STRING} GREATER_EQUAL 7)
|
||||
set(LIBOBS_IMAGEMAGICK_DIR_STYLE LIBOBS_IMAGEMAGICK_DIR_STYLE_7GE)
|
||||
endif()
|
||||
|
||||
set(libobs_image_loading_SOURCES
|
||||
graphics/graphics-magick.c)
|
||||
set(libobs_image_loading_LIBRARIES
|
||||
${ImageMagick_LIBRARIES})
|
||||
|
||||
include_directories(${ImageMagick_INCLUDE_DIRS})
|
||||
else()
|
||||
message(STATUS "Using libavcodec for image loading in libobs")
|
||||
|
||||
set(libobs_image_loading_SOURCES
|
||||
graphics/graphics-ffmpeg.c)
|
||||
set(libobs_image_loading_LIBRARIES
|
||||
${FFMPEG_AVCODEC_LIBRARIES})
|
||||
endif()
|
||||
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
include_directories(SYSTEM ${ZLIB_INCLUDE_DIRS})
|
||||
add_library(libobs SHARED)
|
||||
add_library(OBS::libobs ALIAS libobs)
|
||||
|
||||
add_definitions(-DLIBOBS_EXPORTS)
|
||||
|
||||
include_directories(${OBS_JANSSON_INCLUDE_DIRS})
|
||||
|
||||
if(WIN32)
|
||||
set(MODULE_DESCRIPTION "OBS Library")
|
||||
file(STRINGS obs-config.h _version_parse REGEX "^.*(MAJOR|MINOR|PATCH)_VER[ \t]+[0-9]+[ \t]*$")
|
||||
|
||||
string(REGEX REPLACE ".*MAJOR_VER[ \t]+([0-9]+).*" "\\1" UI_VERSION_MAJOR "${_version_parse}")
|
||||
string(REGEX REPLACE ".*MINOR_VER[ \t]+([0-9]+).*" "\\1" UI_VERSION_MINOR "${_version_parse}")
|
||||
string(REGEX REPLACE ".*PATCH_VER[ \t]+([0-9]+).*" "\\1" UI_VERSION_PATCH "${_version_parse}")
|
||||
set(UI_VERSION "${UI_VERSION_MAJOR}.${UI_VERSION_MINOR}.${UI_VERSION_PATCH}")
|
||||
|
||||
configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in libobs.rc)
|
||||
set(libobs_PLATFORM_SOURCES
|
||||
obs-win-crash-handler.c
|
||||
obs-windows.c
|
||||
util/threading-windows.c
|
||||
util/pipe-windows.c
|
||||
util/platform-windows.c
|
||||
libobs.rc)
|
||||
set(libobs_PLATFORM_HEADERS
|
||||
util/threading-windows.h
|
||||
util/windows/win-registry.h
|
||||
util/windows/win-version.h
|
||||
util/windows/ComPtr.hpp
|
||||
util/windows/CoTaskMemPtr.hpp
|
||||
util/windows/HRError.hpp
|
||||
util/windows/WinHandle.hpp)
|
||||
set(libobs_audio_monitoring_SOURCES
|
||||
audio-monitoring/win32/wasapi-enum-devices.c
|
||||
audio-monitoring/win32/wasapi-monitoring-available.c
|
||||
audio-monitoring/win32/wasapi-output.c
|
||||
)
|
||||
set(libobs_audio_monitoring_HEADERS
|
||||
audio-monitoring/win32/wasapi-output.h
|
||||
)
|
||||
set(libobs_PLATFORM_DEPS Avrt winmm)
|
||||
if(MSVC)
|
||||
set(libobs_PLATFORM_DEPS
|
||||
${libobs_PLATFORM_DEPS}
|
||||
w32-pthreads)
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
set(libobs_PLATFORM_SOURCES
|
||||
obs-cocoa.m
|
||||
util/threading-posix.c
|
||||
util/pipe-posix.c
|
||||
util/platform-nix.c
|
||||
util/platform-cocoa.m)
|
||||
set(libobs_PLATFORM_HEADERS
|
||||
util/threading-posix.h
|
||||
util/apple/cfstring-utils.h)
|
||||
set(libobs_audio_monitoring_SOURCES
|
||||
audio-monitoring/osx/coreaudio-enum-devices.c
|
||||
audio-monitoring/osx/coreaudio-monitoring-available.c
|
||||
audio-monitoring/osx/coreaudio-output.c
|
||||
)
|
||||
set(libobs_audio_monitoring_HEADERS
|
||||
audio-monitoring/osx/mac-helpers.h
|
||||
)
|
||||
|
||||
set_source_files_properties(${libobs_PLATFORM_SOURCES}
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "-fobjc-arc")
|
||||
|
||||
find_library(COCOA Cocoa)
|
||||
mark_as_advanced(COCOA)
|
||||
include_directories(${COCOA})
|
||||
|
||||
find_library(COREAUDIO CoreAudio)
|
||||
mark_as_advanced(COREAUDIO)
|
||||
include_directories(${COREAUDIO})
|
||||
|
||||
find_library(AUDIOTOOLBOX AudioToolbox)
|
||||
mark_as_advanced(AUDIOTOOLBOX)
|
||||
include_directories(${AUDIOTOOLBOX})
|
||||
|
||||
find_library(AUDIOUNIT AudioUnit)
|
||||
mark_as_advanced(AUDIOUNIT)
|
||||
include_directories(${AUDIOUNIT})
|
||||
|
||||
find_library(APPKIT AppKit)
|
||||
mark_as_advanced(APPKIT)
|
||||
include_directories(${APPKIT})
|
||||
|
||||
find_library(IOKIT IOKit)
|
||||
mark_as_advanced(IOKIT)
|
||||
include_directories(${IOKIT})
|
||||
|
||||
find_library(CARBON Carbon)
|
||||
mark_as_advanced(CARBON)
|
||||
include_directories(${CARBON})
|
||||
|
||||
set(libobs_PLATFORM_DEPS
|
||||
${COCOA}
|
||||
${COREAUDIO}
|
||||
${AUDIOUNIT}
|
||||
${AUDIOTOOLBOX}
|
||||
${APPKIT}
|
||||
${IOKIT}
|
||||
${CARBON})
|
||||
elseif(UNIX)
|
||||
set(libobs_PLATFORM_SOURCES
|
||||
obs-nix.c
|
||||
obs-nix-platform.c
|
||||
obs-nix-x11.c
|
||||
util/threading-posix.c
|
||||
util/pipe-posix.c
|
||||
util/platform-nix.c)
|
||||
|
||||
set(libobs_PLATFORM_HEADERS
|
||||
util/threading-posix.h
|
||||
obs-nix-platform.h)
|
||||
|
||||
if(ENABLE_WAYLAND)
|
||||
find_package(Wayland COMPONENTS Client REQUIRED)
|
||||
find_package(Xkbcommon REQUIRED)
|
||||
|
||||
set(libobs_PLATFORM_SOURCES ${libobs_PLATFORM_SOURCES}
|
||||
obs-nix-wayland.c)
|
||||
|
||||
include_directories(
|
||||
${WAYLAND_CLIENT_INCLUDE_DIR}
|
||||
${XKBCOMMON_INCLUDE_DIR})
|
||||
add_definitions(
|
||||
${WAYLAND_DEFINITIONS})
|
||||
set(libobs_PLATFORM_DEPS
|
||||
${libobs_PLATFORM_DEPS}
|
||||
${WAYLAND_CLIENT_LIBRARIES}
|
||||
${XKBCOMMON_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(HAVE_PULSEAUDIO)
|
||||
set(libobs_audio_monitoring_HEADERS
|
||||
audio-monitoring/pulse/pulseaudio-wrapper.h)
|
||||
|
||||
set(libobs_audio_monitoring_SOURCES
|
||||
audio-monitoring/pulse/pulseaudio-wrapper.c
|
||||
audio-monitoring/pulse/pulseaudio-enum-devices.c
|
||||
audio-monitoring/pulse/pulseaudio-monitoring-available.c
|
||||
audio-monitoring/pulse/pulseaudio-output.c)
|
||||
else()
|
||||
set(libobs_audio_monitoring_SOURCES
|
||||
audio-monitoring/null/null-audio-monitoring.c)
|
||||
endif()
|
||||
if(GIO_FOUND)
|
||||
set(libobs_PLATFORM_SOURCES ${libobs_PLATFORM_SOURCES}
|
||||
util/platform-nix-dbus.c
|
||||
util/platform-nix-portal.c)
|
||||
include_directories(${GIO_INCLUDE_DIRS})
|
||||
add_definitions(
|
||||
${GIO_DEFINITIONS})
|
||||
set(libobs_PLATFORM_DEPS
|
||||
${libobs_PLATFORM_DEPS}
|
||||
${GIO_LIBRARIES})
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
${X11_X11_INCLUDE_PATH}
|
||||
${X11_XCB_INCLUDE_DIRS})
|
||||
add_definitions(
|
||||
${X11_XCB_DEFINITIONS})
|
||||
set(libobs_PLATFORM_DEPS
|
||||
${libobs_PLATFORM_DEPS}
|
||||
${DL_LIBRARY}
|
||||
${M_LIBRARY}
|
||||
${X11_X11_LIB}
|
||||
${XCB_LIBRARIES}
|
||||
${X11_XCB_LIBRARIES})
|
||||
|
||||
if(USE_XINPUT)
|
||||
include_directories(
|
||||
${XCB_XINPUT_INCLUDE_DIR})
|
||||
add_definitions(
|
||||
${XCB_DEFINITIONS})
|
||||
set(libobs_PLATFORM_DEPS
|
||||
${XCB_XINPUT_LIBRARY}
|
||||
${libobs_PLATFORM_DEPS})
|
||||
endif()
|
||||
|
||||
if(HAVE_PULSEAUDIO)
|
||||
set(libobs_PLATFORM_DEPS
|
||||
${libobs_PLATFORM_DEPS}
|
||||
${PULSEAUDIO_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
# use the sysinfo compatibility library on bsd
|
||||
find_package(Libsysinfo REQUIRED)
|
||||
include_directories(${SYSINFO_INCLUDE_DIRS})
|
||||
set(libobs_PLATFORM_DEPS
|
||||
${libobs_PLATFORM_DEPS}
|
||||
${SYSINFO_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /EHc-")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHc-")
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/obsconfig.h.in"
|
||||
"${CMAKE_BINARY_DIR}/config/obsconfig.h")
|
||||
|
||||
set(libobs_config_HEADERS
|
||||
"${CMAKE_BINARY_DIR}/config/obsconfig.h"
|
||||
obs-config.h)
|
||||
|
||||
set(libobs_callback_SOURCES
|
||||
callback/calldata.c
|
||||
callback/decl.c
|
||||
callback/signal.c
|
||||
callback/proc.c)
|
||||
set(libobs_callback_HEADERS
|
||||
callback/calldata.h
|
||||
callback/decl.h
|
||||
callback/proc.h
|
||||
callback/signal.h)
|
||||
|
||||
set(libobs_graphics_SOURCES
|
||||
${libobs_image_loading_SOURCES}
|
||||
graphics/quat.c
|
||||
graphics/effect-parser.c
|
||||
graphics/axisang.c
|
||||
graphics/vec4.c
|
||||
graphics/vec2.c
|
||||
graphics/libnsgif/libnsgif.c
|
||||
graphics/texture-render.c
|
||||
graphics/image-file.c
|
||||
graphics/bounds.c
|
||||
graphics/matrix3.c
|
||||
graphics/matrix4.c
|
||||
graphics/vec3.c
|
||||
graphics/graphics.c
|
||||
graphics/shader-parser.c
|
||||
graphics/plane.c
|
||||
graphics/effect.c
|
||||
graphics/math-extra.c
|
||||
graphics/graphics-imports.c)
|
||||
set(libobs_graphics_HEADERS
|
||||
graphics/half.h
|
||||
graphics/plane.h
|
||||
graphics/quat.h
|
||||
graphics/input.h
|
||||
graphics/axisang.h
|
||||
graphics/shader-parser.h
|
||||
graphics/effect.h
|
||||
graphics/math-defs.h
|
||||
graphics/matrix4.h
|
||||
graphics/graphics.h
|
||||
graphics/graphics-internal.h
|
||||
graphics/libnsgif/libnsgif.h
|
||||
graphics/device-exports.h
|
||||
graphics/image-file.h
|
||||
graphics/srgb.h
|
||||
graphics/vec2.h
|
||||
graphics/vec4.h
|
||||
graphics/matrix3.h
|
||||
graphics/vec3.h
|
||||
graphics/math-extra.h
|
||||
graphics/bounds.h
|
||||
graphics/effect-parser.h)
|
||||
|
||||
set(libobs_mediaio_SOURCES
|
||||
media-io/video-io.c
|
||||
media-io/video-fourcc.c
|
||||
media-io/video-matrices.c
|
||||
media-io/audio-io.c
|
||||
media-io/video-frame.c
|
||||
media-io/format-conversion.c
|
||||
media-io/audio-resampler-ffmpeg.c
|
||||
media-io/video-scaler-ffmpeg.c
|
||||
media-io/media-remux.c)
|
||||
set(libobs_mediaio_HEADERS
|
||||
media-io/media-io-defs.h
|
||||
media-io/video-io.h
|
||||
media-io/audio-io.h
|
||||
media-io/audio-math.h
|
||||
media-io/video-frame.h
|
||||
media-io/format-conversion.h
|
||||
media-io/audio-resampler.h
|
||||
media-io/video-scaler.h
|
||||
media-io/media-remux.h
|
||||
media-io/frame-rate.h)
|
||||
|
||||
set(libobs_util_SOURCES
|
||||
util/array-serializer.c
|
||||
util/file-serializer.c
|
||||
util/base.c
|
||||
util/platform.c
|
||||
util/cf-lexer.c
|
||||
util/bmem.c
|
||||
util/config-file.c
|
||||
util/lexer.c
|
||||
util/task.c
|
||||
util/dstr.c
|
||||
util/utf8.c
|
||||
util/crc32.c
|
||||
util/text-lookup.c
|
||||
util/cf-parser.c
|
||||
util/profiler.c
|
||||
util/bitstream.c)
|
||||
set(libobs_util_HEADERS
|
||||
util/curl/curl-helper.h
|
||||
util/sse-intrin.h
|
||||
util/array-serializer.h
|
||||
util/file-serializer.h
|
||||
util/utf8.h
|
||||
util/crc32.h
|
||||
util/base.h
|
||||
util/text-lookup.h
|
||||
util/bmem.h
|
||||
util/c99defs.h
|
||||
util/util_uint64.h
|
||||
util/util_uint128.h
|
||||
util/cf-parser.h
|
||||
util/threading.h
|
||||
util/pipe.h
|
||||
util/cf-lexer.h
|
||||
util/darray.h
|
||||
util/circlebuf.h
|
||||
util/dstr.h
|
||||
util/serializer.h
|
||||
util/config-file.h
|
||||
util/lexer.h
|
||||
util/task.h
|
||||
util/platform.h
|
||||
util/profiler.h
|
||||
util/profiler.hpp
|
||||
util/bitstream.h
|
||||
util/util.hpp)
|
||||
|
||||
set(libobs_libobs_SOURCES
|
||||
${libobs_PLATFORM_SOURCES}
|
||||
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-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-output.c
|
||||
obs-output-delay.c
|
||||
obs.c
|
||||
obs-properties.c
|
||||
obs-data.c
|
||||
obs-missing-files.c
|
||||
obs-hotkey.c
|
||||
obs-hotkey-name-map.c
|
||||
obs-module.c
|
||||
obs-display.c
|
||||
obs-view.c
|
||||
obs-scene.c
|
||||
obs-audio.c
|
||||
obs-ui.h
|
||||
obs-video.c
|
||||
obs-video-gpu-encode.c
|
||||
obs-video.c)
|
||||
set(libobs_libobs_HEADERS
|
||||
util/simde/check.h
|
||||
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
|
||||
|
@ -459,50 +75,135 @@ set(libobs_libobs_HEADERS
|
|||
util/simde/simde-math.h
|
||||
util/simde/x86/mmx.h
|
||||
util/simde/x86/sse2.h
|
||||
util/simde/x86/sse.h
|
||||
${libobs_PLATFORM_HEADERS}
|
||||
obs-audio-controls.h
|
||||
obs-defs.h
|
||||
obs-avc.h
|
||||
obs-encoder.h
|
||||
obs-service.h
|
||||
obs-internal.h
|
||||
obs.h
|
||||
obs-ui.h
|
||||
obs-properties.h
|
||||
obs-data.h
|
||||
obs-missing-files.h
|
||||
obs-interaction.h
|
||||
obs-hotkey.h
|
||||
obs-hotkeys.h
|
||||
obs-module.h
|
||||
obs-scene.h
|
||||
obs-source.h
|
||||
obs-output.h
|
||||
obs-ffmpeg-compat.h
|
||||
obs.hpp)
|
||||
util/simde/x86/sse.h)
|
||||
|
||||
set(libobs_SOURCES
|
||||
${libobs_callback_SOURCES}
|
||||
${libobs_graphics_SOURCES}
|
||||
${libobs_mediaio_SOURCES}
|
||||
${libobs_util_SOURCES}
|
||||
${libobs_libobs_SOURCES}
|
||||
${libobs_audio_monitoring_SOURCES}
|
||||
)
|
||||
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)
|
||||
|
||||
set(libobs_HEADERS
|
||||
${libobs_config_HEADERS}
|
||||
${libobs_callback_HEADERS}
|
||||
${libobs_graphics_HEADERS}
|
||||
${libobs_mediaio_HEADERS}
|
||||
${libobs_util_HEADERS}
|
||||
${libobs_libobs_HEADERS}
|
||||
${libobs_audio_monitoring_HEADERS}
|
||||
)
|
||||
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)
|
||||
|
||||
set(libobs_data_EFFECTS
|
||||
data/area.effect
|
||||
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/util_uint64.h
|
||||
util/util_uint128.h
|
||||
util/curl/curl-helper.h
|
||||
util/darray.h
|
||||
util/util.hpp)
|
||||
|
||||
# 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/default.effect
|
||||
|
@ -522,72 +223,245 @@ set(libobs_data_EFFECTS
|
|||
data/premultiplied_alpha.effect
|
||||
data/repeat.effect
|
||||
data/solid.effect)
|
||||
|
||||
source_group("callback\\Source Files" FILES ${libobs_callback_SOURCES})
|
||||
source_group("callback\\Header Files" FILES ${libobs_callback_HEADERS})
|
||||
source_group("data\\Effect Files" FILES ${libobs_data_EFFECTS})
|
||||
source_group("graphics\\Source Files" FILES ${libobs_graphics_SOURCES})
|
||||
source_group("graphics\\Header Files" FILES ${libobs_graphics_HEADERS})
|
||||
source_group("libobs\\Source Files" FILES ${libobs_libobs_SOURCES})
|
||||
source_group("libobs\\Header Files" FILES ${libobs_libobs_HEADERS})
|
||||
source_group("media-io\\Source Files" FILES ${libobs_mediaio_SOURCES})
|
||||
source_group("media-io\\Header Files" FILES ${libobs_mediaio_HEADERS})
|
||||
source_group("util\\Source Files" FILES ${libobs_util_SOURCES})
|
||||
source_group("util\\Header Files" FILES ${libobs_util_HEADERS})
|
||||
source_group("audio-monitoring\\Source Files" FILES ${libobs_audio_monitoring_SOURCES})
|
||||
source_group("audio-monitoring\\Header Files" FILES ${libobs_audio_monitoring_HEADERS})
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR}/deps/libcaption)
|
||||
set(libobs_PLATFORM_DEPS
|
||||
${libobs_PLATFORM_DEPS}
|
||||
caption)
|
||||
|
||||
add_library(libobs SHARED ${libobs_SOURCES} ${libobs_HEADERS} ${libobs_data_EFFECTS})
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(DEST_DIR "${CMAKE_INSTALL_PREFIX}")
|
||||
foreach(LIB "obs" "rt")
|
||||
set(PRIVATE_LIBS "${PRIVATE_LIBS} -l${LIB}")
|
||||
endforeach()
|
||||
if(LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64(le)?")
|
||||
set(PPC64_CFLAGS "-DNO_WARN_X86_INTRINSICS -mvsx")
|
||||
endif()
|
||||
CONFIGURE_FILE("libobs.pc.in" "libobs.pc" @ONLY)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libobs.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
endif()
|
||||
|
||||
set_target_properties(libobs PROPERTIES
|
||||
target_link_libraries(
|
||||
libobs
|
||||
PRIVATE FFmpeg::avcodec
|
||||
FFmpeg::avformat
|
||||
FFmpeg::avutil
|
||||
FFmpeg::swscale
|
||||
FFmpeg::swresample
|
||||
Jansson::Jansson
|
||||
OBS::caption
|
||||
ZLIB::ZLIB
|
||||
PUBLIC Threads::Threads)
|
||||
|
||||
set_target_properties(
|
||||
libobs
|
||||
PROPERTIES OUTPUT_NAME obs
|
||||
FOLDER "core"
|
||||
OUTPUT_NAME obs
|
||||
VERSION "0"
|
||||
VERSION "${OBS_VERSION_MAJOR}"
|
||||
SOVERSION "0")
|
||||
target_compile_definitions(libobs
|
||||
PUBLIC
|
||||
HAVE_OBSCONFIG_H)
|
||||
|
||||
target_compile_definitions(libobs
|
||||
PUBLIC
|
||||
${ARCH_SIMD_DEFINES})
|
||||
target_compile_definitions(
|
||||
libobs
|
||||
PUBLIC ${ARCH_SIMD_DEFINES}
|
||||
PRIVATE IS_LIBOBS)
|
||||
|
||||
target_compile_options(libobs
|
||||
PUBLIC
|
||||
${ARCH_SIMD_FLAGS})
|
||||
target_compile_features(libobs PRIVATE cxx_alias_templates)
|
||||
|
||||
target_include_directories(libobs
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
|
||||
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/config>"
|
||||
"$<INSTALL_INTERFACE:${OBS_INCLUDE_DESTINATION}>")
|
||||
target_link_libraries(libobs
|
||||
PRIVATE
|
||||
${libobs_PLATFORM_DEPS}
|
||||
${libobs_image_loading_LIBRARIES}
|
||||
${OBS_JANSSON_IMPORT}
|
||||
${FFMPEG_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
Threads::Threads)
|
||||
target_compile_options(libobs PUBLIC ${ARCH_SIMD_FLAGS})
|
||||
|
||||
install_obs_core(libobs EXPORT LibObs)
|
||||
install_obs_data(libobs data libobs)
|
||||
install_obs_headers(${libobs_HEADERS})
|
||||
target_include_directories(
|
||||
libobs PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/config>)
|
||||
|
||||
obs_install_additional(libobs)
|
||||
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/win-registry.h
|
||||
util/windows/win-version.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 Avrt winmm)
|
||||
|
||||
if(MSVC)
|
||||
target_link_libraries(libobs PRIVATE OBS::w32-pthreads)
|
||||
|
||||
target_compile_options(libobs PRIVATE "$<$<COMPILE_LANGUAGE:C>:/EHc->"
|
||||
"$<$<COMPILE_LANGUAGE:CXX>:/EHc->")
|
||||
|
||||
target_link_options(libobs PRIVATE "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
|
||||
"$<TARGET_FILE_DIR:OBS::libobs-opengl>")
|
||||
|
||||
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(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)
|
||||
|
||||
if(USE_XDG)
|
||||
target_compile_definitions(libobs PRIVATE USE_XDG)
|
||||
endif()
|
||||
|
||||
if(ENABLE_PULSEAUDIO)
|
||||
find_package(PulseAudio REQUIRED)
|
||||
message(STATUS "OBS: 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()
|
||||
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 "$<TARGET_FILE_DIR:OBS::libobs-opengl>")
|
||||
endif()
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/obsconfig.h.in
|
||||
${CMAKE_BINARY_DIR}/config/obsconfig.h)
|
||||
|
||||
target_compile_definitions(libobs PUBLIC HAVE_OBSCONFIG_H)
|
||||
|
||||
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)
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
@PACKAGE_INIT@
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
|
||||
check_required_components("@PROJECT_NAME@")
|
||||
|
||||
if(MSVC)
|
||||
find_package(w32-pthreads REQUIRED)
|
||||
endif()
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
set(LIBOBS_PLUGIN_DESTINATION "@PACKAGE_OBS_PLUGIN_DESTINATION@")
|
||||
set(LIBOBS_PLUGIN_DATA_DESTINATION "@PACKAGE_OBS_DATA_DESTINATION@/obs-plugins")
|
||||
|
||||
set(LIBOBS_LIBRARIES libobs)
|
|
@ -38,44 +38,30 @@ bool is_in_bundle()
|
|||
|
||||
const char *get_module_extension(void)
|
||||
{
|
||||
return ".so";
|
||||
return "";
|
||||
}
|
||||
|
||||
static const char *module_bin[] = {
|
||||
"../obs-plugins",
|
||||
OBS_INSTALL_PREFIX "obs-plugins",
|
||||
};
|
||||
|
||||
static const char *module_data[] = {
|
||||
"../data/obs-plugins/%module%",
|
||||
OBS_INSTALL_DATA_PATH "obs-plugins/%module%",
|
||||
};
|
||||
|
||||
static const int module_patterns_size =
|
||||
sizeof(module_bin) / sizeof(module_bin[0]);
|
||||
|
||||
void add_default_module_paths(void)
|
||||
{
|
||||
for (int i = 0; i < module_patterns_size; i++)
|
||||
obs_add_module_path(module_bin[i], module_data[i]);
|
||||
struct dstr plugin_path;
|
||||
|
||||
if (is_in_bundle()) {
|
||||
NSRunningApplication *app =
|
||||
[NSRunningApplication currentApplication];
|
||||
NSURL *bundleURL = [app bundleURL];
|
||||
NSURL *pluginsURL = [bundleURL
|
||||
URLByAppendingPathComponent:@"Contents/PlugIns"];
|
||||
NSURL *dataURL = [bundleURL
|
||||
URLByAppendingPathComponent:
|
||||
@"Contents/Resources/data/obs-plugins/%module%"];
|
||||
dstr_init_move_array(&plugin_path, os_get_executable_path_ptr(""));
|
||||
dstr_cat(&plugin_path, "../PlugIns");
|
||||
char *abs_plugin_path = os_get_abs_path_ptr(plugin_path.array);
|
||||
|
||||
const char *binPath = [[pluginsURL path]
|
||||
cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
const char *dataPath = [[dataURL path]
|
||||
cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
if (abs_plugin_path != NULL) {
|
||||
dstr_move_array(&plugin_path, abs_plugin_path);
|
||||
struct dstr plugin_data;
|
||||
dstr_init_copy_dstr(&plugin_data, &plugin_path);
|
||||
dstr_cat(&plugin_path, "/%module%.plugin/Contents/MacOS/");
|
||||
dstr_cat(&plugin_data, "/%module%.plugin/Contents/Resources/");
|
||||
|
||||
obs_add_module_path(binPath, dataPath);
|
||||
obs_add_module_path(plugin_path.array, plugin_data.array);
|
||||
|
||||
dstr_free(&plugin_data);
|
||||
}
|
||||
|
||||
dstr_free(&plugin_path);
|
||||
}
|
||||
|
||||
char *find_libobs_data_file(const char *file)
|
||||
|
@ -83,12 +69,11 @@ char *find_libobs_data_file(const char *file)
|
|||
struct dstr path;
|
||||
|
||||
if (is_in_bundle()) {
|
||||
NSRunningApplication *app =
|
||||
[NSRunningApplication currentApplication];
|
||||
NSURL *bundleURL = [app bundleURL];
|
||||
NSBundle *frameworkBundle = [NSBundle
|
||||
bundleWithIdentifier:@"com.obsproject.libobs"];
|
||||
NSURL *bundleURL = [frameworkBundle bundleURL];
|
||||
NSURL *libobsDataURL =
|
||||
[bundleURL URLByAppendingPathComponent:
|
||||
@"Contents/Resources/data/libobs/"];
|
||||
[bundleURL URLByAppendingPathComponent:@"Resources/"];
|
||||
const char *libobsDataPath = [[libobsDataURL path]
|
||||
cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
dstr_init_copy(&path, libobsDataPath);
|
||||
|
|
|
@ -358,9 +358,17 @@ static bool parse_binary_from_directory(struct dstr *parsed_bin_path,
|
|||
|
||||
dstr_copy_dstr(parsed_bin_path, &directory);
|
||||
dstr_cat(parsed_bin_path, file);
|
||||
#ifdef __APPLE__
|
||||
if (!os_file_exists(parsed_bin_path->array)) {
|
||||
dstr_cat(parsed_bin_path, ".so");
|
||||
}
|
||||
#else
|
||||
dstr_cat(parsed_bin_path, get_module_extension());
|
||||
#endif
|
||||
|
||||
if (!os_file_exists(parsed_bin_path->array)) {
|
||||
/* Legacy fallback: Check for plugin with .so suffix*/
|
||||
dstr_cat(parsed_bin_path, ".so");
|
||||
/* if the file doesn't exist, check with 'lib' prefix */
|
||||
dstr_copy_dstr(parsed_bin_path, &directory);
|
||||
dstr_cat(parsed_bin_path, "lib");
|
||||
|
@ -397,15 +405,15 @@ static void process_found_module(struct obs_module_path *omp, const char *path,
|
|||
return;
|
||||
|
||||
dstr_copy(&name, file);
|
||||
if (!directory) {
|
||||
char *ext = strrchr(name.array, '.');
|
||||
if (ext)
|
||||
dstr_resize(&name, ext - name.array);
|
||||
|
||||
if (!directory) {
|
||||
dstr_copy(&parsed_bin_path, path);
|
||||
} else {
|
||||
bin_found = parse_binary_from_directory(&parsed_bin_path,
|
||||
omp->bin, file);
|
||||
omp->bin, name.array);
|
||||
}
|
||||
|
||||
parsed_data_dir = make_data_directory(name.array, omp->data);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "obs-nix-x11.h"
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
#if USE_XINPUT
|
||||
#if defined(XINPUT_FOUND)
|
||||
#include <xcb/xinput.h>
|
||||
#endif
|
||||
#include <X11/Xlib.h>
|
||||
|
@ -94,7 +94,7 @@ struct obs_hotkeys_platform {
|
|||
int num_keysyms;
|
||||
int syms_per_code;
|
||||
|
||||
#if USE_XINPUT
|
||||
#if defined(XINPUT_FOUND)
|
||||
bool pressed[XINPUT_MOUSE_LEN];
|
||||
bool update[XINPUT_MOUSE_LEN];
|
||||
bool button_pressed[XINPUT_MOUSE_LEN];
|
||||
|
@ -805,7 +805,7 @@ static inline xcb_window_t root_window(obs_hotkeys_platform_t *context,
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if USE_XINPUT
|
||||
#if defined(XINPUT_FOUND)
|
||||
static inline void registerMouseEvents(struct obs_core_hotkeys *hotkeys)
|
||||
{
|
||||
obs_hotkeys_platform_t *context = hotkeys->platform_context;
|
||||
|
@ -836,7 +836,7 @@ static bool obs_nix_x11_hotkeys_platform_init(struct obs_core_hotkeys *hotkeys)
|
|||
hotkeys->platform_context = bzalloc(sizeof(obs_hotkeys_platform_t));
|
||||
hotkeys->platform_context->display = display;
|
||||
|
||||
#if USE_XINPUT
|
||||
#if defined(XINPUT_FOUND)
|
||||
registerMouseEvents(hotkeys);
|
||||
#endif
|
||||
fill_base_keysyms(hotkeys);
|
||||
|
@ -864,7 +864,7 @@ static bool mouse_button_pressed(xcb_connection_t *connection,
|
|||
{
|
||||
bool ret = false;
|
||||
|
||||
#if USE_XINPUT
|
||||
#if defined(XINPUT_FOUND)
|
||||
memset(context->pressed, 0, XINPUT_MOUSE_LEN);
|
||||
memset(context->update, 0, XINPUT_MOUSE_LEN);
|
||||
|
||||
|
|
|
@ -54,16 +54,15 @@ const char *get_module_extension(void)
|
|||
#define FLATPAK_PLUGIN_PATH "/app/plugins"
|
||||
|
||||
static const char *module_bin[] = {
|
||||
"../../obs-plugins/" BIT_STRING,
|
||||
OBS_INSTALL_PREFIX "/" OBS_PLUGIN_DESTINATION,
|
||||
"../../obs-plugins/" BIT_STRING,
|
||||
FLATPAK_PLUGIN_PATH "/" OBS_PLUGIN_DESTINATION,
|
||||
};
|
||||
|
||||
static const char *module_data[] = {
|
||||
OBS_DATA_PATH "/obs-plugins/%module%",
|
||||
OBS_INSTALL_DATA_PATH "/obs-plugins/%module%",
|
||||
FLATPAK_PLUGIN_PATH "/share/obs/obs-plugins/%module%",
|
||||
};
|
||||
OBS_DATA_PATH "/obs-plugins/%module%",
|
||||
FLATPAK_PLUGIN_PATH "/share/obs/obs-plugins/%module%"};
|
||||
|
||||
static const int module_patterns_size =
|
||||
sizeof(module_bin) / sizeof(module_bin[0]);
|
||||
|
|
|
@ -10,18 +10,15 @@
|
|||
#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_RELATIVE_PREFIX "@OBS_RELATIVE_PREFIX@"
|
||||
#define OBS_UNIX_STRUCTURE @OBS_UNIX_STRUCTURE@
|
||||
#define HAVE_DBUS @HAVE_DBUS@
|
||||
#define HAVE_PULSEAUDIO @HAVE_PULSEAUDIO@
|
||||
#define USE_XINPUT @USE_XINPUT@
|
||||
#define LIBOBS_IMAGEMAGICK_DIR_STYLE_6L 6
|
||||
#define LIBOBS_IMAGEMAGICK_DIR_STYLE_7GE 7
|
||||
#define LIBOBS_IMAGEMAGICK_DIR_STYLE @LIBOBS_IMAGEMAGICK_DIR_STYLE@
|
||||
|
||||
#define LINUX_PORTABLE "@LINUX_PORTABLE@"
|
||||
#cmakedefine GIO_FOUND
|
||||
#cmakedefine PULSEAUDIO_FOUND
|
||||
#cmakedefine XCB_XINPUT_FOUND
|
||||
#cmakedefine ENABLE_WAYLAND
|
||||
|
||||
/* NOTE: Release candidate version numbers internally are always the previous
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
||||
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@/obs
|
||||
|
||||
Name: libobs
|
||||
Description: OBS Studio Library
|
||||
Version: @OBS_VERSION_CANONICAL@
|
||||
Cflags: -I${includedir} @_TARGET_DEFINITIONS@ @_TARGET_OPTIONS@ @_LINKED_DEFINITIONS@
|
||||
Libs: -L${libdir} @_LINKED_LIBRARIES@
|
|
@ -24,16 +24,18 @@
|
|||
#define UNUSED_PARAMETER(param) (void)param
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define OBS_UNUSED
|
||||
#define OBS_DEPRECATED __declspec(deprecated)
|
||||
#define OBS_NORETURN __declspec(noreturn)
|
||||
#define FORCE_INLINE __forceinline
|
||||
#else
|
||||
#define OBS_UNUSED __attribute__((unused))
|
||||
#define OBS_DEPRECATED __attribute__((deprecated))
|
||||
#define OBS_NORETURN __attribute__((noreturn))
|
||||
#define FORCE_INLINE inline __attribute__((always_inline))
|
||||
#endif
|
||||
|
||||
#if defined(IS_LIBOBS) || defined(SWIG)
|
||||
#if defined(IS_LIBOBS) || defined(SWIG_TYPE_TABLE)
|
||||
#define OBS_EXTERNAL_DEPRECATED
|
||||
#else
|
||||
#define OBS_EXTERNAL_DEPRECATED OBS_DEPRECATED
|
||||
|
|
|
@ -64,7 +64,9 @@ void *os_dlopen(const char *path)
|
|||
|
||||
dstr_init_copy(&dylib_name, path);
|
||||
#ifdef __APPLE__
|
||||
if (!dstr_find(&dylib_name, ".so") && !dstr_find(&dylib_name, ".dylib"))
|
||||
if (!dstr_find(&dylib_name, ".framework") &&
|
||||
!dstr_find(&dylib_name, ".plugin") &&
|
||||
!dstr_find(&dylib_name, ".dylib") && !dstr_find(&dylib_name, ".so"))
|
||||
#else
|
||||
if (!dstr_find(&dylib_name, ".so"))
|
||||
#endif
|
||||
|
@ -629,7 +631,7 @@ int os_chdir(const char *path)
|
|||
|
||||
#if !defined(__APPLE__)
|
||||
|
||||
#if HAVE_DBUS
|
||||
#if defined(GIO_FOUND)
|
||||
struct dbus_sleep_info;
|
||||
struct portal_inhibit_info;
|
||||
|
||||
|
@ -645,7 +647,7 @@ extern void portal_inhibit_info_destroy(struct portal_inhibit_info *portal);
|
|||
#endif
|
||||
|
||||
struct os_inhibit_info {
|
||||
#if HAVE_DBUS
|
||||
#if defined(GIO_FOUND)
|
||||
struct dbus_sleep_info *dbus;
|
||||
struct portal_inhibit_info *portal;
|
||||
#endif
|
||||
|
@ -661,7 +663,7 @@ os_inhibit_t *os_inhibit_sleep_create(const char *reason)
|
|||
struct os_inhibit_info *info = bzalloc(sizeof(*info));
|
||||
sigset_t set;
|
||||
|
||||
#if HAVE_DBUS
|
||||
#if defined(GIO_FOUND)
|
||||
info->portal = portal_inhibit_info_create();
|
||||
if (!info->portal)
|
||||
info->dbus = dbus_sleep_info_create();
|
||||
|
@ -718,7 +720,7 @@ bool os_inhibit_sleep_set_active(os_inhibit_t *info, bool active)
|
|||
if (info->active == active)
|
||||
return false;
|
||||
|
||||
#if HAVE_DBUS
|
||||
#if defined(GIO_FOUND)
|
||||
if (info->portal)
|
||||
portal_inhibit(info->portal, info->reason, active);
|
||||
if (info->dbus)
|
||||
|
@ -749,7 +751,7 @@ void os_inhibit_sleep_destroy(os_inhibit_t *info)
|
|||
{
|
||||
if (info) {
|
||||
os_inhibit_sleep_set_active(info, false);
|
||||
#if HAVE_DBUS
|
||||
#if defined(GIO_FOUND)
|
||||
portal_inhibit_info_destroy(info->portal);
|
||||
dbus_sleep_info_destroy(info->dbus);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue