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