Revert "Remove fmt dependency"

This reverts commit 8efdf7b6fe.
This commit is contained in:
Martin Brodbeck 2023-04-25 15:22:06 +02:00
parent e79a81797c
commit f4b4ccbbea
4 changed files with 12 additions and 10 deletions

View File

@ -3,9 +3,9 @@ Type=Application
Name=KIMA2 Name=KIMA2
GenericName=Cash Point Program GenericName=Cash Point Program
GenericName[de]=Kassenprogramm GenericName[de]=Kassenprogramm
Comment=A small cash point program for childrens stuff markets Comment=A small cash point program
Comment[de]=Ein kleines Kassenprogramm für Kindersachenmärkte Comment[de]=Ein kleines Kassenprogramm
Exec=kima2 Exec=kima2
Icon=kima2 Icon=kima2
Categories=Office; Categories=Office;
Terminal=false

View File

@ -7,7 +7,7 @@ find_package(SQLite3 REQUIRED)
set(THREADS_PREFER_PTHREAD_FLAG ON) set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
#find_package(fmt) find_package(fmt)
set(CORE_SOURCES set(CORE_SOURCES
database.cpp database.cpp
@ -27,10 +27,10 @@ set(CORE_SOURCES
add_library(core STATIC ${CORE_SOURCES}) add_library(core STATIC ${CORE_SOURCES})
target_include_directories(core PRIVATE ${PROJECT_SOURCE_DIR}/subprojects/csv-parser/single_include) target_include_directories(core PRIVATE ${PROJECT_SOURCE_DIR}/subprojects/csv-parser/single_include)
if (WIN32) if (WIN32)
target_link_libraries(core PRIVATE sqlite3 nlohmann_json::nlohmann_json Threads::Threads) target_link_libraries(core PRIVATE sqlite3 nlohmann_json::nlohmann_json Threads::Threads fmt::fmt)
target_link_libraries(core PRIVATE bcrypt) target_link_libraries(core PRIVATE bcrypt)
else() else()
target_link_libraries(core PRIVATE sqlite3 nlohmann_json::nlohmann_json Threads::Threads) target_link_libraries(core PRIVATE sqlite3 nlohmann_json::nlohmann_json Threads::Threads fmt::fmt)
endif() endif()
target_include_directories(core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..) target_include_directories(core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..)

View File

@ -2,7 +2,7 @@
#include <chrono> #include <chrono>
#include <filesystem> #include <filesystem>
#include <format> #include <fmt/chrono.h>
#include <iostream> #include <iostream>
#include <stdexcept> #include <stdexcept>
#include <vector> #include <vector>
@ -47,7 +47,7 @@ void Database::newDb()
fs::path destPath = sourcePath.parent_path() / sourcePath.stem(); fs::path destPath = sourcePath.parent_path() / sourcePath.stem();
auto chronoTime = std::chrono::system_clock::now(); auto chronoTime = std::chrono::system_clock::now();
std::string timeString = std::format("{0:%FT%H-%M-%S}", chronoTime); std::string timeString = fmt::format("{0:%FT%H-%M-%S}", chronoTime);
destPath += std::string("_") += timeString += ".db"; destPath += std::string("_") += timeString += ".db";

View File

@ -2,12 +2,14 @@
#include <algorithm> #include <algorithm>
#include <clocale> #include <clocale>
#include <format> #include <fmt/format.h>
#include <iomanip> #include <iomanip>
#include <numeric> #include <numeric>
#include <iostream> #include <iostream>
using namespace fmt;
std::string formatCentAsEuroString(const int cent, int width) std::string formatCentAsEuroString(const int cent, int width)
{ {
/*std::stringstream currStream; /*std::stringstream currStream;
@ -30,7 +32,7 @@ std::string formatCentAsEuroString(const int cent, int width)
#else #else
std::locale myLocale{"de_DE.utf8"}; std::locale myLocale{"de_DE.utf8"};
#endif #endif
return std::format(myLocale, "{:{}.2Lf} €", cent / 100.0L, width); return fmt::format(myLocale, "{:{}.2Lf} €", cent / 100.0L, width);
} }
std::string &ltrim(std::string &str, const std::string &chars) std::string &ltrim(std::string &str, const std::string &chars)