libobs: Update CMakeLists.txt for libobs and associated libraries

Also updates libobs-opengl, libobs-d3d11, libobs-winrt
master
PatTheMav 2022-02-01 00:27:47 +01:00
parent 49e9d49943
commit 1fd7770548
No known key found for this signature in database
GPG Key ID: CEFD5D83C12A66B3
14 changed files with 651 additions and 825 deletions

View File

@ -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)
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/winrc/obs-module.rc.in libobs-d3d11.rc)
configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/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")
target_include_directories(libobs-d3d11 PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
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()
set(USE_GPU_PRIORITY TRUE)
target_compile_definitions(
libobs-d3d11 PRIVATE USE_GPU_PRIORITY=TRUE
GPU_PRIORITY_VAL=${GPU_PRIORITY_VAL})
endif()
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/d3d11-config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/d3d11-config.h")
target_link_libraries(libobs-d3d11 PRIVATE OBS::libobs d3d9 d3d11 dxgi)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(
libobs-d3d11
PROPERTIES OUTPUT_NAME libobs-d3d11
FOLDER "core"
PREFIX "")
set(libobs-d3d11_SOURCES
d3d11-indexbuffer.cpp
d3d11-samplerstate.cpp
d3d11-shader.cpp
d3d11-shaderprocessor.cpp
d3d11-stagesurf.cpp
d3d11-subsystem.cpp
d3d11-texture2d.cpp
d3d11-texture3d.cpp
d3d11-vertexbuffer.cpp
d3d11-duplicator.cpp
d3d11-rebuild.cpp
d3d11-zstencilbuffer.cpp
libobs-d3d11.rc)
set(libobs-d3d11_HEADERS
${CMAKE_CURRENT_BINARY_DIR}/d3d11-config.h
intel-nv12-support.hpp
d3d11-shaderprocessor.hpp
d3d11-subsystem.hpp)
add_library(libobs-d3d11 MODULE
${libobs-d3d11_SOURCES}
${libobs-d3d11_HEADERS})
set_target_properties(libobs-d3d11
PROPERTIES
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)

View File

@ -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 {

View File

@ -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})
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)
add_definitions(-DLIBOBS_EXPORTS)
target_link_libraries(libobs-opengl PRIVATE OBS::libobs OBS::obsglad)
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)
set_target_properties(
libobs-opengl
PROPERTIES FOLDER "core"
VERSION "${OBS_VERSION_MAJOR}"
SOVERSION "1")
find_library(COCOA Cocoa)
include_directories(${COCOA})
mark_as_advanced(COCOA)
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)
find_library(IOSURF IOSurface)
include_directories(${IOSURF})
mark_as_advanced(${IOSURF})
target_sources(libobs-opengl PRIVATE gl-windows.c libobs-opengl.rc)
set(libobs-opengl_PLATFORM_DEPS
${COCOA}
${IOSURF}
${OPENGL_gl_LIBRARY})
else()
find_package(XCB COMPONENTS XCB REQUIRED)
find_package(X11_XCB REQUIRED)
elseif(OS_MACOS)
find_library(COCOA Cocoa)
find_library(IOSURF IOSurface)
include_directories(
${XCB_INCLUDE_DIRS}
${X11_XCB_INCLUDE_DIRS})
target_sources(libobs-opengl PRIVATE gl-cocoa.m)
add_definitions(
${XCB_DEFINITIONS}
${X11_XCB_DEFINITIONS})
target_link_libraries(libobs-opengl PRIVATE ${COCOA} ${IOSURF})
set(libobs-opengl_PLATFORM_DEPS
${XCB_LIBRARIES}
${X11_XCB_LIBRARIES})
set_target_properties(libobs-opengl PROPERTIES PREFIX "")
set(libobs-opengl_PLATFORM_SOURCES
gl-egl-common.c
gl-nix.c
gl-x11-egl.c
gl-x11-glx.c)
elseif(OS_POSIX)
find_package(X11 REQUIRED)
find_package(XCB COMPONENTS XCB)
find_package(X11_XCB REQUIRED)
if(ENABLE_WAYLAND)
find_package(EGL REQUIRED)
find_package(Wayland REQUIRED)
target_sources(libobs-opengl PRIVATE gl-egl-common.c gl-nix.c gl-x11-egl.c
gl-x11-glx.c)
include_directories(
${WAYLAND_CLIENT_INCLUDE_DIRS}
${WAYLAND_EGL_INCLUDE_DIRS}
${EGL_INCLUDE_DIRS})
target_link_libraries(libobs-opengl PRIVATE XCB::XCB X11::X11_xcb)
add_definitions(
${WAYLAND_DEFINITIONS})
set_target_properties(libobs-opengl PROPERTIES PREFIX "")
set(libobs-opengl_PLATFORM_DEPS
${libobs-opengl_PLATFORM_DEPS}
${WAYLAND_CLIENT_LIBRARIES}
${WAYLAND_EGL_LIBRARIES}
${EGL_LIBRARIES})
if(ENABLE_WAYLAND)
find_package(
OpenGL
COMPONENTS EGL
REQUIRED)
find_package(Wayland REQUIRED)
set(libobs-opengl_PLATFORM_SOURCES
${libobs-opengl_PLATFORM_SOURCES}
gl-wayland-egl.c)
endif()
target_sources(libobs-opengl PRIVATE gl-wayland-egl.c)
target_link_libraries(libobs-opengl PRIVATE OpenGL::EGL Wayland::EGL)
endif()
endif()
set(libobs-opengl_SOURCES
${libobs-opengl_PLATFORM_SOURCES}
gl-helpers.c
gl-indexbuffer.c
gl-shader.c
gl-shaderparser.c
gl-stagesurf.c
gl-subsystem.c
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)
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})
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)

View File

@ -1,41 +1,32 @@
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})
target_precompile_headers(
libobs-winrt
PRIVATE
[["../libobs/util/windows/ComPtr.hpp"]]
<obs-module.h>
<d3d11.h>
<DispatcherQueue.h>
<dwmapi.h>
<Windows.Graphics.Capture.Interop.h>
<winrt/Windows.Foundation.Metadata.h>
<winrt/Windows.Graphics.Capture.h>
<winrt/Windows.System.h>)
set(libobs-winrt_SOURCES
winrt-capture.cpp
winrt-dispatch.cpp)
target_link_libraries(libobs-winrt PRIVATE OBS::libobs Dwmapi windowsapp)
set(libobs-winrt_HEADERS
winrt-capture.h
winrt-dispatch.h)
target_compile_features(libobs-winrt PRIVATE cxx_std_17)
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
PRIVATE
[["../libobs/util/windows/ComPtr.hpp"]]
<obs-module.h>
<d3d11.h>
<DispatcherQueue.h>
<dwmapi.h>
<Windows.Graphics.Capture.Interop.h>
<winrt/Windows.Foundation.Metadata.h>
<winrt/Windows.Graphics.Capture.h>
<winrt/Windows.System.h>)
target_link_libraries(libobs-winrt
libobs
Dwmapi
windowsapp)
set_target_properties(
libobs-winrt
PROPERTIES OUTPUT_NAME libobs-winrt
FOLDER "core"
PREFIX "")
install_obs_core(libobs-winrt)
setup_binary_target(libobs-winrt)

File diff suppressed because it is too large Load Diff

View File

@ -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)

View File

@ -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);

View File

@ -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);
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);

View File

@ -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);

View File

@ -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]);

View File

@ -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

View File

@ -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@

View File

@ -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

View File

@ -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