3
0
mirror of https://github.com/triqs/dft_tools synced 2024-10-31 11:13:46 +01:00

Add tools to be able to find version and release

I added a version.hpp and updated the version.py so that
one can find the version of the library either from the
c++ or the python (if there is python support).

  modified:   CMakeLists.txt
  modified:   cmake/TRIQSConfig.cmake.in
  modified:   pytriqs/version.py.in
  modified:   triqs/CMakeLists.txt
  new file:   triqs/version.hpp.in
This commit is contained in:
Michel Ferrero 2013-08-29 11:41:19 +02:00
parent f58569dec5
commit 9c258fa7e1
5 changed files with 38 additions and 27 deletions

View File

@ -20,7 +20,8 @@
###################################################################################
#version number of the library
set (TRIQS_VERSION "1.0.0")
set (TRIQS_VERSION "1.0")
set (TRIQS_RELEASE "1.0.0")
# Path for local cmake modules
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

View File

@ -1,5 +1,6 @@
# version
set(TRIQS_VERSION @TRIQS_VERSION@)
set(TRIQS_RELEASE @TRIQS_RELEASE@)
set(TRIQS_GIT_HASH @TRIQS_GIT_HASH@)
# definitions

View File

@ -1,28 +1,26 @@
################################################################################
#
# TRIQS: a Toolbox for Research in Interacting Quantum Systems
#
# Copyright (C) 2011 by M. Ferrero, O. Parcollet
#
# TRIQS 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 3 of the License, or (at your option) any later
# version.
#
# TRIQS 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
# TRIQS. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
VersionNumber = "1.0"
# if we use a git clone, then tag with the hash, else just the plain number
git_hash = "@GIT_HASH@"
branch_info_all = [ b.strip() for b in """@GIT_BRANCHES@""".split('\n')]
try :
branch_info = [ b[1:].strip() for b in branch_info_all if b[0] == '*'][0]
except :
branch_info = ""
revision = "branch = %s; commit = %s"%(branch_info, git_hash if git_hash else VersionNumber)
def cmake_options() :
return open ("@CMAKE_BINARY_DIR@/CMakeCache.txt").read()
machine_info = """Code compiled on @myHostName@ under login @WhoAmI@ """
all_info = """
Code revision : %s
%s
For all the configuration options, use cmake_options()
"""%(revision,machine_info)
greeting = """ Code revision : %s """%(revision)
triqs_version = "@TRIQS_VERSION@"
triqs_release = "@TRIQS_RELEASE@"
def show_version():
print "\nYou are using the TRIQS library version %s, release %s\n"%(triqs_version, triqs_release)

View File

@ -24,6 +24,10 @@ target_link_libraries (triqs ${LINK_RT} ${TRIQS_LINK_LIBS} )
# Install library
install(TARGETS triqs DESTINATION lib)
# Version file
configure_file(version.hpp.in version.hpp @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/version.hpp" DESTINATION "include/triqs/")
# all .hpp files...
FILE(GLOB_RECURSE ALLHEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.hpp)

7
triqs/version.hpp.in Normal file
View File

@ -0,0 +1,7 @@
#ifndef TRIQS_VERSION_HPP
#define TRIQS_VERSION_HPP
#define TRIQS_VERSION "@TRIQS_VERSION@"
#define TRIQS_RELEASE "@TRIQS_RELEASE@"
#endif