[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.
This commit is contained in:
David Korth 2025-04-01 02:32:10 -04:00
parent 1b2137f3d5
commit 74007ac6f5
10 changed files with 95 additions and 35 deletions

View File

@ -39,7 +39,7 @@ using std::string;
# include "librpbase/crypto/AesNettle.hpp"
#endif /* ENABLE_DECRYPTION && HAVE_NETTLE */
#ifdef ENABLE_XML
# include <tinyxml2.h>
# include <pugixml.hpp>
#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<unsigned int>(TIXML2_MAJOR_VERSION),
static_cast<unsigned int>(TIXML2_MINOR_VERSION),
static_cast<unsigned int>(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"
"<a href='http://www.grinninglizard.com/'>http://www.grinninglizard.com/</a>\n";
sLibraries += fmt::format(FRUN(sLicense), "zlib license");
"Copyright (C) 2006-2025, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)\n"
"<a href='https://pugixml.org/'>https://pugixml.org/</a>\n";
sLibraries += fmt::format(FRUN(sLicense), "MIT license");
#endif /* ENABLE_XML */
/** GNU gettext **/

View File

@ -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})

View File

@ -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})

View File

@ -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})

View File

@ -45,7 +45,7 @@ using std::string;
# include "librpbase/crypto/AesNettle.hpp"
#endif /* ENABLE_DECRYPTION && HAVE_NETTLE */
#ifdef ENABLE_XML
# include <tinyxml2.h>
# include <pugixml.hpp>
#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<unsigned int>(TIXML2_MAJOR_VERSION),
static_cast<unsigned int>(TIXML2_MINOR_VERSION),
static_cast<unsigned int>(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
"<a href='http://www.grinninglizard.com/'>http://www.grinninglizard.com/</a>" BR;
sLibraries += fmt::format(FRUN(sLicense), "zlib license");
"Copyright (C) 2006-2025, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)" BR
"<a href='https://pugixml.org/'>https://pugixml.org/</a>" BR;
sLibraries += fmt::format(FRUN(sLicense), "MIT license");
#endif /* ENABLE_XML */
/** GNU gettext **/

View File

@ -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})

View File

@ -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})

View File

@ -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})

View File

@ -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})

View File

@ -70,7 +70,7 @@ using std::unique_ptr;
#include "librpbase/img/RpPng.hpp"
// TODO: JPEG
#ifdef ENABLE_XML
# include "tinyxml2.h"
# include <pugixml.hpp>
#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<unsigned int>(TIXML2_MAJOR_VERSION),
static_cast<unsigned int>(TIXML2_MINOR_VERSION),
static_cast<unsigned int>(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 **/