Dragonblocks
world.sqlite
DragonblocksAlpha-*.zip
+src/version.h
sqlite3
)
-execute_process(COMMAND git tag --points-at HEAD
- OUTPUT_VARIABLE GIT_VERSION
- OUTPUT_STRIP_TRAILING_WHITESPACE
+add_custom_target(version
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/version.cmake
)
-if ("${GIT_VERSION}" STREQUAL "")
- execute_process(COMMAND git rev-parse --short HEAD
- OUTPUT_VARIABLE GIT_VERSION
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-endif()
-
-add_compile_definitions(DRAGONBLOCKS_VERSION="${GIT_VERSION}")
+add_dependencies(Dragonblocks version)
+add_dependencies(DragonblocksServer version)
if (CMAKE_BUILD_TYPE STREQUAL "Release")
add_compile_definitions(RELEASE)
#include "client/debug_menu.h"
#include "client/hud.h"
#include "client/window.h"
+#include "version.h"
typedef enum
{
void debug_menu_update_version()
{
- hud_change_text(huds[DME_VERSION], "Dragonblocks Alpha " DRAGONBLOCKS_VERSION);
+ char text[BUFSIZ];
+ sprintf(text, "Dragonblocks Alpha %s", VERSION);
+ hud_change_text(huds[DME_VERSION], text);
}
void debug_menu_update_fps(int fps)
handle SIGTERM nostop print pass
handle SIGPIPE nostop noprint pass
set height 0
+set \$_exitcode 1
define hook-stop
if \$_exitcode == 0
quit
--- /dev/null
+execute_process(COMMAND git tag --points-at HEAD
+ OUTPUT_VARIABLE GIT_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+if ("${GIT_VERSION}" STREQUAL "")
+ execute_process(COMMAND git rev-parse --short HEAD
+ OUTPUT_VARIABLE GIT_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+endif()
+
+set(VERSION_DEF "const char *version = \"${GIT_VERSION}\";")
+
+configure_file(
+ ${CMAKE_SOURCE_DIR}/version.h.in
+ ${CMAKE_SOURCE_DIR}/version.h
+)
--- /dev/null
+#define VERSION "@GIT_VERSION@"