dump library versions also, when using wesnoth -v

This commit is contained in:
Chris Beck 2014-10-20 19:13:27 -04:00
parent b5b97bb574
commit aa0ec207e3
9 changed files with 121 additions and 4 deletions

View file

@ -320,6 +320,11 @@ private:
namespace font {
std::string describe_versions()
{
return std::string("Cairo version: ") + cairo_version_string() + "\nPango version: " + pango_version_string() + "\n";
}
manager::manager()
{
const int res = TTF_Init();
@ -349,8 +354,7 @@ void manager::update_font_path() const
void manager::init() const
{
LOG_FT << "Cairo version: " << cairo_version_string() << std::endl;
LOG_FT << "Pango version: " << pango_version_string() << std::endl;
LOG_FT << describe_versions() << std::endl;
#ifdef CAIRO_HAS_FT_FONT
if (!FcConfigAppFontAddDir(FcConfigGetCurrent(),

View file

@ -25,6 +25,8 @@ class t_string;
namespace font {
std::string describe_versions();
//object which initializes and destroys structures needed for fonts
struct manager {
manager();

View file

@ -1190,5 +1190,30 @@ bool precached_file_exists(const std::string& file)
return false;
}
std::string describe_versions()
{
std::stringstream ss;
#ifdef SDL_IMAGE_VERSION
SDL_version compile_version;
SDL_IMAGE_VERSION(&compile_version);
ss << "Compiled with SDL_image version: "
<< static_cast<int> (compile_version.major) << "."
<< static_cast<int> (compile_version.minor) << "."
<< static_cast<int> (compile_version.patch) << " \n";
#endif
#ifdef Image_Linked_Version
const SDL_version *link_version=Image_Linked_Version();
ss << "Running with SDL_image version: "
<< static_cast<int> (link_version->major) << "."
<< static_cast<int> (link_version->minor) << "."
<< static_cast<int> (link_version->patch) << " .\n";
#endif
return ss.str();
}
} // end namespace image

View file

@ -247,6 +247,8 @@ namespace image {
/// precache the existence of files in the subdir (ex: "terrain/")
void precache_file_existence(const std::string& subdir = "");
bool precached_file_exists(const std::string& file);
std::string describe_versions();
}
#endif

View file

@ -36,6 +36,7 @@
#include <set>
#include <cstring>
#include <stdexcept>
#include <sstream>
#include <boost/exception/get_error_info.hpp>
#include <boost/exception/info.hpp>
@ -1202,4 +1203,29 @@ statistics get_receive_stats(connection handle)
return result;
}
std::string describe_versions()
{
std::stringstream ss;
#ifdef SDL_NET_VERSION
SDL_version compile_version;
SDL_NET_VERSION(&compile_version);
ss << "Compiled with SDL_net version: "
<< static_cast<int> (compile_version.major) << "."
<< static_cast<int> (compile_version.minor) << "."
<< static_cast<int> (compile_version.patch) << " \n";
#endif
#ifdef Net_Linked_Version
const SDL_version *link_version=Net_Linked_Version();
ss << "Running with SDL_net version: "
<< static_cast<int> (link_version->major) << "."
<< static_cast<int> (link_version->minor) << "."
<< static_cast<int> (link_version->patch) << " .\n";
#endif
return ss.str();
}
} // end namespace network

View file

@ -304,6 +304,8 @@ statistics get_receive_stats(connection handle);
extern unsigned int ping_timeout;
/** Minimum interval between pings. */
const int ping_interval = 30;
std::string describe_versions();
} // network namespace

View file

@ -29,6 +29,8 @@
#include <boost/foreach.hpp>
#include <list>
#include <string>
#include <sstream>
static lg::log_domain log_audio("audio");
#define DBG_AUDIO LOG_STREAM(debug, log_audio)
@ -890,4 +892,29 @@ void set_UI_volume(int vol)
}
}
std::string describe_versions()
{
std::stringstream ss;
#ifdef SDL_MIXER_VERSION
SDL_version compile_version;
SDL_MIXER_VERSION(&compile_version);
ss << "Compiled with SDL_mixer version: "
<< static_cast<int> (compile_version.major) << "."
<< static_cast<int> (compile_version.minor) << "."
<< static_cast<int> (compile_version.patch) << " \n";
#endif
#ifdef Mix_Linked_Version
const SDL_version *link_version=Mix_Linked_Version();
ss << "Running with SDL_mixer version: "
<< static_cast<int> (link_version->major) << "."
<< static_cast<int> (link_version->minor) << "."
<< static_cast<int> (link_version->patch) << " .\n";
#endif
return ss.str();
}
} // end of sound namespace

View file

@ -22,6 +22,8 @@ class config;
namespace sound {
std::string describe_versions();
enum channel_group {
NULL_CHANNEL = -1,
SOUND_SOURCES = 0,

View file

@ -36,6 +36,7 @@
#include "image.hpp" // for flush_cache, etc
#include "loadscreen.hpp" // for loadscreen, etc
#include "log.hpp" // for LOG_STREAM, general, logger, etc
#include "network.hpp" // for describe_versions
#include "preferences.hpp" // for core_id, etc
#include "preferences_display.hpp" // for display_manager
#include "replay.hpp" // for recorder, replay
@ -83,7 +84,6 @@
#include "SDL_events.h" // for SDL_EventState, etc
#include "SDL_stdinc.h" // for SDL_putenv, Uint32
#include "SDL_timer.h" // for SDL_GetTicks
#include "SDL_version.h" // for SDL_VERSION_ATLEAST
#ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
#include "gui/widgets/debug.hpp"
@ -303,6 +303,27 @@ static void handle_preprocess_command(const commandline_options& cmdline_opts)
std::cerr << "preprocessing finished. Took "<< SDL_GetTicks() - startTime << " ticks.\n";
}
static std::string describe_SDL_versions()
{
SDL_version compiled;
#ifdef SDL_VERSION
SDL_VERSION(&compiled);
std::stringstream ss;
ss << "Compiled with SDL version "
<< static_cast<int> (compiled.major) << "." << static_cast<int> (compiled.minor) << "." << static_cast<int> (compiled.patch) << " \n";
#endif
#ifdef SDL_GetVersion
SDL_version linked;
SDL_GetVersion(&linked);
ss << "Linked with SDL version "
<< static_cast<int> (linked.major) << "." << static_cast<int> (linked.minor) << "." << static_cast<int> (linked.patch) << " .\n";
#endif
return ss.str();
}
/** Process commandline-arguments */
static int process_command_args(const commandline_options& cmdline_opts) {
@ -422,7 +443,13 @@ static int process_command_args(const commandline_options& cmdline_opts) {
strict_validation_enabled = true;
}
if(cmdline_opts.version) {
std::cout << "Battle for Wesnoth" << " " << game_config::version << "\n";
std::cout << "Battle for Wesnoth" << " " << game_config::version << "\n\n";
std::cout << "Boost version: " << BOOST_LIB_VERSION << "\n";
std::cout << font::describe_versions();
std::cout << describe_SDL_versions();
std::cout << sound::describe_versions();
std::cout << network::describe_versions();
std::cout << image::describe_versions();
return 0;
}