diff --git a/CMakeLists.txt b/CMakeLists.txt index 1142585b6d..32e873f009 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -169,6 +169,31 @@ if (MSVC AND NOT CXX_CLANG) set(CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT} /W3 /WX-") endif() +# Set runtime library to MD/MDd for all configurations +if(MSVC) + if (YUZU_USE_BUNDLED_QT AND ARCHITECTURE_arm64) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set(libflag MT) + else() + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") + set(libflag MD) + endif() + + # Force all projects (including external dependencies) to use the same runtime + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /${libflag}") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /${libflag}d") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /${libflag}") + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /${libflag}d") + + # Add this to ensure Cubeb uses the same runtime + add_compile_options( + $<$:$<$:/${libflag}d>> + $<$:$<$:/${libflag}>> + $<$:$<$:/${libflag}>> + $<$:$<$:/${libflag}>> + ) +endif() + # TODO(crueter): Cleanup, each dep that has a bundled option should allow to choose between bundled, external, system cmake_dependent_option(YUZU_USE_EXTERNAL_SDL2 "Build SDL2 from external source" OFF "NOT MSVC;NOT ANDROID" OFF) cmake_dependent_option(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 build" "${MSVC}" "NOT ANDROID" OFF) @@ -688,25 +713,6 @@ if (MSVC AND CXX_CLANG) link_libraries(llvm-mingw-runtime) endif() -# Set runtime library to MD/MDd for all configurations -if(MSVC) - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") - - # Force all projects (including external dependencies) to use the same runtime - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MD") - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MDd") - - # Add this to ensure Cubeb uses the same runtime - add_compile_options( - $<$:/MDd> - $<$:/MD> - $<$:/MD> - $<$:/MD> - ) -endif() - add_subdirectory(src) # Set yuzu project or yuzu-cmd project as default StartUp Project in Visual Studio depending on whether QT is enabled or not diff --git a/externals/demangle/llvm/Demangle/ItaniumDemangle.h b/externals/demangle/llvm/Demangle/ItaniumDemangle.h index 0dc3d73372..a2bac5d735 100644 --- a/externals/demangle/llvm/Demangle/ItaniumDemangle.h +++ b/externals/demangle/llvm/Demangle/ItaniumDemangle.h @@ -1259,7 +1259,7 @@ class ParameterPack final : public Node { // Setup OutputBuffer for a pack expansion, unless we're already expanding // one. void initializePackExpansion(OutputBuffer &OB) const { - if (OB.CurrentPackMax == std::numeric_limits::max()) { + if (OB.CurrentPackMax == (std::numeric_limits::max)()) { OB.CurrentPackMax = static_cast(Data.size()); OB.CurrentPackIndex = 0; } @@ -1353,7 +1353,7 @@ public: const Node *getChild() const { return Child; } void printLeft(OutputBuffer &OB) const override { - constexpr unsigned Max = std::numeric_limits::max(); + constexpr unsigned Max = (std::numeric_limits::max)(); ScopedOverride SavePackIdx(OB.CurrentPackIndex, Max); ScopedOverride SavePackMax(OB.CurrentPackMax, Max); size_t StreamPos = OB.getCurrentPosition(); diff --git a/externals/demangle/llvm/Demangle/Utility.h b/externals/demangle/llvm/Demangle/Utility.h index 30dfbfc8dc..0d2e613ea9 100644 --- a/externals/demangle/llvm/Demangle/Utility.h +++ b/externals/demangle/llvm/Demangle/Utility.h @@ -88,8 +88,8 @@ public: /// If a ParameterPackExpansion (or similar type) is encountered, the offset /// into the pack that we're currently printing. - unsigned CurrentPackIndex = std::numeric_limits::max(); - unsigned CurrentPackMax = std::numeric_limits::max(); + unsigned CurrentPackIndex = (std::numeric_limits::max)(); + unsigned CurrentPackMax = (std::numeric_limits::max)(); /// When zero, we're printing template args and '>' needs to be parenthesized. /// Use a counter so we can simply increment inside parentheses. diff --git a/externals/tz/tz/tz.cpp b/externals/tz/tz/tz.cpp index 04fa6cc8a9..3269d9cc1e 100644 --- a/externals/tz/tz/tz.cpp +++ b/externals/tz/tz/tz.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: 2023 yuzu Emulator Project // SPDX-FileCopyrightText: 1996 Arthur David Olson // SPDX-License-Identifier: BSD-2-Clause @@ -466,8 +469,8 @@ CalendarTimeInternal* timesub(const time_t* timep, s64 offset, const Rule* sp, int signed_y = static_cast(y); tmp->tm_year = signed_y - TM_YEAR_BASE; } - else if ((!std::is_signed_v || std::numeric_limits::min() + TM_YEAR_BASE <= y) && - y - TM_YEAR_BASE <= std::numeric_limits::max()) { + else if ((!std::is_signed_v || (std::numeric_limits::min)() + TM_YEAR_BASE <= y) && + y - TM_YEAR_BASE <= (std::numeric_limits::max)()) { tmp->tm_year = static_cast(y - TM_YEAR_BASE); } else { @@ -558,8 +561,8 @@ CalendarTimeInternal* localsub(Rule const* sp, time_t const* timep, s64 setname, else { newy += years; } - if (!(std::numeric_limits::min() <= newy && - newy <= std::numeric_limits::max())) { + if (!((std::numeric_limits::min)() <= newy && + newy <= (std::numeric_limits::max)())) { return nullptr; } result->tm_year = static_cast(newy); diff --git a/externals/tz/tz/tz.h b/externals/tz/tz/tz.h index dae4459bcb..e70092a987 100644 --- a/externals/tz/tz/tz.h +++ b/externals/tz/tz/tz.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: 2023 yuzu Emulator Project // SPDX-FileCopyrightText: 1996 Arthur David Olson // SPDX-License-Identifier: BSD-2-Clause @@ -26,10 +29,10 @@ constexpr size_t TZ_MAX_CHARS = 50; constexpr size_t MY_TZNAME_MAX = 255; constexpr size_t TZNAME_MAXIMUM = 255; constexpr size_t TZ_MAX_LEAPS = 50; -constexpr s64 TIME_T_MAX = std::numeric_limits::max(); -constexpr s64 TIME_T_MIN = std::numeric_limits::min(); +constexpr s64 TIME_T_MAX = (std::numeric_limits::max)(); +constexpr s64 TIME_T_MIN = (std::numeric_limits::min)(); constexpr size_t CHARS_EXTRA = 3; -constexpr size_t MAX_ZONE_CHARS = std::max(TZ_MAX_CHARS + CHARS_EXTRA, sizeof("UTC")); +constexpr size_t MAX_ZONE_CHARS = (std::max)(TZ_MAX_CHARS + CHARS_EXTRA, sizeof("UTC")); constexpr size_t MAX_TZNAME_CHARS = 2 * (MY_TZNAME_MAX + 1); struct ttinfo { @@ -51,7 +54,7 @@ struct Rule { std::array ats; std::array types; std::array ttis; - std::array chars; + std::array chars; s32 defaulttype; std::array padding1; }; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ec064a0e34..48544aeaec 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -185,7 +185,7 @@ else() add_compile_definitions(_FILE_OFFSET_BITS=64) endif() - if (YUZU_STATIC_BUILD AND NOT APPLE) + if (YUZU_STATIC_BUILD AND NOT APPLE AND NOT MSVC) add_compile_options(-static) # yuzu-cmd requires us to explicitly link libpthread, libgcc, and libstdc++ as static diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index eaa6912f0d..60e0e8449b 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h @@ -811,7 +811,7 @@ void BufferCache

