]>
Commit | Line | Data |
---|---|---|
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 | ||
7ba41e7e | 21 | cmake_minimum_required(VERSION 2.8.6) |
0cf9fb24 | 22 | |
52bbe600 | 23 | include(GNUInstallDirs) |
df944399 | 24 | |
a8d3fb2d | 25 | project(pulseview) |
df944399 | 26 | |
cf2b5b64 UH |
27 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake") |
28 | ||
30588653 | 29 | #=============================================================================== |
506523c1 JH |
30 | #= User Options |
31 | #------------------------------------------------------------------------------- | |
32 | ||
5f606159 | 33 | option(DISABLE_WERROR "Build without -Werror" FALSE) |
140181a4 | 34 | option(ENABLE_SIGNALS "Build with UNIX signals" TRUE) |
19f511a4 | 35 | option(ENABLE_DECODE "Build with libsigrokdecode" TRUE) |
f513bec5 | 36 | option(ENABLE_TESTS "Enable unit tests" TRUE) |
61e1e13e | 37 | option(STATIC_PKGDEPS_LIBS "Statically link to (pkg-config) libraries" FALSE) |
9e8e84fc | 38 | option(FORCE_QT4 "Force use of Qt4 even if Qt5 is available" FALSE) |
b04e278d AG |
39 | |
40 | if(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 | |
2a21747e UH |
45 | # For boost-thread we need two additional settings on win32: |
46 | set(Boost_USE_STATIC_LIBS ON) | |
47 | add_definitions(-DBOOST_THREAD_USE_LIB) | |
48 | ||
e6fd809f UH |
49 | # On Windows/MinGW we need to use 'thread_win32' instead of 'thread'. |
50 | # The library is named libboost_thread_win32* (not libboost_thread*). | |
51 | set(Boost_THREADAPI win32) | |
52 | ||
0aad432c | 53 | # Windows does not support UNIX signals. |
140181a4 | 54 | set(ENABLE_SIGNALS FALSE) |
b04e278d | 55 | endif() |
506523c1 | 56 | |
552f686e | 57 | if(NOT CMAKE_BUILD_TYPE) |
7591fe23 UH |
58 | set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING |
59 | "Choose the type of build (None, Debug, Release, RelWithDebInfo, MinSizeRel)." | |
60 | FORCE) | |
552f686e JH |
61 | endif() |
62 | ||
506523c1 | 63 | #=============================================================================== |
30588653 AG |
64 | #= Dependencies |
65 | #------------------------------------------------------------------------------- | |
66 | ||
68ef4b9d | 67 | list(APPEND PKGDEPS libsigrokcxx>=0.4.0) |
df944399 | 68 | |
269528f5 | 69 | if(ENABLE_DECODE) |
68ef4b9d | 70 | list(APPEND PKGDEPS libsigrokdecode>=0.4.0) |
269528f5 JH |
71 | endif() |
72 | ||
aff51746 MC |
73 | if(ANDROID) |
74 | list(APPEND PKGDEPS libsigrokandroidutils>=0.1.0) | |
75 | endif() | |
76 | ||
d52d8455 JH |
77 | find_package(PkgConfig) |
78 | pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS}) | |
79 | ||
9e8e84fc MC |
80 | if(FORCE_QT4) |
81 | set(Qt5Core_FOUND FALSE) | |
82 | else() | |
83 | find_package(Qt5Core QUIET) | |
84 | endif() | |
85 | ||
86 | if(Qt5Core_FOUND) | |
87 | message("-- Using Qt5") | |
88 | find_package(Qt5Widgets REQUIRED) | |
89 | find_package(Qt5Gui REQUIRED) | |
726ea667 | 90 | find_package(Qt5Svg REQUIRED) |
1cd4be22 | 91 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") |
ea370bc6 | 92 | set(QT_INCLUDE_DIRS ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS}) |
726ea667 | 93 | set(QT_LIBRARIES Qt5::Gui Qt5::Widgets Qt5::Svg) |
9e8e84fc MC |
94 | add_definitions(${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS}) |
95 | else() | |
96 | find_program(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 qmake-mac) | |
52f38de6 | 97 | find_package(Qt4 REQUIRED QtCore QtGui QtSvg) |
9e8e84fc | 98 | endif() |
2e2946fe | 99 | |
226a1527 | 100 | if(ENABLE_TESTS) |
06ef804f | 101 | find_package(Boost 1.53 COMPONENTS filesystem system thread unit_test_framework REQUIRED) |
2a21747e | 102 | else() |
06ef804f | 103 | find_package(Boost 1.53 COMPONENTS filesystem system thread REQUIRED) |
2a21747e | 104 | endif() |
df944399 | 105 | |
858ae630 UH |
106 | # Find the platform's thread library (needed for C++11 threads). |
107 | # This will set ${CMAKE_THREAD_LIBS_INIT} to the correct, OS-specific value. | |
2b76309a AJ |
108 | find_package(Threads REQUIRED) |
109 | ||
9df8453f MC |
110 | #=============================================================================== |
111 | #= System Introspection | |
112 | #------------------------------------------------------------------------------- | |
113 | ||
114 | include(memaccess) | |
115 | memaccess_check_unaligned_le(HAVE_UNALIGNED_LITTLE_ENDIAN_ACCESS) | |
116 | ||
075fb499 AG |
117 | #=============================================================================== |
118 | #= Config Header | |
119 | #------------------------------------------------------------------------------- | |
120 | ||
f7951df4 | 121 | set(PV_TITLE PulseView) |
d4384c6d | 122 | set(PV_DESCRIPTION "A GUI for sigrok") |
4a9e84ca | 123 | set(PV_VERSION_STRING "0.4.0") |
f7951df4 | 124 | |
1e8c82e9 | 125 | include(GetGitRevisionDescription) |
1e8c82e9 | 126 | |
812c0e35 DE |
127 | # Append the revision hash unless we are exactly on a tagged release. |
128 | git_describe(PV_TAG_VERSION_STRING --match "pulseview-${PV_VERSION_STRING}" --exact-match) | |
129 | if(NOT PV_TAG_VERSION_STRING) | |
130 | get_git_head_revision(PV_REVSPEC PV_HASH) | |
131 | if(PV_HASH) | |
132 | string(SUBSTRING "${PV_HASH}" 0 7 PV_SHORTHASH) | |
133 | set(PV_VERSION_STRING "${PV_VERSION_STRING}-git-${PV_SHORTHASH}") | |
d69b3c31 DE |
134 | endif() |
135 | endif() | |
136 | ||
137 | if(PV_VERSION_STRING MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)(-[-0-9a-z]*)?$") | |
1e8c82e9 DE |
138 | set(PV_VERSION_MAJOR ${CMAKE_MATCH_1}) |
139 | set(PV_VERSION_MINOR ${CMAKE_MATCH_2}) | |
140 | set(PV_VERSION_MICRO ${CMAKE_MATCH_3}) | |
141 | set(PV_VERSION_SUFFIX ${CMAKE_MATCH_4}) | |
1e8c82e9 DE |
142 | endif() |
143 | ||
1e8c82e9 | 144 | message("-- ${PV_TITLE} version: ${PV_VERSION_STRING}") |
075fb499 AG |
145 | |
146 | configure_file ( | |
147 | ${PROJECT_SOURCE_DIR}/config.h.in | |
148 | ${PROJECT_BINARY_DIR}/config.h | |
149 | ) | |
df944399 | 150 | |
30588653 AG |
151 | #=============================================================================== |
152 | #= Sources | |
153 | #------------------------------------------------------------------------------- | |
154 | ||
a8d3fb2d | 155 | set(pulseview_SOURCES |
df944399 | 156 | main.cpp |
dac1bb97 | 157 | pv/application.cpp |
107ca6d3 | 158 | pv/devicemanager.cpp |
51e77110 | 159 | pv/mainwindow.cpp |
f65cd27b | 160 | pv/session.cpp |
0fbda3c2 | 161 | pv/storesession.cpp |
f0c9f81c | 162 | pv/util.cpp |
61703a01 | 163 | pv/binding/binding.cpp |
0c913637 | 164 | pv/binding/inputoutput.cpp |
3cc9ad7b | 165 | pv/binding/device.cpp |
1b1ec774 | 166 | pv/data/analog.cpp |
f3d66e52 | 167 | pv/data/analogsegment.cpp |
1b1ec774 | 168 | pv/data/logic.cpp |
f3d66e52 | 169 | pv/data/logicsegment.cpp |
1b1ec774 | 170 | pv/data/signaldata.cpp |
f3d66e52 | 171 | pv/data/segment.cpp |
da30ecb7 | 172 | pv/devices/device.cpp |
474e817a | 173 | pv/devices/file.cpp |
da30ecb7 | 174 | pv/devices/hardwaredevice.cpp |
5237f0c5 | 175 | pv/devices/inputfile.cpp |
da30ecb7 | 176 | pv/devices/sessionfile.cpp |
acda14b8 | 177 | pv/dialogs/about.cpp |
9663c82b | 178 | pv/dialogs/connect.cpp |
e93f5538 | 179 | pv/dialogs/inputoutputoptions.cpp |
0fbda3c2 | 180 | pv/dialogs/storeprogress.cpp |
51d4a9ab | 181 | pv/popups/deviceoptions.cpp |
6ac6242b | 182 | pv/popups/channels.cpp |
de1d99bb | 183 | pv/prop/bool.cpp |
b912c99c | 184 | pv/prop/double.cpp |
820c3dea | 185 | pv/prop/enum.cpp |
a2b92157 | 186 | pv/prop/int.cpp |
c8df6005 | 187 | pv/prop/property.cpp |
7112a458 | 188 | pv/prop/string.cpp |
7c657094 | 189 | pv/toolbars/mainbar.cpp |
aba1dd16 | 190 | pv/view/analogsignal.cpp |
cabce982 | 191 | pv/view/cursor.cpp |
b42d25c4 | 192 | pv/view/cursorpair.cpp |
8914fe79 | 193 | pv/view/flag.cpp |
1d8dca91 | 194 | pv/view/header.cpp |
c23b29d6 | 195 | pv/view/marginwidget.cpp |
8d634081 | 196 | pv/view/logicsignal.cpp |
7c8b6ad2 | 197 | pv/view/rowitem.cpp |
ccdd3ef5 | 198 | pv/view/ruler.cpp |
8d634081 | 199 | pv/view/signal.cpp |
f1626bb8 | 200 | pv/view/signalscalehandle.cpp |
ad341c3a | 201 | pv/view/timeitem.cpp |
cd6c8ee2 | 202 | pv/view/timemarker.cpp |
931f20b0 | 203 | pv/view/trace.cpp |
722930c1 | 204 | pv/view/tracegroup.cpp |
91e8bf08 | 205 | pv/view/tracepalette.cpp |
af503b10 JH |
206 | pv/view/tracetreeitem.cpp |
207 | pv/view/tracetreeitemowner.cpp | |
51ae69ae | 208 | pv/view/triggermarker.cpp |
cdf7bea7 | 209 | pv/view/view.cpp |
26e3af6b | 210 | pv/view/viewitem.cpp |
c373f828 | 211 | pv/view/viewitemowner.cpp |
5b5fa4da | 212 | pv/view/viewitempaintparams.cpp |
cdf7bea7 | 213 | pv/view/viewport.cpp |
40aca27e | 214 | pv/view/viewwidget.cpp |
91e8bf08 JH |
215 | pv/widgets/colourbutton.cpp |
216 | pv/widgets/colourpopup.cpp | |
079d39ea | 217 | pv/widgets/devicetoolbutton.cpp |
ce6001b8 | 218 | pv/widgets/exportmenu.cpp |
1c4c23b8 | 219 | pv/widgets/hidingmenubar.cpp |
56b6fc88 | 220 | pv/widgets/importmenu.cpp |
6e3f046e | 221 | pv/widgets/popup.cpp |
6a91973f | 222 | pv/widgets/popuptoolbutton.cpp |
1198b887 | 223 | pv/widgets/sweeptimingwidget.cpp |
806d3e1e | 224 | pv/widgets/timestampspinbox.cpp |
0c0e1888 | 225 | pv/widgets/wellarray.cpp |
df944399 JH |
226 | ) |
227 | ||
0aad432c | 228 | # This list includes only QObject derived class headers. |
a8d3fb2d | 229 | set(pulseview_HEADERS |
2acdb232 | 230 | pv/mainwindow.hpp |
f65cd27b | 231 | pv/session.hpp |
2acdb232 | 232 | pv/storesession.hpp |
3cc9ad7b | 233 | pv/binding/device.hpp |
2acdb232 JH |
234 | pv/dialogs/about.hpp |
235 | pv/dialogs/connect.hpp | |
e93f5538 | 236 | pv/dialogs/inputoutputoptions.hpp |
2acdb232 JH |
237 | pv/dialogs/storeprogress.hpp |
238 | pv/popups/channels.hpp | |
239 | pv/popups/deviceoptions.hpp | |
240 | pv/prop/bool.hpp | |
241 | pv/prop/double.hpp | |
242 | pv/prop/enum.hpp | |
243 | pv/prop/int.hpp | |
244 | pv/prop/property.hpp | |
245 | pv/prop/string.hpp | |
7c657094 | 246 | pv/toolbars/mainbar.hpp |
2acdb232 | 247 | pv/view/cursor.hpp |
8914fe79 | 248 | pv/view/flag.hpp |
2acdb232 JH |
249 | pv/view/header.hpp |
250 | pv/view/logicsignal.hpp | |
251 | pv/view/marginwidget.hpp | |
252 | pv/view/rowitem.hpp | |
253 | pv/view/ruler.hpp | |
2acdb232 | 254 | pv/view/signal.hpp |
f1626bb8 | 255 | pv/view/signalscalehandle.hpp |
ad341c3a | 256 | pv/view/timeitem.hpp |
2acdb232 JH |
257 | pv/view/timemarker.hpp |
258 | pv/view/trace.hpp | |
259 | pv/view/tracegroup.hpp | |
af503b10 | 260 | pv/view/tracetreeitem.hpp |
51ae69ae | 261 | pv/view/triggermarker.hpp |
2acdb232 | 262 | pv/view/view.hpp |
26e3af6b | 263 | pv/view/viewitem.hpp |
2acdb232 | 264 | pv/view/viewport.hpp |
40aca27e | 265 | pv/view/viewwidget.hpp |
2acdb232 JH |
266 | pv/widgets/colourbutton.hpp |
267 | pv/widgets/colourpopup.hpp | |
079d39ea | 268 | pv/widgets/devicetoolbutton.hpp |
ce6001b8 | 269 | pv/widgets/exportmenu.hpp |
1c4c23b8 | 270 | pv/widgets/hidingmenubar.hpp |
56b6fc88 | 271 | pv/widgets/importmenu.hpp |
2acdb232 JH |
272 | pv/widgets/popup.hpp |
273 | pv/widgets/popuptoolbutton.hpp | |
274 | pv/widgets/sweeptimingwidget.hpp | |
806d3e1e | 275 | pv/widgets/timestampspinbox.hpp |
2acdb232 | 276 | pv/widgets/wellarray.hpp |
df944399 JH |
277 | ) |
278 | ||
a8d3fb2d | 279 | set(pulseview_FORMS |
acda14b8 | 280 | pv/dialogs/about.ui |
df944399 JH |
281 | ) |
282 | ||
a8d3fb2d JH |
283 | set(pulseview_RESOURCES |
284 | pulseview.qrc | |
df944399 JH |
285 | ) |
286 | ||
140181a4 JH |
287 | if(ENABLE_SIGNALS) |
288 | list(APPEND pulseview_SOURCES signalhandler.cpp) | |
2acdb232 | 289 | list(APPEND pulseview_HEADERS signalhandler.hpp) |
140181a4 JH |
290 | endif() |
291 | ||
269528f5 JH |
292 | if(ENABLE_DECODE) |
293 | list(APPEND pulseview_SOURCES | |
3cc9ad7b | 294 | pv/binding/decoder.cpp |
269528f5 JH |
295 | pv/data/decoderstack.cpp |
296 | pv/data/decode/annotation.cpp | |
297 | pv/data/decode/decoder.cpp | |
f9101a91 JH |
298 | pv/data/decode/row.cpp |
299 | pv/data/decode/rowdata.cpp | |
269528f5 JH |
300 | pv/view/decodetrace.cpp |
301 | pv/widgets/decodergroupbox.cpp | |
302 | pv/widgets/decodermenu.cpp | |
269528f5 JH |
303 | ) |
304 | ||
305 | list(APPEND pulseview_HEADERS | |
2acdb232 JH |
306 | pv/data/decoderstack.hpp |
307 | pv/view/decodetrace.hpp | |
308 | pv/widgets/decodergroupbox.hpp | |
309 | pv/widgets/decodermenu.hpp | |
269528f5 JH |
310 | ) |
311 | endif() | |
312 | ||
fe15e0bc UH |
313 | if(WIN32) |
314 | # Use the sigrok icon for the pulseview.exe executable. | |
315 | set(CMAKE_RC_COMPILE_OBJECT "${CMAKE_RC_COMPILER} -O coff -I${CMAKE_CURRENT_SOURCE_DIR} <SOURCE> <OBJECT>") | |
316 | enable_language(RC) | |
61e1e13e | 317 | list(APPEND pulseview_SOURCES pulseviewico.rc) |
fe15e0bc UH |
318 | endif() |
319 | ||
9137928c | 320 | if(ANDROID) |
dddff2e7 DE |
321 | list(APPEND pulseview_SOURCES |
322 | android/assetreader.cpp | |
323 | android/loghandler.cpp | |
324 | ) | |
9137928c MC |
325 | endif() |
326 | ||
9e8e84fc MC |
327 | if(Qt5Core_FOUND) |
328 | qt5_wrap_cpp(pulseview_HEADERS_MOC ${pulseview_HEADERS}) | |
329 | qt5_wrap_ui(pulseview_FORMS_HEADERS ${pulseview_FORMS}) | |
330 | qt5_add_resources(pulseview_RESOURCES_RCC ${pulseview_RESOURCES}) | |
331 | else() | |
39ccf9c3 | 332 | # Workaround for QTBUG-22829: -DBOOST_NEXT_PRIOR_HPP_INCLUDED. |
0661570b UH |
333 | # https://bugreports.qt.io/browse/QTBUG-22829 |
334 | qt4_wrap_cpp(pulseview_HEADERS_MOC ${pulseview_HEADERS} | |
335 | OPTIONS -DBOOST_NEXT_PRIOR_HPP_INCLUDED) | |
9e8e84fc MC |
336 | qt4_wrap_ui(pulseview_FORMS_HEADERS ${pulseview_FORMS}) |
337 | qt4_add_resources(pulseview_RESOURCES_RCC ${pulseview_RESOURCES}) | |
338 | include(${QT_USE_FILE}) | |
339 | endif() | |
df944399 | 340 | |
30588653 AG |
341 | #=============================================================================== |
342 | #= Global Definitions | |
343 | #------------------------------------------------------------------------------- | |
344 | ||
e9213170 | 345 | add_definitions(${QT_DEFINITIONS} -DQT_NO_KEYWORDS) |
ac223c1e | 346 | add_definitions(-D__STDC_LIMIT_MACROS) |
a9974171 | 347 | add_definitions(-Wall -Wextra) |
95d43108 | 348 | add_definitions(-std=c++11) |
5f606159 | 349 | |
269528f5 JH |
350 | if(ENABLE_DECODE) |
351 | add_definitions(-DENABLE_DECODE) | |
352 | endif() | |
353 | ||
5f606159 JH |
354 | if(NOT DISABLE_WERROR) |
355 | add_definitions(-Werror) | |
356 | endif() | |
df944399 | 357 | |
9632990d UH |
358 | if(ENABLE_SIGNALS) |
359 | add_definitions(-DENABLE_SIGNALS) | |
360 | endif() | |
361 | ||
30588653 AG |
362 | #=============================================================================== |
363 | #= Global Include Directories | |
364 | #------------------------------------------------------------------------------- | |
365 | ||
b04e278d AG |
366 | include_directories( |
367 | ${CMAKE_CURRENT_BINARY_DIR} | |
cef18fc6 | 368 | ${CMAKE_CURRENT_SOURCE_DIR} |
b04e278d | 369 | ${Boost_INCLUDE_DIRS} |
9e8e84fc | 370 | ${QT_INCLUDE_DIRS} |
b04e278d AG |
371 | ) |
372 | ||
373 | if(STATIC_PKGDEPS_LIBS) | |
374 | include_directories(${PKGDEPS_STATIC_INCLUDE_DIRS}) | |
375 | else() | |
376 | include_directories(${PKGDEPS_INCLUDE_DIRS}) | |
377 | endif() | |
df944399 | 378 | |
30588653 AG |
379 | #=============================================================================== |
380 | #= Linker Configuration | |
381 | #------------------------------------------------------------------------------- | |
382 | ||
b04e278d AG |
383 | link_directories(${Boost_LIBRARY_DIRS}) |
384 | ||
385 | set(PULSEVIEW_LINK_LIBS | |
386 | ${Boost_LIBRARIES} | |
387 | ${QT_LIBRARIES} | |
2b76309a | 388 | ${CMAKE_THREAD_LIBS_INIT} |
b04e278d AG |
389 | ) |
390 | ||
391 | if(STATIC_PKGDEPS_LIBS) | |
392 | link_directories(${PKGDEPS_STATIC_LIBRARY_DIRS}) | |
393 | list(APPEND PULSEVIEW_LINK_LIBS ${PKGDEPS_STATIC_LIBRARIES}) | |
7cfb538d UH |
394 | if(WIN32) |
395 | # Workaround for a MinGW linking issue. | |
396 | list(APPEND PULSEVIEW_LINK_LIBS "-llzma -llcms2") | |
397 | endif() | |
b04e278d AG |
398 | else() |
399 | link_directories(${PKGDEPS_LIBRARY_DIRS}) | |
400 | list(APPEND PULSEVIEW_LINK_LIBS ${PKGDEPS_LIBRARIES}) | |
401 | endif() | |
df944399 | 402 | |
11a04e2a UH |
403 | if(WIN32) |
404 | # On Windows we need to statically link the libqsvg imageformat | |
405 | # plugin (and the QtSvg component) for SVG graphics/icons to work. | |
406 | add_definitions(-DQT_STATICPLUGIN) | |
407 | link_directories("${QT_PLUGINS_DIR}/imageformats") | |
11a04e2a | 408 | list(APPEND PULSEVIEW_LINK_LIBS "-lqsvg") |
52f38de6 | 409 | list(APPEND PULSEVIEW_LINK_LIBS ${QT_QTSVG_LIBRARY}) |
11a04e2a UH |
410 | endif() |
411 | ||
9137928c MC |
412 | if(ANDROID) |
413 | list(APPEND PULSEVIEW_LINK_LIBS "-llog") | |
414 | endif() | |
415 | ||
26807061 MC |
416 | if(ANDROID) |
417 | add_library(${PROJECT_NAME} SHARED | |
418 | ${pulseview_SOURCES} | |
419 | ${pulseview_HEADERS_MOC} | |
420 | ${pulseview_FORMS_HEADERS} | |
421 | ${pulseview_RESOURCES_RCC} | |
422 | ) | |
423 | else() | |
5a13850b | 424 | add_executable(${PROJECT_NAME} |
a8d3fb2d JH |
425 | ${pulseview_SOURCES} |
426 | ${pulseview_HEADERS_MOC} | |
427 | ${pulseview_FORMS_HEADERS} | |
428 | ${pulseview_RESOURCES_RCC} | |
df944399 | 429 | ) |
26807061 | 430 | endif() |
df944399 | 431 | |
5a13850b | 432 | target_link_libraries(${PROJECT_NAME} ${PULSEVIEW_LINK_LIBS}) |
f0fa92c6 | 433 | |
b0d8c0dc | 434 | if(WIN32) |
61e1e13e UH |
435 | # Pass -mwindows so that no "DOS box" opens when PulseView is started. |
436 | set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-mwindows") | |
b0d8c0dc UH |
437 | endif() |
438 | ||
30588653 AG |
439 | #=============================================================================== |
440 | #= Installation | |
441 | #------------------------------------------------------------------------------- | |
442 | ||
52bbe600 | 443 | # Install the executable. |
cd6606c2 AG |
444 | install(TARGETS ${PROJECT_NAME} DESTINATION bin/) |
445 | ||
52bbe600 UH |
446 | # Install the manpage. |
447 | install(FILES doc/pulseview.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT doc) | |
448 | ||
f9cb49cc DE |
449 | # Generate Windows installer script. |
450 | configure_file(contrib/pulseview_cross.nsi.in contrib/pulseview_cross.nsi @ONLY) | |
451 | ||
cd6606c2 AG |
452 | #=============================================================================== |
453 | #= Packaging (handled by CPack) | |
454 | #------------------------------------------------------------------------------- | |
455 | ||
b02a8cbf JH |
456 | set(CPACK_PACKAGE_VERSION_MAJOR ${PV_VERSION_MAJOR}) |
457 | set(CPACK_PACKAGE_VERSION_MINOR ${PV_VERSION_MINOR}) | |
458 | set(CPACK_PACKAGE_VERSION_PATCH ${PV_VERSION_MICRO}) | |
cd6606c2 AG |
459 | set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README) |
460 | set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/COPYING) | |
461 | set(CPACK_SOURCE_IGNORE_FILES ${CMAKE_CURRENT_BINARY_DIR} ".gitignore" ".git") | |
1e8c82e9 | 462 | set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${PV_VERSION_STRING}") |
1d2fb87d | 463 | set(CPACK_SOURCE_GENERATOR "TGZ") |
cd6606c2 AG |
464 | |
465 | include(CPack) | |
bc1c1462 | 466 | |
30588653 AG |
467 | #=============================================================================== |
468 | #= Tests | |
469 | #------------------------------------------------------------------------------- | |
470 | ||
77e8ac52 | 471 | if(ENABLE_TESTS) |
fb746bcc | 472 | add_subdirectory(test) |
951c583c | 473 | enable_testing() |
fb746bcc | 474 | add_test(test ${CMAKE_CURRENT_BINARY_DIR}/test/pulseview-test) |
0aad432c | 475 | endif() |