From 70586fa27b270f48e36b5f92f0acf803eb723e6a Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 17 Jul 2017 23:03:40 +0200 Subject: Cleanup: eliminate version from config.h The idea behind inkscape-version.h / inkscape-version.cpp is to avoid rebuilding most of the code base when the version number changes. Defining a version number in config.h defeats this purpose. --- CMakeScripts/inkscape-version.cmake | 2 +- config.h.cmake | 12 ------------ src/CMakeLists.txt | 5 ++++- src/extension/internal/latex-pstricks.cpp | 5 +++-- src/extension/internal/latex-text-renderer.cpp | 3 ++- src/inkscape-version.cpp.in | 2 +- src/menus-skeleton.h | 2 +- 7 files changed, 12 insertions(+), 19 deletions(-) diff --git a/CMakeScripts/inkscape-version.cmake b/CMakeScripts/inkscape-version.cmake index 2fae589d1..7d6533a72 100644 --- a/CMakeScripts/inkscape-version.cmake +++ b/CMakeScripts/inkscape-version.cmake @@ -33,5 +33,5 @@ endif() if(NOT "${INKSCAPE_BINARY_DIR}" STREQUAL "") message("revision is " ${INKSCAPE_REVISION}) - configure_file(${INKSCAPE_SOURCE_DIR}/src/inkscape-version.cpp.in ${INKSCAPE_BINARY_DIR}/src/inkscape-version.cpp) + configure_file(${INKSCAPE_BINARY_DIR}/src/inkscape-version.cpp.in ${INKSCAPE_BINARY_DIR}/src/inkscape-version.cpp) endif() diff --git a/config.h.cmake b/config.h.cmake index 134f7539d..a7ad4b355 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -6,9 +6,6 @@ #cmakedefine WIN32 #endif -/* This is for require-config.h */ -#define PACKAGE_TARNAME "${PROJECT_NAME} ${INKSCAPE_VERSION}" - /* Use binreloc thread support? */ #cmakedefine BR_PTHREADS 1 @@ -176,15 +173,6 @@ /* Define to the full name of this package. */ #define PACKAGE_NAME "${PROJECT_NAME}" -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "${PROJECT_NAME} ${INKSCAPE_VERSION}" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "${INKSCAPE_VERSION}" - -/* Define the version as a string. */ -#define VERSION "${INKSCAPE_VERSION}" - /* Build in dbus */ #cmakedefine WITH_DBUS 1 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d1fbc0f78..d10e4ec25 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -412,7 +412,10 @@ set(inkscape_SRC # Generate version file # ----------------------------------------------------------------------------- -# a custom command that is always built (as run_always.txt is never actually created) +# configure with values known at configure time +configure_file(inkscape-version.cpp.in ${CMAKE_BINARY_DIR}/src/inkscape-version.cpp.in @ONLY) + +# configure further at build time (always built as run_always.txt is never actually created) add_custom_command( OUTPUT inkscape-version.cpp run_always.txt COMMAND ${CMAKE_COMMAND} diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp index ae8f30a5c..018c56d82 100644 --- a/src/extension/internal/latex-pstricks.cpp +++ b/src/extension/internal/latex-pstricks.cpp @@ -25,6 +25,7 @@ #include "extension/print.h" #include "extension/system.h" +#include "inkscape-version.h" #include "io/sys.h" #include "latex-pstricks.h" #include "sp-item.h" @@ -121,8 +122,8 @@ unsigned int PrintLatex::begin (Inkscape::Extension::Print *mod, SPDocument *doc if (res >= 0) { - os << "%%Creator: " << PACKAGE_STRING << "\n"; - os << "%%Please note this file requires PSTricks extensions\n"; + os << "%%Creator: Inkscape " << Inkscape::version_string << "\n"; + os << "%%Please note this file requires PSTricks extensions\n"; os << "\\psset{xunit=.5pt,yunit=.5pt,runit=.5pt}\n"; // from now on we can output px, but they will be treated as pt diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index dec75aeb6..d1cf7e484 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -43,6 +43,7 @@ #include "extension/system.h" +#include "inkscape-version.h" #include "io/sys.h" #include "document.h" @@ -153,7 +154,7 @@ LaTeXTextRenderer::setTargetFile(gchar const *filename) { (void) signal(SIGPIPE, SIG_IGN); #endif - fprintf(_stream, "%%%% Creator: Inkscape %s, www.inkscape.org\n", PACKAGE_STRING); + fprintf(_stream, "%%%% Creator: Inkscape %s, www.inkscape.org\n", Inkscape::version_string); fprintf(_stream, "%%%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010\n"); fprintf(_stream, "%%%% Accompanies image file '%s' (pdf, eps, ps)\n", _filename); fprintf(_stream, "%%%%\n"); diff --git a/src/inkscape-version.cpp.in b/src/inkscape-version.cpp.in index 9056ddf8d..455a0fe99 100644 --- a/src/inkscape-version.cpp.in +++ b/src/inkscape-version.cpp.in @@ -3,5 +3,5 @@ #endif namespace Inkscape { - char const *version_string = VERSION " " "(${INKSCAPE_REVISION})"; + char const *version_string = "@INKSCAPE_VERSION@" " " "(${INKSCAPE_REVISION})"; } diff --git a/src/menus-skeleton.h b/src/menus-skeleton.h index e5991aa1d..ca337e6a7 100644 --- a/src/menus-skeleton.h +++ b/src/menus-skeleton.h @@ -11,7 +11,7 @@ #endif static char const menus_skeleton[] = -"\n" "\n" -- cgit v1.2.3