Switch to C++20
This commit is contained in:
@@ -42,7 +42,7 @@ else()
|
||||
endif()
|
||||
FilterPlatformPaths(sources)
|
||||
SetWarningSettings(openVulkanoCpp)
|
||||
set_property(TARGET openVulkanoCpp PROPERTY CXX_STANDARD 17)
|
||||
set_property(TARGET openVulkanoCpp PROPERTY CXX_STANDARD 20)
|
||||
|
||||
target_sources(openVulkanoCpp PRIVATE ${sources})
|
||||
target_include_directories(openVulkanoCpp PUBLIC openVulkanoCpp)
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace OpenVulkano
|
||||
ComponentDecodeHolder(const std::string_view& versionStr)
|
||||
{
|
||||
if (versionStr.empty()) return;
|
||||
int offset = 0;
|
||||
size_t offset = 0;
|
||||
if (versionStr[0] == 'v' || versionStr[0] == 'V')
|
||||
{
|
||||
offset++;
|
||||
@@ -54,7 +54,7 @@ namespace OpenVulkano
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static void ReadVersionComponents(std::vector<uint32_t>& comps, const std::string_view& versionStr, int& offset)
|
||||
static void ReadVersionComponents(std::vector<uint32_t>& comps, const std::string_view& versionStr, size_t& offset)
|
||||
{
|
||||
do
|
||||
{
|
||||
@@ -66,7 +66,7 @@ namespace OpenVulkano
|
||||
} while(versionStr.size() > offset);
|
||||
}
|
||||
|
||||
static void ReadTagComponents(std::vector<std::string>& tags, const std::string_view& versionStr, int& offset)
|
||||
static void ReadTagComponents(std::vector<std::string>& tags, const std::string_view& versionStr, size_t& offset)
|
||||
{
|
||||
do
|
||||
{
|
||||
@@ -88,11 +88,11 @@ namespace OpenVulkano
|
||||
}
|
||||
}
|
||||
|
||||
Version::Version(uint32_t major, uint32_t minor, uint32_t patch, uint32_t build)
|
||||
Version::Version(uint32_t major, uint32_t minor, uint32_t patch, const uint32_t build)
|
||||
: m_versionComponents(build ? std::initializer_list<uint32_t>{major, minor, patch, build} : std::initializer_list<uint32_t>{major, minor, patch})
|
||||
, m_buildNumber(build)
|
||||
#if (__cplusplus >= 202002L)
|
||||
, m_versionString(std::format(build ? "v{}.{}.{}.{}" : "v{}.{}.{}", major, minor, patch, build))
|
||||
, m_versionString(std::format("v{}.{}.{}.{}", major, minor, patch, build))
|
||||
#else
|
||||
, m_versionString("v" + std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(patch) + (build ? "." + std::to_string(build) : ""))
|
||||
#endif
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace OpenVulkano
|
||||
fpsTimer = 0;
|
||||
if (window->HasTitle())
|
||||
{
|
||||
window->SetTitle(fmt::format(windowTitleFormat, avgFps, avgFrameTime));
|
||||
window->SetTitle(fmt::format(fmt::runtime(windowTitleFormat), avgFps, avgFrameTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenVulkano
|
||||
|
||||
void MultiPartArchiveWriter::StartNewFile()
|
||||
{
|
||||
m_archives.push_back(m_dir / fmt::format(m_fileNamePattern, m_archiveId++));
|
||||
m_archives.push_back(m_dir / fmt::format(fmt::runtime(m_fileNamePattern), m_archiveId++));
|
||||
#ifdef WIN32
|
||||
m_writer = std::make_unique<ArchiveWriter>(m_archives.back().string().c_str(), m_archiveConfig, m_logger);
|
||||
#else
|
||||
|
||||
@@ -171,7 +171,7 @@ template<> struct fmt::formatter<OpenVulkano::ByteSize>
|
||||
|
||||
template<typename FormatContext> auto format(const OpenVulkano::ByteSize& bs, FormatContext& ctx)
|
||||
{
|
||||
return format_to(ctx.out(), "{}", bs.Format());
|
||||
return fmt::format_to(ctx.out(), "{}", bs.Format());
|
||||
}
|
||||
};
|
||||
#endif
|
||||
@@ -19,9 +19,24 @@
|
||||
|
||||
namespace ImGui
|
||||
{
|
||||
template <typename T, typename... Args>
|
||||
IMGUI_API void TextFmt(T&& fmt, const Args &... args) {
|
||||
std::string str = fmt::format(std::forward<T>(fmt), args...);
|
||||
template <typename... Args>
|
||||
void TextFmt(const std::string_view& fmt, const Args&... args)
|
||||
{
|
||||
std::string str = fmt::format(fmt::runtime(fmt), (args)...);
|
||||
ImGui::TextUnformatted(str.data(), str.data() + str.size());
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
void TextFmt(const std::string_view& fmt, Args&&... args)
|
||||
{
|
||||
std::string str = fmt::format(fmt::runtime(fmt), std::forward<Args>(args)...);
|
||||
ImGui::TextUnformatted(str.data(), str.data() + str.size());
|
||||
}
|
||||
|
||||
template <const char* FMT, typename... Args>
|
||||
IMGUI_API void TextFmt(Args &&... args)
|
||||
{
|
||||
std::string str = fmt::format(FMT, std::forward<Args>(args)...);
|
||||
ImGui::TextUnformatted(str.data(), str.data() + str.size());
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "DeviceManager.hpp"
|
||||
#include "Device.hpp"
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
|
||||
namespace OpenVulkano::Vulkan
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user