Add a spin box widget for timestamp values
[pulseview.git] / CMakeLists.txt
index c6e3b77053a61e7346f45a2be39e84b393854d4c..bde27c13c900b9c8096d712c1738cf83569042cd 100644 (file)
@@ -65,10 +65,10 @@ endif()
 #= Dependencies
 #-------------------------------------------------------------------------------
 
 #= Dependencies
 #-------------------------------------------------------------------------------
 
-list(APPEND PKGDEPS libsigrokcxx>=0.3.0)
+list(APPEND PKGDEPS libsigrokcxx>=0.4.0)
 
 if(ENABLE_DECODE)
 
 if(ENABLE_DECODE)
-       list(APPEND PKGDEPS libsigrokdecode>=0.3.0)
+       list(APPEND PKGDEPS libsigrokdecode>=0.4.0)
 endif()
 
 if(ANDROID)
 endif()
 
 if(ANDROID)
@@ -99,9 +99,9 @@ else()
 endif()
 
 if(ENABLE_TESTS)
 endif()
 
 if(ENABLE_TESTS)
-       find_package(Boost 1.42 COMPONENTS filesystem system thread unit_test_framework REQUIRED)
+       find_package(Boost 1.48 COMPONENTS filesystem system thread unit_test_framework REQUIRED)
 else()
 else()
-       find_package(Boost 1.42 COMPONENTS filesystem system thread REQUIRED)
+       find_package(Boost 1.48 COMPONENTS filesystem system thread REQUIRED)
 endif()
 
 # Find the platform's thread library (needed for C++11 threads).
 endif()
 
 # Find the platform's thread library (needed for C++11 threads).
@@ -121,13 +121,40 @@ memaccess_check_unaligned_le(HAVE_UNALIGNED_LITTLE_ENDIAN_ACCESS)
 
 set(PV_TITLE PulseView)
 set(PV_DESCRIPTION "A GUI for sigrok")
 
 set(PV_TITLE PulseView)
 set(PV_DESCRIPTION "A GUI for sigrok")
+set(PV_VERSION_STRING "0.3.0")
 
 
-set(PV_VERSION_MAJOR 0)
-set(PV_VERSION_MINOR 2)
-set(PV_VERSION_MICRO 0)
-set(PV_VERSION_STRING
-       ${PV_VERSION_MAJOR}.${PV_VERSION_MINOR}.${PV_VERSION_MICRO}
-)
+include(GetGitRevisionDescription)
+git_describe(PV_TAG_VERSION_STRING --tags --dirty)
+
+if(NOT PV_TAG_VERSION_STRING AND EXISTS "${PROJECT_SOURCE_DIR}/VERSION")
+       # Read the version from a file that is distributed with
+       # the source package (see writepackageversion.cmake).
+       file(STRINGS "${PROJECT_SOURCE_DIR}/VERSION" PV_TAG_VERSION_STRING LIMIT_COUNT 1)
+endif()
+
+if(PV_TAG_VERSION_STRING MATCHES
+               "^pulseview-([0-9]+\\.[0-9]+\\.[0-9]+)(-[0-9a-z]+)?(-g[-0-9a-z]+)?$")
+       set(PV_TAG_VERSION ${CMAKE_MATCH_1})
+       set(PV_TAG_PATCHLEVEL ${CMAKE_MATCH_2})
+       set(PV_TAG_REVHASH ${CMAKE_MATCH_3})
+
+       if(PV_VERSION_STRING VERSION_GREATER ${PV_TAG_VERSION})
+               # Tagged version older than current one: indicate pre-release.
+               set(PV_VERSION_STRING "${PV_VERSION_STRING}-pre${PV_TAG_REVHASH}")
+       else()
+               # For post-release changes, indicate the patch level.
+               set(PV_VERSION_STRING "${PV_TAG_VERSION}${PV_TAG_PATCHLEVEL}${PV_TAG_REVHASH}")
+       endif()
+endif()
+
+if(PV_VERSION_STRING MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)(-[-0-9a-z]*)?$")
+       set(PV_VERSION_MAJOR ${CMAKE_MATCH_1})
+       set(PV_VERSION_MINOR ${CMAKE_MATCH_2})
+       set(PV_VERSION_MICRO ${CMAKE_MATCH_3})
+       set(PV_VERSION_SUFFIX ${CMAKE_MATCH_4})
+endif()
+
+message("-- ${PV_TITLE} version: ${PV_VERSION_STRING}")
 
 configure_file (
        ${PROJECT_SOURCE_DIR}/config.h.in
 
 configure_file (
        ${PROJECT_SOURCE_DIR}/config.h.in
@@ -158,6 +185,7 @@ set(pulseview_SOURCES
        pv/devices/device.cpp
        pv/devices/file.cpp
        pv/devices/hardwaredevice.cpp
        pv/devices/device.cpp
        pv/devices/file.cpp
        pv/devices/hardwaredevice.cpp
+       pv/devices/inputfile.cpp
        pv/devices/sessionfile.cpp
        pv/dialogs/about.cpp
        pv/dialogs/connect.cpp
        pv/devices/sessionfile.cpp
        pv/dialogs/about.cpp
        pv/dialogs/connect.cpp
@@ -202,6 +230,7 @@ set(pulseview_SOURCES
        pv/widgets/popup.cpp
        pv/widgets/popuptoolbutton.cpp
        pv/widgets/sweeptimingwidget.cpp
        pv/widgets/popup.cpp
        pv/widgets/popuptoolbutton.cpp
        pv/widgets/sweeptimingwidget.cpp
+       pv/widgets/timestampspinbox.cpp
        pv/widgets/wellarray.cpp
 )
 
        pv/widgets/wellarray.cpp
 )
 
@@ -249,6 +278,7 @@ set(pulseview_HEADERS
        pv/widgets/popup.hpp
        pv/widgets/popuptoolbutton.hpp
        pv/widgets/sweeptimingwidget.hpp
        pv/widgets/popup.hpp
        pv/widgets/popuptoolbutton.hpp
        pv/widgets/sweeptimingwidget.hpp
+       pv/widgets/timestampspinbox.hpp
        pv/widgets/wellarray.hpp
 )
 
        pv/widgets/wellarray.hpp
 )
 
@@ -429,9 +459,9 @@ set(CPACK_PACKAGE_VERSION_PATCH ${PV_VERSION_MICRO})
 set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README)
 set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/COPYING)
 set(CPACK_SOURCE_IGNORE_FILES ${CMAKE_CURRENT_BINARY_DIR} ".gitignore" ".git")
 set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README)
 set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/COPYING)
 set(CPACK_SOURCE_IGNORE_FILES ${CMAKE_CURRENT_BINARY_DIR} ".gitignore" ".git")
-set(CPACK_SOURCE_PACKAGE_FILE_NAME
-       "${CMAKE_PROJECT_NAME}-${PV_VERSION_MAJOR}.${PV_VERSION_MINOR}.${PV_VERSION_MICRO}")
+set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${PV_VERSION_STRING}")
 set(CPACK_SOURCE_GENERATOR "TGZ")
 set(CPACK_SOURCE_GENERATOR "TGZ")
+set(CPACK_INSTALL_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/CMake/writepackageversion.cmake)
 
 include(CPack)
 
 
 include(CPack)