::BindHostVertexBuffers() { auto& flags = maxwell3d->dirty.flags; u32 enabled_mask = enabled_vertex_buffers_mask; HostBindings bindings{}; - u32 last_index = std::numeric_limits::max(); + u32 last_index = (std::numeric_limits::max)(); const auto flush_bindings = [&]() { if (bindings.buffers.empty()) { return; @@ -819,7 +819,7 @@ void BufferCache

::BindHostVertexBuffers() { bindings.max_index = bindings.min_index + static_cast(bindings.buffers.size()); runtime.BindVertexBuffers(bindings); bindings = HostBindings{}; - last_index = std::numeric_limits::max(); + last_index = (std::numeric_limits::max)(); }; while (enabled_mask != 0) { const u32 index = std::countr_zero(enabled_mask); diff --git a/src/video_core/renderer_vulkan/vk_query_cache.cpp b/src/video_core/renderer_vulkan/vk_query_cache.cpp index 9543c65bd4..98062a78dc 100644 --- a/src/video_core/renderer_vulkan/vk_query_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_query_cache.cpp @@ -951,7 +951,7 @@ private: runtime.View3DRegs([this](Maxwell3D& maxwell3d) { buffers_count = 0; out_topology = maxwell3d.draw_manager.draw_state.topology; - patch_vertices = std::max(maxwell3d.regs.patch_vertices, 1U); + patch_vertices = (std::max)(maxwell3d.regs.patch_vertices, 1U); if (out_topology == Maxwell3D::Regs::PrimitiveTopology::Patches) { switch (maxwell3d.regs.tessellation.params.output_primitives.Value()) { case Maxwell3D::Regs::Tessellation::OutputPrimitives::Points: @@ -1145,7 +1145,7 @@ public: } new_query->stride = 1; runtime.View3DRegs([new_query, subreport](Maxwell3D& maxwell3d) { - new_query->patch_vertices = std::max(maxwell3d.regs.patch_vertices, 1U); + new_query->patch_vertices = (std::max)(maxwell3d.regs.patch_vertices, 1U); for (size_t i = 0; i < Maxwell3D::Regs::NumTransformFeedbackBuffers; i++) { const auto& tf = maxwell3d.regs.transform_feedback; if (tf.buffers[i].enable == 0) {