diff --git a/src/app/command_system_information.cpp b/src/app/command_system_information.cpp index bc19cef4..573c6ed1 100644 --- a/src/app/command_system_information.cpp +++ b/src/app/command_system_information.cpp @@ -48,6 +48,7 @@ #endif #include +#include namespace Mayo { @@ -128,6 +129,17 @@ QTextStream& operator<<(QTextStream& str, std::string_view sv) const char indent[] = " "; const char indentx2[] = " "; +struct LibraryInfo { + std::string name; + std::string data; +}; + +std::vector& getLibraryInfos() +{ + static std::vector vec; + return vec; +} + } // namespace static void dumpOpenGlInfo(QTextStream& str) @@ -211,10 +223,9 @@ QString CommandSystemInformation::data() // OpenCascade version ostr << '\n' << "OpenCascade(build): " << OCC_VERSION_STRING_EXT << '\n'; - // gmio version -#ifdef HAVE_GMIO - ostr << '\n' << "gmio(build): " << GMIO_VERSION_STR << '\n'; -#endif + // Other registered libraries + for (const LibraryInfo& libInfo : getLibraryInfos()) + ostr << '\n' << to_QString(libInfo.name) << ": " << to_QString(libInfo.data) << '\n'; // I/O supported formats { @@ -410,4 +421,12 @@ QString CommandSystemInformation::data() return strSysInfo; } +void CommandSystemInformation::addLibraryInfo(std::string_view libName, std::string_view data) +{ + if (!libName.empty() && !data.empty()) { + LibraryInfo libInfo{ std::string(libName), std::string(data) }; + getLibraryInfos().push_back(std::move(libInfo)); + } +} + } // namespace Mayo diff --git a/src/app/commands_help.h b/src/app/commands_help.h index 0b652ab1..994e8e06 100644 --- a/src/app/commands_help.h +++ b/src/app/commands_help.h @@ -24,6 +24,7 @@ class CommandSystemInformation : public Command { void execute() override; static QString data(); + static void addLibraryInfo(std::string_view libName, std::string_view data); static constexpr std::string_view Name = "system-info"; }; diff --git a/src/app/main.cpp b/src/app/main.cpp index b5cdc268..72635261 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -497,6 +497,9 @@ static int runApp(QCoreApplication* qtApp) appModule->properties()->IO_bindParameters(ioSystem); appModule->properties()->retranslate(); + // Register library infos + CommandSystemInformation::addLibraryInfo(IO::GmioLib::strName, IO::GmioLib::strVersion); + // Process CLI if (args.showSystemInformation) { CommandSystemInformation cmdSysInfo(nullptr); diff --git a/src/io_gmio/io_gmio.h b/src/io_gmio/io_gmio.h index 722f78c1..98c6a48a 100644 --- a/src/io_gmio/io_gmio.h +++ b/src/io_gmio/io_gmio.h @@ -8,6 +8,11 @@ #include "../base/io_writer.h" #include "../base/property.h" + +#ifdef HAVE_GMIO +# include +#endif + #include namespace Mayo { @@ -29,5 +34,16 @@ class GmioFactoryWriter : public FactoryWriter { } }; +struct GmioLib { + static constexpr char strName[] = "gmio(build)"; + static constexpr char strVersion[] = +#ifdef HAVE_GMIO + GMIO_VERSION_STR +#else + "" +#endif + ; +}; + } // namespace IO } // namespace Mayo