void cmdAbout(const std::string& args) { // TODO: replace this with a GUI window narf::console->println(""); narf::console->println("About NarfBlock"); narf::console->println("Version: " VERSION_STR); narf::console->println(""); narf::console->println("Authors:"); auto authors = narf::util::tokenize(VERSION_AUTHORS, '\n'); for (auto& a : authors) { narf::console->println(a); } narf::console->println(""); auto credits = narf::util::tokenize(EMBED_STRING(extra_credits_txt), '\n'); for (auto& c : credits) { narf::console->println(c); } narf::console->println(""); narf::console->println("Library versions:"); narf::console->println("ENet " + std::to_string(ENET_VERSION_MAJOR) + "." + std::to_string(ENET_VERSION_MINOR) + "." + std::to_string(ENET_VERSION_PATCH)); SDL_version sdl; SDL_GetVersion(&sdl); narf::console->println("SDL " + std::to_string(sdl.major) + "." + std::to_string(sdl.minor) + "." + std::to_string(sdl.patch)); narf::console->println("zlib " + std::string(zlibVersion())); auto png = png_access_version_number(); auto pngMajor = png / 10000; auto pngMinor = (png / 100) % 100; auto pngRelease = png % 100; narf::console->println("libpng " + std::to_string(pngMajor) + "." + std::to_string(pngMinor) + "." + std::to_string(pngRelease)); FT_Library ftlib; FT_Init_FreeType(&ftlib); FT_Int ftMajor, ftMinor, ftPatch; FT_Library_Version(ftlib, &ftMajor, &ftMinor, &ftPatch); FT_Done_FreeType(ftlib); narf::console->println("FreeType " + std::to_string(ftMajor) + "." + std::to_string(ftMinor) + "." + std::to_string(ftPatch)); narf::console->println(opus_get_version_string()); narf::console->println(""); narf::console->println("OpenGL information:"); narf::console->println("OpenGL version " + std::string(display->glVersion)); narf::console->println("GLSL version " + std::string(display->glslVersion)); narf::console->println("GL context version " + std::to_string(display->glContextVersionMajor) + "." + std::to_string(display->glContextVersionMinor)); }
int main() { png_uint_32 png_version; char png_version_string[16]; png_version = png_access_version_number (); snprintf (png_version_string, 16, "%i.%i.%i", png_version / 10000, (png_version % 10000) / 100, png_version % 100); assert (strcmp(png_version_string, CMAKE_EXPECTED_PNG_VERSION) == 0); return 0; }
#include <mbgl/util/image.hpp> #include <mbgl/util/string.hpp> #include <png.h> #include <cassert> #include <cstdlib> #include <stdexcept> #include <cstring> #include <mbgl/platform/default/image_reader.hpp> // Check png library version. const static bool png_version_check = []() { const png_uint_32 version = png_access_version_number(); if (version != PNG_LIBPNG_VER) { throw std::runtime_error(mbgl::util::sprintf<96>( "libpng version mismatch: headers report %d.%d.%d, but library reports %d.%d.%d", PNG_LIBPNG_VER / 10000, (PNG_LIBPNG_VER / 100) % 100, PNG_LIBPNG_VER % 100, version / 10000, (version / 100) % 100, version % 100)); } return true; }(); namespace mbgl { namespace util { std::string compress_png(int width, int height, void *rgba) { png_voidp error_ptr = 0; png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, error_ptr, NULL, NULL);
int main(void) { printf("Version %d\n", png_access_version_number()); return 0; }
TEST(Versions, PngStatic) { ASSERT_EQ(10512, png_access_version_number()); ASSERT_STREQ("1.5.12", PNG_LIBPNG_VER_STRING); }
TEST(Versions, Png) { ASSERT_EQ(PNG_LIBPNG_VER_MAJOR * 10000 + PNG_LIBPNG_VER_MINOR * 100 + PNG_LIBPNG_VER_RELEASE, png_access_version_number()); }