Write Hyperion version into default config on compiling.

This commit is contained in:
Paulchen Panther 2021-05-07 21:05:13 +02:00
parent da60a07b98
commit a52965d6ed
2 changed files with 9 additions and 4 deletions

View File

@ -4,10 +4,15 @@ message( STATUS "CMake Version: ${CMAKE_VERSION}" )
PROJECT(hyperion)
# Parse semantic version of version file
# Parse semantic version of version file and write version to config
include (${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.cmake)
file (STRINGS "version" HYPERION_VERSION)
SetVersionNumber(HYPERION ${HYPERION_VERSION})
set(DEFAULT_JSON_CONFIG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/config/hyperion.config.json.default)
file(READ ${DEFAULT_JSON_CONFIG_FILE} DEFAULT_JSON_CONFIG_VAR)
string(REPLACE "configVersionValue" ${HYPERION_VERSION} DEFAULT_JSON_CONFIG_VAR "${DEFAULT_JSON_CONFIG_VAR}")
string(REPLACE "previousVersionValue" ${HYPERION_VERSION} DEFAULT_JSON_CONFIG_VAR "${DEFAULT_JSON_CONFIG_VAR}")
file(WRITE ${DEFAULT_JSON_CONFIG_FILE} "${DEFAULT_JSON_CONFIG_VAR}")
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)

View File

@ -2,8 +2,8 @@
"general" :
{
"name" : "My Hyperion Config",
"configVersion": "2.0.0-alpha.9",
"previousVersion": "2.0.0-alpha.9",
"configVersion": "configVersionValue",
"previousVersion": "previousVersionValue",
"watchedVersionBranch" : "Stable",
"showOptHelp" : true
},
@ -96,7 +96,7 @@
"framegrabber" :
{
"device" : "auto",
"input" : 0,
"input" : 0,
"width" : 80,
"height" : 45,
"fps" : 10,