Skip to content

Commit

Permalink
[cmake] Fix application info in generated files
Browse files Browse the repository at this point in the history
  • Loading branch information
krivenko committed Feb 18, 2022
1 parent cd3447a commit 163ab34
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
13 changes: 6 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# Version number of the application
set(POMEROL2TRIQS_VERSION "0.7")

# Start configuration
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
cmake_policy(VERSION 3.8)
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
project(pomerol2triqs CXX)

project(pomerol2triqs VERSION 0.7 LANGUAGES CXX)

# We use shared libraries
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
Expand Down Expand Up @@ -46,9 +44,10 @@ message(STATUS "Found pomerol ${pomerol_VERSION}")
# Find MPI
find_package(MPI)

# Get git hash
triqs_get_git_hash_of_source_dir(POMEROL2TRIQS_GIT_HASH)
message(STATUS "Git hash: ${POMEROL2TRIQS_GIT_HASH}")
# Get the git hash & print status
triqs_get_git_hash_of_source_dir(PROJECT_GIT_HASH)
message(STATUS "${PROJECT_NAME} version : ${PROJECT_VERSION}")
message(STATUS "${PROJECT_NAME} Git hash: ${PROJECT_GIT_HASH}")

option(Tests "Enable Tests" ON)

Expand Down
4 changes: 2 additions & 2 deletions c++/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ add_library(pomerol2triqs_c pomerol_ed.cpp g.cpp g2.cpp chi.cpp)

target_link_libraries(pomerol2triqs_c PUBLIC triqs pomerol::pomerol)
target_compile_options(pomerol2triqs_c PRIVATE
-DPOMEROL2TRIQS_GIT_HASH=${POMEROL2TRIQS_GIT_HASH}
-DPOMEROL2TRIQS_GIT_HASH=${POMEROL2TRIQS_GIT_HASH}
-DPROJECT_GIT_HASH=${PROJECT_GIT_HASH}
-DTRIQS_GIT_HASH=${TRIQS_GIT_HASH}
)

install(TARGETS pomerol2triqs_c DESTINATION lib EXPORT pomerol2triqs-targets)
Expand Down
8 changes: 4 additions & 4 deletions python/version.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
#
################################################################################

version = "@POMEROL2TRIQS_VERSION@"
version = "@PROJECT_VERSION@"
triqs_hash = "@TRIQS_GIT_HASH@"
pomerol2triqs_hash = "@POMEROL2TRIQS_GIT_HASH@"
@PROJECT_NAME@_hash = "@PROJECT_GIT_HASH@"

def show_version():
print "\nYou are using the pomerol2triqs solver version %s\n" % version
print("\nYou are using @PROJECT_NAME@ version %s\n"%version)

def show_git_hash():
print "\nYou are using the pomerol2triqs solver git hash %s based on triqs git hash %s\n"%(pomerol2triqs_hash, triqs_hash)
print("\nYou are using @PROJECT_NAME@ git hash %s based on triqs git hash %s\n"%("@PROJECT_GIT_HASH@", triqs_hash))

0 comments on commit 163ab34

Please sign in to comment.