Permalink
Browse files

Add version.h generated from git describe

  • Loading branch information...
JonnyH committed Sep 10, 2015
1 parent 967cc25 commit cc41d935d712221d442f131489d5e730dd274ae2
Showing with 24 additions and 2 deletions.
  1. +7 −0 CMakeLists.txt
  2. +8 −1 data/UI/MAINMENU.XML
  3. +3 −0 framework/main.cpp
  4. +3 −1 game/general/mainmenu.cpp
  5. +3 −0 version.h.in
View
@@ -125,6 +125,7 @@ INCLUDE_DIRECTORIES(SYSTEM ${TINYXML2_INCLUDE_DIR})
INCLUDE_DIRECTORIES(SYSTEM ${GLM_INCLUDE_DIR})
INCLUDE_DIRECTORIES(SYSTEM ${FRAMEWORK_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(.)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
foreach (TINYXML2_LIBRARY ${PC_TINYXML2_LIBRARIES})
find_library(TINYXML2_LIBRARY_PATH ${TINYXML2_LIBRARY} HINTS
@@ -171,5 +172,11 @@ add_custom_target(format clang-format -i ${FORMAT_SOURCES}
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CLANG_TIDY clang-tidy CACHE STRING "clang-tidy executable name in PATH")
find_package(Git)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --all --long
OUTPUT_VARIABLE OPENAPOC_VERSION_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE)
configure_file(version.h.in version.h)
add_custom_target(tidy ${CLANG_TIDY} ${FORMAT_SOURCES} -p ${CMAKE_BINARY_DIR}
DEPENDS ${FORMAT_SOURCES} ${CMAKE_BINARY_DIR}/compile_commands.json)
View
@@ -21,7 +21,7 @@
<alignment horizontal="centre" vertical="centre" />
<font>BIGFONT</font>
</label>
<label text="STR_DEBUGMODE">
<backcolour r="255" g="255" b="255" a="0" />
<position x="410" y="bottom" />
@@ -32,6 +32,13 @@
<checkbox id="CHECK_DEBUGMODE">
<position x="right" y="bottom" />
</checkbox>
<label text="STR_VERSION" id="VERSION_LABEL">
<backcolour r="255" g="255" b="255" a="0" />
<position x="0" y="0" />
<size width="200" height="16" />
<alignment horizontal="right" vertical="centre" />
<font>SMALLSET</font>
</label>
</graphic>
View
@@ -1,8 +1,11 @@
#include "framework/framework.h"
#include "version.h"
using namespace OpenApoc;
int main(int argc, char *argv[])
{
LogInfo("Starting OpenApoc \"%s\"", OPENAPOC_VERSION);
std::vector<UString> cmdline;
for (int i = 1; i < argc; i++)
{
@@ -1,4 +1,4 @@
#include "version.h"
#include "game/general/mainmenu.h"
#include "framework/framework.h"
#include "game/general/optionsmenu.h"
@@ -12,6 +12,8 @@ std::vector<UString> tracks{"music:0"};
MainMenu::MainMenu(Framework &fw) : Stage(fw)
{
mainmenuform = fw.gamecore->GetForm("FORM_MAINMENU");
auto versionLabel = mainmenuform->FindControlTyped<Label>("VERSION_LABEL");
versionLabel->SetText(OPENAPOC_VERSION);
}
MainMenu::~MainMenu() {}
View
@@ -0,0 +1,3 @@
#pragma once
#define OPENAPOC_VERSION "@OPENAPOC_VERSION_STRING@"

0 comments on commit cc41d93

Please sign in to comment.