feat: std::format usage enabled for VS2022

This commit is contained in:
Mateusz Pusz
2021-11-15 16:28:26 +01:00
parent 57ec615d79
commit 0ce18dc3c7
3 changed files with 9 additions and 4 deletions

View File

@@ -63,9 +63,12 @@ class UnitsConan(ConanFile):
@property
def _use_libfmt(self):
# compiler = self.settings.compiler
# return compiler != "Visual Studio" and compiler != "msvc" # TODO Enable when VS std::format_to(ctx.out, ...) is fixed
return True
compiler = self.settings.compiler
version = Version(self.settings.compiler.version)
std_support = \
(compiler == "Visual Studio" and version >= "17" and compiler.cppstd == 23) or \
(compiler == "msvc" and (version == "19.3" or version >= "19.30") and compiler.cppstd == 23)
return not std_support
def set_version(self):
content = tools.load(os.path.join(self.recipe_folder, "src/CMakeLists.txt"))

View File

@@ -72,7 +72,7 @@ using namespace glide_computer;
void print(std::string_view phase_name, timestamp start_ts, const glide_computer::flight_point& point, const glide_computer::flight_point& new_point)
{
fmt::print(
std::cout << STD_FMT::format(
"| {:<12} | {:>9%.1Q %q} (Total: {:>9%.1Q %q}) | {:>8%.1Q %q} (Total: {:>8%.1Q %q}) | {:>7%.0Q %q} ({:>6%.0Q %q}) |\n",
phase_name, quantity_cast<si::minute>(new_point.ts - point.ts), quantity_cast<si::minute>(new_point.ts - start_ts),
new_point.dist - point.dist, new_point.dist, new_point.alt - point.alt, new_point.alt);

View File

@@ -22,6 +22,8 @@
#pragma once
#include <version>
#if __clang__
#define UNITS_COMP_CLANG __clang_major__
#elif __GNUC__