Skip to content
Snippets Groups Projects
Commit 051b3a1d authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Fixed git revision infos

parent 8cd08950
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,6 @@ include_directories(${CMAKE_SOURCE_DIR}/packages/CLI11/include)
add_subdirectory(${CMAKE_SOURCE_DIR}/packages/kokkos)
include_directories(${Kokkos_INCLUDE_DIRS_RET})
# Pastis utils
add_subdirectory(utils)
include_directories(utils)
......
......@@ -8,14 +8,28 @@ git_describe(PASTIS_VERSION "--abbrev=0")
get_git_head_revision(PASTIS_HEAD PASTIS_HASH)
git_local_changes(PASTIS_HAS_LOCAL_CHANGES)
set(PASTIS_IS_CLEAN ${PASTIS_HAS_LOCAL_CHANGES} STREQ "CLEAN")
if(${PASTIS_HAS_LOCAL_CHANGES} STREQUAL "CLEAN")
set(PASTIS_IS_CLEAN true)
else()
set(PASTIS_IS_CLEAN false)
endif()
add_custom_target(git_revision ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pastis_git_revision.hpp)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/pastis_git_revision.hpp PROPERTIES GENERATED TRUE HEADER_FILE_ONLY TRUE)
add_custom_target(
git_revision
ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pastis_git_revision.hpp)
set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/pastis_git_revision.hpp
PROPERTIES
GENERATED TRUE
HEADER_FILE_ONLY TRUE
)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pastis_git_revision.hpp.in" "${CMAKE_CURRENT_BINARY_DIR}/pastis_git_revision.hpp" @ONLY)
list(APPEND SOURCES pastis_git_revision.hpp)
list(APPEND SOURCES ${CMAKE_CURRENT_BINARY_DIR}/pastis_git_revision.hpp)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_library(PastisUtils RevisionInfo.cpp)
add_dependencies(PastisUtils git_revision)
......@@ -3,24 +3,20 @@
std::string RevisionInfo::version()
{
return PASTIS_VERSION;
return PASTIS_GIT_VERSION;
}
std::string RevisionInfo::head()
{
return PASTIS_HEAD;
return PASTIS_GIT_HEAD;
}
std::string RevisionInfo::hash()
{
return PASTIS_HASH;
return PASTIS_GIT_HASH;
}
bool RevisionInfo::isClean()
{
#if PASTIS_IS_CLEAN
return true;
#else
return false;
#endif
return PASTIS_GIT_IS_CLEAN;
}
#ifndef GIT_REVISION_HPP
#define GIT_REVISION_HPP
#ifndef PASTIS_GIT_REVISION_HPP
#define PASTIS_GIT_REVISION_HPP
#define PASTIS_VERSION "@PASTIS_VERSION@"
#define PASTIS_HEAD "@PASTIS_HEAD@"
#define PASTIS_HASH "@PASTIS_HASH@"
#define PASTIS_HAS_LOCAL_CHANGES "@PASTIS_HAS_LOCAL_CHANGES@"
#define PASTIS_GIT_VERSION "@PASTIS_VERSION@"
#define PASTIS_GIT_HEAD "@PASTIS_HEAD@"
#define PASTIS_GIT_HASH "@PASTIS_HASH@"
#define PASTIS_GIT_HAS_LOCAL_CHANGES "@PASTIS_HAS_LOCAL_CHANGES@"
#define PASTIS_GIT_IS_CLEAN @PASTIS_IS_CLEAN@
#endif // GIT_REVISION_HPP
#endif // PASTIS_GIT_REVISION_HPP
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment