From 9da29407463242072f95925b14b099c8ca0c1469 Mon Sep 17 00:00:00 2001 From: TennesseeTrash Date: Sun, 15 Jun 2025 18:37:24 +0200 Subject: [PATCH 1/2] Use pugixml explicitly as a static library --- CMake/pugixml.cmake | 2 +- Libraries/Kanimaji/CMakeLists.txt | 2 +- Libraries/Tablegen/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMake/pugixml.cmake b/CMake/pugixml.cmake index fd5f750..996f4ed 100644 --- a/CMake/pugixml.cmake +++ b/CMake/pugixml.cmake @@ -1,4 +1,4 @@ -if(NOT TARGET pugixml) +if(NOT TARGET pugixml-static) include(FetchContent) FetchContent_Declare( diff --git a/Libraries/Kanimaji/CMakeLists.txt b/Libraries/Kanimaji/CMakeLists.txt index 7c72c1b..2d0181a 100644 --- a/Libraries/Kanimaji/CMakeLists.txt +++ b/Libraries/Kanimaji/CMakeLists.txt @@ -12,7 +12,7 @@ target_link_libraries(Kanimaji KVGToolsCommon PRIVATE - pugixml + pugixml-static ) target_include_directories(Kanimaji diff --git a/Libraries/Tablegen/CMakeLists.txt b/Libraries/Tablegen/CMakeLists.txt index 7b17c78..5cd1481 100644 --- a/Libraries/Tablegen/CMakeLists.txt +++ b/Libraries/Tablegen/CMakeLists.txt @@ -17,7 +17,7 @@ target_link_libraries(Tablegen KVGToolsCommon PRIVATE - pugixml + pugixml-static ) target_sources(Tablegen From a0b221f103d22768e939cd6c8b58fc084902eb01 Mon Sep 17 00:00:00 2001 From: TennesseeTrash Date: Sun, 15 Jun 2025 18:37:58 +0200 Subject: [PATCH 2/2] [Tablegen] Specify characters separately from the settings --- .../Tablegen/Include/Tablegen/Settings.hpp | 2 -- .../Tablegen/Include/Tablegen/Tablegen.hpp | 12 ++++++++---- Libraries/Tablegen/Source/Settings.cpp | 1 - Libraries/Tablegen/Source/Tablegen.cpp | 19 +++++++++++-------- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Libraries/Tablegen/Include/Tablegen/Settings.hpp b/Libraries/Tablegen/Include/Tablegen/Settings.hpp index 3e387fc..853d4e3 100644 --- a/Libraries/Tablegen/Include/Tablegen/Settings.hpp +++ b/Libraries/Tablegen/Include/Tablegen/Settings.hpp @@ -4,7 +4,6 @@ #include #include -#include namespace Tablegen { @@ -49,7 +48,6 @@ namespace Tablegen std::size_t CharactersPerRow; std::string ImageFormat; std::string AnimationFormat; - std::vector Characters; static Settings Default(); }; diff --git a/Libraries/Tablegen/Include/Tablegen/Tablegen.hpp b/Libraries/Tablegen/Include/Tablegen/Tablegen.hpp index 57a21eb..aa97c82 100644 --- a/Libraries/Tablegen/Include/Tablegen/Tablegen.hpp +++ b/Libraries/Tablegen/Include/Tablegen/Tablegen.hpp @@ -8,17 +8,21 @@ #endif #include +#include namespace Tablegen { - std::string GeneratePage(const Settings& settings = Settings::Default()); + std::string GeneratePage(std::vector characters, + const Settings& settings = Settings::Default()); - void GeneratePage(const std::string& path, const Settings& settings = Settings::Default()); + void GeneratePage(const std::string& path, std::vector characters, + const Settings& settings = Settings::Default()); # ifdef TABLEGEN_EXPOSE_XML - void GenerateAsChild(pugi::xml_node& node, const Settings& settings = Settings::Default()); + void GenerateAsChild(pugi::xml_node& node, std::vector characters, + const Settings& settings = Settings::Default()); - pugi::xml_document GenerateDocument(const Settings& settings = Settings::Default()); + pugi::xml_document GenerateDocument(std::vector characters, const Settings& settings = Settings::Default()); # endif } diff --git a/Libraries/Tablegen/Source/Settings.cpp b/Libraries/Tablegen/Source/Settings.cpp index 2602eab..d6cbe15 100644 --- a/Libraries/Tablegen/Source/Settings.cpp +++ b/Libraries/Tablegen/Source/Settings.cpp @@ -32,7 +32,6 @@ namespace Tablegen .CharactersPerRow = 3, .ImageFormat = "https://3011.io/Assets/Images/Kanji/Static/{}.png", .AnimationFormat = "https://3011.io/Assets/Temp/{}.svg", - .Characters = {}, }; } } diff --git a/Libraries/Tablegen/Source/Tablegen.cpp b/Libraries/Tablegen/Source/Tablegen.cpp index bff9b28..248e605 100644 --- a/Libraries/Tablegen/Source/Tablegen.cpp +++ b/Libraries/Tablegen/Source/Tablegen.cpp @@ -95,9 +95,9 @@ namespace Tablegen } } - std::string GeneratePage(const Settings& settings) + std::string GeneratePage(std::vector characters, const Settings& settings) { - pugi::xml_document doc = GenerateDocument(settings); + pugi::xml_document doc = GenerateDocument(characters, settings); std::uint32_t formatOptions; formatOptions = pugi::format_indent | pugi::format_no_escapes | pugi::format_no_declaration; @@ -106,16 +106,18 @@ namespace Tablegen return str.str(); } - void GeneratePage(const std::string& path, const Settings& settings) + void GeneratePage(const std::string& path, std::vector characters, + const Settings& settings) { - pugi::xml_document doc = GenerateDocument(settings); + pugi::xml_document doc = GenerateDocument(characters, settings); std::uint32_t formatOptions; formatOptions = pugi::format_indent | pugi::format_no_escapes | pugi::format_no_declaration; doc.save_file("test.html", " ", formatOptions); } - void GenerateAsChild(pugi::xml_node& node, const Settings& settings) + void GenerateAsChild(pugi::xml_node& node, std::vector characters, + const Settings& settings) { pugi::xml_node tableRoot = node; @@ -151,7 +153,7 @@ namespace Tablegen std::string tagIndent((indentLevel > 0 ? indentLevel - 1 : 0) * 4, ' '); pugi::xml_node tableBody = table.append_child("tbody"); - for (pugi::xml_node row; const auto& [i, character] : vw::enumerate(settings.Characters)) { + for (pugi::xml_node row; const auto& [i, character] : vw::enumerate(characters)) { //////////////////////////////////////////////////////////////////// // HTML //////////////////////////////////////////////////////////////////// @@ -201,10 +203,11 @@ namespace Tablegen script.append_child(pugi::node_pcdata).set_value(Script(indent, tagIndent, buttons)); } - pugi::xml_document GenerateDocument(const Settings& settings) + pugi::xml_document GenerateDocument(std::vector characters, + const Settings& settings) { pugi::xml_document doc; - GenerateAsChild(doc); + GenerateAsChild(doc, characters, settings); return doc; } }