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