]> sigrok.org Git - pulseview.git/blame - CMakeLists.txt
Ruler: Add "Set as zero point" context menu entry
[pulseview.git] / CMakeLists.txt
CommitLineData
0aad432c 1##
190fc91a 2## This file is part of the PulseView project.
68c4a3b3
JH
3##
4## Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
3933e8a9 5## Copyright (C) 2012-2013 Alexandru Gagniuc <mr.nuke.me@gmail.com>
68c4a3b3
JH
6##
7## This program is free software: you can redistribute it and/or modify
8## it under the terms of the GNU General Public License as published by
9## the Free Software Foundation, either version 2 of the License, or
10## (at your option) any later version.
11##
12## This program is distributed in the hope that it will be useful,
13## but WITHOUT ANY WARRANTY; without even the implied warranty of
14## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15## GNU General Public License for more details.
16##
17## You should have received a copy of the GNU General Public License
18## along with this program. If not, see <http://www.gnu.org/licenses/>.
19##
20
e222f01e 21cmake_minimum_required(VERSION 2.8.12)
0cf9fb24 22
52bbe600 23include(GNUInstallDirs)
df944399 24
a8d3fb2d 25project(pulseview)
df944399 26
1c4ec8d0
UH
27# Let AUTOMOC and AUTOUIC process GENERATED files.
28if(POLICY CMP0071)
29 cmake_policy(SET CMP0071 NEW)
30endif()
31
2944860f
UH
32# Only interpret if() arguments as variables or keywords when unquoted.
33if(POLICY CMP0054)
34 cmake_policy(SET CMP0054 NEW)
35endif()
36
cf2b5b64
UH
37list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
38
30588653 39#===============================================================================
506523c1
JH
40#= User Options
41#-------------------------------------------------------------------------------
42
5c3c8c1e 43option(DISABLE_WERROR "Build without -Werror" TRUE)
140181a4 44option(ENABLE_SIGNALS "Build with UNIX signals" TRUE)
c1a688de 45option(ENABLE_STACKTRACE "Enable stack trace when crashing" FALSE)
19f511a4 46option(ENABLE_DECODE "Build with libsigrokdecode" TRUE)
b2d9be03 47option(ENABLE_TESTS "Enable unit tests" FALSE)
61e1e13e 48option(STATIC_PKGDEPS_LIBS "Statically link to (pkg-config) libraries" FALSE)
b04e278d
AG
49
50if(WIN32)
7d297a01
UH
51 # On Windows/MinGW we need to statically link to libraries.
52 # This option is user configurable, but enable it by default on win32.
b04e278d 53 set(STATIC_PKGDEPS_LIBS TRUE)
6987ceeb 54
0aad432c 55 # Windows does not support UNIX signals.
140181a4 56 set(ENABLE_SIGNALS FALSE)
b04e278d 57endif()
506523c1 58
552f686e 59if(NOT CMAKE_BUILD_TYPE)
7591fe23
UH
60 set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
61 "Choose the type of build (None, Debug, Release, RelWithDebInfo, MinSizeRel)."
62 FORCE)
552f686e
JH
63endif()
64
506523c1 65#===============================================================================
30588653
AG
66#= Dependencies
67#-------------------------------------------------------------------------------
68
e1e2666e 69list(APPEND PKGDEPS glib-2.0>=2.28.0)
d93ac5e8
UH
70list(APPEND PKGDEPS glibmm-2.4>=2.28.0)
71
844c4619
GS
72set(LIBSR_CXX_BINDING "libsigrokcxx>=0.6.0")
73list(APPEND PKGDEPS "${LIBSR_CXX_BINDING}")
df944399 74
269528f5 75if(ENABLE_DECODE)
e37a0c3e 76 list(APPEND PKGDEPS libsigrokdecode>=0.6.0)
269528f5
JH
77endif()
78
aff51746
MC
79if(ANDROID)
80 list(APPEND PKGDEPS libsigrokandroidutils>=0.1.0)
81endif()
82
d52d8455 83find_package(PkgConfig)
844c4619
GS
84pkg_check_modules(LIBSRCXX QUIET ${LIBSR_CXX_BINDING})
85if(NOT LIBSRCXX_FOUND OR NOT LIBSRCXX_VERSION)
86 message(FATAL_ERROR "libsigrok C++ bindings missing, check libsigrok's 'configure' output (missing dependencies?)")
87endif()
d52d8455
JH
88pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS})
89
e222f01e 90set(CMAKE_AUTOMOC TRUE)
e222f01e
UH
91
92find_package(Qt5 COMPONENTS Core Gui Widgets Svg REQUIRED)
e7ab88e3 93
09f55d96
UH
94if(WIN32)
95 # MXE workaround: Use pkg-config to find Qt5 libs.
96 # https://github.com/mxe/mxe/issues/1642
929b9b19
UH
97 # Not required (and doesn't work) on MSYS2.
98 if(NOT DEFINED ENV{MSYSTEM})
99 pkg_check_modules(QT5ALL REQUIRED Qt5Widgets Qt5Gui Qt5Svg)
100 endif()
09f55d96 101endif()
9e8e84fc 102
e7ab88e3 103set(QT_LIBRARIES Qt5::Gui Qt5::Widgets Qt5::Svg)
2e2946fe 104
b8f1cdeb 105set(BOOSTCOMPS filesystem serialization system)
226a1527 106if(ENABLE_TESTS)
d68d75c2 107 list(APPEND BOOSTCOMPS unit_test_framework)
2a21747e 108endif()
c1a688de
SA
109
110if(ENABLE_STACKTRACE)
111 find_package(Boost 1.65.1 COMPONENTS ${BOOSTCOMPS} REQUIRED)
112else()
113 find_package(Boost 1.55 COMPONENTS ${BOOSTCOMPS} REQUIRED)
114endif()
df944399 115
858ae630
UH
116# Find the platform's thread library (needed for C++11 threads).
117# This will set ${CMAKE_THREAD_LIBS_INIT} to the correct, OS-specific value.
2b76309a
AJ
118find_package(Threads REQUIRED)
119
4da54b6b
SM
120# Check for explicit link against libatomic
121#
122# Depending on the toolchain, linking a program using atomic functions may need
123# "-latomic" explicitly passed to the linker
124#
125# This check first tests if atomics are available in the C-library, if not and
126# libatomic exists, then it runs the same test with -latomic added to the
127# linker flags.
128
129# Helper for checking for atomics
130function(check_working_cxx_atomics varname additional_lib)
131 include(CheckCXXSourceCompiles)
132 include(CMakePushCheckState)
133 cmake_push_check_state()
134 set(CMAKE_REQUIRED_FLAGS "-std=c++11")
135 set(CMAKE_REQUIRED_LIBRARIES "${additional_lib}")
136 set(CMAKE_REQUIRED_QUIET 1)
137 CHECK_CXX_SOURCE_COMPILES("
138#include <atomic>
139std::atomic<int> x;
140int main() {
141 return std::atomic_fetch_add_explicit(&x, 1, std::memory_order_seq_cst);
142}
143" ${varname})
144 cmake_pop_check_state()
145endfunction(check_working_cxx_atomics)
146
147# First check if atomics work without the library.
148# If not, check if the library exists, and atomics work with it.
149check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB "")
150if(HAVE_CXX_ATOMICS_WITHOUT_LIB)
151 message(STATUS "Atomics provided by the C-library - yes")
152else()
153 message(STATUS "Atomics provided by the C-library - no")
154 find_library(LIBATOMIC_LIBRARY NAMES atomic PATH_SUFFIXES lib)
155 if(LIBATOMIC_LIBRARY)
156 check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB "${LIBATOMIC_LIBRARY}")
157 if (HAVE_CXX_ATOMICS_WITH_LIB)
158 message(STATUS "Atomics provided by libatomic - yes")
159 else()
160 message(STATUS "Atomics provided by libatomic - no")
161 message(FATAL_ERROR "Compiler must support std::atomic!")
162 endif()
163 else()
164 message(FATAL_ERROR "Compiler appears to require libatomic, but cannot find it.")
165 endif()
166endif()
167
9df8453f
MC
168#===============================================================================
169#= System Introspection
170#-------------------------------------------------------------------------------
171
172include(memaccess)
173memaccess_check_unaligned_le(HAVE_UNALIGNED_LITTLE_ENDIAN_ACCESS)
174
075fb499
AG
175#===============================================================================
176#= Config Header
177#-------------------------------------------------------------------------------
178
f7951df4 179set(PV_TITLE PulseView)
e2649143 180set(PV_VERSION_STRING "0.5.0")
f7951df4 181
d93ac5e8
UH
182set(PV_GLIBMM_VERSION ${PKGDEPS_glibmm-2.4_VERSION})
183
1e8c82e9 184include(GetGitRevisionDescription)
1e8c82e9 185
812c0e35
DE
186# Append the revision hash unless we are exactly on a tagged release.
187git_describe(PV_TAG_VERSION_STRING --match "pulseview-${PV_VERSION_STRING}" --exact-match)
188if(NOT PV_TAG_VERSION_STRING)
189 get_git_head_revision(PV_REVSPEC PV_HASH)
190 if(PV_HASH)
191 string(SUBSTRING "${PV_HASH}" 0 7 PV_SHORTHASH)
192 set(PV_VERSION_STRING "${PV_VERSION_STRING}-git-${PV_SHORTHASH}")
d69b3c31
DE
193 endif()
194endif()
195
196if(PV_VERSION_STRING MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)(-[-0-9a-z]*)?$")
1e8c82e9
DE
197 set(PV_VERSION_MAJOR ${CMAKE_MATCH_1})
198 set(PV_VERSION_MINOR ${CMAKE_MATCH_2})
199 set(PV_VERSION_MICRO ${CMAKE_MATCH_3})
200 set(PV_VERSION_SUFFIX ${CMAKE_MATCH_4})
1e8c82e9
DE
201endif()
202
1e3a52e3 203message(STATUS "${PV_TITLE} version: ${PV_VERSION_STRING}")
075fb499
AG
204
205configure_file (
206 ${PROJECT_SOURCE_DIR}/config.h.in
207 ${PROJECT_BINARY_DIR}/config.h
208)
df944399 209
30588653
AG
210#===============================================================================
211#= Sources
212#-------------------------------------------------------------------------------
213
a8d3fb2d 214set(pulseview_SOURCES
df944399 215 main.cpp
dac1bb97 216 pv/application.cpp
107ca6d3 217 pv/devicemanager.cpp
bf9f1268 218 pv/globalsettings.cpp
bcb4c327 219 pv/logging.cpp
51e77110 220 pv/mainwindow.cpp
f65cd27b 221 pv/session.cpp
0fbda3c2 222 pv/storesession.cpp
f0c9f81c 223 pv/util.cpp
61703a01 224 pv/binding/binding.cpp
0c913637 225 pv/binding/inputoutput.cpp
3cc9ad7b 226 pv/binding/device.cpp
1b1ec774 227 pv/data/analog.cpp
f3d66e52 228 pv/data/analogsegment.cpp
1b1ec774 229 pv/data/logic.cpp
f3d66e52 230 pv/data/logicsegment.cpp
bf0edd2b 231 pv/data/signalbase.cpp
1b1ec774 232 pv/data/signaldata.cpp
f3d66e52 233 pv/data/segment.cpp
da30ecb7 234 pv/devices/device.cpp
474e817a 235 pv/devices/file.cpp
da30ecb7 236 pv/devices/hardwaredevice.cpp
5237f0c5 237 pv/devices/inputfile.cpp
da30ecb7 238 pv/devices/sessionfile.cpp
9663c82b 239 pv/dialogs/connect.cpp
e93f5538 240 pv/dialogs/inputoutputoptions.cpp
bf9f1268 241 pv/dialogs/settings.cpp
0fbda3c2 242 pv/dialogs/storeprogress.cpp
51d4a9ab 243 pv/popups/deviceoptions.cpp
6ac6242b 244 pv/popups/channels.cpp
de1d99bb 245 pv/prop/bool.cpp
b912c99c 246 pv/prop/double.cpp
820c3dea 247 pv/prop/enum.cpp
a2b92157 248 pv/prop/int.cpp
c8df6005 249 pv/prop/property.cpp
7112a458 250 pv/prop/string.cpp
7c657094 251 pv/toolbars/mainbar.cpp
1573bf16
SA
252 pv/views/trace/analogsignal.cpp
253 pv/views/trace/cursor.cpp
254 pv/views/trace/cursorpair.cpp
255 pv/views/trace/flag.cpp
256 pv/views/trace/header.cpp
257 pv/views/trace/marginwidget.cpp
258 pv/views/trace/logicsignal.cpp
259 pv/views/trace/rowitem.cpp
260 pv/views/trace/ruler.cpp
261 pv/views/trace/signal.cpp
1573bf16
SA
262 pv/views/trace/timeitem.cpp
263 pv/views/trace/timemarker.cpp
264 pv/views/trace/trace.cpp
265 pv/views/trace/tracegroup.cpp
266 pv/views/trace/tracepalette.cpp
267 pv/views/trace/tracetreeitem.cpp
268 pv/views/trace/tracetreeitemowner.cpp
269 pv/views/trace/triggermarker.cpp
270 pv/views/trace/view.cpp
271 pv/views/trace/viewitem.cpp
272 pv/views/trace/viewitemowner.cpp
273 pv/views/trace/viewitempaintparams.cpp
274 pv/views/trace/viewport.cpp
275 pv/views/trace/viewwidget.cpp
f4e57597 276 pv/views/viewbase.cpp
e0ba4f6f 277 pv/views/trace/standardbar.cpp
641574bc
SA
278 pv/widgets/colorbutton.cpp
279 pv/widgets/colorpopup.cpp
079d39ea 280 pv/widgets/devicetoolbutton.cpp
ce6001b8 281 pv/widgets/exportmenu.cpp
56b6fc88 282 pv/widgets/importmenu.cpp
6e3f046e 283 pv/widgets/popup.cpp
6a91973f 284 pv/widgets/popuptoolbutton.cpp
1198b887 285 pv/widgets/sweeptimingwidget.cpp
806d3e1e 286 pv/widgets/timestampspinbox.cpp
0c0e1888 287 pv/widgets/wellarray.cpp
df944399
JH
288)
289
0aad432c 290# This list includes only QObject derived class headers.
a8d3fb2d 291set(pulseview_HEADERS
bcb4c327 292 pv/logging.hpp
bf9f1268 293 pv/globalsettings.hpp
2acdb232 294 pv/mainwindow.hpp
f65cd27b 295 pv/session.hpp
2acdb232 296 pv/storesession.hpp
3cc9ad7b 297 pv/binding/device.hpp
7db61e77
SA
298 pv/data/analog.hpp
299 pv/data/analogsegment.hpp
300 pv/data/logic.hpp
301 pv/data/logicsegment.hpp
bf0edd2b 302 pv/data/signalbase.hpp
2acdb232 303 pv/dialogs/connect.hpp
e93f5538 304 pv/dialogs/inputoutputoptions.hpp
bf9f1268 305 pv/dialogs/settings.hpp
2acdb232
JH
306 pv/dialogs/storeprogress.hpp
307 pv/popups/channels.hpp
308 pv/popups/deviceoptions.hpp
309 pv/prop/bool.hpp
310 pv/prop/double.hpp
311 pv/prop/enum.hpp
312 pv/prop/int.hpp
313 pv/prop/property.hpp
314 pv/prop/string.hpp
7c657094 315 pv/toolbars/mainbar.hpp
1573bf16
SA
316 pv/views/trace/analogsignal.hpp
317 pv/views/trace/cursor.hpp
318 pv/views/trace/flag.hpp
319 pv/views/trace/header.hpp
320 pv/views/trace/logicsignal.hpp
321 pv/views/trace/marginwidget.hpp
322 pv/views/trace/rowitem.hpp
323 pv/views/trace/ruler.hpp
324 pv/views/trace/signal.hpp
1573bf16
SA
325 pv/views/trace/timeitem.hpp
326 pv/views/trace/timemarker.hpp
327 pv/views/trace/trace.hpp
328 pv/views/trace/tracegroup.hpp
329 pv/views/trace/tracetreeitem.hpp
330 pv/views/trace/triggermarker.hpp
331 pv/views/trace/view.hpp
332 pv/views/trace/viewitem.hpp
333 pv/views/trace/viewport.hpp
334 pv/views/trace/viewwidget.hpp
f4e57597 335 pv/views/viewbase.hpp
e0ba4f6f 336 pv/views/trace/standardbar.hpp
641574bc
SA
337 pv/widgets/colorbutton.hpp
338 pv/widgets/colorpopup.hpp
079d39ea 339 pv/widgets/devicetoolbutton.hpp
ce6001b8 340 pv/widgets/exportmenu.hpp
56b6fc88 341 pv/widgets/importmenu.hpp
2acdb232
JH
342 pv/widgets/popup.hpp
343 pv/widgets/popuptoolbutton.hpp
344 pv/widgets/sweeptimingwidget.hpp
806d3e1e 345 pv/widgets/timestampspinbox.hpp
2acdb232 346 pv/widgets/wellarray.hpp
df944399
JH
347)
348
8b9056d4
UH
349set(pulseview_RESOURCES
350 pulseview.qrc
351)
352
140181a4
JH
353if(ENABLE_SIGNALS)
354 list(APPEND pulseview_SOURCES signalhandler.cpp)
2acdb232 355 list(APPEND pulseview_HEADERS signalhandler.hpp)
140181a4
JH
356endif()
357
269528f5
JH
358if(ENABLE_DECODE)
359 list(APPEND pulseview_SOURCES
3cc9ad7b 360 pv/binding/decoder.cpp
ad908057 361 pv/data/decodesignal.cpp
269528f5
JH
362 pv/data/decode/annotation.cpp
363 pv/data/decode/decoder.cpp
f9101a91
JH
364 pv/data/decode/row.cpp
365 pv/data/decode/rowdata.cpp
1573bf16 366 pv/views/trace/decodetrace.cpp
269528f5
JH
367 pv/widgets/decodergroupbox.cpp
368 pv/widgets/decodermenu.cpp
269528f5
JH
369 )
370
371 list(APPEND pulseview_HEADERS
ad908057 372 pv/data/decodesignal.hpp
1573bf16 373 pv/views/trace/decodetrace.hpp
2acdb232
JH
374 pv/widgets/decodergroupbox.hpp
375 pv/widgets/decodermenu.hpp
269528f5
JH
376 )
377endif()
378
fe15e0bc
UH
379if(WIN32)
380 # Use the sigrok icon for the pulseview.exe executable.
381 set(CMAKE_RC_COMPILE_OBJECT "${CMAKE_RC_COMPILER} -O coff -I${CMAKE_CURRENT_SOURCE_DIR} <SOURCE> <OBJECT>")
382 enable_language(RC)
61e1e13e 383 list(APPEND pulseview_SOURCES pulseviewico.rc)
fe15e0bc
UH
384endif()
385
9137928c 386if(ANDROID)
dddff2e7
DE
387 list(APPEND pulseview_SOURCES
388 android/assetreader.cpp
389 android/loghandler.cpp
390 )
9137928c
MC
391endif()
392
8b9056d4
UH
393qt5_add_resources(pulseview_RESOURCES_RCC ${pulseview_RESOURCES})
394
30588653
AG
395#===============================================================================
396#= Global Definitions
397#-------------------------------------------------------------------------------
398
e222f01e 399add_definitions(-DQT_NO_KEYWORDS)
ac223c1e 400add_definitions(-D__STDC_LIMIT_MACROS)
a9974171 401add_definitions(-Wall -Wextra)
95d43108 402add_definitions(-std=c++11)
a838ed7b 403add_definitions(-DBOOST_MATH_DISABLE_FLOAT128=1)
5f606159 404
269528f5
JH
405if(ENABLE_DECODE)
406 add_definitions(-DENABLE_DECODE)
407endif()
408
5f606159
JH
409if(NOT DISABLE_WERROR)
410 add_definitions(-Werror)
411endif()
df944399 412
9632990d
UH
413if(ENABLE_SIGNALS)
414 add_definitions(-DENABLE_SIGNALS)
415endif()
416
c1a688de
SA
417if(ENABLE_STACKTRACE)
418 add_definitions(-DENABLE_STACKTRACE)
419endif()
420
30588653
AG
421#===============================================================================
422#= Global Include Directories
423#-------------------------------------------------------------------------------
424
b04e278d
AG
425include_directories(
426 ${CMAKE_CURRENT_BINARY_DIR}
cef18fc6 427 ${CMAKE_CURRENT_SOURCE_DIR}
b04e278d
AG
428 ${Boost_INCLUDE_DIRS}
429)
430
431if(STATIC_PKGDEPS_LIBS)
432 include_directories(${PKGDEPS_STATIC_INCLUDE_DIRS})
433else()
434 include_directories(${PKGDEPS_INCLUDE_DIRS})
435endif()
df944399 436
30588653
AG
437#===============================================================================
438#= Linker Configuration
439#-------------------------------------------------------------------------------
440
b04e278d
AG
441link_directories(${Boost_LIBRARY_DIRS})
442
443set(PULSEVIEW_LINK_LIBS
444 ${Boost_LIBRARIES}
445 ${QT_LIBRARIES}
2b76309a 446 ${CMAKE_THREAD_LIBS_INIT}
4da54b6b 447 ${LIBATOMIC_LIBRARY}
b04e278d
AG
448)
449
450if(STATIC_PKGDEPS_LIBS)
cddf172d 451 link_directories(${PKGDEPS_STATIC_LIBRARY_DIRS})
09f55d96 452 list(APPEND PULSEVIEW_LINK_LIBS ${PKGDEPS_STATIC_LDFLAGS})
b04e278d 453else()
cddf172d
UH
454 link_directories(${PKGDEPS_LIBRARY_DIRS})
455 list(APPEND PULSEVIEW_LINK_LIBS ${PKGDEPS_LIBRARIES})
b04e278d 456endif()
df944399 457
11a04e2a
UH
458if(WIN32)
459 # On Windows we need to statically link the libqsvg imageformat
460 # plugin (and the QtSvg component) for SVG graphics/icons to work.
356fb5c0
UH
461 # We also need QWindowsIntegrationPlugin, Qt5PlatformSupport (only for
462 # Qt < 5.8.0), and all Qt libs and their dependencies.
11a04e2a 463 add_definitions(-DQT_STATICPLUGIN)
09f55d96
UH
464 list(APPEND PULSEVIEW_LINK_LIBS Qt5::QSvgPlugin)
465 list(APPEND PULSEVIEW_LINK_LIBS Qt5::QWindowsIntegrationPlugin)
356fb5c0
UH
466 if(Qt5Gui_VERSION VERSION_LESS 5.8.0)
467 list(APPEND PULSEVIEW_LINK_LIBS -lQt5PlatformSupport)
468 endif()
469 list(APPEND PULSEVIEW_LINK_LIBS ${QT5ALL_LDFLAGS})
11a04e2a
UH
470endif()
471
c1a688de
SA
472if(ENABLE_STACKTRACE)
473 # Needed to resolve dladdr.
474 list(APPEND PULSEVIEW_LINK_LIBS "-ldl")
475endif()
476
9137928c
MC
477if(ANDROID)
478 list(APPEND PULSEVIEW_LINK_LIBS "-llog")
479endif()
480
26807061 481if(ANDROID)
8b9056d4 482 add_library(${PROJECT_NAME} SHARED ${pulseview_SOURCES} ${pulseview_RESOURCES_RCC})
26807061 483else()
8b9056d4 484 add_executable(${PROJECT_NAME} ${pulseview_SOURCES} ${pulseview_RESOURCES_RCC})
26807061 485endif()
df944399 486
5a13850b 487target_link_libraries(${PROJECT_NAME} ${PULSEVIEW_LINK_LIBS})
f0fa92c6 488
b732b48f 489if(WIN32 AND NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
61e1e13e
UH
490 # Pass -mwindows so that no "DOS box" opens when PulseView is started.
491 set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-mwindows")
b0d8c0dc
UH
492endif()
493
30588653
AG
494#===============================================================================
495#= Installation
496#-------------------------------------------------------------------------------
497
52bbe600 498# Install the executable.
cd6606c2
AG
499install(TARGETS ${PROJECT_NAME} DESTINATION bin/)
500
52bbe600
UH
501# Install the manpage.
502install(FILES doc/pulseview.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT doc)
503
96e282c4
UH
504# Install the desktop file.
505install(FILES contrib/org.sigrok.PulseView.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
506
22fc985b
UH
507# Install the AppData/AppStream file.
508install(FILES contrib/org.sigrok.PulseView.appdata.xml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo)
509
09594425
UH
510# Install the PulseView icons.
511install(FILES icons/pulseview.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps)
512install(FILES icons/pulseview.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps)
513
f9cb49cc
DE
514# Generate Windows installer script.
515configure_file(contrib/pulseview_cross.nsi.in contrib/pulseview_cross.nsi @ONLY)
516
cd6606c2
AG
517#===============================================================================
518#= Packaging (handled by CPack)
519#-------------------------------------------------------------------------------
520
b02a8cbf
JH
521set(CPACK_PACKAGE_VERSION_MAJOR ${PV_VERSION_MAJOR})
522set(CPACK_PACKAGE_VERSION_MINOR ${PV_VERSION_MINOR})
523set(CPACK_PACKAGE_VERSION_PATCH ${PV_VERSION_MICRO})
cd6606c2
AG
524set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README)
525set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/COPYING)
526set(CPACK_SOURCE_IGNORE_FILES ${CMAKE_CURRENT_BINARY_DIR} ".gitignore" ".git")
1e8c82e9 527set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${PV_VERSION_STRING}")
1d2fb87d 528set(CPACK_SOURCE_GENERATOR "TGZ")
cd6606c2
AG
529
530include(CPack)
bc1c1462 531
30588653
AG
532#===============================================================================
533#= Tests
534#-------------------------------------------------------------------------------
535
77e8ac52 536if(ENABLE_TESTS)
fb746bcc 537 add_subdirectory(test)
951c583c 538 enable_testing()
fb746bcc 539 add_test(test ${CMAKE_CURRENT_BINARY_DIR}/test/pulseview-test)
0aad432c 540endif()