CMake: Swap USE_ and WITH_ for ENABLE_

Consistency.
This commit is contained in:
Stenzek 2023-09-17 12:28:11 +10:00
parent 57cdb180c6
commit 68b59ee748
39 changed files with 187 additions and 187 deletions

View file

@ -239,7 +239,7 @@ jobs:
run: |
mkdir build
cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_NOGUI_FRONTEND=OFF -DBUILD_QT_FRONTEND=ON -DBUILD_TESTS=OFF -DUSE_WAYLAND=ON -DUSE_X11=ON -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_PREFIX_PATH=$HOME/deps -DCMAKE_TOOLCHAIN_FILE=../scripts/clang-toolchain.cmake ..
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_PREFIX_PATH=$HOME/deps -DCMAKE_TOOLCHAIN_FILE=../scripts/clang-toolchain.cmake ..
cmake --build . --parallel
cd ..
scripts/make-appimage.sh $(realpath .) $(realpath ./build) $HOME/deps DuckStation-x64

View file

@ -32,11 +32,11 @@ if(NOT ANDROID)
set(ENABLE_CUBEB ON)
set(ENABLE_DISCORD_PRESENCE ON)
set(USE_SDL2 ON)
set(ENABLE_SDL2 ON)
if(LINUX OR FREEBSD)
option(USE_X11 "Support X11 window system" ON)
option(USE_WAYLAND "Support Wayland window system" ON)
option(ENABLE_X11 "Support X11 window system" ON)
option(ENABLE_WAYLAND "Support Wayland window system" ON)
endif()
if(APPLE)
option(SKIP_POSTPROCESS_BUNDLE "Disable bundle post-processing, including Qt additions" OFF)
@ -45,7 +45,7 @@ endif()
# Required libraries.
if(USE_SDL2)
if(ENABLE_SDL2)
find_package(SDL2 2.28.2 REQUIRED)
endif()
if(NOT WIN32 AND NOT ANDROID)
@ -65,17 +65,17 @@ endif()
# Everything except Windows/Mac use EGL.
if(ENABLE_OPENGL AND (LINUX OR FREEBSD OR ANDROID))
find_package(EGL REQUIRED)
set(USE_EGL TRUE)
set(ENABLE_EGL TRUE)
endif()
if(USE_X11)
if(ENABLE_X11)
find_package(X11 REQUIRED)
if (NOT X11_Xrandr_FOUND)
message(FATAL_ERROR "XRandR extension is required")
endif()
endif()
if(USE_WAYLAND)
if(ENABLE_WAYLAND)
message(STATUS "Wayland support enabled")
endif()

View file

@ -16,7 +16,7 @@ echo "Build x64..."
mkdir build-x64
cd build-x64
export MACOSX_DEPLOYMENT_TARGET=11.0
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_NOGUI_FRONTEND=OFF -DBUILD_QT_FRONTEND=ON -DUSE_SDL2=ON -DENABLE_OPENGL=OFF -DCMAKE_PREFIX_PATH="$DEPS" -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -G Ninja "../$SOURCEDIR"
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_OPENGL=OFF -DCMAKE_PREFIX_PATH="$DEPS" -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -G Ninja "../$SOURCEDIR"
cmake --build . --parallel
cd ..
@ -24,7 +24,7 @@ echo "Build arm64..."
mkdir build-arm64
cd build-arm64
export MACOSX_DEPLOYMENT_TARGET=11.00
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_BUILD_TYPE=Release -DBUILD_NOGUI_FRONTEND=OFF -DBUILD_QT_FRONTEND=ON -DUSE_SDL2=ON -DENABLE_OPENGL=OFF -DCMAKE_PREFIX_PATH="$DEPS" -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -G Ninja "../$SOURCEDIR"
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_BUILD_TYPE=Release -DENABLE_OPENGL=OFF -DCMAKE_PREFIX_PATH="$DEPS" -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -G Ninja "../$SOURCEDIR"
cmake --build . --parallel
cd ..

View file

@ -94,7 +94,7 @@ if(NOT WIN32 AND NOT ANDROID)
)
if(LIBBACKTRACE_FOUND)
target_compile_definitions(common PRIVATE "-DUSE_LIBBACKTRACE=1")
target_compile_definitions(common PRIVATE "-DENABLE_LIBBACKTRACE=1")
target_link_libraries(common PRIVATE libbacktrace::libbacktrace)
endif()
endif()

View file

@ -202,7 +202,7 @@ void CrashHandler::Uninstall()
}
}
#elif defined(USE_LIBBACKTRACE)
#elif defined(ENABLE_LIBBACKTRACE)
#include <backtrace.h>
#include <cstdarg>

View file

