diff --git a/src/common/logging/formatter.h b/src/common/logging/formatter.h index 07efba9c27..a5a81bf738 100644 --- a/src/common/logging/formatter.h +++ b/src/common/logging/formatter.h @@ -1,18 +1,26 @@ -// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later #pragma once #include - #include -// adapted from https://github.com/fmtlib/fmt/issues/2704 -// a generic formatter for enum classes +// Opt-out trait for enums that have their own custom fmt::formatter specialization. +namespace Common::Logging { +template +struct enable_generic_enum_formatter : std::true_type {}; +} // namespace Common::Logging + #if FMT_VERSION >= 80100 template -struct fmt::formatter, char>> - : formatter> { +struct fmt::formatter< + T, + std::enable_if_t< + std::is_enum_v && + Common::Logging::enable_generic_enum_formatter::value, + char>> + : fmt::formatter> { template auto format(const T& value, FormatContext& ctx) const -> decltype(ctx.out()) { return fmt::formatter>::format( diff --git a/src/core/file_sys/vfs/vfs_real.cpp b/src/core/file_sys/vfs/vfs_real.cpp index 052684e9db..c91c77c07a 100644 --- a/src/core/file_sys/vfs/vfs_real.cpp +++ b/src/core/file_sys/vfs/vfs_real.cpp @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later #include #include @@ -16,10 +16,6 @@ // For FileTimeStampRaw #include -#ifdef _MSC_VER -#define stat _stat64 -#endif - #ifdef ANDROID #include "common/fs/fs_android.h" #endif @@ -442,11 +438,12 @@ std::vector RealVfsDirectory::GetFiles() const { FileTimeStampRaw RealVfsDirectory::GetFileTimeStamp(std::string_view path_) const { const auto full_path = FS::SanitizePath(path + '/' + std::string(path_)); const auto fs_path = std::filesystem::path{FS::ToU8String(full_path)}; - struct stat file_status; #ifdef _WIN32 + struct _stat64 file_status; const auto stat_result = _wstat64(fs_path.c_str(), &file_status); #else + struct stat file_status; const auto stat_result = stat(fs_path.c_str(), &file_status); #endif diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index 4710167364..d929eb7e9b 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -32,8 +32,10 @@ #undef interface #include #pragma pop_macro("interface") +#ifdef _MSC_VER #pragma comment(lib, "wlanapi.lib") #endif +#endif namespace { diff --git a/src/core/internal_network/emu_net_state.cpp b/src/core/internal_network/emu_net_state.cpp index 17fa58fa08..d6d1a70a60 100644 --- a/src/core/internal_network/emu_net_state.cpp +++ b/src/core/internal_network/emu_net_state.cpp @@ -10,8 +10,10 @@ #define NOMINMAX #include #include +#ifdef _MSC_VER #pragma comment(lib, "wlanapi.lib") #endif +#endif #include #include diff --git a/src/core/internal_network/wifi_scanner.cpp b/src/core/internal_network/wifi_scanner.cpp index f4b1738e69..127221099f 100644 --- a/src/core/internal_network/wifi_scanner.cpp +++ b/src/core/internal_network/wifi_scanner.cpp @@ -15,8 +15,10 @@ using namespace std::chrono_literals; #define NOMINMAX #include #include +#ifdef _MSC_VER #pragma comment(lib, "wlanapi.lib") #endif +#endif namespace Network { #ifdef ENABLE_WIFI_SCAN diff --git a/src/dynarmic/src/dynarmic/ir/opcodes.h b/src/dynarmic/src/dynarmic/ir/opcodes.h index c11ad549da..c059bf60fb 100644 --- a/src/dynarmic/src/dynarmic/ir/opcodes.h +++ b/src/dynarmic/src/dynarmic/ir/opcodes.h @@ -23,6 +23,16 @@ enum class Opcode { #define OPCODE(name, type, ...) name, #define A32OPC(name, type, ...) A32##name, #define A64OPC(name, type, ...) A64##name, + +#if defined(__clang__) || defined(__GNUC__) +#ifdef RotateRight32 +#undef RotateRight32 +#endif +#ifdef RotateRight64 +#undef RotateRight64 +#endif +#endif + #include "./opcodes.inc" #undef OPCODE #undef A32OPC diff --git a/src/video_core/texture_cache/formatter.h b/src/video_core/texture_cache/formatter.h index 33c32645a2..d7b3a1be7c 100644 --- a/src/video_core/texture_cache/formatter.h +++ b/src/video_core/texture_cache/formatter.h @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later #pragma once @@ -9,6 +9,12 @@ #include "video_core/surface.h" #include "video_core/texture_cache/types.h" +#include "common/logging/formatter.h" + +namespace Common::Logging { +template <> +struct enable_generic_enum_formatter : std::false_type {}; +} template <> struct fmt::formatter : fmt::formatter { diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 2e31f47cd5..9a199c7750 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -506,4 +506,9 @@ endif() add_subdirectory(externals) target_link_libraries(yuzu PRIVATE QuaZip::QuaZip) +if (WIN32 AND (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")) + target_link_libraries(yuzu PRIVATE ws2_32 mswsock iphlpapi wlanapi dwmapi stdc++ winpthread) + target_compile_definitions(yuzu PRIVATE SDL_MAIN_HANDLED) +endif() + create_target_directory_groups(yuzu) diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 4e0ff685bf..d965da2480 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -178,7 +178,11 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual #include #include #include + +#ifdef _MSC_VER #pragma comment(lib, "Dwmapi.lib") +#endif + static inline void ApplyWindowsTitleBarDarkMode(HWND hwnd, bool enabled) { if (!hwnd) @@ -386,7 +390,7 @@ static void OverrideWindowsFont() { } #endif -inline static bool isDarkMode() { +[[maybe_unused]] inline static bool isDarkMode() { #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) const auto scheme = QGuiApplication::styleHints()->colorScheme(); return scheme == Qt::ColorScheme::Dark; diff --git a/src/yuzu_cmd/CMakeLists.txt b/src/yuzu_cmd/CMakeLists.txt index 9d1e08c04c..975916f286 100644 --- a/src/yuzu_cmd/CMakeLists.txt +++ b/src/yuzu_cmd/CMakeLists.txt @@ -67,4 +67,9 @@ if (YUZU_USE_PRECOMPILED_HEADERS) target_precompile_headers(yuzu-cmd PRIVATE precompiled_headers.h) endif() +if (WIN32 AND (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")) + target_link_libraries(yuzu-cmd PRIVATE ws2_32 mswsock iphlpapi wlanapi dwmapi stdc++ winpthread) + target_compile_definitions(yuzu-cmd PRIVATE SDL_MAIN_HANDLED) +endif() + create_target_directory_groups(yuzu-cmd)