diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e63c62c66..8f432b77bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,23 +1,10 @@ ######################################## # General setup # -cmake_minimum_required(VERSION 3.13) +cmake_minimum_required(VERSION 3.20...4.2.1) -cmake_policy(SET CMP0079 NEW) # let target_link_libraries() link to a target defined in a different directory cmake_policy(SET CMP0080 OLD) # allow using BundleUtilities at configure time -if (POLICY CMP0099) - cmake_policy(SET CMP0099 NEW) # Propagate INTERFACE_LINK_OPTIONS from private dependencies, used by MacOS framework builds of SDL -endif() - -# Weird chicken-and-egg problem: We can't check the compiler before the project() call, but we have to set the policies before it. -# So we do this in two steps: Set the policies if they exist, then error out afterwards if we end up being MSVC and they don't exist. -if (POLICY CMP0117) - cmake_policy(SET CMP0091 NEW) # MSVC runtime library flags are selected by an abstraction. - cmake_policy(SET CMP0092 NEW) # MSVC warning flags are not in CMAKE_{C,CXX}_FLAGS by default. - cmake_policy(SET CMP0117 NEW) # MSVC RTTI flag will not be added by default. -endif() - if (POLICY CMP0141) cmake_policy(SET CMP0141 NEW) # MSVC debug information format flags are selected by an abstraction. endif() @@ -28,6 +15,12 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0.0" CACHE STRING "") set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_SOURCE_DIR}/CMake/FlagsOverride.cmake") +# CMake 3.28 and later scan c++ source files for module imports by default. Since we don't use +# modules scanning is pointless, so disable it. This also prevents Clang from generating an error +# if the clang-scan-deps tool isn't installed: +# "CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS-NOTFOUND: not found". +set(CMAKE_CXX_SCAN_FOR_MODULES OFF) + project(dolphin-emu) if (CMAKE_VERSION VERSION_LESS "3.25" AND CMAKE_SYSTEM_NAME MATCHES "Linux") @@ -35,12 +28,6 @@ if (CMAKE_VERSION VERSION_LESS "3.25" AND CMAKE_SYSTEM_NAME MATCHES "Linux") endif() if (MSVC) - if (POLICY CMP0117) - # cmake is a weird language. You can't do if(not POLICY) - else() - message(FATAL_ERROR "Please update to CMake 3.20 or higher.") - endif() - set(CMAKE_C_STANDARD 99) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 8d74b60470..c98a9b3188 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -16,7 +16,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows") endif() if (NOT MSVC) - set(CMAKE_CXX_STANDARD 20) + set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) endif() diff --git a/Source/Core/DiscIO/VolumeFileBlobReader.cpp b/Source/Core/DiscIO/VolumeFileBlobReader.cpp index 7cbc06e589..92eb9b4ae2 100644 --- a/Source/Core/DiscIO/VolumeFileBlobReader.cpp +++ b/Source/Core/DiscIO/VolumeFileBlobReader.cpp @@ -33,6 +33,11 @@ VolumeFileBlobReader::VolumeFileBlobReader(const Volume& volume, const Partition { } +// This is defined here instead of the header so that the definition of FileInfo is visible when +// m_file_info is destroyed, preventing a compile error caused by calling unique_ptr's destructor +// with an incomplete type. +VolumeFileBlobReader::~VolumeFileBlobReader() = default; + std::unique_ptr VolumeFileBlobReader::CopyReader() const { ASSERT_MSG(DISCIO, false, "Unimplemented"); diff --git a/Source/Core/DiscIO/VolumeFileBlobReader.h b/Source/Core/DiscIO/VolumeFileBlobReader.h index 58d349a0d4..49fe4cd200 100644 --- a/Source/Core/DiscIO/VolumeFileBlobReader.h +++ b/Source/Core/DiscIO/VolumeFileBlobReader.h @@ -20,6 +20,7 @@ class VolumeFileBlobReader final : public BlobReader public: static std::unique_ptr Create(const Volume& volume, const Partition& partition, std::string_view file_path); + ~VolumeFileBlobReader(); BlobType GetBlobType() const override { return BlobType::PLAIN; } std::unique_ptr CopyReader() const override; diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt index cd49f7f108..1960e944bd 100644 --- a/Source/Core/DolphinQt/CMakeLists.txt +++ b/Source/Core/DolphinQt/CMakeLists.txt @@ -1,8 +1,3 @@ -if(POLICY CMP0084) - # Disable trying to search for Qt3/4 if what we actually want is not found - cmake_policy(SET CMP0084 NEW) -endif() - if (MSVC) if(_M_ARM_64) list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/Externals/Qt/Qt6.5.1/ARM64") diff --git a/Source/Core/VideoBackends/Metal/MTLObjectCache.mm b/Source/Core/VideoBackends/Metal/MTLObjectCache.mm index c4ecfc0713..7dce7a0f34 100644 --- a/Source/Core/VideoBackends/Metal/MTLObjectCache.mm +++ b/Source/Core/VideoBackends/Metal/MTLObjectCache.mm @@ -27,16 +27,6 @@ std::unique_ptr Metal::g_object_cache; static void SetupDepthStencil( MRCOwned> (&dss)[Metal::DepthStencilSelector::N_VALUES]); -Metal::ObjectCache::ObjectCache() -{ - m_internal = std::make_unique(); - SetupDepthStencil(m_dss); -} - -Metal::ObjectCache::~ObjectCache() -{ -} - void Metal::ObjectCache::Initialize(MRCOwned> device) { g_device = std::move(device); @@ -554,6 +544,17 @@ public: } }; +Metal::ObjectCache::ObjectCache() +{ + m_internal = std::make_unique(); + SetupDepthStencil(m_dss); +} + +// This is defined here instead of the header so that the definition of Internal is visible when +// m_internal is destroyed, preventing a compile error caused by calling unique_ptr's destructor +// with an incomplete type. +Metal::ObjectCache::~ObjectCache() = default; + std::unique_ptr Metal::ObjectCache::CreatePipeline(const AbstractPipelineConfig& config) {