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