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