CMake: Remove unsupported options
This commit is contained in:
@ -74,25 +74,22 @@ target_include_directories(util PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
||||
target_link_libraries(util PUBLIC common simpleini imgui)
|
||||
target_link_libraries(util PRIVATE stb libchdr zlib soundtouch Zstd::Zstd reshadefx)
|
||||
|
||||
if(ENABLE_CUBEB)
|
||||
if(USE_CUBEB)
|
||||
target_sources(util PRIVATE
|
||||
cubeb_audio_stream.cpp
|
||||
cubeb_audio_stream.h
|
||||
)
|
||||
target_compile_definitions(util PUBLIC "WITH_CUBEB=1")
|
||||
target_compile_definitions(util PUBLIC "USE_CUBEB=1")
|
||||
target_link_libraries(util PRIVATE cubeb)
|
||||
endif()
|
||||
|
||||
if(USE_X11)
|
||||
target_compile_definitions(util PRIVATE "-DUSE_X11=1")
|
||||
target_include_directories(util PRIVATE "${X11_INCLUDE_DIR}" "${X11_Xrandr_INCLUDE_PATH}")
|
||||
target_link_libraries(util PRIVATE "${X11_LIBRARIES}" "${X11_Xrandr_LIB}")
|
||||
target_link_libraries(util PRIVATE X11::X11 X11::Xrandr)
|
||||
endif()
|
||||
|
||||
if(USE_WAYLAND)
|
||||
target_compile_definitions(util PRIVATE "-DUSE_WAYLAND=1")
|
||||
elseif(SUPPORTS_WAYLAND)
|
||||
message(WARNING "Wayland support for renderers is disabled.\nDuckStation will FAIL to start on Wayland.")
|
||||
endif()
|
||||
|
||||
if(ENABLE_OPENGL)
|
||||
@ -199,7 +196,7 @@ if(USE_SDL2)
|
||||
sdl_input_source.cpp
|
||||
sdl_input_source.h
|
||||
)
|
||||
target_compile_definitions(util PUBLIC "WITH_SDL2=1")
|
||||
target_compile_definitions(util PUBLIC "USE_SDL2=1")
|
||||
target_link_libraries(util PUBLIC SDL2::SDL2)
|
||||
|
||||
# Copy bundled SDL2 to output on Windows.
|
||||
@ -215,14 +212,6 @@ if(USE_SDL2)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_DBUS)
|
||||
target_compile_definitions(util PRIVATE USE_DBUS)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(DBUS REQUIRED dbus-1)
|
||||
target_include_directories(util PRIVATE ${DBUS_INCLUDE_DIRS})
|
||||
target_link_libraries(util PRIVATE ${DBUS_LINK_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_sources(util PRIVATE
|
||||
d3d_common.cpp
|
||||
@ -288,6 +277,10 @@ elseif(NOT ANDROID)
|
||||
target_sources(util PRIVATE
|
||||
platform_misc_unix.cpp
|
||||
)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(DBUS REQUIRED dbus-1)
|
||||
target_include_directories(util PRIVATE ${DBUS_INCLUDE_DIRS})
|
||||
target_link_libraries(util PRIVATE ${DBUS_LINK_LIBRARIES})
|
||||
endif()
|
||||
|
||||
function(add_util_resources target)
|
||||
|
||||
@ -79,7 +79,7 @@ public:
|
||||
|
||||
static std::unique_ptr<AudioStream> CreateNullStream(u32 sample_rate, u32 channels, u32 buffer_ms);
|
||||
|
||||
#ifdef WITH_CUBEB
|
||||
#ifdef USE_CUBEB
|
||||
static std::unique_ptr<AudioStream> CreateCubebAudioStream(u32 sample_rate, u32 channels, u32 buffer_ms,
|
||||
u32 latency_ms, AudioStretchMode stretch);
|
||||
static std::vector<std::string> GetCubebDriverNames();
|
||||
|
||||
@ -481,7 +481,7 @@ static std::array<const char*, static_cast<u32>(InputSourceType::Count)> s_input
|
||||
"XInput",
|
||||
"RawInput",
|
||||
#endif
|
||||
#ifdef WITH_SDL2
|
||||
#ifdef USE_SDL2
|
||||
"SDL",
|
||||
#endif
|
||||
#ifdef __ANDROID__
|
||||
@ -512,17 +512,12 @@ bool InputManager::GetInputSourceDefaultEnabled(InputSourceType type)
|
||||
return false;
|
||||
|
||||
case InputSourceType::XInput:
|
||||
// Disable xinput by default if we have SDL.
|
||||
#ifdef WITH_SDL2
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
case InputSourceType::RawInput:
|
||||
return false;
|
||||
#endif
|
||||
|
||||
#ifdef WITH_SDL2
|
||||
#ifdef USE_SDL2
|
||||
case InputSourceType::SDL:
|
||||
return true;
|
||||
#endif
|
||||
@ -1931,7 +1926,7 @@ void InputManager::ReloadSources(SettingsInterface& si, std::unique_lock<std::mu
|
||||
UpdateInputSourceState(si, settings_lock, InputSourceType::XInput, &InputSource::CreateXInputSource);
|
||||
UpdateInputSourceState(si, settings_lock, InputSourceType::RawInput, &InputSource::CreateWin32RawInputSource);
|
||||
#endif
|
||||
#ifdef WITH_SDL2
|
||||
#ifdef USE_SDL2
|
||||
UpdateInputSourceState(si, settings_lock, InputSourceType::SDL, &InputSource::CreateSDLSource);
|
||||
#endif
|
||||
#ifdef __ANDROID__
|
||||
|
||||
@ -27,7 +27,7 @@ enum class InputSourceType : u32
|
||||
XInput,
|
||||
RawInput,
|
||||
#endif
|
||||
#ifdef WITH_SDL2
|
||||
#ifdef USE_SDL2
|
||||
SDL,
|
||||
#endif
|
||||
#ifdef __ANDROID__
|
||||
|
||||
@ -74,7 +74,7 @@ public:
|
||||
static std::unique_ptr<InputSource> CreateXInputSource();
|
||||
static std::unique_ptr<InputSource> CreateWin32RawInputSource();
|
||||
#endif
|
||||
#ifdef WITH_SDL2
|
||||
#ifdef USE_SDL2
|
||||
static std::unique_ptr<InputSource> CreateSDLSource();
|
||||
#endif
|
||||
#ifdef __ANDROID__
|
||||
|
||||
@ -1,47 +1,20 @@
|
||||
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com> and contributors.
|
||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||
|
||||
#include "input_manager.h"
|
||||
#include "platform_misc.h"
|
||||
|
||||
#include "common/log.h"
|
||||
#include "common/scoped_guard.h"
|
||||
#include "common/string.h"
|
||||
#include "input_manager.h"
|
||||
#include "platform_misc.h"
|
||||
#include <cinttypes>
|
||||
Log_SetChannel(PlatformMisc);
|
||||
|
||||
#include <cinttypes>
|
||||
#include <spawn.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !defined(USE_DBUS) && defined(USE_X11)
|
||||
#include <cstdio>
|
||||
#include <sys/wait.h>
|
||||
|
||||
static bool SetScreensaverInhibitX11(bool inhibit, const WindowInfo& wi)
|
||||
{
|
||||
TinyString command;
|
||||
command.AppendString("xdg-screensaver");
|
||||
|
||||
TinyString operation;
|
||||
operation.AppendString(inhibit ? "suspend" : "resume");
|
||||
|
||||
TinyString id;
|
||||
id.Format("0x%" PRIx64, static_cast<u64>(reinterpret_cast<uintptr_t>(wi.window_handle)));
|
||||
|
||||
char* argv[4] = {command.GetWriteableCharArray(), operation.GetWriteableCharArray(), id.GetWriteableCharArray(),
|
||||
nullptr};
|
||||
pid_t pid;
|
||||
int res = posix_spawnp(&pid, "xdg-screensaver", nullptr, nullptr, argv, environ);
|
||||
if (res != 0)
|
||||
{
|
||||
Log_ErrorPrintf("posix_spawnp() failed: %d", res);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#elif defined(USE_DBUS)
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
Log_SetChannel(PlatformMisc);
|
||||
|
||||
static bool SetScreensaverInhibitDBus(const bool inhibit_requested, const char* program_name, const char* reason)
|
||||
{
|
||||
static dbus_uint32_t s_cookie;
|
||||
@ -115,33 +88,9 @@ static bool SetScreensaverInhibitDBus(const bool inhibit_requested, const char*
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static bool SetScreensaverInhibit(bool inhibit)
|
||||
{
|
||||
#ifdef USE_DBUS
|
||||
return SetScreensaverInhibitDBus(inhibit, "DuckStation", "DuckStation VM is running.");
|
||||
#else
|
||||
|
||||
std::optional<WindowInfo> wi(Host::GetTopLevelWindowInfo());
|
||||
if (!wi.has_value())
|
||||
{
|
||||
Log_ErrorPrintf("No top-level window.");
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (wi->type)
|
||||
{
|
||||
#ifdef USE_X11
|
||||
case WindowInfo::Type::X11:
|
||||
return SetScreensaverInhibitX11(inhibit, wi.value());
|
||||
#endif
|
||||
|
||||
default:
|
||||
Log_ErrorPrintf("Unknown type: %u", static_cast<unsigned>(wi->type));
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool s_screensaver_suspended;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions);SOUNDTOUCH_FLOAT_SAMPLES;SOUNDTOUCH_ALLOW_SSE;ST_NO_EXCEPTION_HANDLING=1</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WITH_CUBEB=1;WITH_SDL2=1;WITH_DINPUT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>USE_CUBEB=1;USE_SDL2=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Platform)'!='ARM64'">%(PreprocessorDefinitions);WITH_OPENGL=1;WITH_VULKAN=1</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Platform)'=='ARM64'">%(PreprocessorDefinitions);SOUNDTOUCH_USE_NEON</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(SolutionDir)dep\soundtouch\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\libchdr\include;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\d3d12ma\include;$(SolutionDir)dep\zstd\lib</AdditionalIncludeDirectories>
|
||||
|
||||
Reference in New Issue
Block a user