Commit 01e902e4 authored by Pino Toscano's avatar Pino Toscano

[cpp] add a version header+functions

this way, it is possible to get (either at build time and at runtime)
the version of the current poppler-cpp library

poppler-config.h is generated by the build system (autotools or cmake)
with the correct version information
parent 9d0cf201
......@@ -547,6 +547,7 @@ AC_SUBST(PC_REQUIRES_PRIVATE)
AC_SUBST([POPPLER_MAJOR_VERSION],[poppler_version_major])
AC_SUBST([POPPLER_MINOR_VERSION],[poppler_version_minor])
AC_SUBST([POPPLER_MICRO_VERSION],[poppler_version_micro])
AC_SUBST([POPPLER_VERSION],[poppler_version])
AC_OUTPUT([
Makefile
......@@ -566,6 +567,7 @@ qt4/src/Makefile
qt4/tests/Makefile
qt4/demos/Makefile
cpp/Makefile
cpp/poppler-version.h
poppler.pc
poppler-cairo.pc
poppler-splash.pc
......
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
configure_file(poppler-version.h.in ${CMAKE_CURRENT_BINARY_DIR}/poppler-version.h @ONLY)
set(poppler_cpp_SRCS
poppler-document.cpp
poppler-embedded-file.cpp
......@@ -11,6 +14,7 @@ set(poppler_cpp_SRCS
poppler-page-transition.cpp
poppler-private.cpp
poppler-toc.cpp
poppler-version.cpp
)
add_library(poppler-cpp SHARED ${poppler_cpp_SRCS})
......@@ -30,5 +34,6 @@ install(FILES
poppler-page-transition.h
poppler-rectangle.h
poppler-toc.h
${CMAKE_CURRENT_BINARY_DIR}/poppler-version.h
DESTINATION include/poppler/cpp)
......@@ -13,7 +13,8 @@ poppler_include_HEADERS = \
poppler-page.h \
poppler-page-transition.h \
poppler-rectangle.h \
poppler-toc.h
poppler-toc.h \
poppler-version.h
lib_LTLIBRARIES = libpoppler-cpp.la
libpoppler_cpp_la_SOURCES = \
......@@ -24,7 +25,8 @@ libpoppler_cpp_la_SOURCES = \
poppler-page.cpp \
poppler-page-transition.cpp \
poppler-private.cpp \
poppler-toc.cpp
poppler-toc.cpp \
poppler-version.cpp
libpoppler_cpp_la_LIBADD = \
$(top_builddir)/poppler/libpoppler.la
......
/*
* Copyright (C) 2009, Pino Toscano <pino@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "poppler-version.h"
using namespace poppler;
std::string version_string()
{
return std::string(POPPLER_VERSION);
}
unsigned int version_major()
{
return POPPLER_VERSION_MAJOR;
}
unsigned int version_minor()
{
return POPPLER_VERSION_MINOR;
}
unsigned int version_micro()
{
return POPPLER_VERSION_MICRO;
}
/*
* Copyright (C) 2009, Pino Toscano <pino@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef POPPLER_VERSION_H
#define POPPLER_VERSION_H
#include "poppler-global.h"
#define POPPLER_VERSION "@POPPLER_VERSION@"
#define POPPLER_VERSION_MAJOR @POPPLER_MAJOR_VERSION@
#define POPPLER_VERSION_MINOR @POPPLER_MINOR_VERSION@
#define POPPLER_VERSION_MICRO @POPPLER_MICRO_VERSION@
namespace poppler
{
POPPLER_CPP_EXPORT std::string version_string();
POPPLER_CPP_EXPORT unsigned int version_major();
POPPLER_CPP_EXPORT unsigned int version_minor();
POPPLER_CPP_EXPORT unsigned int version_micro();
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment