15 #define GETTEXT_DOMAIN "wesnoth-lib"
25 #include <SDL_image.h>
26 #include <SDL_mixer.h>
30 #include <boost/version.hpp>
32 #include <pango/pangocairo.h>
43 struct version_table_manager
48 version_table_manager();
51 const version_table_manager versions;
56 return (
formatter() << a <<
'.' << b <<
'.' << c).str();
62 return (
formatter() <<
unsigned(v.major) <<
'.'
63 <<
unsigned(v.minor) <<
'.'
64 <<
unsigned(v.patch)).str();
67 version_table_manager::version_table_manager()
73 SDL_version sdl_version;
74 const SDL_version* sdl_rt_version =
nullptr;
81 SDL_VERSION(&sdl_version);
84 SDL_GetVersion(&sdl_version);
93 SDL_IMAGE_VERSION(&sdl_version);
96 sdl_rt_version = IMG_Linked_Version();
107 SDL_MIXER_VERSION(&sdl_version);
110 sdl_rt_version = Mix_Linked_Version();
121 SDL_TTF_VERSION(&sdl_version);
124 sdl_rt_version = TTF_Linked_Version();
169 features.push_back(
N_(
"feature^Experimental OpenMP support"));
174 features.push_back(
N_(
"feature^PNG screenshots"));
179 features.push_back(
N_(
"feature^Lua console completion"));
184 features.push_back(
N_(
"feature^Legacy bidirectional rendering"));
191 features.push_back(
N_(
"feature^D-Bus notifications back end"));
200 features.push_back(
N_(
"feature^Win32 notifications back end"));
206 features.push_back(
N_(
"feature^Cocoa notifications back end"));
207 #ifdef HAVE_NS_USER_NOTIFICATION
211 features.push_back(
N_(
"feature^Growl notifications back end"));
225 std::vector<optional_feature>
res = versions.features;
227 for(
size_t k = 0; k < res.size(); ++k) {
228 res[k].name =
_(res[k].
name.c_str());
236 return empty_version;
239 return versions.compiled[lib];
245 return empty_version;
248 return versions.linked[lib];
254 return empty_version;
257 return versions.names[lib];
264 return a.length() < b.length();
267 size_t max_strlen(
const std::vector<std::string>& strs)
269 const std::vector<std::string>::const_iterator it =
270 std::max_element(strs.begin(), strs.end(), strlen_comparator);
272 return it != strs.end() ? it->length() : 0;
279 std::ostringstream o;
281 const size_t col2_start = max_strlen(versions.names) + 2;
282 const size_t col3_start = max_strlen(versions.compiled) + 1;
296 const size_t pos2 = name.length() + 2;
297 if(pos2 < col2_start) {
303 if(!linked.empty()) {
304 const size_t pos3 = compiled.length() + 1;
305 if(pos3 < col3_start) {
308 o <<
" (runtime " << linked <<
")";
323 size_t col2_start = 0;
325 for(
size_t k = 0; k < features.size(); ++k)
327 col2_start = std::max(col2_start, features[k].
name.length() + 2);
330 std::ostringstream o;
332 for(
size_t k = 0; k < features.size(); ++k)
338 const size_t pos2 = f.
name.length() + 2;
339 if(pos2 < col2_start) {
343 o << (f.
enabled ?
"yes" :
"no") <<
'\n';
std::string library_versions_report()
Produce a plain-text report of library versions suitable for stdout/stderr.
std::string optional_features_report()
Produce a plain-text report of features suitable for stdout/stderr.
const std::string & library_build_version(LIBRARY_ID lib)
Retrieve the build-time version number of the given library.
GLdouble GLdouble GLdouble b
static UNUSEDNOWARN std::string _(const char *str)
const std::string & library_name(LIBRARY_ID lib)
Retrieve the user-visible name for the given library.
std::vector< optional_feature > optional_features_table()
Return a localized features table.
std::vector< optional_feature > features
GLboolean GLboolean GLboolean GLboolean a
GLuint const GLuint * names
std::vector< std::string > linked
Game configuration data as global variables.
std::vector< std::string > names
const std::string & library_runtime_version(LIBRARY_ID lib)
Retrieve the runtime version number of the given library.
std::string replace(std::string str, const std::string &src, const std::string &dst)
Replace all instances of src in str with dst.
GLuint const GLchar * name
std::vector< std::string > compiled
GLsizei const GLcharARB ** string