CMake: Swap USE_ and WITH_ for ENABLE_
Consistency.
This commit is contained in:
@ -74,22 +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(USE_CUBEB)
|
||||
if(ENABLE_CUBEB)
|
||||
target_sources(util PRIVATE
|
||||
cubeb_audio_stream.cpp
|
||||
cubeb_audio_stream.h
|
||||
)
|
||||
target_compile_definitions(util PUBLIC "USE_CUBEB=1")
|
||||
target_compile_definitions(util PUBLIC "ENABLE_CUBEB=1")
|
||||
target_link_libraries(util PRIVATE cubeb)
|
||||
endif()
|
||||
|
||||
if(USE_X11)
|
||||
target_compile_definitions(util PRIVATE "-DUSE_X11=1")
|
||||
if(ENABLE_X11)
|
||||
target_compile_definitions(util PRIVATE "-DENABLE_X11=1")
|
||||
target_link_libraries(util PRIVATE X11::X11 X11::Xrandr)
|
||||
endif()
|
||||
|
||||
if(USE_WAYLAND)
|
||||
target_compile_definitions(util PRIVATE "-DUSE_WAYLAND=1")
|
||||
if(ENABLE_WAYLAND)
|
||||
target_compile_definitions(util PRIVATE "-DENABLE_WAYLAND=1")
|
||||
endif()
|
||||
|
||||
if(ENABLE_OPENGL)
|
||||
@ -106,7 +106,7 @@ if(ENABLE_OPENGL)
|
||||
opengl_texture.cpp
|
||||
opengl_texture.h
|
||||
)
|
||||
target_compile_definitions(util PUBLIC "WITH_OPENGL=1")
|
||||
target_compile_definitions(util PUBLIC "ENABLE_OPENGL=1")
|
||||
target_link_libraries(util PRIVATE glad)
|
||||
|
||||
if(WIN32)
|
||||
@ -122,9 +122,9 @@ if(ENABLE_OPENGL)
|
||||
gl/context_egl.cpp
|
||||
gl/context_egl.h
|
||||
)
|
||||
target_compile_definitions(util PRIVATE "-DUSE_EGL=1")
|
||||
target_compile_definitions(util PRIVATE "-DENABLE_EGL=1")
|
||||
|
||||
if(USE_X11)
|
||||
if(ENABLE_X11)
|
||||
target_sources(util PRIVATE
|
||||
gl/context_egl_x11.cpp
|
||||
gl/context_egl_x11.h
|
||||
@ -135,7 +135,7 @@ if(ENABLE_OPENGL)
|
||||
# makes the data types opaque, we can still use it with X11 if needed.
|
||||
target_compile_definitions(util PRIVATE "-DEGL_NO_X11=1")
|
||||
endif()
|
||||
if(USE_WAYLAND)
|
||||
if(ENABLE_WAYLAND)
|
||||
target_sources(util PRIVATE
|
||||
gl/context_egl_wayland.cpp
|
||||
gl/context_egl_wayland.h
|
||||
@ -188,15 +188,15 @@ if(ENABLE_VULKAN)
|
||||
vulkan_texture.cpp
|
||||
vulkan_texture.h
|
||||
)
|
||||
target_compile_definitions(util PUBLIC "WITH_VULKAN=1")
|
||||
target_compile_definitions(util PUBLIC "ENABLE_VULKAN=1")
|
||||
endif()
|
||||
|
||||
if(USE_SDL2)
|
||||
if(ENABLE_SDL2)
|
||||
target_sources(util PRIVATE
|
||||
sdl_input_source.cpp
|
||||
sdl_input_source.h
|
||||
)
|
||||
target_compile_definitions(util PUBLIC "USE_SDL2=1")
|
||||
target_compile_definitions(util PUBLIC "ENABLE_SDL2=1")
|
||||
target_link_libraries(util PUBLIC SDL2::SDL2)
|
||||
|
||||
# Copy bundled SDL2 to output on Windows.
|
||||
|
||||
@ -79,7 +79,7 @@ public:
|
||||
|
||||
static std::unique_ptr<AudioStream> CreateNullStream(u32 sample_rate, u32 channels, u32 buffer_ms);
|
||||
|
||||
#ifdef USE_CUBEB
|
||||
#ifdef ENABLE_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();
|
||||
|
||||
@ -19,11 +19,11 @@
|
||||
#elif defined(__APPLE__)
|
||||
#include "context_agl.h"
|
||||
#else
|
||||
#ifdef USE_EGL
|
||||
#ifdef USE_WAYLAND
|
||||
#ifdef ENABLE_EGL
|
||||
#ifdef ENABLE_WAYLAND
|
||||
#include "context_egl_wayland.h"
|
||||
#endif
|
||||
#ifdef USE_X11
|
||||
#ifdef ENABLE_X11
|
||||
#include "context_egl_x11.h"
|
||||
#endif
|
||||
#endif
|
||||
@ -121,11 +121,11 @@ std::unique_ptr<GL::Context> Context::Create(const WindowInfo& wi, const Version
|
||||
#elif defined(__APPLE__)
|
||||
context = ContextAGL::Create(wi, versions_to_try, num_versions_to_try);
|
||||
#else
|
||||
#if defined(USE_X11)
|
||||
#if defined(ENABLE_X11)
|
||||
if (wi.type == WindowInfo::Type::X11)
|
||||
context = ContextEGLX11::Create(wi, versions_to_try, num_versions_to_try);
|
||||
#endif
|
||||
#if defined(USE_WAYLAND)
|
||||
#if defined(ENABLE_WAYLAND)
|
||||
if (wi.type == WindowInfo::Type::Wayland)
|
||||
context = ContextEGLWayland::Create(wi, versions_to_try, num_versions_to_try);
|
||||
#endif
|
||||
|
||||
@ -25,11 +25,11 @@ Log_SetChannel(GPUDevice);
|
||||
#include "d3d_common.h"
|
||||
#endif
|
||||
|
||||
#ifdef WITH_OPENGL
|
||||
#ifdef ENABLE_OPENGL
|
||||
#include "opengl_device.h"
|
||||
#endif
|
||||
|
||||
#ifdef WITH_VULKAN
|
||||
#ifdef ENABLE_VULKAN
|
||||
#include "vulkan_device.h"
|
||||
#endif
|
||||
|
||||
@ -337,12 +337,12 @@ std::string GPUDevice::GetShaderCacheBaseName(const std::string_view& type) cons
|
||||
ret = fmt::format("d3d12_{}{}", type, debug_suffix);
|
||||
break;
|
||||
#endif
|
||||
#ifdef WITH_VULKAN
|
||||
#ifdef ENABLE_VULKAN
|
||||
case RenderAPI::Vulkan:
|
||||
ret = fmt::format("vulkan_{}{}", type, debug_suffix);
|
||||
break;
|
||||
#endif
|
||||
#ifdef WITH_OPENGL
|
||||
#ifdef ENABLE_OPENGL
|
||||
case RenderAPI::OpenGL:
|
||||
ret = fmt::format("opengl_{}{}", type, debug_suffix);
|
||||
break;
|
||||
@ -747,12 +747,12 @@ std::unique_ptr<GPUDevice> GPUDevice::CreateDeviceForAPI(RenderAPI api)
|
||||
{
|
||||
switch (api)
|
||||
{
|
||||
#ifdef WITH_VULKAN
|
||||
#ifdef ENABLE_VULKAN
|
||||
case RenderAPI::Vulkan:
|
||||
return std::make_unique<VulkanDevice>();
|
||||
#endif
|
||||
|
||||
#ifdef WITH_OPENGL
|
||||
#ifdef ENABLE_OPENGL
|
||||
case RenderAPI::OpenGL:
|
||||
case RenderAPI::OpenGLES:
|
||||
return std::make_unique<OpenGLDevice>();
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||
|
||||
#include "input_manager.h"
|
||||
@ -481,7 +481,7 @@ static std::array<const char*, static_cast<u32>(InputSourceType::Count)> s_input
|
||||
"XInput",
|
||||
"RawInput",
|
||||
#endif
|
||||
#ifdef USE_SDL2
|
||||
#ifdef ENABLE_SDL2
|
||||
"SDL",
|
||||
#endif
|
||||
#ifdef __ANDROID__
|
||||
@ -517,7 +517,7 @@ bool InputManager::GetInputSourceDefaultEnabled(InputSourceType type)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
#ifdef USE_SDL2
|
||||
#ifdef ENABLE_SDL2
|
||||
case InputSourceType::SDL:
|
||||
return true;
|
||||
#endif
|
||||
@ -1926,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 USE_SDL2
|
||||
#ifdef ENABLE_SDL2
|
||||
UpdateInputSourceState(si, settings_lock, InputSourceType::SDL, &InputSource::CreateSDLSource);
|
||||
#endif
|
||||
#ifdef __ANDROID__
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||
|
||||
#pragma once
|
||||
@ -27,7 +27,7 @@ enum class InputSourceType : u32
|
||||
XInput,
|
||||
RawInput,
|
||||
#endif
|
||||
#ifdef USE_SDL2
|
||||
#ifdef ENABLE_SDL2
|
||||
SDL,
|
||||
#endif
|
||||
#ifdef __ANDROID__
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||
|
||||
#pragma once
|
||||
@ -74,7 +74,7 @@ public:
|
||||
static std::unique_ptr<InputSource> CreateXInputSource();
|
||||
static std::unique_ptr<InputSource> CreateWin32RawInputSource();
|
||||
#endif
|
||||
#ifdef USE_SDL2
|
||||
#ifdef ENABLE_SDL2
|
||||
static std::unique_ptr<InputSource> CreateSDLSource();
|
||||
#endif
|
||||
#ifdef __ANDROID__
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
#ifdef WITH_OPENGL
|
||||
#ifdef ENABLE_OPENGL
|
||||
#include "opengl_loader.h"
|
||||
#endif
|
||||
|
||||
@ -18,10 +18,10 @@ ShaderGen::ShaderGen(RenderAPI render_api, bool supports_dual_source_blend)
|
||||
m_spirv(render_api == RenderAPI::Vulkan || render_api == RenderAPI::Metal),
|
||||
m_supports_dual_source_blend(supports_dual_source_blend), m_use_glsl_interface_blocks(false)
|
||||
{
|
||||
#if defined(WITH_OPENGL) || defined(WITH_VULKAN)
|
||||
#if defined(ENABLE_OPENGL) || defined(ENABLE_VULKAN)
|
||||
if (m_glsl)
|
||||
{
|
||||
#ifdef WITH_OPENGL
|
||||
#ifdef ENABLE_OPENGL
|
||||
if (m_render_api == RenderAPI::OpenGL || m_render_api == RenderAPI::OpenGLES)
|
||||
SetGLSLVersionString();
|
||||
|
||||
@ -47,7 +47,7 @@ ShaderGen::~ShaderGen() = default;
|
||||
|
||||
bool ShaderGen::UseGLSLBindingLayout()
|
||||
{
|
||||
#ifdef WITH_OPENGL
|
||||
#ifdef ENABLE_OPENGL
|
||||
return (GLAD_GL_ES_VERSION_3_1 || GLAD_GL_VERSION_4_3 ||
|
||||
(GLAD_GL_ARB_explicit_attrib_location && GLAD_GL_ARB_explicit_uniform_location &&
|
||||
GLAD_GL_ARB_shading_language_420pack));
|
||||
@ -61,7 +61,7 @@ void ShaderGen::DefineMacro(std::stringstream& ss, const char* name, bool enable
|
||||
ss << "#define " << name << " " << BoolToUInt32(enabled) << "\n";
|
||||
}
|
||||
|
||||
#ifdef WITH_OPENGL
|
||||
#ifdef ENABLE_OPENGL
|
||||
void ShaderGen::SetGLSLVersionString()
|
||||
{
|
||||
const char* glsl_version = reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION));
|
||||
@ -113,7 +113,7 @@ void ShaderGen::WriteHeader(std::stringstream& ss)
|
||||
else if (m_spirv)
|
||||
ss << "#version 450 core\n\n";
|
||||
|
||||
#ifdef WITH_OPENGL
|
||||
#ifdef ENABLE_OPENGL
|
||||
// Extension enabling for OpenGL.
|
||||
if (m_render_api == RenderAPI::OpenGLES)
|
||||
{
|
||||
@ -160,7 +160,7 @@ void ShaderGen::WriteHeader(std::stringstream& ss)
|
||||
DefineMacro(ss, "API_VULKAN", m_render_api == RenderAPI::Vulkan);
|
||||
DefineMacro(ss, "API_METAL", m_render_api == RenderAPI::Metal);
|
||||
|
||||
#ifdef WITH_OPENGL
|
||||
#ifdef ENABLE_OPENGL
|
||||
if (m_render_api == RenderAPI::OpenGLES)
|
||||
{
|
||||
ss << "precision highp float;\n";
|
||||
@ -356,7 +356,7 @@ void ShaderGen::DeclareTextureBuffer(std::stringstream& ss, const char* name, u3
|
||||
const char* ShaderGen::GetInterpolationQualifier(bool interface_block, bool centroid_interpolation,
|
||||
bool sample_interpolation, bool is_out) const
|
||||
{
|
||||
#ifdef WITH_OPENGL
|
||||
#ifdef ENABLE_OPENGL
|
||||
const bool shading_language_420pack = GLAD_GL_ARB_shading_language_420pack;
|
||||
#else
|
||||
const bool shading_language_420pack = false;
|
||||
|
||||
@ -31,7 +31,7 @@ protected:
|
||||
const char* GetInterpolationQualifier(bool interface_block, bool centroid_interpolation, bool sample_interpolation,
|
||||
bool is_out) const;
|
||||
|
||||
#ifdef WITH_OPENGL
|
||||
#ifdef ENABLE_OPENGL
|
||||
void SetGLSLVersionString();
|
||||
#endif
|
||||
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions);SOUNDTOUCH_FLOAT_SAMPLES;SOUNDTOUCH_ALLOW_SSE;ST_NO_EXCEPTION_HANDLING=1</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>USE_CUBEB=1;USE_SDL2=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Platform)'!='ARM64'">%(PreprocessorDefinitions);WITH_OPENGL=1;WITH_VULKAN=1</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>ENABLE_CUBEB=1;ENABLE_SDL2=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Platform)'!='ARM64'">%(PreprocessorDefinitions);ENABLE_OPENGL=1;ENABLE_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>
|
||||
<AdditionalIncludeDirectories Condition="'$(Platform)'!='ARM64'">%(AdditionalIncludeDirectories);$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan\include;$(SolutionDir)dep\glslang</AdditionalIncludeDirectories>
|
||||
|
||||
@ -15,18 +15,18 @@
|
||||
#elif defined(__ANDROID__)
|
||||
#define VK_USE_PLATFORM_ANDROID_KHR
|
||||
#else
|
||||
#ifdef USE_X11
|
||||
#ifdef ENABLE_X11
|
||||
#define VK_USE_PLATFORM_XLIB_KHR
|
||||
#endif
|
||||
|
||||
#ifdef USE_WAYLAND
|
||||
#ifdef ENABLE_WAYLAND
|
||||
#define VK_USE_PLATFORM_WAYLAND_KHR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "vulkan/vulkan.h"
|
||||
|
||||
#if defined(USE_X11)
|
||||
#if defined(ENABLE_X11)
|
||||
|
||||
// This breaks a bunch of our code. They shouldn't be #defines in the first place.
|
||||
#ifdef None
|
||||
|
||||
@ -82,7 +82,7 @@ bool WindowInfo::QueryRefreshRateForWindow(const WindowInfo& wi, float* refresh_
|
||||
|
||||
#else
|
||||
|
||||
#ifdef USE_X11
|
||||
#ifdef ENABLE_X11
|
||||
|
||||
#include "common/scoped_guard.h"
|
||||
#include "common/log.h"
|
||||
@ -220,11 +220,11 @@ static bool GetRefreshRateFromXRandR(const WindowInfo& wi, float* refresh_rate)
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // USE_X11
|
||||
#endif // ENABLE_X11
|
||||
|
||||
bool WindowInfo::QueryRefreshRateForWindow(const WindowInfo& wi, float* refresh_rate)
|
||||
{
|
||||
#if defined(USE_X11)
|
||||
#if defined(ENABLE_X11)
|
||||
if (wi.type == WindowInfo::Type::X11)
|
||||
return GetRefreshRateFromXRandR(wi, refresh_rate);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user