From d0beb27197c529d849caaa4971a421ca6890dec7 Mon Sep 17 00:00:00 2001 From: Vadim Markovtsev Date: Sun, 23 Oct 2016 15:45:47 +0200 Subject: [PATCH] Add git commit hash into the version string --- AI/BattleAI/CMakeLists.txt | 4 ++++ AI/EmptyAI/CMakeLists.txt | 4 ++++ AI/StupidAI/CMakeLists.txt | 8 ++++++-- AI/VCAI/CMakeLists.txt | 4 ++++ CMakeLists.txt | 1 - client/CMakeLists.txt | 4 ++++ lib/CMakeLists.txt | 4 ++++ lib/GameConstants.h | 2 +- lib/VCMI_Lib.cpp | 6 +++--- server/CMakeLists.txt | 4 ++++ test/CMakeLists.txt | 4 ++++ 11 files changed, 38 insertions(+), 7 deletions(-) diff --git a/AI/BattleAI/CMakeLists.txt b/AI/BattleAI/CMakeLists.txt index 225218b4c..4a740a919 100644 --- a/AI/BattleAI/CMakeLists.txt +++ b/AI/BattleAI/CMakeLists.txt @@ -1,6 +1,10 @@ project(battleAI) cmake_minimum_required(VERSION 2.6) +include(GetGitRevisionDescription) +get_git_head_revision(GIT_REFSPEC GIT_SHA1) +add_definitions(-DGIT_SHA1="${GIT_SHA1}") + include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib) set(battleAI_SRCS diff --git a/AI/EmptyAI/CMakeLists.txt b/AI/EmptyAI/CMakeLists.txt index 506e0d8e8..3fa51df94 100644 --- a/AI/EmptyAI/CMakeLists.txt +++ b/AI/EmptyAI/CMakeLists.txt @@ -1,6 +1,10 @@ project(emptyAI) cmake_minimum_required(VERSION 2.6) +include(GetGitRevisionDescription) +get_git_head_revision(GIT_REFSPEC GIT_SHA1) +add_definitions(-DGIT_SHA1="${GIT_SHA1}") + include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib) set(emptyAI_SRCS diff --git a/AI/StupidAI/CMakeLists.txt b/AI/StupidAI/CMakeLists.txt index 4f82e9752..d7de8bc48 100644 --- a/AI/StupidAI/CMakeLists.txt +++ b/AI/StupidAI/CMakeLists.txt @@ -1,12 +1,16 @@ project(stupidAI) cmake_minimum_required(VERSION 2.6) +include(GetGitRevisionDescription) +get_git_head_revision(GIT_REFSPEC GIT_SHA1) +add_definitions(-DGIT_SHA1="${GIT_SHA1}") + include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib) set(stupidAI_SRCS StdInc.cpp - StupidAI.cpp - main.cpp + StupidAI.cpp + main.cpp ) add_library(StupidAI SHARED ${stupidAI_SRCS}) diff --git a/AI/VCAI/CMakeLists.txt b/AI/VCAI/CMakeLists.txt index 905df8132..8ec5380c9 100644 --- a/AI/VCAI/CMakeLists.txt +++ b/AI/VCAI/CMakeLists.txt @@ -1,6 +1,10 @@ project(VCAI) cmake_minimum_required(VERSION 2.6) +include(GetGitRevisionDescription) +get_git_head_revision(GIT_REFSPEC GIT_SHA1) +add_definitions(-DGIT_SHA1="${GIT_SHA1}") + if (FL_FOUND) include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib ${FL_INCLUDE_DIRS}) else() diff --git a/CMakeLists.txt b/CMakeLists.txt index 22f42a3c1..83c13fb0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -341,4 +341,3 @@ else() endif() INCLUDE(CPack) - diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 45989848e..aae76bbfd 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -1,6 +1,10 @@ project(vcmiclient) cmake_minimum_required(VERSION 2.6) +include(GetGitRevisionDescription) +get_git_head_revision(GIT_REFSPEC GIT_SHA1) +add_definitions(-DGIT_SHA1="${GIT_SHA1}") + include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib) include_directories(${SDL_INCLUDE_DIR} ${SDLIMAGE_INCLUDE_DIR} ${SDLMIXER_INCLUDE_DIR} ${SDLTTF_INCLUDE_DIR}) include_directories(${Boost_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS}) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 9027da727..7c013a406 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,6 +1,10 @@ project(libvcmi) cmake_minimum_required(VERSION 2.6) +include(GetGitRevisionDescription) +get_git_head_revision(GIT_REFSPEC GIT_SHA1) +add_definitions(-DGIT_SHA1="${GIT_SHA1}") + include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/lib) include_directories(${Boost_INCLUDE_DIRS} ${SDL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}) diff --git a/lib/GameConstants.h b/lib/GameConstants.h index 10317059d..6e22376a7 100644 --- a/lib/GameConstants.h +++ b/lib/GameConstants.h @@ -14,7 +14,7 @@ namespace GameConstants { - const std::string VCMI_VERSION = "VCMI 0.98h"; + const std::string VCMI_VERSION = "VCMI 0.98h " GIT_SHA1; const int BFIELD_WIDTH = 17; const int BFIELD_HEIGHT = 11; diff --git a/lib/VCMI_Lib.cpp b/lib/VCMI_Lib.cpp index 3d3baaafe..ad965c54f 100644 --- a/lib/VCMI_Lib.cpp +++ b/lib/VCMI_Lib.cpp @@ -63,17 +63,17 @@ void LibClasses::loadFilesystem() CStopWatch loadTime; CResourceHandler::initialize(); - logGlobal->infoStream()<<"\t Initialization: "<infoStream()<<"\tInitialization: "<infoStream()<<"\t Data loading: "<infoStream()<<"\tData loading: "<infoStream()<<"\tMod handler: "<loadMods(); modh->loadModFilesystems(); - logGlobal->infoStream()<<"\t Mod filesystems: "<infoStream()<<"\tMod filesystems: "<infoStream()<<"Basic initialization: "<