mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-12 02:40:00 +01:00
Reading version from git
This commit is contained in:
@@ -2,6 +2,28 @@
|
|||||||
cmake_minimum_required(VERSION 3.8.0)
|
cmake_minimum_required(VERSION 3.8.0)
|
||||||
project(vimix VERSION 0.0.1 LANGUAGES CXX C)
|
project(vimix VERSION 0.0.1 LANGUAGES CXX C)
|
||||||
|
|
||||||
|
# use git
|
||||||
|
find_package (Git)
|
||||||
|
if(GIT_EXECUTABLE)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${GIT_EXECUTABLE} describe --tags
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE GIT_DESCRIBE_VERSION
|
||||||
|
RESULT_VARIABLE GIT_DESCRIBE_ERROR_CODE
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
if(NOT GIT_DESCRIBE_ERROR_CODE)
|
||||||
|
string(SUBSTRING ${GIT_DESCRIBE_VERSION} 0 1 VIMIX_VERSION_MAJOR)
|
||||||
|
string(SUBSTRING ${GIT_DESCRIBE_VERSION} 2 1 VIMIX_VERSION_MINOR)
|
||||||
|
string(SUBSTRING ${GIT_DESCRIBE_VERSION} 4 1 VIMIX_VERSION_PATCH)
|
||||||
|
add_definitions(-DVIMIX_VERSION_MAJOR=${VIMIX_VERSION_MAJOR})
|
||||||
|
add_definitions(-DVIMIX_VERSION_MINOR=${VIMIX_VERSION_MINOR})
|
||||||
|
add_definitions(-DVIMIX_VERSION_PATCH=${VIMIX_VERSION_PATCH})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Compiling vimix version ${VIMIX_VERSION_MAJOR}.${VIMIX_VERSION_MINOR}.${VIMIX_VERSION_PATCH}")
|
||||||
|
|
||||||
set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "ON")
|
set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "ON")
|
||||||
set(CMAKE_INCLUDE_CURRENTDIR ON)
|
set(CMAKE_INCLUDE_CURRENTDIR ON)
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules )
|
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules )
|
||||||
@@ -34,6 +56,7 @@ endif()
|
|||||||
# Include the CMake RC module
|
# Include the CMake RC module
|
||||||
include(CMakeRC)
|
include(CMakeRC)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# GSTREAMER
|
# GSTREAMER
|
||||||
#
|
#
|
||||||
@@ -483,8 +506,9 @@ SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "vimix\n Real-time video mixing for live p
|
|||||||
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md")
|
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md")
|
||||||
SET(CPACK_PACKAGE_CONTACT "bruno.herbelin@gmail.com")
|
SET(CPACK_PACKAGE_CONTACT "bruno.herbelin@gmail.com")
|
||||||
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING.txt")
|
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING.txt")
|
||||||
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
|
SET(CPACK_PACKAGE_VERSION_MAJOR "${VIMIX_VERSION_MAJOR}")
|
||||||
SET(CPACK_PACKAGE_VERSION_MINOR "5")
|
SET(CPACK_PACKAGE_VERSION_MINOR "${VIMIX_VERSION_MINOR}")
|
||||||
|
SET(CPACK_PACKAGE_VERSION_PATCH "${VIMIX_VERSION_PATCH}")
|
||||||
SET(CPACK_PACKAGE_VENDOR "Bruno Herbelin")
|
SET(CPACK_PACKAGE_VENDOR "Bruno Herbelin")
|
||||||
SET(CPACK_SOURCE_IGNORE_FILES
|
SET(CPACK_SOURCE_IGNORE_FILES
|
||||||
"/\\\\.git/"
|
"/\\\\.git/"
|
||||||
|
|||||||
10
Settings.cpp
10
Settings.cpp
@@ -22,9 +22,11 @@ void Settings::Save()
|
|||||||
xmlDoc.InsertFirstChild(pDec);
|
xmlDoc.InsertFirstChild(pDec);
|
||||||
|
|
||||||
XMLElement *pRoot = xmlDoc.NewElement(application.name.c_str());
|
XMLElement *pRoot = xmlDoc.NewElement(application.name.c_str());
|
||||||
pRoot->SetAttribute("major", APP_VERSION_MAJOR);
|
#ifdef VIMIX_VERSION_MAJOR
|
||||||
pRoot->SetAttribute("minor", APP_VERSION_MINOR);
|
pRoot->SetAttribute("major", VIMIX_VERSION_MAJOR);
|
||||||
|
pRoot->SetAttribute("minor", VIMIX_VERSION_MINOR);
|
||||||
xmlDoc.InsertEndChild(pRoot);
|
xmlDoc.InsertEndChild(pRoot);
|
||||||
|
#endif
|
||||||
|
|
||||||
string comment = "Settings for " + application.name;
|
string comment = "Settings for " + application.name;
|
||||||
XMLComment *pComment = xmlDoc.NewComment(comment.c_str());
|
XMLComment *pComment = xmlDoc.NewComment(comment.c_str());
|
||||||
@@ -233,12 +235,14 @@ void Settings::Load()
|
|||||||
if (application.name.compare( string( pRoot->Value() ) ) != 0 )
|
if (application.name.compare( string( pRoot->Value() ) ) != 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef VIMIX_VERSION_MAJOR
|
||||||
// cancel on different version
|
// cancel on different version
|
||||||
int version_major = -1, version_minor = -1;
|
int version_major = -1, version_minor = -1;
|
||||||
pRoot->QueryIntAttribute("major", &version_major);
|
pRoot->QueryIntAttribute("major", &version_major);
|
||||||
pRoot->QueryIntAttribute("minor", &version_minor);
|
pRoot->QueryIntAttribute("minor", &version_minor);
|
||||||
if (version_major != APP_VERSION_MAJOR || version_minor != APP_VERSION_MINOR)
|
if (version_major != VIMIX_VERSION_MAJOR || version_minor != VIMIX_VERSION_MINOR)
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
XMLElement * applicationNode = pRoot->FirstChildElement("Application");
|
XMLElement * applicationNode = pRoot->FirstChildElement("Application");
|
||||||
if (applicationNode != nullptr) {
|
if (applicationNode != nullptr) {
|
||||||
|
|||||||
@@ -3042,9 +3042,16 @@ void UserInterface::RenderAbout(bool* p_open)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef VIMIX_VERSION_MAJOR
|
||||||
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_BOLD);
|
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_BOLD);
|
||||||
ImGui::Text("%s %d.%d", APP_NAME, APP_VERSION_MAJOR, APP_VERSION_MINOR);
|
ImGui::Text("%s %d.%d.%d", APP_NAME, VIMIX_VERSION_MAJOR, VIMIX_VERSION_MINOR, VIMIX_VERSION_PATCH);
|
||||||
ImGui::PopFont();
|
ImGui::PopFont();
|
||||||
|
#else
|
||||||
|
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_BOLD);
|
||||||
|
ImGui::Text("%s", APP_NAME);
|
||||||
|
ImGui::PopFont();
|
||||||
|
#endif
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::Text("vimix performs graphical mixing and blending of\nseveral movie clips and computer generated graphics,\nwith image processing effects in real-time.");
|
ImGui::Text("vimix performs graphical mixing and blending of\nseveral movie clips and computer generated graphics,\nwith image processing effects in real-time.");
|
||||||
ImGui::Text("\nvimix is licensed under the GNU GPL version 3.\nCopyright 2019-2020 Bruno Herbelin.");
|
ImGui::Text("\nvimix is licensed under the GNU GPL version 3.\nCopyright 2019-2020 Bruno Herbelin.");
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
#define APP_NAME "vimix"
|
#define APP_NAME "vimix"
|
||||||
#define APP_TITLE " -- Video Live Mixer"
|
#define APP_TITLE " -- Video Live Mixer"
|
||||||
#define APP_SETTINGS "vimix.xml"
|
#define APP_SETTINGS "vimix.xml"
|
||||||
#define APP_VERSION_MAJOR 0
|
|
||||||
#define APP_VERSION_MINOR 5
|
|
||||||
#define XML_VERSION_MAJOR 0
|
#define XML_VERSION_MAJOR 0
|
||||||
#define XML_VERSION_MINOR 2
|
#define XML_VERSION_MINOR 2
|
||||||
#define MAX_RECENT_HISTORY 20
|
#define MAX_RECENT_HISTORY 20
|
||||||
|
|||||||
Reference in New Issue
Block a user