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