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