From 74007ac6f58321369597b1e43a7722d857c88447 Mon Sep 17 00:00:00 2001 From: David Korth Date: Tue, 1 Apr 2025 02:32:10 -0400 Subject: [PATCH] [gtk,kde,win32] AboutTab: Switch from TinyXML2 to PugiXML. Add the PugiXML include path to the GTK and KDE targets It was already added in the Windows target (as TinyXML2). This likely didn't cause any problems before because TinyXML2 is usually installed system-wide on Linux systems. --- src/gtk/config/AboutTab.cpp | 36 ++++++++++++++++++++++++----------- src/gtk/gtk3/CMakeLists.txt | 3 +++ src/gtk/gtk4/CMakeLists.txt | 3 +++ src/gtk/xfce/CMakeLists.txt | 3 +++ src/kde/config/AboutTab.cpp | 36 ++++++++++++++++++++++++----------- src/kde/kde4/CMakeLists.txt | 7 +++++-- src/kde/kf5/CMakeLists.txt | 3 +++ src/kde/kf6/CMakeLists.txt | 3 +++ src/win32/CMakeLists.txt | 4 ++-- src/win32/config/AboutTab.cpp | 32 ++++++++++++++++++++++--------- 10 files changed, 95 insertions(+), 35 deletions(-) diff --git a/src/gtk/config/AboutTab.cpp b/src/gtk/config/AboutTab.cpp index 620414fad..4502938d0 100644 --- a/src/gtk/config/AboutTab.cpp +++ b/src/gtk/config/AboutTab.cpp @@ -39,7 +39,7 @@ using std::string; # include "librpbase/crypto/AesNettle.hpp" #endif /* ENABLE_DECRYPTION && HAVE_NETTLE */ #ifdef ENABLE_XML -# include +# include #endif /* ENABLE_XML */ #if GTK_CHECK_VERSION(3, 0, 0) @@ -728,24 +728,38 @@ rp_about_tab_init_libraries_tab(GtkLabel *lblLibraries) } #endif /* ENABLE_DECRYPTION && HAVE_NETTLE */ - /** TinyXML2 **/ + /** PugiXML **/ #ifdef ENABLE_XML + // PugiXML 1.10 and later uses this format: 1140 == 1.14.0 + // PugiXML 1.9 and earlier uses this format: 190 == 1.9.0 + unsigned int pugixml_major, pugixml_minor, pugixml_patch; + if (PUGIXML_VERSION >= 1000) { + pugixml_major = PUGIXML_VERSION / 1000; + pugixml_minor = (PUGIXML_VERSION % 1000) / 10; + pugixml_patch = PUGIXML_VERSION % 10; + } else { + pugixml_major = PUGIXML_VERSION / 100; + pugixml_minor = (PUGIXML_VERSION % 100) / 10; + pugixml_patch = PUGIXML_VERSION % 10; + } + sLibraries += "\n\n"; - const string tinyXml2Version = fmt::format(FSTR("TinyXML2 {:d}.{:d}.{:d}"), - static_cast(TIXML2_MAJOR_VERSION), - static_cast(TIXML2_MINOR_VERSION), - static_cast(TIXML2_PATCH_VERSION)); + string pugiXmlVersion = fmt::format(FSTR("PugiXML {:d}.{:d}"), + pugixml_major, pugixml_minor); + if (pugixml_patch > 0) { + pugiXmlVersion += fmt::format(FSTR(".{:d}"), pugixml_patch); + } # if defined(USE_INTERNAL_XML) && !defined(USE_INTERNAL_XML_DLL) - sLibraries += fmt::format(FRUN(sIntCopyOf), tinyXml2Version); + sLibraries += fmt::format(FRUN(sIntCopyOf), pugiXmlVersion); # else // FIXME: Runtime version? - sLibraries += fmt::format(FRUN(sCompiledWith), tinyXml2Version); + sLibraries += fmt::format(FRUN(sCompiledWith), pugiXmlVersion); # endif sLibraries += "\n" - "Copyright (C) 2000-2021 Lee Thomason\n" - "http://www.grinninglizard.com/\n"; - sLibraries += fmt::format(FRUN(sLicense), "zlib license"); + "Copyright (C) 2006-2025, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)\n" + "https://pugixml.org/\n"; + sLibraries += fmt::format(FRUN(sLicense), "MIT license"); #endif /* ENABLE_XML */ /** GNU gettext **/ diff --git a/src/gtk/gtk3/CMakeLists.txt b/src/gtk/gtk3/CMakeLists.txt index d49eaeb8e..d32020e57 100644 --- a/src/gtk/gtk3/CMakeLists.txt +++ b/src/gtk/gtk3/CMakeLists.txt @@ -174,6 +174,9 @@ IF(BUILD_GTK3) TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE RP_UI_GTK3) + # PugiXML headers are needed for AboutTab. + TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE ${pugixml_INCLUDE_DIR}) + # libfmt IF(Fmt_FOUND) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${Fmt_LIBRARY}) diff --git a/src/gtk/gtk4/CMakeLists.txt b/src/gtk/gtk4/CMakeLists.txt index 829c30d48..934d58b39 100644 --- a/src/gtk/gtk4/CMakeLists.txt +++ b/src/gtk/gtk4/CMakeLists.txt @@ -153,6 +153,9 @@ IF(BUILD_GTK4) TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE RP_UI_GTK4) + # PugiXML headers are needed for AboutTab. + TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE ${pugixml_INCLUDE_DIR}) + # libfmt IF(Fmt_FOUND) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${Fmt_LIBRARY}) diff --git a/src/gtk/xfce/CMakeLists.txt b/src/gtk/xfce/CMakeLists.txt index 913c2c705..217ac437b 100644 --- a/src/gtk/xfce/CMakeLists.txt +++ b/src/gtk/xfce/CMakeLists.txt @@ -153,6 +153,9 @@ IF(BUILD_XFCE) ADD_DEFINITIONS(${GTK2_DEFINITIONS}) TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE RP_UI_XFCE) + # PugiXML headers are needed for AboutTab. + TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE ${pugixml_INCLUDE_DIR}) + # libfmt IF(Fmt_FOUND) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${Fmt_LIBRARY}) diff --git a/src/kde/config/AboutTab.cpp b/src/kde/config/AboutTab.cpp index c66ca4198..65cf9b2f3 100644 --- a/src/kde/config/AboutTab.cpp +++ b/src/kde/config/AboutTab.cpp @@ -45,7 +45,7 @@ using std::string; # include "librpbase/crypto/AesNettle.hpp" #endif /* ENABLE_DECRYPTION && HAVE_NETTLE */ #ifdef ENABLE_XML -# include +# include #endif /* ENABLE_XML */ #include "ui_AboutTab.h" @@ -480,24 +480,38 @@ void AboutTabPrivate::initLibrariesTab(void) } #endif /* ENABLE_DECRYPTION && HAVE_NETTLE */ - /** TinyXML2 **/ + /** PugiXML **/ #ifdef ENABLE_XML + // PugiXML 1.10 and later uses this format: 1140 == 1.14.0 + // PugiXML 1.9 and earlier uses this format: 190 == 1.9.0 + unsigned int pugixml_major, pugixml_minor, pugixml_patch; + if (PUGIXML_VERSION >= 1000) { + pugixml_major = PUGIXML_VERSION / 1000; + pugixml_minor = (PUGIXML_VERSION % 1000) / 10; + pugixml_patch = PUGIXML_VERSION % 10; + } else { + pugixml_major = PUGIXML_VERSION / 100; + pugixml_minor = (PUGIXML_VERSION % 100) / 10; + pugixml_patch = PUGIXML_VERSION % 10; + } + sLibraries += BR BR; - const string tinyXml2Version = fmt::format(FSTR("TinyXML2 {:d}.{:d}.{:d}"), - static_cast(TIXML2_MAJOR_VERSION), - static_cast(TIXML2_MINOR_VERSION), - static_cast(TIXML2_PATCH_VERSION)); + string pugiXmlVersion = fmt::format(FSTR("PugiXML {:d}.{:d}"), + pugixml_major, pugixml_minor); + if (pugixml_patch > 0) { + pugiXmlVersion += fmt::format(FSTR(".{:d}"), pugixml_patch); + } # if defined(USE_INTERNAL_XML) && !defined(USE_INTERNAL_XML_DLL) - sLibraries += fmt::format(FRUN(sIntCopyOf), tinyXml2Version); + sLibraries += fmt::format(FRUN(sIntCopyOf), pugiXmlVersion); # else // FIXME: Runtime version? - sLibraries += fmt::format(FRUN(sCompiledWith), tinyXml2Version); + sLibraries += fmt::format(FRUN(sCompiledWith), pugiXmlVersion); # endif sLibraries += BR - "Copyright (C) 2000-2021 Lee Thomason" BR - "http://www.grinninglizard.com/" BR; - sLibraries += fmt::format(FRUN(sLicense), "zlib license"); + "Copyright (C) 2006-2025, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)" BR + "https://pugixml.org/" BR; + sLibraries += fmt::format(FRUN(sLicense), "MIT license"); #endif /* ENABLE_XML */ /** GNU gettext **/ diff --git a/src/kde/kde4/CMakeLists.txt b/src/kde/kde4/CMakeLists.txt index db99a7fa4..7b34c6b06 100644 --- a/src/kde/kde4/CMakeLists.txt +++ b/src/kde/kde4/CMakeLists.txt @@ -116,11 +116,14 @@ IF(BUILD_KDE4) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE romdata) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${KDE4_KFILE_LIBRARY} ${KDE4_KDEUI_LIBRARY} ${KDE4_KDECORE_LIBRARY}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC Qt4::QtGui Qt4::QtCore) - TARGET_INCLUDE_DIRECTORIES(rom-properties-kde4 PUBLIC ${KDE4_INCLUDE_DIR} ${KDE4_INCLUDE_DIR}/KDE) + TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC ${KDE4_INCLUDE_DIR} ${KDE4_INCLUDE_DIR}/KDE) IF(HAVE_QtDBus) - TARGET_LINK_LIBRARIES(rom-properties-kde4 PUBLIC Qt4::QtDBus) + TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC Qt4::QtDBus) ENDIF(HAVE_QtDBus) + # PugiXML headers are needed for AboutTab. + TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE ${pugixml_INCLUDE_DIR}) + # libfmt IF(Fmt_FOUND) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${Fmt_LIBRARY}) diff --git a/src/kde/kf5/CMakeLists.txt b/src/kde/kf5/CMakeLists.txt index abd1401d1..56504abff 100644 --- a/src/kde/kf5/CMakeLists.txt +++ b/src/kde/kf5/CMakeLists.txt @@ -127,6 +127,9 @@ IF(BUILD_KF5) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC Qt5::DBus) ENDIF(HAVE_QtDBus) + # PugiXML headers are needed for AboutTab. + TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE ${pugixml_INCLUDE_DIR}) + # libfmt IF(Fmt_FOUND) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${Fmt_LIBRARY}) diff --git a/src/kde/kf6/CMakeLists.txt b/src/kde/kf6/CMakeLists.txt index dd42f7d8b..3bfbd5d22 100644 --- a/src/kde/kf6/CMakeLists.txt +++ b/src/kde/kf6/CMakeLists.txt @@ -114,6 +114,9 @@ IF(BUILD_KF6) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC Qt6::DBus) ENDIF(HAVE_QtDBus) + # PugiXML headers are needed for AboutTab. + TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE ${pugixml_INCLUDE_DIR}) + # libfmt IF(Fmt_FOUND) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${Fmt_LIBRARY}) diff --git a/src/win32/CMakeLists.txt b/src/win32/CMakeLists.txt index 8a24abd12..8923d00e4 100644 --- a/src/win32/CMakeLists.txt +++ b/src/win32/CMakeLists.txt @@ -274,8 +274,8 @@ TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${ZLIB_LIBRARIES}) TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE ${ZLIB_INCLUDE_DIRS}) TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE ${ZLIB_DEFINITIONS}) -# TinyXML2 headers are needed for AboutTab. -TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC ${TinyXML2_INCLUDE_DIR}) +# PugiXML headers are needed for AboutTab. +TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE ${pugixml_INCLUDE_DIR}) IF(Fmt_FOUND) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${Fmt_LIBRARY}) diff --git a/src/win32/config/AboutTab.cpp b/src/win32/config/AboutTab.cpp index 4ec859aac..072908ff7 100644 --- a/src/win32/config/AboutTab.cpp +++ b/src/win32/config/AboutTab.cpp @@ -70,7 +70,7 @@ using std::unique_ptr; #include "librpbase/img/RpPng.hpp" // TODO: JPEG #ifdef ENABLE_XML -# include "tinyxml2.h" +# include #endif // Useful RTF strings. @@ -1186,20 +1186,34 @@ void AboutTabPrivate::initLibrariesTab(void) sLibraries += fmt::format(FRUN(sLicense), "libpng license"); #endif /* HAVE_PNG */ - /** TinyXML2 **/ + /** PugiXML **/ #ifdef ENABLE_XML - const string tinyXml2Version = fmt::format(FSTR("TinyXML2 {:d}.{:d}.{:d}"), - static_cast(TIXML2_MAJOR_VERSION), - static_cast(TIXML2_MINOR_VERSION), - static_cast(TIXML2_PATCH_VERSION)); + // PugiXML 1.10 and later uses this format: 1140 == 1.14.0 + // PugiXML 1.9 and earlier uses this format: 190 == 1.9.0 + unsigned int pugixml_major, pugixml_minor, pugixml_patch; + if (PUGIXML_VERSION >= 1000) { + pugixml_major = PUGIXML_VERSION / 1000; + pugixml_minor = (PUGIXML_VERSION % 1000) / 10; + pugixml_patch = PUGIXML_VERSION % 10; + } else { + pugixml_major = PUGIXML_VERSION / 100; + pugixml_minor = (PUGIXML_VERSION % 100) / 10; + pugixml_patch = PUGIXML_VERSION % 10; + } + + string pugiXmlVersion = fmt::format(FSTR("PugiXML {:d}.{:d}"), + pugixml_major, pugixml_minor); + if (pugixml_patch > 0) { + pugiXmlVersion += fmt::format(FSTR(".{:d}"), pugixml_patch); + } // FIXME: Runtime version? sLibraries += RTF_BR RTF_BR; sLibraries += fmt::format(FRUN(sCompiledWith), tinyXml2Version); sLibraries += RTF_BR - "Copyright (C) 2000-2021 Lee Thomason" RTF_BR - "http://www.grinninglizard.com/" RTF_BR; - sLibraries += fmt::format(FRUN(sLicense), "zlib license"); + "Copyright (C) 2006-2025, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)" RTF_BR + "https://pugixml.org/" RTF_BR; + sLibraries += fmt::format(FRUN(sLicense), "MIT license"); #endif /* ENABLE_XML */ /** GNU gettext **/