forked from analogdevicesinc/scopy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·527 lines (431 loc) · 17 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
# Copyright (c) 2019 Analog Devices Inc.
#
# This file is part of Scopy
# (see http://www.github.com/analogdevicesinc/scopy).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.5)
project(scopy LANGUAGES C CXX VERSION 1.4.0)
set(Python_ADDITIONAL_VERSIONS 3)
FIND_PACKAGE(PythonInterp REQUIRED)
set(PYTHON_VERSION python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
function(dump_cmake_variables)
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
if (ARGV0)
unset(MATCHED)
string(REGEX MATCH ${ARGV0} MATCHED ${_variableName})
if (NOT MATCHED)
continue()
endif()
endif()
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
endfunction()
function(create_build_info_html_pages)
endfunction()
function(configure_stylesheets DU_OPTION)
file(GLOB_RECURSE STYLESHEETS ${CMAKE_CURRENT_SOURCE_DIR}/resources/stylesheets/templates/*.qss.c)
foreach(_stylesheet ${STYLESHEETS})
string(REPLACE ".c" "" FILE_OUT ${_stylesheet})
string(REPLACE "templates/" "" FILE_OUT ${FILE_OUT})
execute_process (
COMMAND ${CMAKE_C_COMPILER} -E -P ${DU_OPTION} ${_stylesheet} -o ${FILE_OUT}
)
message(STATUS "Done preprocessing ${_stylesheet}, file written to: ${FILE_OUT}")
endforeach()
endfunction()
# Get the GIT hash of the latest commit
include(FindGit OPTIONAL)
if (GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --show-toplevel
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE SCOPY_GIT_REPO
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE SCOPY_VERSION_GIT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
if (NOT SCOPY_VERSION_GIT)
set(SCOPY_VERSION_GIT v${PROJECT_VERSION})
endif()
# Set .exe properties
if (WIN32)
string(REPLACE "." "," SCOPY_FILEVERSION ${PROJECT_VERSION})
set(SCOPY_PRODUCTVERSION_STR ${PROJECT_VERSION})
string(TIMESTAMP BUILD_YEAR "%Y")
endif()
if (MSVC)
# http://www.suodenjoki.dk/us/archive/2010/min-max.htm
add_definitions(-DNOMINMAX)
# http://www.qtcentre.org/threads/32028-unresolved-external-symbol-quot-public-static-struct-QMetaObject-const-QwtPlot-staticMe
add_definitions(-DQWT_DLL)
endif (MSVC)
if(ANDROID)
set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
if (ANDROID_ABI STREQUAL "armeabi-v7a")
set(ANDROID_EXTRA_LIBS
${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so)
endif()
endif()
find_package(Qt5Widgets REQUIRED)
find_package(Qt5 COMPONENTS LinguistTools REQUIRED)
find_package(Qt5Concurrent REQUIRED)
find_package(Qt5Network REQUIRED)
if(ANDROID)
find_package(Qt5AndroidExtras REQUIRED)
endif()
FILE(GLOB TS_FILES ${CMAKE_SOURCE_DIR}/resources/translations/*.ts)
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_BINARY_DIR})
# Creates translation .ts files from ${CMAKE_SOURCE_DIR}
#qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
# Generate .qm files from the .ts files
qt5_add_translation(QM_FILES ${TS_FILES})
set(TRANSLATIONS)
foreach(file ${TS_FILES})
get_filename_component(file_name ${file} NAME_WE)
set(TRANSLATIONS "${TRANSLATIONS}\n<file>${file_name}.qm</file>")
endforeach()
configure_file(${CMAKE_SOURCE_DIR}/resources/translations.qrc
${CMAKE_BINARY_DIR}/translations.qrc
@ONLY)
qt5_add_resources(TRANSLATION_RESOURCES ${CMAKE_BINARY_DIR}/translations.qrc)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
#set(CMAKE_AUTOUIC ON) - Can't figure out how to configure it to look under ui/
# for the .ui file. Use qt5_wrap_ui instead.
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel."
FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS None Debug Release RelWithDebInfo MinSizeRel)
endif()
if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
add_definitions(-DQT_NO_DEBUG_OUTPUT=1)
endif()
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_constexpr OUT_CONSTEXPR)
if (NOT "${OUT_CONSTEXPR}" STREQUAL "-1")
add_definitions(-DHAS_CONSTEXPR=1)
endif()
option(BREAKPAD_HANDLER "Build with breakpad exception handler " OFF)
message(STATUS BREAKPAD_HANDLER - ${BREAKPAD_HANDLER})
if (${BREAKPAD_HANDLER})
message("-- Building with breakpad crash handler")
set(BREAKPAD_HANDLER_BOOL 1)
find_library(BREAKPAD_LIBRARIES NAMES breakpad)
find_library(BREAKPADCLIENT_LIBRARIES NAMES breakpad_client)
find_path(BREAKPAD_INCLUDE_DIRS breakpad)
else()
message("-- Building without breakpad crash handler")
set(BREAKPAD_HANDLER_BOOL 0)
SET(BREAKPAD_LIBRARIES "")
SET(BREAKPAD_INCLUDE_DIRS "")
SET(BREAKPADCLIENT_LIBRARIES "")
endif()
find_package(Qt5Qml REQUIRED)
find_package(Qt5Svg REQUIRED)
find_package(Qt5UiTools REQUIRED)
find_package(Qt5Xml REQUIRED)
set(CMAKE_VERBOSE_MAKEFILE TRUE)
find_package(Gnuradio "3.8" REQUIRED COMPONENTS runtime analog blocks fft filter volk pmt )
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH};/usr/local/lib/cmake)
find_package(gnuradio-iio REQUIRED PATH_SUFFIXES iio)
find_package(gnuradio-scopy REQUIRED PATH_SUFFIXES scopy)
find_package(gnuradio-m2k REQUIRED PATH_SUFFIXES m2k)
add_definitions(-DBOOST_ALL_DYN_LINK)
find_package(Boost COMPONENTS system filesystem thread chrono REQUIRED)
find_package(libm2k REQUIRED)
find_library(LIBUSB_LIBRARIES NAMES usb-1.0 usb)
if (ENABLE_MATIO)
message("-- Building with MATLAB support for SignalGenerator")
find_library(MATIO_LIBRARIES REQUIRED NAMES matio)
add_definitions(-DMATLAB_SUPPORT_SIGGEN)
endif()
if(ANDROID)
find_library(QWT_LIBRARIES REQUIRED NAMES qwt_${ANDROID_ABI})
else()
find_library(QWT_LIBRARIES REQUIRED NAMES qwt)
endif()
find_package(PkgConfig)
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
pkg_check_modules(GLIB REQUIRED glib-2.0)
pkg_check_modules(GLIBMM REQUIRED glibmm-2.4)
pkg_check_modules(SIGCPP REQUIRED sigc++-2.0)
pkg_check_modules(LIBSIGROK_DECODE REQUIRED libsigrokdecode)
pkg_get_variable(LIBSIGROK_DECODERS_DIR libsigrokdecode decodersdir)
include_directories(
${Boost_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
${Qt5Concurrent_INCLUDE_DIRS}
${Qt5AndroidExtras_INCLUDE_DIRS}
${Qt5Qml_INCLUDE_DIRS}
${Qt5UiTools_INCLUDE_DIRS}
${QWT_INCLUDE_DIRS}
${Qt5Svg_INCLUDE_DIRS}
${Qt5Xml_INCLUDE_DIRS}
${SCOPY_INCLUDE_DIRS}
${LIBSIGROK_DECODE_INCLUDE_DIRS}
${GLIB_INCLUDE_DIRS}
${GLIBCONFIG_INCLUDE_DIRS}
${GLIBMM_INCLUDE_DIRS}
${GLIBMMCONFIG_INCLUDE_DIRS}
${SIGCPP_INCLUDE_DIRS}
${SIGCPPCONFIG_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/src
${BREAKPAD_INCLUDE_DIRS}
${BREAKPAD_INCLUDE_DIRS}/breakpad
${CMAKE_CURRENT_SOURCE_DIR}/iio-emu
)
link_directories(
${Boost_LIBRARY_DIRS}
${GNURADIO_RUNTIME_LIBRARY_DIRS}
${BREAKPAD_LIBRARIES}
)
FILE(GLOB SRC_LIST src/*.cpp src/*.cc
src/patterngenerator/*.cpp
src/patterngenerator/*/*.cpp
src/logicanalyzer/*.cpp
src/logicanalyzer/*/*.cpp
src/gui/*.cpp
)
FILE(GLOB M2KSCOPE_UIS ui/patterns/*.ui ui/*.ui)
qt5_wrap_ui (m2kscope_FORMS_HEADERS ${M2KSCOPE_UIS})
FILE(GLOB M2KSCOPE_RESOURCES resources/resources.qrc)
qt5_add_resources(m2kscope_RESOURCES ${M2KSCOPE_RESOURCES})
if (WIN32)
set(RESOURCES ${CMAKE_CURRENT_BINARY_DIR}/resources/properties.rc)
configure_file(properties.rc.cmakein ${RESOURCES} @ONLY)
endif()
add_definitions(-DQT_NO_KEYWORDS)
if (APPLE)
option(ENABLE_APPLICATION_BUNDLE "Enable application bundle for OSX" ON)
endif(APPLE)
option(CONFIG_STYLESHEETS "Preprocess stylesheets using ${CMAKE_C_COMPILER}" ON)
message(STATUS CONFIG_STYLESHEETS - ${CONFIG_STYLESHEETS})
if (${CONFIG_STYLESHEETS})
if (ANDROID)
set(PROCESSING_OPTIONS "-D__ANDROID__")
endif(ANDROID)
if (APPLE)
set(PROCESSING_OPTIONS "-D__MACOS__")
endif(APPLE)
if (WIN32)
set(PROCESSING_OPTIONS "-D__WINDOWS__")
endif(WIN32)
configure_stylesheets("${PROCESSING_OPTIONS}")
endif()
if (ENABLE_APPLICATION_BUNDLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
set(PKGINFO ${CMAKE_BINARY_DIR}/PkgInfo)
file(WRITE ${PKGINFO} "APPLScopy")
set_source_files_properties(${PKGINFO} PROPERTIES MACOSX_PACKAGE_LOCATION .)
set(QT_CONF ${CMAKE_BINARY_DIR}/qt.conf)
file(WRITE ${QT_CONF} "")
set_source_files_properties(${QT_CONF} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
set(ICON_FILE ${CMAKE_SOURCE_DIR}/resources/Scopy.icns)
set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-headerpad_max_install_names -Wl,-search_paths_first ${CMAKE_EXE_LINKER_FLAGS}")
foreach(plugin ${Qt5Gui_PLUGINS} ${Qt5Svg_PLUGINS})
get_target_property(_loc ${plugin} LOCATION)
get_filename_component(_name ${_loc} NAME)
get_filename_component(_dir ${_loc} DIRECTORY)
get_filename_component(_dir ${_dir} NAME)
set_source_files_properties(${_loc} PROPERTIES MACOSX_PACKAGE_LOCATION plugins/${_dir})
set(QT_PLUGINS ${QT_PLUGINS} ${_loc})
set(BUNDLED_QT_PLUGINS ${BUNDLED_QT_PLUGINS} ${CMAKE_BINARY_DIR}/Scopy.app/Contents/plugins/${_dir}/${_name})
endforeach()
file(GLOB_RECURSE DECODERS ${LIBSIGROK_DECODERS_DIR}/*.py)
foreach(_decoder ${DECODERS})
file(RELATIVE_PATH _file ${LIBSIGROK_DECODERS_DIR} ${_decoder})
get_filename_component(_path ${_file} DIRECTORY)
set_source_files_properties(${_decoder} PROPERTIES MACOSX_PACKAGE_LOCATION MacOS/decoders/${_path})
endforeach()
install(CODE "
set(BU_CHMOD_BUNDLE_ITEMS ON)
include(BundleUtilities)
fixup_bundle(\"${CMAKE_BINARY_DIR}/Scopy.app\" \"${BUNDLED_QT_PLUGINS}\" \"${CMAKE_SOURCE_DIR}\")"
)
set(OSX_BUNDLE MACOSX_BUNDLE)
set(EXTRA_BUNDLE_FILES ${QT_PLUGINS} ${ICON_FILE} ${PKGINFO} ${QT_CONF} ${DECODERS})
endif()
#dump_cmake_variables("iio")
string(TIMESTAMP TODAY "%Y-%m-%d")
string(TIMESTAMP NOW "%H:%M:%S")
cmake_host_system_information(RESULT BUILD_HOST QUERY HOSTNAME)
set(APPVEYOR_INFO)
if($ENV{APPVEYOR})
set(APPVEYOR_INFO ${APPVEYOR_INFO}Built\ on\ Appveyor\n)
set(APPVEYOR_INFO ${APPVEYOR_INFO}url:\ $ENV{APPVEYOR_URL}\n)
set(APPVEYOR_INFO ${APPVEYOR_INFO}api_url:\ $ENV{APPVEYOR_API_URL}\n)
set(APPVEYOR_INFO ${APPVEYOR_INFO}acc_name:\ $ENV{APPVEYOR_ACCOUNT_NAME}\n)
set(APPVEYOR_INFO ${APPVEYOR_INFO}prj_name:\ $ENV{APPVEYOR_PROJECT_NAME}\n)
set(APPVEYOR_INFO ${APPVEYOR_INFO}build_id:\ $ENV{APPVEYOR_BUILD_ID}\n)
set(APPVEYOR_INFO ${APPVEYOR_INFO}build_nr:\ $ENV{APPVEYOR_BUILD_NUMBER}\n)
set(APPVEYOR_INFO ${APPVEYOR_INFO}build_version:\ $ENV{APPVEYOR_BUILD_VERSION}\n)
set(APPVEYOR_INFO ${APPVEYOR_INFO}job_id:\ $ENV{APPVEYOR_JOB_ID}\n)
set(APPVEYOR_INFO ${APPVEYOR_INFO}job_name:\ $ENV{APPVEYOR_JOB_NAME}\n)
set(APPVEYOR_INFO ${APPVEYOR_INFO}job_nr:\ $ENV{APPVEYOR_JOB_NUMBER}\n)
set(APPVEYOR_INFO ${APPVEYOR_INFO}job_link:\ $ENV{APPVEYOR_URL}/project/$ENV{APPVEYOR_ACCOUNT_NAME}/$ENV{APPVEYOR_PROJECT_NAME}/builds/$ENV{APPVEYOR_BUILD_ID}/job/$ENV{APPVEYOR_JOB_ID}\n)
if(EXISTS ${CMAKE_SOURCE_DIR}/scopy-mingw-build-status)
message(scopy-mingw-build-status found .. populating)
FILE(READ ${CMAKE_SOURCE_DIR}/scopy-mingw-build-status SCOPY_MINGW_BUILD_STATUS_INFO)
endif()
else()
set(APPVEYOR_INFO ${APPVEYOR_INFO}Built\ locally\n)
endif()
# TODO: Pack these in a GLOB and run foreach
configure_file(resources/buildinfo.html.cmakein ${CMAKE_CURRENT_BINARY_DIR}/buildinfo.html)
configure_file(resources/scopy_osp.html.cmakein ${CMAKE_CURRENT_BINARY_DIR}/scopy_osp.html)
configure_file(resources/credits.html.cmakein ${CMAKE_CURRENT_BINARY_DIR}/credits.html)
configure_file(resources/about.html.cmakein ${CMAKE_CURRENT_BINARY_DIR}/about.html)
SET(ABOUT_HTML_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/resources/buildinfo.html ${CMAKE_CURRENT_BINARY_DIR}/resources/scopy_osp.html ${CMAKE_CURRENT_BINARY_DIR}/resources/credits.html ${CMAKE_CURRENT_BINARY_DIR}/resources/about.html)
set(ABOUT_HTML_QRC_SOURCES)
foreach(file ${ABOUT_HTML_SOURCES})
get_filename_component(file_name ${file} NAME)
set(ABOUT_HTML_QRC_SOURCES "${ABOUT_HTML_QRC_SOURCES}\n<file>${file_name}</file>")
endforeach()
configure_file(${CMAKE_SOURCE_DIR}/resources/aboutpage.qrc
${CMAKE_BINARY_DIR}/aboutpage.qrc
@ONLY)
qt5_add_resources(ABOUT_PAGE_RESOURCES ${CMAKE_CURRENT_BINARY_DIR}/aboutpage.qrc)
option(CLONE_IIO_EMU "Clone iio-emu" ON)
if (CLONE_IIO_EMU)
message(STATUS "Checking for iio-emu")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
add_subdirectory(iio-emu)
endif()
if(ANDROID)
add_library(${PROJECT_NAME} SHARED
${SRC_LIST}
${RESOURCES}
${m2kscope_RESOURCES}
${m2kscope_FORMS_HEADERS}
${EXTRA_BUNDLE_FILES}
${TRANSLATION_RESOURCES}
${ABOUT_PAGE_RESOURCES}
)
else()
add_executable(${PROJECT_NAME} WIN32 ${OSX_BUNDLE}
${SRC_LIST}
${RESOURCES}
${m2kscope_RESOURCES}
${m2kscope_FORMS_HEADERS}
${EXTRA_BUNDLE_FILES}
${TRANSLATION_RESOURCES}
${ABOUT_PAGE_RESOURCES}
)
endif()
if (WIN32 OR ENABLE_APPLICATION_BUNDLE)
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME Scopy)
endif()
target_link_libraries(${PROJECT_NAME} LINK_PRIVATE
${BREAKPAD_LIBRARIES}
${BREAKPADCLIENT_LIBRARIES}
${Qt5Widgets_LIBRARIES}
${Qt5Concurrent_LIBRARIES}
${Qt5Qml_LIBRARIES}
${Qt5UiTools_LIBRARIES}
${Qt5Network_LIBRARIES}
${Qt5AndroidExtras_LIBRARIES}
${LIBUSB_LIBRARIES}
gnuradio::gnuradio-runtime
gnuradio::gnuradio-analog
gnuradio::gnuradio-blocks
gnuradio::gnuradio-fft
gnuradio::gnuradio-filter
gnuradio::gnuradio-pmt
gnuradio::gnuradio-iio
gnuradio::gnuradio-scopy
gnuradio::gnuradio-m2k
${Boost_LIBRARIES}
${QWT_LIBRARIES}
${Qt5Svg_LIBRARIES}
${Qt5Xml_LIBRARIES}
${MATIO_LIBRARIES}
${LIBSIGROK_DECODE_LIBRARIES}
${GLIBMM_LIBRARIES}
${SIGCPP_LIBRARIES}
${GLIB_LIBRARIES}
libm2k::libm2k
)
if (NOT WIN32)
find_library(PTHREAD_LIBRARIES pthread)
if (PTHREAD_LIBRARIES)
target_link_libraries(${PROJECT_NAME} LINK_PRIVATE ${PTHREAD_LIBRARIES})
endif()
endif()
configure_file(Info.plist.cmakein ${CMAKE_CURRENT_BINARY_DIR}/Info.plist @ONLY)
option(WITH_NATIVEDIALOGS "Enable native file dialogs for Scopy" ON)
if (NOT ${WITH_NATIVEDIALOGS})
add_definitions(-DNONATIVE)
endif()
# Compiler options
target_compile_options(${PROJECT_NAME} PUBLIC -Wall)
#List of warnings to be treated as errors
target_compile_options(${PROJECT_NAME} PUBLIC
-Werror=return-type
-Werror=uninitialized
-Werror=init-self
-Werror=switch
)
set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist
)
set(CMAKE_INSTALL_DOCDIR "${CMAKE_CURRENT_BINARY_DIR}/doc")
find_package(Doxygen)
if(DOXYGEN_FOUND)
option(WITH_DOC "Generate documentation with Doxygen" OFF)
if (WITH_DOC)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile_API.in ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile @ONLY)
set(HTML_DEST_DIR ${CMAKE_CURRENT_BINARY_DIR})
#file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/doc DESTINATION ${HTML_DEST_DIR})
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
if(NOT SKIP_INSTALL_ALL)
install(DIRECTORY ${HTML_DEST_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR})
endif()
endif()
else()
message(STATUS "Doxygen not found, API documentation won't be generated")
endif()
configure_file(scopy.iss.cmakein ${CMAKE_CURRENT_BINARY_DIR}/scopy.iss @ONLY)
configure_file(scopy-32.iss.cmakein ${CMAKE_CURRENT_BINARY_DIR}/scopy-32.iss @ONLY)
configure_file(scopy-64.iss.cmakein ${CMAKE_CURRENT_BINARY_DIR}/scopy-64.iss @ONLY)
configure_file(config.h.cmakein ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
if (NOT ENABLE_APPLICATION_BUNDLE)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/resources/scopy.desktop.cmakein ${CMAKE_CURRENT_BINARY_DIR}/scopy.desktop @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/scopy.desktop DESTINATION share/applications)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/icon_small.svg DESTINATION share/icons/hicolor/apps/scalable RENAME scopy.svg)
endif()
configure_file(qt.conf.cmakein ${CMAKE_CURRENT_BINARY_DIR}/qt.conf @ONLY)