Add a spin box widget for timestamp values
[pulseview.git] / CMakeLists.txt
index 6848be500153ac15381d6082391ab041fc92d825..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
@@ -147,6 +174,7 @@ set(pulseview_SOURCES
        pv/storesession.cpp
        pv/util.cpp
        pv/binding/binding.cpp
        pv/storesession.cpp
        pv/util.cpp
        pv/binding/binding.cpp
+       pv/binding/inputoutput.cpp
        pv/binding/device.cpp
        pv/data/analog.cpp
        pv/data/analogsegment.cpp
        pv/binding/device.cpp
        pv/data/analog.cpp
        pv/data/analogsegment.cpp
@@ -154,8 +182,14 @@ set(pulseview_SOURCES
        pv/data/logicsegment.cpp
        pv/data/signaldata.cpp
        pv/data/segment.cpp
        pv/data/logicsegment.cpp
        pv/data/signaldata.cpp
        pv/data/segment.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/dialogs/about.cpp
        pv/dialogs/connect.cpp
+       pv/dialogs/inputoutputoptions.cpp
        pv/dialogs/storeprogress.cpp
        pv/popups/deviceoptions.cpp
        pv/popups/channels.cpp
        pv/dialogs/storeprogress.cpp
        pv/popups/deviceoptions.cpp
        pv/popups/channels.cpp
@@ -192,9 +226,11 @@ set(pulseview_SOURCES
        pv/widgets/devicetoolbutton.cpp
        pv/widgets/exportmenu.cpp
        pv/widgets/hidingmenubar.cpp
        pv/widgets/devicetoolbutton.cpp
        pv/widgets/exportmenu.cpp
        pv/widgets/hidingmenubar.cpp
+       pv/widgets/importmenu.cpp
        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
 )
 
@@ -206,6 +242,7 @@ set(pulseview_HEADERS
        pv/binding/device.hpp
        pv/dialogs/about.hpp
        pv/dialogs/connect.hpp
        pv/binding/device.hpp
        pv/dialogs/about.hpp
        pv/dialogs/connect.hpp
+       pv/dialogs/inputoutputoptions.hpp
        pv/dialogs/storeprogress.hpp
        pv/popups/channels.hpp
        pv/popups/deviceoptions.hpp
        pv/dialogs/storeprogress.hpp
        pv/popups/channels.hpp
        pv/popups/deviceoptions.hpp
@@ -237,9 +274,11 @@ set(pulseview_HEADERS
        pv/widgets/devicetoolbutton.hpp
        pv/widgets/exportmenu.hpp
        pv/widgets/hidingmenubar.hpp
        pv/widgets/devicetoolbutton.hpp
        pv/widgets/exportmenu.hpp
        pv/widgets/hidingmenubar.hpp
+       pv/widgets/importmenu.hpp
        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
 )
 
@@ -293,7 +332,10 @@ if(Qt5Core_FOUND)
        qt5_wrap_ui(pulseview_FORMS_HEADERS ${pulseview_FORMS})
        qt5_add_resources(pulseview_RESOURCES_RCC ${pulseview_RESOURCES})
 else()
        qt5_wrap_ui(pulseview_FORMS_HEADERS ${pulseview_FORMS})
        qt5_add_resources(pulseview_RESOURCES_RCC ${pulseview_RESOURCES})
 else()
-       qt4_wrap_cpp(pulseview_HEADERS_MOC ${pulseview_HEADERS})
+       # Workaroud for QTBUG-22829: -DBOOST_NEXT_PRIOR_HPP_INCLUDED.
+       # https://bugreports.qt.io/browse/QTBUG-22829
+       qt4_wrap_cpp(pulseview_HEADERS_MOC ${pulseview_HEADERS}
+               OPTIONS -DBOOST_NEXT_PRIOR_HPP_INCLUDED)
        qt4_wrap_ui(pulseview_FORMS_HEADERS ${pulseview_FORMS})
        qt4_add_resources(pulseview_RESOURCES_RCC ${pulseview_RESOURCES})
        include(${QT_USE_FILE})
        qt4_wrap_ui(pulseview_FORMS_HEADERS ${pulseview_FORMS})
        qt4_add_resources(pulseview_RESOURCES_RCC ${pulseview_RESOURCES})
        include(${QT_USE_FILE})
@@ -417,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)