]> sigrok.org Git - pulseview.git/blame_incremental - CMakeLists.txt
TabularDecView: Some fixes and refactorings
[pulseview.git] / CMakeLists.txt
... / ...
CommitLineData
1##
2## This file is part of the PulseView project.
3##
4## Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
5## Copyright (C) 2012-2013 Alexandru Gagniuc <mr.nuke.me@gmail.com>
6## Copyright (C) 2020 Soeren Apel <soeren@apelpie.net>
7##
8## This program is free software: you can redistribute it and/or modify
9## it under the terms of the GNU General Public License as published by
10## the Free Software Foundation, either version 2 of the License, or
11## (at your option) any later version.
12##
13## This program is distributed in the hope that it will be useful,
14## but WITHOUT ANY WARRANTY; without even the implied warranty of
15## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16## GNU General Public License for more details.
17##
18## You should have received a copy of the GNU General Public License
19## along with this program. If not, see <http://www.gnu.org/licenses/>.
20##
21
22cmake_minimum_required(VERSION 2.8.12)
23
24include(GNUInstallDirs)
25
26project(pulseview)
27
28# Let AUTOMOC and AUTOUIC process GENERATED files.
29if(POLICY CMP0071)
30 cmake_policy(SET CMP0071 NEW)
31endif()
32
33# Only interpret if() arguments as variables or keywords when unquoted.
34if(POLICY CMP0054)
35 cmake_policy(SET CMP0054 NEW)
36endif()
37
38list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
39
40#===============================================================================
41#= User Options
42#-------------------------------------------------------------------------------
43
44option(DISABLE_WERROR "Build without -Werror" TRUE)
45option(ENABLE_SIGNALS "Build with UNIX signals" TRUE)
46option(ENABLE_STACKTRACE "Enable stack trace when crashing" FALSE)
47option(ENABLE_DECODE "Build with libsigrokdecode" TRUE)
48option(ENABLE_FLOW "Build with libsigrokflow" FALSE)
49option(ENABLE_TESTS "Enable unit tests" FALSE)
50option(STATIC_PKGDEPS_LIBS "Statically link to (pkg-config) libraries" FALSE)
51
52if(WIN32)
53 # On Windows/MinGW we need to statically link to libraries.
54 # This option is user configurable, but enable it by default on win32.
55 set(STATIC_PKGDEPS_LIBS TRUE)
56
57 # Windows does not support UNIX signals.
58 set(ENABLE_SIGNALS FALSE)
59endif()
60
61if(NOT CMAKE_BUILD_TYPE)
62 set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
63 "Choose the type of build (None, Debug, Release, RelWithDebInfo, MinSizeRel)."
64 FORCE)
65endif()
66
67#===============================================================================
68#= Documentation
69#-------------------------------------------------------------------------------
70
71add_subdirectory(manual)
72
73#===============================================================================
74#= Dependencies
75#-------------------------------------------------------------------------------
76
77list(APPEND PKGDEPS glib-2.0>=2.28.0)
78list(APPEND PKGDEPS glibmm-2.4>=2.28.0)
79
80if(ENABLE_FLOW)
81 list(APPEND PKGDEPS gstreamermm-1.0>=1.8.0)
82 list(APPEND PKGDEPS libsigrokflow>=0.1.0)
83endif()
84
85set(LIBSR_CXX_BINDING "libsigrokcxx>=0.5.2")
86list(APPEND PKGDEPS "${LIBSR_CXX_BINDING}")
87
88if(ENABLE_DECODE)
89 list(APPEND PKGDEPS libsigrokdecode>=0.5.2)
90endif()
91
92if(ANDROID)
93 list(APPEND PKGDEPS libsigrokandroidutils>=0.1.0)
94endif()
95
96find_package(PkgConfig)
97pkg_check_modules(LIBSRCXX ${LIBSR_CXX_BINDING})
98if(NOT LIBSRCXX_FOUND OR NOT LIBSRCXX_VERSION)
99 message(FATAL_ERROR "libsigrok C++ bindings missing, check libsigrok's 'configure' output (missing dependencies?)")
100endif()
101pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS})
102
103set(CMAKE_AUTOMOC TRUE)
104
105find_package(Qt5 5.3 COMPONENTS Core Gui LinguistTools Widgets Svg REQUIRED)
106
107message(STATUS "Qt version: ${Qt5_VERSION}")
108
109if(WIN32)
110 # MXE workaround: Use pkg-config to find Qt5 libs.
111 # https://github.com/mxe/mxe/issues/1642
112 # Not required (and doesn't work) on MSYS2.
113 if(NOT DEFINED ENV{MSYSTEM})
114 pkg_check_modules(QT5ALL REQUIRED Qt5Widgets>=5.3 Qt5Gui>=5.3 Qt5Svg>=5.3)
115 endif()
116endif()
117
118set(QT_LIBRARIES Qt5::Gui Qt5::Widgets Qt5::Svg)
119
120set(BOOSTCOMPS filesystem serialization system)
121if(ENABLE_TESTS)
122 list(APPEND BOOSTCOMPS unit_test_framework)
123endif()
124
125if(ENABLE_STACKTRACE)
126 include(FindBacktrace)
127 if (Backtrace_FOUND)
128 set(_Boost_STACKTRACE_BACKTRACE_HEADERS "boost/stacktrace.hpp")
129 list(APPEND BOOSTCOMPS stacktrace_backtrace)
130 else()
131 set(_Boost_STACKTRACE_BASIC_HEADERS "boost/stacktrace.hpp")
132 list(APPEND BOOSTCOMPS stacktrace_basic)
133 endif()
134 find_package(Boost 1.65.1 COMPONENTS ${BOOSTCOMPS} REQUIRED)
135else()
136 find_package(Boost 1.55 COMPONENTS ${BOOSTCOMPS} REQUIRED)
137endif()
138
139# Find the platform's thread library (needed for C++11 threads).
140# This will set ${CMAKE_THREAD_LIBS_INIT} to the correct, OS-specific value.
141find_package(Threads REQUIRED)
142
143# Check for explicit link against libatomic
144#
145# Depending on the toolchain, linking a program using atomic functions may need
146# "-latomic" explicitly passed to the linker
147#
148# This check first tests if atomics are available in the C-library, if not and
149# libatomic exists, then it runs the same test with -latomic added to the
150# linker flags.
151
152# Helper for checking for atomics
153function(check_working_cxx_atomics varname additional_lib)
154 include(CheckCXXSourceCompiles)
155 include(CMakePushCheckState)
156 cmake_push_check_state()
157 set(CMAKE_REQUIRED_FLAGS "-std=c++11")
158 set(CMAKE_REQUIRED_LIBRARIES "${additional_lib}")
159 set(CMAKE_REQUIRED_QUIET 1)
160 CHECK_CXX_SOURCE_COMPILES("
161#include <atomic>
162std::atomic<int> x;
163int main() {
164 return std::atomic_fetch_add_explicit(&x, 1, std::memory_order_seq_cst);
165}
166" ${varname})
167 cmake_pop_check_state()
168endfunction(check_working_cxx_atomics)
169
170# First check if atomics work without the library.
171# If not, check if the library exists, and atomics work with it.
172check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB "")
173if(HAVE_CXX_ATOMICS_WITHOUT_LIB)
174 message(STATUS "Atomics provided by the C-library - yes")
175else()
176 message(STATUS "Atomics provided by the C-library - no")
177 find_library(LIBATOMIC_LIBRARY NAMES atomic PATH_SUFFIXES lib)
178 if(LIBATOMIC_LIBRARY)
179 check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB "${LIBATOMIC_LIBRARY}")
180 if (HAVE_CXX_ATOMICS_WITH_LIB)
181 message(STATUS "Atomics provided by libatomic - yes")
182 else()
183 message(STATUS "Atomics provided by libatomic - no")
184 message(FATAL_ERROR "Compiler must support std::atomic!")
185 endif()
186 else()
187 message(FATAL_ERROR "Compiler appears to require libatomic, but cannot find it.")
188 endif()
189endif()
190
191#===============================================================================
192#= System Introspection
193#-------------------------------------------------------------------------------
194
195include(memaccess)
196memaccess_check_unaligned_le(HAVE_UNALIGNED_LITTLE_ENDIAN_ACCESS)
197
198#===============================================================================
199#= Config Header
200#-------------------------------------------------------------------------------
201
202set(PV_TITLE PulseView)
203set(PV_VERSION_STRING "0.5.0")
204
205set(PV_GLIBMM_VERSION ${PKGDEPS_glibmm-2.4_VERSION})
206
207include(GetGitRevisionDescription)
208
209# Append the revision hash unless we are exactly on a tagged release.
210git_describe(PV_TAG_VERSION_STRING --match "pulseview-${PV_VERSION_STRING}" --exact-match)
211if(NOT PV_TAG_VERSION_STRING)
212 get_git_head_revision(PV_REVSPEC PV_HASH)
213 if(PV_HASH)
214 string(SUBSTRING "${PV_HASH}" 0 7 PV_SHORTHASH)
215 set(PV_VERSION_STRING "${PV_VERSION_STRING}-git-${PV_SHORTHASH}")
216 endif()
217
218 # Non-tagged releases use the unstable manual
219 set(PV_MANUAL_VERSION "unstable")
220else()
221 # Tagged releases use a fixed manual version
222 set(PV_MANUAL_VERSION ${PV_VERSION_STRING})
223endif()
224
225if(PV_VERSION_STRING MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)(-[-0-9a-z]*)?$")
226 set(PV_VERSION_MAJOR ${CMAKE_MATCH_1})
227 set(PV_VERSION_MINOR ${CMAKE_MATCH_2})
228 set(PV_VERSION_MICRO ${CMAKE_MATCH_3})
229 set(PV_VERSION_SUFFIX ${CMAKE_MATCH_4})
230endif()
231
232message(STATUS "${PV_TITLE} version: ${PV_VERSION_STRING}")
233
234configure_file (
235 ${PROJECT_SOURCE_DIR}/config.h.in
236 ${PROJECT_BINARY_DIR}/config.h
237)
238
239#===============================================================================
240#= Sources
241#-------------------------------------------------------------------------------
242
243set(pulseview_SOURCES
244 main.cpp
245 pv/application.cpp
246 pv/devicemanager.cpp
247 pv/globalsettings.cpp
248 pv/logging.cpp
249 pv/mainwindow.cpp
250 pv/metadata_obj.cpp
251 pv/session.cpp
252 pv/storesession.cpp
253 pv/util.cpp
254 pv/binding/binding.cpp
255 pv/binding/inputoutput.cpp
256 pv/binding/device.cpp
257 pv/data/analog.cpp
258 pv/data/analogsegment.cpp
259 pv/data/logic.cpp
260 pv/data/logicsegment.cpp
261 pv/data/signalbase.cpp
262 pv/data/signaldata.cpp
263 pv/data/segment.cpp
264 pv/devices/device.cpp
265 pv/devices/file.cpp
266 pv/devices/hardwaredevice.cpp
267 pv/devices/inputfile.cpp
268 pv/devices/sessionfile.cpp
269 pv/dialogs/connect.cpp
270 pv/dialogs/inputoutputoptions.cpp
271 pv/dialogs/settings.cpp
272 pv/dialogs/storeprogress.cpp
273 pv/popups/deviceoptions.cpp
274 pv/popups/channels.cpp
275 pv/prop/bool.cpp
276 pv/prop/double.cpp
277 pv/prop/enum.cpp
278 pv/prop/int.cpp
279 pv/prop/property.cpp
280 pv/prop/string.cpp
281 pv/subwindows/subwindowbase.cpp
282 pv/toolbars/mainbar.cpp
283 pv/views/trace/analogsignal.cpp
284 pv/views/trace/cursor.cpp
285 pv/views/trace/cursorpair.cpp
286 pv/views/trace/flag.cpp
287 pv/views/trace/header.cpp
288 pv/views/trace/marginwidget.cpp
289 pv/views/trace/logicsignal.cpp
290 pv/views/trace/ruler.cpp
291 pv/views/trace/signal.cpp
292 pv/views/trace/timeitem.cpp
293 pv/views/trace/timemarker.cpp
294 pv/views/trace/trace.cpp
295 pv/views/trace/tracegroup.cpp
296 pv/views/trace/tracepalette.cpp
297 pv/views/trace/tracetreeitem.cpp
298 pv/views/trace/tracetreeitemowner.cpp
299 pv/views/trace/triggermarker.cpp
300 pv/views/trace/view.cpp
301 pv/views/trace/viewitem.cpp
302 pv/views/trace/viewitemowner.cpp
303 pv/views/trace/viewitempaintparams.cpp
304 pv/views/trace/viewport.cpp
305 pv/views/trace/viewwidget.cpp
306 pv/views/viewbase.cpp
307 pv/views/trace/standardbar.cpp
308 pv/widgets/colorbutton.cpp
309 pv/widgets/colorpopup.cpp
310 pv/widgets/devicetoolbutton.cpp
311 pv/widgets/exportmenu.cpp
312 pv/widgets/flowlayout.cpp
313 pv/widgets/importmenu.cpp
314 pv/widgets/popup.cpp
315 pv/widgets/popuptoolbutton.cpp
316 pv/widgets/sweeptimingwidget.cpp
317 pv/widgets/timestampspinbox.cpp
318 pv/widgets/wellarray.cpp
319)
320
321# This list includes only QObject derived class headers.
322set(pulseview_HEADERS
323 pv/logging.hpp
324 pv/globalsettings.hpp
325 pv/mainwindow.hpp
326 pv/metadata_obj.hpp
327 pv/session.hpp
328 pv/storesession.hpp
329 pv/binding/device.hpp
330 pv/data/analog.hpp
331 pv/data/analogsegment.hpp
332 pv/data/logic.hpp
333 pv/data/logicsegment.hpp
334 pv/data/signalbase.hpp
335 pv/dialogs/connect.hpp
336 pv/dialogs/inputoutputoptions.hpp
337 pv/dialogs/settings.hpp
338 pv/dialogs/storeprogress.hpp
339 pv/popups/channels.hpp
340 pv/popups/deviceoptions.hpp
341 pv/prop/bool.hpp
342 pv/prop/double.hpp
343 pv/prop/enum.hpp
344 pv/prop/int.hpp
345 pv/prop/property.hpp
346 pv/prop/string.hpp
347 pv/subwindows/subwindowbase.hpp
348 pv/toolbars/mainbar.hpp
349 pv/views/trace/analogsignal.hpp
350 pv/views/trace/cursor.hpp
351 pv/views/trace/flag.hpp
352 pv/views/trace/header.hpp
353 pv/views/trace/logicsignal.hpp
354 pv/views/trace/marginwidget.hpp
355 pv/views/trace/ruler.hpp
356 pv/views/trace/signal.hpp
357 pv/views/trace/timeitem.hpp
358 pv/views/trace/timemarker.hpp
359 pv/views/trace/trace.hpp
360 pv/views/trace/tracegroup.hpp
361 pv/views/trace/tracetreeitem.hpp
362 pv/views/trace/triggermarker.hpp
363 pv/views/trace/view.hpp
364 pv/views/trace/viewitem.hpp
365 pv/views/trace/viewport.hpp
366 pv/views/trace/viewwidget.hpp
367 pv/views/viewbase.hpp
368 pv/views/trace/standardbar.hpp
369 pv/widgets/colorbutton.hpp
370 pv/widgets/colorpopup.hpp
371 pv/widgets/devicetoolbutton.hpp
372 pv/widgets/exportmenu.hpp
373 pv/widgets/flowlayout.hpp
374 pv/widgets/importmenu.hpp
375 pv/widgets/popup.hpp
376 pv/widgets/popuptoolbutton.hpp
377 pv/widgets/sweeptimingwidget.hpp
378 pv/widgets/timestampspinbox.hpp
379 pv/widgets/wellarray.hpp
380)
381
382set(pulseview_RESOURCES
383 pulseview.qrc
384)
385
386if(ENABLE_SIGNALS)
387 list(APPEND pulseview_SOURCES signalhandler.cpp)
388 list(APPEND pulseview_HEADERS signalhandler.hpp)
389endif()
390
391if(ENABLE_DECODE)
392 list(APPEND pulseview_SOURCES
393 pv/binding/decoder.cpp
394 pv/data/decodesignal.cpp
395 pv/data/decode/annotation.cpp
396 pv/data/decode/decoder.cpp
397 pv/data/decode/row.cpp
398 pv/data/decode/rowdata.cpp
399 pv/subwindows/decoder_selector/item.cpp
400 pv/subwindows/decoder_selector/model.cpp
401 pv/subwindows/decoder_selector/subwindow.cpp
402 pv/views/decoder_binary/view.cpp
403 pv/views/decoder_binary/QHexView.cpp
404 pv/views/tabular_decoder/model.cpp
405 pv/views/tabular_decoder/view.cpp
406 pv/views/trace/decodetrace.cpp
407 pv/widgets/decodergroupbox.cpp
408 pv/widgets/decodermenu.cpp
409 )
410
411 list(APPEND pulseview_HEADERS
412 pv/data/decodesignal.hpp
413 pv/subwindows/decoder_selector/subwindow.hpp
414 pv/views/decoder_binary/view.hpp
415 pv/views/decoder_binary/QHexView.hpp
416 pv/views/tabular_decoder/view.hpp
417 pv/views/trace/decodetrace.hpp
418 pv/widgets/decodergroupbox.hpp
419 pv/widgets/decodermenu.hpp
420 )
421endif()
422
423if(WIN32)
424 # Use the sigrok icon for the pulseview.exe executable.
425 set(CMAKE_RC_COMPILE_OBJECT "${CMAKE_RC_COMPILER} -O coff -I${CMAKE_CURRENT_SOURCE_DIR} <SOURCE> <OBJECT>")
426 enable_language(RC)
427 list(APPEND pulseview_SOURCES pulseviewico.rc)
428endif()
429
430if(ANDROID)
431 list(APPEND pulseview_SOURCES
432 android/assetreader.cpp
433 android/loghandler.cpp
434 )
435endif()
436
437qt5_add_resources(pulseview_RESOURCES_RCC ${pulseview_RESOURCES})
438
439#===============================================================================
440#= Translations
441#-------------------------------------------------------------------------------
442
443file(GLOB TS_FILES ${CMAKE_SOURCE_DIR}/l10n/*.ts)
444set_property(SOURCE ${TS_FILES} PROPERTY OUTPUT_LOCATION ${CMAKE_BINARY_DIR}/l10n)
445if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
446 configure_file("translations.qrc" "translations.qrc" COPYONLY)
447endif ()
448
449qt5_add_translation(QM_FILES ${TS_FILES})
450qt5_create_translation(QM_FILES ${pulseview_SOURCES} ${TS_FILES})
451
452qt5_add_resources(pulseview_RESOURCES_RCC ${CMAKE_BINARY_DIR}/translations.qrc)
453
454#===============================================================================
455#= Global Definitions
456#-------------------------------------------------------------------------------
457
458add_definitions(-DQT_NO_KEYWORDS)
459add_definitions(-D__STDC_LIMIT_MACROS)
460add_definitions(-Wall -Wextra)
461add_definitions(-std=c++11)
462add_definitions(-DBOOST_MATH_DISABLE_FLOAT128=1)
463
464if(ENABLE_FLOW)
465 add_definitions(-DENABLE_FLOW)
466endif()
467
468if(ENABLE_DECODE)
469 add_definitions(-DENABLE_DECODE)
470endif()
471
472if(NOT DISABLE_WERROR)
473 add_definitions(-Werror)
474endif()
475
476if(ENABLE_SIGNALS)
477 add_definitions(-DENABLE_SIGNALS)
478endif()
479
480if(ENABLE_STACKTRACE)
481 add_definitions(-DENABLE_STACKTRACE -no-pie -fno-pie)
482 if (Backtrace_FOUND)
483 add_definitions(-DBOOST_STACKTRACE_USE_BACKTRACE)
484 endif()
485endif()
486
487#===============================================================================
488#= Global Include Directories
489#-------------------------------------------------------------------------------
490
491include_directories(
492 ${CMAKE_CURRENT_BINARY_DIR}
493 ${CMAKE_CURRENT_SOURCE_DIR}
494 ${Boost_INCLUDE_DIRS}
495)
496
497if(STATIC_PKGDEPS_LIBS)
498 include_directories(${PKGDEPS_STATIC_INCLUDE_DIRS})
499else()
500 include_directories(${PKGDEPS_INCLUDE_DIRS})
501endif()
502
503#===============================================================================
504#= Linker Configuration
505#-------------------------------------------------------------------------------
506
507link_directories(${Boost_LIBRARY_DIRS})
508
509set(PULSEVIEW_LINK_LIBS
510 ${Boost_LIBRARIES}
511 ${QT_LIBRARIES}
512 ${CMAKE_THREAD_LIBS_INIT}
513 ${LIBATOMIC_LIBRARY}
514)
515
516if(STATIC_PKGDEPS_LIBS)
517 link_directories(${PKGDEPS_STATIC_LIBRARY_DIRS})
518 list(APPEND PULSEVIEW_LINK_LIBS ${PKGDEPS_STATIC_LDFLAGS})
519else()
520 link_directories(${PKGDEPS_LIBRARY_DIRS})
521 list(APPEND PULSEVIEW_LINK_LIBS ${PKGDEPS_LIBRARIES})
522endif()
523
524if(WIN32)
525 # On Windows we need to statically link the libqsvg imageformat
526 # plugin (and the QtSvg component) for SVG graphics/icons to work.
527 # We also need QWindowsIntegrationPlugin, Qt5PlatformSupport (only for
528 # Qt < 5.8.0), and all Qt libs and their dependencies.
529 add_definitions(-DQT_STATICPLUGIN)
530 list(APPEND PULSEVIEW_LINK_LIBS Qt5::QSvgPlugin)
531 list(APPEND PULSEVIEW_LINK_LIBS Qt5::QWindowsIntegrationPlugin)
532 if(Qt5Gui_VERSION VERSION_LESS 5.8.0)
533 list(APPEND PULSEVIEW_LINK_LIBS -lQt5PlatformSupport)
534 endif()
535 list(APPEND PULSEVIEW_LINK_LIBS ${QT5ALL_LDFLAGS})
536endif()
537
538if(ENABLE_STACKTRACE)
539 list(APPEND PULSEVIEW_LINK_LIBS ${CMAKE_DL_LIBS} ${Backtrace_LIBRARIES})
540 link_libraries("-no-pie -fno-pie")
541endif()
542
543if(ANDROID)
544 list(APPEND PULSEVIEW_LINK_LIBS "-llog")
545endif()
546
547set(INPUT_FILES_LIST ${pulseview_SOURCES} ${pulseview_RESOURCES_RCC} ${QM_FILES})
548if(ANDROID)
549 add_library(${PROJECT_NAME} SHARED ${INPUT_FILES_LIST})
550else()
551 add_executable(${PROJECT_NAME} ${INPUT_FILES_LIST})
552endif()
553
554target_link_libraries(${PROJECT_NAME} ${PULSEVIEW_LINK_LIBS})
555
556if(WIN32 AND NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
557 # Pass -mwindows so that no "DOS box" opens when PulseView is started.
558 set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-mwindows")
559endif()
560
561#===============================================================================
562#= Installation
563#-------------------------------------------------------------------------------
564
565# Install the executable.
566install(TARGETS ${PROJECT_NAME} DESTINATION bin/)
567
568# Install the manpage.
569install(FILES doc/pulseview.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT doc)
570
571# Install the desktop file.
572install(FILES contrib/org.sigrok.PulseView.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
573
574# Install the AppData/AppStream file.
575install(FILES contrib/org.sigrok.PulseView.appdata.xml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo)
576
577# Install the PulseView icons.
578install(FILES icons/pulseview.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps)
579install(FILES icons/pulseview.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps)
580
581# Generate Windows installer script.
582configure_file(contrib/pulseview_cross.nsi.in ${CMAKE_CURRENT_BINARY_DIR}/contrib/pulseview_cross.nsi @ONLY)
583
584#===============================================================================
585#= Packaging (handled by CPack)
586#-------------------------------------------------------------------------------
587
588set(CPACK_PACKAGE_VERSION_MAJOR ${PV_VERSION_MAJOR})
589set(CPACK_PACKAGE_VERSION_MINOR ${PV_VERSION_MINOR})
590set(CPACK_PACKAGE_VERSION_PATCH ${PV_VERSION_MICRO})
591set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README)
592set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/COPYING)
593set(CPACK_SOURCE_IGNORE_FILES ${CMAKE_CURRENT_BINARY_DIR} ".gitignore" ".git")
594set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${PV_VERSION_STRING}")
595set(CPACK_SOURCE_GENERATOR "TGZ")
596
597include(CPack)
598
599#===============================================================================
600#= Tests
601#-------------------------------------------------------------------------------
602
603if(ENABLE_TESTS)
604 add_subdirectory(test)
605 enable_testing()
606 add_test(test ${CMAKE_CURRENT_BINARY_DIR}/test/pulseview-test)
607endif()