diff --git a/qmake/qmake.pro b/qmake/qmake.pro index 641943a..4fe957d 100644 --- a/qmake/qmake.pro +++ b/qmake/qmake.pro @@ -40,6 +40,7 @@ DEFINES += _GNU_SOURCE DEBUG _FILE_OFFSET_BITS=64 _USE_MATH_DEFINES # Latest X-Plane APIs. No legacy support needed. DEFINES += XPLM200 XPLM210 +DEFINES += XRAAS2_BUILD_VERSION=\'\"$$system("git rev-parse --short HEAD")\"\' # Aircraft-specific defines DEFINES += ACF_TYPE=$$[ACF_TYPE] diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 621e0ef..6659d8b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -68,6 +68,14 @@ else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DAPL=0 -DIBM=0 -DLIN=1") endif() +# Yes, we need to strip a trailing newline from command output. CMake is +# "smart" like that... +execute_process(COMMAND git rev-parse --short HEAD + OUTPUT_VARIABLE XRAAS2_BUILD_VERSION) +string(REGEX REPLACE "\n$" "" XRAAS2_BUILD_VERSION "${XRAAS2_BUILD_VERSION}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \ + -DXRAAS2_BUILD_VERSION='\"${XRAAS2_BUILD_VERSION}\"'") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") #linking diff --git a/src/xraas2.h b/src/xraas2.h index 342a2c6..c88e4e7 100644 --- a/src/xraas2.h +++ b/src/xraas2.h @@ -30,7 +30,7 @@ extern "C" { #endif -#define XRAAS2_VERSION "2.1" +#define XRAAS2_VERSION "2.1-" XRAAS2_BUILD_VERSION #define TATL_FIELD_ELEV_UNSET -1000000 #define RWY_PROXIMITY_TIME_FACT 2 /* seconds */ #define ARPT_LOAD_LIMIT NM2MET(8) /* meters */