@ -128,23 +128,23 @@ target_link_libraries(core PRIVATE stb xxhash imgui rapidjson rcheevos)
if(${CPU_ARCH} STREQUAL "x64")
target_include_directories(core PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../../dep/xbyak/xbyak")
target_compile_definitions(core PUBLIC "XBYAK_NO_EXCEPTION=1" "WITH_RECOMPILER=1" "WITH_MMAP_FASTMEM=1")
target_compile_definitions(core PUBLIC "XBYAK_NO_EXCEPTION=1" "ENABLE_RECOMPILER=1" "ENABLE_MMAP_FASTMEM=1")
target_sources(core PRIVATE ${RECOMPILER_SRCS}
cpu_recompiler_code_generator_x64.cpp
)
message("Building x64 recompiler")
elseif(${CPU_ARCH} STREQUAL "aarch32")
target_compile_definitions(core PUBLIC "WITH_RECOMPILER=1")
target_compile_definitions(core PUBLIC "ENABLE_RECOMPILER=1")
target_sources(core PRIVATE ${RECOMPILER_SRCS}
cpu_recompiler_code_generator_aarch32.cpp
)
target_link_libraries(core PUBLIC vixl)
message("Building AArch32 recompiler")
elseif(${CPU_ARCH} STREQUAL "aarch64")
target_compile_definitions(core PUBLIC "WITH_RECOMPILER=1")
target_compile_definitions(core PUBLIC "ENABLE_RECOMPILER=1")
if (NOT APPLE)
# Disabled until we support 16K pages.
target_compile_definitions(core PUBLIC "WITH_MMAP_FASTMEM=1")
target_compile_definitions(core PUBLIC "ENABLE_MMAP_FASTMEM=1")
endif()
target_sources(core PRIVATE ${RECOMPILER_SRCS}
cpu_recompiler_code_generator_aarch64.cpp
@ -156,7 +156,7 @@ else()
endif()
if(ENABLE_DISCORD_PRESENCE)
target_compile_definitions(core PUBLIC -DWITH_DISCORD_PRESENCE=1)
target_compile_definitions(core PUBLIC -DENABLE_DISCORD_PRESENCE=1)
target_link_libraries(core PRIVATE discord-rpc)
endif()

View file

@ -52,7 +52,7 @@
Log_SetChannel(Achievements);
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
// RA_Interface ends up including windows.h, with its silly macros.
#ifdef _WIN32
#include "common/windows_headers.h"
@ -184,7 +184,7 @@ static void CloseLeaderboard();
static bool s_hardcore_mode = false;
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
static bool s_using_raintegration = false;
#endif
@ -317,7 +317,7 @@ void Achievements::DownloadImage(std::string url, std::string cache_filename)
bool Achievements::IsActive()
{
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
return (s_client != nullptr) || s_using_raintegration;
#else
return (s_client != nullptr);
@ -326,7 +326,7 @@ bool Achievements::IsActive()
bool Achievements::IsHardcoreModeActive()
{
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
if (IsUsingRAIntegration())
return RA_HardcoreModeIsActive() != 0;
#endif
@ -500,7 +500,7 @@ void Achievements::UpdateSettings(const Settings& old_config)
bool Achievements::Shutdown(bool allow_cancel)
{
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
if (IsUsingRAIntegration())
{
if (System::IsValid() && allow_cancel && !RA_ConfirmLoadNewRom(true))
@ -612,7 +612,7 @@ void Achievements::IdleUpdate()
if (!IsActive())
return;
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
if (IsUsingRAIntegration())
return;
#endif
@ -628,7 +628,7 @@ void Achievements::FrameUpdate()
if (!IsActive())
return;
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
if (IsUsingRAIntegration())
{
RA_DoAchievementsFrame();
@ -748,7 +748,7 @@ void Achievements::UpdateRichPresence(std::unique_lock<std::recursive_mutex>& lo
Log_InfoPrintf("Rich presence updated: %s", s_rich_presence_string.c_str());
Host::OnAchievementsRefreshed();
#ifdef WITH_DISCORD_PRESCENCE
#ifdef ENABLE_DISCORD_PRESENCE
lock.unlock();
System::UpdateDiscordPresence();
lock.lock();
@ -780,7 +780,7 @@ void Achievements::CancelGameLoad()
DisableHardcoreMode();
Host::OnAchievementsRefreshed();
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
if (IsUsingRAIntegration())
{
RAIntegration::GameChanged();
@ -828,7 +828,7 @@ void Achievements::IdentifyGame(const std::string& path, CDImage* image)
s_game_path = path;
s_game_hash = std::move(game_hash);
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
if (IsUsingRAIntegration())
{
RAIntegration::GameChanged();
@ -1280,7 +1280,7 @@ void Achievements::HandleServerReconnectedEvent(const rc_client_event_t* event)
void Achievements::ResetClient()
{
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
if (IsUsingRAIntegration())
{
RA_OnReset();
@ -1297,7 +1297,7 @@ void Achievements::ResetClient()
void Achievements::OnSystemPaused(bool paused)
{
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
if (IsUsingRAIntegration())
RA_SetPaused(paused);
#endif
@ -1308,7 +1308,7 @@ void Achievements::DisableHardcoreMode()
if (!IsActive())
return;
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
if (IsUsingRAIntegration())
{
if (RA_HardcoreModeIsActive())
@ -1397,7 +1397,7 @@ bool Achievements::DoState(StateWrapper& sw)
{
// reset runtime, no data (state might've been created without cheevos)
Log_DevPrintf("State is missing cheevos data, resetting runtime");
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
if (IsUsingRAIntegration())
RA_OnReset();
else
@ -1414,7 +1414,7 @@ bool Achievements::DoState(StateWrapper& sw)
if (sw.HasError())
return false;
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
if (IsUsingRAIntegration())
{
RA_RestoreState(reinterpret_cast<const char*>(data.get()));
@ -1437,7 +1437,7 @@ bool Achievements::DoState(StateWrapper& sw)
u32 data_size;
std::unique_ptr<u8[]> data;
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
if (IsUsingRAIntegration())
{
const int size = RA_CaptureState(nullptr, 0);
@ -1712,7 +1712,7 @@ void Achievements::Logout()
bool Achievements::ConfirmSystemReset()
{
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
if (IsUsingRAIntegration())
return RA_ConfirmLoadNewRom(false);
#endif
@ -1722,7 +1722,7 @@ bool Achievements::ConfirmSystemReset()
bool Achievements::ConfirmHardcoreModeDisable(const char* trigger)
{
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
if (IsUsingRAIntegration())
return (RA_WarnDisableHardcore(trigger) != 0);
#endif
@ -2829,7 +2829,7 @@ void Achievements::CloseLeaderboard()
s_open_leaderboard = nullptr;
}
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
#include "RA_Consoles.h"

View file

@ -126,7 +126,7 @@ bool PrepareLeaderboardsWindow();
/// Renders the leaderboard list.
void DrawLeaderboardsWindow();
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
/// Prevents the internal implementation from being used. Instead, RAIntegration will be
/// called into when achievement-related events occur.
void SwitchToRAIntegration();

View file

@ -116,7 +116,7 @@ static Common::MemoryArena m_memory_arena;
static CPUFastmemMode m_fastmem_mode = CPUFastmemMode::Disabled;
#ifdef WITH_MMAP_FASTMEM
#ifdef ENABLE_MMAP_FASTMEM
static u8* m_fastmem_base = nullptr;
static std::vector<Common::MemoryArena::View> m_fastmem_ram_views;
static std::vector<Common::MemoryArena::View> m_fastmem_reserved_views;
@ -164,7 +164,7 @@ void Shutdown()
std::free(m_fastmem_lut);
m_fastmem_lut = nullptr;
#ifdef WITH_MMAP_FASTMEM
#ifdef ENABLE_MMAP_FASTMEM
m_fastmem_base = nullptr;
m_fastmem_ram_views.clear();
#endif
@ -381,7 +381,7 @@ CPUFastmemMode GetFastmemMode()
u8* GetFastmemBase()
{
#ifdef WITH_MMAP_FASTMEM
#ifdef ENABLE_MMAP_FASTMEM
if (m_fastmem_mode == CPUFastmemMode::MMap)
return m_fastmem_base;
#endif
@ -393,7 +393,7 @@ u8* GetFastmemBase()
void UpdateFastmemViews(CPUFastmemMode mode)
{
#ifndef WITH_MMAP_FASTMEM
#ifndef ENABLE_MMAP_FASTMEM
Assert(mode != CPUFastmemMode::MMap);
#else
m_fastmem_ram_views.clear();
@ -403,7 +403,7 @@ void UpdateFastmemViews(CPUFastmemMode mode)
m_fastmem_mode = mode;
if (mode == CPUFastmemMode::Disabled)
{
#ifdef WITH_MMAP_FASTMEM
#ifdef ENABLE_MMAP_FASTMEM
m_fastmem_base = nullptr;
#endif
std::free(m_fastmem_lut);
@ -411,7 +411,7 @@ void UpdateFastmemViews(CPUFastmemMode mode)
return;
}
#ifdef WITH_MMAP_FASTMEM
#ifdef ENABLE_MMAP_FASTMEM
if (mode == CPUFastmemMode::MMap)
{
std::free(m_fastmem_lut);
@ -488,7 +488,7 @@ void UpdateFastmemViews(CPUFastmemMode mode)
}
#endif
#ifdef WITH_MMAP_FASTMEM
#ifdef ENABLE_MMAP_FASTMEM
m_fastmem_base = nullptr;
#endif
@ -533,7 +533,7 @@ bool CanUseFastmemForAddress(VirtualMemoryAddress address)
switch (m_fastmem_mode)
{
#ifdef WITH_MMAP_FASTMEM
#ifdef ENABLE_MMAP_FASTMEM
case CPUFastmemMode::MMap:
{
// Currently since we don't map the mirrors, don't use fastmem for them.
@ -578,7 +578,7 @@ void ClearRAMCodePage(u32 index)
void SetCodePageFastmemProtection(u32 page_index, bool writable)
{
#ifdef WITH_MMAP_FASTMEM
#ifdef ENABLE_MMAP_FASTMEM
if (m_fastmem_mode == CPUFastmemMode::MMap)
{
// unprotect fastmem pages
@ -609,7 +609,7 @@ void ClearRAMCodePageFlags()
{
m_ram_code_bits.reset();
#ifdef WITH_MMAP_FASTMEM
#ifdef ENABLE_MMAP_FASTMEM
if (m_fastmem_mode == CPUFastmemMode::MMap)
{
// unprotect fastmem pages

View file

@ -89,7 +89,7 @@ enum : size_t
// Offsets within the memory arena.
MEMORY_ARENA_RAM_OFFSET = 0,
#ifdef WITH_MMAP_FASTMEM
#ifdef ENABLE_MMAP_FASTMEM
// Fastmem region size is 4GB to cover the entire 32-bit address space.
FASTMEM_REGION_SIZE = UINT64_C(0x100000000),
#endif

View file

@ -4,10 +4,10 @@
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>WITH_DISCORD_PRESENCE=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="('$(Platform)'!='ARM64')">WITH_RAINTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="('$(Platform)'=='x64' Or '$(Platform)'=='ARM' Or '$(Platform)'=='ARM64')">WITH_RECOMPILER=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="('$(Platform)'=='x64' Or '$(Platform)'=='ARM64')">WITH_MMAP_FASTMEM=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>ENABLE_DISCORD_PRESENCE=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="('$(Platform)'!='ARM64')">ENABLE_RAINTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="('$(Platform)'=='x64' Or '$(Platform)'=='ARM' Or '$(Platform)'=='ARM64')">ENABLE_RECOMPILER=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="('$(Platform)'=='x64' Or '$(Platform)'=='ARM64')">ENABLE_MMAP_FASTMEM=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(SolutionDir)dep\xxhash\include;$(SolutionDir)dep\zlib\include;$(SolutionDir)dep\rcheevos\include;$(SolutionDir)dep\rapidjson\include;$(SolutionDir)dep\discord-rpc\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Platform)'!='ARM64'">%(AdditionalIncludeDirectories);$(SolutionDir)dep\rainterface</AdditionalIncludeDirectories>

View file

@ -14,7 +14,7 @@
#include "timing_event.h"
Log_SetChannel(CPU::CodeCache);
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
#include "cpu_recompiler_code_generator.h"
#endif
@ -29,7 +29,7 @@ static constexpr u32 RECOMPILE_FRAMES_TO_FALL_BACK_TO_INTERPRETER = 100;
static constexpr u32 RECOMPILE_COUNT_TO_FALL_BACK_TO_INTERPRETER = 20;
static constexpr u32 INVALIDATE_THRESHOLD_TO_DISABLE_LINKING = 10;
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
// Currently remapping the code buffer doesn't work in macOS or Haiku.
#if !defined(__HAIKU__) && !defined(__APPLE__)
@ -56,7 +56,7 @@ static JitCodeBuffer s_code_buffer;
#endif
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
static FastMapTable s_fast_map[FAST_MAP_TABLE_COUNT];
static std::unique_ptr<CodeBlock::HostCodePointer[]> s_fast_map_pointers;
@ -227,7 +227,7 @@ static void ClearState();
static BlockMap s_blocks;
static std::array<std::vector<CodeBlock*>, Bus::RAM_8MB_CODE_PAGE_COUNT> m_ram_block_map;
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
static HostCodeMap s_host_code_map;
static void AddBlockToHostCodeMap(CodeBlock* block);
@ -237,17 +237,17 @@ static bool InitializeFastmem();
static void ShutdownFastmem();
static Common::PageFaultHandler::HandlerResult LUTPageFaultHandler(void* exception_pc, void* fault_address,
bool is_write);
#ifdef WITH_MMAP_FASTMEM
#ifdef ENABLE_MMAP_FASTMEM
static Common::PageFaultHandler::HandlerResult MMapPageFaultHandler(void* exception_pc, void* fault_address,
bool is_write);
#endif
#endif // WITH_RECOMPILER
#endif // ENABLE_RECOMPILER
void Initialize()
{
Assert(s_blocks.empty());
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
if (g_settings.IsUsingRecompiler())
{
#ifdef USE_STATIC_CODE_BUFFER
@ -266,7 +266,7 @@ void Initialize()
AllocateFastMap();
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
if (g_settings.IsUsingRecompiler())
{
if (g_settings.IsUsingFastmem() && !InitializeFastmem())
@ -289,7 +289,7 @@ void ClearState()
delete it.second;
s_blocks.clear();
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
s_host_code_map.clear();
s_code_buffer.Reset();
ResetFastMap();
@ -299,7 +299,7 @@ void ClearState()
void Shutdown()
{
ClearState();
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
ShutdownFastmem();
FreeFastMap();
s_code_buffer.Destroy();
@ -395,7 +395,7 @@ template<PGXPMode pgxp_mode>
g_state.npc = g_state.pc;
}
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
void CompileDispatcher()
{
@ -449,7 +449,7 @@ FastMapTable* GetFastMapPointer()
{
switch (g_settings.cpu_execution_mode)
{
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
case CPUExecutionMode::Recompiler:
ExecuteRecompiler();
break;
@ -473,7 +473,7 @@ FastMapTable* GetFastMapPointer()
}
}
#if defined(WITH_RECOMPILER)
#if defined(ENABLE_RECOMPILER)
JitCodeBuffer& GetCodeBuffer()
{
@ -486,11 +486,11 @@ void Reinitialize()
{
ClearState();
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
ShutdownFastmem();
#endif
#if defined(WITH_RECOMPILER)
#if defined(ENABLE_RECOMPILER)
s_code_buffer.Destroy();
if (g_settings.IsUsingRecompiler())
@ -507,7 +507,7 @@ void Reinitialize()
}
#endif
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
if (g_settings.IsUsingRecompiler())
{
if (g_settings.IsUsingFastmem() && !InitializeFastmem())
@ -523,7 +523,7 @@ void Reinitialize()
void Flush()
{
ClearState();
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
if (g_settings.IsUsingRecompiler())
CompileDispatcher();
#endif
@ -601,7 +601,7 @@ CodeBlock* LookupBlock(CodeBlockKey key, bool allow_flush)
// add it to the page map if it's in ram
AddBlockToPageMap(block);
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
SetFastMap(block->GetPC(), block->host_code);
AddBlockToHostCodeMap(block);
#endif
@ -636,7 +636,7 @@ bool RevalidateBlock(CodeBlock* block, bool allow_flush)
// re-add it to the page map since it's still up-to-date
block->invalidated = false;
AddBlockToPageMap(block);
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
SetFastMap(block->GetPC(), block->host_code);
#endif
return true;
@ -647,7 +647,7 @@ recompile:
// and we don't want to nuke the block we're compiling...
RemoveReferencesToBlock(block);
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
RemoveBlockFromHostCodeMap(block);
#endif
@ -684,7 +684,7 @@ recompile:
AddBlockToPageMap(block);
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
// re-add to page map again
SetFastMap(block->GetPC(), block->host_code);
AddBlockToHostCodeMap(block);
@ -809,7 +809,7 @@ bool CompileBlock(CodeBlock* block, bool allow_flush)
return false;
}
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
if (g_settings.IsUsingRecompiler())
{
// Ensure we're not going to run out of space while compiling this block.
@ -846,7 +846,7 @@ bool CompileBlock(CodeBlock* block, bool allow_flush)
return true;
}
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
void FastCompileBlockFunction()
{
@ -920,7 +920,7 @@ static void InvalidateBlock(CodeBlock* block, bool allow_frame_invalidation)
UnlinkBlock(block);
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
SetFastMap(block->GetPC(), FastCompileBlockFunction);
#endif
}
@ -956,7 +956,7 @@ void RemoveReferencesToBlock(CodeBlock* block)
BlockMap::iterator iter = s_blocks.find(block->key.GetPC());
Assert(iter != s_blocks.end() && iter->second == block);
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
SetFastMap(block->GetPC(), FastCompileBlockFunction);
#endif
@ -965,7 +965,7 @@ void RemoveReferencesToBlock(CodeBlock* block)
RemoveBlockFromPageMap(block);
UnlinkBlock(block);
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
if (!block->invalidated)
RemoveBlockFromHostCodeMap(block);
#endif
@ -1017,7 +1017,7 @@ void LinkBlock(CodeBlock* from, CodeBlock* to, void* host_pc, void* host_resolve
li.block = from;
to->link_predecessors.push_back(li);
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
// apply in code
if (host_pc)
{
@ -1034,7 +1034,7 @@ void UnlinkBlock(CodeBlock* block)
if (block->link_predecessors.empty() && block->link_successors.empty())
return;
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
if (g_settings.IsUsingRecompiler() && g_settings.cpu_recompiler_block_linking)
s_code_buffer.WriteProtect(false);
#endif
@ -1045,7 +1045,7 @@ void UnlinkBlock(CodeBlock* block)
[block](const CodeBlock::LinkInfo& li) { return li.block == block; });
Assert(iter != li.block->link_successors.end());
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
// Restore blocks linked to this block back to the resolver
if (li.host_pc)
{
@ -1064,7 +1064,7 @@ void UnlinkBlock(CodeBlock* block)
[block](const CodeBlock::LinkInfo& li) { return li.block == block; });
Assert(iter != li.block->link_predecessors.end());
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
// Restore blocks we're linking to back to the resolver, since the successor won't be linked to us to backpatch if
// it changes.
if (li.host_pc)
@ -1079,13 +1079,13 @@ void UnlinkBlock(CodeBlock* block)
}
block->link_successors.clear();
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
if (g_settings.IsUsingRecompiler() && g_settings.cpu_recompiler_block_linking)
s_code_buffer.WriteProtect(true);
#endif
}
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
void AddBlockToHostCodeMap(CodeBlock* block)
{
@ -1111,7 +1111,7 @@ bool InitializeFastmem()
const CPUFastmemMode mode = g_settings.cpu_fastmem_mode;
Assert(mode != CPUFastmemMode::Disabled);
#ifdef WITH_MMAP_FASTMEM
#ifdef ENABLE_MMAP_FASTMEM
const auto handler = (mode == CPUFastmemMode::MMap) ? MMapPageFaultHandler : LUTPageFaultHandler;
#else
const auto handler = LUTPageFaultHandler;
@ -1137,7 +1137,7 @@ void ShutdownFastmem()
CPU::UpdateFastmemBase();
}
#ifdef WITH_MMAP_FASTMEM
#ifdef ENABLE_MMAP_FASTMEM
Common::PageFaultHandler::HandlerResult MMapPageFaultHandler(void* exception_pc, void* fault_address, bool is_write)
{
@ -1256,11 +1256,11 @@ Common::PageFaultHandler::HandlerResult LUTPageFaultHandler(void* exception_pc,
return Common::PageFaultHandler::HandlerResult::ExecuteNextHandler;
}
#endif // WITH_RECOMPILER
#endif // ENABLE_RECOMPILER
} // namespace CPU::CodeCache
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
void CPU::Recompiler::Thunks::ResolveBranch(CodeBlock* block, void* host_pc, void* host_resolve_pc, u32 host_pc_size)
{
@ -1294,4 +1294,4 @@ void CPU::Recompiler::Thunks::LogPC(u32 pc)
#endif
}
#endif // WITH_RECOMPILER
#endif // ENABLE_RECOMPILER

View file

@ -13,7 +13,7 @@
#include <unordered_map>
#include <vector>
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
#include "cpu_recompiler_types.h"
#endif
@ -88,7 +88,7 @@ struct CodeBlock
TickCount uncached_fetch_ticks = 0;
u32 icache_line_count = 0;
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
std::vector<Recompiler::LoadStoreBackpatchInfo> loadstore_backpatch_info;
#endif
@ -127,14 +127,14 @@ void Initialize();
void Shutdown();
[[noreturn]] void Execute();
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
using DispatcherFunction = void (*)();
using SingleBlockDispatcherFunction = void (*)(const CodeBlock::HostCodePointer);
FastMapTable* GetFastMapPointer();
#endif
#if defined(WITH_RECOMPILER)
#if defined(ENABLE_RECOMPILER)
JitCodeBuffer& GetCodeBuffer();
#endif

View file

@ -2746,7 +2746,7 @@ void FullscreenUI::DrawInterfaceSettingsPage()
ImGuiFullscreen::SetTheme(bsi->GetBoolValue("Main", "UseLightFullscreenUITheme", false));
}
#ifdef WITH_DISCORD_PRESENCE
#ifdef ENABLE_DISCORD_PRESENCE
MenuHeading(FSUI_CSTR("Integration"));
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_CHARGING_STATION, "Enable Discord Presence"),
"Shows the game you are currently playing as part of your profile on Discord.", "Main",
@ -3220,7 +3220,7 @@ void FullscreenUI::DrawControllerSettingsPage()
MenuHeading(FSUI_CSTR("Input Sources"));
#ifdef USE_SDL2
#ifdef ENABLE_SDL2
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_COG, "Enable SDL Input Source"),
FSUI_CSTR("The SDL input source supports most controllers."), "InputSources", "SDL", true, true,
false);
@ -3781,7 +3781,7 @@ void FullscreenUI::DrawDisplaySettingsPage()
break;
#endif
#ifdef WITH_VULKAN
#ifdef ENABLE_VULKAN
case GPURenderer::HardwareVulkan:
{
DrawToggleSetting(bsi, FSUI_CSTR("Threaded Presentation"),
@ -4416,7 +4416,7 @@ void FullscreenUI::DrawAudioSettingsPage()
void FullscreenUI::DrawAchievementsSettingsPage()
{
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
if (Achievements::IsUsingRAIntegration())
{
BeginMenuButtons();

View file

@ -319,7 +319,7 @@ std::unique_ptr<AudioStream> Host::CreateAudioStream(AudioBackend backend, u32 s
{
switch (backend)
{
#ifdef USE_CUBEB
#ifdef ENABLE_CUBEB
case AudioBackend::Cubeb:
return AudioStream::CreateCubebAudioStream(sample_rate, channels, buffer_ms, latency_ms, stretch);
#endif

View file

@ -659,7 +659,7 @@ void Settings::FixIncompatibleSettings(bool display_osd_messages)
}
}
#ifndef WITH_MMAP_FASTMEM
#ifndef ENABLE_MMAP_FASTMEM
if (g_settings.cpu_fastmem_mode == CPUFastmemMode::MMap)
{
Log_WarningPrintf("mmap fastmem is not available on this platform, using LUT instead.");
@ -929,10 +929,10 @@ static constexpr auto s_gpu_renderer_names = make_array(
#ifdef __APPLE__
"Metal",
#endif
#ifdef WITH_VULKAN
#ifdef ENABLE_VULKAN
"Vulkan",
#endif
#ifdef WITH_OPENGL
#ifdef ENABLE_OPENGL
"OpenGL",
#endif
"Software");
@ -943,10 +943,10 @@ static constexpr auto s_gpu_renderer_display_names = make_array(
#ifdef __APPLE__
TRANSLATE_NOOP("GPURenderer", "Hardware (Metal)"),
#endif
#ifdef WITH_VULKAN
#ifdef ENABLE_VULKAN
TRANSLATE_NOOP("GPURenderer", "Hardware (Vulkan)"),
#endif
#ifdef WITH_OPENGL
#ifdef ENABLE_OPENGL
TRANSLATE_NOOP("GPURenderer", "Hardware (OpenGL)"),
#endif
TRANSLATE_NOOP("GPURenderer", "Software"));
@ -988,11 +988,11 @@ RenderAPI Settings::GetRenderAPIForRenderer(GPURenderer renderer)
#ifdef __APPLE__
return RenderAPI::Metal;
#endif
#ifdef WITH_VULKAN
#ifdef ENABLE_VULKAN
case GPURenderer::HardwareVulkan:
return RenderAPI::Vulkan;
#endif
#ifdef WITH_OPENGL
#ifdef ENABLE_OPENGL
case GPURenderer::HardwareOpenGL:
return RenderAPI::OpenGL;
#endif
@ -1247,7 +1247,7 @@ const char* Settings::GetDisplayScalingDisplayName(DisplayScalingMode mode)
static constexpr const char* s_audio_backend_names[] = {
"Null",
#ifdef USE_CUBEB
#ifdef ENABLE_CUBEB
"Cubeb",
#endif
#ifdef _WIN32
@ -1259,7 +1259,7 @@ static constexpr const char* s_audio_backend_names[] = {
};
static constexpr const char* s_audio_backend_display_names[] = {
TRANSLATE_NOOP("AudioBackend", "Null (No Output)"),
#ifdef USE_CUBEB
#ifdef ENABLE_CUBEB
TRANSLATE_NOOP("AudioBackend", "Cubeb"),
#endif
#ifdef _WIN32

View file

@ -420,9 +420,9 @@ struct Settings
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::HardwareD3D11;
#elif defined(__APPLE__)
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::HardwareMetal;
#elif defined(WITH_OPENGL)
#elif defined(ENABLE_OPENGL)
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::HardwareOpenGL;
#elif defined(WITH_VULKAN)
#elif defined(ENABLE_VULKAN)
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::HardwareVulkan;
#else
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::Software;
@ -434,9 +434,9 @@ struct Settings
static constexpr float DEFAULT_GPU_PGXP_DEPTH_THRESHOLD = 300.0f;
static constexpr float GPU_PGXP_DEPTH_THRESHOLD_SCALE = 4096.0f;
#ifdef WITH_RECOMPILER
#ifdef ENABLE_RECOMPILER
static constexpr CPUExecutionMode DEFAULT_CPU_EXECUTION_MODE = CPUExecutionMode::Recompiler;
#ifdef WITH_MMAP_FASTMEM
#ifdef ENABLE_MMAP_FASTMEM
static constexpr CPUFastmemMode DEFAULT_CPU_FASTMEM_MODE = CPUFastmemMode::MMap;
#else
static constexpr CPUFastmemMode DEFAULT_CPU_FASTMEM_MODE = CPUFastmemMode::LUT;
@ -446,7 +446,7 @@ struct Settings
static constexpr CPUFastmemMode DEFAULT_CPU_FASTMEM_MODE = CPUFastmemMode::Disabled;
#endif
#if defined(USE_CUBEB)
#if defined(ENABLE_CUBEB)
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::Cubeb;
#elif defined(_WIN32)
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::XAudio2;

View file

@ -74,7 +74,7 @@ Log_SetChannel(System);
#include <mmsystem.h>
#endif
#ifdef WITH_DISCORD_PRESENCE
#ifdef ENABLE_DISCORD_PRESENCE
#include "discord_rpc.h"
#endif
@ -132,7 +132,7 @@ static void UpdateSessionTime(const std::string& prev_serial);
static void SetTimerResolutionIncreased(bool enabled);
#ifdef WITH_DISCORD_PRESENCE
#ifdef ENABLE_DISCORD_PRESENCE
static void InitializeDiscordPresence();
static void ShutdownDiscordPresence();
static void PollDiscordPresence();
@ -231,7 +231,7 @@ static u32 s_runahead_replay_frames = 0;
// Used to track play time. We use a monotonic timer here, in case of clock changes.
static u64 s_session_start_time = 0;
#ifdef WITH_DISCORD_PRESENCE
#ifdef ENABLE_DISCORD_PRESENCE
static bool s_discord_presence_active = false;
#endif
@ -245,7 +245,7 @@ void System::Internal::ProcessStartup()
// This will call back to Host::LoadSettings() -> ReloadSources().
LoadSettings(false);
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
if (Host::GetBaseBoolSettingValue("Cheevos", "UseRAIntegration", false))
Achievements::SwitchToRAIntegration();
#endif
@ -255,7 +255,7 @@ void System::Internal::ProcessStartup()
void System::Internal::ProcessShutdown()
{
#ifdef WITH_DISCORD_PRESENCE
#ifdef ENABLE_DISCORD_PRESENCE
ShutdownDiscordPresence();
#endif
@ -268,7 +268,7 @@ void System::Internal::IdlePollUpdate()
{
InputManager::PollSources();
#ifdef WITH_DISCORD_PRESENCE
#ifdef ENABLE_DISCORD_PRESENCE
PollDiscordPresence();
#endif
@ -1664,7 +1664,7 @@ void System::ClearRunningGame()
Achievements::GameChanged(s_running_game_path, nullptr);
#ifdef WITH_DISCORD_PRESENCE
#ifdef ENABLE_DISCORD_PRESENCE
UpdateDiscordPresence();
#endif
}
@ -1740,7 +1740,7 @@ void System::FrameDone()
if (Achievements::IsActive())
Achievements::FrameUpdate();
#ifdef WITH_DISCORD_PRESENCE
#ifdef ENABLE_DISCORD_PRESENCE
PollDiscordPresence();
#endif
@ -3316,7 +3316,7 @@ void System::UpdateRunningGame(const char* path, CDImage* image, bool booting)
SaveStateSelectorUI::RefreshList();
#ifdef WITH_DISCORD_PRESENCE
#ifdef ENABLE_DISCORD_PRESENCE
UpdateDiscordPresence();
#endif
@ -4718,7 +4718,7 @@ u64 System::GetSessionPlayedTime()
return static_cast<u64>(std::round(Common::Timer::ConvertValueToSeconds(ctime - s_session_start_time)));
}
#ifdef WITH_DISCORD_PRESENCE
#ifdef ENABLE_DISCORD_PRESENCE
void System::InitializeDiscordPresence()
{

View file

@ -479,7 +479,7 @@ void UpdateMemorySaveStateSettings();
bool LoadRewindState(u32 skip_saves = 0, bool consume_state = true);
void SetRunaheadReplayFlag();
#ifdef WITH_DISCORD_PRESENCE
#ifdef ENABLE_DISCORD_PRESENCE
/// Called when rich presence changes.
void UpdateDiscordPresence();
#endif

View file

@ -65,10 +65,10 @@ enum class GPURenderer : u8
#ifdef __APPLE__
HardwareMetal,
#endif
#ifdef WITH_VULKAN
#ifdef ENABLE_VULKAN
HardwareVulkan,
#endif
#ifdef WITH_OPENGL
#ifdef ENABLE_OPENGL
HardwareOpenGL,
#endif
Software,
@ -144,7 +144,7 @@ enum class DisplayScalingMode : u8
enum class AudioBackend : u8
{
Null,
#ifdef USE_CUBEB
#ifdef ENABLE_CUBEB
Cubeb,
#endif
#ifdef _WIN32

View file

@ -22,7 +22,7 @@ if(WIN32)
DEBUG_POSTFIX "-debug")
endif()
if(USE_X11)
if(ENABLE_X11)
message(STATUS "Building X11 NoGUI Platform.")
target_compile_definitions(duckstation-nogui PRIVATE "NOGUI_PLATFORM_X11=1")
target_sources(duckstation-nogui PRIVATE
@ -33,7 +33,7 @@ if(USE_X11)
target_link_libraries(duckstation-nogui PRIVATE "${X11_LIBRARIES}" "${X11_Xrandr_LIB}")
endif()
if(USE_WAYLAND)
if(ENABLE_WAYLAND)
message(STATUS "Building Wayland NoGUI Platform.")
find_package(ECM REQUIRED NO_MODULE)
list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}")

View file

@ -103,7 +103,7 @@ void AudioSettingsWidget::updateDriverNames()
std::vector<std::string> names;
std::vector<std::pair<std::string, std::string>> devices;
#ifdef USE_CUBEB
#ifdef ENABLE_CUBEB
if (backend == AudioBackend::Cubeb)
{
names = AudioStream::GetCubebDriverNames();

View file

@ -14,7 +14,7 @@
#include "util/d3d11_device.h"
#include "util/d3d12_device.h"
#endif
#ifdef WITH_VULKAN
#ifdef ENABLE_VULKAN
#include "util/vulkan_device.h"
#endif
@ -199,7 +199,7 @@ void DisplaySettingsWidget::populateGPUAdaptersAndResolutions()
aml = GPUDevice::WrapGetMetalAdapterAndModeList();
break;
#endif
#ifdef WITH_VULKAN
#ifdef ENABLE_VULKAN
case GPURenderer::HardwareVulkan:
aml = VulkanDevice::StaticGetAdapterAndModeList();
threaded_presentation_supported = true;

View file

@ -99,7 +99,7 @@ GeneralSettingsWidget::GeneralSettingsWidget(SettingsDialog* dialog, QWidget* pa
dialog->registerWidgetHelp(m_ui.autoLoadCheats, tr("Automatically Load Cheats"), tr("Unchecked"),
tr("Automatically loads and applies cheats on game start."));
#ifdef WITH_DISCORD_PRESENCE
#ifdef ENABLE_DISCORD_PRESENCE
{
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableDiscordPresence, "Main", "EnableDiscordPresence",
false);

View file

@ -144,7 +144,7 @@ void MainWindow::initialize()
switchToGameListView();
updateWindowTitle();
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
if (Achievements::IsUsingRAIntegration())
Achievements::RAIntegration::MainWindowChanged((void*)winId());
#endif
@ -1616,7 +1616,7 @@ void MainWindow::setupAdditionalUi()
connect(action, &QAction::triggered, [scale]() { g_emu_thread->requestDisplaySize(scale); });
}
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
if (Achievements::IsUsingRAIntegration())
{
QMenu* raMenu = new QMenu(QStringLiteral("RAIntegration"), m_ui.menu_Tools);

View file

@ -1764,7 +1764,7 @@ void QtHost::PrintCommandLineHelp(const char* progname)
std::fprintf(stderr, " -settings <filename>: Loads a custom settings configuration from the\n"
" specified filename. Default settings applied if file not found.\n");
std::fprintf(stderr, " -earlyconsole: Creates console as early as possible, for logging.\n");
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
std::fprintf(stderr, " -raintegration: Use RAIntegration instead of built-in achievement support.\n");
#endif
std::fprintf(stderr, " --: Signals that no more arguments will follow and the remaining\n"
@ -1905,7 +1905,7 @@ bool QtHost::ParseCommandLineParametersAndInitializeConfig(QApplication& app,
InitializeEarlyConsole();
continue;
}
#ifdef WITH_RAINTEGRATION
#ifdef ENABLE_RAINTEGRATION
else if (CHECK_ARG("-raintegration"))
{
Achievements::SwitchToRAIntegration();

View file

@ -86,7 +86,7 @@ void QtHost::InstallTranslator()
if (!has_base_ts)
{
// Try without the country suffix.
const int index = language.lastIndexOf('_');
const int index = language.lastIndexOf('-');
if (index > 0)
{
base_path = QStringLiteral("%1/qt_%2.qm").arg(base_dir).arg(language.left(index));

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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