From 91f32a9fbae9c432fb9f19a465b9b8c8c3b15300 Mon Sep 17 00:00:00 2001 From: Luke Benstead Date: Thu, 8 Apr 2021 20:58:35 +0100 Subject: [PATCH] Refactor version file generation --- CMakeLists.txt | 9 +++++++++ GL/version.c.in | 2 ++ include/GL/glkos.h | 3 +++ 3 files changed, 14 insertions(+) create mode 100644 GL/version.c.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 41afb0f..241a723 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,8 +30,17 @@ set( GL/texture.c GL/util.c GL/yalloc/yalloc.c + ${CMAKE_CURRENT_BINARY_DIR}/version.c ) +execute_process( + COMMAND git describe --abbrev=4 --dirty --always --tags + OUTPUT_VARIABLE GLDC_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +configure_file(GL/version.c.in ${CMAKE_CURRENT_BINARY_DIR}/version.c) + if(PLATFORM_DREAMCAST) set(SOURCES ${SOURCES} GL/platforms/sh4.c) else() diff --git a/GL/version.c.in b/GL/version.c.in new file mode 100644 index 0000000..7e37b06 --- /dev/null +++ b/GL/version.c.in @@ -0,0 +1,2 @@ + +const char* GLDC_VERSION = "@GLDC_VERSION@"; diff --git a/include/GL/glkos.h b/include/GL/glkos.h index dd290bb..184ecaf 100644 --- a/include/GL/glkos.h +++ b/include/GL/glkos.h @@ -4,6 +4,9 @@ __BEGIN_DECLS +extern const char* GLDC_VERSION; + + /* * Dreamcast specific compressed + twiddled formats. * We use constants from the range 0xEEE0 onwards