mingw64 gcc/clang support
Some checks failed
eden-license / license-header (pull_request) Failing after 20s

removed unnecessary undefs in src\dynarmic\src\dynarmic\ir\opcodes.h
removed unecessary #define stat _stat64 macro in src\core\file_sys\vfs\vfs_real.cpp
add headers in src\core\file_sys\vfs\vfs_real.cpp
disambiguation of formatters in src\video_core\texture_cache\formatter.h and src\common\logging\formatter.h
This commit is contained in:
U-XBZK-M17X-R4\Allison Cunha 2025-08-18 12:15:07 -03:00
parent b906abf9fc
commit 70811426e6
10 changed files with 54 additions and 13 deletions

View file

@ -4,15 +4,23 @@
#pragma once #pragma once
#include <type_traits> #include <type_traits>
#include <fmt/ranges.h> #include <fmt/ranges.h>
// adapted from https://github.com/fmtlib/fmt/issues/2704 // Opt-out trait for enums that have their own custom fmt::formatter specialization.
// a generic formatter for enum classes namespace Common::Logging {
template <class T>
struct enable_generic_enum_formatter : std::true_type {};
} // namespace Common::Logging
#if FMT_VERSION >= 80100 #if FMT_VERSION >= 80100
template <typename T> template <typename T>
struct fmt::formatter<T, std::enable_if_t<std::is_enum_v<T>, char>> struct fmt::formatter<
: formatter<std::underlying_type_t<T>> { T,
std::enable_if_t<
std::is_enum_v<T> &&
Common::Logging::enable_generic_enum_formatter<T>::value,
char>>
: fmt::formatter<std::underlying_type_t<T>> {
template <typename FormatContext> template <typename FormatContext>
auto format(const T& value, FormatContext& ctx) const -> decltype(ctx.out()) { auto format(const T& value, FormatContext& ctx) const -> decltype(ctx.out()) {
return fmt::formatter<std::underlying_type_t<T>>::format( return fmt::formatter<std::underlying_type_t<T>>::format(

View file

@ -1,5 +1,5 @@
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
#include <algorithm> #include <algorithm>
#include <cstddef> #include <cstddef>
@ -16,10 +16,6 @@
// For FileTimeStampRaw // For FileTimeStampRaw
#include <sys/stat.h> #include <sys/stat.h>
#ifdef _MSC_VER
#define stat _stat64
#endif
#ifdef ANDROID #ifdef ANDROID
#include "common/fs/fs_android.h" #include "common/fs/fs_android.h"
#endif #endif
@ -442,11 +438,12 @@ std::vector<VirtualFile> RealVfsDirectory::GetFiles() const {
FileTimeStampRaw RealVfsDirectory::GetFileTimeStamp(std::string_view path_) const { FileTimeStampRaw RealVfsDirectory::GetFileTimeStamp(std::string_view path_) const {
const auto full_path = FS::SanitizePath(path + '/' + std::string(path_)); const auto full_path = FS::SanitizePath(path + '/' + std::string(path_));
const auto fs_path = std::filesystem::path{FS::ToU8String(full_path)}; const auto fs_path = std::filesystem::path{FS::ToU8String(full_path)};
struct stat file_status;
#ifdef _WIN32 #ifdef _WIN32
struct _stat64 file_status;
const auto stat_result = _wstat64(fs_path.c_str(), &file_status); const auto stat_result = _wstat64(fs_path.c_str(), &file_status);
#else #else
struct stat file_status;
const auto stat_result = stat(fs_path.c_str(), &file_status); const auto stat_result = stat(fs_path.c_str(), &file_status);
#endif #endif

View file

@ -32,8 +32,10 @@
#undef interface #undef interface
#include <wlanapi.h> #include <wlanapi.h>
#pragma pop_macro("interface") #pragma pop_macro("interface")
#ifdef _MSC_VER
#pragma comment(lib, "wlanapi.lib") #pragma comment(lib, "wlanapi.lib")
#endif #endif
#endif
namespace { namespace {

View file

@ -10,8 +10,10 @@
#define NOMINMAX #define NOMINMAX
#include <windows.h> #include <windows.h>
#include <wlanapi.h> #include <wlanapi.h>
#ifdef _MSC_VER
#pragma comment(lib, "wlanapi.lib") #pragma comment(lib, "wlanapi.lib")
#endif #endif
#endif
#include <common/settings.h> #include <common/settings.h>
#include <mutex> #include <mutex>

View file

@ -15,8 +15,10 @@ using namespace std::chrono_literals;
#define NOMINMAX #define NOMINMAX
#include <windows.h> #include <windows.h>
#include <wlanapi.h> #include <wlanapi.h>
#ifdef _MSC_VER
#pragma comment(lib, "wlanapi.lib") #pragma comment(lib, "wlanapi.lib")
#endif #endif
#endif
namespace Network { namespace Network {
#ifdef ENABLE_WIFI_SCAN #ifdef ENABLE_WIFI_SCAN

View file

@ -23,6 +23,16 @@ enum class Opcode {
#define OPCODE(name, type, ...) name, #define OPCODE(name, type, ...) name,
#define A32OPC(name, type, ...) A32##name, #define A32OPC(name, type, ...) A32##name,
#define A64OPC(name, type, ...) A64##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" #include "./opcodes.inc"
#undef OPCODE #undef OPCODE
#undef A32OPC #undef A32OPC

View file

@ -9,6 +9,12 @@
#include "video_core/surface.h" #include "video_core/surface.h"
#include "video_core/texture_cache/types.h" #include "video_core/texture_cache/types.h"
#include "common/logging/formatter.h"
namespace Common::Logging {
template <>
struct enable_generic_enum_formatter<VideoCore::Surface::PixelFormat> : std::false_type {};
}
template <> template <>
struct fmt::formatter<VideoCore::Surface::PixelFormat> : fmt::formatter<fmt::string_view> { struct fmt::formatter<VideoCore::Surface::PixelFormat> : fmt::formatter<fmt::string_view> {

View file

@ -506,4 +506,9 @@ endif()
add_subdirectory(externals) add_subdirectory(externals)
target_link_libraries(yuzu PRIVATE QuaZip::QuaZip) 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) create_target_directory_groups(yuzu)

View file

@ -178,7 +178,11 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
#include <QPlatformSurfaceEvent> #include <QPlatformSurfaceEvent>
#include <dwmapi.h> #include <dwmapi.h>
#include <windows.h> #include <windows.h>
#ifdef _MSC_VER
#pragma comment(lib, "Dwmapi.lib") #pragma comment(lib, "Dwmapi.lib")
#endif
static inline void ApplyWindowsTitleBarDarkMode(HWND hwnd, bool enabled) { static inline void ApplyWindowsTitleBarDarkMode(HWND hwnd, bool enabled) {
if (!hwnd) if (!hwnd)
@ -386,7 +390,7 @@ static void OverrideWindowsFont() {
} }
#endif #endif
inline static bool isDarkMode() { [[maybe_unused]] inline static bool isDarkMode() {
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
const auto scheme = QGuiApplication::styleHints()->colorScheme(); const auto scheme = QGuiApplication::styleHints()->colorScheme();
return scheme == Qt::ColorScheme::Dark; return scheme == Qt::ColorScheme::Dark;

View file

@ -67,4 +67,9 @@ if (YUZU_USE_PRECOMPILED_HEADERS)
target_precompile_headers(yuzu-cmd PRIVATE precompiled_headers.h) target_precompile_headers(yuzu-cmd PRIVATE precompiled_headers.h)
endif() 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) create_target_directory_groups(yuzu-cmd)