forked from gnss-sdr/gnss-sdr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
2940 lines (2701 loc) · 139 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
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
#
# GNSS-SDR is a software-defined Global Navigation Satellite Systems receiver
#
# This file is part of GNSS-SDR.
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
################################################################################
# Project setup
################################################################################
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "Prevented in-tree build, it is bad practice.\nTry 'cd build && cmake ..' instead.")
endif()
cmake_minimum_required(VERSION 2.8.12...3.17)
project(gnss-sdr CXX C)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
################################################################################
# Determine optional blocks/libraries to be built (default: not built)
# Enable them at the command line by doing 'cmake -DENABLE_XXX=ON ..'
################################################################################
include(FeatureSummary)
# Support of optional RF front-ends
option(ENABLE_UHD "Enable the use of UHD (driver for all USRP devices)" ON)
option(ENABLE_OSMOSDR "Enable the use of OsmoSDR and other front-ends (RTL-based dongles, HackRF, bladeRF, etc.) as signal source" OFF)
option(ENABLE_FMCOMMS2 "Enable the use of FMCOMMS4-EBZ + ZedBoard hardware, requires gr-iio" OFF)
option(ENABLE_PLUTOSDR "Enable the use of ADALM-PLUTO Evaluation Boards (Analog Devices Inc.), requires gr-iio" OFF)
option(ENABLE_AD9361 "Enable the use of AD9361 direct to FPGA hardware, requires libiio" OFF)
option(ENABLE_RAW_UDP "Enable the use of high-optimized custom UDP packet sample source, requires libpcap" OFF)
option(ENABLE_FLEXIBAND "Enable the use of the signal source adater for the Teleorbit Flexiband GNU Radio driver" OFF)
option(ENABLE_GN3S "Enable the use of the GN3S dongle as signal source (experimental)" OFF)
option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal source (experimental)" OFF)
# Performance analysis tools
option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF)
option(ENABLE_GPROF "Enable the use of the GNU profiler tool 'gprof'" OFF)
# Code correctness
option(ENABLE_CLANG_TIDY "Enable the use of clang-tidy when compiling" OFF)
# Acceleration
option(ENABLE_PROFILING "Enable execution of volk_gnsssdr_profile at the end of the building" OFF)
option(ENABLE_OPENCL "Enable building of processing blocks implemented with OpenCL (experimental)" OFF)
option(ENABLE_CUDA "Enable building of processing blocks implemented with CUDA (experimental, requires CUDA SDK)" OFF)
option(ENABLE_FPGA "Enable building of processing blocks implementing FPGA offloading" OFF)
# Building and packaging options
option(ENABLE_GENERIC_ARCH "Builds a portable binary" OFF)
option(ENABLE_PACKAGING "Enable software packaging" OFF)
option(ENABLE_OWN_GLOG "Download glog and link it to gflags" OFF)
option(ENABLE_OWN_ARMADILLO "Download and build Armadillo locally" OFF)
option(ENABLE_LOG "Enable logging" ON)
option(ENABLE_ARMA_NO_DEBUG OFF)
if(ENABLE_PACKAGING)
set(ENABLE_GENERIC_ARCH ON)
set(ENABLE_ARMA_NO_DEBUG ON)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif()
# Testing
option(ENABLE_UNIT_TESTING "Build unit tests" ON)
option(ENABLE_UNIT_TESTING_MINIMAL "Build a minimal set of unit tests" OFF)
option(ENABLE_UNIT_TESTING_EXTRA "Download external files and build extra unit tests" OFF)
option(ENABLE_SYSTEM_TESTING "Build system tests" OFF)
option(ENABLE_SYSTEM_TESTING_EXTRA "Download external tools and build extra system tests" OFF)
option(ENABLE_GNSS_SIM_INSTALL "Enable the installation of gnss_sim on the fly" ON)
if(NOT (ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA))
set(ENABLE_GNSS_SIM_INSTALL OFF)
endif()
if(ENABLE_SYSTEM_TESTING_EXTRA)
set(ENABLE_SYSTEM_TESTING ON)
endif()
option(ENABLE_OWN_GPSTK "Force to download, build and link GPSTk for system tests, even if it is already installed" OFF)
option(ENABLE_INSTALL_TESTS "Install QA code system-wide" OFF)
if(ENABLE_FPGA)
set(ENABLE_INSTALL_TESTS ON)
endif()
################################################################################
# GNSS-SDR version information
################################################################################
set(THIS_IS_A_RELEASE ON) # only related to version name, no further implications.
if(NOT ${THIS_IS_A_RELEASE})
find_package(Git)
set_package_properties(Git PROPERTIES
URL "https://git-scm.com"
DESCRIPTION "A free and open source distributed version control system (found: v${GIT_VERSION_STRING})"
PURPOSE "Manage version control, get MINOR_VERSION name for version number."
TYPE REQUIRED
)
if(GIT_FOUND)
# was this info set in the CMake commandline?
if(NOT GIT_BRANCH)
# no: try to find it
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
# was this info set in the CMake commandline?
if(NOT GIT_COMMIT_HASH)
# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
endif()
endif()
set(VERSION_INFO_MAJOR_VERSION 0)
set(VERSION_INFO_API_COMPAT 0)
if(${THIS_IS_A_RELEASE})
set(VERSION_INFO_MINOR_VERSION 12)
else()
set(VERSION_INFO_MINOR_VERSION 12.git-${GIT_BRANCH}-${GIT_COMMIT_HASH})
endif()
set(VERSION ${VERSION_INFO_MAJOR_VERSION}.${VERSION_INFO_API_COMPAT}.${VERSION_INFO_MINOR_VERSION})
################################################################################
# Environment setup
################################################################################
include(ExternalProject)
# Detect 64-bits machine
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCH_64BITS TRUE)
endif()
# Set prefix path for PyBOMBS and Snaps, if defined in environment variables
if(NOT CMAKE_PREFIX_PATH)
if(DEFINED ENV{PYBOMBS_PREFIX})
set(CMAKE_PREFIX_PATH $ENV{PYBOMBS_PREFIX})
endif()
if(DEFINED ENV{SNAP})
set(CMAKE_PREFIX_PATH $ENV{SNAP})
endif()
endif()
# Detect Linux Distribution
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU")
include(DetectLinuxDistro)
if(CMAKE_CROSSCOMPILING)
message(STATUS "Configuring GNSS-SDR v${VERSION} to be cross-compiled on ${LINUX_DISTRIBUTION} ${LINUX_VER} (${CMAKE_HOST_SYSTEM_PROCESSOR}) for ${CMAKE_SYSTEM_PROCESSOR} ${ARCHITECTURE_STRING}")
else()
message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on GNU/Linux ${LINUX_DISTRIBUTION} ${LINUX_VER} ${ARCHITECTURE_STRING}")
endif()
endif()
# Detect macOS / Mac OS X Version
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
include(DetectMacOSVersion)
message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on ${MACOS_DISTRIBUTION}")
endif()
# Define extra build types and select Release by default to get optimization flags
include(GnsssdrBuildTypes)
# Available options:
# - None: nothing set
# - Debug: -O2 -g
# - Release: -O3
# - RelWithDebInfo: -O3 -g
# - MinSizeRel: -Os
# - Coverage: -Wall -pedantic -pthread -g -O0 -fprofile-arcs -ftest-coverage
# - NoOptWithASM: -O0 -g -save-temps
# - O2WithASM: -O2 -g -save-temps
# - O3WithASM: -O3 -g -save-temps
# - ASAN: -Wall -Wextra -g -O2 -fsanitize=address -fno-omit-frame-pointer
if(NOT CMAKE_BUILD_TYPE)
if(ENABLE_GPERFTOOLS OR ENABLE_GPROF)
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
message(STATUS "Build type not specified: defaulting to RelWithDebInfo.")
else()
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "Build type not specified: defaulting to Release.")
endif()
else()
message(STATUS "Build type set to ${CMAKE_BUILD_TYPE}.")
endif()
gnsssdr_check_build_type(${CMAKE_BUILD_TYPE})
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
# Enable optimization options in GCC for Release and RelWithDebInfo build types
if((${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") AND (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
if(NOT (${LINUX_DISTRIBUTION} MATCHES "Fedora") AND NOT (${LINUX_DISTRIBUTION} MATCHES "Gentoo"))
# flag -O3 enables tree vectorization
# See https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")
endif()
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Fix for Debug mode in macOS
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-fstandalone-debug HAVE_STANDALONE_DEBUG)
check_cxx_compiler_flag(-Og HAVE_OG_FLAG)
if(HAVE_STANDALONE_DEBUG AND HAVE_OG_FLAG)
set(CMAKE_CXX_FLAGS_DEBUG "-Og -g -fstandalone-debug")
set(CMAKE_C_FLAGS_DEBUG "-Og -g -fstandalone-debug")
endif()
endif()
endif()
# allow 'large' files in 32 bit builds
if(UNIX)
add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES)
endif()
# Determine if we are using make or ninja
if(CMAKE_MAKE_PROGRAM MATCHES "make")
set(CMAKE_MAKE_PROGRAM_PRETTY_NAME "make")
endif()
if(CMAKE_MAKE_PROGRAM MATCHES "ninja")
set(CMAKE_MAKE_PROGRAM_PRETTY_NAME "ninja")
endif()
if(CMAKE_MAKE_PROGRAM MATCHES "xcodebuild")
set(CMAKE_MAKE_PROGRAM_PRETTY_NAME "xcodebuild")
endif()
if(NOT CMAKE_MAKE_PROGRAM_PRETTY_NAME)
set(CMAKE_MAKE_PROGRAM_PRETTY_NAME "${CMAKE_MAKE_PROGRAM}")
endif()
if(CMAKE_VERSION VERSION_LESS 3.12)
if(POLICY CMP0057) # required by FindDoxygen.cmake module
cmake_policy(SET CMP0057 NEW) # Support if() IN_LIST operator, added in CMake 3.3
endif()
endif()
################################################################################
# Minimum required versions
################################################################################
set(GNSSSDR_GCC_MIN_VERSION "4.7.2")
set(GNSSSDR_CLANG_MIN_VERSION "3.4.0")
set(GNSSSDR_APPLECLANG_MIN_VERSION "500")
set(GNSSSDR_GNURADIO_MIN_VERSION "3.7.3")
set(GNSSSDR_BOOST_MIN_VERSION "1.53")
set(GNSSSDR_PYTHON_MIN_VERSION "2.7")
set(GNSSSDR_PYTHON3_MIN_VERSION "3.4")
set(GNSSSDR_MAKO_MIN_VERSION "0.4.2")
set(GNSSSDR_ARMADILLO_MIN_VERSION "5.300.0")
set(GNSSSDR_MATIO_MIN_VERSION "1.5.3")
set(GNSSSDR_PROTOBUF_MIN_VERSION "3.0.0")
################################################################################
# Versions to download and build (but not installed) if not found
################################################################################
set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2")
set(GNSSSDR_GLOG_LOCAL_VERSION "0.4.0")
set(GNSSSDR_ARMADILLO_LOCAL_VERSION "9.800.x")
set(GNSSSDR_GTEST_LOCAL_VERSION "1.10.0")
set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master")
set(GNSSSDR_GPSTK_LOCAL_VERSION "3.0.0")
set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.17")
set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.10")
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "3.11.4")
if(CMAKE_VERSION VERSION_LESS "3.0.2")
set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.1") # Fix for CentOS 7
set(GNSSSDR_GLOG_LOCAL_VERSION "0.3.4") # Fix for Ubuntu 14.04
endif()
################################################################################
# Check compiler version
################################################################################
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${GNSSSDR_GCC_MIN_VERSION})
message(STATUS "Your GCC version is too old and does not support some C++ features required by GNSS-SDR. GCC version must be at least ${GNSSSDR_GCC_MIN_VERSION}")
message(FATAL_ERROR "Fatal error: GCC >= ${GNSSSDR_GCC_MIN_VERSION} required.")
endif()
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
execute_process(COMMAND
${CMAKE_CXX_COMPILER} -v
RESULT_VARIABLE _res ERROR_VARIABLE _err
ERROR_STRIP_TRAILING_WHITESPACE
)
if(${_res} STREQUAL "0")
# output is in error stream
string(REGEX MATCH "^Apple.*" IS_APPLE ${_err})
if("${IS_APPLE}" STREQUAL "")
set(MIN_VERSION ${GNSSSDR_CLANG_MIN_VERSION})
set(APPLE_STR "")
# retrieve the compiler's version from it
string(REGEX MATCH "clang version [0-9.]+" CLANG_OTHER_VERSION ${_err})
string(REGEX MATCH "[0-9.]+" CLANG_VERSION ${CLANG_OTHER_VERSION})
else()
set(MIN_VERSION ${GNSSSDR_APPLECLANG_MIN_VERSION})
set(APPLE_STR "Apple ")
# retrieve the compiler's version from it
string(REGEX MATCH "(clang-[0-9.]+)" CLANG_APPLE_VERSION ${_err})
string(REGEX MATCH "[0-9.]+" CLANG_VERSION ${CLANG_APPLE_VERSION})
endif()
if(${CLANG_VERSION} VERSION_LESS "${MIN_VERSION}")
message(WARNING "\nThe compiler selected to build GNSS-SDR (${APPLE_STR}Clang version ${CLANG_VERSION} : ${CMAKE_CXX_COMPILER}) is older than that officially supported (${MIN_VERSION} minimum). This build may or not work. We highly recommend using Apple Clang version ${APPLECLANG_MIN_VERSION} or more recent, or Clang version ${CLANG_MIN_VERSION} or more recent.")
endif()
else()
message(WARNING "\nCannot determine the version of the compiler selected to build GNSS-SDR (${APPLE_STR}Clang : ${CMAKE_CXX_COMPILER}). This build may or not work. We highly recommend using Apple Clang version ${APPLECLANG_MIN_VERSION} or more recent, or Clang version ${CLANG_MIN_VERSION} or more recent.")
endif()
endif()
################################################################################
# Set minimal C and C++ standards
################################################################################
if(NOT (CMAKE_VERSION VERSION_LESS "3.1"))
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_EXTENSIONS OFF)
else()
add_compile_options("$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,C>:-std=gnu11>")
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.1.1")
add_compile_options("$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:-std=c++11>")
else()
add_compile_options("$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:-std=c++14>")
endif()
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
if(CLANG_VERSION VERSION_LESS "600")
add_compile_options("$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:-std=c++11>")
else()
add_compile_options("$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:-std=c++14>")
endif()
else()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.5.0")
add_compile_options("$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:-std=c++11>")
else()
add_compile_options("$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:-std=c++14>")
endif()
endif()
endif()
endif()
# Visibility
# See https://gcc.gnu.org/wiki/Visibility
if(POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
else()
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
add_definitions(-fvisibility=hidden)
endif()
endif()
################################################################################
# Check if the compiler defines the architecture as ARM
################################################################################
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
if(CMAKE_CROSSCOMPILING)
set(IS_ARM TRUE)
if(NOT CMAKE_NO_SYSTEM_FROM_IMPORTED)
set(CMAKE_NO_SYSTEM_FROM_IMPORTED TRUE)
endif()
else()
if(NOT IS_ARM)
include(TestForARM)
endif()
endif()
endif()
################################################################################
# pkg-config - Helper tool used when compiling applications and libraries.
################################################################################
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
find_package(PkgConfig)
################################################################################
# Find the POSIX thread (pthread) libraries
################################################################################
if(CMAKE_VERSION VERSION_LESS 3.1)
# Workaround for CMake < 3.1
find_package(Threads REQUIRED)
add_library(Threads::Threads SHARED IMPORTED)
set_property(TARGET Threads::Threads PROPERTY INTERFACE_LINK_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
set_property(TARGET Threads::Threads PROPERTY IMPORTED_LINK_INTERFACE_LANGUAGES "CXX")
include(GNUInstallDirs)
# Fix bug in Debian 8.11
if(${LINUX_DISTRIBUTION} MATCHES "Debian")
if(${LINUX_VER} VERSION_LESS 8.12)
if(ARCH_64BITS)
set(FIX_PTHREADS_LOCATION "x86_64-linux-gnu/")
endif()
endif()
endif()
set_property(TARGET Threads::Threads PROPERTY IMPORTED_LOCATION /usr/${CMAKE_INSTALL_LIBDIR}/${FIX_PTHREADS_LOCATION}${CMAKE_FIND_LIBRARY_PREFIXES}pthread${CMAKE_SHARED_LIBRARY_SUFFIX})
else()
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
if(CMAKE_CROSSCOMPILING)
set(THREADS_PREFER_PTHREAD_FLAG FALSE)
else()
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
endif()
find_package(Threads REQUIRED)
endif()
set_package_properties(Threads PROPERTIES
URL "https://computing.llnl.gov/tutorials/pthreads/"
DESCRIPTION "Implements the POSIX Threads execution model"
PURPOSE "Used to implement parallelism."
TYPE REQUIRED
)
################################################################################
# Googletest - https://github.com/google/googletest
################################################################################
enable_testing()
if(ENABLE_UNIT_TESTING OR ENABLE_SYSTEM_TESTING)
if(NOT GTEST_DIR)
if(DEFINED ENV{GTEST_DIR})
set(GTEST_DIR $ENV{GTEST_DIR})
message(STATUS "Googletest root folder set at ${GTEST_DIR}")
endif()
endif()
endif()
find_package(GOOGLETEST)
set_package_properties(GOOGLETEST PROPERTIES
PURPOSE "Used for Unit and System Tests."
TYPE REQUIRED
)
if(NOT GOOGLETEST_FOUND)
set_package_properties(GOOGLETEST PROPERTIES
PURPOSE "Googletest v${GNSSSDR_GTEST_LOCAL_VERSION} will be downloaded and built when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'."
)
endif()
################################################################################
# GNU Radio - https://www.gnuradio.org
################################################################################
set(GR_REQUIRED_COMPONENTS RUNTIME PMT BLOCKS FFT FILTER ANALOG)
find_package(UHD)
set_package_properties(UHD PROPERTIES
PURPOSE "Used for communication with front-ends of the USRP family."
TYPE OPTIONAL
)
if(ENABLE_UHD)
if(NOT UHD_FOUND)
set(ENABLE_UHD OFF)
else()
set(GR_REQUIRED_COMPONENTS ${GR_REQUIRED_COMPONENTS} UHD)
endif()
endif()
find_package(GNURADIO)
set_package_properties(GNURADIO PROPERTIES
PURPOSE "Implements flowgraph scheduler, provides some processing blocks and classes to create new ones."
TYPE REQUIRED
)
################################################################################
# Log4cpp - http://log4cpp.sourceforge.net/
################################################################################
find_package(LOG4CPP)
set_package_properties(LOG4CPP PROPERTIES
PURPOSE "Required by GNU Radio."
TYPE REQUIRED
)
if(NOT LOG4CPP_FOUND)
message(FATAL_ERROR "*** Log4cpp is required to build gnss-sdr")
endif()
################################################################################
# Detect availability of std::filesystem and set C++ standard accordingly
################################################################################
set(FILESYSTEM_FOUND FALSE)
if(NOT (GNURADIO_VERSION VERSION_LESS 3.8) AND LOG4CPP_READY_FOR_CXX17)
# Check if we have std::filesystem
if(NOT (CMAKE_VERSION VERSION_LESS 3.8))
find_package(FILESYSTEM COMPONENTS Final Experimental)
set_package_properties(FILESYSTEM PROPERTIES
URL "https://en.cppreference.com/w/cpp/filesystem"
DESCRIPTION "Provides facilities for performing operations on file systems and their components"
PURPOSE "Work with paths, regular files, and directories."
TYPE OPTIONAL
)
if(${FILESYSTEM_FOUND})
if(CMAKE_VERSION VERSION_LESS 3.13)
set(CMAKE_CXX_STANDARD 17)
else()
set(CMAKE_CXX_STANDARD 20)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
endif()
endif()
################################################################################
# Boost - https://www.boost.org
################################################################################
if(UNIX AND EXISTS "/usr/lib64")
list(APPEND BOOST_LIBRARYDIR "/usr/lib64") # Fedora 64-bit fix
endif()
# Boost_ADDITIONAL_VERSIONS is only used internally by cmake to know the
# formation of newer versions. No need to increase, not used anymore since newer
# Boost provides its own CMake configuration files.
set(Boost_ADDITIONAL_VERSIONS
"1.53.0" "1.53" "1.54.0" "1.54"
"1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"
"1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64"
"1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69"
"1.70.0" "1.70" "1.71.0" "1.71"
)
set(Boost_USE_MULTITHREAD ON)
set(Boost_USE_STATIC_LIBS OFF)
set(BOOST_COMPONENTS atomic chrono date_time serialization system thread)
if(NOT ${FILESYSTEM_FOUND})
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} filesystem)
endif()
find_package(Boost ${GNSSSDR_BOOST_MIN_VERSION} COMPONENTS ${BOOST_COMPONENTS} REQUIRED)
if(NOT Boost_FOUND)
message(FATAL_ERROR "Fatal error: Boost (version >=${GNSSSDR_BOOST_MIN_VERSION}) required.")
endif()
set_package_properties(Boost PROPERTIES
URL "https://www.boost.org"
PURPOSE "Used widely across the source code."
TYPE REQUIRED
)
if(CMAKE_VERSION VERSION_LESS 3.14)
set(Boost_VERSION_STRING "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
endif()
if(POLICY CMP0093)
cmake_policy(SET CMP0093 NEW) # FindBoost reports Boost_VERSION in x.y.z format.
endif()
set_package_properties(Boost PROPERTIES
DESCRIPTION "Portable C++ source libraries (found: v${Boost_VERSION_STRING})"
)
# Define targets if CMake < 3.5
if(CMAKE_VERSION VERSION_LESS 3.5)
if(NOT TARGET Boost::date_time)
add_library(Boost::date_time SHARED IMPORTED)
set_target_properties(Boost::date_time PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_DATE_TIME_LIBRARIES}
IMPORTED_LOCATION ${Boost_DATE_TIME_LIBRARIES}
)
endif()
if(NOT TARGET Boost::system)
add_library(Boost::system SHARED IMPORTED)
set_target_properties(Boost::system PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_SYSTEM_LIBRARIES}
IMPORTED_LOCATION ${Boost_SYSTEM_LIBRARIES}
)
endif()
if(NOT TARGET Boost::thread)
add_library(Boost::thread SHARED IMPORTED)
set_target_properties(Boost::thread PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_THREAD_LIBRARIES}
IMPORTED_LOCATION ${Boost_THREAD_LIBRARIES}
)
endif()
if(NOT TARGET Boost::serialization)
add_library(Boost::serialization SHARED IMPORTED)
set_target_properties(Boost::serialization PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_SERIALIZATION_LIBRARIES}
IMPORTED_LOCATION ${Boost_SERIALIZATION_LIBRARIES}
)
endif()
if(NOT TARGET Boost::chrono)
add_library(Boost::chrono SHARED IMPORTED)
set_target_properties(Boost::chrono PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_CHRONO_LIBRARIES}
IMPORTED_LOCATION ${Boost_CHRONO_LIBRARIES}
)
endif()
if(NOT TARGET Boost::atomic)
add_library(Boost::atomic SHARED IMPORTED)
set_target_properties(Boost::atomic PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_ATOMIC_LIBRARIES}
IMPORTED_LOCATION ${Boost_ATOMIC_LIBRARIES}
)
endif()
if(NOT ${FILESYSTEM_FOUND})
if(NOT TARGET Boost::filesystem)
add_library(Boost::filesystem SHARED IMPORTED)
set_target_properties(Boost::filesystem PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_FILESYSTEM_LIBRARIES}
IMPORTED_LOCATION ${Boost_FILESYSTEM_LIBRARIES}
)
endif()
endif()
endif()
# Define Boost::headers target if CMake < 3.15
if(CMAKE_VERSION VERSION_LESS 3.15)
if(NOT TARGET Boost::headers)
if(CMAKE_VERSION VERSION_LESS 3.0)
add_library(Boost::headers SHARED IMPORTED) # Trick for CMake 2.8.12
set_target_properties(Boost::headers PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
IMPORTED_LOCATION ${Boost_DATE_TIME_LIBRARIES}
)
else()
add_library(Boost::headers INTERFACE IMPORTED)
set_target_properties(Boost::headers PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
)
endif()
endif()
endif()
# Provide package descriptions if Boost >= 1.71.00
if(Boost_VERSION_STRING VERSION_GREATER 1.70.99)
set_package_properties(boost_headers PROPERTIES
URL "https://www.boost.org/"
DESCRIPTION "Header files of Boost libraries"
PURPOSE "Used widely across the source code."
TYPE REQUIRED
)
set_package_properties(boost_atomic PROPERTIES
URL "https://www.boost.org/doc/libs/release/doc/html/atomic.html"
DESCRIPTION "Provides atomic data types and operations on those types"
PURPOSE "Required by Boost Thread."
TYPE REQUIRED
)
set_package_properties(boost_chrono PROPERTIES
URL "https://www.boost.org/doc/libs/release/doc/html/chrono.html"
DESCRIPTION "Useful time utilities"
PURPOSE "Required by Boost Thread."
TYPE REQUIRED
)
set_package_properties(boost_date_time PROPERTIES
URL "https://www.boost.org/doc/libs/release/doc/html/date_time.html"
DESCRIPTION "A set of date-time libraries"
PURPOSE "Required by Boost Thread."
TYPE REQUIRED
)
set_package_properties(boost_serialization PROPERTIES
URL "https://www.boost.org/doc/libs/release/libs/serialization/doc/index.html"
DESCRIPTION "Reversible deconstruction of C++ data structures to sequences of bytes"
PURPOSE "Used for serializing data."
TYPE REQUIRED
)
set_package_properties(boost_system PROPERTIES
URL "https://www.boost.org/doc/libs/release/libs/system/doc/html/system.html"
DESCRIPTION "Extensible error reporting library"
PURPOSE "Used for error reporting."
TYPE REQUIRED
)
set_package_properties(boost_thread PROPERTIES
URL "https://www.boost.org/doc/libs/release/doc/html/thread.html"
DESCRIPTION "Portable C++ multi-threading"
PURPOSE "Used by GNU Radio multi-threading system."
TYPE REQUIRED
)
if(NOT ${FILESYSTEM_FOUND})
set_package_properties(boost_filesystem PROPERTIES
URL "https://www.boost.org/doc/libs/release/libs/filesystem/doc/index.htm"
DESCRIPTION "Portable facilities to manipulate paths and files"
PURPOSE "Used for output file handling."
TYPE REQUIRED
)
endif()
endif()
# Fix for Boost Asio < 1.70 when using Clang in macOS
if(Boost_VERSION_STRING VERSION_LESS 1.70.0)
# Check if we have std::string_view
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#include <string_view>
int main()
{ std::string_view sv; }"
has_string_view
)
endif()
################################################################################
# VOLK - Vector-Optimized Library of Kernels
################################################################################
find_package(VOLK)
if(NOT VOLK_FOUND)
message(FATAL_ERROR "*** VOLK is required to build gnss-sdr")
endif()
set_package_properties(VOLK PROPERTIES
PURPOSE "Provides an abstraction of optimized math routines targeting several SIMD processors."
TYPE REQUIRED
)
################################################################################
# volk_gnsssdr module - GNSS-SDR's own VOLK library
################################################################################
find_package(VOLKGNSSSDR)
set_package_properties(VOLKGNSSSDR PROPERTIES
PURPOSE "Accelerates math routines targeting several SIMD processors."
TYPE REQUIRED
)
if(NOT VOLKGNSSSDR_FOUND)
message(STATUS " volk_gnsssdr will be built along with gnss-sdr when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'.")
###############################
# Find Python required modules
###############################
include(SetupPython) # sets PYTHON_EXECUTABLE and search for required modules
if(NOT PYTHON_MIN_VER_FOUND)
message(FATAL_ERROR "Python ${GNSSSDR_PYTHON_MIN_VERSION} or greater required to build VOLK_GNSSSDR")
endif()
if(${PYTHON3})
set(PYTHON_NAME "python3")
else()
set(PYTHON_NAME "python")
endif()
# Mako
if(NOT MAKO_FOUND)
message(STATUS "Mako template library not found. See https://www.makotemplates.org/")
message(STATUS " You can try to install it by typing:")
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(STATUS " sudo yum install ${PYTHON_NAME}-mako")
elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE")
message(STATUS " sudo zypper install ${PYTHON_NAME}-Mako")
else()
message(STATUS " sudo apt-get install ${PYTHON_NAME}-mako")
endif()
message(FATAL_ERROR "Mako templates required to build VOLK_GNSSSDR")
endif()
# Six
if(NOT SIX_FOUND)
message(STATUS "python-six not found. See https://pythonhosted.org/six/")
message(STATUS " You can try to install it by typing:")
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(STATUS " sudo yum install ${PYTHON_NAME}-six")
elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE")
message(STATUS " sudo zypper install ${PYTHON_NAME}-six")
else()
message(STATUS " sudo apt-get install ${PYTHON_NAME}-six")
endif()
message(FATAL_ERROR "six - python 2 and 3 compatibility library required to build VOLK_GNSSSDR")
endif()
if(CMAKE_VERSION VERSION_GREATER 3.12)
set_package_properties(Python3 PROPERTIES
URL "https://www.python.org/"
PURPOSE "Required to build volk_gnsssdr."
TYPE REQUIRED
)
if(Python3_FOUND)
set_package_properties(Python3 PROPERTIES
DESCRIPTION "An interpreted, high-level, general-purpose programming language (found: v${Python3_VERSION})"
)
else()
set_package_properties(Python3 PROPERTIES
DESCRIPTION "An interpreted, high-level, general-purpose programming language"
PURPOSE "Another Python version will be used."
)
endif()
if(Python2_FOUND)
set_package_properties(Python2 PROPERTIES
URL "https://www.python.org/"
DESCRIPTION "An interpreted, high-level, general-purpose programming language (found: v${Python2_VERSION})"
PURPOSE "Required to build volk_gnsssdr."
TYPE REQUIRED
)
endif()
endif()
if(PYTHONINTERP_FOUND)
set_package_properties(PythonInterp PROPERTIES
URL "https://www.python.org/"
DESCRIPTION "An interpreted, high-level, general-purpose programming language (found: v${PYTHON_VERSION_STRING})"
PURPOSE "Required to build volk_gnsssdr."
TYPE REQUIRED
)
endif()
set(STRIP_VOLK_GNSSSDR_PROFILE "")
if(ENABLE_PACKAGING)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
set(STRIP_VOLK_GNSSSDR_PROFILE "-DENABLE_STRIP=ON -DCMAKE_VERBOSE_MAKEFILE=ON")
endif()
endif()
set(VOLK_GNSSSDR_BUILD_COMMAND "${CMAKE_MAKE_PROGRAM}")
if(PYTHON_EXECUTABLE)
set(USE_THIS_PYTHON "-DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}")
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(CMAKE_GENERATOR STREQUAL Xcode)
set(VOLK_GNSSSDR_BUILD_COMMAND "xcodebuild"
"-configuration" $<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>
"-target"
)
endif()
endif()
if(CMAKE_TOOLCHAIN_FILE)
set(VOLK_GNSSSDR_COMPILER "")
else()
set(VOLK_GNSSSDR_COMPILER -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER})
endif()
find_package(ORC)
set_package_properties(ORC PROPERTIES
PURPOSE "Used by volk_gnsssdr."
TYPE OPTIONAL
)
if(ORC_FOUND)
set(ORC_ENABLED ON)
else()
set(ORC_ENABLED OFF)
endif()
set(VOLK_GNSSSDR_CMAKE_ARGS ${VOLK_GNSSSDR_COMPILER}
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module/install
-DENABLE_STATIC_LIBS=ON
-DENABLE_PROFILING=${ENABLE_PROFILING}
-DENABLE_ORC=${ORC_ENABLED}
${STRIP_VOLK_GNSSSDR_PROFILE}
${USE_THIS_PYTHON}
)
if(DEFINED ENV{OECORE_TARGET_SYSROOT})
set(VOLK_GNSSSDR_CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS}
-DCROSSCOMPILE_MULTILIB=TRUE
)
if(NOT CMAKE_TOOLCHAIN_FILE)
set(VOLK_GNSSSDR_CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_SOURCE_DIR}/cmake/Toolchains/oe-sdk_cross.cmake
)
endif()
else()
if(CMAKE_TOOLCHAIN_FILE)
set(VOLK_GNSSSDR_CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
)
endif()
endif()
if(CMAKE_VERSION VERSION_LESS 3.2)
ExternalProject_Add(volk_gnsssdr_module
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module/build
CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS}
-DCMAKE_BUILD_TYPE=$<$<CONFIG:None>:None>$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:NoOptWithASM>$<$<CONFIG:Coverage>:Coverage>$<$<CONFIG:O2WithASM>:O2WithASM>$<$<CONFIG:O3WithASM>:O3WithASM>$<$<CONFIG:ASAN>:ASAN>
DOWNLOAD_COMMAND ""
UPDATE_COMMAND ""
PATCH_COMMAND ""
BUILD_COMMAND ${VOLK_GNSSSDR_BUILD_COMMAND} volk_gnsssdr_profile
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module/install
)
else()
ExternalProject_Add(volk_gnsssdr_module
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module/build
CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS}
-DCMAKE_BUILD_TYPE=$<$<CONFIG:None>:None>$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:NoOptWithASM>$<$<CONFIG:Coverage>:Coverage>$<$<CONFIG:O2WithASM>:O2WithASM>$<$<CONFIG:O3WithASM>:O3WithASM>$<$<CONFIG:ASAN>:ASAN>
DOWNLOAD_COMMAND ""
UPDATE_COMMAND ""
PATCH_COMMAND ""
BUILD_COMMAND ${VOLK_GNSSSDR_BUILD_COMMAND} volk_gnsssdr_profile
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}volk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX}
${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr_profile
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module/install
)
endif()
if(NOT ORC_FOUND)
set(ORC_LIBRARIES "")
set(ORC_INCLUDE_DIRS "")
endif()
add_library(volk_gnsssdr UNKNOWN IMPORTED)
set_property(TARGET volk_gnsssdr PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module/install/lib/libvolk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX})
set(VOLK_GNSSSDR_INCLUDE_DIRS "${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module/build/include/;${CMAKE_CURRENT_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/include;${ORC_INCLUDE_DIRS}")
set(VOLK_GNSSSDR_LIBRARIES volk_gnsssdr ${ORC_LIBRARIES})
if(NOT TARGET Volkgnsssdr::volkgnsssdr)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module/build/include)
add_library(Volkgnsssdr::volkgnsssdr STATIC IMPORTED)
add_dependencies(Volkgnsssdr::volkgnsssdr volk_gnsssdr_module)
set_target_properties(Volkgnsssdr::volkgnsssdr PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module/install/lib/libvolk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX}"
INCLUDE_DIRECTORIES "${VOLK_GNSSSDR_INCLUDE_DIRS}"
INTERFACE_INCLUDE_DIRECTORIES "${VOLK_GNSSSDR_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${VOLK_GNSSSDR_LIBRARIES}"
)
endif()
if(CMAKE_VERSION VERSION_LESS 3.2)
add_custom_command(TARGET volk_gnsssdr_module POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr_profile
${CMAKE_SOURCE_DIR}/install/volk_gnsssdr_profile
)
else()
add_custom_command(TARGET volk_gnsssdr_module POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr_profile
${CMAKE_SOURCE_DIR}/install/volk_gnsssdr_profile
BYPRODUCTS ${CMAKE_SOURCE_DIR}/install/volk_gnsssdr_profile
)
endif()
add_custom_command(TARGET volk_gnsssdr_module POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr-config-info
${CMAKE_SOURCE_DIR}/install/volk_gnsssdr-config-info
)
set_package_properties(VOLKGNSSSDR PROPERTIES
PURPOSE "volk_gnsssdr will be built when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'."
)
endif()
################################################################################
# gflags - https://github.com/gflags/gflags
################################################################################
set(LOCAL_GFLAGS FALSE)
find_package(GFLAGS)
set_package_properties(GFLAGS PROPERTIES
PURPOSE "Used for commandline flags management."
TYPE REQUIRED
)
if(NOT GFLAGS_FOUND)
message(STATUS " gflags library has not been found.")
message(STATUS " gflags v${GNSSSDR_GFLAGS_LOCAL_VERSION} will be downloaded and built automatically")
message(STATUS " when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'.")
set(GFLAGS_BUILD_COMMAND ${CMAKE_COMMAND}