From 85c4297f0ba6d8c69f36cb912439b3da52f8e1b8 Mon Sep 17 00:00:00 2001 From: Stijn Frishert Date: Sun, 9 Dec 2018 22:38:54 +0100 Subject: [PATCH] Removed libfmt dependency --- lsdj_wavetable_import/CMakeLists.txt | 3 +-- lsdj_wavetable_import/main.cpp | 28 +++++++--------------------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/lsdj_wavetable_import/CMakeLists.txt b/lsdj_wavetable_import/CMakeLists.txt index e327f59..807f767 100644 --- a/lsdj_wavetable_import/CMakeLists.txt +++ b/lsdj_wavetable_import/CMakeLists.txt @@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.0.0) set(Boost_USE_STATIC_LIBS ON) find_package(Boost REQUIRED COMPONENTS filesystem program_options) -find_library(Fmt fmt) # Create the executable target add_executable(lsdj-wavetable-import main.cpp ../common/common.hpp ../common/common.cpp) @@ -10,6 +9,6 @@ source_group(\\ FILES main.cpp ../common/common.hpp ../common/common.cpp) target_compile_features(lsdj-wavetable-import PUBLIC cxx_std_14) target_include_directories(lsdj-wavetable-import PUBLIC ${Boost_INCLUDE_DIRS}) -target_link_libraries(lsdj-wavetable-import liblsdj ${Boost_LIBRARIES} ${Fmt}) +target_link_libraries(lsdj-wavetable-import liblsdj ${Boost_LIBRARIES}) install(TARGETS lsdj-wavetable-import DESTINATION bin) diff --git a/lsdj_wavetable_import/main.cpp b/lsdj_wavetable_import/main.cpp index c17bae8..59e5fcc 100644 --- a/lsdj_wavetable_import/main.cpp +++ b/lsdj_wavetable_import/main.cpp @@ -44,8 +44,6 @@ #include #include -#include - #include "../common/common.hpp" #include "../liblsdj/project.h" @@ -106,15 +104,15 @@ int apply(const std::string& projectName, const std::string& outputName, const s // Compute the amount of frames we will write const auto frameCount = wavetableSize / 16; if (verbose) - fmt::print("Found {} frames in {}\n", frameCount, wavetablePath.string()); + std::cout << "Found " << std::dec << frameCount << " frames in " << wavetablePath.string() << std::endl; const auto actualFrameCount = std::min(0x100 - wavetableIndex, frameCount); if (frameCount != actualFrameCount) { - fmt::print("Last {} frames won't fit in the song\n", frameCount - actualFrameCount); + std::cout << "Last " << std::dec << (frameCount - actualFrameCount) << " won't fit in the song" << std::endl; if (verbose) - fmt::print("Writing only {} frames due to space limits\n", actualFrameCount); + std::cout << "Writing only " << std::dec << actualFrameCount << " frames due to space limits" << std::endl; } // Check to see if we're overwriting non-default wavetables @@ -139,7 +137,7 @@ int apply(const std::string& projectName, const std::string& outputName, const s break; } } else if (verbose) { - fmt::print("Frame 0x{0:02X} is default\n", wavetableIndex + frame); + std::cout << "Frame 0x" << std::hex << (wavetableIndex + frame) << " is default" << std::endl; } } } @@ -151,13 +149,7 @@ int apply(const std::string& projectName, const std::string& outputName, const s wavetableStream.read(reinterpret_cast(wave->data), sizeof(wave->data)); if (verbose) - { - fmt::print("Wrote {} bytes to frame 0x{:02X} (", sizeof(wave->data), wavetableIndex + frame); - - for (auto i = 0; i < sizeof(wave->data); i++) - fmt::print("{:02X}", wave->data[i]); - std::cout << ")" << std::endl; - } + std::cout << "Wrote " << std::dec << sizeof(wave->data) << " bytes to frame 0x" << std::hex << (wavetableIndex + frame) << std::endl; } // Write zero wavetables @@ -175,13 +167,7 @@ int apply(const std::string& projectName, const std::string& outputName, const s memcpy(wave->data, table.data(), sizeof(table)); if (verbose) - { - fmt::print("Wrote {} bytes to frame 0x{:02X} (", sizeof(wave->data), wavetableIndex + frame); - - for (auto i = 0; i < sizeof(wave->data); i++) - fmt::print("{:02X}", wave->data[i]); - std::cout << ")" << std::endl; - } + std::cout << "Wrote default bytes to frame 0x" << std::hex << (wavetableIndex + frame) << std::endl; } } @@ -194,7 +180,7 @@ int apply(const std::string& projectName, const std::string& outputName, const s return 1; } - fmt::print("Wrote {} frames starting at 0x{:02X} to {}\n", actualFrameCount, wavetableIndex, outputPath.filename().string()); + std::cout << "Wrote " << std::dec << actualFrameCount << " frames starting at 0x" << std::hex << wavetableIndex << " to " << outputPath.string() << std::endl; return 0; }