From 1745fa1108ec2939c397a07515f4c3315d02aef5 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Fri, 2 Jan 2015 12:15:02 +0100 Subject: [PATCH] Add a revision.h header file that exports git branch and revision for compile time usage in user projects --- doc/news/changes.h | 9 ++++++++ include/CMakeLists.txt | 8 +++++-- include/deal.II/base/revision.h.in | 34 ++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 include/deal.II/base/revision.h.in diff --git a/doc/news/changes.h b/doc/news/changes.h index 88d59451c1..72a17ca31b 100644 --- a/doc/news/changes.h +++ b/doc/news/changes.h @@ -56,6 +56,15 @@ inconvenience this causes.
    +
  1. New: The build system now queries for git branch name and + revision sha1 (and automatically reconfigures if necessary). This + information is used to annotate summary.log and detailed.log with the + current revision sha1. Further, a header file + is now available that exports the macros: DEAL_II_GIT_BRANCH, + DEAL_II_GIT_REVISION, DEAL_II_GIT_REVISION_SHORT. +
    + (Matthias Maier, 2015/01/02) +
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 88f15474cb..436e048d7c 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1,6 +1,6 @@ ## --------------------------------------------------------------------- ## -## Copyright (C) 2012 - 2013, 2015 by the deal.II authors +## Copyright (C) 2012 - 2015 by the deal.II authors ## ## This file is part of the deal.II library. ## @@ -14,12 +14,16 @@ ## --------------------------------------------------------------------- # -# Configure config.h +# Configure config.h and revision.h # CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/deal.II/base/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/deal.II/base/config.h ) +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/deal.II/base/revision.h.in + ${CMAKE_CURRENT_BINARY_DIR}/deal.II/base/revision.h + ) # # Add a rule for how to install the header files: diff --git a/include/deal.II/base/revision.h.in b/include/deal.II/base/revision.h.in new file mode 100644 index 0000000000..72104d8e34 --- /dev/null +++ b/include/deal.II/base/revision.h.in @@ -0,0 +1,34 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2014 - 2015 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +#ifndef __deal2__revision_h +#define __deal2__revision_h + +/** + * Name of the local git branch of the source directory. + */ +#define DEAL_II_GIT_BRANCH @DEAL_II_GIT_BRANCH@ + +/** + * Full sha1 revision of the current git HEAD. + */ +#define DEAL_II_GIT_REVISION @DEAL_II_GIT_REVISION@ + +/** + * Short sha1 revision of the current git HEAD. + */ +#define DEAL_II_GIT_SHORTREV @DEAL_II_GIT_SHORTREV@ + +#endif -- 2.39.5