]> sigrok.org Git - pulseview.git/blobdiff - CMakeLists.txt
CMakeLists.txt: Enable unit tests by default.
[pulseview.git] / CMakeLists.txt
index e1bc3a60f856b63ad08eb80f57089d3bb69b6884..77b0137db22b7b6cab80d8aee7c97fecb8c542bf 100644 (file)
@@ -34,7 +34,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
 option(DISABLE_WERROR "Build without -Werror" FALSE)
 option(ENABLE_SIGNALS "Build with UNIX signals" TRUE)
 option(ENABLE_DECODE "Build with libsigrokdecode" TRUE)
-option(ENABLE_TESTS "Enable unit tests" FALSE)
+option(ENABLE_TESTS "Enable unit tests" TRUE)
 option(STATIC_PKGDEPS_LIBS "Statically link to (pkg-config) libraries" FALSE)
 option(FORCE_QT4 "Force use of Qt4 even if Qt5 is available" FALSE)
 
@@ -99,9 +99,9 @@ else()
 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()
-       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).
@@ -121,28 +121,27 @@ memaccess_check_unaligned_le(HAVE_UNALIGNED_LITTLE_ENDIAN_ACCESS)
 
 set(PV_TITLE PulseView)
 set(PV_DESCRIPTION "A GUI for sigrok")
+set(PV_VERSION_STRING "0.3.0")
 
 include(GetGitRevisionDescription)
-git_describe(PV_NAME_VERSION_STRING)
 
-if(NOT PV_NAME_VERSION_STRING)
-       # Read the version from a file that is distributed with
-       # the source package (see writepackageversion.cmake).
-       file(STRINGS "${PROJECT_SOURCE_DIR}/VERSION" PV_NAME_VERSION_STRING LIMIT_COUNT 1)
+# Append the revision hash unless we are exactly on a tagged release.
+git_describe(PV_TAG_VERSION_STRING --match "pulseview-${PV_VERSION_STRING}" --exact-match)
+if(NOT PV_TAG_VERSION_STRING)
+       get_git_head_revision(PV_REVSPEC PV_HASH)
+       if(PV_HASH)
+               string(SUBSTRING "${PV_HASH}" 0 7 PV_SHORTHASH)
+               set(PV_VERSION_STRING "${PV_VERSION_STRING}-git-${PV_SHORTHASH}")
+       endif()
 endif()
 
-if(PV_NAME_VERSION_STRING MATCHES "^pulseview-([0-9]+)\\.([0-9]+)\\.([0-9]+)(-[-0-9a-z]+)?$")
+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})
-else()
-       message(FATAL_ERROR "-- Cannot get the ${PV_TITLE} version from anywhere")
 endif()
 
-set(PV_VERSION_STRING
-       ${PV_VERSION_MAJOR}.${PV_VERSION_MINOR}.${PV_VERSION_MICRO}${PV_VERSION_SUFFIX}
-)
 message("-- ${PV_TITLE} version: ${PV_VERSION_STRING}")
 
 configure_file (
@@ -197,16 +196,19 @@ set(pulseview_SOURCES
        pv/view/marginwidget.cpp
        pv/view/logicsignal.cpp
        pv/view/rowitem.cpp
-       pv/view/rowitemowner.cpp
        pv/view/ruler.cpp
        pv/view/signal.cpp
+       pv/view/signalscalehandle.cpp
        pv/view/timeitem.cpp
        pv/view/timemarker.cpp
        pv/view/trace.cpp
        pv/view/tracegroup.cpp
        pv/view/tracepalette.cpp
+       pv/view/tracetreeitem.cpp
+       pv/view/tracetreeitemowner.cpp
        pv/view/view.cpp
        pv/view/viewitem.cpp
+       pv/view/viewitemowner.cpp
        pv/view/viewitempaintparams.cpp
        pv/view/viewport.cpp
        pv/view/viewwidget.cpp
@@ -219,6 +221,7 @@ set(pulseview_SOURCES
        pv/widgets/popup.cpp
        pv/widgets/popuptoolbutton.cpp
        pv/widgets/sweeptimingwidget.cpp
+       pv/widgets/timestampspinbox.cpp
        pv/widgets/wellarray.cpp
 )
 
@@ -249,10 +252,12 @@ set(pulseview_HEADERS
        pv/view/rowitem.hpp
        pv/view/ruler.hpp
        pv/view/signal.hpp
+       pv/view/signalscalehandle.hpp
        pv/view/timeitem.hpp
        pv/view/timemarker.hpp
        pv/view/trace.hpp
        pv/view/tracegroup.hpp
+       pv/view/tracetreeitem.hpp
        pv/view/view.hpp
        pv/view/viewitem.hpp
        pv/view/viewport.hpp
@@ -266,6 +271,7 @@ set(pulseview_HEADERS
        pv/widgets/popup.hpp
        pv/widgets/popuptoolbutton.hpp
        pv/widgets/sweeptimingwidget.hpp
+       pv/widgets/timestampspinbox.hpp
        pv/widgets/wellarray.hpp
 )
 
@@ -311,7 +317,10 @@ if(WIN32)
 endif()
 
 if(ANDROID)
-       list(APPEND pulseview_SOURCES android/loghandler.cpp)
+       list(APPEND pulseview_SOURCES
+               android/assetreader.cpp
+               android/loghandler.cpp
+       )
 endif()
 
 if(Qt5Core_FOUND)
@@ -436,6 +445,9 @@ install(TARGETS ${PROJECT_NAME} DESTINATION bin/)
 # Install the manpage.
 install(FILES doc/pulseview.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT doc)
 
+# Generate Windows installer script.
+configure_file(contrib/pulseview_cross.nsi.in contrib/pulseview_cross.nsi @ONLY)
+
 #===============================================================================
 #= Packaging (handled by CPack)
 #-------------------------------------------------------------------------------
@@ -448,7 +460,6 @@ 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_STRING}")
 set(CPACK_SOURCE_GENERATOR "TGZ")
-set(CPACK_INSTALL_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/CMake/writepackageversion.cmake)
 
 include(CPack)