diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,11 +21,6 @@ cmake_minimum_required(VERSION 2.8.11) project(serialplot) -set(MAJOR_VERSION 0) -set(MINOR_VERSION 1) -set(PATCH_VERSION 0) -set(VERSION_STRING "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") - # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -75,6 +70,32 @@ else() message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") endif() +# version number +set(MAJOR_VERSION 0) +set(MINOR_VERSION 1) +set(PATCH_VERSION 0) +set(VERSION_STRING "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") + +# get revision number from mercurial +find_program(MERCURIAL hg) + +if (MERCURIAL) + execute_process(COMMAND ${MERCURIAL} id -i + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE MERCURIAL_RESULT + OUTPUT_VARIABLE VERSION_REVISION + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT MERCURIAL_RESULT EQUAL 0) + set(VERSION_SCM_REVISION false) + endif(NOT MERCURIAL_RESULT EQUAL 0) +endif (MERCURIAL) + +if (NOT VERSION_REVISION) + set(VERSION_REVISION "0") +endif (NOT VERSION_REVISION) + +message("SCM revision: ${VERSION_REVISION}") + # configure version file configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/version.h") diff --git a/about_dialog.ui b/about_dialog.ui --- a/about_dialog.ui +++ b/about_dialog.ui @@ -7,7 +7,7 @@ 0 0 487 - 300 + 325 @@ -17,7 +17,7 @@ - <html><head/><body><p align="center"><span style=" font-size:14pt;">SerialPlot</span></p><p align="center"><span style=" font-size:10pt;">$VERSION_STRING$</span></p><p align="center">Developed by Hasan Yavuz Özderya</p><p align="center">Using Qt and Qwt (<a href="http://qwt.sf.net"><span style=" text-decoration: underline; color:#0000ff;">http://qwt.sf.net</span></a>)</p><p align="center"><br/></p><p align="center">This software is GPL licensed. You can obtain source code from <a href="https://bitbucket.org/hyOzd/serialplot"><span style=" text-decoration: underline; color:#0000ff;">https://bitbucket.org/hyOzd/serialplot</span></a>.<br/></p></body></html> + <html><head/><body><p align="center"><span style=" font-size:14pt;">SerialPlot</span></p><p align="center"><span style=" font-size:10pt;">$VERSION_STRING$</span></p><p align="center">Developed by Hasan Yavuz Özderya</p><p align="center">Using Qt and Qwt (<a href="http://qwt.sf.net"><span style=" text-decoration: underline; color:#0000ff;">http://qwt.sf.net</span></a>)</p><p align="center"><br/></p><p align="center">This software is GPL licensed. You can obtain source code from <a href="https://bitbucket.org/hyOzd/serialplot"><span style=" text-decoration: underline; color:#0000ff;">https://bitbucket.org/hyOzd/serialplot</span></a>.</p><p align="center"><br/></p><p align="right"><span style=" font-size:8pt;">RevID: $VERSION_REVISION$<br/></span></p></body></html> true diff --git a/mainwindow.cpp b/mainwindow.cpp --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -215,6 +215,7 @@ void MainWindow::setupAboutDialog() QString aboutText = uiAboutDialog.lbAbout->text(); aboutText.replace("$VERSION_STRING$", VERSION_STRING); + aboutText.replace("$VERSION_REVISION$", VERSION_REVISION); uiAboutDialog.lbAbout->setText(aboutText); } diff --git a/version.h.in b/version.h.in --- a/version.h.in +++ b/version.h.in @@ -21,3 +21,4 @@ #define MINOR_VERSION @MINOR_VERSION@ #define PATCH_VERSION @PATCH_VERSION@ #define VERSION_STRING "@VERSION_STRING@" +#define VERSION_REVISION "@VERSION_REVISION@"