From 95596b8f918a95ee9d5c6f03e3f7a5d606e99f7b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 29 Apr 2024 08:27:33 +0200 Subject: [PATCH] Soft transition from Gflags and Glog to Abseil. Some CI fixes --- .clang-tidy | 1 - .github/workflows/main.yml | 31 +- CMakeLists.txt | 873 ++++++++++-------- README.md | 19 +- docs/CHANGELOG.md | 31 +- src/algorithms/PVT/adapters/CMakeLists.txt | 8 +- src/algorithms/PVT/adapters/rtklib_pvt.cc | 25 +- .../PVT/gnuradio_blocks/CMakeLists.txt | 9 +- .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 7 +- src/algorithms/PVT/libs/CMakeLists.txt | 11 +- src/algorithms/PVT/libs/an_packet_printer.cc | 7 +- src/algorithms/PVT/libs/geohash.cc | 2 +- src/algorithms/PVT/libs/geojson_printer.cc | 7 +- src/algorithms/PVT/libs/gpx_printer.cc | 6 +- src/algorithms/PVT/libs/has_simple_printer.cc | 7 +- src/algorithms/PVT/libs/kml_printer.cc | 6 +- src/algorithms/PVT/libs/nmea_printer.cc | 7 +- src/algorithms/PVT/libs/pvt_kf.cc | 6 +- src/algorithms/PVT/libs/pvt_solution.cc | 6 +- src/algorithms/PVT/libs/rinex_printer.cc | 6 +- src/algorithms/PVT/libs/rtcm.h | 7 +- src/algorithms/PVT/libs/rtcm_printer.cc | 6 +- src/algorithms/PVT/libs/rtklib_solver.cc | 6 +- .../acquisition/adapters/CMakeLists.txt | 8 +- .../adapters/beidou_b1i_pcps_acquisition.cc | 14 +- .../adapters/beidou_b3i_pcps_acquisition.cc | 14 +- ...lileo_e1_pcps_8ms_ambiguous_acquisition.cc | 14 +- .../galileo_e1_pcps_ambiguous_acquisition.cc | 14 +- ...ileo_e1_pcps_ambiguous_acquisition_fpga.cc | 14 +- ...eo_e1_pcps_cccwsr_ambiguous_acquisition.cc | 13 +- ...e1_pcps_quicksync_ambiguous_acquisition.cc | 14 +- ...ileo_e1_pcps_tong_ambiguous_acquisition.cc | 14 +- ...ileo_e5a_noncoherent_iq_acquisition_caf.cc | 14 +- .../adapters/galileo_e5a_pcps_acquisition.cc | 14 +- .../galileo_e5a_pcps_acquisition_fpga.cc | 14 +- .../adapters/galileo_e5b_pcps_acquisition.cc | 14 +- .../galileo_e5b_pcps_acquisition_fpga.cc | 14 +- .../adapters/galileo_e6_pcps_acquisition.cc | 14 +- .../glonass_l1_ca_pcps_acquisition.cc | 14 +- .../glonass_l2_ca_pcps_acquisition.cc | 14 +- .../adapters/gps_l1_ca_pcps_acquisition.cc | 14 +- ...gps_l1_ca_pcps_acquisition_fine_doppler.cc | 13 +- .../gps_l1_ca_pcps_acquisition_fpga.cc | 14 +- .../gps_l1_ca_pcps_assisted_acquisition.cc | 13 +- .../gps_l1_ca_pcps_opencl_acquisition.cc | 14 +- .../gps_l1_ca_pcps_quicksync_acquisition.cc | 14 +- .../gps_l1_ca_pcps_tong_acquisition.cc | 14 +- .../adapters/gps_l2_m_pcps_acquisition.cc | 14 +- .../gps_l2_m_pcps_acquisition_fpga.cc | 14 +- .../adapters/gps_l5i_pcps_acquisition.cc | 15 +- .../adapters/gps_l5i_pcps_acquisition_fpga.cc | 14 +- .../gnuradio_blocks/CMakeLists.txt | 9 +- ...o_e5a_noncoherent_iq_acquisition_caf_cc.cc | 7 +- .../galileo_pcps_8ms_acquisition_cc.cc | 6 +- .../gnuradio_blocks/pcps_acquisition.cc | 18 + .../gnuradio_blocks/pcps_acquisition.h | 13 +- .../pcps_acquisition_fine_doppler_cc.cc | 7 +- .../gnuradio_blocks/pcps_acquisition_fpga.cc | 17 +- .../gnuradio_blocks/pcps_acquisition_fpga.h | 10 +- .../pcps_assisted_acquisition_cc.cc | 6 +- .../pcps_cccwsr_acquisition_cc.cc | 7 +- .../pcps_opencl_acquisition_cc.cc | 7 +- .../pcps_quicksync_acquisition_cc.cc | 7 +- .../pcps_tong_acquisition_cc.cc | 7 +- .../acquisition/libs/CMakeLists.txt | 9 +- src/algorithms/acquisition/libs/acq_conf.cc | 7 +- .../acquisition/libs/acq_conf_fpga.cc | 7 +- .../acquisition/libs/fpga_acquisition.cc | 6 +- .../channel/adapters/CMakeLists.txt | 8 +- src/algorithms/channel/adapters/channel.cc | 13 +- src/algorithms/channel/libs/CMakeLists.txt | 9 +- src/algorithms/channel/libs/channel_fsm.cc | 7 +- .../channel/libs/channel_msg_receiver_cc.cc | 7 +- .../conditioner/adapters/CMakeLists.txt | 10 +- .../adapters/array_signal_conditioner.cc | 6 +- .../adapters/signal_conditioner.cc | 6 +- .../data_type_adapter/adapters/CMakeLists.txt | 9 +- .../adapters/byte_to_short.cc | 7 +- .../adapters/ibyte_to_cbyte.cc | 7 +- .../adapters/ibyte_to_complex.cc | 5 + .../adapters/ibyte_to_cshort.cc | 6 +- .../adapters/ishort_to_complex.cc | 6 +- .../adapters/ishort_to_cshort.cc | 6 +- .../input_filter/adapters/CMakeLists.txt | 9 +- .../adapters/beamformer_filter.cc | 6 +- .../input_filter/adapters/fir_filter.cc | 6 +- .../adapters/freq_xlating_fir_filter.cc | 6 +- .../input_filter/adapters/notch_filter.cc | 6 +- .../adapters/notch_filter_lite.cc | 6 +- .../adapters/pulse_blanking_filter.cc | 6 +- src/algorithms/libs/CMakeLists.txt | 24 +- src/algorithms/libs/gnss_sdr_flags.cc | 30 +- src/algorithms/libs/gnss_sdr_flags.h | 128 ++- src/algorithms/libs/pass_through.cc | 6 +- src/algorithms/libs/rtklib/CMakeLists.txt | 9 +- src/algorithms/libs/rtklib/rtklib_rtkcmn.cc | 7 +- .../observables/adapters/CMakeLists.txt | 8 +- .../adapters/hybrid_observables.cc | 11 +- .../gnuradio_blocks/CMakeLists.txt | 9 +- .../gnuradio_blocks/hybrid_observables_gs.cc | 7 +- src/algorithms/observables/libs/obs_conf.cc | 6 + .../resampler/adapters/CMakeLists.txt | 9 +- .../adapters/direct_resampler_conditioner.cc | 6 +- .../adapters/mmse_resampler_conditioner.cc | 7 +- .../signal_generator/adapters/CMakeLists.txt | 9 +- .../adapters/signal_generator.cc | 6 +- .../signal_source/adapters/CMakeLists.txt | 8 +- .../adapters/ad9361_fpga_signal_source.cc | 6 +- .../adapters/ad936x_custom_signal_source.cc | 7 +- .../adapters/custom_udp_signal_source.cc | 6 +- .../adapters/fifo_signal_source.cc | 6 +- .../adapters/file_signal_source.cc | 5 + .../adapters/file_source_base.cc | 19 +- .../adapters/file_timestamp_signal_source.cc | 16 +- .../adapters/flexiband_signal_source.cc | 7 +- .../adapters/fmcomms2_signal_source.cc | 7 +- .../four_bit_cpx_file_signal_source.cc | 14 +- .../adapters/gen_signal_source.cc | 6 +- .../adapters/labsat_signal_source.cc | 7 +- .../adapters/limesdr_signal_source.cc | 7 +- .../multichannel_file_signal_source.cc | 7 +- .../adapters/nsr_file_signal_source.cc | 5 + .../adapters/osmosdr_signal_source.cc | 7 +- .../adapters/plutosdr_signal_source.cc | 6 +- .../adapters/raw_array_signal_source.cc | 6 +- .../adapters/rtl_tcp_signal_source.cc | 7 +- .../adapters/spir_file_signal_source.cc | 7 +- .../spir_gss6450_file_signal_source.cc | 8 +- .../two_bit_cpx_file_signal_source.cc | 5 + .../two_bit_packed_file_signal_source.cc | 7 +- .../adapters/uhd_signal_source.cc | 7 +- .../adapters/zmq_signal_source.cc | 5 + .../gnuradio_blocks/CMakeLists.txt | 9 +- .../gnuradio_blocks/fifo_reader.cc | 5 + .../rtl_tcp_signal_source_c.cc | 6 +- .../signal_source/libs/CMakeLists.txt | 9 +- .../signal_source/libs/ad9361_manager.cc | 7 +- .../signal_source/libs/ad936x_iio_custom.cc | 7 +- .../signal_source/libs/fpga_buffer_monitor.cc | 7 +- .../libs/fpga_dynamic_bit_selection.cc | 7 +- .../signal_source/libs/fpga_switch.cc | 7 +- .../signal_source/libs/gnss_sdr_valve.cc | 7 +- .../telemetry_decoder/adapters/CMakeLists.txt | 9 +- .../adapters/beidou_b1i_telemetry_decoder.cc | 5 + .../adapters/beidou_b3i_telemetry_decoder.cc | 5 + .../adapters/galileo_e1b_telemetry_decoder.cc | 5 + .../adapters/galileo_e5a_telemetry_decoder.cc | 5 + .../adapters/galileo_e5b_telemetry_decoder.cc | 5 + .../adapters/galileo_e6_telemetry_decoder.cc | 5 + .../glonass_l1_ca_telemetry_decoder.cc | 5 + .../glonass_l2_ca_telemetry_decoder.cc | 5 + .../adapters/gps_l1_ca_telemetry_decoder.cc | 5 + .../adapters/gps_l2c_telemetry_decoder.cc | 5 + .../adapters/gps_l5_telemetry_decoder.cc | 5 + .../adapters/sbas_l1_telemetry_decoder.cc | 6 +- .../gnuradio_blocks/CMakeLists.txt | 9 +- .../beidou_b1i_telemetry_decoder_gs.cc | 7 +- .../beidou_b3i_telemetry_decoder_gs.cc | 7 +- .../galileo_telemetry_decoder_gs.cc | 7 +- .../glonass_l1_ca_telemetry_decoder_gs.cc | 7 +- .../glonass_l2_ca_telemetry_decoder_gs.cc | 7 +- .../gps_l1_ca_telemetry_decoder_gs.cc | 7 +- .../gps_l2c_telemetry_decoder_gs.cc | 6 +- .../gps_l5_telemetry_decoder_gs.cc | 7 +- .../sbas_l1_telemetry_decoder_gs.cc | 7 +- .../telemetry_decoder/libs/CMakeLists.txt | 9 +- .../telemetry_decoder/libs/tlm_crc_stats.cc | 6 +- .../libs/viterbi_decoder_sbas.cc | 7 +- .../tracking/adapters/CMakeLists.txt | 8 +- .../adapters/beidou_b1i_dll_pll_tracking.cc | 6 +- .../adapters/beidou_b3i_dll_pll_tracking.cc | 7 +- .../galileo_e1_dll_pll_veml_tracking.cc | 7 +- .../galileo_e1_dll_pll_veml_tracking_fpga.cc | 7 +- .../galileo_e1_tcp_connector_tracking.cc | 21 +- .../adapters/galileo_e5a_dll_pll_tracking.cc | 7 +- .../galileo_e5a_dll_pll_tracking_fpga.cc | 7 +- .../adapters/galileo_e5b_dll_pll_tracking.cc | 7 +- .../adapters/galileo_e6_dll_pll_tracking.cc | 7 +- .../glonass_l1_ca_dll_pll_c_aid_tracking.cc | 20 + .../glonass_l1_ca_dll_pll_tracking.cc | 20 + .../glonass_l2_ca_dll_pll_c_aid_tracking.cc | 20 + .../glonass_l2_ca_dll_pll_tracking.cc | 19 + .../adapters/gps_l1_ca_dll_pll_tracking.cc | 7 +- .../gps_l1_ca_dll_pll_tracking_fpga.cc | 7 +- .../gps_l1_ca_dll_pll_tracking_gpu.cc | 14 + .../adapters/gps_l1_ca_gaussian_tracking.cc | 12 + .../adapters/gps_l1_ca_kf_tracking.cc | 7 +- .../gps_l1_ca_tcp_connector_tracking.cc | 7 +- .../adapters/gps_l2_m_dll_pll_tracking.cc | 7 +- .../gps_l2_m_dll_pll_tracking_fpga.cc | 7 +- .../adapters/gps_l5_dll_pll_tracking.cc | 7 +- .../adapters/gps_l5_dll_pll_tracking_fpga.cc | 7 +- .../tracking/gnuradio_blocks/CMakeLists.txt | 8 +- .../gnuradio_blocks/dll_pll_veml_tracking.cc | 7 +- .../dll_pll_veml_tracking_fpga.cc | 7 +- .../galileo_e1_tcp_connector_tracking_cc.cc | 35 +- ...glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc | 28 +- ...glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc | 28 +- .../glonass_l1_ca_dll_pll_tracking_cc.cc | 24 +- ...glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc | 26 +- ...glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc | 24 +- .../glonass_l2_ca_dll_pll_tracking_cc.cc | 24 +- .../gps_l1_ca_dll_pll_tracking_gpu_cc.cc | 34 +- .../gps_l1_ca_gaussian_tracking_cc.cc | 33 +- .../gps_l1_ca_tcp_connector_tracking_cc.cc | 33 +- .../tracking/gnuradio_blocks/kf_tracking.cc | 7 +- src/algorithms/tracking/libs/CMakeLists.txt | 8 +- src/algorithms/tracking/libs/dll_pll_conf.cc | 29 +- .../tracking/libs/dll_pll_conf_fpga.cc | 28 +- .../tracking/libs/fpga_multicorrelator.cc | 7 +- src/algorithms/tracking/libs/kf_conf.cc | 20 +- .../tracking/libs/tracking_loop_filter.cc | 7 +- src/core/interfaces/signal_source_interface.h | 5 + src/core/libs/CMakeLists.txt | 9 +- src/core/libs/channel_status_msg_receiver.cc | 7 +- src/core/libs/galileo_e6_has_msg_receiver.cc | 7 +- src/core/libs/galileo_tow_map.cc | 13 +- src/core/libs/gnss_sdr_fpga_sample_counter.cc | 6 +- src/core/libs/gnss_sdr_supl_client.cc | 7 +- src/core/libs/nav_message_monitor.cc | 7 +- src/core/receiver/CMakeLists.txt | 10 +- src/core/receiver/control_thread.cc | 29 +- src/core/receiver/file_configuration.cc | 6 +- src/core/receiver/gnss_block_factory.cc | 7 +- src/core/receiver/gnss_flowgraph.cc | 17 +- src/core/system_parameters/CMakeLists.txt | 10 +- .../system_parameters/galileo_cnav_message.cc | 9 +- .../system_parameters/galileo_fnav_message.cc | 7 +- .../system_parameters/galileo_inav_message.cc | 6 +- .../glonass_gnav_navigation_message.cc | 7 +- src/core/system_parameters/gnss_satellite.cc | 7 +- src/main/CMakeLists.txt | 24 +- src/main/main.cc | 98 +- src/tests/CMakeLists.txt | 96 +- src/tests/common-files/gnuplot_i.h | 7 +- .../common-files/observable_tests_flags.h | 17 +- .../common-files/signal_generator_flags.h | 24 +- src/tests/common-files/test_flags.h | 18 +- src/tests/common-files/tracking_tests_flags.h | 61 +- src/tests/single_test_main.cc | 63 +- src/tests/system-tests/libs/CMakeLists.txt | 8 +- .../system-tests/libs/position_test_flags.h | 26 +- src/tests/system-tests/position_test.cc | 237 ++++- src/tests/system-tests/ttff.cc | 105 ++- src/tests/test_main.cc | 59 +- .../arithmetic/complex_carrier_test.cc | 73 +- .../unit-tests/arithmetic/conjugate_test.cc | 73 +- .../unit-tests/arithmetic/fft_length_test.cc | 42 +- .../unit-tests/arithmetic/fft_speed_test.cc | 20 + .../arithmetic/magnitude_squared_test.cc | 76 +- .../unit-tests/arithmetic/multiply_test.cc | 126 ++- .../control-plane/control_thread_test.cc | 8 +- .../acquisition/acq_performance_test.cc | 278 +++++- .../beidou_b1i_pcps_acquisition_test.cc | 9 +- .../beidou_b3i_pcps_acquisition_test.cc | 9 +- ...ileo_e1_pcps_ambiguous_acquisition_test.cc | 21 +- ...e1_pcps_ambiguous_acquisition_test_fpga.cc | 7 +- ...ync_ambiguous_acquisition_gsoc2014_test.cc | 45 +- .../gps_l1_ca_pcps_acquisition_test.cc | 32 +- .../gps_l1_ca_pcps_acquisition_test_fpga.cc | 7 +- ...cps_quicksync_acquisition_gsoc2014_test.cc | 44 +- .../gps_l2_m_pcps_acquisition_test.cc | 20 + .../filter/fir_filter_test.cc | 12 +- .../filter/notch_filter_lite_test.cc | 13 +- .../filter/notch_filter_test.cc | 12 +- .../filter/pulse_blanking_filter_test.cc | 12 +- .../libs/CMakeLists.txt | 9 +- .../libs/acquisition_msg_rx.cc | 11 +- .../observables/hybrid_observables_test.cc | 226 ++++- .../hybrid_observables_test_fpga.cc | 184 +++- .../gps_l1_ca_telemetry_decoder_test.cc | 40 +- .../cpu_multicorrelator_real_codes_test.cc | 31 +- .../tracking/cpu_multicorrelator_test.cc | 27 +- .../galileo_e1_dll_pll_veml_tracking_test.cc | 2 +- .../gps_l1_ca_dll_pll_tracking_test.cc | 225 ++++- .../gps_l1_ca_dll_pll_tracking_test_fpga.cc | 46 +- .../gps_l1_ca_gaussian_tracking_test.cc | 85 +- .../tracking/gpu_multicorrelator_test.cc | 19 +- .../tracking/tracking_pull-in_test.cc | 278 +++++- .../tracking/tracking_pull-in_test_fpga.cc | 239 ++++- .../system-parameters/has_decoding_test.cc | 18 +- src/utils/front-end-cal/CMakeLists.txt | 17 +- src/utils/front-end-cal/front_end_cal.cc | 7 +- src/utils/front-end-cal/main.cc | 102 +- src/utils/rinex-tools/CMakeLists.txt | 14 +- src/utils/rinex-tools/obsdiff.cc | 116 ++- src/utils/rinex-tools/obsdiff_flags.h | 20 + src/utils/rinex2assist/CMakeLists.txt | 8 +- src/utils/rinex2assist/main.cc | 39 +- 289 files changed, 5930 insertions(+), 952 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 0ef91e2ec..3ddbd1a51 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -120,7 +120,6 @@ Checks: '-*, readability-uppercase-literal-suffix' WarningsAsErrors: '' HeaderFilterRegex: '' -AnalyzeTemporaryDtors: false FormatStyle: 'file' CheckOptions: - key: performance-unnecessary-copy-initialization.ExcludedContainerTypes diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 060517643..8323fdea8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,8 +57,7 @@ jobs: rm /usr/local/bin/python3.1* || true export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew link --overwrite python@3.12 - brew install ninja hdf5 automake armadillo lapack libmatio \ - gflags glog gnuradio log4cpp openssl pugixml protobuf + brew install ninja hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf pip3 install mako - name: configure run: cd build && cmake -GNinja .. @@ -90,8 +89,7 @@ jobs: rm /usr/local/bin/python3.1* || true export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew link --overwrite python@3.12 - brew install ninja pkg-config hdf5 automake armadillo lapack libmatio \ - gflags glog gnuradio log4cpp openssl pugixml protobuf + brew install ninja pkg-config hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf pip3 install mako - name: configure run: cd build && cmake -GXcode .. @@ -142,16 +140,15 @@ jobs: rm /usr/local/bin/python3.1* || true export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew link --overwrite python@3.12 - brew install ninja pkg-config hdf5 automake armadillo lapack libmatio \ - gflags glog gnuradio log4cpp openssl pugixml protobuf llvm - pip3 install mako + brew install ninja pkg-config hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf llvm + pip3 install mako ln -s $(brew --prefix llvm)/bin/clang-tidy /usr/local/bin ln -s $(brew --prefix llvm)/bin/clang-apply-replacements /usr/local/bin ln -s $(brew --prefix llvm)/bin/run-clang-tidy.py /usr/local/bin - name: Prepare run run: cd build && cmake .. && make volk_gnsssdr_module gtest-1.14.0 core_monitor core_libs pvt_libs - name: run clang-tidy - run: cd build && /usr/local/opt/llvm/bin/run-clang-tidy -fix + run: cd build && /opt/homebrew/opt/llvm/bin/run-clang-tidy -fix - name: check run: | git diff > clang_tidy.patch @@ -243,8 +240,13 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 - - name: install dependencies - run: pip3 install mako + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install mako - name: configure run: cd build && cmake ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr - name: build @@ -256,8 +258,13 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 - - name: install dependencies - run: pip3 install mako + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install mako - name: configure run: cd build && cmake -GXcode ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr - name: build diff --git a/CMakeLists.txt b/CMakeLists.txt index b780e3144..aa4eafe9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,9 +74,20 @@ option(ENABLE_PACKAGING "Enable software packaging" OFF) option(ENABLE_OWN_GLOG "Download glog and link it to gflags" OFF) +option(ENABLE_GLOG_AND_GFLAGS "Force using Google glog and Gflags instead of Abseil" OFF) + +option(ENABLE_OWN_ABSEIL "Forces downloading and building of Abseil" OFF) +if(CMAKE_VERSION VERSION_LESS 3.24) + set(ENABLE_OWN_ABSEIL OFF) +endif() +if(ENABLE_OWN_ABSEIL) + set(ENABLE_OWN_GLOG OFF) + set(ENABLE_GLOG_AND_GFLAGS OFF) +endif() + option(ENABLE_OWN_ARMADILLO "Download and build Armadillo locally" OFF) -option(ENABLE_LOG "Enable logging" ON) +option(ENABLE_LOG "Enable internal logging" ON) option(ENABLE_ARMA_NO_DEBUG OFF) @@ -329,6 +340,7 @@ set(GNSSSDR_MATIO_MIN_VERSION "1.5.3") set(GNSSSDR_PROTOBUF_MIN_VERSION "3.0.0") set(GNSSSDR_PYTHON_MIN_VERSION "2.7") set(GNSSSDR_PYTHON3_MIN_VERSION "3.4") +set(GNSSSDR_ABSEIL_MIN_VERSION "20240116") @@ -1157,7 +1169,7 @@ if(NOT VOLKGNSSSDR_FOUND) if(CMAKE_GENERATOR STREQUAL Xcode) set(VOLK_GNSSSDR_BUILD_COMMAND "xcodebuild" - "-configuration" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel> + "-configuration" $<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:Debug>:RelWithDebInfo>$<$:Debug> ) endif() @@ -1392,316 +1404,427 @@ endif() ################################################################################ -# gflags - https://github.com/gflags/gflags +# Abseil C++ - https://abseil.io/docs/cpp/ ################################################################################ -set(LOCAL_GFLAGS FALSE) -if(ENABLE_OWN_GLOG) - unset(Glog::glog CACHE) - unset(GLOG_FOUND CACHE) - unset(Gflags::gflags CACHE) - unset(GLAGS_FOUND CACHE) - set(GFLAGS_GREATER_20 TRUE) -else() - unset(Glog::glog CACHE) - unset(GLOG_FOUND CACHE) - find_package(GLOG) - if(GLOG_FOUND) - unset(GFLAGS_GREATER_20 CACHE) - find_package(GFLAGS) - endif() -endif() -set_package_properties(GFLAGS PROPERTIES - PURPOSE "Used for commandline flags management." - TYPE REQUIRED -) -if(NOT GFLAGS_FOUND) - set(ENABLE_OWN_GLOG ON) - if(GFLAGS_VERSION) - message(STATUS " A version of the gflags library equal or higher than v${GNSSSDR_GFLAGS_MIN_VERSION} has not been found.") - else() - message(STATUS " The gflags library has not been found.") - endif() - message(STATUS " gflags v${GNSSSDR_GFLAGS_LOCAL_VERSION} will be downloaded, built, and statically linked automatically") - message(STATUS " when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'.") - set(GFLAGS_BUILD_COMMAND ${CMAKE_COMMAND} - "--build" "${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}" - "--config" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> - ) - if(CMAKE_GENERATOR STREQUAL Xcode) - set(GFLAGS_BUILD_COMMAND "xcodebuild" "-configuration" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>) - endif() - if(CMAKE_TOOLCHAIN_FILE) - set(GFLAGS_TOOLCHAIN_FILE -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) - endif() +if(CMAKE_VERSION VERSION_GREATER 3.13 + AND NOT (CMAKE_CXX_STANDARD VERSION_LESS 14) + AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3.1) + AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0) + AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12) + AND NOT ENABLE_OWN_GLOG + AND NOT ENABLE_GLOG_AND_GFLAGS) + # See https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md - if(CMAKE_VERSION VERSION_LESS 3.2) - ExternalProject_Add(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - PREFIX ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - GIT_REPOSITORY https://github.com/gflags/gflags.git - GIT_TAG v${GNSSSDR_GFLAGS_LOCAL_VERSION} - SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gflags/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - BINARY_DIR ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF - -DBUILD_STATIC_LIBS=ON - -DBUILD_gflags_LIB=ON - -DBUILD_gflags_nothreads_LIB=ON - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - ${GFLAGS_TOOLCHAIN_FILE} - -DGFLAGS_NAMESPACE=google - -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> - BUILD_COMMAND ${GFLAGS_BUILD_COMMAND} - UPDATE_COMMAND "" - PATCH_COMMAND "" - INSTALL_COMMAND "" + if(ENABLE_OWN_ABSEIL) + include(FetchContent) + set(ABSEIL_BUILD_COMMAND ${CMAKE_COMMAND} + "--build" "${GNSSSDR_BINARY_DIR}/abseil-cpp" + "--config" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> + "--target" "install" ) - else() - set(GFLAGS_BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX}) - if((CMAKE_BUILD_TYPE STREQUAL Debug) OR (CMAKE_BUILD_TYPE STREQUAL NoOptWithASM) OR - (CMAKE_BUILD_TYPE STREQUAL Coverage) OR (CMAKE_BUILD_TYPE STREQUAL ASAN)) # Workaround for Ninja generator - set(GFLAGS_BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags_debug${CMAKE_STATIC_LIBRARY_SUFFIX}) + if(CMAKE_GENERATOR STREQUAL Xcode) + set(ABSEIL_BUILD_COMMAND "xcodebuild" "-configuration" $<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:Debug>) endif() - if((CMAKE_VERSION VERSION_GREATER 3.12.0) AND NOT (CMAKE_GENERATOR STREQUAL Xcode)) - set(PARALLEL_BUILD "--parallel 2") + if(CMAKE_TOOLCHAIN_FILE) + set(ABSEIL_TOOLCHAIN_FILE -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) endif() - ExternalProject_Add(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - PREFIX ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - GIT_REPOSITORY https://github.com/gflags/gflags.git - GIT_TAG v${GNSSSDR_GFLAGS_LOCAL_VERSION} - SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gflags/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - BINARY_DIR ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF - -DBUILD_STATIC_LIBS=ON - -DBUILD_gflags_LIB=ON - -DBUILD_gflags_nothreads_LIB=ON - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - ${GFLAGS_TOOLCHAIN_FILE} - -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> - BUILD_COMMAND "${GFLAGS_BUILD_COMMAND} ${PARALLEL_BUILD}" - BUILD_BYPRODUCTS ${GFLAGS_BUILD_BYPRODUCTS} - UPDATE_COMMAND "" - PATCH_COMMAND "" - INSTALL_COMMAND "" + set(ABSL_PROPAGATE_CXX_STD ON) + FetchContent_Declare( + absl + GIT_REPOSITORY https://github.com/abseil/abseil-cpp + GIT_TAG master # live at head + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/abseil-cpp + CMAKE_ARGS -DABSL_PROPAGATE_CXX_STD=ON -ABSL_BUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/abseil-cpp ${ABSEIL_TOOLCHAIN_FILE} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/abseil-cpp + BUILD_COMMAND ${ABSEIL_BUILD_COMMAND} + OVERRIDE_FIND_PACKAGE # Requires CMake 3.24 ) - endif() - # Note: -DBUILD_gflags_nothreads_LIB=ON is required as a workaround to a bug in gflags 2.2.2. This is fixed in gflags master branch - - set(GFlags_INCLUDE_DIRS - ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/include CACHE PATH "Local Gflags headers" - ) - - if(CMAKE_VERSION VERSION_LESS "3.0.2") - set(GFlags_LIBS - ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} + FetchContent_MakeAvailable(absl) + set(absl_FOUND TRUE) + set(ENABLE_GLOG_AND_GFLAGS OFF) + else() + find_package(absl) + set_package_properties(absl PROPERTIES + URL "https://github.com/abseil/abseil-cpp" + PURPOSE "Making use of Abseil's log and flags libraries." + TYPE OPTIONAL ) - endif() - - if(NOT TARGET Gflags::gflags) - file(MAKE_DIRECTORY ${GFlags_INCLUDE_DIRS}) - add_library(Gflags::gflags STATIC IMPORTED) - add_dependencies(Gflags::gflags gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) - set_target_properties(Gflags::gflags PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_CONFIGURATIONS "None;Debug;Release;RelWithDebInfo;MinSizeRel" - MAP_IMPORTED_CONFIG_NOOPTWITHASM Debug - MAP_IMPORTED_CONFIG_COVERAGE Debug - MAP_IMPORTED_CONFIG_O2WITHASM RelWithDebInfo - MAP_IMPORTED_CONFIG_O3WITHASM RelWithDebInfo - MAP_IMPORTED_CONFIG_ASAN Debug - IMPORTED_LOCATION_NONE ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags_debug${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} - INTERFACE_INCLUDE_DIRECTORIES ${GFlags_INCLUDE_DIRS} - INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags$<$:_debug>${CMAKE_STATIC_LIBRARY_SUFFIX} - ) - if((CMAKE_GENERATOR STREQUAL Xcode) OR MSVC) - if(MSVC) - set(MSVC_POSTFIX _static) - endif() - set_target_properties(Gflags::gflags PROPERTIES - IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}_debug${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/Release/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} - INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}$<$:_debug>${CMAKE_STATIC_LIBRARY_SUFFIX} + if(absl_FOUND) + set_package_properties(absl PROPERTIES + DESCRIPTION "A collection of C++ library code designed to augment the C++ standard library (found: v${absl_VERSION})" + ) + else() + set_package_properties(absl PROPERTIES + DESCRIPTION "A collection of C++ library code designed to augment the C++ standard library" + ) + endif() + if("${absl_VERSION}" VERSION_LESS ${GNSSSDR_ABSEIL_MIN_VERSION}) + unset(absl_FOUND CACHE) + set(absl_FOUND FALSE) + set(ENABLE_GLOG_AND_GFLAGS ON) + set_package_properties(absl PROPERTIES + DESCRIPTION "A collection of C++ library code designed to augment the C++ standard library (found: v${absl_VERSION}, but it is too old and it will not be used)" ) endif() endif() +endif() - if(MSVC) - target_link_libraries(Gflags::gflags INTERFACE shlwapi.lib) + +if(NOT absl_FOUND) + set(ENABLE_GLOG_AND_GFLAGS ON) + ################################################################################ + # gflags - https://github.com/gflags/gflags + ################################################################################ + set(LOCAL_GFLAGS FALSE) + if(ENABLE_OWN_GLOG) + unset(Glog::glog CACHE) + unset(GLOG_FOUND CACHE) + unset(Gflags::gflags CACHE) + unset(GLAGS_FOUND CACHE) + set(GFLAGS_GREATER_20 TRUE) + else() + unset(Glog::glog CACHE) + unset(GLOG_FOUND CACHE) + find_package(GLOG) + if(GLOG_FOUND) + unset(GFLAGS_GREATER_20 CACHE) + find_package(GFLAGS) + endif() endif() - - set(LOCAL_GFLAGS TRUE CACHE STRING "GFlags downloaded, built, and statically linked automatically" FORCE) set_package_properties(GFLAGS PROPERTIES - PURPOSE "Gflags v${GNSSSDR_GFLAGS_LOCAL_VERSION} and Glog v${GNSSSDR_GLOG_LOCAL_VERSION} will be downloaded, built, and statically linked when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'." + PURPOSE "Used for commandline flags management." + TYPE REQUIRED ) - if(CMAKE_VERSION VERSION_LESS 3.2) - set_property(TARGET Gflags::gflags APPEND PROPERTY - INTERFACE_COMPILE_DEFINITIONS GFLAGS_OLD_NAMESPACE=1 - ) - endif() -endif() - - - -################################################################################ -# glog - https://github.com/google/glog -################################################################################ -set_package_properties(GLOG PROPERTIES - PURPOSE "Used for runtime internal logging." - TYPE REQUIRED -) -if(NOT GLOG_FOUND OR ${LOCAL_GFLAGS}) - message(STATUS " glog library has not been found") if(NOT GFLAGS_FOUND) - message(STATUS " or it is likely not linked to gflags.") - endif() - message(STATUS " glog v${GNSSSDR_GLOG_LOCAL_VERSION} will be downloaded, built, and statically linked automatically") - message(STATUS " when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'.") - find_package(LIBUNWIND) - set_package_properties(LIBUNWIND PROPERTIES - PURPOSE "Needed by glog." - TYPE OPTIONAL - ) - if(NOT ${LOCAL_GFLAGS}) - if(NOT TARGET gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) - add_library(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} UNKNOWN IMPORTED) + set(ENABLE_OWN_GLOG ON) + if(GFLAGS_VERSION) + message(STATUS " A version of the gflags library equal or higher than v${GNSSSDR_GFLAGS_MIN_VERSION} has not been found.") + else() + message(STATUS " The gflags library has not been found.") endif() - set_property(TARGET gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} PROPERTY IMPORTED_LOCATION "${GFlags_LIBS}") - string(REPLACE /include "" GFLAGS_PREFIX_PATH ${GFlags_INCLUDE_DIRS}) - else() - set(GFLAGS_PREFIX_PATH ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) - endif() - set(TARGET_GFLAGS gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) - set(GLOG_MAKE_PROGRAM ${CMAKE_COMMAND} - "--build" "${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}" - "--config" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> - ) - if(CMAKE_GENERATOR STREQUAL Xcode) - set(GLOG_MAKE_PROGRAM "xcodebuild" "-configuration" - $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel> + message(STATUS " gflags v${GNSSSDR_GFLAGS_LOCAL_VERSION} will be downloaded, built, and statically linked automatically") + message(STATUS " when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'.") + set(GFLAGS_BUILD_COMMAND ${CMAKE_COMMAND} + "--build" "${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}" + "--config" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> ) - endif() - if(CMAKE_TOOLCHAIN_FILE) - set(GLOG_TOOLCHAIN_FILE -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) - endif() + if(CMAKE_GENERATOR STREQUAL Xcode) + set(GFLAGS_BUILD_COMMAND "xcodebuild" "-configuration" $<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:Debug>) + endif() + if(CMAKE_TOOLCHAIN_FILE) + set(GFLAGS_TOOLCHAIN_FILE -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) + endif() - if(CMAKE_VERSION VERSION_LESS 3.3) - if(CMAKE_VERSION VERSION_LESS 3.0) - set(GLOG_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM}) - set(GFLAGS_LIBRARIES_TO_LINK ${GFlags_LIBS}) - if(${LOCAL_GFLAGS}) - set(GFLAGS_LIBRARY_DIR_TO_LINK ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib) - else() - set(GFLAGS_LIBRARY_DIR_TO_LINK ${GFlags_LIBRARY_DIRS}) - endif() - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(GFLAGS_LIBRARIES_TO_LINK "${GFLAGS_LIBRARIES_TO_LINK} -lc++") - set(GLOG_EXPORT_CXX_LIBRARIES "export CXXFLAGS=\"-stdlib=libc++\"") - endif() - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(GLOG_EXPORT_C_COMPILER "export CC=clang") - set(GLOG_EXPORT_CXX_COMPILER "export CXX=clang++") - endif() - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(GLOG_EXPORT_C_COMPILER "export CC=gcc") - set(GLOG_EXPORT_CXX_COMPILER "export CXX=g++") - endif() - file(WRITE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/tmp/configure_with_gflags -"#!/bin/sh -export CPPFLAGS=-I${GFlags_INCLUDE_DIRS} -export LDFLAGS=-L${GFLAGS_LIBRARY_DIR_TO_LINK} -export LIBS=\"${GFLAGS_LIBRARIES_TO_LINK}\" -${GLOG_EXPORT_CXX_LIBRARIES} -${GLOG_EXPORT_C_COMPILER} -${GLOG_EXPORT_CXX_COMPILER} -cd ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/ -aclocal -automake --add-missing -autoreconf -vfi -cd ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} -${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure --enable-shared=no" - ) - - file(COPY ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/tmp/configure_with_gflags - DESTINATION ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} - FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ - GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - ) - - set(GLOG_CONFIGURE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure_with_gflags) - - # Ensure that aclocal and libtool are present - if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") - if(EXISTS "/usr/bin/libtoolize") - if(EXISTS "/usr/bin/aclocal" OR - EXISTS "/usr/bin/aclocal-1.16" OR - EXISTS "/usr/bin/aclocal-1.15" OR - EXISTS "/usr/bin/aclocal-1.14" OR - EXISTS "/usr/bin/aclocal-1.13" OR - EXISTS "/usr/bin/aclocal-1.11" OR - EXISTS "/usr/bin/aclocal-1.10") - # Everything ok, we can move on - else() - message(" aclocal has not been found.") - message(" You can try to install it by typing:") - if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") - message(" sudo yum groupinstall 'Development Tools'") - elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") - message(" sudo zypper install automake") - else() - message(" sudo apt-get install automake") - endif() - message(FATAL_ERROR "aclocal is required to build glog from source") - endif() - else() - message(" libtool has not been found.") - message(" You can try to install it by typing:") - if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") - message(" sudo yum groupinstall 'Development Tools'") - elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") - message(" sudo zypper install libtoool") - else() - message(" sudo apt-get install libtool") - endif() - message(FATAL_ERROR "libtool is required to build glog from source") - endif() - endif() - - if(GLOG_MAKE_PROGRAM MATCHES "ninja") - find_program(GLOG_MAKE_EXECUTABLE make - PATHS - /usr/bin - /usr/local/bin - ) - if(NOT GLOG_MAKE_EXECUTABLE) - message(FATAL_ERROR "make is required to build Glog from source.") - endif() - set(GLOG_MAKE_PROGRAM ${GLOG_MAKE_EXECUTABLE}) - endif() - ExternalProject_Add(glog-${GNSSSDR_GLOG_LOCAL_VERSION} - DEPENDS ${TARGET_GFLAGS} - PREFIX ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} - GIT_REPOSITORY https://github.com/google/glog/ - GIT_TAG v${GNSSSDR_GLOG_LOCAL_VERSION} - SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION} - BINARY_DIR ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} - CONFIGURE_COMMAND ${GLOG_CONFIGURE} --prefix= - BUILD_COMMAND "${GLOG_MAKE_PROGRAM}" + if(CMAKE_VERSION VERSION_LESS 3.2) + ExternalProject_Add(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + PREFIX ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + GIT_REPOSITORY https://github.com/gflags/gflags.git + GIT_TAG v${GNSSSDR_GFLAGS_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gflags/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF + -DBUILD_STATIC_LIBS=ON + -DBUILD_gflags_LIB=ON + -DBUILD_gflags_nothreads_LIB=ON + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + ${GFLAGS_TOOLCHAIN_FILE} + -DGFLAGS_NAMESPACE=google + -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> + BUILD_COMMAND ${GFLAGS_BUILD_COMMAND} UPDATE_COMMAND "" PATCH_COMMAND "" INSTALL_COMMAND "" ) - set(GLOG_LIBRARIES - ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/.libs/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + else() + set(GFLAGS_BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX}) + if((CMAKE_BUILD_TYPE STREQUAL Debug) OR (CMAKE_BUILD_TYPE STREQUAL NoOptWithASM) OR + (CMAKE_BUILD_TYPE STREQUAL Coverage) OR (CMAKE_BUILD_TYPE STREQUAL ASAN)) # Workaround for Ninja generator + set(GFLAGS_BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags_debug${CMAKE_STATIC_LIBRARY_SUFFIX}) + endif() + if((CMAKE_VERSION VERSION_GREATER 3.12.0) AND NOT (CMAKE_GENERATOR STREQUAL Xcode)) + set(PARALLEL_BUILD "--parallel 2") + endif() + ExternalProject_Add(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + PREFIX ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + GIT_REPOSITORY https://github.com/gflags/gflags.git + GIT_TAG v${GNSSSDR_GFLAGS_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gflags/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF + -DBUILD_STATIC_LIBS=ON + -DBUILD_gflags_LIB=ON + -DBUILD_gflags_nothreads_LIB=ON + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + ${GFLAGS_TOOLCHAIN_FILE} + -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> + BUILD_COMMAND "${GFLAGS_BUILD_COMMAND} ${PARALLEL_BUILD}" + BUILD_BYPRODUCTS ${GFLAGS_BUILD_BYPRODUCTS} + UPDATE_COMMAND "" + PATCH_COMMAND "" + INSTALL_COMMAND "" ) - set(GLOG_INCLUDE_DIRS - ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src - ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src + endif() + # Note: -DBUILD_gflags_nothreads_LIB=ON is required as a workaround to a bug in gflags 2.2.2. This is fixed in gflags master branch + + set(GFlags_INCLUDE_DIRS + ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/include CACHE PATH "Local Gflags headers" + ) + + if(CMAKE_VERSION VERSION_LESS "3.0.2") + set(GFlags_LIBS + ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} ) - else() # CMake > 3.0 but < 3.3 + endif() + + if(NOT TARGET Gflags::gflags) + file(MAKE_DIRECTORY ${GFlags_INCLUDE_DIRS}) + add_library(Gflags::gflags STATIC IMPORTED) + add_dependencies(Gflags::gflags gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) + set_target_properties(Gflags::gflags PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_CONFIGURATIONS "None;Debug;Release;RelWithDebInfo;MinSizeRel" + MAP_IMPORTED_CONFIG_NOOPTWITHASM Debug + MAP_IMPORTED_CONFIG_COVERAGE Debug + MAP_IMPORTED_CONFIG_O2WITHASM RelWithDebInfo + MAP_IMPORTED_CONFIG_O3WITHASM RelWithDebInfo + MAP_IMPORTED_CONFIG_ASAN Debug + IMPORTED_LOCATION_NONE ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags_debug${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_INCLUDE_DIRECTORIES ${GFlags_INCLUDE_DIRS} + INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags$<$:_debug>${CMAKE_STATIC_LIBRARY_SUFFIX} + ) + if((CMAKE_GENERATOR STREQUAL Xcode) OR MSVC) + if(MSVC) + set(MSVC_POSTFIX _static) + endif() + set_target_properties(Gflags::gflags PROPERTIES + IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}_debug${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/Release/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}$<$:_debug>${CMAKE_STATIC_LIBRARY_SUFFIX} + ) + endif() + endif() + + if(MSVC) + target_link_libraries(Gflags::gflags INTERFACE shlwapi.lib) + endif() + + set(LOCAL_GFLAGS TRUE CACHE STRING "GFlags downloaded, built, and statically linked automatically" FORCE) + set_package_properties(GFLAGS PROPERTIES + PURPOSE "Gflags v${GNSSSDR_GFLAGS_LOCAL_VERSION} and Glog v${GNSSSDR_GLOG_LOCAL_VERSION} will be downloaded, built, and statically linked when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'." + ) + if(CMAKE_VERSION VERSION_LESS 3.2) + set_property(TARGET Gflags::gflags APPEND PROPERTY + INTERFACE_COMPILE_DEFINITIONS GFLAGS_OLD_NAMESPACE=1 + ) + endif() + endif() + + + + ################################################################################ + # glog - https://github.com/google/glog + ################################################################################ + set_package_properties(GLOG PROPERTIES + PURPOSE "Used for runtime internal logging." + TYPE REQUIRED + ) + if(NOT GLOG_FOUND OR ${LOCAL_GFLAGS}) + message(STATUS " glog library has not been found") + if(NOT GFLAGS_FOUND) + message(STATUS " or it is likely not linked to gflags.") + endif() + message(STATUS " glog v${GNSSSDR_GLOG_LOCAL_VERSION} will be downloaded, built, and statically linked automatically") + message(STATUS " when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'.") + find_package(LIBUNWIND) + set_package_properties(LIBUNWIND PROPERTIES + PURPOSE "Needed by glog." + TYPE OPTIONAL + ) + if(NOT ${LOCAL_GFLAGS}) + if(NOT TARGET gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) + add_library(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} UNKNOWN IMPORTED) + endif() + set_property(TARGET gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} PROPERTY IMPORTED_LOCATION "${GFlags_LIBS}") + string(REPLACE /include "" GFLAGS_PREFIX_PATH ${GFlags_INCLUDE_DIRS}) + else() + set(GFLAGS_PREFIX_PATH ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) + endif() + set(TARGET_GFLAGS gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) + set(GLOG_MAKE_PROGRAM ${CMAKE_COMMAND} + "--build" "${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}" + "--config" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> + ) + if(CMAKE_GENERATOR STREQUAL Xcode) + set(GLOG_MAKE_PROGRAM "xcodebuild" "-configuration" + $<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:Debug> + ) + endif() + if(CMAKE_TOOLCHAIN_FILE) + set(GLOG_TOOLCHAIN_FILE -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) + endif() + + if(CMAKE_VERSION VERSION_LESS 3.3) + if(CMAKE_VERSION VERSION_LESS 3.0) + set(GLOG_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM}) + set(GFLAGS_LIBRARIES_TO_LINK ${GFlags_LIBS}) + if(${LOCAL_GFLAGS}) + set(GFLAGS_LIBRARY_DIR_TO_LINK ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib) + else() + set(GFLAGS_LIBRARY_DIR_TO_LINK ${GFlags_LIBRARY_DIRS}) + endif() + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(GFLAGS_LIBRARIES_TO_LINK "${GFLAGS_LIBRARIES_TO_LINK} -lc++") + set(GLOG_EXPORT_CXX_LIBRARIES "export CXXFLAGS=\"-stdlib=libc++\"") + endif() + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(GLOG_EXPORT_C_COMPILER "export CC=clang") + set(GLOG_EXPORT_CXX_COMPILER "export CXX=clang++") + endif() + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(GLOG_EXPORT_C_COMPILER "export CC=gcc") + set(GLOG_EXPORT_CXX_COMPILER "export CXX=g++") + endif() + file(WRITE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/tmp/configure_with_gflags + "#!/bin/sh + export CPPFLAGS=-I${GFlags_INCLUDE_DIRS} + export LDFLAGS=-L${GFLAGS_LIBRARY_DIR_TO_LINK} + export LIBS=\"${GFLAGS_LIBRARIES_TO_LINK}\" + ${GLOG_EXPORT_CXX_LIBRARIES} + ${GLOG_EXPORT_C_COMPILER} + ${GLOG_EXPORT_CXX_COMPILER} + cd ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/ + aclocal + automake --add-missing + autoreconf -vfi + cd ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure --enable-shared=no" + ) + + file(COPY ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/tmp/configure_with_gflags + DESTINATION ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ + GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) + + set(GLOG_CONFIGURE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure_with_gflags) + + # Ensure that aclocal and libtool are present + if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") + if(EXISTS "/usr/bin/libtoolize") + if(EXISTS "/usr/bin/aclocal" OR + EXISTS "/usr/bin/aclocal-1.16" OR + EXISTS "/usr/bin/aclocal-1.15" OR + EXISTS "/usr/bin/aclocal-1.14" OR + EXISTS "/usr/bin/aclocal-1.13" OR + EXISTS "/usr/bin/aclocal-1.11" OR + EXISTS "/usr/bin/aclocal-1.10") + # Everything ok, we can move on + else() + message(" aclocal has not been found.") + message(" You can try to install it by typing:") + if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") + message(" sudo yum groupinstall 'Development Tools'") + elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") + message(" sudo zypper install automake") + else() + message(" sudo apt-get install automake") + endif() + message(FATAL_ERROR "aclocal is required to build glog from source") + endif() + else() + message(" libtool has not been found.") + message(" You can try to install it by typing:") + if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") + message(" sudo yum groupinstall 'Development Tools'") + elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") + message(" sudo zypper install libtoool") + else() + message(" sudo apt-get install libtool") + endif() + message(FATAL_ERROR "libtool is required to build glog from source") + endif() + endif() + + if(GLOG_MAKE_PROGRAM MATCHES "ninja") + find_program(GLOG_MAKE_EXECUTABLE make + PATHS + /usr/bin + /usr/local/bin + ) + if(NOT GLOG_MAKE_EXECUTABLE) + message(FATAL_ERROR "make is required to build Glog from source.") + endif() + set(GLOG_MAKE_PROGRAM ${GLOG_MAKE_EXECUTABLE}) + endif() + ExternalProject_Add(glog-${GNSSSDR_GLOG_LOCAL_VERSION} + DEPENDS ${TARGET_GFLAGS} + PREFIX ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + GIT_REPOSITORY https://github.com/google/glog/ + GIT_TAG v${GNSSSDR_GLOG_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + CONFIGURE_COMMAND ${GLOG_CONFIGURE} --prefix= + BUILD_COMMAND "${GLOG_MAKE_PROGRAM}" + UPDATE_COMMAND "" + PATCH_COMMAND "" + INSTALL_COMMAND "" + ) + set(GLOG_LIBRARIES + ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/.libs/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + ) + set(GLOG_INCLUDE_DIRS + ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src + ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src + ) + else() # CMake > 3.0 but < 3.3 + ExternalProject_Add(glog-${GNSSSDR_GLOG_LOCAL_VERSION} + DEPENDS ${TARGET_GFLAGS} + PREFIX ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + GIT_REPOSITORY https://github.com/google/glog/ + GIT_TAG v${GNSSSDR_GLOG_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_PREFIX_PATH=${GFLAGS_PREFIX_PATH} + ${GLOG_TOOLCHAIN_FILE} + -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> + BUILD_COMMAND ${GLOG_MAKE_PROGRAM} + UPDATE_COMMAND "" + PATCH_COMMAND "" + INSTALL_COMMAND "" + ) + set(GLOG_INCLUDE_DIRS + ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src + ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + ${GFlags_INCLUDE_DIRS} + ) + endif() + else() # CMake > 3.3 + set(GLOG_BUILD_BYPRODUCTS + ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + ) + if((CMAKE_BUILD_TYPE STREQUAL Debug) OR (CMAKE_BUILD_TYPE STREQUAL NoOptWithASM) OR + (CMAKE_BUILD_TYPE STREQUAL Coverage) OR (CMAKE_BUILD_TYPE STREQUAL ASAN)) # Workaround for Ninja generator + set(GLOG_BUILD_BYPRODUCTS + ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glogd${CMAKE_STATIC_LIBRARY_SUFFIX} + ) + endif() + if((CMAKE_VERSION VERSION_GREATER 3.12.0) AND NOT (CMAKE_GENERATOR STREQUAL Xcode) AND NOT CMAKE_CROSSCOMPILING) + set(PARALLEL_BUILD "--parallel 2") + endif() + if(GNSSSDR_GLOG_LOCAL_VERSION VERSION_GREATER 0.5.0) + set(GLOG_GTEST -DWITH_GTEST=FALSE) + endif() + if(NOT (CMAKE_VERSION VERSION_LESS "3.22")) + set(GNSSSDR_GLOG_LOCAL_GFLAGS -DCMAKE_REQUIRED_INCLUDES=${GFlags_INCLUDE_DIRS}) + endif() ExternalProject_Add(glog-${GNSSSDR_GLOG_LOCAL_VERSION} DEPENDS ${TARGET_GFLAGS} PREFIX ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} @@ -1710,11 +1833,15 @@ ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configu SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION} BINARY_DIR ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_PREFIX_PATH=${GFLAGS_PREFIX_PATH} ${GLOG_TOOLCHAIN_FILE} -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> - BUILD_COMMAND ${GLOG_MAKE_PROGRAM} + -DBUILD_SHARED_LIBS=OFF + ${GLOG_GTEST} + -DBUILD_TESTING=OFF + "${GNSSSDR_GLOG_LOCAL_GFLAGS}" + BUILD_COMMAND "${GLOG_MAKE_PROGRAM} ${PARALLEL_BUILD}" + BUILD_BYPRODUCTS ${GLOG_BUILD_BYPRODUCTS} UPDATE_COMMAND "" PATCH_COMMAND "" INSTALL_COMMAND "" @@ -1725,120 +1852,64 @@ ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configu ${GFlags_INCLUDE_DIRS} ) endif() - else() # CMake > 3.3 - set(GLOG_BUILD_BYPRODUCTS - ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - ) - if((CMAKE_BUILD_TYPE STREQUAL Debug) OR (CMAKE_BUILD_TYPE STREQUAL NoOptWithASM) OR - (CMAKE_BUILD_TYPE STREQUAL Coverage) OR (CMAKE_BUILD_TYPE STREQUAL ASAN)) # Workaround for Ninja generator - set(GLOG_BUILD_BYPRODUCTS - ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glogd${CMAKE_STATIC_LIBRARY_SUFFIX} - ) - endif() - if((CMAKE_VERSION VERSION_GREATER 3.12.0) AND NOT (CMAKE_GENERATOR STREQUAL Xcode) AND NOT CMAKE_CROSSCOMPILING) - set(PARALLEL_BUILD "--parallel 2") - endif() - if(GNSSSDR_GLOG_LOCAL_VERSION VERSION_GREATER 0.5.0) - set(GLOG_GTEST -DWITH_GTEST=FALSE) - endif() - if(NOT (CMAKE_VERSION VERSION_LESS "3.22")) - set(GNSSSDR_GLOG_LOCAL_GFLAGS -DCMAKE_REQUIRED_INCLUDES=${GFlags_INCLUDE_DIRS}) - endif() - ExternalProject_Add(glog-${GNSSSDR_GLOG_LOCAL_VERSION} - DEPENDS ${TARGET_GFLAGS} - PREFIX ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} - GIT_REPOSITORY https://github.com/google/glog/ - GIT_TAG v${GNSSSDR_GLOG_LOCAL_VERSION} - SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION} - BINARY_DIR ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} - CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_PREFIX_PATH=${GFLAGS_PREFIX_PATH} - ${GLOG_TOOLCHAIN_FILE} - -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> - -DBUILD_SHARED_LIBS=OFF - ${GLOG_GTEST} - -DBUILD_TESTING=OFF - "${GNSSSDR_GLOG_LOCAL_GFLAGS}" - BUILD_COMMAND "${GLOG_MAKE_PROGRAM} ${PARALLEL_BUILD}" - BUILD_BYPRODUCTS ${GLOG_BUILD_BYPRODUCTS} - UPDATE_COMMAND "" - PATCH_COMMAND "" - INSTALL_COMMAND "" - ) - set(GLOG_INCLUDE_DIRS - ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src - ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} - ${GFlags_INCLUDE_DIRS} - ) - endif() - add_dependencies(glog-${GNSSSDR_GLOG_LOCAL_VERSION} Gflags::gflags) + add_dependencies(glog-${GNSSSDR_GLOG_LOCAL_VERSION} Gflags::gflags) - # Create Glog::glog target - if(NOT TARGET Glog::glog) - file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src) - file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}) - add_library(Glog::glog STATIC IMPORTED) - add_dependencies(Glog::glog glog-${GNSSSDR_GLOG_LOCAL_VERSION}) - if(CMAKE_VERSION VERSION_LESS 3.0) - set_target_properties(Glog::glog PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${GLOG_LIBRARIES}" - INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIRS}" - INTERFACE_INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "${GLOG_LIBRARIES}" - ) - else() - set_target_properties(Glog::glog PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_CONFIGURATIONS "None;Debug;Release;RelWithDebInfo;MinSizeRel" - MAP_IMPORTED_CONFIG_NOOPTWITHASM Debug - MAP_IMPORTED_CONFIG_COVERAGE Debug - MAP_IMPORTED_CONFIG_O2WITHASM RelWithDebInfo - MAP_IMPORTED_CONFIG_O3WITHASM RelWithDebInfo - MAP_IMPORTED_CONFIG_ASAN Debug - IMPORTED_LOCATION_NONE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glogd${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - INTERFACE_INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog$<$:d>${CMAKE_STATIC_LIBRARY_SUFFIX} - ) - if((CMAKE_GENERATOR STREQUAL Xcode) OR MSVC) + # Create Glog::glog target + if(NOT TARGET Glog::glog) + file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src) + file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}) + add_library(Glog::glog STATIC IMPORTED) + add_dependencies(Glog::glog glog-${GNSSSDR_GLOG_LOCAL_VERSION}) + if(CMAKE_VERSION VERSION_LESS 3.0) set_target_properties(Glog::glog PROPERTIES - IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}glogd${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/Release/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>${CMAKE_FIND_LIBRARY_PREFIXES}glog$<$:d>${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${GLOG_LIBRARIES}" + INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIRS}" + INTERFACE_INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${GLOG_LIBRARIES}" ) + else() + set_target_properties(Glog::glog PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_CONFIGURATIONS "None;Debug;Release;RelWithDebInfo;MinSizeRel" + MAP_IMPORTED_CONFIG_NOOPTWITHASM Debug + MAP_IMPORTED_CONFIG_COVERAGE Debug + MAP_IMPORTED_CONFIG_O2WITHASM RelWithDebInfo + MAP_IMPORTED_CONFIG_O3WITHASM RelWithDebInfo + MAP_IMPORTED_CONFIG_ASAN Debug + IMPORTED_LOCATION_NONE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glogd${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog$<$:d>${CMAKE_STATIC_LIBRARY_SUFFIX} + ) + if((CMAKE_GENERATOR STREQUAL Xcode) OR MSVC) + set_target_properties(Glog::glog PROPERTIES + IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}glogd${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/Release/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>${CMAKE_FIND_LIBRARY_PREFIXES}glog$<$:d>${CMAKE_STATIC_LIBRARY_SUFFIX} + ) + endif() endif() endif() - endif() - if(NOT (CMAKE_VERSION VERSION_LESS "3.22")) - set_target_properties(Glog::glog PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "GLOG_USE_GLOG_EXPORT;GLOG_USE_GFLAGS" - INTERFACE_COMPILE_FEATURES "cxx_std_14") - endif() + if(NOT (CMAKE_VERSION VERSION_LESS "3.22")) + set_target_properties(Glog::glog PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "GLOG_USE_GLOG_EXPORT;GLOG_USE_GFLAGS" + INTERFACE_COMPILE_FEATURES "cxx_std_14") + endif() - if(LIBUNWIND_FOUND) - target_link_libraries(Glog::glog INTERFACE Libunwind::libunwind) - endif() - set(LOCAL_GLOG TRUE CACHE STRING "Glog downloaded, built, and statically linked automatically" FORCE) + if(LIBUNWIND_FOUND) + target_link_libraries(Glog::glog INTERFACE Libunwind::libunwind) + endif() + set(LOCAL_GLOG TRUE CACHE STRING "Glog downloaded, built, and statically linked automatically" FORCE) - set_package_properties(GLOG PROPERTIES - PURPOSE "Glog v${GNSSSDR_GLOG_LOCAL_VERSION} will be downloaded, built, and statically linked when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'." - ) -endif() - -if(NOT ENABLE_LOG) - message(STATUS "Internal logging is not enabled") - if(CMAKE_VERSION VERSION_GREATER 3.11.0) - target_compile_definitions(Glog::glog INTERFACE -DGOOGLE_STRIP_LOG=1) - else() - set_property(TARGET Glog::glog APPEND PROPERTY - INTERFACE_COMPILE_DEFINITIONS GOOGLE_STRIP_LOG=1 + set_package_properties(GLOG PROPERTIES + PURPOSE "Glog v${GNSSSDR_GLOG_LOCAL_VERSION} will be downloaded, built, and statically linked when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'." ) endif() endif() @@ -2656,12 +2727,6 @@ if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSI endif() else() if(CMAKE_VERSION VERSION_GREATER "3.13") - find_package(absl) - set_package_properties(absl PROPERTIES - URL "https://github.com/abseil/abseil-cpp" - PURPOSE "Abseil-cpp >= 20230117 required to be installed before building Protocol Buffers >22.x on the fly." - TYPE OPTIONAL - ) if(absl_FOUND) if(absl_VERSION) if(${absl_VERSION} VERSION_LESS "20230117") @@ -3481,8 +3546,10 @@ add_feature_info(ENABLE_FPGA ENABLE_FPGA "Enables building of processing blocks add_feature_info(ENABLE_ARMA_NO_DEBUG ENABLE_ARMA_NO_DEBUG "Enables passing the ARMA_NO_DEBUG macro to Armadillo, hence disabling bound checking.") add_feature_info(ENABLE_PACKAGING ENABLE_PACKAGING "Enables software packaging.") add_feature_info(ENABLE_OWN_GLOG ENABLE_OWN_GLOG "Forces the downloading and building of Google glog.") +add_feature_info(ENABLE_GLOG_AND_GFLAGS ENABLE_GLOG_AND_GFLAGS "Forces the usage of Google glog and Gflags instead of Abseil") +add_feature_info(ENABLE_OWN_ABSEIL ENABLE_OWN_ABSEIL "Forces downloading and building Abseil. Supersedes ENABLE_OWN_GLOG") add_feature_info(ENABLE_OWN_ARMADILLO ENABLE_OWN_ARMADILLO "Forces the downloading and building of Armadillo.") -add_feature_info(ENABLE_LOG ENABLE_LOG "Enables runtime internal logging with Google glog.") +add_feature_info(ENABLE_LOG ENABLE_LOG "Enables runtime internal logging.") add_feature_info(ENABLE_ORC ENABLE_ORC "Use the Optimized Inner Loop Runtime Compiler (ORC) for building volk_gnsssdr.") add_feature_info(ENABLE_STRIP ENABLE_STRIP "Enables the generation of stripped binaries (without debugging symbols).") add_feature_info(ENABLE_UNIT_TESTING ENABLE_UNIT_TESTING "Enables building of Unit Tests.") diff --git a/README.md b/README.md index 0413da74a..357e06637 100644 --- a/README.md +++ b/README.md @@ -222,9 +222,9 @@ Once you have installed these packages, you can jump directly to If you are using Arch Linux: ``` -$ pacman -S gcc make cmake pkgconf git boost boost-libs log4cpp libvolk gnuradio \ - blas lapack gflags google-glog openssl pugixml libmatio protobuf \ - python-mako libpcap gtest +$ pacman -S gcc make cmake pkgconf git boost boost-libs libvolk gnuradio \ + blas lapack hdf5 openssl pugixml libmatio protobuf libpcap gtest \ + python-mako ``` Once you have installed these packages, you can jump directly to @@ -430,6 +430,10 @@ $ sudo make install $ sudo ldconfig ``` +Please note that GFlags is replaced by the +[Abseil Flags Library](https://abseil.io/docs/cpp/guides/flags) if Abseil >= +v20240116 is available in your system. + #### Install [Glog](https://github.com/google/glog "Glog's Homepage"), a library that implements application-level logging ``` @@ -443,6 +447,10 @@ $ sudo make install $ sudo ldconfig ``` +Please note that Glog is replaced by the +[Abseil Logging Library](https://abseil.io/docs/cpp/guides/logging) if Abseil >= +v20240116 is available in your system. + #### Install the GnuTLS or OpenSSL libraries ``` @@ -832,7 +840,7 @@ $ sudo port selfupdate $ sudo port upgrade outdated $ sudo port install armadillo cmake pkgconfig protobuf3-cpp pugixml gnutls $ sudo port install gnuradio +uhd +grc +zeromq -$ sudo port install boost matio libad9361-iio libiio google-glog +gflags +$ sudo port install boost matio libad9361-iio libiio $ sudo port install py311-mako $ sudo port install doxygen +docs ``` @@ -871,8 +879,7 @@ Install the required dependencies: ``` $ brew update && brew upgrade -$ brew install armadillo cmake hdf5 gflags glog gnuradio libmatio log4cpp \ - openssl pkg-config protobuf pugixml +$ brew install armadillo cmake hdf5 gnuradio libmatio openssl pkg-config protobuf pugixml $ brew install --cask mactex # when completed, restart Terminal $ brew install graphviz doxygen ¢ pip3 install mako diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 3d797d433..473f7742b 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -16,8 +16,37 @@ All notable changes to GNSS-SDR will be documented in this file. ### Improvements in Portability: -- Fix building against google-glog 0.7.0 +- Fix building against google-glog 0.7.0. - Find dependencies in the loongarch64 architecture. +- Soft transition from [GFlags](https://github.com/gflags/gflags) and + [Google Logging (glog)](https://github.com/google/glog) to Abseil + [Logging](https://abseil.io/docs/cpp/guides/logging) and + [Flags](https://abseil.io/docs/cpp/guides/flags) libraries. While gflags and + glog have dutifully served GNSS-SDR for over a decade, they are now showing + signs of aging. The latest version of gflags dates back six years now, with + its last commit in the master branch occurring two years ago. Glog remains + well maintained, with its latest version v0.7.0 released in February 2024, but + with no active development of new features and stuck at C++14. Abseil, on the + other hand, represents a contemporary evolution in software development, + supports C++17 and C++20, and has absorbed the functionalities of flags and + logging from its predecessors. Furthermore, as Abseil has become a + prerequisite for the latest versions of Protocol Buffers, its eventual + inclusion in GNSS-SDR's indirect dependencies is inevitable. Leveraging Abseil + allows for eliminating the need for gflags and glog, thereby reducing the + number of mandatory dependencies for GNSS-SDR in forthcoming GNU/Linux + distributions. For seamless integration, GNSS-SDR requires a quite recent + minimum version of Abseil, v20240116. If an older version is detected, the + library will not be utilized, and GNSS-SDR will fall back to using gflags and + glog, which still can be used and are fully supported. A new CMake + configuration option `-DENABLE_GLOG_AND_GFLAGS=ON` is available to force the + usage of glog and gflags instead of Abseil, even if a valid version of that + library is present. If the Abseil version installed in your system is too old + but you still want to try it, you can also force the downloading and building + of a recent version with the new CMake configuration flag + `-DENABLE_OWN_ABSEIL=ON` (requires CMake >= 3.24, otherwise it has no effect). + This change has a downside in maintainability, since the source code becomes + plagued with preprocessor directives required to maintain compatibility both + with gflags and glog, and with Abseil. ### Improvements in Usability: diff --git a/src/algorithms/PVT/adapters/CMakeLists.txt b/src/algorithms/PVT/adapters/CMakeLists.txt index 658e493ac..415fb13d4 100644 --- a/src/algorithms/PVT/adapters/CMakeLists.txt +++ b/src/algorithms/PVT/adapters/CMakeLists.txt @@ -23,10 +23,16 @@ target_link_libraries(pvt_adapters pvt_gr_blocks PRIVATE gnss_sdr_flags - Glog::glog pvt_libs ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(pvt_adapters PRIVATE Glog::glog) + target_compile_definitions(pvt_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(pvt_adapters PRIVATE absl::flags absl::log) +endif() + target_include_directories(pvt_adapters PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.cc b/src/algorithms/PVT/adapters/rtklib_pvt.cc index 93166877d..bdd1f97c6 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.cc +++ b/src/algorithms/PVT/adapters/rtklib_pvt.cc @@ -26,8 +26,12 @@ #include "gps_ephemeris.h" // for Gps_Ephemeris #include "pvt_conf.h" // for Pvt_Conf #include "rtklib_rtkpos.h" // for rtkfree, rtkinit -#include // for LOG #include // for std::cout +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif #if USE_STD_COMMON_FACTOR #include namespace bc = std; @@ -88,6 +92,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, // RINEX version pvt_output_parameters.rinex_version = configuration->property(role + ".rinex_version", 3); +#if USE_GLOG_AND_GFLAGS if (FLAGS_RINEX_version == "3.01" || FLAGS_RINEX_version == "3.02" || FLAGS_RINEX_version == "3") { pvt_output_parameters.rinex_version = 3; @@ -96,13 +101,29 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, { pvt_output_parameters.rinex_version = 2; } +#else + if (absl::GetFlag(FLAGS_RINEX_version) == "3.01" || absl::GetFlag(FLAGS_RINEX_version) == "3.02" || absl::GetFlag(FLAGS_RINEX_version) == "3") + { + pvt_output_parameters.rinex_version = 3; + } + else if (absl::GetFlag(FLAGS_RINEX_version) == "2.10" || absl::GetFlag(FLAGS_RINEX_version) == "2.11" || absl::GetFlag(FLAGS_RINEX_version) == "2") + { + pvt_output_parameters.rinex_version = 2; + } +#endif pvt_output_parameters.rinexobs_rate_ms = bc::lcm(configuration->property(role + ".rinexobs_rate_ms", 1000), pvt_output_parameters.output_rate_ms); pvt_output_parameters.rinex_name = configuration->property(role + ".rinex_name", std::string("-")); +#if USE_GLOG_AND_GFLAGS if (FLAGS_RINEX_name != "-") { pvt_output_parameters.rinex_name = FLAGS_RINEX_name; } - +#else + if (absl::GetFlag(FLAGS_RINEX_name) != "-") + { + pvt_output_parameters.rinex_name = absl::GetFlag(FLAGS_RINEX_name); + } +#endif // RTCM Printer settings pvt_output_parameters.flag_rtcm_tty_port = configuration->property(role + ".flag_rtcm_tty_port", false); pvt_output_parameters.rtcm_dump_devname = configuration->property(role + ".rtcm_dump_devname", default_rtcm_dump_devname); diff --git a/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt b/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt index ae1b728bf..1964d1533 100644 --- a/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt @@ -27,11 +27,16 @@ target_link_libraries(pvt_gr_blocks PRIVATE algorithms_libs pvt_libs - Gflags::gflags - Glog::glog Boost::serialization ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(pvt_gr_blocks PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(pvt_gr_blocks PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(pvt_gr_blocks PRIVATE absl::log) +endif() + if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(pvt_gr_blocks PUBLIC -DGNURADIO_USES_STD_POINTERS=1 diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 80b41440a..b2dfbfaa5 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -64,7 +64,6 @@ #include #include #include // for nvp, make_nvp -#include // for LOG #include // for io_signature #include // for mp #include // for sort, unique @@ -82,6 +81,12 @@ #include // for std::type_info, typeid #include // for pair +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include diff --git a/src/algorithms/PVT/libs/CMakeLists.txt b/src/algorithms/PVT/libs/CMakeLists.txt index 07e905a2c..69283a081 100644 --- a/src/algorithms/PVT/libs/CMakeLists.txt +++ b/src/algorithms/PVT/libs/CMakeLists.txt @@ -92,11 +92,18 @@ target_link_libraries(pvt_libs algorithms_libs_rtklib PRIVATE algorithms_libs - Gflags::gflags - Glog::glog + gnss_sdr_flags Matio::matio ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(pvt_libs PUBLIC Glog::glog) + + target_compile_definitions(pvt_libs PUBLIC -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(pvt_libs PUBLIC absl::log) +endif() + get_filename_component(PROTO_INCLUDE_HEADERS_DIR ${PROTO_HDRS} DIRECTORY) # for concurrent_queue.h diff --git a/src/algorithms/PVT/libs/an_packet_printer.cc b/src/algorithms/PVT/libs/an_packet_printer.cc index 6618d6982..22d31371b 100644 --- a/src/algorithms/PVT/libs/an_packet_printer.cc +++ b/src/algorithms/PVT/libs/an_packet_printer.cc @@ -20,7 +20,6 @@ #include "an_packet_printer.h" #include "rtklib_solver.h" // for Rtklib_Solver -#include // for DLOG #include // for M_PI #include // for memcpy #include // for fcntl @@ -29,6 +28,12 @@ #include // values for termios #include // for write(), read(), close() +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + An_Packet_Printer::An_Packet_Printer(const std::string& an_dump_devname) : d_start(std::chrono::system_clock::now()), diff --git a/src/algorithms/PVT/libs/geohash.cc b/src/algorithms/PVT/libs/geohash.cc index ecc1f6f3a..44a06adda 100644 --- a/src/algorithms/PVT/libs/geohash.cc +++ b/src/algorithms/PVT/libs/geohash.cc @@ -135,7 +135,7 @@ std::array Geohash::decode(std::string geohash) const std::array Geohash::bounds(std::string geohash) const { - if (geohash.length() == 0) + if (geohash.empty()) { throw std::runtime_error("Invalid geohash"); } diff --git a/src/algorithms/PVT/libs/geojson_printer.cc b/src/algorithms/PVT/libs/geojson_printer.cc index f57e9d582..62c53e82c 100644 --- a/src/algorithms/PVT/libs/geojson_printer.cc +++ b/src/algorithms/PVT/libs/geojson_printer.cc @@ -20,13 +20,18 @@ #include "gnss_sdr_filesystem.h" #include "pvt_solution.h" #include -#include #include // for tm #include // for exception #include // for operator<< #include // for cout, cerr #include // for stringstream +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GeoJSON_Printer::GeoJSON_Printer(const std::string& base_path) : geojson_base_path(base_path), first_pos(true) diff --git a/src/algorithms/PVT/libs/gpx_printer.cc b/src/algorithms/PVT/libs/gpx_printer.cc index 699f92db5..c2a16bee4 100644 --- a/src/algorithms/PVT/libs/gpx_printer.cc +++ b/src/algorithms/PVT/libs/gpx_printer.cc @@ -20,13 +20,17 @@ #include "gnss_sdr_filesystem.h" #include "pvt_solution.h" #include -#include #include // for tm #include // for exception #include // for operator<< #include // for cout, cerr #include // for stringstream +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif Gpx_Printer::Gpx_Printer(const std::string& base_path) : indent(" "), gpx_base_path(base_path), diff --git a/src/algorithms/PVT/libs/has_simple_printer.cc b/src/algorithms/PVT/libs/has_simple_printer.cc index e29df9809..e05c55f1f 100644 --- a/src/algorithms/PVT/libs/has_simple_printer.cc +++ b/src/algorithms/PVT/libs/has_simple_printer.cc @@ -21,7 +21,6 @@ #include "galileo_has_data.h" #include "gnss_sdr_filesystem.h" #include -#include #include // for std::find, std::count #include // for std::bitset #include // for uint8_t, ... @@ -32,6 +31,12 @@ #include // for std::cout, std::cerr #include // for std::stringstream +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + Has_Simple_Printer::Has_Simple_Printer(const std::string& base_path, const std::string& filename, diff --git a/src/algorithms/PVT/libs/kml_printer.cc b/src/algorithms/PVT/libs/kml_printer.cc index 72ea272d9..8a520aec3 100644 --- a/src/algorithms/PVT/libs/kml_printer.cc +++ b/src/algorithms/PVT/libs/kml_printer.cc @@ -20,7 +20,6 @@ #include "gnss_sdr_filesystem.h" #include "pvt_solution.h" #include -#include #include // for mkstemp #include // for tm #include // for exception @@ -30,6 +29,11 @@ #include // for S_IXUSR | S_IRWXG | S_IRWXO #include // for mode_t +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif Kml_Printer::Kml_Printer(const std::string& base_path) : kml_base_path(base_path), indent(" "), diff --git a/src/algorithms/PVT/libs/nmea_printer.cc b/src/algorithms/PVT/libs/nmea_printer.cc index 20c876059..d41eb7146 100644 --- a/src/algorithms/PVT/libs/nmea_printer.cc +++ b/src/algorithms/PVT/libs/nmea_printer.cc @@ -23,7 +23,6 @@ #include "gnss_sdr_filesystem.h" #include "rtklib_solution.h" #include "rtklib_solver.h" -#include #include #include #include @@ -32,6 +31,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + Nmea_Printer::Nmea_Printer(const std::string& filename, bool flag_nmea_output_file, diff --git a/src/algorithms/PVT/libs/pvt_kf.cc b/src/algorithms/PVT/libs/pvt_kf.cc index 805a53a57..b75e5e17f 100644 --- a/src/algorithms/PVT/libs/pvt_kf.cc +++ b/src/algorithms/PVT/libs/pvt_kf.cc @@ -16,8 +16,12 @@ */ #include "pvt_kf.h" -#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif void Pvt_Kf::init_Kf(const arma::vec& p, const arma::vec& v, diff --git a/src/algorithms/PVT/libs/pvt_solution.cc b/src/algorithms/PVT/libs/pvt_solution.cc index c97a12d70..da14f8be4 100644 --- a/src/algorithms/PVT/libs/pvt_solution.cc +++ b/src/algorithms/PVT/libs/pvt_solution.cc @@ -17,10 +17,14 @@ #include "pvt_solution.h" #include "MATH_CONSTANTS.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif int Pvt_Solution::cart2geo(double X, double Y, double Z, int elipsoid_selection) { diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 6c2d322d5..0e4367ea2 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -42,7 +42,6 @@ #include #include #include -#include #include // for min and max #include #include // for floor @@ -55,6 +54,11 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif Rinex_Printer::Rinex_Printer(int32_t conf_version, const std::string& base_path, diff --git a/src/algorithms/PVT/libs/rtcm.h b/src/algorithms/PVT/libs/rtcm.h index c7011eec3..e4d933863 100644 --- a/src/algorithms/PVT/libs/rtcm.h +++ b/src/algorithms/PVT/libs/rtcm.h @@ -29,7 +29,6 @@ #include "gps_ephemeris.h" #include #include -#include #include // for std::max, std::min, std::copy_n #include #include @@ -47,6 +46,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + /** \addtogroup PVT * \{ */ /** \addtogroup PVT_libs diff --git a/src/algorithms/PVT/libs/rtcm_printer.cc b/src/algorithms/PVT/libs/rtcm_printer.cc index cb07b9eea..f6e382259 100644 --- a/src/algorithms/PVT/libs/rtcm_printer.cc +++ b/src/algorithms/PVT/libs/rtcm_printer.cc @@ -30,7 +30,6 @@ #include "rtcm.h" #include "rtklib_solver.h" #include -#include #include // for tm #include // for exception #include // for O_RDWR @@ -39,6 +38,11 @@ #include // for close, write #include // for std::vector +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif Rtcm_Printer::Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump, diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index ef3e46647..35e4d3a9c 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -35,7 +35,6 @@ #include "gnss_sdr_filesystem.h" #include "rtklib_rtkpos.h" #include "rtklib_solution.h" -#include #include #include #include @@ -43,6 +42,11 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif Rtklib_Solver::Rtklib_Solver(const rtk_t &rtk, const Pvt_Conf &conf, diff --git a/src/algorithms/acquisition/adapters/CMakeLists.txt b/src/algorithms/acquisition/adapters/CMakeLists.txt index 41cfe8a8a..85eb8672e 100644 --- a/src/algorithms/acquisition/adapters/CMakeLists.txt +++ b/src/algorithms/acquisition/adapters/CMakeLists.txt @@ -104,9 +104,15 @@ target_link_libraries(acquisition_adapters PRIVATE gnss_sdr_flags Boost::headers - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(acquisition_adapters PRIVATE Glog::glog) + target_compile_definitions(acquisition_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(acquisition_adapters PRIVATE absl::flags absl::log) +endif() + if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(acquisition_adapters PUBLIC -DGNURADIO_USES_STD_POINTERS=1 diff --git a/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc index 180a95795..2e293af43 100644 --- a/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc @@ -23,10 +23,15 @@ #include "beidou_b1i_signal_replica.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -52,10 +57,17 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition( LOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); fs_in_ = acq_parameters_.fs_in; diff --git a/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc index a8204a24e..a5e41a125 100644 --- a/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc @@ -21,9 +21,14 @@ #include "beidou_b3i_signal_replica.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -48,10 +53,17 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition( LOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); item_type_ = acq_parameters_.item_type; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc index 4ba572b17..903a3748c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc @@ -21,9 +21,14 @@ #include "galileo_e1_signal_replica.h" #include "gnss_sdr_flags.h" #include -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -58,10 +63,17 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition( fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif if (sampled_ms_ % 4 != 0) { diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc index f4097b600..cace01b94 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc @@ -22,9 +22,14 @@ #include "galileo_e1_signal_replica.h" #include "gnss_sdr_flags.h" #include -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -51,10 +56,17 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( acq_parameters_.ms_per_code = 4; acq_parameters_.SetFromConfiguration(configuration_, role_, GALILEO_E1_CODE_CHIP_RATE_CPS, GALILEO_E1_OPT_ACQ_FS_SPS); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); item_type_ = acq_parameters_.item_type; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc index 87e4c2d06..900e7ac91 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc @@ -21,7 +21,6 @@ #include "galileo_e1_signal_replica.h" #include "gnss_sdr_fft.h" #include "gnss_sdr_flags.h" -#include #include // for fft_complex #include // for gr_complex #include // for volk_32fc_conjugate_32fc @@ -30,6 +29,12 @@ #include // for abs, pow, floor #include // for complex +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( const ConfigurationInterface* configuration, const std::string& role, @@ -46,10 +51,17 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( { acq_parameters_.SetFromConfiguration(configuration, role_, fpga_buff_num, fpga_blk_exp, downsampling_factor_default, GALILEO_E1_CODE_CHIP_RATE_CPS, GALILEO_E1_B_CODE_LENGTH_CHIPS); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); fs_in_ = acq_parameters_.fs_in; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc index c7af648aa..700644227 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc @@ -21,8 +21,12 @@ #include "galileo_e1_signal_replica.h" #include "gnss_sdr_flags.h" #include -#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition( const ConfigurationInterface* configuration, @@ -50,10 +54,17 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif if (sampled_ms_ % 4 != 0) { diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc index 2632418a7..cafbcf33b 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc @@ -21,9 +21,14 @@ #include "galileo_e1_signal_replica.h" #include "gnss_sdr_flags.h" #include -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -58,10 +63,17 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif /* --- Find number of samples per spreading code (4 ms) -----------------*/ code_length_ = static_cast(round( diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc index 59bd0e2a0..fca12dbfe 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc @@ -21,9 +21,14 @@ #include "galileo_e1_signal_replica.h" #include "gnss_sdr_flags.h" #include -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -71,10 +76,17 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( << sampled_ms_ << " ms will be used."; } +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif bool enable_monitor_output = configuration_->property("AcquisitionMonitor.enable_monitor", false); diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc index b51d12a73..5fcb2658c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc @@ -27,9 +27,14 @@ #include "galileo_e5_signal_replica.h" #include "gnss_sdr_flags.h" #include -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -67,10 +72,17 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf( int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif DLOG(INFO) << "role " << role_; if (sampled_ms_ > 3) diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc index 3d9eee1fa..c18aa48c2 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc @@ -21,10 +21,15 @@ #include "configuration_interface.h" #include "galileo_e5_signal_replica.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -51,10 +56,17 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition( acq_parameters_.ms_per_code = 1; acq_parameters_.SetFromConfiguration(configuration, role_, GALILEO_E5A_CODE_CHIP_RATE_CPS, GALILEO_E5A_OPT_ACQ_FS_SPS); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); item_type_ = acq_parameters_.item_type; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc index f3c041952..98e8bcf3c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc @@ -21,7 +21,6 @@ #include "galileo_e5_signal_replica.h" #include "gnss_sdr_fft.h" #include "gnss_sdr_flags.h" -#include #include // for gr_complex #include // for volk_32fc_conjugate_32fc #include @@ -29,6 +28,12 @@ #include // for abs, pow, floor #include // for complex +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( const ConfigurationInterface* configuration, const std::string& role, @@ -45,10 +50,17 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( { acq_parameters_.SetFromConfiguration(configuration, role_, fpga_buff_num, fpga_blk_exp, downsampling_factor_default, GALILEO_E5A_CODE_CHIP_RATE_CPS, GALILEO_E5A_CODE_LENGTH_CHIPS); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); fs_in_ = acq_parameters_.fs_in; diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition.cc index 5f8af8baf..11ecebcdd 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition.cc @@ -22,10 +22,15 @@ #include "configuration_interface.h" #include "galileo_e5_signal_replica.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -51,10 +56,17 @@ GalileoE5bPcpsAcquisition::GalileoE5bPcpsAcquisition(const ConfigurationInterfac acq_parameters_.ms_per_code = 1; acq_parameters_.SetFromConfiguration(configuration, role_, GALILEO_E5B_CODE_CHIP_RATE_CPS, GALILEO_E5B_OPT_ACQ_FS_SPS); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); item_type_ = acq_parameters_.item_type; diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc index 83996b5c8..f7a303f2d 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc @@ -22,13 +22,18 @@ #include "galileo_e5_signal_replica.h" #include "gnss_sdr_fft.h" #include "gnss_sdr_flags.h" -#include #include // for gr_complex #include // for volk_32fc_conjugate_32fc #include // for copy_n #include // for abs, pow, floor #include // for complex +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, @@ -44,10 +49,17 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration acq_iq_(configuration->property(role + ".acquire_iq", false)) { acq_parameters_.SetFromConfiguration(configuration, role_, fpga_buff_num, fpga_blk_exp, downsampling_factor_default, GALILEO_E5B_CODE_CHIP_RATE_CPS, GALILEO_E5B_CODE_LENGTH_CHIPS); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); fs_in_ = acq_parameters_.fs_in; diff --git a/src/algorithms/acquisition/adapters/galileo_e6_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e6_pcps_acquisition.cc index eda68fb66..dd76d0d98 100644 --- a/src/algorithms/acquisition/adapters/galileo_e6_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e6_pcps_acquisition.cc @@ -21,9 +21,14 @@ #include "configuration_interface.h" #include "galileo_e6_signal_replica.h" #include "gnss_sdr_flags.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -51,10 +56,17 @@ GalileoE6PcpsAcquisition::GalileoE6PcpsAcquisition( DLOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); item_type_ = acq_parameters_.item_type; diff --git a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc index c63eb5ec7..628c96d25 100644 --- a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc @@ -23,9 +23,14 @@ #include "configuration_interface.h" #include "glonass_l1_signal_replica.h" #include "gnss_sdr_flags.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -51,10 +56,17 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition( DLOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); item_type_ = acq_parameters_.item_type; diff --git a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc index 180f50747..46b6790a4 100644 --- a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc @@ -22,9 +22,14 @@ #include "configuration_interface.h" #include "glonass_l2_signal_replica.h" #include "gnss_sdr_flags.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -50,10 +55,17 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition( DLOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); item_type_ = acq_parameters_.item_type; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc index 72994eebc..6992b7260 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc @@ -25,9 +25,14 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include "gps_sdr_signal_replica.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -54,10 +59,17 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( DLOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc index ffe4ca5d2..f119a60c4 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc @@ -24,8 +24,12 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include "gps_sdr_signal_replica.h" -#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler( const ConfigurationInterface* configuration, @@ -57,10 +61,17 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler( acq_parameters.dump = dump_; dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); acq_parameters.dump_filename = dump_filename_; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif acq_parameters.doppler_max = doppler_max_; acq_parameters.sampled_ms = sampled_ms_; acq_parameters.max_dwells = max_dwells_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc index cc2713d24..0242062b0 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc @@ -24,13 +24,18 @@ #include "gnss_sdr_fft.h" #include "gnss_sdr_flags.h" #include "gps_sdr_signal_replica.h" -#include #include // for gr_complex #include // for volk_32fc_conjugate_32fc #include // for copy_n #include // for abs, pow, floor #include // for complex +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( const ConfigurationInterface* configuration, const std::string& role, @@ -47,10 +52,17 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( DLOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); fs_in_ = acq_parameters_.fs_in; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc index 98fb0b9c6..0bd82c2dc 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc @@ -23,8 +23,12 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include "gps_sdr_signal_replica.h" -#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( const ConfigurationInterface* configuration, @@ -51,10 +55,17 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_min_ = configuration->property(role_ + ".doppler_min", -doppler_max_); bool enable_monitor_output = configuration->property("AcquisitionMonitor.enable_monitor", false); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc index 05d26212c..e0352f9b2 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc @@ -21,9 +21,14 @@ #include "gnss_sdr_flags.h" #include "gps_sdr_signal_replica.h" #include -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -58,10 +63,17 @@ GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition( fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); dump_ = configuration->property(role + ".dump", false); doppler_max_ = configuration->property(role + ".doppler_max", 5000); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif sampled_ms_ = configuration->property(role + ".coherent_integration_time_ms", 1); bit_transition_flag_ = configuration->property("Acquisition.bit_transition_flag", false); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc index db6451541..9fd146be2 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc @@ -22,9 +22,14 @@ #include "gnss_sdr_flags.h" #include "gps_sdr_signal_replica.h" #include -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -58,10 +63,17 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif // -- Find number of samples per spreading code ------------------------- code_length_ = static_cast(round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc index 7dca40c3a..63efcab00 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc @@ -21,9 +21,14 @@ #include "gnss_sdr_flags.h" #include "gps_sdr_signal_replica.h" #include -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -63,10 +68,17 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); dump_filename_ = configuration_->property(role_ + ".dump_filename", std::move(default_dump_filename)); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif bool enable_monitor_output = configuration_->property("AcquisitionMonitor.enable_monitor", false); // -- Find number of samples per spreading code ------------------------- diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc index f2e491690..0b61172b1 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc @@ -23,9 +23,14 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include "gps_l2c_signal_replica.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -52,10 +57,17 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( DLOG(INFO) << "Role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); item_type_ = acq_parameters_.item_type; diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc index ecce4df4c..e78b1b174 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc @@ -23,7 +23,6 @@ #include "gnss_sdr_fft.h" #include "gnss_sdr_flags.h" #include "gps_l2c_signal_replica.h" -#include #include // for gr_complex #include // for volk_32fc_conjugate_32fc #include @@ -31,6 +30,12 @@ #include // for abs, pow, floor #include // for complex +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( const ConfigurationInterface* configuration, const std::string& role, @@ -47,10 +52,17 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( LOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); fs_in_ = acq_parameters_.fs_in; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc index 35b889994..b901c2db3 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc @@ -23,8 +23,14 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include "gps_l5_signal_replica.h" -#include #include + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -51,10 +57,17 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( DLOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc index a96bf531d..0e379d034 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc @@ -24,7 +24,6 @@ #include "gnss_sdr_fft.h" #include "gnss_sdr_flags.h" #include "gps_l5_signal_replica.h" -#include #include // for gr_complex #include // for volk_32fc_conjugate_32fc #include @@ -32,6 +31,12 @@ #include // for abs, pow, floor #include // for complex +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( const ConfigurationInterface* configuration, const std::string& role, @@ -48,10 +53,17 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( LOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); fs_in_ = acq_parameters_.fs_in; diff --git a/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt b/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt index fdeb3981e..de689f5b3 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt @@ -65,11 +65,16 @@ target_link_libraries(acquisition_gr_blocks Volk::volk Volkgnsssdr::volkgnsssdr PRIVATE - Gflags::gflags - Glog::glog Matio::matio ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(acquisition_gr_blocks PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(acquisition_gr_blocks PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(acquisition_gr_blocks PRIVATE absl::flags absl::log) +endif() + target_include_directories(acquisition_gr_blocks PRIVATE ${GNSSSDR_SOURCE_DIR}/src/core/receiver diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc index 7851aff79..ed095a757 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc @@ -23,7 +23,6 @@ #include "galileo_e5a_noncoherent_iq_acquisition_caf_cc.h" #include "MATH_CONSTANTS.h" -#include #include #include #include @@ -32,6 +31,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr galileo_e5a_noncoherentIQ_make_acquisition_caf_cc( unsigned int sampled_ms, diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc index 7dad27c45..8bc915769 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc @@ -17,7 +17,6 @@ #include "galileo_pcps_8ms_acquisition_cc.h" #include "MATH_CONSTANTS.h" -#include #include #include #include @@ -26,6 +25,11 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif galileo_pcps_8ms_acquisition_cc_sptr galileo_pcps_8ms_make_acquisition_cc( uint32_t sampled_ms, diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index 5aa106bf3..5249cd115 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -39,6 +39,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + pcps_acquisition_sptr pcps_make_acquisition(const Acq_Conf& conf_) { @@ -896,6 +902,18 @@ void pcps_acquisition::calculate_threshold() } +void pcps_acquisition::set_doppler_center(int32_t doppler_center) +{ + gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler + if (doppler_center != d_doppler_center) + { + DLOG(INFO) << " Doppler assistance for Channel: " << d_channel << " => Doppler: " << doppler_center << "[Hz]"; + d_doppler_center = doppler_center; + update_grid_doppler_wipeoffs(); + } +} + + int pcps_acquisition::general_work(int noutput_items __attribute__((unused)), gr_vector_int& ninput_items, gr_vector_const_void_star& input_items, diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h index 74fb8c114..673267f75 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h @@ -46,7 +46,6 @@ #include "channel_fsm.h" #include "gnss_sdr_fft.h" #include -#include #include #include // for gr_complex #include // for scoped_lock @@ -60,6 +59,7 @@ #include #include + #if HAS_STD_SPAN #include namespace own = std; @@ -196,16 +196,7 @@ public: * \brief Set Doppler center frequency for the grid search. It will refresh the Doppler grid. * \param doppler_center - Frequency center of the search grid [Hz]. */ - inline void set_doppler_center(int32_t doppler_center) - { - gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler - if (doppler_center != d_doppler_center) - { - DLOG(INFO) << " Doppler assistance for Channel: " << d_channel << " => Doppler: " << doppler_center << "[Hz]"; - d_doppler_center = doppler_center; - update_grid_doppler_wipeoffs(); - } - } + void set_doppler_center(int32_t doppler_center); /*! * \brief Parallel Code Phase Search Acquisition signal processing. diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc index 28624f346..e51f9711b 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc @@ -21,7 +21,6 @@ #include "gnss_sdr_create_directory.h" #include "gnss_sdr_filesystem.h" #include "gps_sdr_signal_replica.h" -#include #include #include #include @@ -30,6 +29,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + pcps_acquisition_fine_doppler_cc_sptr pcps_make_acquisition_fine_doppler_cc(const Acq_Conf &conf_) { diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc index 0414a2d79..eff195cb1 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc @@ -21,12 +21,17 @@ #include "pcps_acquisition_fpga.h" #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 #include "gnss_synchro.h" -#include #include // for ceil #include // for operator<< #include // for move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(Acq_Conf_Fpga& conf_) { return pcps_acquisition_fpga_sptr(new pcps_acquisition_fpga(conf_)); @@ -288,6 +293,16 @@ void pcps_acquisition_fpga::set_active(bool active) } +void pcps_acquisition_fpga::set_doppler_center(int32_t doppler_center) +{ + if (doppler_center != d_doppler_center) + { + DLOG(INFO) << " Doppler assistance for Channel: " << d_channel << " => Doppler: " << doppler_center << "[Hz]"; + d_doppler_center = doppler_center; + } +} + + void pcps_acquisition_fpga::reset_acquisition() { // this function triggers a HW reset of the FPGA PL. diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h index 92ec51781..ded4ba660 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h @@ -29,7 +29,6 @@ #include "acq_conf_fpga.h" #include "channel_fsm.h" #include "fpga_acquisition.h" -#include #include // for uint32_t #include // for shared_ptr #include // for string @@ -156,14 +155,7 @@ public: * \brief Set Doppler center frequency for the grid search. It will refresh the Doppler grid. * \param doppler_center - Frequency center of the search grid [Hz]. */ - inline void set_doppler_center(int32_t doppler_center) - { - if (doppler_center != d_doppler_center) - { - DLOG(INFO) << " Doppler assistance for Channel: " << d_channel << " => Doppler: " << doppler_center << "[Hz]"; - d_doppler_center = doppler_center; - } - } + void set_doppler_center(int32_t doppler_center); /*! * \brief This function triggers a HW reset of the FPGA PL. diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc index 3d919f87f..34eb3d189 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc @@ -20,7 +20,6 @@ #include "MATH_CONSTANTS.h" #include "concurrent_map.h" #include "gps_acq_assist.h" -#include #include #include #include @@ -30,6 +29,11 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif extern Concurrent_Map global_gps_acq_assist_map; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc index e16d184a3..ed4ed9ddb 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc @@ -22,7 +22,6 @@ #include "pcps_cccwsr_acquisition_cc.h" #include "MATH_CONSTANTS.h" // TWO_PI -#include #include #include #include @@ -32,6 +31,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + pcps_cccwsr_acquisition_cc_sptr pcps_cccwsr_make_acquisition_cc( uint32_t sampled_ms, diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc index 2f0e3662a..5f2fa348c 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc @@ -38,7 +38,6 @@ #include "MATH_CONSTANTS.h" // TWO_PI #include "opencl/fft_base_kernels.h" #include "opencl/fft_internal.h" -#include #include #include #include @@ -50,6 +49,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + pcps_opencl_acquisition_cc_sptr pcps_make_opencl_acquisition_cc( uint32_t sampled_ms, uint32_t max_dwells, diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc index 39bac577c..fdd6d918a 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc @@ -16,7 +16,6 @@ #include "pcps_quicksync_acquisition_cc.h" #include "MATH_CONSTANTS.h" -#include #include #include #include @@ -25,6 +24,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + pcps_quicksync_acquisition_cc_sptr pcps_quicksync_make_acquisition_cc( uint32_t folding_factor, diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc index f072dcd6a..42c131337 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc @@ -36,7 +36,6 @@ #include "pcps_tong_acquisition_cc.h" #include "MATH_CONSTANTS.h" // for TWO_PI -#include #include #include #include @@ -45,6 +44,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + pcps_tong_acquisition_cc_sptr pcps_tong_make_acquisition_cc( uint32_t sampled_ms, diff --git a/src/algorithms/acquisition/libs/CMakeLists.txt b/src/algorithms/acquisition/libs/CMakeLists.txt index 65437c649..a2eb01230 100644 --- a/src/algorithms/acquisition/libs/CMakeLists.txt +++ b/src/algorithms/acquisition/libs/CMakeLists.txt @@ -38,12 +38,17 @@ target_link_libraries(acquisition_libs INTERFACE Gnuradio::runtime PRIVATE - Gflags::gflags - Glog::glog algorithms_libs core_system_parameters ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(acquisition_libs PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(acquisition_libs PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(acquisition_libs PRIVATE absl::flags absl::log) +endif() + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(acquisition_libs diff --git a/src/algorithms/acquisition/libs/acq_conf.cc b/src/algorithms/acquisition/libs/acq_conf.cc index 715b07f62..e0ad5d490 100644 --- a/src/algorithms/acquisition/libs/acq_conf.cc +++ b/src/algorithms/acquisition/libs/acq_conf.cc @@ -17,9 +17,14 @@ #include "acq_conf.h" #include "item_type_helpers.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + void Acq_Conf::SetFromConfiguration(const ConfigurationInterface *configuration, const std::string &role, double chip_rate, double opt_freq) diff --git a/src/algorithms/acquisition/libs/acq_conf_fpga.cc b/src/algorithms/acquisition/libs/acq_conf_fpga.cc index 838ab3ae6..00e47b153 100644 --- a/src/algorithms/acquisition/libs/acq_conf_fpga.cc +++ b/src/algorithms/acquisition/libs/acq_conf_fpga.cc @@ -18,11 +18,16 @@ #include "acq_conf_fpga.h" #include "item_type_helpers.h" #include "uio_fpga.h" -#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + void Acq_Conf_Fpga::SetFromConfiguration(const ConfigurationInterface *configuration, const std::string &role, uint32_t sel_queue_fpga, uint32_t blk_exp, uint32_t downsampling_factor_default, double chip_rate, double code_length_chips) { diff --git a/src/algorithms/acquisition/libs/fpga_acquisition.cc b/src/algorithms/acquisition/libs/fpga_acquisition.cc index 667533c08..def42d9d8 100644 --- a/src/algorithms/acquisition/libs/fpga_acquisition.cc +++ b/src/algorithms/acquisition/libs/fpga_acquisition.cc @@ -21,7 +21,6 @@ #include "fpga_acquisition.h" #include "MATH_CONSTANTS.h" // for TWO_PI -#include // for LOG #include // for log2 #include // libraries used by the GIPO #include // for operator<< @@ -29,6 +28,11 @@ #include // for write, close, read, ssize_t #include // for move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif #ifndef TEMP_FAILURE_RETRY #define TEMP_FAILURE_RETRY(exp) \ diff --git a/src/algorithms/channel/adapters/CMakeLists.txt b/src/algorithms/channel/adapters/CMakeLists.txt index 7d9ddcf83..4d1fda6ba 100644 --- a/src/algorithms/channel/adapters/CMakeLists.txt +++ b/src/algorithms/channel/adapters/CMakeLists.txt @@ -26,9 +26,15 @@ target_link_libraries(channel_adapters channel_libs PRIVATE gnss_sdr_flags - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(channel_adapters PRIVATE Glog::glog) + target_compile_definitions(channel_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(channel_adapters PRIVATE absl::flags absl::log) +endif() + target_include_directories(channel_adapters PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/channel/adapters/channel.cc b/src/algorithms/channel/adapters/channel.cc index 444eef958..f69743398 100644 --- a/src/algorithms/channel/adapters/channel.cc +++ b/src/algorithms/channel/adapters/channel.cc @@ -22,10 +22,14 @@ #include "gnss_sdr_flags.h" #include "telemetry_decoder_interface.h" #include "tracking_interface.h" -#include #include // for std::invalid_argument #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif Channel::Channel(const ConfigurationInterface* configuration, uint32_t channel, @@ -77,10 +81,17 @@ Channel::Channel(const ConfigurationInterface* configuration, { doppler_step = configuration->property("Acquisition_" + signal_str + ".doppler_step", 500); } +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_step != 0) { doppler_step = static_cast(FLAGS_doppler_step); } +#else + if (absl::GetFlag(FLAGS_doppler_step) != 0) + { + doppler_step = static_cast(absl::GetFlag(FLAGS_doppler_step)); + } +#endif DLOG(INFO) << "Channel " << channel_ << " Doppler_step = " << doppler_step; acq_->set_doppler_step(doppler_step); diff --git a/src/algorithms/channel/libs/CMakeLists.txt b/src/algorithms/channel/libs/CMakeLists.txt index 63e0d72d8..dc5715abb 100644 --- a/src/algorithms/channel/libs/CMakeLists.txt +++ b/src/algorithms/channel/libs/CMakeLists.txt @@ -39,10 +39,15 @@ target_link_libraries(channel_libs PRIVATE core_libs Boost::headers - Gflags::gflags - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(channel_libs PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(channel_libs PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(channel_libs PRIVATE absl::flags absl::log) +endif() + target_include_directories(channel_libs PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/receiver diff --git a/src/algorithms/channel/libs/channel_fsm.cc b/src/algorithms/channel/libs/channel_fsm.cc index 48f001238..c092c77a8 100644 --- a/src/algorithms/channel/libs/channel_fsm.cc +++ b/src/algorithms/channel/libs/channel_fsm.cc @@ -18,9 +18,14 @@ #include "channel_fsm.h" #include "channel_event.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + ChannelFsm::ChannelFsm() : queue_(nullptr), channel_(0U), diff --git a/src/algorithms/channel/libs/channel_msg_receiver_cc.cc b/src/algorithms/channel/libs/channel_msg_receiver_cc.cc index 4d2e5616b..3a9607b5a 100644 --- a/src/algorithms/channel/libs/channel_msg_receiver_cc.cc +++ b/src/algorithms/channel/libs/channel_msg_receiver_cc.cc @@ -17,12 +17,17 @@ #include "channel_msg_receiver_cc.h" -#include #include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if PMT_USES_BOOST_ANY #include namespace wht = boost; diff --git a/src/algorithms/conditioner/adapters/CMakeLists.txt b/src/algorithms/conditioner/adapters/CMakeLists.txt index 7c24d008e..59432f3e9 100644 --- a/src/algorithms/conditioner/adapters/CMakeLists.txt +++ b/src/algorithms/conditioner/adapters/CMakeLists.txt @@ -37,11 +37,15 @@ endif() target_link_libraries(conditioner_adapters PUBLIC Gnuradio::runtime - PRIVATE - Gflags::gflags - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(conditioner_adapters PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(conditioner_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(conditioner_adapters PRIVATE absl::flags absl::log) +endif() + target_include_directories(conditioner_adapters PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/conditioner/adapters/array_signal_conditioner.cc b/src/algorithms/conditioner/adapters/array_signal_conditioner.cc index 02471e8a5..85256ee13 100644 --- a/src/algorithms/conditioner/adapters/array_signal_conditioner.cc +++ b/src/algorithms/conditioner/adapters/array_signal_conditioner.cc @@ -17,9 +17,13 @@ #include "array_signal_conditioner.h" #include "configuration_interface.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif // Constructor ArraySignalConditioner::ArraySignalConditioner(std::shared_ptr data_type_adapt, diff --git a/src/algorithms/conditioner/adapters/signal_conditioner.cc b/src/algorithms/conditioner/adapters/signal_conditioner.cc index 871ed0a51..421871708 100644 --- a/src/algorithms/conditioner/adapters/signal_conditioner.cc +++ b/src/algorithms/conditioner/adapters/signal_conditioner.cc @@ -16,10 +16,14 @@ */ #include "signal_conditioner.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif // Constructor SignalConditioner::SignalConditioner(std::shared_ptr data_type_adapt, diff --git a/src/algorithms/data_type_adapter/adapters/CMakeLists.txt b/src/algorithms/data_type_adapter/adapters/CMakeLists.txt index f3829b5ab..253624190 100644 --- a/src/algorithms/data_type_adapter/adapters/CMakeLists.txt +++ b/src/algorithms/data_type_adapter/adapters/CMakeLists.txt @@ -53,11 +53,16 @@ target_link_libraries(data_type_adapters Gnuradio::blocks data_type_gr_blocks PRIVATE - Gflags::gflags - Glog::glog Volk::volk ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(data_type_adapters PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(data_type_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(data_type_adapters PRIVATE absl::flags absl::log) +endif() + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(data_type_adapters diff --git a/src/algorithms/data_type_adapter/adapters/byte_to_short.cc b/src/algorithms/data_type_adapter/adapters/byte_to_short.cc index 43e9d119b..afb062772 100644 --- a/src/algorithms/data_type_adapter/adapters/byte_to_short.cc +++ b/src/algorithms/data_type_adapter/adapters/byte_to_short.cc @@ -16,9 +16,14 @@ #include "byte_to_short.h" #include "configuration_interface.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + ByteToShort::ByteToShort(const ConfigurationInterface* configuration, std::string role, diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc index dc825015d..835ec2021 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc @@ -17,9 +17,14 @@ #include "ibyte_to_cbyte.h" #include "configuration_interface.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + IbyteToCbyte::IbyteToCbyte(const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc index 13be7798c..a79458e5b 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc @@ -16,7 +16,12 @@ #include "ibyte_to_complex.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif IbyteToComplex::IbyteToComplex(const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc index a146ef474..2420bcd0f 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc @@ -17,9 +17,13 @@ #include "ibyte_to_cshort.h" #include "configuration_interface.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif IbyteToCshort::IbyteToCshort(const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc index 0e67db072..18d8df571 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc @@ -16,8 +16,12 @@ #include "ishort_to_complex.h" #include "configuration_interface.h" -#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif IshortToComplex::IshortToComplex(const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc index b51232869..80e1c680a 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc @@ -17,9 +17,13 @@ #include "ishort_to_cshort.h" #include "configuration_interface.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif IshortToCshort::IshortToCshort(const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/input_filter/adapters/CMakeLists.txt b/src/algorithms/input_filter/adapters/CMakeLists.txt index a4f052ade..6af64cff8 100644 --- a/src/algorithms/input_filter/adapters/CMakeLists.txt +++ b/src/algorithms/input_filter/adapters/CMakeLists.txt @@ -47,11 +47,16 @@ target_link_libraries(input_filter_adapters algorithms_libs input_filter_gr_blocks PRIVATE - Gflags::gflags - Glog::glog Volk::volk ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(input_filter_adapters PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(input_filter_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(input_filter_adapters PRIVATE absl::flags absl::log) +endif() + if(GNURADIO_IS_38_OR_GREATER) target_compile_definitions(input_filter_adapters PUBLIC -DGR_GREATER_38=1) endif() diff --git a/src/algorithms/input_filter/adapters/beamformer_filter.cc b/src/algorithms/input_filter/adapters/beamformer_filter.cc index 4a96bf85b..daa8b1ec5 100644 --- a/src/algorithms/input_filter/adapters/beamformer_filter.cc +++ b/src/algorithms/input_filter/adapters/beamformer_filter.cc @@ -17,9 +17,13 @@ #include "beamformer_filter.h" #include "beamformer.h" #include "configuration_interface.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif BeamformerFilter::BeamformerFilter( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/input_filter/adapters/fir_filter.cc b/src/algorithms/input_filter/adapters/fir_filter.cc index ad76b5f6a..12cef24ca 100644 --- a/src/algorithms/input_filter/adapters/fir_filter.cc +++ b/src/algorithms/input_filter/adapters/fir_filter.cc @@ -17,11 +17,15 @@ #include "fir_filter.h" #include "configuration_interface.h" -#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif FirFilter::FirFilter(const ConfigurationInterface* configuration, std::string role, diff --git a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc index 1d4e2f386..1378931c8 100644 --- a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc +++ b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc @@ -17,13 +17,17 @@ #include "freq_xlating_fir_filter.h" #include "configuration_interface.h" -#include #include #include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif FreqXlatingFirFilter::FreqXlatingFirFilter(const ConfigurationInterface* configuration, std::string role, diff --git a/src/algorithms/input_filter/adapters/notch_filter.cc b/src/algorithms/input_filter/adapters/notch_filter.cc index 1ca31c5f3..8e8b93392 100644 --- a/src/algorithms/input_filter/adapters/notch_filter.cc +++ b/src/algorithms/input_filter/adapters/notch_filter.cc @@ -19,8 +19,12 @@ #include "configuration_interface.h" #include "notch_cc.h" #include -#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif NotchFilter::NotchFilter(const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/input_filter/adapters/notch_filter_lite.cc b/src/algorithms/input_filter/adapters/notch_filter_lite.cc index 8dc161688..42afd1713 100644 --- a/src/algorithms/input_filter/adapters/notch_filter_lite.cc +++ b/src/algorithms/input_filter/adapters/notch_filter_lite.cc @@ -19,9 +19,13 @@ #include "configuration_interface.h" #include "notch_lite_cc.h" #include -#include #include // for max +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif NotchFilterLite::NotchFilterLite(const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc index b28c13d47..8971d2c9d 100644 --- a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc +++ b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc @@ -19,12 +19,16 @@ #include "pulse_blanking_filter.h" #include "configuration_interface.h" #include -#include #include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif PulseBlankingFilter::PulseBlankingFilter(const ConfigurationInterface* configuration, std::string role, diff --git a/src/algorithms/libs/CMakeLists.txt b/src/algorithms/libs/CMakeLists.txt index 1e31cf4c3..3f0b050a6 100644 --- a/src/algorithms/libs/CMakeLists.txt +++ b/src/algorithms/libs/CMakeLists.txt @@ -109,10 +109,15 @@ target_link_libraries(algorithms_libs core_system_parameters Volk::volk Volkgnsssdr::volkgnsssdr - Gflags::gflags - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(algorithms_libs PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(algorithms_libs PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(algorithms_libs PRIVATE absl::flags absl::log) +endif() + if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(algorithms_libs PUBLIC -DGNURADIO_USES_STD_POINTERS=1 @@ -208,13 +213,14 @@ else() target_link_libraries(gnss_sdr_flags PRIVATE Boost::filesystem Boost::system) endif() -target_link_libraries(gnss_sdr_flags - PUBLIC - Gflags::gflags -) - -if(GFLAGS_GREATER_20 OR ${LOCAL_GFLAGS}) - target_compile_definitions(gnss_sdr_flags PRIVATE -DGFLAGS_GREATER_2_0=1) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(gnss_sdr_flags PUBLIC Gflags::gflags) + target_compile_definitions(gnss_sdr_flags PUBLIC -DUSE_GLOG_AND_GFLAGS=1) + if(GFLAGS_GREATER_20 OR "${LOCAL_GFLAGS}") + target_compile_definitions(gnss_sdr_flags PRIVATE -DGFLAGS_GREATER_2_0=1) + endif() +else() + target_link_libraries(gnss_sdr_flags PUBLIC absl::flags) endif() target_compile_definitions(gnss_sdr_flags diff --git a/src/algorithms/libs/gnss_sdr_flags.cc b/src/algorithms/libs/gnss_sdr_flags.cc index 4961c01aa..26ae20da6 100644 --- a/src/algorithms/libs/gnss_sdr_flags.cc +++ b/src/algorithms/libs/gnss_sdr_flags.cc @@ -1,7 +1,7 @@ /*! * \file gnss_sdr_flags.cc * \brief Helper file for gnss-sdr commandline flags - * \author Carles Fernandez-Prades, 2018. cfernandez(at)cttc.es + * \author Carles Fernandez-Prades, 2018-2024. cfernandez(at)cttc.es * * * ----------------------------------------------------------------------------- @@ -9,7 +9,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -19,9 +19,8 @@ #include "gnss_sdr_flags.h" #include "gnss_sdr_filesystem.h" #include -#include - +#if USE_GLOG_AND_GFLAGS DEFINE_string(c, "-", "Path to the configuration file (if set, overrides --config_file)."); DEFINE_string(config_file, std::string(GNSSSDR_INSTALL_DIR "/share/gnss-sdr/conf/default.conf"), @@ -235,3 +234,26 @@ DEFINE_validator(pll_bw_hz, &ValidatePllBw); DEFINE_validator(carrier_smoothing_factor, &ValidateCarrierSmoothingFactor); #endif + +#else +ABSL_FLAG(std::string, c, "-", "Path to the configuration file (if set, overrides --config_file)."); +ABSL_FLAG(std::string, config_file, std::string(GNSSSDR_INSTALL_DIR "/share/gnss-sdr/conf/default.conf"), "Path to the configuration file."); +ABSL_FLAG(std::string, log_dir, "", "Directory for log files"); +ABSL_FLAG(std::string, s, "-", "If defined, path to the file containing the signal samples (overrides the configuration file and --signal_source)."); +ABSL_FLAG(std::string, signal_source, "-", "If defined, path to the file containing the signal samples (overrides the configuration file)."); +ABSL_FLAG(std::string, timestamp_source, "-", "If defined, path to the file containing the signal timestamp data (overrides the configuration file)."); +ABSL_FLAG(bool, rf_shutdown, true, "If set to false, AD9361 RF channels are not shut down when exiting the program. Useful to leave the AD9361 configured and running."); +ABSL_FLAG(int32_t, doppler_max, 0, "If defined, sets the maximum Doppler value in the search grid, in Hz (overrides the configuration file)."); +ABSL_FLAG(int32_t, doppler_step, 0, "If defined, sets the frequency step in the search grid, in Hz (overrides the configuration file)."); +ABSL_FLAG(int32_t, cn0_samples, 20, "Number of correlator outputs used for CN0 estimation."); +ABSL_FLAG(int32_t, cn0_min, 25, "Minimum valid CN0 (in dB-Hz)."); +ABSL_FLAG(int32_t, max_carrier_lock_fail, 5000, "Maximum number of carrier lock failures before dropping a satellite."); +ABSL_FLAG(int32_t, max_lock_fail, 50, "Maximum number of code lock failures before dropping a satellite."); +ABSL_FLAG(double, carrier_lock_th, 0.7, "Carrier lock threshold (in rad)."); +ABSL_FLAG(double, dll_bw_hz, 0.0, "If defined, bandwidth of the DLL low pass filter, in Hz (overrides the configuration file)."); +ABSL_FLAG(double, pll_bw_hz, 0.0, "If defined, bandwidth of the PLL low pass filter, in Hz (overrides the configuration file)."); +ABSL_FLAG(int32_t, carrier_smoothing_factor, DEFAULT_CARRIER_SMOOTHING_FACTOR, "Sets carrier smoothing factor M (overrides the configuration file)"); +ABSL_FLAG(std::string, RINEX_version, "-", "If defined, specifies the RINEX version (2.11 or 3.02). Overrides the configuration file."); +ABSL_FLAG(std::string, RINEX_name, "-", "If defined, specifies the RINEX files base name"); +ABSL_FLAG(bool, keyboard, true, "If set to false, it disables the keyboard listener (so the receiver cannot be stopped with q+[Enter])"); +#endif diff --git a/src/algorithms/libs/gnss_sdr_flags.h b/src/algorithms/libs/gnss_sdr_flags.h index 361195a49..3dd02fd3d 100644 --- a/src/algorithms/libs/gnss_sdr_flags.h +++ b/src/algorithms/libs/gnss_sdr_flags.h @@ -1,7 +1,7 @@ /*! * \file gnss_sdr_flags.h * \brief Helper file for gnss-sdr commandline flags - * \author Carles Fernandez-Prades, 2018. cfernandez(at)cttc.es + * \author Carles Fernandez-Prades, 2018-2024. cfernandez(at)cttc.es * * * ----------------------------------------------------------------------------- @@ -9,7 +9,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -18,9 +18,20 @@ #ifndef GNSS_SDR_GNSS_SDR_FLAGS_H #define GNSS_SDR_GNSS_SDR_FLAGS_H - -#include #include +#include + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#include +#include +#include +#include +#include +#endif + /** \addtogroup Algorithms_Library * \{ */ @@ -28,7 +39,7 @@ * Library for command-line handling. * \{ */ - +#if USE_GLOG_AND_GFLAGS DECLARE_string(c); //!< Path to the configuration file. DECLARE_string(config_file); //!< Path to the configuration file. @@ -62,6 +73,113 @@ DECLARE_string(RINEX_version); //!< If defined, specifies the RINEX version (2. DECLARE_string(RINEX_name); //!< If defined, specifies the RINEX files base name DECLARE_bool(keyboard); //!< If set to false, disables the keyboard listener. Only for debug purposes (e.g. ASAN mode termination) +#else +ABSL_DECLARE_FLAG(std::string, c); //!< Path to the configuration file. +ABSL_DECLARE_FLAG(std::string, config_file); //!< Path to the configuration file. + +ABSL_DECLARE_FLAG(std::string, log_dir); //!< Path to the folder in which logging will be stored. + +// Declare flags for signal sources +ABSL_DECLARE_FLAG(std::string, s); //!< Path to the file containing the signal samples. +ABSL_DECLARE_FLAG(std::string, signal_source); //!< Path to the file containing the signal samples. +ABSL_DECLARE_FLAG(std::string, timestamp_source); //!< Path to the file containing the signal samples. +ABSL_DECLARE_FLAG(bool, rf_shutdown); //!< Shutdown RF when program exits. + +// Declare flags for acquisition blocks +ABSL_DECLARE_FLAG(int32_t, doppler_max); //!< If defined, maximum Doppler value in the search grid, in Hz (overrides the configuration file). +ABSL_DECLARE_FLAG(int32_t, doppler_step); //!< If defined, sets the frequency step in the search grid, in Hz, in Hz (overrides the configuration file). + +// Declare flags for tracking blocks +ABSL_DECLARE_FLAG(int32_t, cn0_samples); //!< Number of correlator outputs used for CN0 estimation. +ABSL_DECLARE_FLAG(int32_t, cn0_min); //!< Minimum valid CN0 (in dB-Hz). +ABSL_DECLARE_FLAG(int32_t, max_lock_fail); //!< Maximum number of code lock failures before dropping a satellite. +ABSL_DECLARE_FLAG(int32_t, max_carrier_lock_fail); //!< Maximum number of carrier lock failures before dropping a satellite. +ABSL_DECLARE_FLAG(double, carrier_lock_th); //!< Carrier lock threshold (in rad). +ABSL_DECLARE_FLAG(double, dll_bw_hz); //!< Bandwidth of the DLL low pass filter, in Hz (overrides the configuration file). +ABSL_DECLARE_FLAG(double, pll_bw_hz); //!< Bandwidth of the PLL low pass filter, in Hz (overrides the configuration file). + +// Declare flags for observables block +ABSL_DECLARE_FLAG(int32_t, carrier_smoothing_factor); //!< Sets carrier smoothing factor M (overrides the configuration file). +const int32_t DEFAULT_CARRIER_SMOOTHING_FACTOR = 200; + +// Declare flags for PVT +ABSL_DECLARE_FLAG(std::string, RINEX_version); //!< If defined, specifies the RINEX version (2.11 or 3.02). Overrides the configuration file. +ABSL_DECLARE_FLAG(std::string, RINEX_name); //!< If defined, specifies the RINEX files base name +ABSL_DECLARE_FLAG(bool, keyboard); //!< If set to false, disables the keyboard listener. Only for debug purposes (e.g. ASAN mode termination) + +static inline void GetTempDirectories(std::vector& list) +{ + list.clear(); + // Directories, in order of preference. If we find a dir that + // exists, we stop adding other less-preferred dirs + const char* candidates[] = { + // Non-null only during unittest/regtest + std::getenv("TEST_TMPDIR"), + + // Explicitly-supplied temp dirs + std::getenv("TMPDIR"), + std::getenv("TMP"), + + // If all else fails + "/tmp", + }; + for (auto d : candidates) + { + if (!d) continue; // Empty env var + + // Make sure we don't surprise anyone who's expecting a '/' + std::string dstr = d; + if (dstr[dstr.size() - 1] != '/') + { + dstr += "/"; + } + list.push_back(dstr); + + struct stat statbuf; + if (!stat(d, &statbuf) && S_ISDIR(statbuf.st_mode)) + { + // We found a dir that exists - we're done. + return; + } + } +} + + +static inline void GetExistingTempDirectories(std::vector& list) +{ + GetTempDirectories(list); + auto i_dir = list.begin(); + while (i_dir != list.end()) + { + if (access(i_dir->c_str(), 0)) + { + i_dir = list.erase(i_dir); + } + else + { + ++i_dir; + } + }; +} + + +static inline std::string GetTempDir() +{ + std::vector temp_directories_list; + GetExistingTempDirectories(temp_directories_list); + + if (temp_directories_list.empty()) + { + std::cerr << "No temporary directory found\n"; + exit(EXIT_FAILURE); + } + + // Use first directory from list of existing temporary directories. + return temp_directories_list.front(); +} +#endif + + /** \} */ /** \} */ #endif // GNSS_SDR_GNSS_SDR_FLAGS_H diff --git a/src/algorithms/libs/pass_through.cc b/src/algorithms/libs/pass_through.cc index bc54ae61a..714b5cd27 100644 --- a/src/algorithms/libs/pass_through.cc +++ b/src/algorithms/libs/pass_through.cc @@ -18,12 +18,16 @@ #include "pass_through.h" #include "configuration_interface.h" -#include #include #include #include // for int8_t #include // for operator<< +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif Pass_Through::Pass_Through(const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/libs/rtklib/CMakeLists.txt b/src/algorithms/libs/rtklib/CMakeLists.txt index c23d55119..e308f102c 100644 --- a/src/algorithms/libs/rtklib/CMakeLists.txt +++ b/src/algorithms/libs/rtklib/CMakeLists.txt @@ -70,12 +70,17 @@ target_link_libraries(algorithms_libs_rtklib core_system_parameters algorithms_libs Armadillo::armadillo - Gflags::gflags - Glog::glog LAPACK::LAPACK BLAS::BLAS ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(algorithms_libs_rtklib PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(algorithms_libs_rtklib PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(algorithms_libs_rtklib PRIVATE absl::flags absl::log) +endif() + if(ENABLE_ARMA_NO_DEBUG) target_compile_definitions(algorithms_libs_rtklib PRIVATE -DARMA_NO_BOUND_CHECKING=1 diff --git a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc index 12e3fed4d..736928e51 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc @@ -30,7 +30,6 @@ *----------------------------------------------------------------------------*/ #include "rtklib_rtkcmn.h" -#include #include #include #include @@ -43,6 +42,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + const double GPST0[] = {1980, 1, 6, 0, 0, 0}; /* gps time reference */ const double GST0[] = {1999, 8, 22, 0, 0, 0}; /* galileo system time reference */ const double BDT0[] = {2006, 1, 1, 0, 0, 0}; /* beidou time reference */ diff --git a/src/algorithms/observables/adapters/CMakeLists.txt b/src/algorithms/observables/adapters/CMakeLists.txt index a4097a4dd..8417c1532 100644 --- a/src/algorithms/observables/adapters/CMakeLists.txt +++ b/src/algorithms/observables/adapters/CMakeLists.txt @@ -29,9 +29,15 @@ target_link_libraries(obs_adapters core_system_parameters PRIVATE gnss_sdr_flags - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(obs_adapters PRIVATE Glog::glog) + target_compile_definitions(obs_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(obs_adapters PRIVATE absl::flags absl::log) +endif() + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(obs_adapters diff --git a/src/algorithms/observables/adapters/hybrid_observables.cc b/src/algorithms/observables/adapters/hybrid_observables.cc index fbb6ba2a3..7a434f5df 100644 --- a/src/algorithms/observables/adapters/hybrid_observables.cc +++ b/src/algorithms/observables/adapters/hybrid_observables.cc @@ -19,9 +19,14 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include "obs_conf.h" -#include #include // for operator<< +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + HybridObservables::HybridObservables(const ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, @@ -45,7 +50,11 @@ HybridObservables::HybridObservables(const ConfigurationInterface* configuration conf.always_output_gs = configuration->property("PVT.an_output_enabled", conf.always_output_gs) || configuration->property(role + ".always_output_gs", conf.always_output_gs); conf.enable_E6 = configuration->property("PVT.use_e6_for_pvt", conf.enable_E6); +#if USE_GLOG_AND_GFLAGS if (FLAGS_carrier_smoothing_factor == DEFAULT_CARRIER_SMOOTHING_FACTOR) +#else + if (absl::GetFlag(FLAGS_carrier_smoothing_factor) == DEFAULT_CARRIER_SMOOTHING_FACTOR) +#endif { conf.smoothing_factor = configuration->property(role + ".smoothing_factor", conf.smoothing_factor); } diff --git a/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt b/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt index 225518612..a8964f90c 100644 --- a/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt @@ -31,12 +31,17 @@ target_link_libraries(obs_gr_blocks PRIVATE algorithms_libs core_system_parameters - Gflags::gflags - Glog::glog Matio::matio Gnuradio::pmt ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(obs_gr_blocks PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(obs_gr_blocks PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(obs_gr_blocks PRIVATE absl::flags absl::log) +endif() + target_include_directories(obs_gr_blocks PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc index a9bc19407..48a1b1c14 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc @@ -23,7 +23,6 @@ #include "gnss_sdr_filesystem.h" #include "gnss_sdr_make_unique.h" #include "gnss_synchro.h" -#include #include #include #include @@ -36,6 +35,12 @@ #include // for numeric_limits #include // for move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if PMT_USES_BOOST_ANY #include namespace wht = boost; diff --git a/src/algorithms/observables/libs/obs_conf.cc b/src/algorithms/observables/libs/obs_conf.cc index 9c11be794..f89ae1be7 100644 --- a/src/algorithms/observables/libs/obs_conf.cc +++ b/src/algorithms/observables/libs/obs_conf.cc @@ -18,6 +18,12 @@ #include "obs_conf.h" #include "gnss_sdr_flags.h" +#if USE_GLOG_AND_GFLAGS Obs_Conf::Obs_Conf() : smoothing_factor(FLAGS_carrier_smoothing_factor) { } +#else +Obs_Conf::Obs_Conf() : smoothing_factor(absl::GetFlag(FLAGS_carrier_smoothing_factor)) +{ +} +#endif \ No newline at end of file diff --git a/src/algorithms/resampler/adapters/CMakeLists.txt b/src/algorithms/resampler/adapters/CMakeLists.txt index ac4eca082..0cda783f8 100644 --- a/src/algorithms/resampler/adapters/CMakeLists.txt +++ b/src/algorithms/resampler/adapters/CMakeLists.txt @@ -38,11 +38,16 @@ target_link_libraries(resampler_adapters PUBLIC resampler_gr_blocks PRIVATE - Gflags::gflags - Glog::glog Volk::volk ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(resampler_adapters PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(resampler_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(resampler_adapters PRIVATE absl::flags absl::log) +endif() + target_include_directories(resampler_adapters PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc index bffa67680..57c875742 100644 --- a/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc +++ b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc @@ -20,13 +20,17 @@ #include "direct_resampler_conditioner_cb.h" #include "direct_resampler_conditioner_cc.h" #include "direct_resampler_conditioner_cs.h" -#include #include #include // for lv_8sc_t #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif DirectResamplerConditioner::DirectResamplerConditioner( const ConfigurationInterface* configuration, diff --git a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc index 7ee86662f..07f0e2b67 100644 --- a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc +++ b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc @@ -17,12 +17,17 @@ #include "mmse_resampler_conditioner.h" #include "configuration_interface.h" -#include #include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + MmseResamplerConditioner::MmseResamplerConditioner( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/signal_generator/adapters/CMakeLists.txt b/src/algorithms/signal_generator/adapters/CMakeLists.txt index c430af3c2..b7f8c1537 100644 --- a/src/algorithms/signal_generator/adapters/CMakeLists.txt +++ b/src/algorithms/signal_generator/adapters/CMakeLists.txt @@ -27,11 +27,16 @@ target_link_libraries(signal_generator_adapters Gnuradio::pmt signal_generator_gr_blocks PRIVATE - Gflags::gflags - Glog::glog core_system_parameters ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(signal_generator_adapters PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(signal_generator_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(signal_generator_adapters PRIVATE absl::flags absl::log) +endif() + target_include_directories(signal_generator_adapters PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/signal_generator/adapters/signal_generator.cc b/src/algorithms/signal_generator/adapters/signal_generator.cc index 841cbfe3f..c5d745689 100644 --- a/src/algorithms/signal_generator/adapters/signal_generator.cc +++ b/src/algorithms/signal_generator/adapters/signal_generator.cc @@ -25,10 +25,14 @@ #include "Galileo_E5b.h" #include "Galileo_E6.h" #include "configuration_interface.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif SignalGenerator::SignalGenerator(const ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index afbf36296..e4ead311b 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -169,10 +169,16 @@ target_link_libraries(signal_source_adapters algorithms_libs gnss_sdr_flags core_system_parameters - Glog::glog Volk::volk ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(signal_source_adapters PRIVATE Glog::glog) + target_compile_definitions(signal_source_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(signal_source_adapters PRIVATE absl::flags absl::log) +endif() + if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(signal_source_adapters PUBLIC -DGNURADIO_USES_STD_POINTERS=1 diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc index 488c80ead..225f67782 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -31,7 +31,6 @@ #include "gnss_sdr_flags.h" #include "gnss_sdr_string_literals.h" #include "uio_fpga.h" -#include #include #include // for std::max #include // for std::chrono @@ -44,6 +43,11 @@ #include // for write #include // fr std::vector +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc b/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc index 796126e03..b93dc9344 100644 --- a/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc @@ -21,10 +21,15 @@ #include "gnss_sdr_string_literals.h" #include "gnss_sdr_valve.h" #include -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; Ad936xCustomSignalSource::Ad936xCustomSignalSource(const ConfigurationInterface* configuration, diff --git a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc index 85299cc27..8a96c375d 100644 --- a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc @@ -18,9 +18,13 @@ #include "custom_udp_signal_source.h" #include "configuration_interface.h" #include "gnss_sdr_string_literals.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/fifo_signal_source.cc b/src/algorithms/signal_source/adapters/fifo_signal_source.cc index 7ffac8e5b..c4f0fd08b 100644 --- a/src/algorithms/signal_source/adapters/fifo_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fifo_signal_source.cc @@ -19,10 +19,14 @@ #include "configuration_interface.h" #include "fifo_reader.h" #include "gnss_sdr_string_literals.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/file_signal_source.cc b/src/algorithms/signal_source/adapters/file_signal_source.cc index d1267949e..c4fbd25a2 100644 --- a/src/algorithms/signal_source/adapters/file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/file_signal_source.cc @@ -18,7 +18,12 @@ #include "file_signal_source.h" #include "gnss_sdr_string_literals.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/file_source_base.cc b/src/algorithms/signal_source/adapters/file_source_base.cc index 6efa7cdbc..7b9efcbc2 100644 --- a/src/algorithms/signal_source/adapters/file_source_base.cc +++ b/src/algorithms/signal_source/adapters/file_source_base.cc @@ -29,12 +29,16 @@ #include "gnss_sdr_flags.h" #include "gnss_sdr_string_literals.h" #include "gnss_sdr_valve.h" -#include #include // for std::max #include // for ceil, floor #include // for std::cout, std:cerr #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif using namespace std::string_literals; @@ -93,7 +97,8 @@ FileSourceBase::FileSourceBase(ConfigurationInterface const* configuration, std: } } - // override value with commandline flag, if present +// override value with commandline flag, if present +#if USE_GLOG_AND_GFLAGS if (FLAGS_signal_source != "-") { filename_ = FLAGS_signal_source; @@ -102,6 +107,16 @@ FileSourceBase::FileSourceBase(ConfigurationInterface const* configuration, std: { filename_ = FLAGS_s; } +#else + if (absl::GetFlag(FLAGS_signal_source) != "-") + { + filename_ = absl::GetFlag(FLAGS_signal_source); + } + if (absl::GetFlag(FLAGS_s) != "-") + { + filename_ = absl::GetFlag(FLAGS_s); + } +#endif if (sampling_frequency_ == 0) { std::cerr << "Warning: parameter " << role_ << ".sampling_frequency is not set, this could lead to wrong results.\n" diff --git a/src/algorithms/signal_source/adapters/file_timestamp_signal_source.cc b/src/algorithms/signal_source/adapters/file_timestamp_signal_source.cc index 8a7c2958f..92788ee02 100644 --- a/src/algorithms/signal_source/adapters/file_timestamp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/file_timestamp_signal_source.cc @@ -18,9 +18,14 @@ #include "file_timestamp_signal_source.h" #include "gnss_sdr_flags.h" #include "gnss_sdr_string_literals.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; FileTimestampSignalSource::FileTimestampSignalSource(const ConfigurationInterface* configuration, @@ -41,11 +46,18 @@ FileTimestampSignalSource::FileTimestampSignalSource(const ConfigurationInterfac LOG(ERROR) << "This implementation only supports one output stream"; } - // override value with commandline flag, if present + // override value with commandline flag, if present +#if USE_GLOG_AND_GFLAGS if (FLAGS_timestamp_source != "-") { timestamp_file_ = FLAGS_timestamp_source; } +#else + if (absl::GetFlag(FLAGS_timestamp_source) != "-") + { + timestamp_file_ = absl::GetFlag(FLAGS_timestamp_source); + } +#endif } diff --git a/src/algorithms/signal_source/adapters/flexiband_signal_source.cc b/src/algorithms/signal_source/adapters/flexiband_signal_source.cc index 66683bf7f..1848b3da5 100644 --- a/src/algorithms/signal_source/adapters/flexiband_signal_source.cc +++ b/src/algorithms/signal_source/adapters/flexiband_signal_source.cc @@ -19,11 +19,16 @@ #include "flexiband_signal_source.h" #include "configuration_interface.h" #include "gnss_sdr_string_literals.h" -#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc index c68ce03aa..1bd15ce35 100644 --- a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc @@ -24,12 +24,17 @@ #include "gnss_sdr_flags.h" #include "gnss_sdr_string_literals.h" #include "gnss_sdr_valve.h" -#include #include // for max #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; Fmcomms2SignalSource::Fmcomms2SignalSource(const ConfigurationInterface *configuration, diff --git a/src/algorithms/signal_source/adapters/four_bit_cpx_file_signal_source.cc b/src/algorithms/signal_source/adapters/four_bit_cpx_file_signal_source.cc index 7052f0a4c..2de8b994b 100644 --- a/src/algorithms/signal_source/adapters/four_bit_cpx_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/four_bit_cpx_file_signal_source.cc @@ -19,7 +19,12 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include "gnss_sdr_string_literals.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif using namespace std::string_literals; @@ -58,11 +63,18 @@ FourBitCpxFileSignalSource::FourBitCpxFileSignalSource( LOG(ERROR) << "This implementation only supports one output stream"; } - // override value with commandline flag, if present + // override value with commandline flag, if present +#if USE_GLOG_AND_GFLAGS if (FLAGS_timestamp_source != "-") { timestamp_file_ = FLAGS_timestamp_source; } +#else + if (absl::GetFlag(FLAGS_timestamp_source) != "-") + { + timestamp_file_ = absl::GetFlag(FLAGS_timestamp_source); + } +#endif } diff --git a/src/algorithms/signal_source/adapters/gen_signal_source.cc b/src/algorithms/signal_source/adapters/gen_signal_source.cc index a87f77b12..388131815 100644 --- a/src/algorithms/signal_source/adapters/gen_signal_source.cc +++ b/src/algorithms/signal_source/adapters/gen_signal_source.cc @@ -18,12 +18,16 @@ #include "gen_signal_source.h" #include -#include #include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif // Constructor GenSignalSource::GenSignalSource(std::shared_ptr signal_generator, diff --git a/src/algorithms/signal_source/adapters/labsat_signal_source.cc b/src/algorithms/signal_source/adapters/labsat_signal_source.cc index 30760ce97..227e0a246 100644 --- a/src/algorithms/signal_source/adapters/labsat_signal_source.cc +++ b/src/algorithms/signal_source/adapters/labsat_signal_source.cc @@ -18,10 +18,15 @@ #include "configuration_interface.h" #include "gnss_sdr_string_literals.h" #include "labsat23_source.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; LabsatSignalSource::LabsatSignalSource(const ConfigurationInterface* configuration, diff --git a/src/algorithms/signal_source/adapters/limesdr_signal_source.cc b/src/algorithms/signal_source/adapters/limesdr_signal_source.cc index a8168bd82..28f3a3a68 100644 --- a/src/algorithms/signal_source/adapters/limesdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/limesdr_signal_source.cc @@ -20,10 +20,15 @@ #include "gnss_sdr_string_literals.h" #include "gnss_sdr_valve.h" #include -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; LimesdrSignalSource::LimesdrSignalSource(const ConfigurationInterface* configuration, diff --git a/src/algorithms/signal_source/adapters/multichannel_file_signal_source.cc b/src/algorithms/signal_source/adapters/multichannel_file_signal_source.cc index fd7973d90..84271beea 100644 --- a/src/algorithms/signal_source/adapters/multichannel_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/multichannel_file_signal_source.cc @@ -20,13 +20,18 @@ #include "gnss_sdr_flags.h" #include "gnss_sdr_string_literals.h" #include "gnss_sdr_valve.h" -#include #include #include #include #include // for std::cerr #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#include +#endif using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc b/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc index c86c11e76..1945f5f85 100644 --- a/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc @@ -18,7 +18,12 @@ #include "nsr_file_signal_source.h" #include "gnss_sdr_string_literals.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc index f7ab32057..b2f5a6c1f 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc @@ -21,10 +21,15 @@ #include "gnss_sdr_string_literals.h" #include "gnss_sdr_valve.h" #include -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc index fd69989f7..f4b782400 100644 --- a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc @@ -20,9 +20,13 @@ #include "configuration_interface.h" #include "gnss_sdr_string_literals.h" #include "gnss_sdr_valve.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/raw_array_signal_source.cc b/src/algorithms/signal_source/adapters/raw_array_signal_source.cc index b282aad24..18d563235 100644 --- a/src/algorithms/signal_source/adapters/raw_array_signal_source.cc +++ b/src/algorithms/signal_source/adapters/raw_array_signal_source.cc @@ -18,11 +18,15 @@ #include "concurrent_queue.h" #include "configuration_interface.h" #include "gnss_sdr_string_literals.h" -#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc index 86da2608d..2e5849eb5 100644 --- a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc @@ -22,11 +22,16 @@ #include "gnss_sdr_string_literals.h" #include "gnss_sdr_valve.h" #include -#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; RtlTcpSignalSource::RtlTcpSignalSource(const ConfigurationInterface* configuration, diff --git a/src/algorithms/signal_source/adapters/spir_file_signal_source.cc b/src/algorithms/signal_source/adapters/spir_file_signal_source.cc index 23d74e93b..63b89e54d 100644 --- a/src/algorithms/signal_source/adapters/spir_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/spir_file_signal_source.cc @@ -17,8 +17,13 @@ #include "spir_file_signal_source.h" #include "gnss_sdr_string_literals.h" -#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#include +#endif using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc index dead525be..a9b503c14 100644 --- a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc @@ -19,13 +19,19 @@ #include "spir_gss6450_file_signal_source.h" #include "configuration_interface.h" #include "gnss_sdr_string_literals.h" -#include #include #include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#include +#endif + using namespace std::string_literals; SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(const ConfigurationInterface* configuration, diff --git a/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc b/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc index 1350bded2..3c85bf02d 100644 --- a/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc @@ -17,7 +17,12 @@ #include "two_bit_cpx_file_signal_source.h" #include "gnss_sdr_string_literals.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc b/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc index 57e6e7768..81f55cf81 100644 --- a/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc @@ -19,9 +19,14 @@ #include "two_bit_packed_file_signal_source.h" #include "configuration_interface.h" #include "gnss_sdr_string_literals.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource( diff --git a/src/algorithms/signal_source/adapters/uhd_signal_source.cc b/src/algorithms/signal_source/adapters/uhd_signal_source.cc index efaae370b..7e9010aa5 100644 --- a/src/algorithms/signal_source/adapters/uhd_signal_source.cc +++ b/src/algorithms/signal_source/adapters/uhd_signal_source.cc @@ -21,13 +21,18 @@ #include "gnss_sdr_filesystem.h" #include "gnss_sdr_string_literals.h" #include "gnss_sdr_valve.h" -#include #include #include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/zmq_signal_source.cc b/src/algorithms/signal_source/adapters/zmq_signal_source.cc index bc8616ccd..924262617 100644 --- a/src/algorithms/signal_source/adapters/zmq_signal_source.cc +++ b/src/algorithms/signal_source/adapters/zmq_signal_source.cc @@ -17,7 +17,12 @@ #include "zmq_signal_source.h" #include "configuration_interface.h" #include "gnss_sdr_string_literals.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif using namespace std::string_literals; diff --git a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt index 0a89dffd6..24f067be6 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt @@ -75,10 +75,15 @@ target_link_libraries(signal_source_gr_blocks PRIVATE algorithms_libs core_libs - Gflags::gflags - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(signal_source_gr_blocks PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(signal_source_gr_blocks PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(signal_source_gr_blocks PRIVATE absl::flags absl::log) +endif() + target_include_directories(signal_source_gr_blocks PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/receiver diff --git a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc index 583fe6810..2617cc9fd 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc @@ -16,7 +16,12 @@ */ #include "fifo_reader.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif // initial construction; pass to private constructor FifoReader::sptr FifoReader::make(const std::string &file_name, const std::string &sample_type) diff --git a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc index 1b490b4f3..58f58d766 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc @@ -20,9 +20,13 @@ #include "rtl_tcp_commands.h" #include #include -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif namespace ip = boost::asio::ip; diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index a5d582116..2b0eb6a86 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -74,11 +74,16 @@ target_link_libraries(signal_source_libs Boost::headers Gnuradio::runtime PRIVATE - Gflags::gflags - Glog::glog core_libs ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(signal_source_libs PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(signal_source_libs PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(signal_source_libs PRIVATE absl::flags absl::log) +endif() + target_include_directories(signal_source_libs PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/receiver diff --git a/src/algorithms/signal_source/libs/ad9361_manager.cc b/src/algorithms/signal_source/libs/ad9361_manager.cc index 7e7e3fa74..913488287 100644 --- a/src/algorithms/signal_source/libs/ad9361_manager.cc +++ b/src/algorithms/signal_source/libs/ad9361_manager.cc @@ -16,7 +16,6 @@ * ----------------------------------------------------------------------------- */ #include "ad9361_manager.h" -#include #include #include #include // for ifstream @@ -25,6 +24,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + /* check return value of attr_write function */ void errchk(int v, const char *what) { diff --git a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc index ce25e7897..2869081f2 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc +++ b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc @@ -15,7 +15,6 @@ #include "ad936x_iio_custom.h" #include #include -#include #include #include #include @@ -24,6 +23,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + ad936x_iio_custom::ad936x_iio_custom(int debug_level_, int log_level_) { receive_samples = false; diff --git a/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc b/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc index 449579441..0b250d131 100644 --- a/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc +++ b/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc @@ -25,7 +25,6 @@ #include "fpga_buffer_monitor.h" #include "gnss_sdr_create_directory.h" #include "gnss_sdr_filesystem.h" -#include #include // for time, localtime #include // for open, O_RDWR, O_SYNC #include // for string, ofstream @@ -34,6 +33,12 @@ #include // for close #include // for move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + Fpga_buffer_monitor::Fpga_buffer_monitor(const std::string &device_name, uint32_t num_freq_bands, diff --git a/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.cc b/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.cc index 8cec947ef..f3352b715 100644 --- a/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.cc +++ b/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.cc @@ -21,12 +21,17 @@ #include "fpga_dynamic_bit_selection.h" #include "uio_fpga.h" -#include #include // for open, O_RDWR, O_SYNC #include // for cout #include // for mmap #include // for close +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + Fpga_dynamic_bit_selection::Fpga_dynamic_bit_selection(bool enable_rx1_band, bool enable_rx2_band) : d_map_base_freq_band_1(nullptr), d_map_base_freq_band_2(nullptr), diff --git a/src/algorithms/signal_source/libs/fpga_switch.cc b/src/algorithms/signal_source/libs/fpga_switch.cc index b56f63bf5..f2d51c2fb 100644 --- a/src/algorithms/signal_source/libs/fpga_switch.cc +++ b/src/algorithms/signal_source/libs/fpga_switch.cc @@ -21,12 +21,17 @@ */ #include "fpga_switch.h" -#include #include // for open, O_RDWR, O_SYNC #include // for cout #include // for mmap #include // for close +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + Fpga_Switch::Fpga_Switch(const std::string &device_name) { if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1) diff --git a/src/algorithms/signal_source/libs/gnss_sdr_valve.cc b/src/algorithms/signal_source/libs/gnss_sdr_valve.cc index 6054af6dd..a62917745 100644 --- a/src/algorithms/signal_source/libs/gnss_sdr_valve.cc +++ b/src/algorithms/signal_source/libs/gnss_sdr_valve.cc @@ -19,11 +19,16 @@ #include "gnss_sdr_valve.h" #include "command_event.h" -#include // for LOG #include // for io_signature #include // for min #include // for memcpy +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + Gnss_Sdr_Valve::Gnss_Sdr_Valve(size_t sizeof_stream_item, uint64_t nitems, Concurrent_Queue* queue, diff --git a/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt b/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt index 9c0ae28ee..a804a1a86 100644 --- a/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt @@ -59,11 +59,16 @@ target_link_libraries(telemetry_decoder_adapters telemetry_decoder_gr_blocks telemetry_decoder_libs PRIVATE - Gflags::gflags - Glog::glog Gnuradio::runtime ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(telemetry_decoder_adapters PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(telemetry_decoder_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(telemetry_decoder_adapters PRIVATE absl::flags absl::log) +endif() + target_include_directories(telemetry_decoder_adapters PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/telemetry_decoder/adapters/beidou_b1i_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/beidou_b1i_telemetry_decoder.cc index 433ad8643..8f7229954 100644 --- a/src/algorithms/telemetry_decoder/adapters/beidou_b1i_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/beidou_b1i_telemetry_decoder.cc @@ -18,7 +18,12 @@ #include "beidou_b1i_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif BeidouB1iTelemetryDecoder::BeidouB1iTelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/beidou_b3i_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/beidou_b3i_telemetry_decoder.cc index 6b35a9c07..502479613 100644 --- a/src/algorithms/telemetry_decoder/adapters/beidou_b3i_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/beidou_b3i_telemetry_decoder.cc @@ -17,7 +17,12 @@ #include "beidou_b3i_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif BeidouB3iTelemetryDecoder::BeidouB3iTelemetryDecoder( const ConfigurationInterface *configuration, diff --git a/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.cc index cadc48503..e6c302437 100644 --- a/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.cc @@ -19,7 +19,12 @@ #include "galileo_e1b_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GalileoE1BTelemetryDecoder::GalileoE1BTelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc index 73bf36b88..cf0c3828c 100644 --- a/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc @@ -22,7 +22,12 @@ #include "galileo_e5a_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GalileoE5aTelemetryDecoder::GalileoE5aTelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/galileo_e5b_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/galileo_e5b_telemetry_decoder.cc index 94181a94c..d6c66b20c 100644 --- a/src/algorithms/telemetry_decoder/adapters/galileo_e5b_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/galileo_e5b_telemetry_decoder.cc @@ -20,7 +20,12 @@ #include "galileo_e5b_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GalileoE5bTelemetryDecoder::GalileoE5bTelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/galileo_e6_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/galileo_e6_telemetry_decoder.cc index 4f4517ef7..5fd6342ea 100644 --- a/src/algorithms/telemetry_decoder/adapters/galileo_e6_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/galileo_e6_telemetry_decoder.cc @@ -19,7 +19,12 @@ #include "galileo_e6_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GalileoE6TelemetryDecoder::GalileoE6TelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.cc index 037f20454..c6de2b98f 100644 --- a/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.cc @@ -19,7 +19,12 @@ #include "glonass_l1_ca_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GlonassL1CaTelemetryDecoder::GlonassL1CaTelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.cc index cfa172edd..77dfb5528 100644 --- a/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.cc @@ -18,7 +18,12 @@ #include "glonass_l2_ca_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GlonassL2CaTelemetryDecoder::GlonassL2CaTelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc index 9ee5f3db1..7f9a243bd 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc @@ -18,7 +18,12 @@ #include "gps_l1_ca_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GpsL1CaTelemetryDecoder::GpsL1CaTelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.cc index f662627d7..6db0843bb 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.cc @@ -18,7 +18,12 @@ #include "gps_l2c_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GpsL2CTelemetryDecoder::GpsL2CTelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.cc index a302c479f..e5dadfa90 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.cc @@ -18,7 +18,12 @@ #include "gps_l5_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GpsL5TelemetryDecoder::GpsL5TelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc index 82b639f70..334e934ea 100644 --- a/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc @@ -18,8 +18,12 @@ #include "sbas_l1_telemetry_decoder.h" #include "configuration_interface.h" -#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif SbasL1TelemetryDecoder::SbasL1TelemetryDecoder( const ConfigurationInterface* configuration, diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt index c71184aa8..7c9ff7b83 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt @@ -58,11 +58,16 @@ target_link_libraries(telemetry_decoder_gr_blocks Gnuradio::runtime Boost::headers PRIVATE - Gflags::gflags - Glog::glog Gnuradio::pmt ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(telemetry_decoder_gr_blocks PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(telemetry_decoder_gr_blocks PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(telemetry_decoder_gr_blocks PRIVATE absl::flags absl::log) +endif() + if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(telemetry_decoder_gr_blocks PUBLIC -DGNURADIO_USES_STD_POINTERS=1 diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc index 0edbfee36..c7ecd7da4 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc @@ -26,7 +26,6 @@ #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 #include "gnss_synchro.h" #include "tlm_utils.h" -#include #include #include // for make_any #include // for mp @@ -38,6 +37,12 @@ #include // for shared_ptr, make_shared #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #define CRC_ERROR_LIMIT 8 diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc index a1fd40555..d27afa592 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc @@ -25,7 +25,6 @@ #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 #include "gnss_synchro.h" #include "tlm_utils.h" -#include #include #include // for make_any #include // for mp @@ -37,6 +36,12 @@ #include // for shared_ptr, make_shared #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #define CRC_ERROR_LIMIT 8 beidou_b3i_telemetry_decoder_gs_sptr diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc index 690715725..a2d6b40cf 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc @@ -34,7 +34,6 @@ #include "tlm_crc_stats.h" // for Tlm_CRC_Stats #include "tlm_utils.h" // for save_tlm_matfile, tlm_remove_file #include "viterbi_decoder.h" // for Viterbi_Decoder -#include // for LOG, DLOG #include // for gr::io_signature::make #include // for pmt::mp #include // for std::array @@ -49,6 +48,12 @@ #include // for typeid #include // for std::pair +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc index b2cc50cf8..b19c5eb02 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc @@ -22,7 +22,6 @@ #include "glonass_gnav_utc_model.h" #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 #include "tlm_utils.h" -#include #include #include // for make_any #include // for mp @@ -35,6 +34,12 @@ #include // for shared_ptr, make_shared #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #define CRC_ERROR_LIMIT 6 diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc index 473e5eb73..9de17d33c 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc @@ -22,7 +22,6 @@ #include "glonass_gnav_utc_model.h" #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 #include "tlm_utils.h" -#include #include #include // for make_any #include // for mp @@ -35,6 +34,12 @@ #include // for shared_ptr, make_shared #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #define CRC_ERROR_LIMIT 6 diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc index bd72d4cde..62bbf6bfa 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc @@ -24,7 +24,6 @@ #include "gps_iono.h" // for Gps_Iono #include "gps_utc_model.h" // for Gps_Utc_Model #include "tlm_utils.h" -#include #include #include // for make_any #include // for mp @@ -39,6 +38,12 @@ #include // for std::move #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #ifdef COMPILER_HAS_ROTL #include namespace my_rotl = std; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.cc index b745738da..ea4f15585 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.cc @@ -24,7 +24,6 @@ #include "gps_cnav_iono.h" // for Gps_CNAV_Iono #include "gps_cnav_utc_model.h" // for Gps_CNAV_Utc_Model #include "tlm_utils.h" -#include #include #include // for make_any #include // for mp @@ -37,6 +36,11 @@ #include // for shared_ptr, make_shared #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif gps_l2c_telemetry_decoder_gs_sptr gps_l2c_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc index d664551ea..f6d95d2a5 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc @@ -23,7 +23,6 @@ #include "gps_cnav_iono.h" #include "gps_cnav_utc_model.h" // for Gps_CNAV_Utc_Model #include "tlm_utils.h" -#include #include #include // for make_any #include // for mp @@ -35,6 +34,12 @@ #include // for std::cout #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + gps_l5_telemetry_decoder_gs_sptr gps_l5_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf) { diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.cc index 9a15fd2b6..303adbf2b 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.cc @@ -17,7 +17,6 @@ #include "sbas_l1_telemetry_decoder_gs.h" #include "gnss_synchro.h" #include "viterbi_decoder_sbas.h" -#include #include #include // for mp #include // for copy @@ -27,6 +26,12 @@ #include // for operator<<, setw #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + // logging levels #define EVENT 2 // logs important events which don't occur every block #define FLOW 3 // logs the function calls of block processing functions diff --git a/src/algorithms/telemetry_decoder/libs/CMakeLists.txt b/src/algorithms/telemetry_decoder/libs/CMakeLists.txt index befb48ddf..ed35d0111 100644 --- a/src/algorithms/telemetry_decoder/libs/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/libs/CMakeLists.txt @@ -47,11 +47,16 @@ target_link_libraries(telemetry_decoder_libs PRIVATE Volkgnsssdr::volkgnsssdr algorithms_libs - Gflags::gflags - Glog::glog Matio::matio ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(telemetry_decoder_libs PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(telemetry_decoder_libs PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(telemetry_decoder_libs PRIVATE absl::flags absl::log) +endif() + target_include_directories(telemetry_decoder_libs PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/telemetry_decoder/libs/tlm_crc_stats.cc b/src/algorithms/telemetry_decoder/libs/tlm_crc_stats.cc index 4d6b9d9e6..a5d69c96f 100644 --- a/src/algorithms/telemetry_decoder/libs/tlm_crc_stats.cc +++ b/src/algorithms/telemetry_decoder/libs/tlm_crc_stats.cc @@ -17,11 +17,15 @@ #include "tlm_crc_stats.h" #include "gnss_sdr_create_directory.h" #include "gnss_sdr_filesystem.h" -#include #include // for std::setw() #include // for cerr, cout #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif void Tlm_CRC_Stats::initialize(std::string dump_crc_stats_filename) { diff --git a/src/algorithms/telemetry_decoder/libs/viterbi_decoder_sbas.cc b/src/algorithms/telemetry_decoder/libs/viterbi_decoder_sbas.cc index 7972e708c..0eafce0f8 100644 --- a/src/algorithms/telemetry_decoder/libs/viterbi_decoder_sbas.cc +++ b/src/algorithms/telemetry_decoder/libs/viterbi_decoder_sbas.cc @@ -16,10 +16,15 @@ */ #include "viterbi_decoder_sbas.h" -#include #include // for fill_n #include // for operator<<, basic_ostream, char_traits +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + // logging #define EVENT 2 // logs important events which don't occur every block #define FLOW 3 // logs the function calls of block processing functions diff --git a/src/algorithms/tracking/adapters/CMakeLists.txt b/src/algorithms/tracking/adapters/CMakeLists.txt index f37824a3e..b72ae96df 100644 --- a/src/algorithms/tracking/adapters/CMakeLists.txt +++ b/src/algorithms/tracking/adapters/CMakeLists.txt @@ -100,9 +100,15 @@ target_link_libraries(tracking_adapters tracking_gr_blocks PRIVATE gnss_sdr_flags - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(tracking_adapters PRIVATE Glog::glog) + target_compile_definitions(tracking_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(tracking_adapters PRIVATE absl::flags absl::log) +endif() + target_include_directories(tracking_adapters PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc index 31ffb9fe8..748d81967 100644 --- a/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc @@ -26,10 +26,14 @@ #include "display.h" #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif BeidouB1iDllPllTracking::BeidouB1iDllPllTracking( const ConfigurationInterface* configuration, diff --git a/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc index 633b87689..8408e1861 100644 --- a/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc @@ -26,10 +26,15 @@ #include "display.h" #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + BeidouB3iDllPllTracking::BeidouB3iDllPllTracking( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc index 4483afa1b..16c021217 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc @@ -26,10 +26,15 @@ #include "display.h" #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc index b0571c13d..52c41c3d2 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc @@ -28,11 +28,16 @@ #include "galileo_e1_signal_replica.h" #include "gnss_sdr_flags.h" #include "uio_fpga.h" -#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc index 9236e0862..fc79e02ab 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc @@ -25,9 +25,13 @@ #include "Galileo_E1.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking( const ConfigurationInterface* configuration, @@ -47,15 +51,30 @@ GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking( int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); float pll_bw_hz = configuration->property(role_ + ".pll_bw_hz", static_cast(50.0)); +#if USE_GLOG_AND_GFLAGS if (FLAGS_pll_bw_hz != 0.0) { pll_bw_hz = static_cast(FLAGS_pll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_pll_bw_hz) != 0.0) + { + pll_bw_hz = static_cast(absl::GetFlag(FLAGS_pll_bw_hz)); + } +#endif float dll_bw_hz = configuration->property(role_ + ".dll_bw_hz", static_cast(2.0)); + +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) + { + dll_bw_hz = static_cast(absl::GetFlag(FLAGS_dll_bw_hz)); + } +#endif float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.15)); float very_early_late_space_chips = configuration->property(role_ + ".very_early_late_space_chips", static_cast(0.5)); size_t port_ch0 = configuration->property(role_ + ".port_ch0", 2060); diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc index f54f904e6..876ff34c7 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc @@ -26,10 +26,15 @@ #include "display.h" #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GalileoE5aDllPllTracking::GalileoE5aDllPllTracking( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc index e6dcca1ac..dd1c8ca85 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc @@ -23,11 +23,16 @@ #include "galileo_e5_signal_replica.h" #include "gnss_sdr_flags.h" #include "uio_fpga.h" -#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( const ConfigurationInterface *configuration, const std::string &role, diff --git a/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc index 61df5df98..6e7191958 100644 --- a/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc @@ -27,10 +27,15 @@ #include "display.h" #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GalileoE5bDllPllTracking::GalileoE5bDllPllTracking( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc index ca01034d4..1d1c81e09 100644 --- a/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc @@ -22,10 +22,15 @@ #include "display.h" #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GalileoE6DllPllTracking::GalileoE6DllPllTracking( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc index 460a6f2df..c31149afb 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc @@ -27,7 +27,12 @@ #include "GLONASS_L1_L2_CA.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( @@ -48,15 +53,30 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); float pll_bw_hz = configuration->property(role_ + ".pll_bw_hz", static_cast(50.0)); +#if USE_GLOG_AND_GFLAGS if (FLAGS_pll_bw_hz != 0.0) { pll_bw_hz = static_cast(FLAGS_pll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_pll_bw_hz) != 0.0) + { + pll_bw_hz = static_cast(absl::GetFlag(FLAGS_pll_bw_hz)); + } +#endif float dll_bw_hz = configuration->property(role_ + ".dll_bw_hz", static_cast(2.0)); + +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) + { + dll_bw_hz = static_cast(absl::GetFlag(FLAGS_dll_bw_hz)); + } +#endif float pll_bw_narrow_hz = configuration->property(role_ + ".pll_bw_narrow_hz", static_cast(20.0)); float dll_bw_narrow_hz = configuration->property(role_ + ".dll_bw_narrow_hz", static_cast(2.0)); int extend_correlation_ms = configuration->property(role_ + ".extend_correlation_ms", 1); diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc index 769c15dd0..6a8faf31b 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc @@ -26,7 +26,12 @@ #include "GLONASS_L1_L2_CA.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking( @@ -47,15 +52,30 @@ GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking( int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); float pll_bw_hz = configuration->property(role_ + ".pll_bw_hz", static_cast(50.0)); + +#if USE_GLOG_AND_GFLAGS if (FLAGS_pll_bw_hz != 0.0) { pll_bw_hz = static_cast(FLAGS_pll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_pll_bw_hz) != 0.0) + { + pll_bw_hz = static_cast(absl::GetFlag(FLAGS_pll_bw_hz)); + } +#endif float dll_bw_hz = configuration->property(role_ + ".dll_bw_hz", static_cast(2.0)); +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) + { + dll_bw_hz = static_cast(absl::GetFlag(FLAGS_dll_bw_hz)); + } +#endif float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc index 3da79c423..19350ce18 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc @@ -25,7 +25,12 @@ #include "GLONASS_L1_L2_CA.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( @@ -46,15 +51,30 @@ GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); float pll_bw_hz = configuration->property(role_ + ".pll_bw_hz", static_cast(50.0)); + +#if USE_GLOG_AND_GFLAGS if (FLAGS_pll_bw_hz != 0.0) { pll_bw_hz = static_cast(FLAGS_pll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_pll_bw_hz) != 0.0) + { + pll_bw_hz = static_cast(absl::GetFlag(FLAGS_pll_bw_hz)); + } +#endif float dll_bw_hz = configuration->property(role_ + ".dll_bw_hz", static_cast(2.0)); +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) + { + dll_bw_hz = static_cast(absl::GetFlag(FLAGS_dll_bw_hz)); + } +#endif float pll_bw_narrow_hz = configuration->property(role_ + ".pll_bw_narrow_hz", static_cast(20.0)); float dll_bw_narrow_hz = configuration->property(role_ + ".dll_bw_narrow_hz", static_cast(2.0)); int extend_correlation_ms = configuration->property(role_ + ".extend_correlation_ms", 1); diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc index 283f10ed1..f5b6f2325 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc @@ -24,7 +24,12 @@ #include "GLONASS_L1_L2_CA.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking( @@ -45,15 +50,29 @@ GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking( int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); float pll_bw_hz = configuration->property(role_ + ".pll_bw_hz", static_cast(50.0)); +#if USE_GLOG_AND_GFLAGS if (FLAGS_pll_bw_hz != 0.0) { pll_bw_hz = static_cast(FLAGS_pll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_pll_bw_hz) != 0.0) + { + pll_bw_hz = static_cast(absl::GetFlag(FLAGS_pll_bw_hz)); + } +#endif float dll_bw_hz = configuration->property(role_ + ".dll_bw_hz", static_cast(2.0)); +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) + { + dll_bw_hz = static_cast(absl::GetFlag(FLAGS_dll_bw_hz)); + } +#endif float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc index 00cccbe97..5d0f9973a 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc @@ -27,10 +27,15 @@ #include "display.h" #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc index c0db6265d..6d9981ed5 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc @@ -28,11 +28,16 @@ #include "gnss_sdr_flags.h" #include "gps_sdr_signal_replica.h" #include "uio_fpga.h" -#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_gpu.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_gpu.cc index 5477511d6..c52d546a9 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_gpu.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_gpu.cc @@ -25,7 +25,12 @@ #include "GPS_L1_CA.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GpsL1CaDllPllTrackingGPU::GpsL1CaDllPllTrackingGPU( @@ -49,9 +54,18 @@ GpsL1CaDllPllTrackingGPU::GpsL1CaDllPllTrackingGPU( fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); dump = configuration->property(role + ".dump", false); pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0); +#if USE_GLOG_AND_GFLAGS if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast(FLAGS_pll_bw_hz); +#else + if (absl::GetFlag(FLAGS_pll_bw_hz) != 0.0) pll_bw_hz = static_cast(absl::GetFlag(FLAGS_pll_bw_hz)); +#endif dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0); +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast(FLAGS_dll_bw_hz); +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) dll_bw_hz = static_cast(absl::GetFlag(FLAGS_dll_bw_hz)); +#endif + early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); const std::string default_dump_filename("./track_ch"); dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc index b5439d319..3b501dcbc 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc @@ -28,7 +28,12 @@ #include "GPS_L1_CA.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GpsL1CaGaussianTracking::GpsL1CaGaussianTracking( @@ -50,10 +55,17 @@ GpsL1CaGaussianTracking::GpsL1CaGaussianTracking( int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); float dll_bw_hz = configuration->property(role_ + ".dll_bw_hz", static_cast(2.0)); +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) + { + dll_bw_hz = static_cast(absl::GetFlag(FLAGS_dll_bw_hz)); + } +#endif float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.cc index d1fbae84d..ad4dd1647 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.cc @@ -27,10 +27,15 @@ #include "display.h" #include "gnss_sdr_flags.h" #include "kf_conf.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL1CaKfTracking::GpsL1CaKfTracking( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc index fa09c8dcb..887dbdbc5 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc @@ -24,9 +24,14 @@ #include "gps_l1_ca_tcp_connector_tracking.h" #include "GPS_L1_CA.h" #include "configuration_interface.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking( const ConfigurationInterface* configuration, diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc index 98692f544..c048686c9 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc @@ -26,10 +26,15 @@ #include "display.h" #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL2MDllPllTracking::GpsL2MDllPllTracking( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc index da652be87..0d0fa843a 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc @@ -30,13 +30,18 @@ #include "gnss_synchro.h" #include "gps_l2c_signal_replica.h" #include "uio_fpga.h" -#include #include #include #include #include // for round #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc index d77303820..fddc9d8c2 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc @@ -26,10 +26,15 @@ #include "display.h" #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL5DllPllTracking::GpsL5DllPllTracking( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc index 485afd7c3..2020ef042 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc @@ -30,11 +30,16 @@ #include "gnss_sdr_flags.h" #include "gps_l5_signal_replica.h" #include "uio_fpga.h" -#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( const ConfigurationInterface *configuration, const std::string &role, diff --git a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt index cad24584d..4f72b86d0 100644 --- a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt @@ -85,9 +85,15 @@ target_link_libraries(tracking_gr_blocks algorithms_libs Matio::matio gnss_sdr_flags - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(tracking_gr_blocks PRIVATE Glog::glog) + target_compile_definitions(tracking_gr_blocks PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(tracking_gr_blocks PRIVATE absl::flags absl::log) +endif() + if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(tracking_gr_blocks PUBLIC -DGNURADIO_USES_STD_POINTERS=1 diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc index 5ac5f6d62..4bba76fba 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc @@ -45,7 +45,6 @@ #include "gps_sdr_signal_replica.h" #include "lock_detectors.h" #include "tracking_discriminators.h" -#include #include // for io_signature #include // for scoped_lock #include // for Mat_VarCreate @@ -61,6 +60,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc index 0d450d469..ba556f46c 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc @@ -35,7 +35,6 @@ #include "gps_sdr_signal_replica.h" #include "lock_detectors.h" #include "tracking_discriminators.h" -#include #include // for io_signature #include // for scoped_lock #include // for Mat_VarCreate @@ -49,6 +48,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc index d40c99783..e4af28caf 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc @@ -32,7 +32,6 @@ #include "tcp_communication.h" #include "tcp_packet_data.h" #include "tracking_discriminators.h" -#include #include #include #include // for fill_n @@ -42,6 +41,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + galileo_e1_tcp_connector_tracking_cc_sptr galileo_e1_tcp_connector_make_tracking_cc( int64_t fs_in, @@ -111,7 +116,11 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc( d_cn0_estimation_counter(0), d_carrier_lock_test(1), d_CN0_SNV_dB_Hz(0), +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold(static_cast(FLAGS_carrier_lock_th)), +#else + d_carrier_lock_threshold(static_cast(absl::GetFlag(FLAGS_carrier_lock_th))), +#endif d_carrier_lock_fail_counter(0), d_enable_tracking(false), d_pull_in(false), @@ -126,8 +135,11 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc( // Telemetry message port input this->message_port_register_in(pmt::mp("telemetry_to_trk")); +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); - +#else + d_Prompt_buffer = volk_gnsssdr::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif // Initialization of local code replica // Get space for a vector with the sinboc(1,1) replica sampled 2x/chip d_ca_code = volk_gnsssdr::vector(2 * GALILEO_E1_B_CODE_LENGTH_CHIPS, gr_complex(0.0, 0.0)); @@ -365,10 +377,13 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri T_prn_samples = T_prn_seconds * static_cast(d_fs_in); K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_secs * static_cast(d_fs_in); d_current_prn_length_samples = round(K_blk_samples); // round to a discrete number of samples - // d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### +#if USE_GLOG_AND_GFLAGS if (d_cn0_estimation_counter < FLAGS_cn0_samples) +#else + if (d_cn0_estimation_counter < absl::GetFlag(FLAGS_cn0_samples)) +#endif { // fill buffer with prompt correlator output values d_Prompt_buffer[d_cn0_estimation_counter] = *d_Prompt; @@ -379,6 +394,8 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri d_cn0_estimation_counter = 0; // Code lock indicator + +#if USE_GLOG_AND_GFLAGS d_CN0_SNV_dB_Hz = cn0_m2m4_estimator(d_Prompt_buffer.data(), FLAGS_cn0_samples, GALILEO_E1_CODE_PERIOD_S); // Carrier lock indicator @@ -386,6 +403,14 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri // Loss of lock detection if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + d_CN0_SNV_dB_Hz = cn0_m2m4_estimator(d_Prompt_buffer.data(), absl::GetFlag(FLAGS_cn0_samples), GALILEO_E1_CODE_PERIOD_S); + + // Carrier lock indicator + d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), absl::GetFlag(FLAGS_cn0_samples)); + + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { d_carrier_lock_fail_counter++; } @@ -396,7 +421,11 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri d_carrier_lock_fail_counter--; } } +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc index 32e0a2e2f..5a1eed229 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -30,7 +30,6 @@ #include "gnss_sdr_flags.h" #include "lock_detectors.h" #include "tracking_discriminators.h" -#include #include #include #include @@ -46,6 +45,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include @@ -146,7 +151,11 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc d_cn0_estimation_counter(0), d_carrier_lock_test(1), d_CN0_SNV_dB_Hz(0), +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold(FLAGS_carrier_lock_th), +#else + d_carrier_lock_threshold(absl::GetFlag(FLAGS_carrier_lock_th)), +#endif d_carrier_lock_fail_counter(0), d_enable_extended_integration(false), d_preamble_synchronized(false), @@ -189,8 +198,12 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc d_local_code_shift_chips[2] = d_early_late_spc_chips; multicorrelator_cpu.init(2 * d_correlation_length_samples, d_n_correlator_taps); - +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); +#else + d_Prompt_buffer = volk_gnsssdr::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif + systemName["R"] = std::string("Glonass"); #if GNURADIO_GREATER_THAN_38 this->set_relative_rate(1, static_cast(d_vector_length)); @@ -747,8 +760,13 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at d_CN0_SNV_dB_Hz = cn0_m2m4_estimator(d_Prompt_buffer.data(), CN0_ESTIMATION_SAMPLES, GLONASS_L1_CA_CODE_PERIOD_S); // Carrier lock indicator d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), CN0_ESTIMATION_SAMPLES); - // Loss of lock detection + // Loss of lock detectionç + +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { d_carrier_lock_fail_counter++; } @@ -759,7 +777,11 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at d_carrier_lock_fail_counter--; } } +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc index 99108ee19..c67786201 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -30,7 +30,6 @@ #include "gnss_sdr_flags.h" #include "lock_detectors.h" #include "tracking_discriminators.h" -#include #include #include #include @@ -44,6 +43,13 @@ #include #include + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include @@ -144,7 +150,11 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc d_cn0_estimation_counter(0), d_carrier_lock_test(1), d_CN0_SNV_dB_Hz(0), +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold(FLAGS_carrier_lock_th), +#else + d_carrier_lock_threshold(absl::GetFlag(FLAGS_carrier_lock_th)), +#endif d_carrier_lock_fail_counter(0), d_enable_extended_integration(false), d_preamble_synchronized(false), @@ -185,9 +195,11 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc d_local_code_shift_chips[2] = d_early_late_spc_chips; multicorrelator_cpu_16sc.init(2 * d_correlation_length_samples, d_n_correlator_taps); - +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); - +#else + d_Prompt_buffer = volk_gnsssdr::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif systemName["R"] = std::string("Glonass"); #if GNURADIO_GREATER_THAN_38 @@ -750,7 +762,12 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at // Carrier lock indicator d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), CN0_ESTIMATION_SAMPLES); // Loss of lock detection + +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { d_carrier_lock_fail_counter++; } @@ -761,7 +778,12 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at d_carrier_lock_fail_counter--; } } + +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc index 61e9e9feb..3829539c9 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc @@ -30,7 +30,6 @@ #include "gnss_sdr_flags.h" #include "lock_detectors.h" #include "tracking_discriminators.h" -#include #include #include #include @@ -44,6 +43,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #define CN0_ESTIMATION_SAMPLES 10 glonass_l1_ca_dll_pll_tracking_cc_sptr glonass_l1_ca_dll_pll_make_tracking_cc( @@ -106,7 +111,11 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc( d_acq_sample_stamp(0), d_carrier_lock_test(1), d_CN0_SNV_dB_Hz(0), +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold(FLAGS_carrier_lock_th), +#else + d_carrier_lock_threshold(absl::GetFlag(FLAGS_carrier_lock_th)), +#endif d_carrier_lock_fail_counter(0), d_cn0_estimation_counter(0), d_enable_tracking(false), @@ -134,7 +143,11 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc( multicorrelator_cpu.init(2 * d_current_prn_length_samples, d_n_correlator_taps); +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); +#else + d_Prompt_buffer = volk_gnsssdr::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif systemName["R"] = std::string("Glonass"); #if GNURADIO_GREATER_THAN_38 @@ -594,7 +607,12 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut // Carrier lock indicator d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), CN0_ESTIMATION_SAMPLES); // Loss of lock detection + +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { d_carrier_lock_fail_counter++; } @@ -605,7 +623,11 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut d_carrier_lock_fail_counter--; } } +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc index 6274a0b26..5c433346e 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc @@ -28,7 +28,6 @@ #include "gnss_sdr_flags.h" #include "lock_detectors.h" #include "tracking_discriminators.h" -#include #include #include #include @@ -43,6 +42,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include @@ -143,7 +148,11 @@ glonass_l2_ca_dll_pll_c_aid_tracking_cc::glonass_l2_ca_dll_pll_c_aid_tracking_cc d_cn0_estimation_counter(0), d_carrier_lock_test(1), d_CN0_SNV_dB_Hz(0), +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold(FLAGS_carrier_lock_th), +#else + d_carrier_lock_threshold(absl::GetFlag(FLAGS_carrier_lock_th)), +#endif d_carrier_lock_fail_counter(0), d_enable_extended_integration(false), d_preamble_synchronized(false), @@ -185,8 +194,11 @@ glonass_l2_ca_dll_pll_c_aid_tracking_cc::glonass_l2_ca_dll_pll_c_aid_tracking_cc multicorrelator_cpu.init(2 * d_correlation_length_samples, d_n_correlator_taps); +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); - +#else + d_Prompt_buffer = volk_gnsssdr::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif systemName["R"] = std::string("Glonass"); #if GNURADIO_GREATER_THAN_38 @@ -747,7 +759,12 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at // Carrier lock indicator d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), CN0_ESTIMATION_SAMPLES); // Loss of lock detection + +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { d_carrier_lock_fail_counter++; } @@ -758,7 +775,12 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at d_carrier_lock_fail_counter--; } } + +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc index f88f217c4..6c8b65c20 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc @@ -28,7 +28,6 @@ #include "gnss_sdr_flags.h" #include "lock_detectors.h" #include "tracking_discriminators.h" -#include #include #include #include @@ -42,6 +41,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include @@ -141,7 +146,11 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc d_acq_sample_stamp(0), d_carrier_lock_test(1), d_CN0_SNV_dB_Hz(0), +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold(FLAGS_carrier_lock_th), +#else + d_carrier_lock_threshold(absl::GetFlag(FLAGS_carrier_lock_th)), +#endif d_carrier_lock_fail_counter(0), d_cn0_estimation_counter(0), d_enable_extended_integration(false), @@ -183,7 +192,11 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc multicorrelator_cpu_16sc.init(2 * d_correlation_length_samples, d_n_correlator_taps); +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); +#else + d_Prompt_buffer = volk_gnsssdr::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif systemName["R"] = std::string("Glonass"); @@ -747,7 +760,12 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at // Carrier lock indicator d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), CN0_ESTIMATION_SAMPLES); // Loss of lock detection + +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { d_carrier_lock_fail_counter++; } @@ -758,7 +776,11 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at d_carrier_lock_fail_counter--; } } +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc index 56b892474..9950a77e8 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc @@ -30,7 +30,6 @@ #include "gnss_sdr_flags.h" #include "lock_detectors.h" #include "tracking_discriminators.h" -#include #include #include #include @@ -44,6 +43,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #define CN0_ESTIMATION_SAMPLES 10 @@ -107,7 +112,11 @@ Glonass_L2_Ca_Dll_Pll_Tracking_cc::Glonass_L2_Ca_Dll_Pll_Tracking_cc( d_acq_sample_stamp(0), d_carrier_lock_test(1), d_CN0_SNV_dB_Hz(0), +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold(FLAGS_carrier_lock_th), +#else + d_carrier_lock_threshold(absl::GetFlag(FLAGS_carrier_lock_th)), +#endif d_cn0_estimation_counter(0), d_carrier_lock_fail_counter(0), d_enable_tracking(false), @@ -135,7 +144,11 @@ Glonass_L2_Ca_Dll_Pll_Tracking_cc::Glonass_L2_Ca_Dll_Pll_Tracking_cc( multicorrelator_cpu.init(2 * d_current_prn_length_samples, d_n_correlator_taps); +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); +#else + d_Prompt_buffer = volk_gnsssdr::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif systemName["R"] = std::string("Glonass"); @@ -596,7 +609,12 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut // Carrier lock indicator d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), CN0_ESTIMATION_SAMPLES); // Loss of lock detection + +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { d_carrier_lock_fail_counter++; } @@ -607,7 +625,11 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut d_carrier_lock_fail_counter--; } } +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc index 9898ad178..2930c5278 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc @@ -22,7 +22,6 @@ #include "lock_detectors.h" #include "tracking_discriminators.h" #include -#include #include #include #include @@ -32,6 +31,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + gps_l1_ca_dll_pll_tracking_gpu_cc_sptr gps_l1_ca_dll_pll_make_tracking_gpu_cc( @@ -127,12 +132,21 @@ Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc( // CN0 estimation and lock detector buffers d_cn0_estimation_counter = 0; +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = std::vector(FLAGS_cn0_samples); +#else + d_Prompt_buffer = std::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif + + d_carrier_lock_test = 1; d_CN0_SNV_dB_Hz = 0; d_carrier_lock_fail_counter = 0; +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold = FLAGS_carrier_lock_th; - +#else + d_carrier_lock_threshold = absl::GetFlag(FLAGS_carrier_lock_th); +#endif systemName["G"] = std::string("GPS"); systemName["S"] = std::string("SBAS"); @@ -421,7 +435,12 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work(int noutput_items __attribut d_rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_chips / static_cast(d_fs_in)); // ####### CN0 ESTIMATION AND LOCK DETECTORS ####################################### + +#if USE_GLOG_AND_GFLAGS if (d_cn0_estimation_counter < FLAGS_cn0_samples) +#else + if (d_cn0_estimation_counter < absl::getFlag(FLAGS_cn0_samples)) +#endif { // fill buffer with prompt correlator output values d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; // prompt @@ -431,11 +450,18 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work(int noutput_items __attribut { d_cn0_estimation_counter = 0; // Code lock indicator + +#if USE_GLOG_AND_GFLAGS d_CN0_SNV_dB_Hz = cn0_m2m4_estimator(d_Prompt_buffer.data(), FLAGS_cn0_samples, GPS_L1_CA_CODE_PERIOD_S); // Carrier lock indicator d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), FLAGS_cn0_samples); // Loss of lock detection if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + d_CN0_SNV_dB_Hz = cn0_m2m4_estimator(d_Prompt_buffer.data(), absl::GetFlag(FLAGS_cn0_samples), GPS_L1_CA_CODE_PERIOD_S); + d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), absl::GetFlag(FLAGS_cn0_samples)); + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { d_carrier_lock_fail_counter++; } @@ -443,7 +469,11 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work(int noutput_items __attribut { if (d_carrier_lock_fail_counter > 0) d_carrier_lock_fail_counter--; } +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc index 0b8c3bb84..0d90a799f 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc @@ -30,7 +30,6 @@ #include "gps_sdr_signal_replica.h" #include "lock_detectors.h" #include "tracking_discriminators.h" -#include #include #include #include @@ -44,6 +43,11 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif gps_l1_ca_gaussian_tracking_cc_sptr gps_l1_ca_gaussian_make_tracking_cc( uint32_t order, @@ -126,7 +130,11 @@ Gps_L1_Ca_Gaussian_Tracking_cc::Gps_L1_Ca_Gaussian_Tracking_cc( d_cn0_estimation_counter(0), d_carrier_lock_test(1), d_CN0_SNV_dB_Hz(0), +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold(FLAGS_carrier_lock_th), +#else + d_carrier_lock_threshold(absl::GetFlag(FLAGS_carrier_lock_th)), +#endif d_carrier_lock_fail_counter(0), d_enable_tracking(false), d_pull_in(false), @@ -154,8 +162,11 @@ Gps_L1_Ca_Gaussian_Tracking_cc::Gps_L1_Ca_Gaussian_Tracking_cc( multicorrelator_cpu.init(2 * d_current_prn_length_samples, d_n_correlator_taps); +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); - +#else + d_Prompt_buffer = volk_gnsssdr::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif systemName["G"] = std::string("GPS"); systemName["S"] = std::string("SBAS"); @@ -746,7 +757,12 @@ int Gps_L1_Ca_Gaussian_Tracking_cc::general_work(int noutput_items __attribute__ d_rem_code_phase_chips = d_code_freq_chips * (d_rem_code_phase_samples / static_cast(d_fs_in)); // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### + +#if USE_GLOG_AND_GFLAGS if (d_cn0_estimation_counter < FLAGS_cn0_samples) +#else + if (d_cn0_estimation_counter < absl::GetFlag(FLAGS_cn0_samples)) +#endif { // fill buffer with prompt correlator output values d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; // prompt @@ -755,12 +771,21 @@ int Gps_L1_Ca_Gaussian_Tracking_cc::general_work(int noutput_items __attribute__ else { d_cn0_estimation_counter = 0; +#if USE_GLOG_AND_GFLAGS // Code lock indicator d_CN0_SNV_dB_Hz = cn0_m2m4_estimator(d_Prompt_buffer.data(), FLAGS_cn0_samples, GPS_L1_CA_CODE_PERIOD_S); // Carrier lock indicator d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), FLAGS_cn0_samples); // Loss of lock detection if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + // Code lock indicator + d_CN0_SNV_dB_Hz = cn0_m2m4_estimator(d_Prompt_buffer.data(), absl::GetFlag(FLAGS_cn0_samples), GPS_L1_CA_CODE_PERIOD_S); + // Carrier lock indicator + d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), absl::GetFlag(FLAGS_cn0_samples)); + // Loss of lock detection + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { // if (d_channel == 1) // std::cout << "Carrier Lock Test Fail in channel " << d_channel << ": " << d_carrier_lock_test << " < " << d_carrier_lock_threshold << "," << nfail++ << '\n'; @@ -774,7 +799,11 @@ int Gps_L1_Ca_Gaussian_Tracking_cc::general_work(int noutput_items __attribute__ d_carrier_lock_fail_counter--; } } +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc index fb94fc2de..7862a2256 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc @@ -30,7 +30,6 @@ #include "tcp_communication.h" #include "tcp_packet_data.h" #include "tracking_discriminators.h" -#include #include #include #include @@ -39,6 +38,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + gps_l1_ca_tcp_connector_tracking_cc_sptr gps_l1_ca_tcp_connector_make_tracking_cc( int64_t fs_in, @@ -102,7 +107,11 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc( d_acq_carrier_doppler_hz(0.0), d_carrier_lock_test(1), d_CN0_SNV_dB_Hz(0), +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold(static_cast(FLAGS_carrier_lock_th)), +#else + d_carrier_lock_threshold(static_cast(absl::GetFlag(FLAGS_carrier_lock_th))), +#endif d_control_id(0), d_enable_tracking(false), d_pull_in(false), @@ -130,8 +139,11 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc( multicorrelator_cpu.init(2 * d_correlation_length_samples, d_n_correlator_taps); +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); - +#else + d_Prompt_buffer = volk_gnsssdr::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif systemName["G"] = std::string("GPS"); systemName["R"] = std::string("GLONASS"); systemName["S"] = std::string("SBAS"); @@ -400,7 +412,12 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib * \todo Improve the lock detection algorithm! */ // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### + +#if USE_GLOG_AND_GFLAGS if (d_cn0_estimation_counter < FLAGS_cn0_samples) +#else + if (d_cn0_estimation_counter < absl::GetFlag(FLAGS_cn0_samples)) +#endif { // fill buffer with prompt correlator output values d_Prompt_buffer[d_cn0_estimation_counter] = *d_Prompt; @@ -409,11 +426,19 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib else { d_cn0_estimation_counter = 0; +#if USE_GLOG_AND_GFLAGS d_CN0_SNV_dB_Hz = cn0_m2m4_estimator(d_Prompt_buffer.data(), FLAGS_cn0_samples, GPS_L1_CA_CODE_PERIOD_S); d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), FLAGS_cn0_samples); // ###### TRACKING UNLOCK NOTIFICATION ##### if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + d_CN0_SNV_dB_Hz = cn0_m2m4_estimator(d_Prompt_buffer.data(), absl::GetFlag(FLAGS_cn0_samples), GPS_L1_CA_CODE_PERIOD_S); + d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), absl::GetFlag(FLAGS_cn0_samples)); + + // ###### TRACKING UNLOCK NOTIFICATION ##### + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { d_carrier_lock_fail_counter++; } @@ -424,7 +449,11 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib d_carrier_lock_fail_counter--; } } +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc index dd50b4547..838dbab85 100644 --- a/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc @@ -43,7 +43,6 @@ #include "lock_detectors.h" #include "tracking_discriminators.h" #include "trackingcmd.h" -#include #include // for io_signature #include // for scoped_lock #include // for Mat_VarCreate @@ -58,6 +57,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include diff --git a/src/algorithms/tracking/libs/CMakeLists.txt b/src/algorithms/tracking/libs/CMakeLists.txt index 5b9520c0a..d207a7cc9 100644 --- a/src/algorithms/tracking/libs/CMakeLists.txt +++ b/src/algorithms/tracking/libs/CMakeLists.txt @@ -88,10 +88,16 @@ target_link_libraries(tracking_libs algorithms_libs PRIVATE gnss_sdr_flags - Glog::glog Gnuradio::runtime ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(tracking_libs PRIVATE Glog::glog) + target_compile_definitions(tracking_libs PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(tracking_libs PRIVATE absl::flags absl::log) +endif() + if(ENABLE_CUDA) if(CMAKE_VERSION VERSION_GREATER 3.11) target_include_directories(tracking_libs diff --git a/src/algorithms/tracking/libs/dll_pll_conf.cc b/src/algorithms/tracking/libs/dll_pll_conf.cc index 0ffa5a395..c41229d7e 100644 --- a/src/algorithms/tracking/libs/dll_pll_conf.cc +++ b/src/algorithms/tracking/libs/dll_pll_conf.cc @@ -18,14 +18,26 @@ #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" #include "item_type_helpers.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif - +#if USE_GLOG_AND_GFLAGS Dll_Pll_Conf::Dll_Pll_Conf() : carrier_lock_th(FLAGS_carrier_lock_th), cn0_samples(FLAGS_cn0_samples), cn0_min(FLAGS_cn0_min), max_code_lock_fail(FLAGS_max_lock_fail), max_carrier_lock_fail(FLAGS_max_carrier_lock_fail) +#else +Dll_Pll_Conf::Dll_Pll_Conf() : carrier_lock_th(absl::GetFlag(FLAGS_carrier_lock_th)), + cn0_samples(absl::GetFlag(FLAGS_cn0_samples)), + cn0_min(absl::GetFlag(FLAGS_cn0_min)), + max_code_lock_fail(absl::GetFlag(FLAGS_max_lock_fail)), + max_carrier_lock_fail(absl::GetFlag(FLAGS_max_carrier_lock_fail)) +#endif { signal[0] = '1'; signal[1] = 'C'; @@ -50,18 +62,31 @@ void Dll_Pll_Conf::SetFromConfiguration(const ConfigurationInterface *configurat dump_filename = configuration->property(role + ".dump_filename", dump_filename); dump_mat = configuration->property(role + ".dump_mat", dump_mat); pll_bw_hz = configuration->property(role + ".pll_bw_hz", pll_bw_hz); +#if USE_GLOG_AND_GFLAGS if (FLAGS_pll_bw_hz != 0.0) { pll_bw_hz = static_cast(FLAGS_pll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_pll_bw_hz) != 0.0) + { + pll_bw_hz = static_cast(absl::GetFlag(FLAGS_pll_bw_hz)); + } +#endif pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", pll_bw_narrow_hz); dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", dll_bw_narrow_hz); dll_bw_hz = configuration->property(role + ".dll_bw_hz", dll_bw_hz); +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } - +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) + { + dll_bw_hz = static_cast(absl::GetFlag(FLAGS_dll_bw_hz)); + } +#endif dll_filter_order = configuration->property(role + ".dll_filter_order", dll_filter_order); pll_filter_order = configuration->property(role + ".pll_filter_order", pll_filter_order); if (dll_filter_order < 1) diff --git a/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc b/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc index f2c3ea73a..d784a204b 100644 --- a/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc +++ b/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc @@ -19,14 +19,26 @@ #include "dll_pll_conf_fpga.h" #include "gnss_sdr_flags.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif - +#if USE_GLOG_AND_GFLAGS Dll_Pll_Conf_Fpga::Dll_Pll_Conf_Fpga() : carrier_lock_th(FLAGS_carrier_lock_th), cn0_samples(FLAGS_cn0_samples), cn0_min(FLAGS_cn0_min), max_code_lock_fail(FLAGS_max_lock_fail), max_carrier_lock_fail(FLAGS_max_carrier_lock_fail) +#else +Dll_Pll_Conf_Fpga::Dll_Pll_Conf_Fpga() : carrier_lock_th(absl::GetFlag(FLAGS_carrier_lock_th)), + cn0_samples(absl::GetFlag(FLAGS_cn0_samples)), + cn0_min(absl::GetFlag(FLAGS_cn0_min)), + max_code_lock_fail(absl::GetFlag(FLAGS_max_lock_fail)), + max_carrier_lock_fail(absl::GetFlag(FLAGS_max_carrier_lock_fail)) +#endif { signal[0] = '1'; signal[1] = 'C'; @@ -88,15 +100,29 @@ void Dll_Pll_Conf_Fpga::SetFromConfiguration(const ConfigurationInterface *confi pll_pull_in_bw_hz = 50.0; dll_pull_in_bw_hz = 3.0; pll_bw_hz = configuration->property(role + ".pll_bw_hz", pll_bw_hz); +#if USE_GLOG_AND_GFLAGS if (FLAGS_pll_bw_hz != 0.0) { pll_bw_hz = static_cast(FLAGS_pll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_pll_bw_hz) != 0.0) + { + pll_bw_hz = static_cast(absl::GetFlag(FLAGS_pll_bw_hz)); + } +#endif dll_bw_hz = configuration->property(role + ".dll_bw_hz", dll_bw_hz); +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) + { + dll_bw_hz = static_cast(absl::GetFlag(FLAGS_dll_bw_hz)); + } +#endif pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", pll_bw_narrow_hz); dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", dll_bw_narrow_hz); early_late_space_chips = configuration->property(role + ".early_late_space_chips", early_late_space_chips); diff --git a/src/algorithms/tracking/libs/fpga_multicorrelator.cc b/src/algorithms/tracking/libs/fpga_multicorrelator.cc index 99f5f778c..3b2ed122d 100644 --- a/src/algorithms/tracking/libs/fpga_multicorrelator.cc +++ b/src/algorithms/tracking/libs/fpga_multicorrelator.cc @@ -21,7 +21,6 @@ */ #include "fpga_multicorrelator.h" -#include #include #include #include // for O_RDWR, O_RSYNC @@ -29,6 +28,12 @@ #include // for PROT_READ, PROT_WRITE, MAP_SHARED #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #ifndef TEMP_FAILURE_RETRY #define TEMP_FAILURE_RETRY(exp) \ ({ \ diff --git a/src/algorithms/tracking/libs/kf_conf.cc b/src/algorithms/tracking/libs/kf_conf.cc index 80b049c38..db4818261 100644 --- a/src/algorithms/tracking/libs/kf_conf.cc +++ b/src/algorithms/tracking/libs/kf_conf.cc @@ -21,13 +21,21 @@ #include "kf_conf.h" #include "gnss_sdr_flags.h" #include "item_type_helpers.h" -#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif Kf_Conf::Kf_Conf() : item_type("gr_complex"), dump_filename("./Kf_dump.dat"), fs_in(2000000.0), +#if USE_GLOG_AND_GFLAGS carrier_lock_th(FLAGS_carrier_lock_th), +#else + carrier_lock_th(absl::GetFlag(FLAGS_carrier_lock_th)), +#endif code_disc_sd_chips(0.2), carrier_disc_sd_rads(0.3), code_phase_sd_chips(0.15), @@ -52,12 +60,22 @@ Kf_Conf::Kf_Conf() : item_type("gr_complex"), vector_length(0U), smoother_length(10), extend_correlation_symbols(1), +#if USE_GLOG_AND_GFLAGS cn0_samples(FLAGS_cn0_samples), +#else + cn0_samples(absl::GetFlag(FLAGS_cn0_samples)), +#endif cn0_smoother_samples(200), carrier_lock_test_smoother_samples(25), +#if USE_GLOG_AND_GFLAGS cn0_min(FLAGS_cn0_min), max_code_lock_fail(FLAGS_max_lock_fail), max_carrier_lock_fail(FLAGS_max_carrier_lock_fail), +#else + cn0_min(absl::GetFlag(FLAGS_cn0_min)), + max_code_lock_fail(absl::GetFlag(FLAGS_max_lock_fail)), + max_carrier_lock_fail(absl::GetFlag(FLAGS_max_carrier_lock_fail)), +#endif system('G'), track_pilot(true), enable_doppler_correction(false), diff --git a/src/algorithms/tracking/libs/tracking_loop_filter.cc b/src/algorithms/tracking/libs/tracking_loop_filter.cc index a722f6ffa..8fd66a946 100644 --- a/src/algorithms/tracking/libs/tracking_loop_filter.cc +++ b/src/algorithms/tracking/libs/tracking_loop_filter.cc @@ -19,10 +19,15 @@ #include "tracking_loop_filter.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + const int MAX_LOOP_ORDER = 3; const int MAX_LOOP_HISTORY_LENGTH = 4; diff --git a/src/core/interfaces/signal_source_interface.h b/src/core/interfaces/signal_source_interface.h index df4a7baf4..759169c90 100644 --- a/src/core/interfaces/signal_source_interface.h +++ b/src/core/interfaces/signal_source_interface.h @@ -27,7 +27,12 @@ #define GNSS_SDR_SIGNAL_SOURCE_INTERFACE_H #include "gnss_block_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif /** \addtogroup Core * \{ */ diff --git a/src/core/libs/CMakeLists.txt b/src/core/libs/CMakeLists.txt index 994501ecf..7b4f4f703 100644 --- a/src/core/libs/CMakeLists.txt +++ b/src/core/libs/CMakeLists.txt @@ -95,11 +95,16 @@ target_link_libraries(core_libs PRIVATE algorithms_libs Boost::serialization - Gflags::gflags - Glog::glog Pugixml::pugixml ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(core_libs PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(core_libs PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(core_libs PRIVATE absl::flags absl::log) +endif() + if(USE_GENERIC_LAMBDAS AND NOT GNURADIO_USES_STD_POINTERS) target_link_libraries(core_libs PUBLIC Boost::headers) else() diff --git a/src/core/libs/channel_status_msg_receiver.cc b/src/core/libs/channel_status_msg_receiver.cc index 4b11abd7e..c96bb51a8 100644 --- a/src/core/libs/channel_status_msg_receiver.cc +++ b/src/core/libs/channel_status_msg_receiver.cc @@ -17,7 +17,6 @@ #include "channel_status_msg_receiver.h" -#include #include #include #include @@ -25,6 +24,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include diff --git a/src/core/libs/galileo_e6_has_msg_receiver.cc b/src/core/libs/galileo_e6_has_msg_receiver.cc index 22e1cd524..db0dc3fd7 100644 --- a/src/core/libs/galileo_e6_has_msg_receiver.cc +++ b/src/core/libs/galileo_e6_has_msg_receiver.cc @@ -23,7 +23,6 @@ #include "galileo_has_page.h" // for Galileo_HAS_page #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 #include "reed_solomon.h" // for ReedSolomon -#include // for DLOG #include // for gr::io_signature::make #include // for std::find, std::count #include // for std::remainder @@ -34,6 +33,12 @@ #include // for std::out_of_range #include // for typeid +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include diff --git a/src/core/libs/galileo_tow_map.cc b/src/core/libs/galileo_tow_map.cc index 6b4da0fb5..831dff044 100644 --- a/src/core/libs/galileo_tow_map.cc +++ b/src/core/libs/galileo_tow_map.cc @@ -16,10 +16,15 @@ #include "galileo_tow_map.h" -#include // for LOG -#include // for std::numeric_limits -#include // for std::shared -#include // for typeid +#include // for std::numeric_limits +#include // for std::shared +#include // for typeid + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif #if HAS_GENERIC_LAMBDA #else diff --git a/src/core/libs/gnss_sdr_fpga_sample_counter.cc b/src/core/libs/gnss_sdr_fpga_sample_counter.cc index d67ea3b37..5ba9b0f0b 100644 --- a/src/core/libs/gnss_sdr_fpga_sample_counter.cc +++ b/src/core/libs/gnss_sdr_fpga_sample_counter.cc @@ -19,7 +19,6 @@ #include "gnss_sdr_fpga_sample_counter.h" #include "gnss_synchro.h" #include "uio_fpga.h" -#include #include #include // for from_double #include // for mp @@ -29,6 +28,11 @@ #include // libraries used by the GIPO #include // for write, close, read, ssize_t +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif #ifndef TEMP_FAILURE_RETRY #define TEMP_FAILURE_RETRY(exp) \ diff --git a/src/core/libs/gnss_sdr_supl_client.cc b/src/core/libs/gnss_sdr_supl_client.cc index 6e4ec6d1d..86ec16658 100644 --- a/src/core/libs/gnss_sdr_supl_client.cc +++ b/src/core/libs/gnss_sdr_supl_client.cc @@ -23,7 +23,6 @@ #include #include #include -#include #include #include // for pow #include // for exception @@ -31,6 +30,12 @@ #include // for pair #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + Gnss_Sdr_Supl_Client::Gnss_Sdr_Supl_Client() : server_port(0), request(0), mcc(0), mns(0), lac(0), ci(0) { diff --git a/src/core/libs/nav_message_monitor.cc b/src/core/libs/nav_message_monitor.cc index 105234b81..954f760fd 100644 --- a/src/core/libs/nav_message_monitor.cc +++ b/src/core/libs/nav_message_monitor.cc @@ -17,11 +17,16 @@ #include "nav_message_monitor.h" #include "gnss_sdr_make_unique.h" -#include #include #include // size_t #include // typeid +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index 418ee72ab..0dfc09a84 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -172,12 +172,18 @@ target_link_libraries(core_receiver telemetry_decoder_adapters obs_adapters pvt_adapters + gnss_sdr_flags Boost::headers - Gflags::gflags - Glog::glog Armadillo::armadillo ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(core_receiver PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(core_receiver PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(core_receiver PRIVATE absl::flags absl::log) +endif() + if(ENABLE_ARMA_NO_DEBUG) target_compile_definitions(core_receiver PRIVATE -DARMA_NO_BOUND_CHECKING=1 diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index a6791fd52..52b0b344d 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -50,7 +50,6 @@ #include "rtklib_rtkcmn.h" // for utc2gpst #include // for interaction with geofunctions #include // for bad_lexical_cast -#include // for LOG #include // for make_any #include // for find, min #include // for milliseconds @@ -66,6 +65,12 @@ #include // for IPC_CREAT #include // for msgctl, msgget +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #ifdef ENABLE_FPGA #include // for steady_clock #endif @@ -89,7 +94,7 @@ ControlThread::ControlThread() signal(SIGINT, ControlThread::handle_signal); signal(SIGTERM, ControlThread::handle_signal); signal(SIGHUP, ControlThread::handle_signal); - +#if USE_GLOG_AND_GFLAGS if (FLAGS_c == "-") { configuration_ = std::make_shared(FLAGS_config_file); @@ -98,6 +103,16 @@ ControlThread::ControlThread() { configuration_ = std::make_shared(FLAGS_c); } +#else + if (absl::GetFlag(FLAGS_c) == "-") + { + configuration_ = std::make_shared(absl::GetFlag(FLAGS_config_file)); + } + else + { + configuration_ = std::make_shared(absl::GetFlag(FLAGS_c)); + } +#endif // Basic configuration checks auto aux = std::dynamic_pointer_cast(configuration_); conf_file_has_section_ = aux->has_section(); @@ -405,8 +420,12 @@ int ControlThread::run() // launch GNSS assistance process AFTER the flowgraph is running because the GNU Radio asynchronous queues must be already running to transport msgs assist_GNSS(); - // start the keyboard_listener thread +// start the keyboard_listener thread +#if USE_GLOG_AND_GFLAGS if (FLAGS_keyboard) +#else + if (absl::GetFlag(FLAGS_keyboard)) +#endif { keyboard_thread_ = std::thread(&ControlThread::keyboard_listener, this); } @@ -445,7 +464,11 @@ int ControlThread::run() #endif // Terminate keyboard thread +#if USE_GLOG_AND_GFLAGS if (FLAGS_keyboard && keyboard_thread_.joinable()) +#else + if (absl::GetFlag(FLAGS_keyboard) && keyboard_thread_.joinable()) +#endif { pthread_t id = keyboard_thread_.native_handle(); keyboard_thread_.detach(); diff --git a/src/core/receiver/file_configuration.cc b/src/core/receiver/file_configuration.cc index 5e8fff282..4bee6ae75 100644 --- a/src/core/receiver/file_configuration.cc +++ b/src/core/receiver/file_configuration.cc @@ -21,10 +21,14 @@ #include "file_configuration.h" #include "gnss_sdr_make_unique.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif FileConfiguration::FileConfiguration(std::string filename) : filename_(std::move(filename)) diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 5742bca83..1a48e0a7f 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -113,11 +113,16 @@ #include "tracking_interface.h" #include "two_bit_cpx_file_signal_source.h" #include "two_bit_packed_file_signal_source.h" -#include #include // for exception #include // for cerr #include // for move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if RAW_UDP #include "custom_udp_signal_source.h" #endif diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 47e35bfbd..a4b177acc 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -40,7 +40,6 @@ #include "signal_source_interface.h" #include // for boost::lexical_cast #include // for boost::tokenizer -#include // for LOG #include // for basic_block #include // for gr::filter::firdes #include // for io_signature @@ -59,6 +58,12 @@ #include // for std::thread #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #ifdef GR_GREATER_38 #include #else @@ -2181,7 +2186,7 @@ void GNSSFlowgraph::set_signals_list() std::string sv_list = configuration_->property("Galileo.prns", std::string("")); - if (sv_list.length() > 0) + if (!sv_list.empty()) { // Reset the available prns: std::set tmp_set; @@ -2221,7 +2226,7 @@ void GNSSFlowgraph::set_signals_list() sv_list = configuration_->property("GPS.prns", std::string("")); - if (sv_list.length() > 0) + if (!sv_list.empty()) { // Reset the available prns: std::set tmp_set; @@ -2261,7 +2266,7 @@ void GNSSFlowgraph::set_signals_list() sv_list = configuration_->property("SBAS.prns", std::string("")); - if (sv_list.length() > 0) + if (!sv_list.empty()) { // Reset the available prns: std::set tmp_set; @@ -2301,7 +2306,7 @@ void GNSSFlowgraph::set_signals_list() sv_list = configuration_->property("Glonass.prns", std::string("")); - if (sv_list.length() > 0) + if (!sv_list.empty()) { // Reset the available prns: std::set tmp_set; @@ -2341,7 +2346,7 @@ void GNSSFlowgraph::set_signals_list() sv_list = configuration_->property("Beidou.prns", std::string("")); - if (sv_list.length() > 0) + if (!sv_list.empty()) { // Reset the available prns: std::set tmp_set; diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index 3e25387ed..fa0fa9983 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -114,11 +114,15 @@ target_link_libraries(core_system_parameters PUBLIC Boost::date_time Boost::serialization - PRIVATE - Gflags::gflags - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(core_system_parameters PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(core_system_parameters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(core_system_parameters PRIVATE absl::flags absl::log) +endif() + # for gnss_sdr_make_unique.h target_include_directories(core_system_parameters PUBLIC diff --git a/src/core/system_parameters/galileo_cnav_message.cc b/src/core/system_parameters/galileo_cnav_message.cc index e514b00b7..488d8f49f 100644 --- a/src/core/system_parameters/galileo_cnav_message.cc +++ b/src/core/system_parameters/galileo_cnav_message.cc @@ -19,11 +19,16 @@ #include "galileo_cnav_message.h" #include // for boost::crc_basic, boost::crc_optimal #include // for boost::dynamic_bitset -#include -#include // for reverse +#include // for reverse #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using CRC_Galileo_CNAV_type = boost::crc_optimal<24, 0x1864CFBU, 0x0, 0x0, false, false>; diff --git a/src/core/system_parameters/galileo_fnav_message.cc b/src/core/system_parameters/galileo_fnav_message.cc index 5dea81898..0ea44e6a7 100644 --- a/src/core/system_parameters/galileo_fnav_message.cc +++ b/src/core/system_parameters/galileo_fnav_message.cc @@ -23,11 +23,16 @@ #include "galileo_fnav_message.h" #include // for boost::crc_basic, boost::crc_optimal #include -#include #include // for reverse #include // for string, operator<< #include // for back_insert_iterator +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using CRC_Galileo_FNAV_type = boost::crc_optimal<24, 0x1864CFBU, 0x0, 0x0, false, false>; diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index 81c47c3bb..d97ca6a90 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -21,12 +21,16 @@ #include "reed_solomon.h" #include // for boost::crc_basic, boost::crc_optimal #include // for boost::dynamic_bitset -#include // for DLOG #include // for reverse #include // for operator<< #include // for std::numeric_limits #include // for std::accumulate +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif using CRC_Galileo_INAV_type = boost::crc_optimal<24, 0x1864CFBU, 0x0, 0x0, false, false>; diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.cc b/src/core/system_parameters/glonass_gnav_navigation_message.cc index 9428875c4..b655850fe 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.cc +++ b/src/core/system_parameters/glonass_gnav_navigation_message.cc @@ -19,10 +19,15 @@ #include "glonass_gnav_navigation_message.h" #include "MATH_CONSTANTS.h" // for TWO_N20, TWO_N30, TWO_N14, TWO_N15, TWO_N18 #include "gnss_satellite.h" -#include #include // for size_t #include // for operator<< +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + Glonass_Gnav_Navigation_Message::Glonass_Gnav_Navigation_Message() { diff --git a/src/core/system_parameters/gnss_satellite.cc b/src/core/system_parameters/gnss_satellite.cc index 2a974cc0a..d05c880b3 100644 --- a/src/core/system_parameters/gnss_satellite.cc +++ b/src/core/system_parameters/gnss_satellite.cc @@ -15,9 +15,14 @@ */ #include "gnss_satellite.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + Gnss_Satellite::Gnss_Satellite(const std::string& system_, uint32_t PRN_) { diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 9f7ead3c7..8d3fd6759 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -16,13 +16,29 @@ target_link_libraries(gnss-sdr PRIVATE algorithms_libs core_receiver + gnss_sdr_flags Boost::headers Boost::thread - Gflags::gflags - Glog::glog Threads::Threads ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(gnss-sdr PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(gnss-sdr PUBLIC -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(gnss-sdr PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize absl::log_sink absl::log_sink_registry) + if(NOT ENABLE_LOG) + message(STATUS "Internal logging is not enabled") + if(CMAKE_VERSION VERSION_GREATER 3.11.0) + target_compile_definitions(gnss-sdr INTERFACE -DABSL_MIN_LOG_LEVEL=3) + else() + set_property(TARGET gnss-sdr APPEND PROPERTY + INTERFACE_COMPILE_DEFINITIONS ABSL_MIN_LOG_LEVEL=3 + ) + endif() + endif() +endif() + target_compile_definitions(gnss-sdr PRIVATE -DGNSS_SDR_VERSION="${VERSION}") if(ENABLE_CUDA) @@ -55,6 +71,10 @@ if(ENABLE_GPERFTOOLS) endif() endif() +if(NOT ENABLE_LOG) + target_compile_definitions(gnss-sdr PRIVATE -DABSL_MIN_LOG_LEVEL=3) +endif() + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") target_link_libraries(gnss-sdr PRIVATE "-lc++") diff --git a/src/main/main.cc b/src/main/main.cc index e4715a5c3..472f44148 100644 --- a/src/main/main.cc +++ b/src/main/main.cc @@ -29,30 +29,71 @@ #include "concurrent_queue.h" #include "control_thread.h" #include "gnss_sdr_filesystem.h" +#include "gnss_sdr_flags.h" #include "gnss_sdr_make_unique.h" #include "gps_acq_assist.h" #include // for diagnostic_information #include // for exception #include // for thread_resource_error -#include // for ShutDownCommandLineFlags -#include // for FLAGS_log_dir #include // for time_point #include // for exception +#include // for ofstream #include // for operator<< #include // for unique_ptr +#include // fro std::flush #include // for string -#if CUDA_GPU_ACCEL -// For the CUDA runtime routines (prefixed with "cuda_") -#include -#endif - +#if USE_GLOG_AND_GFLAGS +#include // for ShutDownCommandLineFlags +#include #if GFLAGS_OLD_NAMESPACE namespace gflags { using namespace google; } #endif +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include +std::string GnssSdrVersionString() { return std::string("gnss-sdr version ") + std::string(GNSS_SDR_VERSION) + "\n"; } +class GnssSdrLogSink : public absl::LogSink +{ +public: + GnssSdrLogSink() + { + if (!absl::GetFlag(FLAGS_log_dir).empty()) + { + filename = absl::GetFlag(FLAGS_log_dir) + "/gnss-sdr.log"; + } + else + { + filename = GetTempDir() + "/gnss-sdr.log"; + } + logfile.open(filename); + } + void Send(const absl::LogEntry& entry) override + { + logfile << entry.text_message_with_prefix_and_newline() << std::flush; + } + +private: + std::ofstream logfile; + std::string filename; +}; +#endif + +#if CUDA_GPU_ACCEL +// For the CUDA runtime routines (prefixed with "cuda_") +#include +#endif + /* * Concurrent queues that communicates the Telemetry Decoder @@ -69,14 +110,21 @@ int main(int argc, char** argv) { const std::string intro_help( std::string("\nGNSS-SDR is an Open Source GNSS Software Defined Receiver\n") + - "Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors)\n" + + "Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors)\n" + "This program comes with ABSOLUTELY NO WARRANTY;\n" + "See COPYING file to see a copy of the General Public License\n \n"); - const std::string gnss_sdr_version(GNSS_SDR_VERSION); +#if USE_GLOG_AND_GFLAGS gflags::SetUsageMessage(intro_help); gflags::SetVersionString(gnss_sdr_version); gflags::ParseCommandLineFlags(&argc, &argv, true); +#else + absl::FlagsUsageConfig empty_config; + empty_config.version_string = &GnssSdrVersionString; + absl::SetFlagsUsageConfig(empty_config); + absl::SetProgramUsageMessage(intro_help); + absl::ParseCommandLine(argc, argv); +#endif std::cout << "Initializing GNSS-SDR v" << gnss_sdr_version << " ... Please wait.\n"; } catch (const std::exception& e) @@ -99,8 +147,16 @@ int main(int argc, char** argv) if (GOOGLE_STRIP_LOG == 0) { + // google::InitGoogleLogging(argv[0]); +#if USE_GLOG_AND_GFLAGS google::InitGoogleLogging(argv[0]); if (FLAGS_log_dir.empty()) +#else + absl::LogSink* theSink = new GnssSdrLogSink; + absl::AddLogSink(theSink); + absl::InitializeLog(); + if (absl::GetFlag(FLAGS_log_dir).empty()) +#endif { std::cout << "Logging will be written at " << fs::temp_directory_path() @@ -111,27 +167,47 @@ int main(int argc, char** argv) { try { +#if USE_GLOG_AND_GFLAGS const fs::path p(FLAGS_log_dir); +#else + const fs::path p(absl::GetFlag(FLAGS_log_dir)); +#endif if (!fs::exists(p)) { std::cout << "The path " +#if USE_GLOG_AND_GFLAGS << FLAGS_log_dir +#else + << absl::GetFlag(FLAGS_log_dir) +#endif << " does not exist, attempting to create it.\n"; errorlib::error_code ec; if (!fs::create_directory(p, ec)) { +#if USE_GLOG_AND_GFLAGS std::cerr << "Could not create the " << FLAGS_log_dir << " folder. GNSS-SDR program ended.\n"; gflags::ShutDownCommandLineFlags(); +#else + std::cerr << "Could not create the " << absl::GetFlag(FLAGS_log_dir) << " folder. GNSS-SDR program ended.\n"; +#endif return 1; } } +#if USE_GLOG_AND_GFLAGS std::cout << "Logging will be written at " << FLAGS_log_dir << '\n'; +#else + std::cout << "Logging will be written at " << absl::GetFlag(FLAGS_log_dir) << '\n'; +#endif } catch (const std::exception& e) { std::cerr << e.what() << '\n'; +#if USE_GLOG_AND_GFLAGS std::cerr << "Could not create the " << FLAGS_log_dir << " folder. GNSS-SDR program ended.\n"; gflags::ShutDownCommandLineFlags(); +#else + std::cerr << "Could not create the " << absl::GetFlag(FLAGS_log_dir) << " folder. GNSS-SDR program ended.\n"; +#endif return 1; } } @@ -201,7 +277,11 @@ int main(int argc, char** argv) << elapsed_seconds.count() << " [seconds]\n"; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#else + absl::FlushLogSinks(); +#endif std::cout << "GNSS-SDR program ended.\n"; return return_code; } diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index bd0a8e92c..2785c5b8c 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -37,7 +37,7 @@ if(NOT GOOGLETEST_FOUND) set(GTEST_BUILD_COMMAND ${GTEST_BUILD_COMMAND} "--parallel 1") endif() if(CMAKE_GENERATOR STREQUAL Xcode) - set(GTEST_BUILD_COMMAND "xcodebuild" "-configuration" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel> "-target" "gtest_main") + set(GTEST_BUILD_COMMAND "xcodebuild" "-configuration" $<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:Debug> "-target" "gtest_main") endif() if(GNSSSDR_GTEST_LOCAL_VERSION VERSION_LESS 1.12.0) set(DEBUG_DECORATION "d") @@ -305,7 +305,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) else() set(GNSS_SIM_BUILD_COMMAND "${CMAKE_MAKE_PROGRAM}") if(CMAKE_GENERATOR STREQUAL Xcode) - set(GNSS_SIM_BUILD_COMMAND "xcodebuild" "-configuration" "${CMAKE_BUILD_TYPE}" "-target" "gnss_sim") + set(GNSS_SIM_BUILD_COMMAND "xcodebuild" "-configuration" $<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:Debug> "-target" "gnss_sim") endif() if(TOOLCHAIN_ARG) set(TOOLCHAIN_ARG_GNSS_SIM "-DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON") @@ -355,7 +355,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) endif() set(GNSSTK_BUILD_COMMAND "${CMAKE_MAKE_PROGRAM}") if(CMAKE_GENERATOR STREQUAL Xcode) - set(GNSSTK_BUILD_COMMAND "xcodebuild" "-configuration" "${CMAKE_BUILD_TYPE}") + set(GNSSTK_BUILD_COMMAND "xcodebuild" "-configuration" $<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:Debug>) endif() include(GNUInstallDirs) find_program(Patch_EXECUTABLE NAME patch PATHS ENV PATH) @@ -591,8 +591,6 @@ if(ENABLE_UNIT_TESTING) PRIVATE Boost::thread Armadillo::armadillo - Gflags::gflags - Glog::glog Gnuradio::runtime Gnuradio::blocks Gnuradio::filter @@ -621,6 +619,12 @@ if(ENABLE_UNIT_TESTING) system_testing_lib core_receiver ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(run_tests PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(run_tests PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(run_tests PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + endif() target_include_directories(run_tests INTERFACE ${GNSSSDR_SOURCE_DIR}/src/tests/common-files @@ -752,8 +756,6 @@ if(ENABLE_FPGA) PRIVATE Armadillo::armadillo Boost::thread - Gflags::gflags - Glog::glog Gnuradio::runtime Gnuradio::blocks GTest::GTest @@ -767,9 +769,16 @@ if(ENABLE_FPGA) algorithms_libs core_receiver ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + endif() target_include_directories(gps_l1_ca_dll_pll_tracking_test_fpga INTERFACE ${GNSSSDR_SOURCE_DIR}/src/tests/common-files ) + xcode_remove_warning_duplicates(gps_l1_ca_dll_pll_tracking_test_fpga) install(TARGETS gps_l1_ca_dll_pll_tracking_test_fpga RUNTIME DESTINATION bin COMPONENT "fpga-test" @@ -854,12 +863,18 @@ if(ENABLE_SYSTEM_TESTING) #### TTFF set(OPT_LIBS_ Boost::thread Boost::date_time - Threads::Threads Gflags::gflags Glog::glog + Threads::Threads Gnuradio::runtime GTest::GTest GTest::Main Gnuradio::blocks Gnuradio::filter Gnuradio::analog algorithms_libs core_receiver ) + if(ENABLE_GLOG_AND_GFLAGS) + set(OPT_LIBS_ ${OPT_LIBS_} Gflags::gflags Glog::glog) + add_definitions(-DUSE_GLOG=1) + else() + set(OPT_LIBS_ ${OPT_LIBS_} absl::flags_parse absl::flags absl::log absl::log_initialize absl::log_sink absl::log_sink_registry) + endif() if(NOT ENABLE_PACKAGING) add_system_test(ttff) endif() @@ -869,11 +884,17 @@ if(ENABLE_SYSTEM_TESTING) set(OPT_LIBS_ algorithms_libs core_receiver core_system_parameters gnss_sdr_flags system_testing_lib signal_processing_testing_lib - Boost::thread Threads::Threads Gflags::gflags Glog::glog + Boost::thread Threads::Threads GTest::GTest GTest::Main Gnuradio::runtime Gnuradio::blocks Gnuradio::filter Gnuradio::analog Matio::matio Volkgnsssdr::volkgnsssdr ) + if(ENABLE_GLOG_AND_GFLAGS) + set(OPT_LIBS_ ${OPT_LIBS_} Gflags::gflags Glog::glog) + add_definitions(-DUSE_GLOG=1) + else() + set(OPT_LIBS_ ${OPT_LIBS_} absl::flags_parse absl::log absl::log_initialize absl::log_sink absl::log_sink_registry) + endif() add_system_test(position_test) if(ENABLE_GPERFTOOLS) if(GPERFTOOLS_FOUND) @@ -926,8 +947,6 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(flowgraph_test PRIVATE Boost::thread - Gflags::gflags - Glog::glog Gnuradio::runtime GTest::GTest GTest::Main @@ -938,6 +957,12 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) core_receiver algorithms_libs ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(flowgraph_test PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(flowgraph_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(flowgraph_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + endif() target_include_directories(flowgraph_test PRIVATE @@ -975,8 +1000,6 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(gnss_block_test PRIVATE Boost::thread - Gflags::gflags - Glog::glog Gnuradio::runtime Gnuradio::blocks Gnuradio::filter @@ -991,6 +1014,12 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) core_receiver algorithms_libs ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(gnss_block_test PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(gnss_block_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(gnss_block_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + endif() target_include_directories(gnss_block_test PRIVATE ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs @@ -1025,8 +1054,6 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(gnuradio_block_test PRIVATE Boost::thread - Gflags::gflags - Glog::glog Gnuradio::runtime Gnuradio::blocks Gnuradio::filter @@ -1039,6 +1066,12 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) core_receiver algorithms_libs ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(gnuradio_block_test PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(gnuradio_block_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(gnuradio_block_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + endif() xcode_remove_warning_duplicates(gnuradio_block_test) @@ -1063,14 +1096,19 @@ endif() target_link_libraries(matio_test PRIVATE algorithms_libs - Gflags::gflags - Glog::glog GTest::GTest GTest::Main Matio::matio core_receiver ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(matio_test PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(matio_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(matio_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) +endif() + target_include_directories(matio_test INTERFACE ${GNSSSDR_SOURCE_DIR}/src/tests/common-files @@ -1099,8 +1137,6 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(acq_test PRIVATE Boost::thread - Gflags::gflags - Glog::glog Gnuradio::runtime Gnuradio::blocks Gnuradio::filter @@ -1116,6 +1152,12 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) signal_processing_testing_lib core_receiver ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(acq_test PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(acq_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(acq_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + endif() target_include_directories(acq_test INTERFACE ${GNSSSDR_SOURCE_DIR}/src/tests/common-files @@ -1182,8 +1224,6 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(trk_test PRIVATE Boost::thread - Gflags::gflags - Glog::glog Gnuradio::runtime Gnuradio::blocks Gnuradio::filter @@ -1198,6 +1238,12 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) signal_generator_gr_blocks core_receiver ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(trk_test PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(trk_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(trk_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + endif() if(USE_GENERIC_LAMBDAS) set(has_generic_lambdas HAS_GENERIC_LAMBDA=1) set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0) @@ -1249,14 +1295,18 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(control_thread_test PRIVATE Boost::thread - Gflags::gflags - Glog::glog GTest::GTest GTest::Main signal_source_adapters algorithms_libs core_receiver ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(control_thread_test PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(control_thread_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(control_thread_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + endif() xcode_remove_warning_duplicates(control_thread_test) diff --git a/src/tests/common-files/gnuplot_i.h b/src/tests/common-files/gnuplot_i.h index 5566f59cc..04b7e3458 100644 --- a/src/tests/common-files/gnuplot_i.h +++ b/src/tests/common-files/gnuplot_i.h @@ -34,7 +34,6 @@ #ifndef GNSS_SDR_GNUPLOT_I_H #define GNSS_SDR_GNUPLOT_I_H -#include #include #include // for getenv() #include // for strncpy @@ -47,7 +46,13 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include DEFINE_bool(show_plots, true, "Show plots on screen. Disable for non-interactive testing."); +#else +#include +ABSL_FLAG(bool, show_plots, true, "Show plots on screen. Disable for non-interactive testing."); +#endif #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) // defined for 32 and 64-bit environments diff --git a/src/tests/common-files/observable_tests_flags.h b/src/tests/common-files/observable_tests_flags.h index 444211337..a0ab470b6 100644 --- a/src/tests/common-files/observable_tests_flags.h +++ b/src/tests/common-files/observable_tests_flags.h @@ -17,12 +17,27 @@ #ifndef GNSS_SDR_OBSERVABLE_TESTS_FLAGS_H #define GNSS_SDR_OBSERVABLE_TESTS_FLAGS_H -#include #include +#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + +#if USE_GLOG_AND_GFLAGS DEFINE_double(skip_obs_transitory_s, 30.0, "Skip the initial observable outputs to avoid transitory results [s]"); DEFINE_bool(compute_single_diffs, false, "Compute also the single difference errors for Accumulated Carrier Phase and Carrier Doppler (requires LO synchronization between receivers)"); DEFINE_bool(compare_with_5X, false, "Compare the E5a Doppler and Carrier Phases with the E5 full bw in RINEX (expect discrepancy due to the center frequencies differences"); DEFINE_bool(duplicated_satellites_test, false, "Enable special observable test mode where the scenario contains duplicated satellite orbits"); DEFINE_string(duplicated_satellites_prns, "1,2,3,4", "List of duplicated satellites PRN pairs (i.e. 1,2,3,4 indicates that the PRNs 1,2 share the same orbit. The same applies for PRNs 3,4)"); +#else +ABSL_FLAG(double, skip_obs_transitory_s, 30.0, "Skip the initial observable outputs to avoid transitory results [s]"); +ABSL_FLAG(bool, compute_single_diffs, false, "Compute also the single difference errors for Accumulated Carrier Phase and Carrier Doppler (requires LO synchronization between receivers)"); +ABSL_FLAG(bool, compare_with_5X, false, "Compare the E5a Doppler and Carrier Phases with the E5 full bw in RINEX (expect discrepancy due to the center frequencies differences"); +ABSL_FLAG(bool, duplicated_satellites_test, false, "Enable special observable test mode where the scenario contains duplicated satellite orbits"); +ABSL_FLAG(std::string, duplicated_satellites_prns, "1,2,3,4", "List of duplicated satellites PRN pairs (i.e. 1,2,3,4 indicates that the PRNs 1,2 share the same orbit. The same applies for PRNs 3,4)"); +#endif + #endif diff --git a/src/tests/common-files/signal_generator_flags.h b/src/tests/common-files/signal_generator_flags.h index c43763fd3..be2ae03ac 100644 --- a/src/tests/common-files/signal_generator_flags.h +++ b/src/tests/common-files/signal_generator_flags.h @@ -17,10 +17,17 @@ #ifndef GNSS_SDR_SIGNAL_GENERATOR_FLAGS_H #define GNSS_SDR_SIGNAL_GENERATOR_FLAGS_H -#include +#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + +#if USE_GLOG_AND_GFLAGS DEFINE_bool(disable_generator, false, "Disable the signal generator (a external signal file must be available for the test)"); DEFINE_string(generator_binary, std::string(SW_GENERATOR_BIN), "Path of software-defined signal generator binary"); DEFINE_string(rinex_nav_file, std::string(DEFAULT_RINEX_NAV), "Input RINEX navigation file"); @@ -34,5 +41,20 @@ DEFINE_int32(test_satellite_PRN, 1, "PRN of the satellite under test (must be vi DEFINE_int32(test_satellite_PRN2, 2, "PRN of the satellite under test (must be visible during the observation time)"); DEFINE_string(test_satellite_PRN_list, "1,2,3,6,9,10,12,17,20,23,28", "List of PRN of the satellites under test (must be visible during the observation time)"); DEFINE_double(CN0_dBHz, std::numeric_limits::infinity(), "Enable noise generator and set the CN0 [dB-Hz]"); +#else +ABSL_FLAG(bool, disable_generator, false, "Disable the signal generator (a external signal file must be available for the test)"); +ABSL_FLAG(std::string, generator_binary, std::string(SW_GENERATOR_BIN), "Path of software-defined signal generator binary"); +ABSL_FLAG(std::string, rinex_nav_file, std::string(DEFAULT_RINEX_NAV), "Input RINEX navigation file"); +ABSL_FLAG(int32_t, duration, 100, "Duration of the experiment [in seconds, max = 300]"); +ABSL_FLAG(std::string, static_position, "30.286502,120.032669,100", "Static receiver position [latitude,longitude,height]"); +ABSL_FLAG(std::string, dynamic_position, "", "Observer positions file, in .csv or .nmea format"); +ABSL_FLAG(std::string, filename_rinex_obs, "sim.16o", "Filename of output RINEX navigation file"); +ABSL_FLAG(std::string, filename_raw_data, "signal_out.bin", "Filename of output raw data file"); +ABSL_FLAG(int32_t, fs_gen_sps, 2600000, "Sampling frequency [sps]"); +ABSL_FLAG(int32_t, test_satellite_PRN, 1, "PRN of the satellite under test (must be visible during the observation time)"); +ABSL_FLAG(int32_t, test_satellite_PRN2, 2, "PRN of the satellite under test (must be visible during the observation time)"); +ABSL_FLAG(std::string, test_satellite_PRN_list, "1,2,3,6,9,10,12,17,20,23,28", "List of PRN of the satellites under test (must be visible during the observation time)"); +ABSL_FLAG(double, CN0_dBHz, std::numeric_limits::infinity(), "Enable noise generator and set the CN0 [dB-Hz]"); +#endif #endif diff --git a/src/tests/common-files/test_flags.h b/src/tests/common-files/test_flags.h index 814cf69e6..937ad4418 100644 --- a/src/tests/common-files/test_flags.h +++ b/src/tests/common-files/test_flags.h @@ -17,16 +17,28 @@ #ifndef GNSS_SDR_TEST_FLAGS_H #define GNSS_SDR_TEST_FLAGS_H -#include + +#include #include + +#if USE_GLOG_AND_GFLAGS +#include #if defined GNUPLOT_EXECUTABLE DEFINE_string(gnuplot_executable, std::string(GNUPLOT_EXECUTABLE), "Gnuplot binary path"); #elif !defined GNUPLOT_EXECUTABLE DEFINE_string(gnuplot_executable, "", "Gnuplot binary path"); #endif - DEFINE_bool(plot_acq_grid, false, "Plots acquisition grid with gnuplot"); DEFINE_int32(plot_decimate, 1, "Decimate plots"); - +#else +#include +#if defined GNUPLOT_EXECUTABLE +ABSL_FLAG(std::string, std::string(GNUPLOT_EXECUTABLE), "Gnuplot binary path"); +#elif !defined GNUPLOT_EXECUTABLE +ABSL_FLAG(std::string, gnuplot_executable, "", "Gnuplot binary path"); +#endif +ABSL_FLAG(bool, plot_acq_grid, false, "Plots acquisition grid with gnuplot"); +ABSL_FLAG(int32_t, plot_decimate, 1, "Decimate plots"); +#endif #endif diff --git a/src/tests/common-files/tracking_tests_flags.h b/src/tests/common-files/tracking_tests_flags.h index 8bbc4701c..0027fb862 100644 --- a/src/tests/common-files/tracking_tests_flags.h +++ b/src/tests/common-files/tracking_tests_flags.h @@ -17,10 +17,12 @@ #ifndef GNSS_SDR_TRACKING_TESTS_FLAGS_H #define GNSS_SDR_TRACKING_TESTS_FLAGS_H -#include +#include #include #include +#if USE_GLOG_AND_GFLAGS +#include DEFINE_string(trk_test_implementation, std::string("GPS_L1_CA_DLL_PLL_Tracking"), "Tracking block implementation under test, defaults to GPS_L1_CA_DLL_PLL_Tracking"); // Input signal configuration @@ -77,6 +79,63 @@ DEFINE_bool(high_dyn, false, "Activates the code resampler and NCO generator for // Test output configuration DEFINE_bool(plot_gps_l1_tracking_test, false, "Plots results of GpsL1CADllPllTrackingTest with gnuplot"); +#else +#include +ABSL_FLAG(std::string, trk_test_implementation, std::string("GPS_L1_CA_DLL_PLL_Tracking"), "Tracking block implementation under test, defaults to GPS_L1_CA_DLL_PLL_Tracking"); +// Input signal configuration +ABSL_FLAG(bool, enable_external_signal_file, false, "Use an external signal file capture instead of the software-defined signal generator"); +ABSL_FLAG(double, external_signal_acquisition_threshold, 2.5, "Threshold for satellite acquisition when external file is used"); +ABSL_FLAG(int32_t, external_signal_acquisition_dwells, 5, "Maximum dwells count for satellite acquisition when external file is used"); +ABSL_FLAG(double, external_signal_acquisition_doppler_max_hz, 5000.0, "Doppler max for satellite acquisition when external file is used"); +ABSL_FLAG(double, external_signal_acquisition_doppler_step_hz, 125.0, "Doppler step for satellite acquisition when external file is used"); +ABSL_FLAG(bool, use_acquisition_resampler, false, "Reduce the sampling rate of the input signal for the acquisition in order to optimize the SNR and decrease the processor load"); +ABSL_FLAG(std::string, signal_file, std::string("signal_out.bin"), "Path of the external signal capture file"); +ABSL_FLAG(double, CN0_dBHz_start, std::numeric_limits::infinity(), "Enable noise generator and set the CN0 start sweep value [dB-Hz]"); +ABSL_FLAG(double, CN0_dBHz_stop, std::numeric_limits::infinity(), "Enable noise generator and set the CN0 stop sweep value [dB-Hz]"); +ABSL_FLAG(double, CN0_dB_step, 3.0, "Noise generator CN0 sweep step value [dB]"); + +ABSL_FLAG(double, PLL_bw_hz_start, 20.0, "PLL Wide configuration start sweep value [Hz]"); +ABSL_FLAG(double, PLL_bw_hz_stop, 20.0, "PLL Wide configuration stop sweep value [Hz]"); +ABSL_FLAG(double, PLL_bw_hz_step, 5.0, "PLL Wide configuration sweep step value [Hz]"); + +ABSL_FLAG(double, DLL_bw_hz_start, 1.0, "DLL Wide configuration start sweep value [Hz]"); +ABSL_FLAG(double, DLL_bw_hz_stop, 1.0, "DLL Wide configuration stop sweep value [Hz]"); +ABSL_FLAG(double, DLL_bw_hz_step, 0.25, "DLL Wide configuration sweep step value [Hz]"); + +ABSL_FLAG(double, fll_bw_hz, 4.0, "FLL filter bandwidth [Hz]"); +ABSL_FLAG(bool, enable_fll_pull_in, false, "Enable FLL in pull-in phase"); +ABSL_FLAG(bool, enable_fll_steady_state, false, "Enable FLL in steady-state phase"); + +ABSL_FLAG(double, PLL_narrow_bw_hz, 5.0, "PLL Narrow configuration value [Hz]"); +ABSL_FLAG(double, DLL_narrow_bw_hz, 0.75, "DLL Narrow configuration value [Hz]"); + +ABSL_FLAG(double, acq_Doppler_error_hz_start, 1000.0, "Acquisition Doppler error start sweep value [Hz]"); +ABSL_FLAG(double, acq_Doppler_error_hz_stop, -1000.0, "Acquisition Doppler error stop sweep value [Hz]"); +ABSL_FLAG(double, acq_Doppler_error_hz_step, -50.0, "Acquisition Doppler error sweep step value [Hz]"); + +ABSL_FLAG(double, acq_Delay_error_chips_start, 2.0, "Acquisition Code Delay error start sweep value [Chips]"); +ABSL_FLAG(double, acq_Delay_error_chips_stop, -2.0, "Acquisition Code Delay error stop sweep value [Chips]"); +ABSL_FLAG(double, acq_Delay_error_chips_step, -0.1, "Acquisition Code Delay error sweep step value [Chips]"); + +ABSL_FLAG(double, acq_to_trk_delay_s, 0.0, "Acquisition to Tracking delay value [s]"); + + +ABSL_FLAG(int64_t, skip_samples, 0, "Skip an initial transitory in the processed signal file capture [samples]"); + +ABSL_FLAG(int32_t, plot_detail_level, 0, "Specify the desired plot detail (0,1,2): 0 - Minimum plots (default) 2 - Plot all tracking parameters"); + +ABSL_FLAG(double, skip_trk_transitory_s, 1.0, "Skip the initial tracking output signal to avoid transitory results [s]"); + +// Emulated acquisition configuration + +// Tracking configuration +ABSL_FLAG(int32_t, extend_correlation_symbols, 1, "Set the tracking coherent correlation to N symbols (up to 20 for GPS L1 C/A)"); +ABSL_FLAG(int32_t, smoother_length, 10, "Set the moving average size for the carrier phase and code phase in case of high dynamics"); +ABSL_FLAG(bool, high_dyn, false, "Activates the code resampler and NCO generator for high dynamics"); + +// Test output configuration +ABSL_FLAG(bool, plot_gps_l1_tracking_test, false, "Plots results of GpsL1CADllPllTrackingTest with gnuplot"); #endif +#endif diff --git a/src/tests/single_test_main.cc b/src/tests/single_test_main.cc index 5f8d52aab..669bc91c8 100644 --- a/src/tests/single_test_main.cc +++ b/src/tests/single_test_main.cc @@ -19,26 +19,64 @@ #include "concurrent_map.h" #include "concurrent_queue.h" #include "gps_acq_assist.h" +#include +#include +#include +#include +#include + +#if USE_GLOG_AND_GFLAGS #include #include -#include -#include - #if GFLAGS_OLD_NAMESPACE namespace gflags { using namespace google; } +DECLARE_string(log_dir); #endif +#else +#include "gnss_sdr_flags.h" +#include +#include +#include +#include +#include +#include + +class TestLogSink : public absl::LogSink +{ +public: + TestLogSink() + { + if (!absl::GetFlag(FLAGS_log_dir).empty()) + { + logfile.open(absl::GetFlag(FLAGS_log_dir) + "/test.log"); + } + else + { + logfile.open(GetTempDir() + "/test.log"); + } + } + void Send(const absl::LogEntry &entry) override + { + logfile << entry.text_message_with_prefix_and_newline() << std::flush; + } + +private: + std::ofstream logfile; +}; +#endif + Concurrent_Queue global_gps_acq_assist_queue; Concurrent_Map global_gps_acq_assist_map; -DECLARE_string(log_dir); int main(int argc, char **argv) { +#if USE_GLOG_AND_GFLAGS gflags::ParseCommandLineFlags(&argc, &argv, true); try { @@ -48,6 +86,19 @@ int main(int argc, char **argv) { } // catch the "testing::internal::::ClassUniqueToAlwaysTrue" from gtest google::InitGoogleLogging(argv[0]); +#else + absl::ParseCommandLine(argc, argv); + try + { + testing::InitGoogleTest(&argc, argv); + } + catch (...) + { + } // catch the "testing::internal::::ClassUniqueToAlwaysTrue" from gtest + absl::LogSink *testLogSink = new TestLogSink; + absl::AddLogSink(testLogSink); + absl::InitializeLog(); +#endif int res = 0; try { @@ -57,6 +108,10 @@ int main(int argc, char **argv) { LOG(WARNING) << "Unexpected catch"; } +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#else + absl::FlushLogSinks(); +#endif return res; } diff --git a/src/tests/system-tests/libs/CMakeLists.txt b/src/tests/system-tests/libs/CMakeLists.txt index eb936a24f..01a5bfdeb 100644 --- a/src/tests/system-tests/libs/CMakeLists.txt +++ b/src/tests/system-tests/libs/CMakeLists.txt @@ -32,12 +32,18 @@ endif() target_link_libraries(system_testing_lib PUBLIC Armadillo::armadillo - Gflags::gflags PRIVATE Boost::headers Matio::matio ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(system_testing_lib PUBLIC Gflags::gflags) + target_compile_definitions(system_testing_lib PUBLIC -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(system_testing_lib PUBLIC absl::flags) +endif() + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(system_testing_lib diff --git a/src/tests/system-tests/libs/position_test_flags.h b/src/tests/system-tests/libs/position_test_flags.h index 57cc1e5dd..abff0f4a6 100644 --- a/src/tests/system-tests/libs/position_test_flags.h +++ b/src/tests/system-tests/libs/position_test_flags.h @@ -17,10 +17,18 @@ #ifndef GNSS_SDR_POSITION_TEST_FLAGS_H #define GNSS_SDR_POSITION_TEST_FLAGS_H -#include + +#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + +#if USE_GLOG_AND_GFLAGS DEFINE_string(config_file_ptest, std::string(""), "File containing the configuration parameters for the position test."); DEFINE_bool(plot_position_test, false, "Plots results of with gnuplot"); DEFINE_bool(static_scenario, true, "Compute figures of merit for static user position (DRMS, CEP, etc..)"); @@ -35,5 +43,21 @@ DEFINE_double(precision_SEP, 15.0, "Static scenario 3D (East, North, Up) precisi DEFINE_double(dynamic_3D_position_RMSE, 10.0, "Dynamic scenario 3D (ECEF) accuracy RMSE threshold [meters]"); DEFINE_double(dynamic_3D_velocity_RMSE, 5.0, "Dynamic scenario 3D (ECEF) velocity accuracy RMSE threshold [meters/second]"); DEFINE_bool(enable_carrier_smoothing, false, "Activates carrier smoothing of pseudoranges"); +#else +ABSL_FLAG(std::string, config_file_ptest, std::string(""), "File containing the configuration parameters for the position test."); +ABSL_FLAG(bool, plot_position_test, false, "Plots results of with gnuplot"); +ABSL_FLAG(bool, static_scenario, true, "Compute figures of merit for static user position (DRMS, CEP, etc..)"); +ABSL_FLAG(bool, use_ref_motion_file, false, "Enable or disable the use of a reference file containing the true receiver position, velocity and acceleration."); +ABSL_FLAG(int32_t, ref_motion_file_type, 1, "Type of reference motion file: 1- Spirent CSV motion file"); +ABSL_FLAG(std::string, ref_motion_filename, std::string("motion.csv"), "Path and filename for the reference motion file"); +ABSL_FLAG(std::string, pvt_solver_dump_filename, std::string("PVT.dat"), "Path and filename for the PVT solver binary dump file"); +ABSL_FLAG(double, static_2D_error_m, 2.0, "Static scenario 2D (East, North) positioning error threshold [meters]"); +ABSL_FLAG(double, static_3D_error_m, 5.0, "Static scenario 3D (East, North, Up) positioning error threshold [meters]"); +ABSL_FLAG(double, accuracy_CEP, 3.0, "Static scenario 2D (East, North) accuracy Circular Error Position (CEP) threshold [meters]"); +ABSL_FLAG(double, precision_SEP, 15.0, "Static scenario 3D (East, North, Up) precision Spherical Error Position (SEP) threshold [meters]"); +ABSL_FLAG(double, dynamic_3D_position_RMSE, 10.0, "Dynamic scenario 3D (ECEF) accuracy RMSE threshold [meters]"); +ABSL_FLAG(double, dynamic_3D_velocity_RMSE, 5.0, "Dynamic scenario 3D (ECEF) velocity accuracy RMSE threshold [meters/second]"); +ABSL_FLAG(bool, enable_carrier_smoothing, false, "Activates carrier smoothing of pseudoranges"); +#endif #endif diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index 5802aa9ca..f15fdf6aa 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -48,16 +47,53 @@ #include #include #include +#include #include +#if USE_GLOG_AND_GFLAGS +#include #if GFLAGS_OLD_NAMESPACE namespace gflags { using namespace google; } #endif +#else +#include +#include +#include +#include +#include +#include +#endif +#if USE_GLOG_AND_GFLAGS DEFINE_int32(num_channels, 11, "Number of channels"); +#else +ABSL_FLAG(int32_t, num_channels, 11, "Number of channels"); +class PositionTestLogSink : public absl::LogSink +{ +public: + PositionTestLogSink() + { + if (!absl::GetFlag(FLAGS_log_dir).empty()) + { + logfile.open(absl::GetFlag(FLAGS_log_dir) + "/position_test.log"); + } + else + { + logfile.open(GetTempDir() + "/position_test.log"); + } + } + void Send(const absl::LogEntry& entry) override + { + logfile << entry.text_message_with_prefix_and_newline() << std::flush; + } + +private: + std::ofstream logfile; +}; +#endif // For GPS NAVIGATION (L1) Concurrent_Queue global_gps_acq_assist_queue; @@ -84,11 +120,15 @@ private: std::string p5; std::string p6; +#if USE_GLOG_AND_GFLAGS const double baseband_sampling_freq = static_cast(FLAGS_fs_gen_sps); - std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; - +#else + const double baseband_sampling_freq = static_cast(absl::GetFlag(FLAGS_fs_gen_sps)); + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_filename_raw_data); +#endif void print_results(const arma::mat& R_eb_enu) const; std::shared_ptr config; std::shared_ptr config_f; @@ -101,6 +141,7 @@ private: int PositionSystemTest::configure_generator() { +#if USE_GLOG_AND_GFLAGS // Configure signal generator generator_binary = FLAGS_generator_binary; @@ -128,6 +169,35 @@ int PositionSystemTest::configure_generator() { p6 = std::string("-CN0_dBHz=") + std::to_string(FLAGS_CN0_dBHz); } +#else + // Configure signal generator + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(std::min(absl::GetFlag(FLAGS_duration) * 10, 3000)); + if (absl::GetFlag(FLAGS_duration) > 300) + { + std::cout << "WARNING: Duration has been set to its maximum value of 300 s\n"; + } + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_filename_raw_data); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] + if (absl::GetFlag(FLAGS_CN0_dBHz) > 100.0) + { + p6 = std::string("-CN0_dBHz=45"); + } + else + { + p6 = std::string("-CN0_dBHz=") + std::to_string(absl::GetFlag(FLAGS_CN0_dBHz)); + } +#endif return 0; } @@ -162,7 +232,11 @@ int PositionSystemTest::generate_signal() int PositionSystemTest::configure_receiver() { +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ptest.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ptest).empty()) +#endif { config = std::make_shared(); const int sampling_rate_internal = baseband_sampling_freq; @@ -182,7 +256,11 @@ int PositionSystemTest::configure_receiver() const int grid_density = 16; const float zero = 0.0; +#if USE_GLOG_AND_GFLAGS const int number_of_channels = FLAGS_num_channels; +#else + const int number_of_channels = absl::GetFlag(FLAGS_num_channels); +#endif const int in_acquisition = 1; const float threshold = 2.5; @@ -199,14 +277,22 @@ int PositionSystemTest::configure_receiver() const float early_late_space_narrow_chips = 0.1; const float pll_bw_narrow_hz = 15.0; const float dll_bw_narrow_hz = 1.5; +#if USE_GLOG_AND_GFLAGS const int extend_correlation_symbols = FLAGS_extend_correlation_symbols; // defaults to 1 - +#else + const int extend_correlation_symbols = absl::GetFlag(FLAGS_extend_correlation_symbols); // defaults to 1 +#endif const int display_rate_ms = 500; const int output_rate_ms = 100; config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(sampling_rate_internal)); // Enable automatic resampler for the acquisition, if required + +#if USE_GLOG_AND_GFLAGS if (FLAGS_use_acquisition_resampler == true) +#else + if (absl::GetFlag(FLAGS_use_acquisition_resampler) == true) +#endif { config->set_property("GNSS-SDR.use_acquisition_resampler", "true"); } @@ -305,8 +391,13 @@ int PositionSystemTest::configure_receiver() // Set Observables config->set_property("Observables.implementation", "Hybrid_Observables"); +#if USE_GLOG_AND_GFLAGS config->set_property("Observables.enable_carrier_smoothing", FLAGS_enable_carrier_smoothing ? "true" : "false"); config->set_property("Observables.smoothing_factor", std::to_string(FLAGS_carrier_smoothing_factor)); +#else + config->set_property("Observables.enable_carrier_smoothing", absl::GetFlag(FLAGS_enable_carrier_smoothing) ? "true" : "false"); + config->set_property("Observables.smoothing_factor", std::to_string(absl::GetFlag(FLAGS_carrier_smoothing_factor))); +#endif config->set_property("Observables.dump", "false"); config->set_property("Observables.dump_filename", "./observables.dat"); @@ -334,7 +425,11 @@ int PositionSystemTest::configure_receiver() } else { +#if USE_GLOG_AND_GFLAGS config_f = std::make_shared(FLAGS_config_file_ptest); +#else + config_f = std::make_shared(absl::GetFlag(FLAGS_config_file_ptest)); +#endif config = nullptr; } return 0; @@ -344,7 +439,11 @@ int PositionSystemTest::configure_receiver() int PositionSystemTest::run_receiver() { std::shared_ptr control_thread; +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ptest.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ptest).empty()) +#endif { control_thread = std::make_shared(config); } @@ -472,7 +571,11 @@ void PositionSystemTest::check_results() arma::mat ref_LLH; // Geodetic coordinates (latitude, longitude, height) reference in WGS84 datum arma::vec ref_time_s; +#if USE_GLOG_AND_GFLAGS std::istringstream iss2(FLAGS_static_position); +#else + std::istringstream iss2(absl::GetFlag(FLAGS_static_position)); +#endif std::string str_aux; std::getline(iss2, str_aux, ','); double ref_lat = std::stod(str_aux); @@ -491,7 +594,11 @@ void PositionSystemTest::check_results() cart2utm(true_r_eb_e, utm_zone, ref_r_enu); Rtklib_Solver_Dump_Reader pvt_reader; +#if USE_GLOG_AND_GFLAGS pvt_reader.open_obs_file(FLAGS_pvt_solver_dump_filename); +#else + pvt_reader.open_obs_file(absl::GetFlag(FLAGS_pvt_solver_dump_filename)); +#endif int64_t n_epochs_pvt = pvt_reader.num_epochs(); R_eb_e = arma::zeros(3, n_epochs_pvt); V_eb_e = arma::zeros(3, n_epochs_pvt); @@ -525,7 +632,11 @@ void PositionSystemTest::check_results() ASSERT_FALSE(current_epoch == 0) << "PVT dump is empty"; // compute results +#if USE_GLOG_AND_GFLAGS if (FLAGS_static_scenario) +#else + if (absl::GetFlag(FLAGS_static_scenario)) +#endif { double sigma_E_2_precision = arma::var(R_eb_enu.row(0)); double sigma_N_2_precision = arma::var(R_eb_enu.row(1)); @@ -566,11 +677,17 @@ void PositionSystemTest::check_results() std::stringstream stm; std::ofstream position_test_file; +#if USE_GLOG_AND_GFLAGS if (!FLAGS_config_file_ptest.empty()) { stm << "Configuration file: " << FLAGS_config_file_ptest << '\n'; } - +#else + if (!absl::GetFlag(FLAGS_config_file_ptest).empty()) + { + stm << "Configuration file: " << absl::GetFlag(FLAGS_config_file_ptest) << '\n'; + } +#endif stm << "---- STATIC ACCURACY ----\n"; stm << "2DRMS = " << 2 * sqrt(sigma_E_2_accuracy + sigma_N_2_accuracy) << " [m]\n"; stm << "DRMS = " << sqrt(sigma_E_2_accuracy + sigma_N_2_accuracy) << " [m]\n"; @@ -607,7 +724,7 @@ void PositionSystemTest::check_results() // Sanity Check double accuracy_CEP = 0.62 * sqrt(sigma_N_2_accuracy) + 0.56 * sqrt(sigma_E_2_accuracy); double precision_SEP = 0.51 * (sigma_E_2_precision + sigma_N_2_precision + sigma_U_2_precision); - +#if USE_GLOG_AND_GFLAGS EXPECT_LT(static_2D_error_m, FLAGS_static_2D_error_m); EXPECT_LT(static_3D_error_m, FLAGS_static_3D_error_m); ASSERT_LT(accuracy_CEP, FLAGS_accuracy_CEP); @@ -617,12 +734,27 @@ void PositionSystemTest::check_results() { print_results(R_eb_enu); } +#else + EXPECT_LT(static_2D_error_m, absl::GetFlag(FLAGS_static_2D_error_m)); + EXPECT_LT(static_3D_error_m, absl::GetFlag(FLAGS_static_3D_error_m)); + ASSERT_LT(accuracy_CEP, absl::GetFlag(FLAGS_accuracy_CEP)); + ASSERT_LT(precision_SEP, absl::GetFlag(FLAGS_precision_SEP)); + + if (absl::GetFlag(FLAGS_plot_position_test) == true) + { + print_results(R_eb_enu); + } +#endif } else { // dynamic position Spirent_Motion_Csv_Dump_Reader ref_reader; +#if USE_GLOG_AND_GFLAGS ref_reader.open_obs_file(FLAGS_ref_motion_filename); +#else + ref_reader.open_obs_file(absl::GetFlag(FLAGS_ref_motion_filename)); +#endif int64_t n_epochs_ref = ref_reader.num_epochs(); ref_R_eb_e = arma::zeros(3, n_epochs_ref); ref_V_eb_e = arma::zeros(3, n_epochs_ref); @@ -692,10 +824,17 @@ void PositionSystemTest::check_results() // report std::cout << "----- Position and Velocity 3D ECEF error statistics -----\n"; +#if USE_GLOG_AND_GFLAGS if (!FLAGS_config_file_ptest.empty()) { std::cout << "---- Configuration file: " << FLAGS_config_file_ptest << '\n'; } +#else + if (!absl::GetFlag(FLAGS_config_file_ptest).empty()) + { + std::cout << "---- Configuration file: " << absl::GetFlag(FLAGS_config_file_ptest) << '\n'; + } +#endif std::streamsize ss = std::cout.precision(); std::cout << std::setprecision(10) << "---- 3D ECEF Position RMSE = " << rmse_R_eb_e << ", mean = " << error_mean_R_eb_e @@ -711,14 +850,24 @@ void PositionSystemTest::check_results() << " [m/s]\n"; std::cout.precision(ss); - // plots +// plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_position_test == true) { const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + if (absl::GetFlag(FLAGS_plot_position_test) == true) + { + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (!gnuplot_executable.empty()) { Gnuplot g1("points"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g1.showonscreen(); // window output } @@ -740,7 +889,11 @@ void PositionSystemTest::check_results() g1.cmd("set key box opaque"); g1.plot_xyz(X, Y, Z, "ECEF 3D error"); g1.set_legend(); +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ptest.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ptest).empty()) +#endif { g1.savetops("ECEF_3d_error"); } @@ -750,7 +903,11 @@ void PositionSystemTest::check_results() } arma::vec time_vector_from_start_s = receiver_time_s - receiver_time_s(0); Gnuplot g3("linespoints"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g3.showonscreen(); // window output } @@ -771,7 +928,11 @@ void PositionSystemTest::check_results() g3.set_style("lines"); g3.plot_xy(time_vector_from_start_s, error_mean, "Mean"); g3.set_legend(); +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ptest.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ptest).empty()) +#endif { g3.savetops("Position_3d_error"); } @@ -781,7 +942,11 @@ void PositionSystemTest::check_results() } Gnuplot g4("linespoints"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g4.showonscreen(); // window output } @@ -802,7 +967,11 @@ void PositionSystemTest::check_results() g4.set_style("lines"); g4.plot_xy(time_vector_from_start_s, error_mean_v, "Mean"); g4.set_legend(); +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ptest.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ptest).empty()) +#endif { g4.savetops("Velocity_3d_error"); } @@ -813,17 +982,27 @@ void PositionSystemTest::check_results() } } - // ERROR CHECK - // todo: reduce the error tolerance or enable the option to pass the error tolerance by parameter + // ERROR CHECK + // todo: reduce the error tolerance or enable the option to pass the error tolerance by parameter + +#if USE_GLOG_AND_GFLAGS EXPECT_LT(rmse_R_eb_e, FLAGS_dynamic_3D_position_RMSE); // 3D RMS positioning error less than 10 meters EXPECT_LT(rmse_V_eb_e, FLAGS_dynamic_3D_velocity_RMSE); // 3D RMS speed error less than 5 meters/s (18 km/h) +#else + EXPECT_LT(rmse_R_eb_e, absl::GetFlag(FLAGS_dynamic_3D_position_RMSE)); // 3D RMS positioning error less than 10 meters + EXPECT_LT(rmse_V_eb_e, absl::GetFlag(FLAGS_dynamic_3D_velocity_RMSE)); // 3D RMS speed error less than 5 meters/s (18 km/h) +#endif } } void PositionSystemTest::print_results(const arma::mat& R_eb_enu) const { +#if USE_GLOG_AND_GFLAGS const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag plot_position_test has been set to TRUE,\n"; @@ -874,7 +1053,11 @@ void PositionSystemTest::print_results(const arma::mat& R_eb_enu) const Gnuplot::set_GNUPlotPath(gnuplot_path); Gnuplot g1("points"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g1.showonscreen(); // window output } @@ -895,7 +1078,11 @@ void PositionSystemTest::print_results(const arma::mat& R_eb_enu) const g1.cmd("set grid front"); g1.cmd("replot"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ptest.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ptest).empty()) +#endif { g1.savetops("Position_test_2D"); g1.savetopdf("Position_test_2D", 18); @@ -907,7 +1094,11 @@ void PositionSystemTest::print_results(const arma::mat& R_eb_enu) const } Gnuplot g2("points"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g2.showonscreen(); // window output } @@ -930,7 +1121,11 @@ void PositionSystemTest::print_results(const arma::mat& R_eb_enu) const std::to_string(ninty_sas) + "\n fx(v,u) = r*cos(v)*cos(u)\n fy(v,u) = r*cos(v)*sin(u)\n fz(v) = r*sin(v) \n splot fx(v,u),fy(v,u),fz(v) title \"90%-SAS\" lt rgb \"gray\"\n"); g2.plot_xyz(east, north, up, "3D Position Fixes"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ptest.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ptest).empty()) +#endif { g2.savetops("Position_test_3D"); g2.savetopdf("Position_test_3D"); @@ -951,20 +1146,33 @@ void PositionSystemTest::print_results(const arma::mat& R_eb_enu) const TEST_F(PositionSystemTest /*unused*/, Position_system_test /*unused*/) { +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ptest.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ptest).empty()) +#endif { // Configure the signal generator configure_generator(); // Generate signal raw signal samples and observations RINEX file + +#if USE_GLOG_AND_GFLAGS if (!FLAGS_disable_generator) +#else + if (!absl::GetFlag(FLAGS_disable_generator)) +#endif { generate_signal(); } } else { +#if USE_GLOG_AND_GFLAGS config_filename_no_extension = FLAGS_config_file_ptest.substr(FLAGS_config_file_ptest.find_last_of("/\\") + 1); +#else + config_filename_no_extension = absl::GetFlag(FLAGS_config_file_ptest).substr(absl::GetFlag(FLAGS_config_file_ptest).find_last_of("/\\") + 1); +#endif config_filename_no_extension = config_filename_no_extension.erase(config_filename_no_extension.length() - 5); } @@ -991,8 +1199,15 @@ int main(int argc, char** argv) { } // catch the "testing::internal::::ClassUniqueToAlwaysTrue" from gtest +#if USE_GLOG_AND_GFLAGS gflags::ParseCommandLineFlags(&argc, &argv, true); google::InitGoogleLogging(argv[0]); +#else + absl::ParseCommandLine(argc, argv); + absl::LogSink* logSink = new PositionTestLogSink; + absl::AddLogSink(logSink); + absl::InitializeLog(); +#endif // Run the Tests try @@ -1003,6 +1218,10 @@ int main(int argc, char** argv) { LOG(WARNING) << "Unexpected catch"; } +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#else + absl::FlushLogSinks(); +#endif return res; } diff --git a/src/tests/system-tests/ttff.cc b/src/tests/system-tests/ttff.cc index 55f0698cf..ebaebee55 100644 --- a/src/tests/system-tests/ttff.cc +++ b/src/tests/system-tests/ttff.cc @@ -26,12 +26,11 @@ #include #include #include -#include -#include #include #include #include #include +#include #include #include #include @@ -41,19 +40,37 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#include #if GFLAGS_OLD_NAMESPACE namespace gflags { using namespace google; } #endif +#else +#include +#include +#include +#endif + +#if USE_GLOG_AND_GFLAGS DEFINE_int32(fs_in, 4000000, "Sampling rate, in Samples/s"); DEFINE_int32(max_measurement_duration, 90, "Maximum time waiting for a position fix, in seconds"); DEFINE_int32(num_measurements, 2, "Number of measurements"); DEFINE_string(device_address, "192.168.40.2", "USRP device IP address"); DEFINE_string(subdevice, "A:0", "USRP subdevice"); DEFINE_string(config_file_ttff, std::string(""), "File containing the configuration parameters for the TTFF test."); +#else +ABSL_FLAG(int32_t, fs_in, 4000000, "Sampling rate, in Samples/s"); +ABSL_FLAG(int32_t, max_measurement_duration, 90, "Maximum time waiting for a position fix, in seconds"); +ABSL_FLAG(int32_t, num_measurements, 2, "Number of measurements"); +ABSL_FLAG(std::string, device_address, "192.168.40.2", "USRP device IP address"); +ABSL_FLAG(std::string, subdevice, "A:0", "USRP subdevice"); +ABSL_FLAG(std::string, config_file_ttff, std::string(""), "File containing the configuration parameters for the TTFF test."); +#endif // For GPS NAVIGATION (L1) Concurrent_Queue global_gps_acq_assist_queue; @@ -121,8 +138,11 @@ void TtffTest::config_1() { config = std::make_shared(); +#if USE_GLOG_AND_GFLAGS config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(FLAGS_fs_in)); +#else +#endif // Set the assistance system parameters config->set_property("GNSS-SDR.SUPL_gps_ephemeris_server", "supl.google.com"); config->set_property("GNSS-SDR.SUPL_gps_ephemeris_port", std::to_string(7275)); @@ -137,11 +157,15 @@ void TtffTest::config_1() config->set_property("SignalSource.item_type", "cshort"); config->set_property("SignalSource.implementation", "UHD_Signal_Source"); config->set_property("SignalSource.freq", std::to_string(central_freq)); - config->set_property("SignalSource.sampling_frequency", std::to_string(FLAGS_fs_in)); config->set_property("SignalSource.gain", std::to_string(gain_dB)); +#if USE_GLOG_AND_GFLAGS + config->set_property("SignalSource.sampling_frequency", std::to_string(FLAGS_fs_in)); config->set_property("SignalSource.subdevice", FLAGS_subdevice); config->set_property("SignalSource.samples", std::to_string(FLAGS_fs_in * FLAGS_max_measurement_duration)); config->set_property("SignalSource.device_address", FLAGS_device_address); +#else + +#endif // Set the Signal Conditioner config->set_property("SignalConditioner.implementation", "Signal_Conditioner"); @@ -166,13 +190,21 @@ void TtffTest::config_1() config->set_property("InputFilter.band2_error", std::to_string(band2_error)); config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", std::to_string(grid_density)); +#if USE_GLOG_AND_GFLAGS config->set_property("InputFilter.sampling_frequency", std::to_string(FLAGS_fs_in)); +#else + +#endif config->set_property("InputFilter.IF", std::to_string(zero)); config->set_property("Resampler.implementation", "Pass_Through"); config->set_property("Resampler.dump", "false"); config->set_property("Resampler.item_type", "gr_complex"); +#if USE_GLOG_AND_GFLAGS config->set_property("Resampler.sample_freq_in", std::to_string(FLAGS_fs_in)); config->set_property("Resampler.sample_freq_out", std::to_string(FLAGS_fs_in)); +#else + +#endif // Set the number of Channels config->set_property("Channels_1C.count", std::to_string(number_of_channels)); @@ -228,6 +260,7 @@ void TtffTest::config_1() void TtffTest::config_2() { +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ttff.empty()) { std::string path = std::string(TEST_PATH); @@ -242,6 +275,9 @@ void TtffTest::config_2() int d_sampling_rate; d_sampling_rate = config2->property("GNSS-SDR.internal_fs_sps", FLAGS_fs_in); config2->set_property("SignalSource.samples", std::to_string(d_sampling_rate * FLAGS_max_measurement_duration)); +#else + +#endif } @@ -377,7 +413,12 @@ void TtffTest::print_TTFF_report(const std::vector &ttff_v, const std::s { stm << "Disabled.\n"; } +#if USE_GLOG_AND_GFLAGS stm << "Valid measurements (" << ttff.size() << "/" << FLAGS_num_measurements << "): "; +#else + stm << "Valid measurements (" << ttff.size() << "/" << absl::GetFlag(FLAGS_num_measurements) << "): "; +#endif + for (double ttff_ : ttff) { stm << ttff_ << " "; @@ -427,12 +468,19 @@ TEST_F(TtffTest /*unused*/, ColdStart /*unused*/) config2->set_property("GNSS-SDR.SUPL_gps_enabled", "false"); config2->set_property("GNSS-SDR.SUPL_read_gps_assistance_xml", "false"); config2->set_property("PVT.flag_rtcm_server", "false"); - +#if USE_GLOG_AND_GFLAGS for (int n = 0; n < FLAGS_num_measurements; n++) +#else + for (int n = 0; n < absl::GetFlag(FLAGS_num_measurements); n++) +#endif { // Create a new ControlThread object with a smart pointer std::shared_ptr control_thread; +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ttff.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ttff).empty()) +#endif { control_thread = std::make_shared(config); } @@ -441,8 +489,13 @@ TEST_F(TtffTest /*unused*/, ColdStart /*unused*/) control_thread = std::make_shared(config2); } - // record startup time + // record startup time +#if USE_GLOG_AND_GFLAGS std::cout << "Starting measurement " << num_measurements + 1 << " / " << FLAGS_num_measurements << '\n'; +#else + std::cout << "Starting measurement " << num_measurements + 1 << " / " << absl::GetFlag(FLAGS_num_measurements) << '\n'; + +#endif std::chrono::time_point start; std::chrono::time_point end; start = std::chrono::system_clock::now(); @@ -470,7 +523,11 @@ TEST_F(TtffTest /*unused*/, ColdStart /*unused*/) num_measurements = num_measurements + 1; std::cout << "Just finished measurement " << num_measurements << ", which took " << ttff << " seconds.\n"; +#if USE_GLOG_AND_GFLAGS if (n < FLAGS_num_measurements - 1) +#else + if (n < absl::GetFlag(FLAGS_num_measurements) - 1) +#endif { std::random_device r; std::default_random_engine e1(r()); @@ -484,8 +541,13 @@ TEST_F(TtffTest /*unused*/, ColdStart /*unused*/) } } - // Print TTFF report + // Print TTFF report + +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ttff.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ttff).empty()) +#endif { print_TTFF_report(TTFF_v, config); } @@ -513,11 +575,19 @@ TEST_F(TtffTest /*unused*/, HotStart /*unused*/) config2->set_property("GNSS-SDR.SUPL_read_gps_assistance_xml", "true"); config2->set_property("PVT.flag_rtcm_server", "false"); +#if USE_GLOG_AND_GFLAGS for (int n = 0; n < FLAGS_num_measurements; n++) +#else + for (int n = 0; n < absl::GetFlag(FLAGS_num_measurements); n++) +#endif { // Create a new ControlThread object with a smart pointer std::shared_ptr control_thread; +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ttff.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ttff).empty()) +#endif { control_thread = std::make_shared(config); } @@ -525,8 +595,12 @@ TEST_F(TtffTest /*unused*/, HotStart /*unused*/) { control_thread = std::make_shared(config2); } - // record startup time + // record startup time +#if USE_GLOG_AND_GFLAGS std::cout << "Starting measurement " << num_measurements + 1 << " / " << FLAGS_num_measurements << '\n'; +#else + std::cout << "Starting measurement " << num_measurements + 1 << " / " << absl::GetFlag(FLAGS_num_measurements) << '\n'; +#endif std::chrono::time_point start; std::chrono::time_point end; start = std::chrono::system_clock::now(); @@ -555,7 +629,11 @@ TEST_F(TtffTest /*unused*/, HotStart /*unused*/) num_measurements = num_measurements + 1; std::cout << "Just finished measurement " << num_measurements << ", which took " << ttff << " seconds.\n"; +#if USE_GLOG_AND_GFLAGS if (n < FLAGS_num_measurements - 1) +#else + if (n < absl::GetFlag(FLAGS_num_measurements) - 1) +#endif { std::random_device r; std::default_random_engine e1(r()); @@ -569,8 +647,13 @@ TEST_F(TtffTest /*unused*/, HotStart /*unused*/) } } - // Print TTFF report + // Print TTFF report + +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ttff.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ttff).empty()) +#endif { print_TTFF_report(TTFF_v, config); } @@ -594,8 +677,12 @@ int main(int argc, char **argv) { } // catch the "testing::internal::::ClassUniqueToAlwaysTrue" from gtest +#if USE_GLOG_AND_GFLAGS gflags::ParseCommandLineFlags(&argc, &argv, true); google::InitGoogleLogging(argv[0]); +#else + absl::ParseCommandLine(argc, argv); +#endif // Start queue thread std::thread receive_msg_thread(receive_msg); @@ -629,6 +716,8 @@ int main(int argc, char **argv) receive_msg_thread.join(); msgctl(sysv_msqid, IPC_RMID, nullptr); +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return res; } diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index 3769756aa..991495070 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -18,19 +18,58 @@ #include "concurrent_map.h" #include "concurrent_queue.h" #include "gps_acq_assist.h" +#include +#include +#include +#include +#include + +#if USE_GLOG_AND_GFLAGS #include #include -#include -#include - #if GFLAGS_OLD_NAMESPACE namespace gflags { using namespace google; } +DECLARE_string(log_dir); +#endif +#else +#include "gnss_sdr_flags.h" +#include +#include +#include +#include +#include +#include +#include + +class TestingLogSink : public absl::LogSink +{ +public: + TestingLogSink() + { + if (!absl::GetFlag(FLAGS_log_dir).empty()) + { + filename = std::string(absl::GetFlag(FLAGS_log_dir) + "/run_tests.log"); + } + else + { + filename = std::string(GetTempDir() + "/run_tests.log"); + } + logfile.open(filename); + } + void Send(const absl::LogEntry &entry) override + { + logfile << entry.text_message_with_prefix_and_newline() << std::flush; + } + +private: + std::ofstream logfile; + std::string filename; +}; #endif -DECLARE_string(log_dir); #if UNIT_TESTING_MINIMAL #include "unit-tests/arithmetic/matio_test.cc" @@ -174,8 +213,16 @@ int main(int argc, char **argv) catch (...) { } // catch the "testing::internal::::ClassUniqueToAlwaysTrue" from gtest +#if USE_GLOG_AND_GFLAGS gflags::ParseCommandLineFlags(&argc, &argv, true); google::InitGoogleLogging(argv[0]); +#else + absl::ParseCommandLine(argc, argv); + absl::LogSink *testLogSink = new TestingLogSink; + absl::AddLogSink(testLogSink); + // absl::SetMinLogLevel(absl::LogSeverityAtLeast::kInfinity); + absl::InitializeLog(); +#endif try { res = RUN_ALL_TESTS(); @@ -184,6 +231,10 @@ int main(int argc, char **argv) { LOG(WARNING) << "Unexpected catch"; } +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#else + absl::FlushLogSinks(); +#endif return res; } diff --git a/src/tests/unit-tests/arithmetic/complex_carrier_test.cc b/src/tests/unit-tests/arithmetic/complex_carrier_test.cc index 19a4ba37c..0504b543b 100644 --- a/src/tests/unit-tests/arithmetic/complex_carrier_test.cc +++ b/src/tests/unit-tests/arithmetic/complex_carrier_test.cc @@ -20,16 +20,23 @@ #include #include #include +#include - +#if USE_GLOG_AND_GFLAGS DEFINE_int32(size_carrier_test, 100000, "Size of the arrays used for complex carrier testing"); - +#else +ABSL_FLAG(int32_t, size_carrier_test, 100000, "Size of the arrays used for complex carrier testing"); +#endif TEST(ComplexCarrierTest, StandardComplexImplementation) { - // Dynamic allocation creates new usable space on the program STACK - // (an area of RAM specifically allocated to the program) +// Dynamic allocation creates new usable space on the program STACK +// (an area of RAM specifically allocated to the program) +#if USE_GLOG_AND_GFLAGS auto* output = new std::complex[FLAGS_size_carrier_test]; +#else + auto* output = new std::complex[absl::GetFlag(FLAGS_size_carrier_test)]; +#endif const double _f = 2000.0; const double _fs = 2000000.0; const auto phase_step = (TWO_PI * _f) / _fs; @@ -37,8 +44,11 @@ TEST(ComplexCarrierTest, StandardComplexImplementation) std::chrono::time_point start, end; start = std::chrono::system_clock::now(); - +#if USE_GLOG_AND_GFLAGS for (int i = 0; i < FLAGS_size_carrier_test; i++) +#else + for (int i = 0; i < absl::GetFlag(FLAGS_size_carrier_test); i++) +#endif { output[i] = std::complex(cos(phase), sin(phase)); phase += phase_step; @@ -46,18 +56,32 @@ TEST(ComplexCarrierTest, StandardComplexImplementation) end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; + +#if USE_GLOG_AND_GFLAGS std::cout << "A " << FLAGS_size_carrier_test +#else + std::cout << "A " << absl::GetFlag(FLAGS_size_carrier_test) +#endif << "-length complex carrier in standard C++ (dynamic allocation) generated in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; std::complex expected(1, 0); +#if USE_GLOG_AND_GFLAGS std::vector> mag(FLAGS_size_carrier_test); for (int i = 0; i < FLAGS_size_carrier_test; i++) +#else + std::vector> mag(absl::GetFlag(FLAGS_size_carrier_test)); + for (int i = 0; i < absl::GetFlag(FLAGS_size_carrier_test); i++) +#endif { mag[i] = output[i] * std::conj(output[i]); } delete[] output; +#if USE_GLOG_AND_GFLAGS for (int i = 0; i < FLAGS_size_carrier_test; i++) +#else + for (int i = 0; i < absl::GetFlag(FLAGS_size_carrier_test); i++) +#endif { ASSERT_FLOAT_EQ(std::norm(expected), std::norm(mag[i])); } @@ -69,7 +93,12 @@ TEST(ComplexCarrierTest, StandardComplexImplementation) TEST(ComplexCarrierTest, C11ComplexImplementation) { // declaration: load data onto the program data segment + +#if USE_GLOG_AND_GFLAGS std::vector> output(FLAGS_size_carrier_test); +#else + std::vector> output(absl::GetFlag(FLAGS_size_carrier_test)); +#endif const double _f = 2000.0; const double _fs = 2000000.0; const auto phase_step = (TWO_PI * _f) / _fs; @@ -78,20 +107,34 @@ TEST(ComplexCarrierTest, C11ComplexImplementation) std::chrono::time_point start, end; start = std::chrono::system_clock::now(); +#if USE_GLOG_AND_GFLAGS for (int i = 0; i < FLAGS_size_carrier_test; i++) +#else + for (int i = 0; i < absl::GetFlag(FLAGS_size_carrier_test); i++) +#endif { output[i] = std::complex(cos(phase), sin(phase)); phase += phase_step; } end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; + +#if USE_GLOG_AND_GFLAGS std::cout << "A " << FLAGS_size_carrier_test +#else + std::cout << "A " << absl::GetFlag(FLAGS_size_carrier_test) +#endif << "-length complex carrier in standard C++ (declaration) generated in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); std::complex expected(1, 0); +#if USE_GLOG_AND_GFLAGS std::vector> mag(FLAGS_size_carrier_test); for (int i = 0; i < FLAGS_size_carrier_test; i++) +#else + std::vector> mag(absl::GetFlag(FLAGS_size_carrier_test)); + for (int i = 0; i < absl::GetFlag(FLAGS_size_carrier_test); i++) +#endif { mag[i] = output[i] * std::conj(output[i]); ASSERT_FLOAT_EQ(std::norm(expected), std::norm(mag[i])); @@ -101,8 +144,11 @@ TEST(ComplexCarrierTest, C11ComplexImplementation) TEST(ComplexCarrierTest, OwnComplexImplementation) { +#if USE_GLOG_AND_GFLAGS std::vector> output(FLAGS_size_carrier_test); - +#else + std::vector> output(absl::GetFlag(FLAGS_size_carrier_test)); +#endif double _f = 2000.0; double _fs = 2000000.0; std::chrono::time_point start, end; @@ -112,18 +158,31 @@ TEST(ComplexCarrierTest, OwnComplexImplementation) end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "A " << FLAGS_size_carrier_test +#else + std::cout << "A " << absl::GetFlag(FLAGS_size_carrier_test) +#endif << "-length complex carrier using fixed point generated in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; std::complex expected(1, 0); + +#if USE_GLOG_AND_GFLAGS std::vector> mag(FLAGS_size_carrier_test); for (int i = 0; i < FLAGS_size_carrier_test; i++) +#else + std::vector> mag(absl::GetFlag(FLAGS_size_carrier_test)); + for (int i = 0; i < absl::GetFlag(FLAGS_size_carrier_test); i++) +#endif { mag[i] = output[i] * std::conj(output[i]); } - +#if USE_GLOG_AND_GFLAGS for (int i = 0; i < FLAGS_size_carrier_test; i++) +#else + for (int i = 0; i < absl::GetFlag(FLAGS_size_carrier_test); i++) +#endif { ASSERT_NEAR(std::norm(expected), std::norm(mag[i]), 0.0001); } diff --git a/src/tests/unit-tests/arithmetic/conjugate_test.cc b/src/tests/unit-tests/arithmetic/conjugate_test.cc index 1fadedfed..2a72656f1 100644 --- a/src/tests/unit-tests/arithmetic/conjugate_test.cc +++ b/src/tests/unit-tests/arithmetic/conjugate_test.cc @@ -23,26 +23,42 @@ #include #include +#if USE_GLOG_AND_GFLAGS DEFINE_int32(size_conjugate_test, 100000, "Size of the arrays used for conjugate testing"); +#else +ABSL_FLAG(int32_t, size_conjugate_test, 100000, "Size of the arrays used for conjugate testing"); +#endif TEST(ConjugateTest, StandardCComplexImplementation) { +#if USE_GLOG_AND_GFLAGS auto* input = new std::complex[FLAGS_size_conjugate_test]; auto* output = new std::complex[FLAGS_size_conjugate_test]; std::fill_n(input, FLAGS_size_conjugate_test, std::complex(0.0, 0.0)); - +#else + auto* input = new std::complex[absl::GetFlag(FLAGS_size_conjugate_test)]; + auto* output = new std::complex[absl::GetFlag(FLAGS_size_conjugate_test)]; + std::fill_n(input, absl::GetFlag(FLAGS_size_conjugate_test), std::complex(0.0, 0.0)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); - +#if USE_GLOG_AND_GFLAGS for (int i = 0; i < FLAGS_size_conjugate_test; i++) +#else + for (int i = 0; i < absl::GetFlag(FLAGS_size_conjugate_test); i++) +#endif { output[i] = std::conj(input[i]); } end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "Conjugate of a " << FLAGS_size_conjugate_test +#else + std::cout << "Conjugate of a " << absl::GetFlag(FLAGS_size_conjugate_test) +#endif << "-length complex float vector in standard C finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; @@ -54,8 +70,13 @@ TEST(ConjugateTest, StandardCComplexImplementation) TEST(ConjugateTest, C11ComplexImplementation) { +#if USE_GLOG_AND_GFLAGS const std::vector> input(FLAGS_size_conjugate_test); std::vector> output(FLAGS_size_conjugate_test); +#else + const std::vector> input(absl::GetFlag(FLAGS_size_conjugate_test)); + std::vector> output(absl::GetFlag(FLAGS_size_conjugate_test)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); int pos = 0; @@ -65,7 +86,11 @@ TEST(ConjugateTest, C11ComplexImplementation) } end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "Conjugate of a " << FLAGS_size_conjugate_test +#else + std::cout << "Conjugate of a " << absl::GetFlag(FLAGS_size_conjugate_test) +#endif << " complex vector (C++11-style) finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); @@ -82,9 +107,13 @@ TEST(ConjugateTest, C11ComplexImplementation) TEST(ConjugateTest, ArmadilloComplexImplementation) { +#if USE_GLOG_AND_GFLAGS arma::cx_fvec input(FLAGS_size_conjugate_test, arma::fill::zeros); arma::cx_fvec output(FLAGS_size_conjugate_test); - +#else + arma::cx_fvec input(absl::GetFlag(FLAGS_size_conjugate_test), arma::fill::zeros); + arma::cx_fvec output(absl::GetFlag(FLAGS_size_conjugate_test)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); @@ -92,7 +121,12 @@ TEST(ConjugateTest, ArmadilloComplexImplementation) end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; + +#if USE_GLOG_AND_GFLAGS std::cout << "Conjugate of a " << FLAGS_size_conjugate_test +#else + std::cout << "Conjugate of a " << absl::GetFlag(FLAGS_size_conjugate_test) +#endif << "-length complex float Armadillo vector finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); @@ -101,18 +135,29 @@ TEST(ConjugateTest, ArmadilloComplexImplementation) TEST(ConjugateTest, VolkComplexImplementation) { +#if USE_GLOG_AND_GFLAGS auto* input = static_cast*>(volk_gnsssdr_malloc(FLAGS_size_conjugate_test * sizeof(std::complex), volk_gnsssdr_get_alignment())); auto* output = static_cast*>(volk_gnsssdr_malloc(FLAGS_size_conjugate_test * sizeof(std::complex), volk_gnsssdr_get_alignment())); std::fill_n(input, FLAGS_size_conjugate_test, std::complex(0.0, 0.0)); - +#else + auto* input = static_cast*>(volk_gnsssdr_malloc(absl::GetFlag(FLAGS_size_conjugate_test) * sizeof(std::complex), volk_gnsssdr_get_alignment())); + auto* output = static_cast*>(volk_gnsssdr_malloc(absl::GetFlag(FLAGS_size_conjugate_test) * sizeof(std::complex), volk_gnsssdr_get_alignment())); + std::fill_n(input, absl::GetFlag(FLAGS_size_conjugate_test), std::complex(0.0, 0.0)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); - +#if USE_GLOG_AND_GFLAGS volk_32fc_conjugate_32fc(output, input, FLAGS_size_conjugate_test); - +#else + volk_32fc_conjugate_32fc(output, input, absl::GetFlag(FLAGS_size_conjugate_test)); +#endif end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "Conjugate of a " << FLAGS_size_conjugate_test +#else + std::cout << "Conjugate of a " << absl::GetFlag(FLAGS_size_conjugate_test) +#endif << "-length complex float vector using VOLK finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); @@ -123,17 +168,27 @@ TEST(ConjugateTest, VolkComplexImplementation) TEST(ConjugateTest, VolkComplexImplementationAlloc) { +#if USE_GLOG_AND_GFLAGS volk_gnsssdr::vector> input(FLAGS_size_conjugate_test, std::complex(0.0, 0.0)); volk_gnsssdr::vector> output(FLAGS_size_conjugate_test); - +#else + volk_gnsssdr::vector> input(absl::GetFlag(FLAGS_size_conjugate_test), std::complex(0.0, 0.0)); + volk_gnsssdr::vector> output(absl::GetFlag(FLAGS_size_conjugate_test)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); - +#if USE_GLOG_AND_GFLAGS volk_32fc_conjugate_32fc(output.data(), input.data(), FLAGS_size_conjugate_test); - +#else + volk_32fc_conjugate_32fc(output.data(), input.data(), absl::GetFlag(FLAGS_size_conjugate_test)); +#endif end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "Conjugate of a " << FLAGS_size_conjugate_test +#else + std::cout << "Conjugate of a " << absl::GetFlag(FLAGS_size_conjugate_test) +#endif << "-length complex float vector using VOLK ALLOC finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); diff --git a/src/tests/unit-tests/arithmetic/fft_length_test.cc b/src/tests/unit-tests/arithmetic/fft_length_test.cc index 8ad39a141..fb937de89 100644 --- a/src/tests/unit-tests/arithmetic/fft_length_test.cc +++ b/src/tests/unit-tests/arithmetic/fft_length_test.cc @@ -24,9 +24,13 @@ #include #include - +#if USE_GLOG_AND_GFLAGS DEFINE_int32(fft_iterations_test, 1000, "Number of averaged iterations in FFT length timing test"); DEFINE_bool(plot_fft_length_test, false, "Plots results of FFTLengthTest with gnuplot"); +#else +ABSL_FLAG(int32_t, fft_iterations_test, 1000, "Number of averaged iterations in FFT length timing test"); +ABSL_FLAG(bool, plot_fft_length_test, false, "Plots results of FFTLengthTest with gnuplot"); +#endif // Note from FFTW documentation: the standard FFTW distribution works most efficiently for arrays whose // size can be factored into small primes (2, 3, 5, and 7), and otherwise it uses a slower general-purpose routine. @@ -63,13 +67,21 @@ TEST(FFTLengthTest, MeasureExecutionTime) std::generate_n(d_fft->get_inbuf(), d_fft_size, gen); start = std::chrono::system_clock::now(); +#if USE_GLOG_AND_GFLAGS for (int k = 0; k < FLAGS_fft_iterations_test; k++) +#else + for (int k = 0; k < absl::GetFlag(FLAGS_fft_iterations_test); k++) +#endif { d_fft->execute(); } end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS double exec_time = elapsed_seconds.count() / static_cast(FLAGS_fft_iterations_test); +#else + double exec_time = elapsed_seconds.count() / static_cast(absl::GetFlag(FLAGS_fft_iterations_test)); +#endif execution_times.push_back(exec_time * 1e3); std::cout << "FFT execution time for length=" << d_fft_size << " : " << exec_time << " [s]\n"; @@ -79,10 +91,15 @@ TEST(FFTLengthTest, MeasureExecutionTime) execution_times_powers_of_two.push_back(exec_time / 1e-3); } }); - +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_fft_length_test == true) { const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + if (absl::GetFlag(FLAGS_plot_fft_length_test) == true) + { + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag plot_fft_length_test has been set to TRUE,\n"; @@ -99,7 +116,11 @@ TEST(FFTLengthTest, MeasureExecutionTime) Gnuplot::set_GNUPlotPath(gnuplot_path); Gnuplot g1("linespoints"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g1.showonscreen(); // window output } @@ -111,13 +132,21 @@ TEST(FFTLengthTest, MeasureExecutionTime) g1.set_grid(); g1.set_xlabel("FFT length"); g1.set_ylabel("Execution time [ms]"); +#if USE_GLOG_AND_GFLAGS g1.plot_xy(fft_sizes_v, execution_times, "FFT execution time (averaged over " + std::to_string(FLAGS_fft_iterations_test) + " iterations)"); +#else + g1.plot_xy(fft_sizes_v, execution_times, "FFT execution time (averaged over " + std::to_string(absl::GetFlag(FLAGS_fft_iterations_test)) + " iterations)"); +#endif g1.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2"); g1.savetops("FFT_execution_times_extended"); g1.savetopdf("FFT_execution_times_extended", 18); Gnuplot g2("linespoints"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g2.showonscreen(); // window output } @@ -130,11 +159,20 @@ TEST(FFTLengthTest, MeasureExecutionTime) g2.set_xlabel("FFT length"); g2.set_ylabel("Execution time [ms]"); g2.set_xrange(0, 16384); +#if USE_GLOG_AND_GFLAGS g2.plot_xy(fft_sizes_v, execution_times, "FFT execution time (averaged over " + std::to_string(FLAGS_fft_iterations_test) + " iterations)"); +#else + g2.plot_xy(fft_sizes_v, execution_times, "FFT execution time (averaged over " + std::to_string(absl::GetFlag(FLAGS_fft_iterations_test)) + " iterations)"); +#endif + g2.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2"); g2.savetops("FFT_execution_times"); g2.savetopdf("FFT_execution_times", 18); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g2.showonscreen(); // window output } diff --git a/src/tests/unit-tests/arithmetic/fft_speed_test.cc b/src/tests/unit-tests/arithmetic/fft_speed_test.cc index 2fa477b81..6c3d28690 100644 --- a/src/tests/unit-tests/arithmetic/fft_speed_test.cc +++ b/src/tests/unit-tests/arithmetic/fft_speed_test.cc @@ -22,7 +22,11 @@ #include #include +#if USE_GLOG_AND_GFLAGS DEFINE_int32(fft_speed_iterations_test, 100, "Number of averaged iterations in FFT length timing test"); +#else +ABSL_FLAG(int32_t, fft_speed_iterations_test, 100, "Number of averaged iterations in FFT length timing test"); +#endif TEST(FFTSpeedTest, ArmadilloVSGNURadioExecutionTime) { @@ -43,23 +47,39 @@ TEST(FFTSpeedTest, ArmadilloVSGNURadioExecutionTime) std::copy_n(d_arma_fft.memptr(), d_fft_size, d_gr_fft->get_inbuf()); start = std::chrono::system_clock::now(); +#if USE_GLOG_AND_GFLAGS for (int k = 0; k < FLAGS_fft_speed_iterations_test; k++) +#else + for (int k = 0; k < absl::GetFlag(FLAGS_fft_speed_iterations_test); k++) +#endif { d_gr_fft->execute(); } end = std::chrono::system_clock::now(); elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS d_execution_time = elapsed_seconds.count() / static_cast(FLAGS_fft_speed_iterations_test); +#else + d_execution_time = elapsed_seconds.count() / static_cast(absl::GetFlag(FLAGS_fft_speed_iterations_test)); +#endif std::cout << "GNU Radio FFT execution time for length = " << d_fft_size << " : " << d_execution_time * 1e6 << " [us]\n"; start = std::chrono::system_clock::now(); +#if USE_GLOG_AND_GFLAGS for (int k = 0; k < FLAGS_fft_speed_iterations_test; k++) +#else + for (int k = 0; k < absl::GetFlag(FLAGS_fft_speed_iterations_test); k++) +#endif { d_arma_fft_result = arma::fft(d_arma_fft); } end = std::chrono::system_clock::now(); elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS d_execution_time = elapsed_seconds.count() / static_cast(FLAGS_fft_speed_iterations_test); +#else + d_execution_time = elapsed_seconds.count() / static_cast(absl::GetFlag(FLAGS_fft_speed_iterations_test)); +#endif std::cout << "Armadillo FFT execution time for length = " << d_fft_size << " : " << d_execution_time * 1e6 << " [us]\n"; }); } diff --git a/src/tests/unit-tests/arithmetic/magnitude_squared_test.cc b/src/tests/unit-tests/arithmetic/magnitude_squared_test.cc index 3611733f3..3287b51e2 100644 --- a/src/tests/unit-tests/arithmetic/magnitude_squared_test.cc +++ b/src/tests/unit-tests/arithmetic/magnitude_squared_test.cc @@ -24,29 +24,49 @@ #include #include +#if USE_GLOG_AND_GFLAGS DEFINE_int32(size_magnitude_test, 100000, "Size of the arrays used for magnitude testing"); - +#else +ABSL_FLAG(int32_t, size_magnitude_test, 100000, "Size of the arrays used for magnitude testing"); +#endif TEST(MagnitudeSquaredTest, StandardCComplexImplementation) { +#if USE_GLOG_AND_GFLAGS auto* input = new std::complex[FLAGS_size_magnitude_test]; auto* output = new float[FLAGS_size_magnitude_test]; +#else + auto* input = new std::complex[absl::GetFlag(FLAGS_size_magnitude_test)]; + auto* output = new float[absl::GetFlag(FLAGS_size_magnitude_test)]; +#endif unsigned int number = 0; +#if USE_GLOG_AND_GFLAGS for (number = 0; number < static_cast(FLAGS_size_magnitude_test); number++) +#else + for (number = 0; number < static_cast(absl::GetFlag(FLAGS_size_magnitude_test)); number++) +#endif { input[number] = std::complex(0.0, 0.0); } std::chrono::time_point start, end; start = std::chrono::system_clock::now(); - +#if USE_GLOG_AND_GFLAGS for (number = 0; number < static_cast(FLAGS_size_magnitude_test); number++) +#else + for (number = 0; number < static_cast(absl::GetFlag(FLAGS_size_magnitude_test)); number++) +#endif { output[number] = (input[number].real() * input[number].real()) + (input[number].imag() * input[number].imag()); } end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; + +#if USE_GLOG_AND_GFLAGS std::cout << "The squared magnitude of a " << FLAGS_size_magnitude_test +#else + std::cout << "The squared magnitude of a " << absl::GetFlag(FLAGS_size_magnitude_test) +#endif << "-length complex vector in standard C computed in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; delete[] input; @@ -57,8 +77,13 @@ TEST(MagnitudeSquaredTest, StandardCComplexImplementation) TEST(MagnitudeSquaredTest, C11ComplexImplementation) { +#if USE_GLOG_AND_GFLAGS const std::vector> input(FLAGS_size_magnitude_test); std::vector output(FLAGS_size_magnitude_test); +#else + const std::vector> input(absl::GetFlag(FLAGS_size_magnitude_test)); + std::vector output(absl::GetFlag(FLAGS_size_magnitude_test)); +#endif int pos = 0; std::chrono::time_point start, end; start = std::chrono::system_clock::now(); @@ -70,7 +95,12 @@ TEST(MagnitudeSquaredTest, C11ComplexImplementation) end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; + +#if USE_GLOG_AND_GFLAGS std::cout << "The squared magnitude of a " << FLAGS_size_magnitude_test +#else + std::cout << "The squared magnitude of a " << absl::GetFlag(FLAGS_size_magnitude_test) +#endif << " complex vector (C++11-style) finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); @@ -87,8 +117,13 @@ TEST(MagnitudeSquaredTest, C11ComplexImplementation) TEST(MagnitudeSquaredTest, ArmadilloComplexImplementation) { +#if USE_GLOG_AND_GFLAGS arma::cx_fvec input(FLAGS_size_magnitude_test, arma::fill::zeros); arma::fvec output(FLAGS_size_magnitude_test); +#else + arma::cx_fvec input(absl::GetFlag(FLAGS_size_magnitude_test), arma::fill::zeros); + arma::fvec output(absl::GetFlag(FLAGS_size_magnitude_test)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); @@ -96,7 +131,12 @@ TEST(MagnitudeSquaredTest, ArmadilloComplexImplementation) end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; + +#if USE_GLOG_AND_GFLAGS std::cout << "The squared magnitude of a " << FLAGS_size_magnitude_test +#else + std::cout << "The squared magnitude of a " << absl::GetFlag(FLAGS_size_magnitude_test) +#endif << "-length vector using Armadillo computed in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); @@ -105,17 +145,31 @@ TEST(MagnitudeSquaredTest, ArmadilloComplexImplementation) TEST(MagnitudeSquaredTest, VolkComplexImplementation) { +#if USE_GLOG_AND_GFLAGS auto* input = static_cast*>(volk_gnsssdr_malloc(FLAGS_size_magnitude_test * sizeof(std::complex), volk_gnsssdr_get_alignment())); std::fill_n(input, FLAGS_size_magnitude_test, std::complex(0.0, 0.0)); auto* output = static_cast(volk_gnsssdr_malloc(FLAGS_size_magnitude_test * sizeof(float), volk_gnsssdr_get_alignment())); +#else + auto* input = static_cast*>(volk_gnsssdr_malloc(absl::GetFlag(FLAGS_size_magnitude_test) * sizeof(std::complex), volk_gnsssdr_get_alignment())); + std::fill_n(input, absl::GetFlag(FLAGS_size_magnitude_test), std::complex(0.0, 0.0)); + auto* output = static_cast(volk_gnsssdr_malloc(absl::GetFlag(FLAGS_size_magnitude_test) * sizeof(float), volk_gnsssdr_get_alignment())); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); +#if USE_GLOG_AND_GFLAGS volk_32fc_magnitude_squared_32f(output, input, static_cast(FLAGS_size_magnitude_test)); - +#else + volk_32fc_magnitude_squared_32f(output, input, static_cast(absl::GetFlag(FLAGS_size_magnitude_test))); +#endif end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; + +#if USE_GLOG_AND_GFLAGS std::cout << "The squared magnitude of a " << FLAGS_size_magnitude_test +#else + std::cout << "The squared magnitude of a " << absl::GetFlag(FLAGS_size_magnitude_test) +#endif << "-length vector using VOLK computed in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; volk_gnsssdr_free(input); @@ -126,18 +180,30 @@ TEST(MagnitudeSquaredTest, VolkComplexImplementation) TEST(MagnitudeSquaredTest, VolkComplexImplementationAlloc) { +#if USE_GLOG_AND_GFLAGS volk_gnsssdr::vector> input(FLAGS_size_magnitude_test); // or: input(FLAGS_size_magnitude_test, std::complex(0.0, 0.0)); std::fill_n(input.begin(), FLAGS_size_magnitude_test, std::complex(0.0, 0.0)); volk_gnsssdr::vector output(FLAGS_size_magnitude_test); +#else + volk_gnsssdr::vector> input(absl::GetFlag(FLAGS_size_magnitude_test)); + std::fill_n(input.begin(), absl::GetFlag(FLAGS_size_magnitude_test), std::complex(0.0, 0.0)); + volk_gnsssdr::vector output(absl::GetFlag(FLAGS_size_magnitude_test)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); - +#if USE_GLOG_AND_GFLAGS volk_32fc_magnitude_squared_32f(output.data(), input.data(), static_cast(FLAGS_size_magnitude_test)); - +#else + volk_32fc_magnitude_squared_32f(output.data(), input.data(), static_cast(absl::GetFlag(FLAGS_size_magnitude_test))); +#endif end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "The squared magnitude of a " << FLAGS_size_magnitude_test +#else + std::cout << "The squared magnitude of a " << absl::GetFlag(FLAGS_size_magnitude_test) +#endif << "-length vector using VOLK ALLOC computed in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); diff --git a/src/tests/unit-tests/arithmetic/multiply_test.cc b/src/tests/unit-tests/arithmetic/multiply_test.cc index bb47dac58..cc0f7acd6 100644 --- a/src/tests/unit-tests/arithmetic/multiply_test.cc +++ b/src/tests/unit-tests/arithmetic/multiply_test.cc @@ -24,31 +24,51 @@ #include #include +#if USE_GLOG_AND_GFLAGS DEFINE_int32(size_multiply_test, 100000, "Size of the arrays used for multiply testing"); - +#else +ABSL_FLAG(int32_t, size_multiply_test, 100000, "Size of the arrays used for multiply testing"); +#endif TEST(MultiplyTest, StandardCDoubleImplementation) { +#if USE_GLOG_AND_GFLAGS auto* input = new double[FLAGS_size_multiply_test]; auto* output = new double[FLAGS_size_multiply_test]; std::fill_n(input, FLAGS_size_multiply_test, 0.0); +#else + auto* input = new double[absl::GetFlag(FLAGS_size_multiply_test)]; + auto* output = new double[absl::GetFlag(FLAGS_size_multiply_test)]; + std::fill_n(input, absl::GetFlag(FLAGS_size_multiply_test), 0.0); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); - +#if USE_GLOG_AND_GFLAGS for (int i = 0; i < FLAGS_size_multiply_test; i++) +#else + for (int i = 0; i < absl::GetFlag(FLAGS_size_multiply_test); i++) +#endif { output[i] = input[i] * input[i]; } end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "Element-wise multiplication of " << FLAGS_size_multiply_test +#else + std::cout << "Element-wise multiplication of " << absl::GetFlag(FLAGS_size_multiply_test) +#endif << " doubles in standard C finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; double acc = 0.0; double expected = 0.0; +#if USE_GLOG_AND_GFLAGS for (int i = 0; i < FLAGS_size_multiply_test; i++) +#else + for (int i = 0; i < absl::GetFlag(FLAGS_size_multiply_test); i++) +#endif { acc += output[i]; } @@ -61,9 +81,13 @@ TEST(MultiplyTest, StandardCDoubleImplementation) TEST(MultiplyTest, ArmadilloImplementation) { +#if USE_GLOG_AND_GFLAGS arma::vec input(FLAGS_size_multiply_test, arma::fill::zeros); arma::vec output(FLAGS_size_multiply_test); - +#else + arma::vec input(absl::GetFlag(FLAGS_size_multiply_test), arma::fill::zeros); + arma::vec output(absl::GetFlag(FLAGS_size_multiply_test)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); @@ -71,7 +95,11 @@ TEST(MultiplyTest, ArmadilloImplementation) end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "Element-wise multiplication of " << FLAGS_size_multiply_test +#else + std::cout << "Element-wise multiplication of " << absl::GetFlag(FLAGS_size_multiply_test) +#endif << "-length double Armadillo vectors finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); @@ -81,26 +109,44 @@ TEST(MultiplyTest, ArmadilloImplementation) TEST(MultiplyTest, StandardCComplexImplementation) { +#if USE_GLOG_AND_GFLAGS auto* input = new std::complex[FLAGS_size_multiply_test]; auto* output = new std::complex[FLAGS_size_multiply_test]; std::fill_n(input, FLAGS_size_multiply_test, std::complex(0.0, 0.0)); +#else + auto* input = new std::complex[absl::GetFlag(FLAGS_size_multiply_test)]; + auto* output = new std::complex[absl::GetFlag(FLAGS_size_multiply_test)]; + std::fill_n(input, absl::GetFlag(FLAGS_size_multiply_test), std::complex(0.0, 0.0)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); +#if USE_GLOG_AND_GFLAGS for (int i = 0; i < FLAGS_size_multiply_test; i++) +#else + for (int i = 0; i < absl::GetFlag(FLAGS_size_multiply_test); i++) +#endif { output[i] = input[i] * input[i]; } end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "Element-wise multiplication of " << FLAGS_size_multiply_test +#else + std::cout << "Element-wise multiplication of " << absl::GetFlag(FLAGS_size_multiply_test) +#endif << " complex in standard C finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; std::complex expected(0.0, 0.0); std::complex result(0.0, 0.0); +#if USE_GLOG_AND_GFLAGS for (int i = 0; i < FLAGS_size_multiply_test; i++) +#else + for (int i = 0; i < absl::GetFlag(FLAGS_size_multiply_test); i++) +#endif { result += output[i]; } @@ -113,8 +159,13 @@ TEST(MultiplyTest, StandardCComplexImplementation) TEST(MultiplyTest, C11ComplexImplementation) { +#if USE_GLOG_AND_GFLAGS const std::vector> input(FLAGS_size_multiply_test); std::vector> output(FLAGS_size_multiply_test); +#else + const std::vector> input(absl::GetFlag(FLAGS_size_multiply_test)); + std::vector> output(absl::GetFlag(FLAGS_size_multiply_test)); +#endif int pos = 0; std::chrono::time_point start, end; start = std::chrono::system_clock::now(); @@ -127,7 +178,11 @@ TEST(MultiplyTest, C11ComplexImplementation) end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "Element-wise multiplication of " << FLAGS_size_multiply_test +#else + std::cout << "Element-wise multiplication of " << absl::GetFlag(FLAGS_size_multiply_test) +#endif << " complex vector (C++11-style) finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); @@ -140,8 +195,13 @@ TEST(MultiplyTest, C11ComplexImplementation) TEST(MultiplyTest, ArmadilloComplexImplementation) { +#if USE_GLOG_AND_GFLAGS arma::cx_fvec input(FLAGS_size_multiply_test, arma::fill::zeros); arma::cx_fvec output(FLAGS_size_multiply_test); +#else + arma::cx_fvec input(absl::GetFlag(FLAGS_size_multiply_test), arma::fill::zeros); + arma::cx_fvec output(absl::GetFlag(FLAGS_size_multiply_test)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); @@ -150,7 +210,12 @@ TEST(MultiplyTest, ArmadilloComplexImplementation) end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; + +#if USE_GLOG_AND_GFLAGS std::cout << "Element-wise multiplication of " << FLAGS_size_multiply_test +#else + std::cout << "Element-wise multiplication of " << absl::GetFlag(FLAGS_size_multiply_test) +#endif << "-length complex float Armadillo vectors finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); @@ -160,30 +225,55 @@ TEST(MultiplyTest, ArmadilloComplexImplementation) TEST(MultiplyTest, VolkComplexImplementation) { +#if USE_GLOG_AND_GFLAGS auto* input = static_cast*>(volk_gnsssdr_malloc(FLAGS_size_multiply_test * sizeof(std::complex), volk_gnsssdr_get_alignment())); auto* output = static_cast*>(volk_gnsssdr_malloc(FLAGS_size_multiply_test * sizeof(std::complex), volk_gnsssdr_get_alignment())); std::fill_n(input, FLAGS_size_multiply_test, std::complex(0.0, 0.0)); +#else + auto* input = static_cast*>(volk_gnsssdr_malloc(absl::GetFlag(FLAGS_size_multiply_test) * sizeof(std::complex), volk_gnsssdr_get_alignment())); + auto* output = static_cast*>(volk_gnsssdr_malloc(absl::GetFlag(FLAGS_size_multiply_test) * sizeof(std::complex), volk_gnsssdr_get_alignment())); + std::fill_n(input, absl::GetFlag(FLAGS_size_multiply_test), std::complex(0.0, 0.0)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); +#if USE_GLOG_AND_GFLAGS volk_32fc_x2_multiply_32fc(output, input, input, FLAGS_size_multiply_test); +#else + volk_32fc_x2_multiply_32fc(output, input, input, absl::GetFlag(FLAGS_size_multiply_test)); +#endif end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "Element-wise multiplication of " << FLAGS_size_multiply_test +#else + std::cout << "Element-wise multiplication of " << absl::GetFlag(FLAGS_size_multiply_test) +#endif << "-length complex float vector using VOLK finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); +#if USE_GLOG_AND_GFLAGS auto* mag = static_cast(volk_gnsssdr_malloc(FLAGS_size_multiply_test * sizeof(float), volk_gnsssdr_get_alignment())); volk_32fc_magnitude_32f(mag, output, FLAGS_size_multiply_test); +#else + auto* mag = static_cast(volk_gnsssdr_malloc(absl::GetFlag(FLAGS_size_multiply_test) * sizeof(float), volk_gnsssdr_get_alignment())); + volk_32fc_magnitude_32f(mag, output, absl::GetFlag(FLAGS_size_multiply_test)); +#endif auto* result = new float(0.0); + +#if USE_GLOG_AND_GFLAGS volk_32f_accumulator_s32f(result, mag, FLAGS_size_multiply_test); +#else + volk_32f_accumulator_s32f(result, mag, absl::GetFlag(FLAGS_size_multiply_test)); +#endif + // Comparing floating-point numbers is tricky. // Due to round-off errors, it is very unlikely that two floating-points will match exactly. - // See https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#floating-point-comparison + // See https://google.github.io/googletest/reference/assertions.html#floating-point float expected = 0.0; ASSERT_FLOAT_EQ(expected, result[0]); volk_gnsssdr_free(input); @@ -194,28 +284,52 @@ TEST(MultiplyTest, VolkComplexImplementation) TEST(MultiplyTest, VolkComplexImplementationAlloc) { +#if USE_GLOG_AND_GFLAGS volk_gnsssdr::vector> input(FLAGS_size_multiply_test, std::complex(0.0, 0.0)); volk_gnsssdr::vector> output(FLAGS_size_multiply_test); - +#else + volk_gnsssdr::vector> input(absl::GetFlag(FLAGS_size_multiply_test), std::complex(0.0, 0.0)); + volk_gnsssdr::vector> output(absl::GetFlag(FLAGS_size_multiply_test)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); +#if USE_GLOG_AND_GFLAGS volk_32fc_x2_multiply_32fc(output.data(), input.data(), input.data(), FLAGS_size_multiply_test); +#else + volk_32fc_x2_multiply_32fc(output.data(), input.data(), input.data(), absl::GetFlag(FLAGS_size_multiply_test)); +#endif end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; + +#if USE_GLOG_AND_GFLAGS std::cout << "Element-wise multiplication of " << FLAGS_size_multiply_test +#else + std::cout << "Element-wise multiplication of " << absl::GetFlag(FLAGS_size_multiply_test) +#endif << "-length complex float vector using VOLK ALLOC finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); + +#if USE_GLOG_AND_GFLAGS volk_gnsssdr::vector mag(FLAGS_size_multiply_test); volk_32fc_magnitude_32f(mag.data(), output.data(), FLAGS_size_multiply_test); +#else + volk_gnsssdr::vector mag(absl::GetFlag(FLAGS_size_multiply_test)); + volk_32fc_magnitude_32f(mag.data(), output.data(), absl::GetFlag(FLAGS_size_multiply_test)); +#endif auto* result = new float(0.0); + +#if USE_GLOG_AND_GFLAGS volk_32f_accumulator_s32f(result, mag.data(), FLAGS_size_multiply_test); +#else + volk_32f_accumulator_s32f(result, mag.data(), absl::GetFlag(FLAGS_size_multiply_test)); +#endif // Comparing floating-point numbers is tricky. // Due to round-off errors, it is very unlikely that two floating-points will match exactly. - // See https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#floating-point-comparison + // See https://google.github.io/googletest/reference/assertions.html#floating-point float expected = 0.0; ASSERT_FLOAT_EQ(expected, result[0]); } diff --git a/src/tests/unit-tests/control-plane/control_thread_test.cc b/src/tests/unit-tests/control-plane/control_thread_test.cc index c43756128..9aa6d3620 100644 --- a/src/tests/unit-tests/control-plane/control_thread_test.cc +++ b/src/tests/unit-tests/control-plane/control_thread_test.cc @@ -26,8 +26,6 @@ #include #include #include -#include -#include #include #include #include @@ -39,6 +37,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#include +#else +#include +#endif class ControlThreadTest : public ::testing::Test { diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc index 327ffade0..7dddc77f6 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc @@ -41,6 +41,8 @@ #include #include #include +#include +#include #include #include @@ -55,6 +57,7 @@ namespace wht = boost; namespace wht = std; #endif +#if USE_GLOG_AND_GFLAGS DEFINE_string(config_file_ptest, std::string(""), "File containing alternative configuration parameters for the acquisition performance test."); DEFINE_string(acq_test_input_file, std::string(""), "File containing raw signal data, must be in int8_t format. The signal generator will not be used."); DEFINE_string(acq_test_implementation, std::string("GPS_L1_CA_PCPS_Acquisition"), "Acquisition block implementation under test. Alternatives: GPS_L1_CA_PCPS_Acquisition, GPS_L1_CA_PCPS_Acquisition_Fine_Doppler, Galileo_E1_PCPS_Ambiguous_Acquisition, GLONASS_L1_CA_PCPS_Acquisition, GLONASS_L2_CA_PCPS_Acquisition, GPS_L2_M_PCPS_Acquisition, Galileo_E5a_Pcps_Acquisition, GPS_L5i_PCPS_Acquisition"); @@ -86,6 +89,39 @@ DEFINE_int32(acq_test_fake_PRN, 33, "PRN number of a non-present satellite"); DEFINE_int32(acq_test_iterations, 1, "Number of iterations (same signal, different noise realization)"); DEFINE_bool(plot_acq_test, false, "Plots results with gnuplot, if available"); DEFINE_int32(acq_test_skiphead, 0, "Number of samples to skip in the input file"); +#else +ABSL_FLAG(std::string, config_file_ptest, std::string(""), "File containing alternative configuration parameters for the acquisition performance test."); +ABSL_FLAG(std::string, acq_test_input_file, std::string(""), "File containing raw signal data, must be in int8_t format. The signal generator will not be used."); +ABSL_FLAG(std::string, acq_test_implementation, std::string("GPS_L1_CA_PCPS_Acquisition"), "Acquisition block implementation under test. Alternatives: GPS_L1_CA_PCPS_Acquisition, GPS_L1_CA_PCPS_Acquisition_Fine_Doppler, Galileo_E1_PCPS_Ambiguous_Acquisition, GLONASS_L1_CA_PCPS_Acquisition, GLONASS_L2_CA_PCPS_Acquisition, GPS_L2_M_PCPS_Acquisition, Galileo_E5a_Pcps_Acquisition, GPS_L5i_PCPS_Acquisition"); + +ABSL_FLAG(int32_t, acq_test_doppler_max, 5000, "Maximum Doppler, in Hz"); +ABSL_FLAG(int32_t, acq_test_doppler_step, 125, "Doppler step, in Hz."); +ABSL_FLAG(int32_t, acq_test_coherent_time_ms, 1, "Acquisition coherent time, in ms"); +ABSL_FLAG(int32_t, acq_test_max_dwells, 1, "Number of non-coherent integrations."); +ABSL_FLAG(bool, acq_test_bit_transition_flag, false, "Bit transition flag."); +ABSL_FLAG(bool, acq_test_make_two_steps, false, "Perform second step in a thinner grid."); +ABSL_FLAG(int32_t, acq_test_second_nbins, 4, "If --acq_test_make_two_steps is set to true, this parameter sets the number of bins done in the acquisition refinement stage."); +ABSL_FLAG(int32_t, acq_test_second_doppler_step, 10, "If --acq_test_make_two_steps is set to true, this parameter sets the Doppler step applied in the acquisition refinement stage, in Hz."); + +ABSL_FLAG(int32_t, acq_test_signal_duration_s, 2, "Generated signal duration, in s"); +ABSL_FLAG(int32_t, acq_test_num_meas, 0, "Number of measurements per run. 0 means the complete file."); +ABSL_FLAG(double, acq_test_cn0_init, 30.0, "Initial CN0, in dBHz."); +ABSL_FLAG(double, acq_test_cn0_final, 45.0, "Final CN0, in dBHz."); +ABSL_FLAG(double, acq_test_cn0_step, 3.0, "CN0 step, in dB."); + +ABSL_FLAG(double, acq_test_threshold_init, 3.0, "Initial acquisition threshold"); +ABSL_FLAG(double, acq_test_threshold_final, 4.0, "Final acquisition threshold"); +ABSL_FLAG(double, acq_test_threshold_step, 0.5, "Acquisition threshold step"); + +ABSL_FLAG(double, acq_test_pfa_init, 1e-5, "Set initial threshold via probability of false alarm. Disable with -1.0"); + +ABSL_FLAG(int32_t, acq_test_PRN, 1, "PRN number of a present satellite"); +ABSL_FLAG(int32_t, acq_test_fake_PRN, 33, "PRN number of a non-present satellite"); + +ABSL_FLAG(int32_t, acq_test_iterations, 1, "Number of iterations (same signal, different noise realization)"); +ABSL_FLAG(bool, plot_acq_test, false, "Plots results with gnuplot, if available"); +ABSL_FLAG(int32_t, acq_test_skiphead, 0, "Number of samples to skip in the input file"); +#endif // ######## GNURADIO BLOCK MESSAGE RECEVER ######### class AcqPerfTest_msg_rx; @@ -160,9 +196,15 @@ protected: config = std::make_shared(); item_size = sizeof(gr_complex); gnss_synchro = Gnss_Synchro(); +#if USE_GLOG_AND_GFLAGS doppler_max = static_cast(FLAGS_acq_test_doppler_max); doppler_step = static_cast(FLAGS_acq_test_doppler_step); +#else + doppler_max = static_cast(absl::GetFlag(FLAGS_acq_test_doppler_max)); + doppler_step = static_cast(absl::GetFlag(FLAGS_acq_test_doppler_step)); +#endif stop = false; +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_input_file.empty()) { cn0_vector.push_back(FLAGS_acq_test_cn0_init); @@ -173,6 +215,18 @@ protected: aux = aux + FLAGS_acq_test_cn0_step; } } +#else + if (absl::GetFlag(FLAGS_acq_test_input_file).empty()) + { + cn0_vector.push_back(absl::GetFlag(FLAGS_acq_test_cn0_init)); + double aux = absl::GetFlag(FLAGS_acq_test_cn0_init) + absl::GetFlag(FLAGS_acq_test_cn0_step); + while (aux <= absl::GetFlag(FLAGS_acq_test_cn0_final)) + { + cn0_vector.push_back(aux); + aux = aux + absl::GetFlag(FLAGS_acq_test_cn0_step); + } + } +#endif else { cn0_vector = {0.0}; @@ -182,14 +236,22 @@ protected: { signal_id = "1C"; system_id = 'G'; +#if USE_GLOG_AND_GFLAGS coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; +#else + coherent_integration_time_ms = absl::GetFlag(FLAGS_acq_test_coherent_time_ms); +#endif min_integration_ms = 1; } else if (implementation == "GPS_L1_CA_PCPS_Acquisition_Fine_Doppler") { signal_id = "1C"; system_id = 'G'; +#if USE_GLOG_AND_GFLAGS coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; +#else + coherent_integration_time_ms = absl::GetFlag(FLAGS_acq_test_coherent_time_ms); +#endif min_integration_ms = 1; } else if (implementation == "Galileo_E1_PCPS_Ambiguous_Acquisition") @@ -197,40 +259,65 @@ protected: signal_id = "1B"; system_id = 'E'; min_integration_ms = 4; +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_coherent_time_ms == 1) +#else + if (absl::GetFlag(FLAGS_acq_test_coherent_time_ms) == 1) +#endif { coherent_integration_time_ms = 4; } else { +#if USE_GLOG_AND_GFLAGS coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; +#else + coherent_integration_time_ms = absl::GetFlag(FLAGS_acq_test_coherent_time_ms); +#endif } } else if (implementation == "GLONASS_L1_CA_PCPS_Acquisition") { signal_id = "1G"; system_id = 'R'; +#if USE_GLOG_AND_GFLAGS coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; +#else + coherent_integration_time_ms = absl::GetFlag(FLAGS_acq_test_coherent_time_ms); +#endif min_integration_ms = 1; } else if (implementation == "GLONASS_L2_CA_PCPS_Acquisition") { signal_id = "2G"; system_id = 'R'; +#if USE_GLOG_AND_GFLAGS coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; +#else + coherent_integration_time_ms = absl::GetFlag(FLAGS_acq_test_coherent_time_ms); +#endif min_integration_ms = 1; } else if (implementation == "GPS_L2_M_PCPS_Acquisition") { signal_id = "2S"; system_id = 'G'; +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_coherent_time_ms == 1) +#else + if (absl::GetFlag(FLAGS_acq_test_coherent_time_ms) == 1) +#endif + { coherent_integration_time_ms = 20; } else { +#if USE_GLOG_AND_GFLAGS coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; +#else + coherent_integration_time_ms = absl::GetFlag(FLAGS_acq_test_coherent_time_ms); +#endif } min_integration_ms = 20; } @@ -238,25 +325,37 @@ protected: { signal_id = "5X"; system_id = 'E'; +#if USE_GLOG_AND_GFLAGS coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; +#else + coherent_integration_time_ms = absl::GetFlag(FLAGS_acq_test_coherent_time_ms); +#endif min_integration_ms = 1; } else if (implementation == "GPS_L5i_PCPS_Acquisition") { signal_id = "L5"; system_id = 'G'; +#if USE_GLOG_AND_GFLAGS coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; +#else + coherent_integration_time_ms = absl::GetFlag(FLAGS_acq_test_coherent_time_ms); +#endif } else { signal_id = "1C"; system_id = 'G'; +#if USE_GLOG_AND_GFLAGS coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; +#else + coherent_integration_time_ms = absl::GetFlag(FLAGS_acq_test_coherent_time_ms); +#endif min_integration_ms = 1; } init(); - +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_pfa_init > 0.0) { pfa_vector.push_back(FLAGS_acq_test_pfa_init); @@ -279,11 +378,36 @@ protected: aux = aux + static_cast(FLAGS_acq_test_threshold_step); } } +#else + if (absl::GetFlag(FLAGS_acq_test_pfa_init) > 0.0) + { + pfa_vector.push_back(absl::GetFlag(FLAGS_acq_test_pfa_init)); + float aux = 1.0; + while ((absl::GetFlag(FLAGS_acq_test_pfa_init) * std::pow(10, aux)) < 1) + { + pfa_vector.push_back(absl::GetFlag(FLAGS_acq_test_pfa_init) * std::pow(10, aux)); + aux = aux + 1.0; + } + pfa_vector.push_back(0.999); + } + else + { + auto aux = static_cast(absl::GetFlag(FLAGS_acq_test_threshold_init)); + pfa_vector.push_back(aux); + aux = aux + static_cast(absl::GetFlag(FLAGS_acq_test_threshold_step)); + while (aux <= static_cast(absl::GetFlag(FLAGS_acq_test_threshold_final))) + { + pfa_vector.push_back(aux); + aux = aux + static_cast(absl::GetFlag(FLAGS_acq_test_threshold_step)); + } + } +#endif num_thresholds = pfa_vector.size(); // the gnss simulator does not dump the trk observables for the last 100 ms of generated signal int aux2; +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_bit_transition_flag) { aux2 = floor((generated_signal_duration_s * ms_per_s - 100) / (FLAGS_acq_test_coherent_time_ms * 2.0) - 1); @@ -300,7 +424,24 @@ protected: { num_of_measurements = static_cast(aux2); } - +#else + if (absl::GetFlag(FLAGS_acq_test_bit_transition_flag)) + { + aux2 = floor((generated_signal_duration_s * ms_per_s - 100) / (absl::GetFlag(FLAGS_acq_test_coherent_time_ms) * 2.0) - 1); + } + else + { + aux2 = floor((generated_signal_duration_s * ms_per_s - 100) / (absl::GetFlag(FLAGS_acq_test_coherent_time_ms) * absl::GetFlag(FLAGS_acq_test_max_dwells)) - 1); + } + if ((absl::GetFlag(FLAGS_acq_test_num_meas) > 0) && (absl::GetFlag(FLAGS_acq_test_num_meas) < aux2)) + { + num_of_measurements = static_cast(absl::GetFlag(FLAGS_acq_test_num_meas)); + } + else + { + num_of_measurements = static_cast(aux2); + } +#endif Pd.resize(cn0_vector.size()); for (int i = 0; i < static_cast(cn0_vector.size()); i++) { @@ -323,7 +464,12 @@ protected: std::vector cn0_vector; std::vector pfa_vector; +#if USE_GLOG_AND_GFLAGS int N_iterations = FLAGS_acq_test_iterations; +#else + int N_iterations = absl::GetFlag(FLAGS_acq_test_iterations); +#endif + void init(); int configure_generator(double cn0); @@ -353,19 +499,31 @@ protected: int message; std::thread ch_thread; - +#if USE_GLOG_AND_GFLAGS std::string implementation = FLAGS_acq_test_implementation; - const double baseband_sampling_freq = static_cast(FLAGS_fs_gen_sps); +#else + std::string implementation = absl::GetFlag(FLAGS_acq_test_implementation); + const double baseband_sampling_freq = static_cast(absl::GetFlag(FLAGS_fs_gen_sps)); +#endif + int coherent_integration_time_ms; const int in_acquisition = 1; const int dump_channel = 0; +#if USE_GLOG_AND_GFLAGS int generated_signal_duration_s = FLAGS_acq_test_signal_duration_s; +#else + int generated_signal_duration_s = absl::GetFlag(FLAGS_acq_test_signal_duration_s); +#endif unsigned int num_of_measurements; unsigned int measurement_counter = 0; +#if USE_GLOG_AND_GFLAGS unsigned int observed_satellite = FLAGS_acq_test_PRN; +#else + unsigned int observed_satellite = absl::GetFlag(FLAGS_acq_test_PRN); +#endif std::string path_str = "./acq-perf-test"; int num_thresholds; @@ -388,8 +546,13 @@ private: std::string p5; std::string p6; +#if USE_GLOG_AND_GFLAGS std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; +#else + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_filename_raw_data); +#endif char system_id; double compute_stdev_precision(const std::vector& vec); @@ -449,6 +612,7 @@ void AcquisitionPerformanceTest::stop_queue() int AcquisitionPerformanceTest::configure_generator(double cn0) { // Configure signal generator +#if USE_GLOG_AND_GFLAGS generator_binary = FLAGS_generator_binary; p1 = std::string("-rinex_nav_file=") + FLAGS_rinex_nav_file; @@ -464,6 +628,24 @@ int AcquisitionPerformanceTest::configure_generator(double cn0) p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] p6 = std::string("-CN0_dBHz=") + std::to_string(cn0); +#else + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(std::min(generated_signal_duration_s * 10, 3000)); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_filename_raw_data); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] + p6 = std::string("-CN0_dBHz=") + std::to_string(cn0); +#endif + return 0; } @@ -498,7 +680,11 @@ int AcquisitionPerformanceTest::generate_signal() int AcquisitionPerformanceTest::configure_receiver(double cn0, float pfa, unsigned int iter) { +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ptest.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ptest).empty()) +#endif { config = std::make_shared(); const int sampling_rate_internal = baseband_sampling_freq; @@ -514,13 +700,23 @@ int AcquisitionPerformanceTest::configure_receiver(double cn0, float pfa, unsign config->set_property("Acquisition.threshold", std::to_string(pfa)); // if (FLAGS_acq_test_pfa_init > 0.0) config->supersede_property("Acquisition.pfa", std::to_string(pfa)); + +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_pfa_init > 0.0) +#else + if (absl::GetFlag(FLAGS_acq_test_pfa_init) > 0.0) +#endif { config->supersede_property("Acquisition.pfa", std::to_string(pfa)); } config->set_property("Acquisition.coherent_integration_time_ms", std::to_string(coherent_integration_time_ms)); + +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_bit_transition_flag) +#else + if (absl::GetFlag(FLAGS_acq_test_bit_transition_flag)) +#endif { config->set_property("Acquisition.bit_transition_flag", "true"); } @@ -528,18 +724,30 @@ int AcquisitionPerformanceTest::configure_receiver(double cn0, float pfa, unsign { config->set_property("Acquisition.bit_transition_flag", "false"); } - +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_acq_test_max_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_acq_test_max_dwells))); +#endif config->set_property("Acquisition.repeat_satellite", "true"); config->set_property("Acquisition.blocking", "true"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_make_two_steps) { config->set_property("Acquisition.make_two_steps", "true"); config->set_property("Acquisition.second_nbins", std::to_string(FLAGS_acq_test_second_nbins)); config->set_property("Acquisition.second_doppler_step", std::to_string(FLAGS_acq_test_second_doppler_step)); } +#else + if (absl::GetFlag(FLAGS_acq_test_make_two_steps)) + { + config->set_property("Acquisition.make_two_steps", "true"); + config->set_property("Acquisition.second_nbins", std::to_string(absl::GetFlag(FLAGS_acq_test_second_nbins))); + config->set_property("Acquisition.second_doppler_step", std::to_string(absl::GetFlag(FLAGS_acq_test_second_doppler_step))); + } +#endif else { config->set_property("Acquisition.make_two_steps", "false"); @@ -557,7 +765,11 @@ int AcquisitionPerformanceTest::configure_receiver(double cn0, float pfa, unsign } else { +#if USE_GLOG_AND_GFLAGS config_f = std::make_shared(FLAGS_config_file_ptest); +#else + config_f = std::make_shared(absl::GetFlag(FLAGS_config_file_ptest)); +#endif config = nullptr; } return 0; @@ -567,13 +779,21 @@ int AcquisitionPerformanceTest::configure_receiver(double cn0, float pfa, unsign int AcquisitionPerformanceTest::run_receiver() { std::string file; +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_input_file.empty()) +#else + if (absl::GetFlag(FLAGS_acq_test_input_file).empty()) +#endif { file = "./" + filename_raw_data; } else { +#if USE_GLOG_AND_GFLAGS file = FLAGS_acq_test_input_file; +#else + file = absl::GetFlag(FLAGS_acq_test_input_file); +#endif } const char* file_name = file.c_str(); gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false); @@ -582,7 +802,11 @@ int AcquisitionPerformanceTest::run_receiver() top_block = gr::make_top_block("Acquisition test"); auto msg_rx = AcqPerfTest_msg_rx_make(channel_internal_queue); +#if USE_GLOG_AND_GFLAGS gr::blocks::skiphead::sptr skiphead = gr::blocks::skiphead::make(sizeof(gr_complex), FLAGS_acq_test_skiphead); +#else + gr::blocks::skiphead::sptr skiphead = gr::blocks::skiphead::make(sizeof(gr_complex), absl::GetFlag(FLAGS_acq_test_skiphead)); +#endif queue = std::make_shared>(); gnss_synchro = Gnss_Synchro(); @@ -681,9 +905,15 @@ int AcquisitionPerformanceTest::count_executions(const std::string& basename, un void AcquisitionPerformanceTest::plot_results() { +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_test == true) { const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + if (absl::GetFlag(FLAGS_plot_acq_test) == true) + { + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag plot_gps_l1_tracking_test has been set to TRUE,\n"; @@ -700,7 +930,11 @@ void AcquisitionPerformanceTest::plot_results() Gnuplot::set_GNUPlotPath(gnuplot_path); Gnuplot g1("linespoints"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g1.showonscreen(); // window output } @@ -736,7 +970,11 @@ void AcquisitionPerformanceTest::plot_results() g1.savetopdf("ROC", 18); Gnuplot g2("linespoints"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g2.showonscreen(); // window output } @@ -798,8 +1036,11 @@ TEST_F(AcquisitionPerformanceTest, ROC) std::vector meas_Pd_; std::vector meas_Pd_correct_; std::vector meas_Pfa_; - +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_input_file.empty()) +#else + if (absl::GetFlag(FLAGS_acq_test_input_file).empty()) +#endif { std::cout << "Execution for CN0 = " << it << " dB-Hz\n"; } @@ -807,7 +1048,11 @@ TEST_F(AcquisitionPerformanceTest, ROC) // Do N_iterations of the experiment for (int pfa_iter = 0; pfa_iter < static_cast(pfa_vector.size()); pfa_iter++) { +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_pfa_init > 0.0) +#else + if (absl::GetFlag(FLAGS_acq_test_pfa_init) > 0.0) +#endif { std::cout << "Setting threshold for Pfa = " << pfa_vector[pfa_iter] << '\n'; } @@ -816,16 +1061,25 @@ TEST_F(AcquisitionPerformanceTest, ROC) std::cout << "Setting threshold to " << pfa_vector[pfa_iter] << '\n'; } - // Configure the signal generator + // Configure the signal generator + +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_input_file.empty()) +#else + if (absl::GetFlag(FLAGS_acq_test_input_file).empty()) +#endif { configure_generator(it); } for (int iter = 0; iter < N_iterations; iter++) { - // Generate signal raw signal samples and observations RINEX file +// Generate signal raw signal samples and observations RINEX file +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_input_file.empty()) +#else + if (absl::GetFlag(FLAGS_acq_test_input_file).empty()) +#endif { generate_signal(); } @@ -834,11 +1088,19 @@ TEST_F(AcquisitionPerformanceTest, ROC) { if (k == 0) { +#if USE_GLOG_AND_GFLAGS observed_satellite = FLAGS_acq_test_PRN; +#else + observed_satellite = absl::GetFlag(FLAGS_acq_test_PRN); +#endif } else { +#if USE_GLOG_AND_GFLAGS observed_satellite = FLAGS_acq_test_fake_PRN; +#else + observed_satellite = absl::GetFlag(FLAGS_acq_test_fake_PRN); +#endif } init(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc index 9e577e096..563b41294 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc @@ -29,7 +29,6 @@ #include "in_memory_configuration.h" #include "test_flags.h" #include -#include #include #include #include @@ -39,6 +38,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include @@ -139,7 +144,7 @@ protected: gr::top_block_sptr top_block; std::shared_ptr config; - Gnss_Synchro gnss_synchro{}; + Gnss_Synchro gnss_synchro; size_t item_size; unsigned int doppler_max; unsigned int doppler_step; diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc index bb99b7f07..17cd4010a 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc @@ -29,7 +29,6 @@ #include "in_memory_configuration.h" #include "test_flags.h" #include -#include #include #include #include @@ -39,6 +38,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include @@ -138,7 +143,7 @@ protected: gr::top_block_sptr top_block; std::shared_ptr config; - Gnss_Synchro gnss_synchro{}; + Gnss_Synchro gnss_synchro; size_t item_size; unsigned int doppler_max; unsigned int doppler_step; diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc index 0d964e826..9be206e3f 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc @@ -31,7 +31,6 @@ #include "in_memory_configuration.h" #include "test_flags.h" #include -#include #include #include #include @@ -162,7 +161,11 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::init() config->set_property("GNSS-SDR.internal_fs_sps", "4000000"); config->set_property("Acquisition_1B.item_type", "gr_complex"); config->set_property("Acquisition_1B.coherent_integration_time_ms", "4"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_grid == true) +#else + if (absl::GetFlag(FLAGS_plot_acq_grid) == true) +#endif { config->set_property("Acquisition_1B.dump", "true"); } @@ -198,7 +201,11 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid() std::vector* samples = &acq_dump.samples; std::vector>* mag = &acq_dump.mag; +#if USE_GLOG_AND_GFLAGS const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag plot_acq_grid has been set to TRUE,\n"; @@ -216,7 +223,11 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid() Gnuplot::set_GNUPlotPath(gnuplot_path); Gnuplot g1("lines"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g1.showonscreen(); // window output } @@ -291,7 +302,11 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_grid == true) +#else + if (absl::GetFlag(FLAGS_plot_acq_grid) == true) +#endif { std::string data_str = "./tmp-acq-gal1"; if (fs::exists(data_str)) @@ -368,7 +383,11 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults) EXPECT_LE(doppler_error_hz, 166) << "Doppler error exceeds the expected value: 166 Hz = 2/(3*integration period)"; EXPECT_LT(delay_error_chips, 0.175) << "Delay error exceeds the expected value: 0.175 chips"; +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_grid == true) +#else + if (absl::GetFlag(FLAGS_plot_acq_grid) == true) +#endif { plot_grid(); } diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc index 714810fd7..816dbfe1a 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc @@ -29,7 +29,6 @@ #include "in_memory_configuration.h" #include "test_flags.h" #include -#include #include #include #include @@ -38,6 +37,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #ifdef GR_GREATER_38 #include #else diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc index 5204b859b..0a893e41c 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc @@ -27,18 +27,23 @@ #include "in_memory_configuration.h" #include "signal_generator.h" #include "signal_generator_c.h" -#include #include #include #include #include #include #include +#include #include #include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif #if HAS_GENERIC_LAMBDA #else #include @@ -54,9 +59,13 @@ namespace wht = boost; namespace wht = std; #endif +#if USE_GLOG_AND_GFLAGS DEFINE_double(e1_value_threshold, 0.3, "Value of the threshold for the acquisition"); DEFINE_int32(e1_value_CN0_dB_0, 50, "Value for the CN0_dB_0 in channel 0"); - +#else +ABSL_FLAG(double, e1_value_threshold, 0.3, "Value of the threshold for the acquisition"); +ABSL_FLAG(int32_t, e1_value_CN0_dB_0, 50, "Value for the CN0_dB_0 in channel 0"); +#endif // ######## GNURADIO BLOCK MESSAGE RECEVER ######### class GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx; @@ -313,7 +322,11 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_2() config->set_property("SignalSource.system_0", "E"); config->set_property("SignalSource.PRN_0", "10"); +#if USE_GLOG_AND_GFLAGS config->set_property("SignalSource.CN0_dB_0", std::to_string(FLAGS_e1_value_CN0_dB_0)); +#else + config->set_property("SignalSource.CN0_dB_0", std::to_string(absl::GetFlag(FLAGS_e1_value_CN0_dB_0))); +#endif config->set_property("SignalSource.doppler_Hz_0", std::to_string(expected_doppler_hz)); config->set_property("SignalSource.delay_chips_0", @@ -366,7 +379,11 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_2() std::to_string(integration_time_ms)); config->set_property("Acquisition_1B.max_dwells", "1"); config->set_property("Acquisition_1B.bit_transition_flag", "false"); +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition_1B.threshold", std::to_string(FLAGS_e1_value_threshold)); +#else + config->set_property("Acquisition_1B.threshold", std::to_string(absl::GetFlag(FLAGS_e1_value_threshold))); +#endif config->set_property("Acquisition_1B.doppler_max", "10000"); config->set_property("Acquisition_1B.doppler_step", "125"); config->set_property("Acquisition_1B.folding_factor", "2"); @@ -403,7 +420,11 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_3() config->set_property("SignalSource.system_0", "E"); config->set_property("SignalSource.PRN_0", "10"); +#if USE_GLOG_AND_GFLAGS config->set_property("SignalSource.CN0_dB_0", std::to_string(FLAGS_e1_value_CN0_dB_0)); +#else + config->set_property("SignalSource.CN0_dB_0", std::to_string(absl::GetFlag(FLAGS_e1_value_CN0_dB_0))); +#endif config->set_property("SignalSource.doppler_Hz_0", std::to_string(expected_doppler_hz)); config->set_property("SignalSource.delay_chips_0", @@ -863,10 +884,18 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul filenamepd.str(""); filenamepd << "../data/test_statistics_" << gnss_synchro.System << "_" << gnss_synchro.Signal << "_sat_" +#if USE_GLOG_AND_GFLAGS << gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_e1_value_CN0_dB_0 << "_dBHz.csv"; - +#else + << gnss_synchro.PRN << "CN0_dB_0_" << absl::GetFlag(FLAGS_e1_value_CN0_dB_0) << "_dBHz.csv"; +#endif pdpfafile.open(filenamepd.str().c_str(), std::ios::app | std::ios::out); + +#if USE_GLOG_AND_GFLAGS pdpfafile << FLAGS_e1_value_threshold << "," << Pd << "," << Pfa_p << "," << Pmd << '\n'; +#else + pdpfafile << absl::GetFlag(FLAGS_e1_value_threshold) << "," << Pd << "," << Pfa_p << "," << Pmd << '\n'; +#endif pdpfafile.close(); } } @@ -881,10 +910,18 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul filenamepf.str(""); filenamepf << "../data/test_statistics_" << gnss_synchro.System << "_" << gnss_synchro.Signal << "_sat_" +#if USE_GLOG_AND_GFLAGS << gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_e1_value_CN0_dB_0 << "_dBHz.csv"; - +#else + << gnss_synchro.PRN << "CN0_dB_0_" << absl::GetFlag(FLAGS_e1_value_CN0_dB_0) << "_dBHz.csv"; +#endif pdpfafile.open(filenamepf.str().c_str(), std::ios::app | std::ios::out); + +#if USE_GLOG_AND_GFLAGS pdpfafile << FLAGS_e1_value_threshold << "," << Pfa_a << '\n'; +#else + pdpfafile << absl::GetFlag(FLAGS_e1_value_threshold) << "," << Pfa_a << '\n'; +#endif pdpfafile.close(); } } diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc index 76056cb3b..4aac0c104 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc @@ -28,7 +28,6 @@ #include "gps_l1_ca_pcps_acquisition.h" #include "in_memory_configuration.h" #include "test_flags.h" -#include #include #include #include @@ -39,6 +38,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include @@ -132,7 +137,7 @@ protected: gr::top_block_sptr top_block; std::shared_ptr config; - Gnss_Synchro gnss_synchro{}; + Gnss_Synchro gnss_synchro; size_t item_size; unsigned int doppler_max{5000}; unsigned int doppler_step{100}; @@ -150,7 +155,12 @@ void GpsL1CaPcpsAcquisitionTest::init() config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition"); config->set_property("Acquisition_1C.item_type", "gr_complex"); config->set_property("Acquisition_1C.coherent_integration_time_ms", "1"); + +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_grid == true) +#else + if (absl::GetFlag(FLAGS_plot_acq_grid) == true) +#endif { config->set_property("Acquisition_1C.dump", "true"); } @@ -185,8 +195,12 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid() const std::vector *doppler = &acq_dump.doppler; std::vector *samples = &acq_dump.samples; std::vector > *mag = &acq_dump.mag; - +#if USE_GLOG_AND_GFLAGS const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif + if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag plot_acq_grid has been set to TRUE,\n"; @@ -204,7 +218,11 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid() const Gnuplot::set_GNUPlotPath(gnuplot_path); Gnuplot g1("lines"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g1.showonscreen(); // window output } @@ -286,7 +304,11 @@ TEST_F(GpsL1CaPcpsAcquisitionTest /*unused*/, ValidationOfResults /*unused*/) init(); +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_grid == true) +#else + if (absl::GetFlag(FLAGS_plot_acq_grid) == true) +#endif { std::string data_str = "./tmp-acq-gps1"; if (fs::exists(data_str)) @@ -354,7 +376,11 @@ TEST_F(GpsL1CaPcpsAcquisitionTest /*unused*/, ValidationOfResults /*unused*/) EXPECT_LE(doppler_error_hz, 666) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)"; EXPECT_LT(delay_error_chips, 0.5) << "Delay error exceeds the expected value: 0.5 chips"; +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_grid == true) +#else + if (absl::GetFlag(FLAGS_plot_acq_grid) == true) +#endif { plot_grid(); } diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc index 60db2ec9b..ee06f57ce 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc @@ -29,7 +29,6 @@ #include "in_memory_configuration.h" #include "test_flags.h" #include -#include #include #include #include // for abs, pow, floor @@ -37,6 +36,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #ifdef GR_GREATER_38 #include #else diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc index 92a8e19ff..1dce2a6f8 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc @@ -25,7 +25,6 @@ #include "in_memory_configuration.h" #include "signal_generator.h" #include "signal_generator_c.h" -#include #include #include #include @@ -33,9 +32,15 @@ #include #include #include +#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif #if HAS_GENERIC_LAMBDA #else #include @@ -51,9 +56,13 @@ namespace wht = boost; namespace wht = std; #endif +#if USE_GLOG_AND_GFLAGS DEFINE_double(value_threshold, 1, "Value of the threshold for the acquisition"); DEFINE_int32(value_CN0_dB_0, 44, "Value for the CN0_dB_0 in channel 0"); - +#else +ABSL_FLAG(double, value_threshold, 1, "Value of the threshold for the acquisition"); +ABSL_FLAG(int32_t, value_CN0_dB_0, 44, "Value for the CN0_dB_0 in channel 0"); +#endif // ######## GNURADIO BLOCK MESSAGE RECEVER ######### class GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx; @@ -304,7 +313,11 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_2() config->set_property("SignalSource.system_0", "G"); config->set_property("SignalSource.PRN_0", "10"); +#if USE_GLOG_AND_GFLAGS config->set_property("SignalSource.CN0_dB_0", std::to_string(FLAGS_value_CN0_dB_0)); +#else + config->set_property("SignalSource.CN0_dB_0", std::to_string(absl::GetFlag(FLAGS_value_CN0_dB_0))); +#endif config->set_property("SignalSource.doppler_Hz_0", std::to_string(expected_doppler_hz)); config->set_property("SignalSource.delay_chips_0", std::to_string(expected_delay_chips)); @@ -354,7 +367,11 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_2() config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(integration_time_ms)); config->set_property("Acquisition_1C.max_dwells", "1"); +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition_1C.threshold", std::to_string(FLAGS_value_threshold)); +#else + config->set_property("Acquisition_1C.threshold", std::to_string(absl::GetFlag(FLAGS_value_threshold))); +#endif config->set_property("Acquisition_1C.doppler_max", "10000"); config->set_property("Acquisition_1C.doppler_step", "100"); config->set_property("Acquisition_1C.bit_transition_flag", "false"); @@ -395,7 +412,11 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_3() config->set_property("SignalSource.system_0", "G"); config->set_property("SignalSource.PRN_0", "10"); +#if USE_GLOG_AND_GFLAGS config->set_property("SignalSource.CN0_dB_0", std::to_string(FLAGS_value_CN0_dB_0)); +#else + config->set_property("SignalSource.CN0_dB_0", std::to_string(absl::GetFlag(FLAGS_value_CN0_dB_0))); +#endif config->set_property("SignalSource.doppler_Hz_0", std::to_string(expected_doppler_hz)); config->set_property("SignalSource.delay_chips_0", std::to_string(expected_delay_chips)); @@ -830,10 +851,19 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili filenamepd.str(""); filenamepd << "../data/test_statistics_" << gnss_synchro.System << "_" << gnss_synchro.Signal << "_sat_" +#if USE_GLOG_AND_GFLAGS << gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_value_CN0_dB_0 << "_dBHz.csv"; +#else + << gnss_synchro.PRN << "CN0_dB_0_" << absl::GetFlag(FLAGS_value_CN0_dB_0) << "_dBHz.csv"; +#endif pdpfafile.open(filenamepd.str().c_str(), std::ios::app | std::ios::out); + +#if USE_GLOG_AND_GFLAGS pdpfafile << FLAGS_value_threshold << "," << Pd << "," << Pfa_p << "," << Pmd << '\n'; +#else + pdpfafile << absl::GetFlag(FLAGS_value_threshold) << "," << Pd << "," << Pfa_p << "," << Pmd << '\n'; +#endif pdpfafile.close(); } } @@ -848,10 +878,18 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili filenamepf.str(""); filenamepf << "../data/test_statistics_" << gnss_synchro.System << "_" << gnss_synchro.Signal << "_sat_" +#if USE_GLOG_AND_GFLAGS << gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_value_CN0_dB_0 << "_dBHz.csv"; - +#else + << gnss_synchro.PRN << "CN0_dB_0_" << absl::GetFlag(FLAGS_value_CN0_dB_0) << "_dBHz.csv"; +#endif pdpfafile.open(filenamepf.str().c_str(), std::ios::app | std::ios::out); + +#if USE_GLOG_AND_GFLAGS pdpfafile << FLAGS_value_threshold << "," << Pfa_a << '\n'; +#else + pdpfafile << absl::GetFlag(FLAGS_value_threshold) << "," << Pfa_a << '\n'; +#endif pdpfafile.close(); } } diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc index a2d87201d..bb65ec8c5 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc @@ -160,7 +160,11 @@ void GpsL2MPcpsAcquisitionTest::init() config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(sampling_frequency_hz)); config->set_property("Acquisition_2S.implementation", "GPS_L2_M_PCPS_Acquisition"); config->set_property("Acquisition_2S.item_type", "gr_complex"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_grid == true) +#else + if (absl::GetFlag(FLAGS_plot_acq_grid) == true) +#endif { config->set_property("Acquisition_2S.dump", "true"); } @@ -195,7 +199,11 @@ void GpsL2MPcpsAcquisitionTest::plot_grid() std::vector *samples = &acq_dump.samples; std::vector> *mag = &acq_dump.mag; +#if USE_GLOG_AND_GFLAGS const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag plot_acq_grid has been set to TRUE,\n"; @@ -213,7 +221,11 @@ void GpsL2MPcpsAcquisitionTest::plot_grid() Gnuplot::set_GNUPlotPath(gnuplot_path); Gnuplot g1("impulses"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g1.showonscreen(); // window output } @@ -290,7 +302,11 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults) double expected_delay_samples = 1; // 2004; double expected_doppler_hz = 1200; // 3000; +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_grid == true) +#else + if (absl::GetFlag(FLAGS_plot_acq_grid) == true) +#endif { std::string data_str = "./tmp-acq-gps2"; if (fs::exists(data_str)) @@ -372,7 +388,11 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults) EXPECT_LE(doppler_error_hz, 200) << "Doppler error exceeds the expected value: 2/(3*integration period)"; EXPECT_LT(delay_error_chips, 0.5) << "Delay error exceeds the expected value: 0.5 chips"; +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_grid == true) +#else + if (absl::GetFlag(FLAGS_plot_acq_grid) == true) +#endif { plot_grid(); } diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc b/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc index 97b27f51c..9bebac3a9 100644 --- a/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc @@ -14,7 +14,6 @@ * ----------------------------------------------------------------------------- */ -#include #include #include #include @@ -40,13 +39,24 @@ #include +#if USE_GLOG_AND_GFLAGS +#include DEFINE_int32(filter_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)"); +#else +#include +ABSL_FLAG(int32_t, filter_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)"); +#endif + class FirFilterTest : public ::testing::Test { protected: FirFilterTest() : item_size(sizeof(gr_complex)), +#if USE_GLOG_AND_GFLAGS nsamples(FLAGS_filter_test_nsamples) +#else + nsamples(absl::GetFlag(FLAGS_filter_test_nsamples)) +#endif { queue = std::make_shared>(); config = std::make_shared(); diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc b/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc index 1c77dc929..79cc01136 100644 --- a/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc @@ -14,7 +14,6 @@ * ----------------------------------------------------------------------------- */ -#include #include #include #include @@ -38,14 +37,24 @@ #include #include - +#if USE_GLOG_AND_GFLAGS +#include DEFINE_int32(notch_filter_lite_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)"); +#else +#include +ABSL_FLAG(int32_t, notch_filter_lite_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)"); +#endif + class NotchFilterLiteTest : public ::testing::Test { protected: NotchFilterLiteTest() : item_size(sizeof(gr_complex)), +#if USE_GLOG_AND_GFLAGS nsamples(FLAGS_notch_filter_lite_test_nsamples) +#else + nsamples(absl::GetFlag(FLAGS_notch_filter_lite_test_nsamples)) +#endif { queue = std::make_shared>(); config = std::make_shared(); diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc b/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc index cf4cde035..17be01cc4 100644 --- a/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc @@ -14,7 +14,6 @@ * ----------------------------------------------------------------------------- */ -#include #include #include #include @@ -38,14 +37,23 @@ #include #include - +#if USE_GLOG_AND_GFLAGS +#include DEFINE_int32(notch_filter_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)"); +#else +#include +ABSL_FLAG(int32_t, notch_filter_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)"); +#endif class NotchFilterTest : public ::testing::Test { protected: NotchFilterTest() : item_size(sizeof(gr_complex)), +#if USE_GLOG_AND_GFLAGS nsamples(FLAGS_notch_filter_test_nsamples) +#else + nsamples(absl::GetFlag(FLAGS_notch_filter_test_nsamples)) +#endif { queue = std::make_shared>(); config = std::make_shared(); diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc b/src/tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc index 4cb3c5c43..b99e17655 100644 --- a/src/tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc @@ -14,7 +14,6 @@ * ----------------------------------------------------------------------------- */ -#include #include #include #include @@ -38,14 +37,23 @@ #include #include - +#if USE_GLOG_AND_GFLAGS +#include DEFINE_int32(pb_filter_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)"); +#else +#include +ABSL_FLAG(int32_t, pb_filter_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)"); +#endif class PulseBlankingFilterTest : public ::testing::Test { protected: PulseBlankingFilterTest() : item_size(sizeof(gr_complex)), +#if USE_GLOG_AND_GFLAGS nsamples(FLAGS_pb_filter_test_nsamples) +#else + nsamples(absl::GetFlag(FLAGS_pb_filter_test_nsamples)) +#endif { queue = std::make_shared>(); config = std::make_shared(); diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt b/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt index 53545ef44..32a81ee01 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt +++ b/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt @@ -37,15 +37,20 @@ endif() target_link_libraries(signal_processing_testing_lib PUBLIC Armadillo::armadillo - Gflags::gflags Gnuradio::runtime Gnuradio::pmt PRIVATE Boost::headers Matio::matio - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(signal_processing_testing_lib PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(signal_processing_testing_lib PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(signal_processing_testing_lib PRIVATE absl::flags absl::log) +endif() + target_include_directories(signal_processing_testing_lib PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.cc b/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.cc index c8701e41d..fb8697898 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.cc @@ -17,10 +17,17 @@ */ #include "acquisition_msg_rx.h" -#include -#include #include #include + +#if USE_GLOG_AND_GFLAGS +#include +#include +#else +#include +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include diff --git a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc index 9cb2337d4..f7540e0c0 100644 --- a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc @@ -252,12 +252,18 @@ public: std::string p3; std::string p4; std::string p5; + +#if USE_GLOG_AND_GFLAGS std::string implementation = FLAGS_trk_test_implementation; - const int baseband_sampling_freq = FLAGS_fs_gen_sps; - std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; +#else + std::string implementation = absl::GetFlag(FLAGS_trk_test_implementation); + const int baseband_sampling_freq = absl::GetFlag(FLAGS_fs_gen_sps); + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_filename_raw_data); +#endif int configure_generator(); int generate_signal(); @@ -340,6 +346,7 @@ public: int HybridObservablesTest::configure_generator() { +#if USE_GLOG_AND_GFLAGS // Configure signal generator generator_binary = FLAGS_generator_binary; @@ -355,6 +362,24 @@ int HybridObservablesTest::configure_generator() p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#else + // Configure signal generator + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(absl::GetFlag(FLAGS_duration) * 10); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_filename_raw_data); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#endif + return 0; } @@ -395,8 +420,12 @@ bool HybridObservablesTest::acquire_signal() tmp_gnss_synchro.Channel_ID = 0; config = std::make_shared(); config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); - // Enable automatic resampler for the acquisition, if required +// Enable automatic resampler for the acquisition, if required +#if USE_GLOG_AND_GFLAGS if (FLAGS_use_acquisition_resampler == true) +#else + if (absl::GetFlag(FLAGS_use_acquisition_resampler) == true) +#endif { config->set_property("GNSS-SDR.use_acquisition_resampler", "true"); } @@ -418,8 +447,11 @@ bool HybridObservablesTest::acquire_signal() std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "GPS L1 CA"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); - // acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking") @@ -430,7 +462,11 @@ bool HybridObservablesTest::acquire_signal() std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "Galileo E1B"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } else if (implementation == "GPS_L2_M_DLL_PLL_Tracking") @@ -441,7 +477,11 @@ bool HybridObservablesTest::acquire_signal() std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "GPS L2CM"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_b") @@ -453,7 +493,11 @@ bool HybridObservablesTest::acquire_signal() tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "Galileo E5a"; config->set_property("Acquisition_5X.coherent_integration_time_ms", "1"); +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif config->set_property("Acquisition.CAF_window_hz", "0"); // **Only for E5a** Resolves doppler ambiguity averaging the specified BW in the winner code delay. If set to 0 CAF filter is deactivated. Recommended value 3000 Hz config->set_property("Acquisition.Zero_padding", "0"); // **Only for E5a** Avoids power loss and doppler ambiguity in bit transitions by correlating one code with twice the input data length, ensuring that at least one full code is present without transitions. If set to 1 it is ON, if set to 0 it is OFF. config->set_property("Acquisition.bit_transition_flag", "false"); @@ -468,7 +512,11 @@ bool HybridObservablesTest::acquire_signal() std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "Galileo E5a"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } else if (implementation == "GPS_L5_DLL_PLL_Tracking") @@ -479,7 +527,11 @@ bool HybridObservablesTest::acquire_signal() std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "GPS L5I"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } else @@ -490,27 +542,43 @@ bool HybridObservablesTest::acquire_signal() acquisition->set_gnss_synchro(&tmp_gnss_synchro); acquisition->set_channel(0); +#if USE_GLOG_AND_GFLAGS acquisition->set_doppler_max(config->property("Acquisition.doppler_max", FLAGS_external_signal_acquisition_doppler_max_hz)); acquisition->set_doppler_step(config->property("Acquisition.doppler_step", FLAGS_external_signal_acquisition_doppler_step_hz)); acquisition->set_threshold(config->property("Acquisition.threshold", FLAGS_external_signal_acquisition_threshold)); +#else + acquisition->set_doppler_max(config->property("Acquisition.doppler_max", absl::GetFlag(FLAGS_external_signal_acquisition_doppler_max_hz))); + acquisition->set_doppler_step(config->property("Acquisition.doppler_step", absl::GetFlag(FLAGS_external_signal_acquisition_doppler_step_hz))); + acquisition->set_threshold(config->property("Acquisition.threshold", absl::GetFlag(FLAGS_external_signal_acquisition_threshold))); +#endif acquisition->init(); acquisition->set_local_code(); acquisition->set_state(1); // Ensure that acquisition starts at the first sample acquisition->connect(top_block_acq); gr::blocks::file_source::sptr file_source; +#if USE_GLOG_AND_GFLAGS std::string file = FLAGS_signal_file; +#else + std::string file = absl::GetFlag(FLAGS_signal_file); +#endif const char* file_name = file.c_str(); file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false); +#if USE_GLOG_AND_GFLAGS file_source->seek(2 * FLAGS_skip_samples, 0); // skip head. ibyte, two bytes per complex sample +#else + file_source->seek(2 * absl::GetFlag(FLAGS_skip_samples), 0); // skip head. ibyte, two bytes per complex sample +#endif gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make(); - // gr::blocks::head::sptr head_samples = gr::blocks::head::make(sizeof(gr_complex), baseband_sampling_freq * FLAGS_duration); - // top_block_acq->connect(head_samples, 0, acquisition->get_left_block(), 0); - top_block_acq->connect(file_source, 0, gr_interleaved_char_to_complex, 0); // Enable automatic resampler for the acquisition, if required + +#if USE_GLOG_AND_GFLAGS if (FLAGS_use_acquisition_resampler == true) +#else + if (absl::GetFlag(FLAGS_use_acquisition_resampler) == true) +#endif { // create acquisition resamplers if required double resampler_ratio = 1.0; @@ -636,7 +704,11 @@ bool HybridObservablesTest::acquire_signal() top_block_acq->run(); if (start_msg == true) { +#if USE_GLOG_AND_GFLAGS std::cout << "Reading external signal file: " << FLAGS_signal_file << '\n'; +#else + std::cout << "Reading external signal file: " << absl::GetFlag(FLAGS_signal_file) << '\n'; +#endif std::cout << "Searching for " << System_and_Signal << " Satellites...\n"; std::cout << "["; start_msg = false; @@ -655,7 +727,11 @@ bool HybridObservablesTest::acquire_signal() std::cout << " . "; } top_block_acq->stop(); +#if USE_GLOG_AND_GFLAGS file_source->seek(2 * FLAGS_skip_samples, 0); // skip head. ibyte, two bytes per complex sample +#else + file_source->seek(2 * absl::GetFlag(FLAGS_skip_samples), 0); // skip head. ibyte, two bytes per complex sample +#endif std::cout.flush(); } std::cout << "]\n"; @@ -712,9 +788,15 @@ void HybridObservablesTest::configure_receiver( config->set_property("Tracking.extend_correlation_symbols", std::to_string(extend_correlation_symbols)); config->set_property("Tracking.pll_bw_narrow_hz", std::to_string(PLL_narrow_bw_hz)); config->set_property("Tracking.dll_bw_narrow_hz", std::to_string(DLL_narrow_bw_hz)); +#if USE_GLOG_AND_GFLAGS config->set_property("Tracking.fll_bw_hz", std::to_string(FLAGS_fll_bw_hz)); config->set_property("Tracking.enable_fll_pull_in", FLAGS_enable_fll_pull_in ? "true" : "false"); config->set_property("Tracking.enable_fll_steady_state", FLAGS_enable_fll_steady_state ? "true" : "false"); +#else + config->set_property("Tracking.fll_bw_hz", std::to_string(absl::GetFlag(FLAGS_fll_bw_hz))); + config->set_property("Tracking.enable_fll_pull_in", absl::GetFlag(FLAGS_enable_fll_pull_in) ? "true" : "false"); + config->set_property("Tracking.enable_fll_steady_state", absl::GetFlag(FLAGS_enable_fll_steady_state) ? "true" : "false"); +#endif config->set_property("Tracking.smoother_length", std::to_string(smoother_length)); config->set_property("Tracking.dump", "true"); config->set_property("Tracking.dump_filename", "./tracking_ch_"); @@ -877,7 +959,12 @@ void HybridObservablesTest::check_results_carrier_phase( std::cout.precision(ss); // plots + +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Accumulated Carrier phase error [cycles]"); @@ -968,7 +1055,12 @@ void HybridObservablesTest::check_results_carrier_phase_double_diff( std::cout.precision(ss); // plots + +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Double diff Carrier Phase error [Cycles]"); @@ -1061,8 +1153,12 @@ void HybridObservablesTest::check_results_carrier_doppler_double_diff( << " [Hz]\n"; std::cout.precision(ss); - // plots +// plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Double diff Carrier Doppler error [Hz]"); @@ -1147,7 +1243,11 @@ void HybridObservablesTest::check_results_carrier_doppler( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Carrier Doppler error [Hz]"); @@ -1282,7 +1382,11 @@ void HybridObservablesTest::check_results_duplicated_satellite( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Carrier Doppler error [Hz]"); @@ -1341,8 +1445,12 @@ void HybridObservablesTest::check_results_duplicated_satellite( << " [Cycles]\n"; std::cout.precision(ss); - // plots +// plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Carrier Phase error [Cycles]"); @@ -1401,7 +1509,12 @@ void HybridObservablesTest::check_results_duplicated_satellite( std::cout.precision(ss); // plots + +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Pseudorange error [m]"); @@ -1526,8 +1639,12 @@ void HybridObservablesTest::check_results_code_pseudorange( << " [meters]\n"; std::cout.precision(ss); - // plots +// plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Double diff Pseudorange error [m]"); @@ -1568,7 +1685,11 @@ bool HybridObservablesTest::ReadRinexObs(std::vector* obs_vec, Gnss_S // Open and read reference RINEX observables file try { +#if USE_GLOG_AND_GFLAGS gnsstk::Rinex3ObsStream r_ref(FLAGS_filename_rinex_obs); +#else + gnsstk::Rinex3ObsStream r_ref(absl::GetFlag(FLAGS_filename_rinex_obs)); +#endif r_ref.exceptions(std::ios::failbit); gnsstk::Rinex3ObsData r_ref_data; gnsstk::Rinex3ObsHeader r_ref_header; @@ -1727,7 +1848,12 @@ TEST_F(HybridObservablesTest, ValidationOfResults) configure_generator(); // Generate signal raw signal samples and observations RINEX file + +#if USE_GLOG_AND_GFLAGS if (FLAGS_disable_generator == false) +#else + if (absl::GetFlag(FLAGS_disable_generator) == false) +#endif { generate_signal(); } @@ -1736,7 +1862,12 @@ TEST_F(HybridObservablesTest, ValidationOfResults) std::chrono::duration elapsed_seconds(0); // use generator or use an external capture file + +#if USE_GLOG_AND_GFLAGS if (FLAGS_enable_external_signal_file) +#else + if (absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { // create and configure an acquisition block and perform an acquisition to obtain the synchronization parameters ASSERT_EQ(acquire_signal(), true); @@ -1747,8 +1878,11 @@ TEST_F(HybridObservablesTest, ValidationOfResults) tmp_gnss_synchro.System = 'G'; std::string signal = "1C"; signal.copy(tmp_gnss_synchro.Signal, 2, 0); - +#if USE_GLOG_AND_GFLAGS std::istringstream ss(FLAGS_test_satellite_PRN_list); +#else + std::istringstream ss(absl::GetFlag(FLAGS_test_satellite_PRN_list)); +#endif std::string token; while (std::getline(ss, token, ',')) @@ -1758,6 +1892,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults) } } +#if USE_GLOG_AND_GFLAGS configure_receiver(FLAGS_PLL_bw_hz_start, FLAGS_DLL_bw_hz_start, FLAGS_PLL_narrow_bw_hz, @@ -1765,11 +1900,25 @@ TEST_F(HybridObservablesTest, ValidationOfResults) FLAGS_extend_correlation_symbols, FLAGS_smoother_length, FLAGS_high_dyn); +#else + configure_receiver(absl::GetFlag(FLAGS_PLL_bw_hz_start), + absl::GetFlag(FLAGS_DLL_bw_hz_start), + absl::GetFlag(FLAGS_PLL_narrow_bw_hz), + absl::GetFlag(FLAGS_DLL_narrow_bw_hz), + absl::GetFlag(FLAGS_extend_correlation_symbols), + absl::GetFlag(FLAGS_smoother_length), + absl::GetFlag(FLAGS_high_dyn)); +#endif for (auto& n : gnss_synchro_vec) { // setup the signal synchronization, simulating an acquisition + +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { // based on true observables metadata (for custom sdr generator) // open true observables log file written by the simulator or based on provided RINEX obs @@ -1873,6 +2022,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults) ASSERT_NO_THROW({ std::string file; +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { file = "./" + filename_raw_data; @@ -1881,6 +2031,16 @@ TEST_F(HybridObservablesTest, ValidationOfResults) { file = FLAGS_signal_file; } +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + file = "./" + filename_raw_data; + } + else + { + file = absl::GetFlag(FLAGS_signal_file); + } +#endif const char* file_name = file.c_str(); gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false); gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make(); @@ -1900,7 +2060,11 @@ TEST_F(HybridObservablesTest, ValidationOfResults) // connect sample counter and timmer to the last channel in observables block (extra channel) top_block_tlm->connect(samp_counter, 0, observables->get_left_block(), tracking_ch_vec.size()); +#if USE_GLOG_AND_GFLAGS file_source->seek(2 * FLAGS_skip_samples, 0); // skip head. ibyte, two bytes per complex sample +#else + file_source->seek(2 * absl::GetFlag(FLAGS_skip_samples), 0); // skip head. ibyte, two bytes per complex sample +#endif }) << "Failure connecting the blocks."; for (auto& n : tracking_ch_vec) @@ -1918,8 +2082,11 @@ TEST_F(HybridObservablesTest, ValidationOfResults) // check results // Matrices for storing columnwise true GPS time, Range, Doppler and Carrier phase std::vector true_obs_vec; - +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { // load the true values True_Observables_Reader true_observables; @@ -1963,7 +2130,11 @@ TEST_F(HybridObservablesTest, ValidationOfResults) } else { +#if USE_GLOG_AND_GFLAGS if (!FLAGS_duplicated_satellites_test) +#else + if (!absl::GetFlag(FLAGS_duplicated_satellites_test)) +#endif { ASSERT_EQ(ReadRinexObs(&true_obs_vec, gnss_synchro_master), true) << "Failure reading RINEX file"; @@ -2018,8 +2189,12 @@ TEST_F(HybridObservablesTest, ValidationOfResults) } } - // Cut measurement initial transitory of the measurements +// Cut measurement initial transitory of the measurements +#if USE_GLOG_AND_GFLAGS double initial_transitory_s = FLAGS_skip_obs_transitory_s; +#else + double initial_transitory_s = absl::GetFlag(FLAGS_skip_obs_transitory_s); +#endif for (unsigned int n = 0; n < measured_obs_vec.size(); n++) { index = arma::find(measured_obs_vec.at(n).col(0) >= (measured_obs_vec.at(n)(0, 0) + initial_transitory_s), 1, "first"); @@ -2027,8 +2202,11 @@ TEST_F(HybridObservablesTest, ValidationOfResults) { measured_obs_vec.at(n).shed_rows(0, index(0)); } - +#if USE_GLOG_AND_GFLAGS if (!FLAGS_duplicated_satellites_test) +#else + if (!absl::GetFlag(FLAGS_duplicated_satellites_test)) +#endif { index = arma::find(measured_obs_vec.at(n).col(0) >= true_obs_vec.at(n)(0, 0), 1, "first"); if ((!index.empty()) and (index(0) > 0)) @@ -2038,11 +2216,19 @@ TEST_F(HybridObservablesTest, ValidationOfResults) } } +#if USE_GLOG_AND_GFLAGS if (FLAGS_duplicated_satellites_test) +#else + if (absl::GetFlag(FLAGS_duplicated_satellites_test)) +#endif { // special test mode for duplicated satellites std::vector prn_pairs; +#if USE_GLOG_AND_GFLAGS std::stringstream ss(FLAGS_duplicated_satellites_prns); +#else + std::stringstream ss(absl::GetFlag(FLAGS_duplicated_satellites_prns)); +#endif unsigned int i; while (ss >> i) { @@ -2190,9 +2376,13 @@ TEST_F(HybridObservablesTest, ValidationOfResults) measured_obs_vec.at(n), measured_obs_vec.at(min_pr_ch_id), "[CH " + std::to_string(n) + "] PRN " + std::to_string(gnss_synchro_vec.at(n).PRN) + " "); - // Do not compare E5a with E5 RINEX due to the Doppler frequency discrepancy caused by the different center frequencies - // E5a_fc=1176.45e6, E5b_fc=1207.14e6, E5_fc=1191.795e6; +// Do not compare E5a with E5 RINEX due to the Doppler frequency discrepancy caused by the different center frequencies +// E5a_fc=1176.45e6, E5b_fc=1207.14e6, E5_fc=1191.795e6; +#if USE_GLOG_AND_GFLAGS if (strcmp("5X\0", gnss_synchro_vec.at(n).Signal) != 0 or FLAGS_compare_with_5X) +#else + if (strcmp("5X\0", gnss_synchro_vec.at(n).Signal) != 0 or absl::GetFlag(FLAGS_compare_with_5X)) +#endif { check_results_carrier_phase_double_diff(true_obs_vec.at(n), true_obs_vec.at(min_pr_ch_id), @@ -2215,7 +2405,11 @@ TEST_F(HybridObservablesTest, ValidationOfResults) { std::cout << "[CH " << std::to_string(n) << "] PRN " << std::to_string(gnss_synchro_vec.at(n).PRN) << " is the reference satellite\n"; } +#if USE_GLOG_AND_GFLAGS if (FLAGS_compute_single_diffs) +#else + if (absl::GetFlag(FLAGS_compute_single_diffs)) +#endif { check_results_carrier_phase(true_obs_vec.at(n), true_TOW_ch_s, diff --git a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc index 492b5d1fc..9824e1d17 100644 --- a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc @@ -224,12 +224,17 @@ public: std::string p3; std::string p4; std::string p5; +#if USE_GLOG_AND_GFLAGS std::string implementation = FLAGS_trk_test_implementation; - const int baseband_sampling_freq = FLAGS_fs_gen_sps; - std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; +#else + std::string implementation = absl::GetFlag(FLAGS_trk_test_implementation); + const int baseband_sampling_freq = absl::GetFlag(FLAGS_fs_gen_sps); + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_filename_raw_data); +#endif int configure_generator(); int generate_signal(); @@ -310,6 +315,7 @@ public: int HybridObservablesTestFpga::configure_generator() { +#if USE_GLOG_AND_GFLAGS // Configure signal generator generator_binary = FLAGS_generator_binary; @@ -325,6 +331,24 @@ int HybridObservablesTestFpga::configure_generator() p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#else + // Configure signal generator + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(absl::GetFlag(FLAGS_duration) * 10); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_filename_raw_data); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#endif + return 0; } @@ -422,12 +446,15 @@ void* handler_DMA_obs_test(void* arguments) return nullptr; } - // ************************************************************************* - // Open input file - // ************************************************************************* + // ************************************************************************* + // Open input file + // ************************************************************************* +#if USE_GLOG_AND_GFLAGS uint32_t skip_samples = static_cast(FLAGS_skip_samples); - +#else + uint32_t skip_samples = static_cast(absl::GetFlag(FLAGS_skip_samples)); +#endif if (skip_samples + skip_used_samples > 0) { try @@ -601,8 +628,11 @@ bool HybridObservablesTestFpga::acquire_signal() std::string signal; struct DMA_handler_args_obs_test args; struct acquisition_handler_args_obs_test args_acq; - +#if USE_GLOG_AND_GFLAGS std::string file = FLAGS_signal_file; +#else + std::string file = absl::GetFlag(FLAGS_signal_file); +#endif args.file = file; // DMA file configuration // instantiate the FPGA switch and set the @@ -669,11 +699,17 @@ bool HybridObservablesTestFpga::acquire_signal() acquisition->set_gnss_synchro(&tmp_gnss_synchro); acquisition->set_channel_fsm(channel_fsm_); acquisition->set_channel(0); +#if USE_GLOG_AND_GFLAGS acquisition->set_doppler_max(config->property("Acquisition.doppler_max", FLAGS_external_signal_acquisition_doppler_max_hz)); acquisition->set_doppler_step(config->property("Acquisition.doppler_step", FLAGS_external_signal_acquisition_doppler_step_hz)); acquisition->set_doppler_center(0); acquisition->set_threshold(config->property("Acquisition.threshold", FLAGS_external_signal_acquisition_threshold)); - +#else + acquisition->set_doppler_max(config->property("Acquisition.doppler_max", absl::GetFlag(FLAGS_external_signal_acquisition_doppler_max_hz))); + acquisition->set_doppler_step(config->property("Acquisition.doppler_step", absl::GetFlag(FLAGS_external_signal_acquisition_doppler_step_hz))); + acquisition->set_doppler_center(0); + acquisition->set_threshold(config->property("Acquisition.threshold", absl::GetFlag(FLAGS_external_signal_acquisition_threshold))); +#endif std::chrono::time_point start, end; std::chrono::duration elapsed_seconds; start = std::chrono::system_clock::now(); @@ -760,7 +796,11 @@ bool HybridObservablesTestFpga::acquire_signal() if (start_msg == true) { +#if USE_GLOG_AND_GFLAGS std::cout << "Reading external signal file: " << FLAGS_signal_file << '\n'; +#else + std::cout << "Reading external signal file: " << absl::GetFlag(FLAGS_signal_file) << '\n'; +#endif std::cout << "Searching for " << System_and_Signal << " Satellites...\n"; std::cout << "["; start_msg = false; @@ -850,9 +890,15 @@ void HybridObservablesTestFpga::configure_receiver( config->set_property("Tracking.extend_correlation_symbols", std::to_string(extend_correlation_symbols)); config->set_property("Tracking.pll_bw_narrow_hz", std::to_string(PLL_narrow_bw_hz)); config->set_property("Tracking.dll_bw_narrow_hz", std::to_string(DLL_narrow_bw_hz)); +#if USE_GLOG_AND_GFLAGS config->set_property("Tracking.fll_bw_hz", std::to_string(FLAGS_fll_bw_hz)); config->set_property("Tracking.enable_fll_pull_in", FLAGS_enable_fll_pull_in ? "true" : "false"); config->set_property("Tracking.enable_fll_steady_state", FLAGS_enable_fll_steady_state ? "true" : "false"); +#else + config->set_property("Tracking.fll_bw_hz", std::to_string(absl::GetFlag(FLAGS_fll_bw_hz))); + config->set_property("Tracking.enable_fll_pull_in", absl::GetFlag(FLAGS_enable_fll_pull_in) ? "true" : "false"); + config->set_property("Tracking.enable_fll_steady_state", absl::GetFlag(FLAGS_enable_fll_steady_state) ? "true" : "false"); +#endif config->set_property("Tracking.smoother_length", std::to_string(smoother_length)); config->set_property("Tracking.dump", "true"); config->set_property("Tracking.dump_filename", "./tracking_ch_"); @@ -995,7 +1041,11 @@ void HybridObservablesTestFpga::check_results_carrier_phase( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Accumulated Carrier phase error [cycles]"); @@ -1084,7 +1134,11 @@ void HybridObservablesTestFpga::check_results_carrier_phase_double_diff( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Double diff Carrier Phase error [Cycles]"); @@ -1171,8 +1225,12 @@ void HybridObservablesTestFpga::check_results_carrier_doppler_double_diff( << " [Hz]\n"; std::cout.precision(ss); - // plots +// plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Double diff Carrier Doppler error [Hz]"); @@ -1250,7 +1308,11 @@ void HybridObservablesTestFpga::check_results_carrier_doppler( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Carrier Doppler error [Hz]"); @@ -1384,7 +1446,11 @@ void HybridObservablesTestFpga::check_results_duplicated_satellite( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Carrier Doppler error [Hz]"); @@ -1444,7 +1510,11 @@ void HybridObservablesTestFpga::check_results_duplicated_satellite( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Carrier Phase error [Cycles]"); @@ -1503,7 +1573,11 @@ void HybridObservablesTestFpga::check_results_duplicated_satellite( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Pseudorange error [m]"); @@ -1627,8 +1701,12 @@ void HybridObservablesTestFpga::check_results_code_pseudorange( << " [meters]\n"; std::cout.precision(ss); - // plots +// plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Double diff Pseudorange error [m]"); @@ -1661,7 +1739,11 @@ bool HybridObservablesTestFpga::ReadRinexObs(std::vector* obs_vec, Gn // Open and read reference RINEX observables file try { +#if USE_GLOG_AND_GFLAGS gnsstk::Rinex3ObsStream r_ref(FLAGS_filename_rinex_obs); +#else + gnsstk::Rinex3ObsStream r_ref(absl::GetFlag(FLAGS_filename_rinex_obs)); +#endif r_ref.exceptions(std::ios::failbit); gnsstk::Rinex3ObsData r_ref_data; gnsstk::Rinex3ObsHeader r_ref_header; @@ -1828,7 +1910,11 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) configure_generator(); // Generate signal raw signal samples and observations RINEX file +#if USE_GLOG_AND_GFLAGS if (FLAGS_disable_generator == false) +#else + if (absl::GetFlag(FLAGS_disable_generator) == false) +#endif { generate_signal(); } @@ -1836,8 +1922,12 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); - // use generator or use an external capture file +// use generator or use an external capture file +#if USE_GLOG_AND_GFLAGS if (FLAGS_enable_external_signal_file) +#else + if (absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { // create and configure an acquisition block and perform an acquisition to obtain the synchronization parameters ASSERT_EQ(acquire_signal(), true); @@ -1849,7 +1939,11 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) std::string signal = "1C"; signal.copy(tmp_gnss_synchro.Signal, 2, 0); +#if USE_GLOG_AND_GFLAGS std::istringstream ss(FLAGS_test_satellite_PRN_list); +#else + std::istringstream ss(absl::GetFlag(FLAGS_test_satellite_PRN_list)); +#endif std::string token; while (std::getline(ss, token, ',')) @@ -1858,7 +1952,7 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) gnss_synchro_vec.push_back(tmp_gnss_synchro); } } - +#if USE_GLOG_AND_GFLAGS configure_receiver(FLAGS_PLL_bw_hz_start, FLAGS_DLL_bw_hz_start, FLAGS_PLL_narrow_bw_hz, @@ -1866,11 +1960,24 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) FLAGS_extend_correlation_symbols, FLAGS_smoother_length, FLAGS_high_dyn); +#else + configure_receiver(absl::GetFlag(FLAGS_PLL_bw_hz_start), + absl::GetFlag(FLAGS_DLL_bw_hz_start), + absl::GetFlag(FLAGS_PLL_narrow_bw_hz), + absl::GetFlag(FLAGS_DLL_narrow_bw_hz), + absl::GetFlag(FLAGS_extend_correlation_symbols), + absl::GetFlag(FLAGS_smoother_length), + absl::GetFlag(FLAGS_high_dyn)); +#endif for (auto& n : gnss_synchro_vec) { // setup the signal synchronization, simulating an acquisition +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { // based on true observables metadata (for custom sdr generator) // open true observables log file written by the simulator or based on provided RINEX obs @@ -2011,6 +2118,7 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) std::string file; ASSERT_NO_THROW({ +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { file = "./" + filename_raw_data; @@ -2019,6 +2127,16 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) { file = FLAGS_signal_file; } +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + file = "./" + filename_raw_data; + } + else + { + file = absl::GetFlag(FLAGS_signal_file); + } +#endif int observable_interval_ms = 20; double fs = static_cast(config->property("GNSS-SDR.internal_fs_sps", 0)); @@ -2051,7 +2169,12 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) usleep(1000000); args.file = file; +#if USE_GLOG_AND_GFLAGS args.nsamples_tx = baseband_sampling_freq * FLAGS_duration; +#else + args.nsamples_tx = baseband_sampling_freq * absl::GetFlag(FLAGS_duration); +#endif + args.skip_used_samples = 0; if (pthread_create(&thread_DMA, nullptr, handler_DMA_obs_test, reinterpret_cast(&args)) < 0) @@ -2087,8 +2210,11 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) // check results // Matrices for storing columnwise true GPS time, Range, Doppler and Carrier phase std::vector true_obs_vec; - +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { // load the true values True_Observables_Reader true_observables; @@ -2132,7 +2258,11 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) } else { +#if USE_GLOG_AND_GFLAGS if (!FLAGS_duplicated_satellites_test) +#else + if (!absl::GetFlag(FLAGS_duplicated_satellites_test)) +#endif { ASSERT_EQ(ReadRinexObs(&true_obs_vec, gnss_synchro_master), true) << "Failure reading RINEX file"; @@ -2188,8 +2318,12 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) } } - // Cut measurement initial transitory of the measurements +// Cut measurement initial transitory of the measurements +#if USE_GLOG_AND_GFLAGS double initial_transitory_s = FLAGS_skip_obs_transitory_s; +#else + double initial_transitory_s = absl::GetFlag(FLAGS_skip_obs_transitory_s); +#endif for (unsigned int n = 0; n < measured_obs_vec.size(); n++) { index = arma::find(measured_obs_vec.at(n).col(0) >= (measured_obs_vec.at(n)(0, 0) + initial_transitory_s), 1, "first"); @@ -2197,8 +2331,11 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) { measured_obs_vec.at(n).shed_rows(0, index(0)); } - +#if USE_GLOG_AND_GFLAGS if (!FLAGS_duplicated_satellites_test) +#else + if (!absl::GetFlag(FLAGS_duplicated_satellites_test)) +#endif { index = arma::find(measured_obs_vec.at(n).col(0) >= true_obs_vec.at(n)(0, 0), 1, "first"); if ((!index.empty()) and (index(0) > 0)) @@ -2207,12 +2344,19 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) } } } - +#if USE_GLOG_AND_GFLAGS if (FLAGS_duplicated_satellites_test) +#else + if (absl::GetFlag(FLAGS_duplicated_satellites_test)) +#endif { // special test mode for duplicated satellites std::vector prn_pairs; +#if USE_GLOG_AND_GFLAGS std::stringstream ss(FLAGS_duplicated_satellites_prns); +#else + std::stringstream ss(absl::GetFlag(FLAGS_duplicated_satellites_prns)); +#endif unsigned int i; while (ss >> i) { @@ -2363,7 +2507,11 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) "[CH " + std::to_string(n) + "] PRN " + std::to_string(gnss_synchro_vec.at(n).PRN) + " "); // Do not compare E5a with E5 RINEX due to the Doppler frequency discrepancy caused by the different center frequencies // E5a_fc=1176.45e6, E5b_fc=1207.14e6, E5_fc=1191.795e6; +#if USE_GLOG_AND_GFLAGS if (strcmp("5X\0", gnss_synchro_vec.at(n).Signal) != 0 or FLAGS_compare_with_5X) +#else + if (strcmp("5X\0", gnss_synchro_vec.at(n).Signal) != 0 or absl::GetFlag(FLAGS_compare_with_5X)) +#endif { check_results_carrier_phase_double_diff(true_obs_vec.at(n), true_obs_vec.at(min_pr_ch_id), @@ -2386,7 +2534,11 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) { std::cout << "[CH " << std::to_string(n) << "] PRN " << std::to_string(gnss_synchro_vec.at(n).PRN) << " is the reference satellite\n"; } +#if USE_GLOG_AND_GFLAGS if (FLAGS_compute_single_diffs) +#else + if (absl::GetFlag(FLAGS_compute_single_diffs)) +#endif { check_results_carrier_phase(true_obs_vec.at(n), true_TOW_ch_s, diff --git a/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc b/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc index 3155a3ab8..f6916b29f 100644 --- a/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc @@ -186,11 +186,15 @@ public: std::string p4; std::string p5; +#if USE_GLOG_AND_GFLAGS const int baseband_sampling_freq = FLAGS_fs_gen_sps; - std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; - +#else + const int baseband_sampling_freq = absl::GetFlag(FLAGS_fs_gen_sps); + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_filename_raw_data); +#endif int configure_generator(); int generate_signal(); void check_results(arma::vec& true_time_s, @@ -218,6 +222,7 @@ public: int GpsL1CATelemetryDecoderTest::configure_generator() { +#if USE_GLOG_AND_GFLAGS // Configure signal generator generator_binary = FLAGS_generator_binary; @@ -233,6 +238,24 @@ int GpsL1CATelemetryDecoderTest::configure_generator() p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#else + // Configure signal generator + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(absl::GetFlag(FLAGS_duration) * 10); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_filename_raw_data); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#endif + return 0; } @@ -268,8 +291,11 @@ void GpsL1CATelemetryDecoderTest::configure_receiver() gnss_synchro.System = 'G'; std::string signal = "1C"; signal.copy(gnss_synchro.Signal, 2, 0); +#if USE_GLOG_AND_GFLAGS gnss_synchro.PRN = FLAGS_test_satellite_PRN; - +#else + gnss_synchro.PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); // Set Tracking @@ -340,7 +366,11 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults) configure_generator(); // Generate signal raw signal samples and observations RINEX file +#if USE_GLOG_AND_GFLAGS if (FLAGS_disable_generator == false) +#else + if (absl::GetFlag(FLAGS_disable_generator) == false) +#endif { generate_signal(); } @@ -352,7 +382,11 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults) // open true observables log file written by the simulator Tracking_True_Obs_Reader true_obs_data; +#if USE_GLOG_AND_GFLAGS int test_satellite_PRN = FLAGS_test_satellite_PRN; +#else + int test_satellite_PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif std::cout << "Testing satellite PRN=" << test_satellite_PRN << '\n'; std::string true_obs_file = std::string("./gps_l1_ca_obs_prn"); true_obs_file.append(std::to_string(test_satellite_PRN)); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc index 34c4894d7..7b7566f00 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc @@ -18,18 +18,25 @@ #include "GPS_L1_CA.h" #include "cpu_multicorrelator_real_codes.h" #include "gps_sdr_signal_replica.h" -#include #include #include #include #include #include +#include #include #include - +#if USE_GLOG_AND_GFLAGS +#include DEFINE_int32(cpu_multicorrelator_real_codes_iterations_test, 100, "Number of averaged iterations in CPU multicorrelator test timing test"); DEFINE_int32(cpu_multicorrelator_real_codes_max_threads_test, 12, "Number of maximum concurrent correlators in CPU multicorrelator test timing test"); +#else +#include +ABSL_FLAG(int32_t, cpu_multicorrelator_real_codes_iterations_test, 100, "Number of averaged iterations in CPU multicorrelator test timing test"); +ABSL_FLAG(int32_t, cpu_multicorrelator_real_codes_max_threads_test, 12, "Number of maximum concurrent correlators in CPU multicorrelator test timing test"); +#endif + void run_correlator_cpu_real_codes(Cpu_Multicorrelator_Real_Codes* correlator, float d_rem_carrier_phase_rad, @@ -39,7 +46,11 @@ void run_correlator_cpu_real_codes(Cpu_Multicorrelator_Real_Codes* correlator, float d_rem_code_phase_chips, int correlation_size) { +#if USE_GLOG_AND_GFLAGS for (int k = 0; k < FLAGS_cpu_multicorrelator_real_codes_iterations_test; k++) +#else + for (int k = 0; k < absl::GetFlag(FLAGS_cpu_multicorrelator_real_codes_iterations_test); k++) +#endif { correlator->Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad, d_carrier_phase_step_rad, @@ -56,7 +67,11 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTime) std::chrono::time_point start; std::chrono::time_point end; std::chrono::duration elapsed_seconds(0); +#if USE_GLOG_AND_GFLAGS int max_threads = FLAGS_cpu_multicorrelator_real_codes_max_threads_test; +#else + int max_threads = absl::GetFlag(FLAGS_cpu_multicorrelator_real_codes_max_threads_test); +#endif std::vector thread_pool; std::vector correlator_pool(max_threads); unsigned int correlation_sizes[3] = {2048, 4096, 8192}; @@ -143,7 +158,11 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTime) thread_pool.clear(); end = std::chrono::system_clock::now(); elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(FLAGS_cpu_multicorrelator_real_codes_iterations_test); +#else + execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(absl::GetFlag(FLAGS_cpu_multicorrelator_real_codes_iterations_test)); +#endif std::cout << "CPU Multicorrelator (real codes) execution time for length=" << correlation_sizes[correlation_sizes_idx] << " : " << execution_times[correlation_sizes_idx] << " [s]\n"; } @@ -166,7 +185,11 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTimeAlloc) std::chrono::time_point start; std::chrono::time_point end; std::chrono::duration elapsed_seconds(0); +#if USE_GLOG_AND_GFLAGS int max_threads = FLAGS_cpu_multicorrelator_real_codes_max_threads_test; +#else + int max_threads = absl::GetFlag(FLAGS_cpu_multicorrelator_real_codes_max_threads_test); +#endif std::vector thread_pool; std::vector correlator_pool(max_threads); unsigned int correlation_sizes[3] = {2048, 4096, 8192}; @@ -241,7 +264,11 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTimeAlloc) thread_pool.clear(); end = std::chrono::system_clock::now(); elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(FLAGS_cpu_multicorrelator_real_codes_iterations_test); +#else + execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(absl::GetFlag(FLAGS_cpu_multicorrelator_real_codes_iterations_test)); +#endif std::cout << "CPU Multicorrelator (real codes) execution time for length=" << correlation_sizes[correlation_sizes_idx] << " : " << execution_times[correlation_sizes_idx] << " [s]\n"; } diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc index 339205f43..7bd54c5a9 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc @@ -18,7 +18,6 @@ #include "GPS_L1_CA.h" #include "cpu_multicorrelator.h" #include "gps_sdr_signal_replica.h" -#include #include #include #include @@ -27,9 +26,13 @@ #include #include - +#if USE_GLOG_AND_GFLAGS DEFINE_int32(cpu_multicorrelator_iterations_test, 100, "Number of averaged iterations in CPU multicorrelator test timing test"); DEFINE_int32(cpu_multicorrelator_max_threads_test, 12, "Number of maximum concurrent correlators in CPU multicorrelator test timing test"); +#else +ABSL_FLAG(int32_t, cpu_multicorrelator_iterations_test, 100, "Number of averaged iterations in CPU multicorrelator test timing test"); +ABSL_FLAG(int32_t, cpu_multicorrelator_max_threads_test, 12, "Number of maximum concurrent correlators in CPU multicorrelator test timing test"); +#endif void run_correlator_cpu(Cpu_Multicorrelator* correlator, float d_rem_carrier_phase_rad, @@ -38,7 +41,11 @@ void run_correlator_cpu(Cpu_Multicorrelator* correlator, float d_rem_code_phase_chips, int correlation_size) { +#if USE_GLOG_AND_GFLAGS for (int k = 0; k < FLAGS_cpu_multicorrelator_iterations_test; k++) +#else + for (int k = 0; k < absl::GetFlag(FLAGS_cpu_multicorrelator_iterations_test); k++) +#endif { correlator->Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad, d_carrier_phase_step_rad, @@ -53,7 +60,11 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTime) { std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); +#if USE_GLOG_AND_GFLAGS int max_threads = FLAGS_cpu_multicorrelator_max_threads_test; +#else + int max_threads = absl::GetFlag(FLAGS_cpu_multicorrelator_max_threads_test); +#endif std::vector thread_pool; std::vector correlator_pool(max_threads); unsigned int correlation_sizes[3] = {2048, 4096, 8192}; @@ -138,7 +149,11 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTime) thread_pool.clear(); end = std::chrono::system_clock::now(); elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(FLAGS_cpu_multicorrelator_iterations_test); +#else + execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(absl::GetFlag(FLAGS_cpu_multicorrelator_iterations_test)); +#endif std::cout << "CPU Multicorrelator execution time for length=" << correlation_sizes[correlation_sizes_idx] << " : " << execution_times[correlation_sizes_idx] << " [s]\n"; } @@ -160,7 +175,11 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTimeAlloc) { std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); +#if USE_GLOG_AND_GFLAGS int max_threads = FLAGS_cpu_multicorrelator_max_threads_test; +#else + int max_threads = absl::GetFlag(FLAGS_cpu_multicorrelator_max_threads_test); +#endif std::vector thread_pool; std::vector correlator_pool(max_threads); unsigned int correlation_sizes[3] = {2048, 4096, 8192}; @@ -236,7 +255,11 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTimeAlloc) thread_pool.clear(); end = std::chrono::system_clock::now(); elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(FLAGS_cpu_multicorrelator_iterations_test); +#else + execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(absl::GetFlag(FLAGS_cpu_multicorrelator_iterations_test)); +#endif std::cout << "CPU Multicorrelator execution time for length=" << correlation_sizes[correlation_sizes_idx] << " : " << execution_times[correlation_sizes_idx] << " [s]\n"; } diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc index 0519b3de3..b5b92999b 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc @@ -53,7 +53,7 @@ protected: gr::top_block_sptr top_block; std::shared_ptr factory; std::shared_ptr config; - Gnss_Synchro gnss_synchro{}; + Gnss_Synchro gnss_synchro; size_t item_size; int message{0}; bool stop{false}; diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc index 87af5fe45..a7464207c 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc @@ -138,10 +138,15 @@ public: std::string p6; std::string implementation = "GPS_L1_CA_DLL_PLL_Tracking"; +#if USE_GLOG_AND_GFLAGS const int baseband_sampling_freq = FLAGS_fs_gen_sps; - std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; +#else + const int baseband_sampling_freq = absl::GetFlag(FLAGS_fs_gen_sps); + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_filename_raw_data); +#endif int configure_generator(double CN0_dBHz, int file_idx); int generate_signal(); @@ -193,6 +198,7 @@ public: int GpsL1CADllPllTrackingTest::configure_generator(double CN0_dBHz, int file_idx) { +#if USE_GLOG_AND_GFLAGS // Configure signal generator generator_binary = FLAGS_generator_binary; @@ -209,6 +215,25 @@ int GpsL1CADllPllTrackingTest::configure_generator(double CN0_dBHz, int file_idx p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data + std::to_string(file_idx); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] p6 = std::string("-CN0_dBHz=") + std::to_string(CN0_dBHz); // Signal generator CN0 +#else + // Configure signal generator + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(absl::GetFlag(FLAGS_duration) * 10); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_filename_raw_data) + std::to_string(file_idx); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] + p6 = std::string("-CN0_dBHz=") + std::to_string(CN0_dBHz); // Signal generator CN0 +#endif + return 0; } @@ -249,7 +274,12 @@ void GpsL1CADllPllTrackingTest::configure_receiver( gnss_synchro.System = 'G'; std::string signal = "1C"; signal.copy(gnss_synchro.Signal, 2, 0); + +#if USE_GLOG_AND_GFLAGS gnss_synchro.PRN = FLAGS_test_satellite_PRN; +#else + gnss_synchro.PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif config = std::make_shared(); config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); @@ -464,6 +494,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) // *********************************************************** // ***** STEP 2: Tracking configuration parameters sweep ***** // *********************************************************** +#if USE_GLOG_AND_GFLAGS if (FLAGS_PLL_bw_hz_start == FLAGS_PLL_bw_hz_stop) { if (FLAGS_DLL_bw_hz_start == FLAGS_DLL_bw_hz_stop) @@ -491,25 +522,70 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) DLL_wide_bw_values.push_back(FLAGS_DLL_bw_hz_start); } } +#else + if (absl::GetFlag(FLAGS_PLL_bw_hz_start) == absl::GetFlag(FLAGS_PLL_bw_hz_stop)) + { + if (absl::GetFlag(FLAGS_DLL_bw_hz_start) == absl::GetFlag(FLAGS_DLL_bw_hz_stop)) + { + // NO PLL/DLL BW sweep + PLL_wide_bw_values.push_back(absl::GetFlag(FLAGS_PLL_bw_hz_start)); + DLL_wide_bw_values.push_back(absl::GetFlag(FLAGS_DLL_bw_hz_start)); + } + else + { + // DLL BW Sweep + for (double dll_bw = absl::GetFlag(FLAGS_DLL_bw_hz_start); dll_bw >= absl::GetFlag(FLAGS_DLL_bw_hz_stop); dll_bw = dll_bw - absl::GetFlag(FLAGS_DLL_bw_hz_step)) + { + PLL_wide_bw_values.push_back(absl::GetFlag(FLAGS_PLL_bw_hz_start)); + DLL_wide_bw_values.push_back(dll_bw); + } + } + } + else + { + // PLL BW Sweep + for (double pll_bw = absl::GetFlag(FLAGS_PLL_bw_hz_start); pll_bw >= absl::GetFlag(FLAGS_PLL_bw_hz_stop); pll_bw = pll_bw - absl::GetFlag(FLAGS_PLL_bw_hz_step)) + { + PLL_wide_bw_values.push_back(pll_bw); + DLL_wide_bw_values.push_back(absl::GetFlag(FLAGS_DLL_bw_hz_start)); + } + } +#endif // ********************************************* // ***** STEP 3: Generate the input signal ***** // ********************************************* std::vector cno_vector; +#if USE_GLOG_AND_GFLAGS if (FLAGS_CN0_dBHz_start == FLAGS_CN0_dBHz_stop) { generator_CN0_values.push_back(FLAGS_CN0_dBHz_start); } +#else + if (absl::GetFlag(FLAGS_CN0_dBHz_start) == absl::GetFlag(FLAGS_CN0_dBHz_stop)) + { + generator_CN0_values.push_back(absl::GetFlag(FLAGS_CN0_dBHz_start)); + } +#endif else { +#if USE_GLOG_AND_GFLAGS for (double cn0 = FLAGS_CN0_dBHz_start; cn0 > FLAGS_CN0_dBHz_stop; cn0 = cn0 - FLAGS_CN0_dB_step) +#else + for (double cn0 = absl::GetFlag(FLAGS_CN0_dBHz_start); cn0 > absl::GetFlag(FLAGS_CN0_dBHz_stop); cn0 = cn0 - absl::GetFlag(FLAGS_CN0_dB_step)) +#endif { generator_CN0_values.push_back(cn0); } } - // use generator or use an external capture file + // use generator or use an external capture file + +#if USE_GLOG_AND_GFLAGS if (FLAGS_enable_external_signal_file) +#else + if (absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { // todo: create and configure an acquisition block and perform an acquisition to obtain the synchronization parameters } @@ -520,7 +596,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) // Configure the signal generator configure_generator(generator_CN0_values.at(current_cn0_idx), current_cn0_idx); // Generate signal raw signal samples and observations RINEX file +#if USE_GLOG_AND_GFLAGS if (FLAGS_disable_generator == false) +#else + if (absl::GetFlag(FLAGS_disable_generator) == false) +#endif { generate_signal(); } @@ -561,17 +641,29 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) configure_receiver(PLL_wide_bw_values.at(config_idx), DLL_wide_bw_values.at(config_idx), +#if USE_GLOG_AND_GFLAGS FLAGS_PLL_narrow_bw_hz, FLAGS_DLL_narrow_bw_hz, FLAGS_extend_correlation_symbols); +#else + absl::GetFlag(FLAGS_PLL_narrow_bw_hz), + absl::GetFlag(FLAGS_DLL_narrow_bw_hz), + absl::GetFlag(FLAGS_extend_correlation_symbols)); +#endif for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++) { // ****************************************************************************************** // ***** Obtain the initial signal sinchronization parameters (emulating an acquisition) **** // ****************************************************************************************** +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { test_satellite_PRN = FLAGS_test_satellite_PRN; +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + test_satellite_PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif std::string true_obs_file = std::string("./gps_l1_ca_obs_prn"); true_obs_file.append(std::to_string(test_satellite_PRN)); true_obs_file.append(".dat"); @@ -580,7 +672,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) // load acquisition data based on the first epoch of the true observations ASSERT_EQ(true_obs_data.read_binary_obs(), true) << "Failure reading true tracking dump file.\n" +#if USE_GLOG_AND_GFLAGS << "Maybe sat PRN #" + std::to_string(FLAGS_test_satellite_PRN) + +#else + << "Maybe sat PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + +#endif " is not available?"; std::cout << "Testing satellite PRN=" << test_satellite_PRN << '\n'; std::cout << "Initial Doppler [Hz]=" << true_obs_data.doppler_l1_hz << " Initial code delay [Chips]=" << true_obs_data.prn_delay_chips << '\n'; @@ -694,10 +790,14 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) promptQ_sweep.push_back(promptQ); CN0_dBHz_sweep.push_back(CN0_dBHz); - // *********************************************************** - // ***** STEP 6: Compare with true values (if available) ***** - // *********************************************************** +// *********************************************************** +// ***** STEP 6: Compare with true values (if available) ***** +// *********************************************************** +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { std::vector doppler_error_hz; std::vector code_phase_error_chips; @@ -726,8 +826,12 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) true_tow_s(epoch_counter) = true_obs_data.tow; epoch_counter++; } - // Align initial measurements and cut the tracking pull-in transitory +// Align initial measurements and cut the tracking pull-in transitory +#if USE_GLOG_AND_GFLAGS double pull_in_offset_s = FLAGS_skip_trk_transitory_s; +#else + double pull_in_offset_s = absl::GetFlag(FLAGS_skip_trk_transitory_s); +#endif arma::uvec initial_meas_point = arma::find(trk_timestamp_s >= (true_timestamp_s(0) + pull_in_offset_s), 1, "first"); if (!initial_meas_point.empty() and tracking_last_msg != 3) @@ -782,8 +886,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) } } } // CN0 LOOP - +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { mean_doppler_error_sweep.push_back(mean_doppler_error); std_dev_doppler_error_sweep.push_back(std_dev_doppler_error); @@ -801,12 +908,18 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) generator_CN0_values_sweep_copy.push_back(valid_CN0_values); } - // ******************************** - // ***** STEP 7: Plot results ***** - // ******************************** +// ******************************** +// ***** STEP 7: Plot results ***** +// ******************************** +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_gps_l1_tracking_test == true) { const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + if (absl::GetFlag(FLAGS_plot_gps_l1_tracking_test) == true) + { + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag plot_gps_l1_tracking_test has been set to TRUE,\n"; @@ -821,14 +934,26 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) fs::path dir = p.parent_path(); const std::string& gnuplot_path = dir.native(); Gnuplot::set_GNUPlotPath(gnuplot_path); +#if USE_GLOG_AND_GFLAGS auto decimate = static_cast(FLAGS_plot_decimate); if (FLAGS_plot_detail_level >= 2) +#else + auto decimate = static_cast(absl::GetFlag(FLAGS_plot_decimate)); + + if (absl::GetFlag(FLAGS_plot_detail_level) >= 2) +#endif + { for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++) { Gnuplot g1("linespoints"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif + { g1.showonscreen(); // window output } @@ -836,7 +961,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) { g1.disablescreen(); } +#if USE_GLOG_AND_GFLAGS g1.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, " + "PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g1.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, " + "PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g1.set_grid(); g1.set_xlabel("Time [s]"); g1.set_ylabel("Correlators' output"); @@ -849,7 +978,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g1.savetopdf("Correlators_outputs" + std::to_string(generator_CN0_values.at(current_cn0_idx)), 18); } Gnuplot g2("points"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g2.showonscreen(); // window output } @@ -862,7 +995,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++) { g2.reset_plot(); +#if USE_GLOG_AND_GFLAGS g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g2.set_grid(); g2.set_xlabel("Inphase"); g2.set_ylabel("Quadrature"); @@ -874,7 +1011,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g2.savetopdf("Constellation", 18); Gnuplot g3("linespoints"); +#if USE_GLOG_AND_GFLAGS g3.set_title("GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g3.set_title("GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g3.set_grid(); g3.set_xlabel("Time [s]"); g3.set_ylabel("Reported CN0 [dB-Hz]"); @@ -887,7 +1028,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g3.set_legend(); g3.savetops("CN0_output"); g3.savetopdf("CN0_output", 18); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g3.showonscreen(); // window output } @@ -897,13 +1042,22 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) } } - // PLOT ERROR FIGURES (only if it is used the signal generator) +// PLOT ERROR FIGURES (only if it is used the signal generator) +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { if (FLAGS_plot_detail_level >= 1) { Gnuplot g5("points"); if (FLAGS_show_plots) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + if (absl::GetFlag(FLAGS_plot_detail_level) >= 1) + { + Gnuplot g5("points"); + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g5.showonscreen(); // window output } @@ -911,7 +1065,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) { g5.disablescreen(); } +#if USE_GLOG_AND_GFLAGS g5.set_title("Code delay error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g5.set_title("Code delay error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g5.set_grid(); g5.set_xlabel("Time [s]"); g5.set_ylabel("Code delay error [Chips]"); @@ -937,7 +1095,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g5.savetopdf("Code_error_chips", 18); Gnuplot g5b("points"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g5b.showonscreen(); // window output } @@ -945,7 +1107,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) { g5b.disablescreen(); } +#if USE_GLOG_AND_GFLAGS g5b.set_title("Code delay error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g5b.set_title("Code delay error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g5b.set_grid(); g5b.set_xlabel("Time [s]"); g5b.set_ylabel("Code delay error [meters]"); @@ -971,7 +1137,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g5b.savetopdf("Code_error_meters", 18); Gnuplot g6("points"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g6.showonscreen(); // window output } @@ -979,7 +1149,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) { g6.disablescreen(); } +#if USE_GLOG_AND_GFLAGS g6.set_title("Accumulated carrier phase error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g6.set_title("Accumulated carrier phase error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g6.set_grid(); g6.set_xlabel("Time [s]"); g6.set_ylabel("Accumulated carrier phase error [Cycles]"); @@ -1005,7 +1179,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g6.savetopdf("Acc_carrier_phase_error_cycles", 18); Gnuplot g4("points"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g4.showonscreen(); // window output } @@ -1018,7 +1196,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values_sweep_copy.at(config_idx).size(); current_cn0_idx++) { g4.reset_plot(); +#if USE_GLOG_AND_GFLAGS g4.set_title("Dopper error" + std::to_string(static_cast(round(generator_CN0_values_sweep_copy.at(config_idx).at(current_cn0_idx)))) + "[dB-Hz], PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g4.set_title("Dopper error" + std::to_string(static_cast(round(generator_CN0_values_sweep_copy.at(config_idx).at(current_cn0_idx)))) + "[dB-Hz], PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g4.set_grid(); // g4.cmd("set key box opaque"); g4.set_xlabel("Time [s]"); @@ -1051,7 +1233,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) } } +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_gps_l1_tracking_test == true) +#else + if (absl::GetFlag(FLAGS_plot_gps_l1_tracking_test) == true) +#endif { std::cout << "Plotting performance metrics...\n"; try @@ -1060,7 +1246,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) { // plot metrics Gnuplot g7("linespoints"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g7.showonscreen(); // window output } @@ -1068,7 +1258,12 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) { g7.disablescreen(); } + +#if USE_GLOG_AND_GFLAGS g7.set_title("Doppler error metrics (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g7.set_title("Doppler error metrics (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g7.set_grid(); g7.set_xlabel("CN0 [dB-Hz]"); g7.set_ylabel("Doppler error [Hz]"); @@ -1093,7 +1288,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g7.savetopdf("Doppler_error_metrics", 18); Gnuplot g8("linespoints"); +#if USE_GLOG_AND_GFLAGS g8.set_title("Accumulated carrier phase error metrics (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g8.set_title("Accumulated carrier phase error metrics (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g8.set_grid(); g8.set_xlabel("CN0 [dB-Hz]"); g8.set_ylabel("Accumulated Carrier Phase error [Cycles]"); @@ -1117,7 +1316,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g8.savetopdf("Carrier_error_metrics", 18); Gnuplot g9("linespoints"); +#if USE_GLOG_AND_GFLAGS g9.set_title("Code Phase error metrics (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g9.set_title("Code Phase error metrics (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g9.set_grid(); g9.set_xlabel("CN0 [dB-Hz]"); g9.set_ylabel("Code Phase error [Chips]"); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc index 81ca1df0c..4bd43fc30 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc @@ -29,8 +29,6 @@ #include "tracking_true_obs_reader.h" #include #include // to test the FPGA we have to create a simultaneous task to send the samples using the DMA and stop the test -#include -#include #include #include #include @@ -46,6 +44,14 @@ #include #include #include + +#if USE_GLOG_AND_GFLAGS +#include +#include +#else +#include +#include +#endif #if HAS_GENERIC_LAMBDA #else #include @@ -232,11 +238,15 @@ public: std::string p4; std::string p5; +#if USE_GLOG_AND_GFLAGS const int baseband_sampling_freq = FLAGS_fs_gen_sps; - std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; - +#else + const int baseband_sampling_freq = absl::GetFlag(FLAGS_fs_gen_sps); + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_filename_raw_data); +#endif int configure_generator(); int generate_signal(); void check_results_doppler(arma::vec &true_time_s, arma::vec &true_value, @@ -266,7 +276,8 @@ public: int GpsL1CADllPllTrackingTestFpga::configure_generator() { - // Configure signal generator +// Configure signal generator +#if USE_GLOG_AND_GFLAGS generator_binary = FLAGS_generator_binary; p1 = std::string("-rinex_nav_file=") + FLAGS_rinex_nav_file; @@ -281,6 +292,23 @@ int GpsL1CADllPllTrackingTestFpga::configure_generator() p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#else + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(absl::GetFlag(FLAGS_duration) * 10); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_filename_raw_data); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#endif + return 0; } @@ -317,7 +345,11 @@ void GpsL1CADllPllTrackingTestFpga::configure_receiver() gnss_synchro.System = 'G'; std::string signal = "1C"; signal.copy(gnss_synchro.Signal, 2, 0); +#if USE_GLOG_AND_GFLAGS gnss_synchro.PRN = FLAGS_test_satellite_PRN; +#else + gnss_synchro.PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); @@ -464,7 +496,11 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga) // open true observables log file written by the simulator Tracking_True_Obs_Reader true_obs_data; +#if USE_GLOG_AND_GFLAGS int test_satellite_PRN = FLAGS_test_satellite_PRN; +#else + int test_satellite_PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif std::cout << "Testing satellite PRN=" << test_satellite_PRN << '\n'; std::string true_obs_file = std::string("./gps_l1_ca_obs_prn"); true_obs_file.append(std::to_string(test_satellite_PRN)); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_gaussian_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_gaussian_tracking_test.cc index fbd1b2d0f..8765ac60c 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_gaussian_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_gaussian_tracking_test.cc @@ -60,8 +60,11 @@ namespace wht = boost; namespace wht = std; #endif +#if USE_GLOG_AND_GFLAGS DEFINE_bool(plot_gps_l1_gaussian_tracking_test, false, "Plots results of GpsL1CAGaussianTrackingTest with gnuplot"); - +#else +ABSL_FLAG(bool, plot_gps_l1_gaussian_tracking_test, false, "Plots results of GpsL1CAGaussianTrackingTest with gnuplot"); +#endif // ######## GNURADIO BLOCK MESSAGE RECEVER ######### class GpsL1CAGaussianTrackingTest_msg_rx; @@ -139,10 +142,15 @@ public: std::string implementation = "GPS_L1_CA_Gaussian_Tracking"; +#if USE_GLOG_AND_GFLAGS const int baseband_sampling_freq = FLAGS_fs_gen_sps; - std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; +#else + const int baseband_sampling_freq = absl::GetFlag(FLAGS_fs_gen_sps); + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_filename_raw_data); +#endif int configure_generator(); int generate_signal(); @@ -181,6 +189,7 @@ public: int GpsL1CAGaussianTrackingTest::configure_generator() { +#if USE_GLOG_AND_GFLAGS // Configure signal generator generator_binary = FLAGS_generator_binary; @@ -196,6 +205,24 @@ int GpsL1CAGaussianTrackingTest::configure_generator() p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#else + // Configure signal generator + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(absl::GetFlag(FLAGS_duration) * 10); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_filename_raw_data); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#endif + return 0; } @@ -231,16 +258,27 @@ void GpsL1CAGaussianTrackingTest::configure_receiver() gnss_synchro.System = 'G'; std::string signal = "1C"; signal.copy(gnss_synchro.Signal, 2, 0); +#if USE_GLOG_AND_GFLAGS gnss_synchro.PRN = FLAGS_test_satellite_PRN; +#else + gnss_synchro.PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); // Set Tracking config->set_property("Tracking_1C.implementation", implementation); config->set_property("Tracking_1C.item_type", "gr_complex"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) { config->set_property("Tracking_1C.dll_bw_hz", std::to_string(FLAGS_dll_bw_hz)); } +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) + { + config->set_property("Tracking_1C.dll_bw_hz", std::to_string(absl::GetFlag(FLAGS_dll_bw_hz))); + } +#endif else { config->set_property("Tracking_1C.dll_bw_hz", "2.0"); @@ -376,18 +414,28 @@ TEST_F(GpsL1CAGaussianTrackingTest, ValidationOfResults) configure_generator(); // Generate signal raw signal samples and observations RINEX file +#if USE_GLOG_AND_GFLAGS if (FLAGS_disable_generator == false) { generate_signal(); } - +#else + if (absl::GetFlag(FLAGS_disable_generator) == false) + { + generate_signal(); + } +#endif std::chrono::time_point start, end; configure_receiver(); // open true observables log file written by the simulator Tracking_True_Obs_Reader true_obs_data; +#if USE_GLOG_AND_GFLAGS int test_satellite_PRN = FLAGS_test_satellite_PRN; +#else + int test_satellite_PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif std::cout << "Testing satellite PRN=" << test_satellite_PRN << '\n'; std::string true_obs_file = std::string("./gps_l1_ca_obs_prn"); true_obs_file.append(std::to_string(test_satellite_PRN)); @@ -404,7 +452,11 @@ TEST_F(GpsL1CAGaussianTrackingTest, ValidationOfResults) // load acquisition data based on the first epoch of the true observations ASSERT_EQ(true_obs_data.read_binary_obs(), true) << "Failure reading true tracking dump file.\n" +#if USE_GLOG_AND_GFLAGS << "Maybe sat PRN #" + std::to_string(FLAGS_test_satellite_PRN) + +#else + << "Maybe sat PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + +#endif " is not available?"; // restart the epoch counter @@ -522,10 +574,15 @@ TEST_F(GpsL1CAGaussianTrackingTest, ValidationOfResults) std::chrono::duration elapsed_seconds = end - start; std::cout << "Signal tracking completed in " << elapsed_seconds.count() << " seconds.\n"; - +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_gps_l1_gaussian_tracking_test == true) { const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + if (absl::GetFlag(FLAGS_plot_gps_l1_gaussian_tracking_test) == true) + { + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag plot_gps_l1_tracking_test has been set to TRUE,\n"; @@ -549,18 +606,30 @@ TEST_F(GpsL1CAGaussianTrackingTest, ValidationOfResults) t = t + GPS_L1_CA_CODE_PERIOD_S; } Gnuplot g1("linespoints"); +#if USE_GLOG_AND_GFLAGS g1.set_title("GPS L1 C/A signal tracking correlators' output (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g1.set_title("GPS L1 C/A signal tracking correlators' output (satellite PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g1.set_grid(); g1.set_xlabel("Time [s]"); g1.set_ylabel("Correlators' output"); g1.cmd("set key box opaque"); +#if USE_GLOG_AND_GFLAGS auto decimate = static_cast(FLAGS_plot_decimate); +#else + auto decimate = static_cast(absl::GetFlag(FLAGS_plot_decimate)); +#endif g1.plot_xy(timevec, prompt, "Prompt", decimate); g1.plot_xy(timevec, early, "Early", decimate); g1.plot_xy(timevec, late, "Late", decimate); g1.savetops("Correlators_outputs"); g1.savetopdf("Correlators_outputs", 18); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g1.showonscreen(); // window output } @@ -570,7 +639,11 @@ TEST_F(GpsL1CAGaussianTrackingTest, ValidationOfResults) } Gnuplot g2("points"); +#if USE_GLOG_AND_GFLAGS g2.set_title("Constellation diagram (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g2.set_title("Constellation diagram (satellite PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g2.set_grid(); g2.set_xlabel("Inphase"); g2.set_ylabel("Quadrature"); @@ -578,7 +651,11 @@ TEST_F(GpsL1CAGaussianTrackingTest, ValidationOfResults) g2.plot_xy(promptI, promptQ); g2.savetops("Constellation"); g2.savetopdf("Constellation", 18); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g2.showonscreen(); // window output } diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc index d8749dc39..db5680d02 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc @@ -20,14 +20,19 @@ #include "gps_sdr_signal_replica.h" #include #include +#include #include #include #include #include - +#if USE_GLOG_AND_GFLAGS DEFINE_int32(gpu_multicorrelator_iterations_test, 1000, "Number of averaged iterations in GPU multicorrelator test timing test"); DEFINE_int32(gpu_multicorrelator_max_threads_test, 12, "Number of maximum concurrent correlators in GPU multicorrelator test timing test"); +#else +ABSL_FLAG(int32_t, gpu_multicorrelator_iterations_test, 1000, "Number of averaged iterations in GPU multicorrelator test timing test"); +ABSL_FLAG(int32_t, gpu_multicorrelator_max_threads_test, 12, "Number of maximum concurrent correlators in GPU multicorrelator test timing test"); +#endif void run_correlator_gpu(cuda_multicorrelator* correlator, float d_rem_carrier_phase_rad, @@ -37,7 +42,11 @@ void run_correlator_gpu(cuda_multicorrelator* correlator, int correlation_size, int d_n_correlator_taps) { +#if USE_GLOG_AND_GFLAGS for (int k = 0; k < FLAGS_cpu_multicorrelator_iterations_test; k++) +#else + for (int k = 0; k < absl::GetFlag(FLAGS_cpu_multicorrelator_iterations_test); k++) +#endif { correlator->Carrier_wipeoff_multicorrelator_resampler_cuda(d_rem_carrier_phase_rad, d_carrier_phase_step_rad, @@ -53,7 +62,11 @@ TEST(GpuMulticorrelatorTest, MeasureExecutionTime) { std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); +#if USE_GLOG_AND_GFLAGS int max_threads = FLAGS_gpu_multicorrelator_max_threads_test; +#else + int max_threads = absl::GetFlag(FLAGS_gpu_multicorrelator_max_threads_test); +#endif std::vector thread_pool; cuda_multicorrelator* correlator_pool[max_threads]; unsigned int correlation_sizes[3] = {2048, 4096, 8192}; @@ -133,7 +146,11 @@ TEST(GpuMulticorrelatorTest, MeasureExecutionTime) thread_pool.clear(); end = std::chrono::system_clock::now(); elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(FLAGS_gpu_multicorrelator_iterations_test); +#else + execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(absl::GetFlag(FLAGS_gpu_multicorrelator_iterations_test)); +#endif std::cout << "GPU Multicorrelator execution time for length=" << correlation_sizes[correlation_sizes_idx] << " : " << execution_times[correlation_sizes_idx] << " [s]\n"; } }); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc index 5f1265edd..d5a28ffa9 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc @@ -161,12 +161,18 @@ public: std::string p4; std::string p5; std::string p6; + +#if USE_GLOG_AND_GFLAGS std::string implementation = FLAGS_trk_test_implementation; - const int baseband_sampling_freq = FLAGS_fs_gen_sps; - std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_signal_file; +#else + std::string implementation = absl::GetFlag(FLAGS_trk_test_implementation); + const int baseband_sampling_freq = absl::GetFlag(FLAGS_fs_gen_sps); + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_signal_file); +#endif std::map doppler_measurements_map; std::map code_delay_measurements_map; @@ -229,6 +235,7 @@ public: int TrackingPullInTest::configure_generator(double CN0_dBHz, int file_idx) { +#if USE_GLOG_AND_GFLAGS // Configure signal generator generator_binary = FLAGS_generator_binary; @@ -245,6 +252,24 @@ int TrackingPullInTest::configure_generator(double CN0_dBHz, int file_idx) p4 = std::string("-sig_out_file=") + FLAGS_signal_file + std::to_string(file_idx); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] p6 = std::string("-CN0_dBHz=") + std::to_string(CN0_dBHz); // Signal generator CN0 +#else + // Configure signal generator + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(absl::GetFlag(FLAGS_duration) * 10); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_signal_file) + std::to_string(file_idx); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] + p6 = std::string("-CN0_dBHz=") + std::to_string(CN0_dBHz); // Signal generator CN0 +#endif return 0; } @@ -291,7 +316,11 @@ void TrackingPullInTest::configure_receiver( config->set_property("Tracking.extend_correlation_symbols", std::to_string(extend_correlation_symbols)); config->set_property("Tracking.pll_bw_narrow_hz", std::to_string(PLL_narrow_bw_hz)); config->set_property("Tracking.dll_bw_narrow_hz", std::to_string(DLL_narrow_bw_hz)); +#if USE_GLOG_AND_GFLAGS gnss_synchro.PRN = FLAGS_test_satellite_PRN; +#else + gnss_synchro.PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif gnss_synchro.Channel_ID = 0; config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); @@ -383,8 +412,12 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) config = std::make_shared(); config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); - // Enable automatic resampler for the acquisition, if required +// Enable automatic resampler for the acquisition, if required +#if USE_GLOG_AND_GFLAGS if (FLAGS_use_acquisition_resampler == true) +#else + if (absl::GetFlag(FLAGS_use_acquisition_resampler) == true) +#endif { config->set_property("GNSS-SDR.use_acquisition_resampler", "true"); } @@ -406,7 +439,11 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "GPS L1 CA"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif // acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } @@ -418,7 +455,11 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "Galileo E1B"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } else if (implementation == "GPS_L2_M_DLL_PLL_Tracking") @@ -429,7 +470,11 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "GPS L2CM"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_b") @@ -441,7 +486,11 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "Galileo E5a"; config->set_property("Acquisition_5X.coherent_integration_time_ms", "1"); +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif config->set_property("Acquisition.CAF_window_hz", "0"); // **Only for E5a** Resolves doppler ambiguity averaging the specified BW in the winner code delay. If set to 0 CAF filter is deactivated. Recommended value 3000 Hz config->set_property("Acquisition.Zero_padding", "0"); // **Only for E5a** Avoids power loss and doppler ambiguity in bit transitions by correlating one code with twice the input data length, ensuring that at least one full code is present without transitions. If set to 1 it is ON, if set to 0 it is OFF. config->set_property("Acquisition.bit_transition_flag", "false"); @@ -456,7 +505,11 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "Galileo E5a"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } else if (implementation == "GPS_L5_DLL_PLL_Tracking") @@ -467,7 +520,11 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "GPS L5I"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } else @@ -478,26 +535,44 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) acquisition->set_gnss_synchro(&tmp_gnss_synchro); acquisition->set_channel(0); +#if USE_GLOG_AND_GFLAGS acquisition->set_doppler_max(config->property("Acquisition.doppler_max", FLAGS_external_signal_acquisition_doppler_max_hz)); acquisition->set_doppler_step(config->property("Acquisition.doppler_step", FLAGS_external_signal_acquisition_doppler_step_hz)); acquisition->set_threshold(config->property("Acquisition.threshold", FLAGS_external_signal_acquisition_threshold)); +#else + acquisition->set_doppler_max(config->property("Acquisition.doppler_max", absl::GetFlag(FLAGS_external_signal_acquisition_doppler_max_hz))); + acquisition->set_doppler_step(config->property("Acquisition.doppler_step", absl::GetFlag(FLAGS_external_signal_acquisition_doppler_step_hz))); + acquisition->set_threshold(config->property("Acquisition.threshold", absl::GetFlag(FLAGS_external_signal_acquisition_threshold))); +#endif acquisition->init(); acquisition->set_local_code(); acquisition->set_state(1); // Ensure that acquisition starts at the first sample acquisition->connect(top_block_acq); gr::blocks::file_source::sptr file_source; +#if USE_GLOG_AND_GFLAGS std::string file = FLAGS_signal_file; +#else + std::string file = absl::GetFlag(FLAGS_signal_file); +#endif const char* file_name = file.c_str(); file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false); +#if USE_GLOG_AND_GFLAGS file_source->seek(2 * FLAGS_skip_samples, SEEK_SET); // skip head. ibyte, two bytes per complex sample +#else + file_source->seek(2 * absl::GetFlag(FLAGS_skip_samples), SEEK_SET); // skip head. ibyte, two bytes per complex sample +#endif gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make(); // gr::blocks::head::sptr head_samples = gr::blocks::head::make(sizeof(gr_complex), baseband_sampling_freq * FLAGS_duration); top_block_acq->connect(file_source, 0, gr_interleaved_char_to_complex, 0); - // Enable automatic resampler for the acquisition, if required +// Enable automatic resampler for the acquisition, if required +#if USE_GLOG_AND_GFLAGS if (FLAGS_use_acquisition_resampler == true) +#else + if (absl::GetFlag(FLAGS_use_acquisition_resampler) == true) +#endif { // create acquisition resamplers if required double resampler_ratio = 1.0; @@ -625,7 +700,11 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) top_block_acq->run(); if (start_msg == true) { +#if USE_GLOG_AND_GFLAGS std::cout << "Reading external signal file: " << FLAGS_signal_file << '\n'; +#else + std::cout << "Reading external signal file: " << absl::GetFlag(FLAGS_signal_file) << '\n'; +#endif std::cout << "Searching for " << System_and_Signal << " Satellites...\n"; std::cout << "["; start_msg = false; @@ -646,7 +725,11 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) std::cout << " . "; } top_block_acq->stop(); +#if USE_GLOG_AND_GFLAGS file_source->seek(2 * FLAGS_skip_samples, SEEK_SET); // skip head. ibyte, two bytes per complex sample +#else + file_source->seek(2 * absl::GetFlag(FLAGS_skip_samples), SEEK_SET); // skip head. ibyte, two bytes per complex sample +#endif std::cout.flush(); } std::cout << "]\n"; @@ -672,16 +755,23 @@ TEST_F(TrackingPullInTest, ValidationOfResults) // ************************************************* // ***** STEP 1: Prepare the parameters sweep ****** // ************************************************* - std::vector - acq_doppler_error_hz_values; + std::vector acq_doppler_error_hz_values; std::vector> acq_delay_error_chips_values; // vector of vector - +#if USE_GLOG_AND_GFLAGS for (double doppler_hz = FLAGS_acq_Doppler_error_hz_start; doppler_hz >= FLAGS_acq_Doppler_error_hz_stop; doppler_hz = doppler_hz + FLAGS_acq_Doppler_error_hz_step) +#else + for (double doppler_hz = absl::GetFlag(FLAGS_acq_Doppler_error_hz_start); doppler_hz >= absl::GetFlag(FLAGS_acq_Doppler_error_hz_stop); doppler_hz = doppler_hz + absl::GetFlag(FLAGS_acq_Doppler_error_hz_step)) +#endif + { acq_doppler_error_hz_values.push_back(doppler_hz); std::vector tmp_vector; - // Code Delay Sweep +// Code Delay Sweep +#if USE_GLOG_AND_GFLAGS for (double code_delay_chips = FLAGS_acq_Delay_error_chips_start; code_delay_chips >= FLAGS_acq_Delay_error_chips_stop; code_delay_chips = code_delay_chips + FLAGS_acq_Delay_error_chips_step) +#else + for (double code_delay_chips = absl::GetFlag(FLAGS_acq_Delay_error_chips_start); code_delay_chips >= absl::GetFlag(FLAGS_acq_Delay_error_chips_stop); code_delay_chips = code_delay_chips + absl::GetFlag(FLAGS_acq_Delay_error_chips_step)) +#endif { tmp_vector.push_back(code_delay_chips); } @@ -692,12 +782,17 @@ TEST_F(TrackingPullInTest, ValidationOfResults) // ***** STEP 2: Generate the input signal (if required) ***** // *********************************************************** std::vector generator_CN0_values; +#if USE_GLOG_AND_GFLAGS if (FLAGS_enable_external_signal_file) +#else + if (absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { generator_CN0_values.push_back(999); // an external input signal capture is selected, no CN0 information available } else { +#if USE_GLOG_AND_GFLAGS if (FLAGS_CN0_dBHz_start == FLAGS_CN0_dBHz_stop) { generator_CN0_values.push_back(FLAGS_CN0_dBHz_start); @@ -709,15 +804,39 @@ TEST_F(TrackingPullInTest, ValidationOfResults) generator_CN0_values.push_back(cn0); } } +#else + if (absl::GetFlag(FLAGS_CN0_dBHz_start) == absl::GetFlag(FLAGS_CN0_dBHz_stop)) + { + generator_CN0_values.push_back(absl::GetFlag(FLAGS_CN0_dBHz_start)); + } + else + { + for (double cn0 = absl::GetFlag(FLAGS_CN0_dBHz_start); cn0 > absl::GetFlag(FLAGS_CN0_dBHz_stop); cn0 = cn0 - absl::GetFlag(FLAGS_CN0_dB_step)) + { + generator_CN0_values.push_back(cn0); + } + } +#endif } - // use generator or use an external capture file + // use generator or use an external capture file + +#if USE_GLOG_AND_GFLAGS if (FLAGS_enable_external_signal_file) +#else + if (absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { +#if USE_GLOG_AND_GFLAGS // create and configure an acquisition block and perform an acquisition to obtain the synchronization parameters ASSERT_EQ(acquire_signal(FLAGS_test_satellite_PRN), true); bool found_satellite = doppler_measurements_map.find(FLAGS_test_satellite_PRN) != doppler_measurements_map.end(); EXPECT_TRUE(found_satellite) << "Error: satellite SV: " << FLAGS_test_satellite_PRN << " is not acquired"; +#else + ASSERT_EQ(acquire_signal(absl::GetFlag(FLAGS_test_satellite_PRN)), true); + bool found_satellite = doppler_measurements_map.find(absl::GetFlag(FLAGS_test_satellite_PRN)) != doppler_measurements_map.end(); + EXPECT_TRUE(found_satellite) << "Error: satellite SV: " << absl::GetFlag(FLAGS_test_satellite_PRN) << " is not acquired"; +#endif if (!found_satellite) { return; @@ -730,18 +849,30 @@ TEST_F(TrackingPullInTest, ValidationOfResults) // Configure the signal generator configure_generator(generator_CN0_values.at(current_cn0_idx), current_cn0_idx); // Generate signal raw signal samples and observations RINEX file +#if USE_GLOG_AND_GFLAGS if (FLAGS_disable_generator == false) +#else + if (absl::GetFlag(FLAGS_disable_generator) == false) +#endif { generate_signal(); } } } +#if USE_GLOG_AND_GFLAGS configure_receiver(FLAGS_PLL_bw_hz_start, FLAGS_DLL_bw_hz_start, FLAGS_PLL_narrow_bw_hz, FLAGS_DLL_narrow_bw_hz, FLAGS_extend_correlation_symbols); +#else + configure_receiver(absl::GetFlag(FLAGS_PLL_bw_hz_start), + absl::GetFlag(FLAGS_DLL_bw_hz_start), + absl::GetFlag(FLAGS_PLL_narrow_bw_hz), + absl::GetFlag(FLAGS_DLL_narrow_bw_hz), + absl::GetFlag(FLAGS_extend_correlation_symbols)); +#endif // ****************************************************************************************** // ***** Obtain the initial signal sinchronization parameters (emulating an acquisition) **** @@ -752,9 +883,15 @@ TEST_F(TrackingPullInTest, ValidationOfResults) uint64_t acq_samplestamp_samples = 0; Tracking_True_Obs_Reader true_obs_data; +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { test_satellite_PRN = FLAGS_test_satellite_PRN; +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + test_satellite_PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif std::string true_obs_file = std::string("./gps_l1_ca_obs_prn"); true_obs_file.append(std::to_string(test_satellite_PRN)); true_obs_file.append(".dat"); @@ -763,7 +900,11 @@ TEST_F(TrackingPullInTest, ValidationOfResults) // load acquisition data based on the first epoch of the true observations ASSERT_EQ(true_obs_data.read_binary_obs(), true) << "Failure reading true tracking dump file.\n" +#if USE_GLOG_AND_GFLAGS << "Maybe sat PRN #" + std::to_string(FLAGS_test_satellite_PRN) + +#else + << "Maybe sat PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + +#endif " is not available?"; std::cout << "Testing satellite PRN=" << test_satellite_PRN << '\n'; std::cout << "True Initial Doppler " << true_obs_data.doppler_l1_hz << " [Hz], true Initial code delay [Chips]=" << true_obs_data.prn_delay_chips << "[Chips]\n"; @@ -773,17 +914,30 @@ TEST_F(TrackingPullInTest, ValidationOfResults) } else { +#if USE_GLOG_AND_GFLAGS true_acq_doppler_hz = doppler_measurements_map.find(FLAGS_test_satellite_PRN)->second; true_acq_delay_samples = code_delay_measurements_map.find(FLAGS_test_satellite_PRN)->second; +#else + true_acq_doppler_hz = doppler_measurements_map.find(absl::GetFlag(FLAGS_test_satellite_PRN))->second; + true_acq_delay_samples = code_delay_measurements_map.find(absl::GetFlag(FLAGS_test_satellite_PRN))->second; +#endif acq_samplestamp_samples = 0; std::cout << "Estimated Initial Doppler " << true_acq_doppler_hz << " [Hz], estimated Initial code delay " << true_acq_delay_samples << " [Samples]" +#if USE_GLOG_AND_GFLAGS << " Acquisition SampleStamp is " << acq_samplestamp_map.find(FLAGS_test_satellite_PRN)->second << '\n'; +#else + << " Acquisition SampleStamp is " << acq_samplestamp_map.find(absl::GetFlag(FLAGS_test_satellite_PRN))->second << '\n'; +#endif } // create the msg queue for valve queue = std::make_shared>(); +#if USE_GLOG_AND_GFLAGS long long int acq_to_trk_delay_samples = ceil(static_cast(FLAGS_fs_gen_sps) * FLAGS_acq_to_trk_delay_s); +#else + long long int acq_to_trk_delay_samples = ceil(static_cast(absl::GetFlag(FLAGS_fs_gen_sps)) * absl::GetFlag(FLAGS_acq_to_trk_delay_s)); +#endif auto resetable_valve_ = gnss_sdr_make_valve(sizeof(gr_complex), acq_to_trk_delay_samples, queue.get(), false); // CN0 LOOP @@ -822,19 +976,31 @@ TEST_F(TrackingPullInTest, ValidationOfResults) std::string file; ASSERT_NO_THROW({ +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { file = "./" + filename_raw_data + std::to_string(current_cn0_idx); } else { +#if USE_GLOG_AND_GFLAGS file = FLAGS_signal_file; +#else + file = absl::GetFlag(FLAGS_signal_file); +#endif } const char* file_name = file.c_str(); gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false); gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make(); gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro)); +#if USE_GLOG_AND_GFLAGS gr::blocks::head::sptr head_samples = gr::blocks::head::make(sizeof(gr_complex), baseband_sampling_freq * FLAGS_duration); +#else + gr::blocks::head::sptr head_samples = gr::blocks::head::make(sizeof(gr_complex), baseband_sampling_freq * absl::GetFlag(FLAGS_duration)); +#endif top_block_trk->connect(file_source, 0, gr_interleaved_char_to_complex, 0); top_block_trk->connect(gr_interleaved_char_to_complex, 0, head_samples, 0); if (acq_to_trk_delay_samples > 0) @@ -848,7 +1014,11 @@ TEST_F(TrackingPullInTest, ValidationOfResults) } top_block_trk->connect(tracking->get_right_block(), 0, sink, 0); top_block_trk->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); +#if USE_GLOG_AND_GFLAGS file_source->seek(2 * FLAGS_skip_samples, 0); // skip head. ibyte, two bytes per complex sample +#else + file_source->seek(2 * absl::GetFlag(FLAGS_skip_samples), 0); // skip head. ibyte, two bytes per complex sample +#endif }) << "Failure connecting the blocks of tracking test."; // ******************************************************************** @@ -860,7 +1030,11 @@ TEST_F(TrackingPullInTest, ValidationOfResults) { EXPECT_NO_THROW({ start = std::chrono::system_clock::now(); +#if USE_GLOG_AND_GFLAGS std::cout << "--- SIMULATING A PULL-IN DELAY OF " << FLAGS_acq_to_trk_delay_s << " SECONDS ---\n"; +#else + std::cout << "--- SIMULATING A PULL-IN DELAY OF " << absl::GetFlag(FLAGS_acq_to_trk_delay_s) << " SECONDS ---\n"; +#endif top_block_trk->start(); std::cout << " Waiting for valve...\n"; // wait the valve message indicating the circulation of the amount of samples of the delay @@ -889,10 +1063,14 @@ TEST_F(TrackingPullInTest, ValidationOfResults) pull_in_results_v.push_back(msg_rx->rx_message != 3); // save last asynchronous tracking message in order to detect a loss of lock - // ******************************** - // ***** STEP 7: Plot results ***** - // ******************************** +// ******************************** +// ***** STEP 7: Plot results ***** +// ******************************** +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_detail_level >= 2 and FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_plot_detail_level) >= 2 and absl::GetFlag(FLAGS_show_plots)) +#endif { // load the measured values Tracking_Dump_Reader trk_dump; @@ -937,8 +1115,11 @@ TEST_F(TrackingPullInTest, ValidationOfResults) Doppler.push_back(trk_dump.carrier_doppler_hz); epoch_counter++; } - +#if USE_GLOG_AND_GFLAGS const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag show_plots has been set to TRUE,\n"; @@ -953,6 +1134,7 @@ TEST_F(TrackingPullInTest, ValidationOfResults) fs::path dir = p.parent_path(); const std::string& gnuplot_path = dir.native(); Gnuplot::set_GNUPlotPath(gnuplot_path); +#if USE_GLOG_AND_GFLAGS auto decimate = static_cast(FLAGS_plot_decimate); if (FLAGS_plot_detail_level >= 2 and FLAGS_show_plots) @@ -967,6 +1149,22 @@ TEST_F(TrackingPullInTest, ValidationOfResults) { g1.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } +#else + auto decimate = static_cast(absl::GetFlag(FLAGS_plot_decimate)); + + if (absl::GetFlag(FLAGS_plot_detail_level) >= 2 and absl::GetFlag(FLAGS_show_plots)) + { + Gnuplot g1("linespoints"); + g1.showonscreen(); // window output + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + g1.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, " + "PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } + else + { + g1.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g1.set_grid(); g1.set_xlabel("Time [s]"); @@ -985,6 +1183,7 @@ TEST_F(TrackingPullInTest, ValidationOfResults) Gnuplot g2("points"); g2.showonscreen(); // window output +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); @@ -993,7 +1192,16 @@ TEST_F(TrackingPullInTest, ValidationOfResults) { g2.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } - +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } + else + { + g2.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g2.set_grid(); g2.set_xlabel("Inphase"); g2.set_ylabel("Quadrature"); @@ -1002,6 +1210,7 @@ TEST_F(TrackingPullInTest, ValidationOfResults) g2.savetops("Constellation"); Gnuplot g3("linespoints"); +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { g3.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); @@ -1010,6 +1219,16 @@ TEST_F(TrackingPullInTest, ValidationOfResults) { g3.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips] PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + g3.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } + else + { + g3.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips] PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g3.set_grid(); g3.set_xlabel("Time [s]"); g3.set_ylabel("Reported CN0 [dB-Hz]"); @@ -1024,6 +1243,7 @@ TEST_F(TrackingPullInTest, ValidationOfResults) g3.showonscreen(); // window output Gnuplot g4("linespoints"); +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { g4.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); @@ -1032,6 +1252,16 @@ TEST_F(TrackingPullInTest, ValidationOfResults) { g4.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips] PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + g4.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } + else + { + g4.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips] PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g4.set_grid(); g4.set_xlabel("Time [s]"); g4.set_ylabel("Estimated Doppler [Hz]"); @@ -1075,7 +1305,11 @@ TEST_F(TrackingPullInTest, ValidationOfResults) pull_in_result_mesh = pull_in_results_v_v.at(current_cn0_idx); // plot grid Gnuplot g4("points palette pointsize 2 pointtype 7"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g4.showonscreen(); // window output } @@ -1087,6 +1321,7 @@ TEST_F(TrackingPullInTest, ValidationOfResults) g4.cmd("set key off"); g4.cmd("set view map"); std::string title; +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { title = std::string("Tracking Pull-in result grid at CN0:" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx)))) + " [dB-Hz], PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz]."); @@ -1095,7 +1330,16 @@ TEST_F(TrackingPullInTest, ValidationOfResults) { title = std::string("Tracking Pull-in result grid, PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } - +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + title = std::string("Tracking Pull-in result grid at CN0:" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx)))) + " [dB-Hz], PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz]."); + } + else + { + title = std::string("Tracking Pull-in result grid, PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g4.set_title(title); g4.set_grid(); g4.set_xlabel("Acquisition Doppler error [Hz]"); @@ -1105,7 +1349,11 @@ TEST_F(TrackingPullInTest, ValidationOfResults) code_delay_error_mesh, pull_in_result_mesh); g4.set_legend(); +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { g4.savetops("trk_pull_in_grid_" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx))))); g4.savetopdf("trk_pull_in_grid_" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx)))), 12); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc index dedfcb658..39f87bdfa 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc @@ -201,10 +201,15 @@ void* handler_DMA_trk_pull_in_test(void* arguments) return nullptr; } - // ************************************************************************* - // Open input file - // ************************************************************************* + // ************************************************************************* + // Open input file + // ************************************************************************* + +#if USE_GLOG_AND_GFLAGS uint32_t skip_samples = static_cast(FLAGS_skip_samples); +#else + uint32_t skip_samples = static_cast(absl::GetFlag(FLAGS_skip_samples)); +#endif if (skip_samples + skip_used_samples > 0) { @@ -328,12 +333,17 @@ public: std::string p4; std::string p5; std::string p6; +#if USE_GLOG_AND_GFLAGS std::string implementation = FLAGS_trk_test_implementation; - const int baseband_sampling_freq = FLAGS_fs_gen_sps; std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_signal_file; - +#else + std::string implementation = absl::GetFlag(FLAGS_trk_test_implementation); + const int baseband_sampling_freq = absl::GetFlag(FLAGS_fs_gen_sps); + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_signal_file); +#endif std::map doppler_measurements_map; std::map code_delay_measurements_map; std::map acq_samplestamp_map; @@ -391,6 +401,7 @@ public: int TrackingPullInTestFpga::configure_generator(double CN0_dBHz, int file_idx) { +#if USE_GLOG_AND_GFLAGS // Configure signal generator generator_binary = FLAGS_generator_binary; @@ -407,6 +418,25 @@ int TrackingPullInTestFpga::configure_generator(double CN0_dBHz, int file_idx) p4 = std::string("-sig_out_file=") + FLAGS_signal_file + std::to_string(file_idx); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] p6 = std::string("-CN0_dBHz=") + std::to_string(CN0_dBHz); // Signal generator CN0 +#else + // Configure signal generator + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(absl::GetFlag(FLAGS_duration) * 10); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_signal_file) + std::to_string(file_idx); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] + p6 = std::string("-CN0_dBHz=") + std::to_string(CN0_dBHz); // Signal generator CN0 +#endif + return 0; } @@ -497,7 +527,11 @@ void TrackingPullInTestFpga::configure_receiver( config->set_property("Tracking.extend_correlation_symbols", std::to_string(extend_correlation_symbols)); config->set_property("Tracking.pll_bw_narrow_hz", std::to_string(PLL_narrow_bw_hz)); config->set_property("Tracking.dll_bw_narrow_hz", std::to_string(DLL_narrow_bw_hz)); +#if USE_GLOG_AND_GFLAGS gnss_synchro.PRN = FLAGS_test_satellite_PRN; +#else + gnss_synchro.PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif gnss_synchro.Channel_ID = 0; config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); @@ -590,7 +624,11 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) struct DMA_handler_args_trk_pull_in_test args; struct acquisition_handler_args_trk_pull_in_test args_acq; +#if USE_GLOG_AND_GFLAGS std::string file = FLAGS_signal_file; +#else + std::string file = absl::GetFlag(FLAGS_signal_file); +#endif args.file = file; // DMA file configuration // instantiate the FPGA switch and set the @@ -657,11 +695,17 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) acquisition->set_gnss_synchro(&tmp_gnss_synchro); acquisition->set_channel_fsm(channel_fsm_); acquisition->set_channel(0); +#if USE_GLOG_AND_GFLAGS acquisition->set_doppler_max(config->property("Acquisition.doppler_max", FLAGS_external_signal_acquisition_doppler_max_hz)); acquisition->set_doppler_step(config->property("Acquisition.doppler_step", FLAGS_external_signal_acquisition_doppler_step_hz)); acquisition->set_doppler_center(0); acquisition->set_threshold(config->property("Acquisition.threshold", FLAGS_external_signal_acquisition_threshold)); - +#else + acquisition->set_doppler_max(config->property("Acquisition.doppler_max", absl::GetFlag(FLAGS_external_signal_acquisition_doppler_max_hz))); + acquisition->set_doppler_step(config->property("Acquisition.doppler_step", absl::GetFlag(FLAGS_external_signal_acquisition_doppler_step_hz))); + acquisition->set_doppler_center(0); + acquisition->set_threshold(config->property("Acquisition.threshold", absl::GetFlag(FLAGS_external_signal_acquisition_threshold))); +#endif std::chrono::time_point start, end; std::chrono::duration elapsed_seconds; start = std::chrono::system_clock::now(); @@ -755,7 +799,11 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) if (start_msg == true) { +#if USE_GLOG_AND_GFLAGS std::cout << "Reading external signal file: " << FLAGS_signal_file << '\n'; +#else + std::cout << "Reading external signal file: " << absl::GetFlag(FLAGS_signal_file) << '\n'; +#endif std::cout << "Searching for " << System_and_Signal << " Satellites...\n"; std::cout << "["; start_msg = false; @@ -824,13 +872,20 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) std::vector acq_doppler_error_hz_values; std::vector> acq_delay_error_chips_values; // vector of vector - +#if USE_GLOG_AND_GFLAGS for (double doppler_hz = FLAGS_acq_Doppler_error_hz_start; doppler_hz >= FLAGS_acq_Doppler_error_hz_stop; doppler_hz = doppler_hz + FLAGS_acq_Doppler_error_hz_step) +#else + for (double doppler_hz = absl::GetFlag(FLAGS_acq_Doppler_error_hz_start); doppler_hz >= absl::GetFlag(FLAGS_acq_Doppler_error_hz_stop); doppler_hz = doppler_hz + absl::GetFlag(FLAGS_acq_Doppler_error_hz_step)) +#endif { acq_doppler_error_hz_values.push_back(doppler_hz); std::vector tmp_vector; // Code Delay Sweep +#if USE_GLOG_AND_GFLAGS for (double code_delay_chips = FLAGS_acq_Delay_error_chips_start; code_delay_chips >= FLAGS_acq_Delay_error_chips_stop; code_delay_chips = code_delay_chips + FLAGS_acq_Delay_error_chips_step) +#else + for (double code_delay_chips = absl::GetFlag(FLAGS_acq_Delay_error_chips_start); code_delay_chips >= absl::GetFlag(FLAGS_acq_Delay_error_chips_stop); code_delay_chips = code_delay_chips + absl::GetFlag(FLAGS_acq_Delay_error_chips_step)) +#endif { tmp_vector.push_back(code_delay_chips); } @@ -841,6 +896,7 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) // ***** STEP 2: Generate the input signal (if required) ***** // *********************************************************** std::vector generator_CN0_values; +#if USE_GLOG_AND_GFLAGS if (FLAGS_enable_external_signal_file) { generator_CN0_values.push_back(999); // an external input signal capture is selected, no CN0 information available @@ -859,14 +915,44 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) } } } +#else + if (absl::GetFlag(FLAGS_enable_external_signal_file)) + { + generator_CN0_values.push_back(999); // an external input signal capture is selected, no CN0 information available + } + else + { + if (absl::GetFlag(FLAGS_CN0_dBHz_start) == absl::GetFlag(FLAGS_CN0_dBHz_stop)) + { + generator_CN0_values.push_back(absl::GetFlag(FLAGS_CN0_dBHz_start)); + } + else + { + for (double cn0 = absl::GetFlag(FLAGS_CN0_dBHz_start); cn0 > absl::GetFlag(FLAGS_CN0_dBHz_stop); cn0 = cn0 - absl::GetFlag(FLAGS_CN0_dB_step)) + { + generator_CN0_values.push_back(cn0); + } + } + } +#endif - // use generator or use an external capture file + // use generator or use an external capture file + +#if USE_GLOG_AND_GFLAGS if (FLAGS_enable_external_signal_file) { // create and configure an acquisition block and perform an acquisition to obtain the synchronization parameters ASSERT_EQ(acquire_signal(FLAGS_test_satellite_PRN), true); bool found_satellite = doppler_measurements_map.find(FLAGS_test_satellite_PRN) != doppler_measurements_map.end(); EXPECT_TRUE(found_satellite) << "Error: satellite SV: " << FLAGS_test_satellite_PRN << " is not acquired"; +#else + if (absl::GetFlag(FLAGS_enable_external_signal_file)) + { + // create and configure an acquisition block and perform an acquisition to obtain the synchronization parameters + ASSERT_EQ(acquire_signal(absl::GetFlag(FLAGS_test_satellite_PRN)), true); + bool found_satellite = doppler_measurements_map.find(absl::GetFlag(FLAGS_test_satellite_PRN)) != doppler_measurements_map.end(); + EXPECT_TRUE(found_satellite) << "Error: satellite SV: " << absl::GetFlag(FLAGS_test_satellite_PRN) << " is not acquired"; +#endif if (!found_satellite) { return; @@ -879,18 +965,30 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) // Configure the signal generator configure_generator(generator_CN0_values.at(current_cn0_idx), current_cn0_idx); // Generate signal raw signal samples and observations RINEX file + +#if USE_GLOG_AND_GFLAGS if (FLAGS_disable_generator == false) +#else + if (absl::GetFlag(FLAGS_disable_generator) == false) +#endif { generate_signal(); } } } - +#if USE_GLOG_AND_GFLAGS configure_receiver(FLAGS_PLL_bw_hz_start, FLAGS_DLL_bw_hz_start, FLAGS_PLL_narrow_bw_hz, FLAGS_DLL_narrow_bw_hz, FLAGS_extend_correlation_symbols); +#else + configure_receiver(absl::GetFlag(FLAGS_PLL_bw_hz_start), + absl::GetFlag(FLAGS_DLL_bw_hz_start), + absl::GetFlag(FLAGS_PLL_narrow_bw_hz), + absl::GetFlag(FLAGS_DLL_narrow_bw_hz), + absl::GetFlag(FLAGS_extend_correlation_symbols)); +#endif // ****************************************************************************************** // ***** Obtain the initial signal sinchronization parameters (emulating an acquisition) **** @@ -901,9 +999,15 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) uint64_t acq_samplestamp_samples = 0; Tracking_True_Obs_Reader true_obs_data; +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { test_satellite_PRN = FLAGS_test_satellite_PRN; +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + test_satellite_PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif std::string true_obs_file = std::string("./gps_l1_ca_obs_prn"); true_obs_file.append(std::to_string(test_satellite_PRN)); true_obs_file.append(".dat"); @@ -912,7 +1016,11 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) // load acquisition data based on the first epoch of the true observations ASSERT_EQ(true_obs_data.read_binary_obs(), true) << "Failure reading true tracking dump file.\n" +#if USE_GLOG_AND_GFLAGS << "Maybe sat PRN #" + std::to_string(FLAGS_test_satellite_PRN) + +#else + << "Maybe sat PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + +#endif " is not available?"; std::cout << "Testing satellite PRN=" << test_satellite_PRN << '\n'; std::cout << "True Initial Doppler " << true_obs_data.doppler_l1_hz << " [Hz], true Initial code delay [Chips]=" << true_obs_data.prn_delay_chips << "[Chips]\n"; @@ -922,16 +1030,29 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) } else { +#if USE_GLOG_AND_GFLAGS true_acq_doppler_hz = doppler_measurements_map.find(FLAGS_test_satellite_PRN)->second; true_acq_delay_samples = code_delay_measurements_map.find(FLAGS_test_satellite_PRN)->second; acq_samplestamp_samples = acq_samplestamp_map.find(FLAGS_test_satellite_PRN)->second; +#else + true_acq_doppler_hz = doppler_measurements_map.find(absl::GetFlag(FLAGS_test_satellite_PRN))->second; + true_acq_delay_samples = code_delay_measurements_map.find(absl::GetFlag(FLAGS_test_satellite_PRN))->second; + acq_samplestamp_samples = acq_samplestamp_map.find(absl::GetFlag(FLAGS_test_satellite_PRN))->second; +#endif std::cout << "Estimated Initial Doppler " << true_acq_doppler_hz << " [Hz], estimated Initial code delay " << true_acq_delay_samples << " [Samples]" +#if USE_GLOG_AND_GFLAGS << " Acquisition SampleStamp is " << acq_samplestamp_map.find(FLAGS_test_satellite_PRN)->second << '\n'; +#else + << " Acquisition SampleStamp is " << acq_samplestamp_map.find(absl::GetFlag(FLAGS_test_satellite_PRN))->second << '\n'; +#endif } - +#if USE_GLOG_AND_GFLAGS int64_t acq_to_trk_delay_samples = ceil(static_cast(FLAGS_fs_gen_sps) * FLAGS_acq_to_trk_delay_s); +#else + int64_t acq_to_trk_delay_samples = ceil(static_cast(absl::GetFlag(FLAGS_fs_gen_sps)) * absl::GetFlag(FLAGS_acq_to_trk_delay_s)); +#endif // set the scaling factor args.scaling_factor = DMA_SIGNAL_SCALING_FACTOR; @@ -1006,13 +1127,21 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) std::string file; ASSERT_NO_THROW({ +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { file = "./" + filename_raw_data + std::to_string(current_cn0_idx); } else { +#if USE_GLOG_AND_GFLAGS file = FLAGS_signal_file; +#else + file = absl::GetFlag(FLAGS_signal_file); +#endif } gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro)); @@ -1034,8 +1163,11 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) if (acq_to_trk_delay_samples > 0) { +#if USE_GLOG_AND_GFLAGS std::cout << "--- SIMULATING A PULL-IN DELAY OF " << FLAGS_acq_to_trk_delay_s << " SECONDS ---\n"; - +#else + std::cout << "--- SIMULATING A PULL-IN DELAY OF " << absl::GetFlag(FLAGS_acq_to_trk_delay_s) << " SECONDS ---\n"; +#endif args.file = file; args.nsamples_tx = acq_to_trk_delay_samples; // 150 s for now but will be all file @@ -1053,8 +1185,11 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) std::cout << " Waiting flowgraph..\n"; args.file = file; +#if USE_GLOG_AND_GFLAGS args.nsamples_tx = baseband_sampling_freq * FLAGS_duration; - +#else + args.nsamples_tx = baseband_sampling_freq * absl::GetFlag(FLAGS_duration); +#endif args.skip_used_samples = acq_to_trk_delay_samples; if (pthread_create(&thread_DMA, nullptr, handler_DMA_trk_pull_in_test, reinterpret_cast(&args)) < 0) @@ -1082,7 +1217,12 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) // ******************************** // ***** STEP 7: Plot results ***** // ******************************** + +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_detail_level >= 2 and FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_plot_detail_level) >= 2 and absl::GetFlag(FLAGS_show_plots)) +#endif { // load the measured values Tracking_Dump_Reader trk_dump; @@ -1127,8 +1267,11 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) Doppler.push_back(trk_dump.carrier_doppler_hz); epoch_counter++; } - +#if USE_GLOG_AND_GFLAGS const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag show_plots has been set to TRUE,\n"; @@ -1143,6 +1286,7 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) fs::path dir = p.parent_path(); const std::string& gnuplot_path = dir.native(); Gnuplot::set_GNUPlotPath(gnuplot_path); +#if USE_GLOG_AND_GFLAGS auto decimate = static_cast(FLAGS_plot_decimate); if (FLAGS_plot_detail_level >= 2 and FLAGS_show_plots) @@ -1157,7 +1301,22 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) { g1.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } +#else + auto decimate = static_cast(absl::GetFlag(FLAGS_plot_decimate)); + if (absl::GetFlag(FLAGS_plot_detail_level) >= 2 and absl::GetFlag(FLAGS_show_plots)) + { + Gnuplot g1("linespoints"); + g1.showonscreen(); // window output + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + g1.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, " + "PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } + else + { + g1.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g1.set_grid(); g1.set_xlabel("Time [s]"); g1.set_ylabel("Correlators' output"); @@ -1175,6 +1334,7 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) Gnuplot g2("points"); g2.showonscreen(); // window output +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); @@ -1183,7 +1343,16 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) { g2.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } - +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } + else + { + g2.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g2.set_grid(); g2.set_xlabel("Inphase"); g2.set_ylabel("Quadrature"); @@ -1192,6 +1361,7 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) g2.savetops("Constellation"); Gnuplot g3("linespoints"); +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { g3.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); @@ -1200,6 +1370,16 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) { g3.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips] PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + g3.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } + else + { + g3.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips] PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g3.set_grid(); g3.set_xlabel("Time [s]"); g3.set_ylabel("Reported CN0 [dB-Hz]"); @@ -1214,6 +1394,7 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) g3.showonscreen(); // window output Gnuplot g4("linespoints"); +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { g4.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); @@ -1222,6 +1403,16 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) { g4.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips] PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + g4.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } + else + { + g4.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips] PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g4.set_grid(); g4.set_xlabel("Time [s]"); g4.set_ylabel("Estimated Doppler [Hz]"); @@ -1265,7 +1456,11 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) pull_in_result_mesh = pull_in_results_v_v.at(current_cn0_idx); // plot grid Gnuplot g4("points palette pointsize 2 pointtype 7"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g4.showonscreen(); // window output } @@ -1277,6 +1472,7 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) g4.cmd("set key off"); g4.cmd("set view map"); std::string title; +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { title = std::string("Tracking Pull-in result grid at CN0:" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx)))) + " [dB-Hz], PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz]."); @@ -1285,7 +1481,16 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) { title = std::string("Tracking Pull-in result grid, PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } - +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + title = std::string("Tracking Pull-in result grid at CN0:" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx)))) + " [dB-Hz], PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz]."); + } + else + { + title = std::string("Tracking Pull-in result grid, PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g4.set_title(title); g4.set_grid(); g4.set_xlabel("Acquisition Doppler error [Hz]"); @@ -1295,7 +1500,11 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) code_delay_error_mesh, pull_in_result_mesh); g4.set_legend(); +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { g4.savetops("trk_pull_in_grid_" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx))))); g4.savetopdf("trk_pull_in_grid_" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx)))), 12); diff --git a/src/tests/unit-tests/system-parameters/has_decoding_test.cc b/src/tests/unit-tests/system-parameters/has_decoding_test.cc index 593ce79de..5dc12536f 100644 --- a/src/tests/unit-tests/system-parameters/has_decoding_test.cc +++ b/src/tests/unit-tests/system-parameters/has_decoding_test.cc @@ -20,7 +20,6 @@ #include "galileo_has_page.h" #include "gnss_sdr_make_unique.h" #include "has_simple_printer.h" -#include #include #include #include @@ -35,8 +34,14 @@ // Usage: // ./run_tests --gtest_filter=HAS_Test.Decoder // ./run_tests --gtest_filter=HAS_Test.Decoder --has_data_test_file=../data/HAS_Messages_sample/encoded/Sample_HAS_Pages_Encoded_20210713_08.txt --start_page_test_file=70 + +#if USE_GLOG_AND_GFLAGS DEFINE_string(has_data_test_file, std::string(""), "File containing encoded HAS pages (format: [time sat_id HAS_page_in_hex] in each line)"); DEFINE_int32(start_page_test_file, 0, "Starting page in case of reading HAS pages from a file"); +#else +ABSL_FLAG(std::string, has_data_test_file, std::string(""), "File containing encoded HAS pages (format: [time sat_id HAS_page_in_hex] in each line)"); +ABSL_FLAG(int32_t, start_page_test_file, 0, "Starting page in case of reading HAS pages from a file"); +#endif #if PMT_USES_BOOST_ANY namespace wht = boost; @@ -212,7 +217,11 @@ private: TEST(HAS_Test, Decoder) { Read_Encoded_Pages read_pages{}; +#if USE_GLOG_AND_GFLAGS EXPECT_TRUE(read_pages.read_data(FLAGS_has_data_test_file)); +#else + EXPECT_TRUE(read_pages.read_data(absl::GetFlag(FLAGS_has_data_test_file))); +#endif auto gal_e6_has_rx_ = galileo_e6_has_msg_receiver_make(); auto has_tester = HasDecoderTester_make(); std::unique_ptr has_simple_printer = nullptr; @@ -224,10 +233,17 @@ TEST(HAS_Test, Decoder) if (!known_data) { has_simple_printer = std::make_unique(); +#if USE_GLOG_AND_GFLAGS if (static_cast(FLAGS_start_page_test_file) < read_pages.get_number_pages()) { init = FLAGS_start_page_test_file; } +#else + if (static_cast(absl::GetFlag(FLAGS_start_page_test_file)) < read_pages.get_number_pages()) + { + init = absl::GetFlag(FLAGS_start_page_test_file); + } +#endif else { std::cerr << "The flag --start_page_test_file is set beyond the total number of pages in the file (" << read_pages.get_number_pages() << "), ignoring it.\n"; diff --git a/src/utils/front-end-cal/CMakeLists.txt b/src/utils/front-end-cal/CMakeLists.txt index f8abe59a5..8e328b089 100644 --- a/src/utils/front-end-cal/CMakeLists.txt +++ b/src/utils/front-end-cal/CMakeLists.txt @@ -30,12 +30,17 @@ target_link_libraries(front_end_cal_lib core_libs PRIVATE Boost::headers - Gflags::gflags - Glog::glog Gnuradio::blocks Gnuradio::runtime ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(front_end_cal_lib PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(front_end_cal_lib PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(front_end_cal_lib PRIVATE absl::flags absl::log) +endif() + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(front_end_cal_lib @@ -59,9 +64,15 @@ target_link_libraries(front-end-cal front_end_cal_lib gnss_sdr_flags Boost::headers - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(front-end-cal PRIVATE Glog::glog) + target_compile_definitions(front-end-cal PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(front-end-cal PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize absl::log_sink absl::log_sink_registry) +endif() + if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(front-end-cal PRIVATE -DGNURADIO_USES_STD_POINTERS=1 diff --git a/src/utils/front-end-cal/front_end_cal.cc b/src/utils/front-end-cal/front_end_cal.cc index 9c527d10e..dc26ab2a3 100644 --- a/src/utils/front-end-cal/front_end_cal.cc +++ b/src/utils/front-end-cal/front_end_cal.cc @@ -26,7 +26,6 @@ #include "gps_iono.h" #include "gps_utc_model.h" #include -#include #include // for min #include #include // for operator<< @@ -34,6 +33,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + extern Concurrent_Map global_gps_ephemeris_map; extern Concurrent_Map global_gps_iono_map; extern Concurrent_Map global_gps_utc_model_map; diff --git a/src/utils/front-end-cal/main.cc b/src/utils/front-end-cal/main.cc index 972e4a21e..4da2c1730 100644 --- a/src/utils/front-end-cal/main.cc +++ b/src/utils/front-end-cal/main.cc @@ -40,8 +40,6 @@ #include // for bad_any_cast #include #include -#include -#include #include // for block #include #include @@ -70,6 +68,23 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#include +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif + #if HAS_GENERIC_LAMBDA #else #include @@ -81,14 +96,39 @@ namespace wht = boost; namespace wht = std; #endif +#if USE_GLOG_AND_GFLAGS #if GFLAGS_OLD_NAMESPACE namespace gflags { using namespace google; } #endif - DECLARE_string(log_dir); +#else +class FrontEndCalLogSink : public absl::LogSink +{ +public: + FrontEndCalLogSink() + { + if (!absl::GetFlag(FLAGS_log_dir).empty()) + { + logfile.open(absl::GetFlag(FLAGS_log_dir) + "/front_end_cal.log"); + } + else + { + logfile.open(GetTempDir() + "/front_end_cal.log"); + } + } + void Send(const absl::LogEntry& entry) override + { + logfile << entry.text_message_with_prefix_and_newline() << std::flush; + } + +private: + std::ofstream logfile; +}; +std::string FrontEndCalVersionString() { return std::string(FRONT_END_CAL_VERSION) + "\n"; } +#endif Concurrent_Map global_gps_ephemeris_map; Concurrent_Map global_gps_iono_map; @@ -100,7 +140,7 @@ Concurrent_Queue global_gps_acq_assist_queue; bool stop; Concurrent_Queue channel_internal_queue; std::vector gnss_sync_vector; -Gnss_Synchro gnss_synchro{}; +Gnss_Synchro gnss_synchro; // ######## GNURADIO BLOCK MESSAGE RECEVER ######### class FrontEndCal_msg_rx; @@ -277,10 +317,17 @@ int main(int argc, char** argv) "This program comes with ABSOLUTELY NO WARRANTY;\n" + "See COPYING file to see a copy of the General Public License\n \n"); +#if USE_GLOG_AND_GFLAGS gflags::SetUsageMessage(intro_help); google::SetVersionString(FRONT_END_CAL_VERSION); gflags::ParseCommandLineFlags(&argc, &argv, true); - +#else + absl::FlagsUsageConfig empty_config; + empty_config.version_string = &FrontEndCalVersionString; + absl::SetFlagsUsageConfig(empty_config); + absl::SetProgramUsageMessage(intro_help); + absl::ParseCommandLine(argc, argv); +#endif std::cout << "Initializing... Please wait.\n"; } catch (const std::exception& e) @@ -289,8 +336,16 @@ int main(int argc, char** argv) std::cout << "front-end-cal program ended.\n"; return 1; } + +#if USE_GLOG_AND_GFLAGS google::InitGoogleLogging(argv[0]); if (FLAGS_log_dir.empty()) +#else + absl::LogSink* fecLogSink = new FrontEndCalLogSink; + absl::AddLogSink(fecLogSink); + absl::InitializeLog(); + if (absl::GetFlag(FLAGS_log_dir).empty()) +#endif { std::cout << "Logging will be done at " << "/tmp" @@ -302,29 +357,49 @@ int main(int argc, char** argv) { try { +#if USE_GLOG_AND_GFLAGS const fs::path p(FLAGS_log_dir); +#else + const fs::path p(absl::GetFlag(FLAGS_log_dir)); +#endif if (!fs::exists(p)) { std::cout << "The path " +#if USE_GLOG_AND_GFLAGS << FLAGS_log_dir +#else + << absl::GetFlag(FLAGS_log_dir) +#endif << " does not exist, attempting to create it" << '\n'; errorlib::error_code ec; if (!fs::create_directory(p, ec)) { +#if USE_GLOG_AND_GFLAGS std::cerr << "Could not create the " << FLAGS_log_dir << " folder. Front-end-cal program ended.\n"; gflags::ShutDownCommandLineFlags(); +#else + std::cerr << "Could not create the " << absl::GetFlag(FLAGS_log_dir) << " folder. Front-end-cal program ended.\n"; +#endif return 1; } } std::cout << "Logging with be done at " +#if USE_GLOG_AND_GFLAGS << FLAGS_log_dir << '\n'; +#else + << absl::GetFlag(FLAGS_log_dir) << '\n'; +#endif } catch (const std::exception& e) { std::cerr << e.what() << '\n'; +#if USE_GLOG_AND_GFLAGS std::cerr << "Could not create the " << FLAGS_log_dir << " folder. Front-end-cal program ended.\n"; gflags::ShutDownCommandLineFlags(); +#else + std::cerr << "Could not create the " << absl::GetFlag(FLAGS_log_dir) << " folder. Front-end-cal program ended.\n"; +#endif return 1; } } @@ -335,7 +410,11 @@ int main(int argc, char** argv) FrontEndCal front_end_cal; // 1. Load configuration parameters from config file +#if USE_GLOG_AND_GFLAGS std::shared_ptr configuration = std::make_shared(FLAGS_config_file); +#else + std::shared_ptr configuration = std::make_shared(absl::GetFlag(FLAGS_config_file)); +#endif front_end_cal.set_configuration(configuration); // 2. Get SUPL information from server: Ephemeris record, assistance info and TOW @@ -541,7 +620,9 @@ int main(int argc, char** argv) else { std::cout << "Unable to get Ephemeris SUPL assistance. TOW is unknown!\n"; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif std::cout << "GNSS-SDR Front-end calibration program ended.\n"; return 0; } @@ -549,7 +630,9 @@ int main(int argc, char** argv) catch (const boost::exception& e) { std::cout << "Exception in getting Global ephemeris map\n"; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif std::cout << "GNSS-SDR Front-end calibration program ended.\n"; return 0; } @@ -568,7 +651,9 @@ int main(int argc, char** argv) if (doppler_measurements_map.empty()) { std::cout << "Sorry, no GPS satellites detected in the front-end capture, please check the antenna setup...\n"; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif std::cout << "GNSS-SDR Front-end calibration program ended.\n"; return 0; } @@ -673,17 +758,22 @@ int main(int argc, char** argv) catch (const std::exception& e) { std::cerr << "Exception: " << e.what(); +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } catch (...) { std::cerr << "Unknown error\n"; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } - +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif std::cout << "GNSS-SDR Front-end calibration program ended.\n"; return 0; } diff --git a/src/utils/rinex-tools/CMakeLists.txt b/src/utils/rinex-tools/CMakeLists.txt index 107d4be37..cef3bd057 100644 --- a/src/utils/rinex-tools/CMakeLists.txt +++ b/src/utils/rinex-tools/CMakeLists.txt @@ -52,8 +52,10 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO) add_dependencies(obsdiff armadillo-${armadillo_RELEASE}) endif() - if(NOT GFLAGS_FOUND) - add_dependencies(obsdiff gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) + if(ENABLE_GLOG_AND_GFLAGS) + if(NOT GFLAGS_FOUND) + add_dependencies(obsdiff gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) + endif() endif() if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) add_dependencies(obsdiff gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}) @@ -101,11 +103,17 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND PRIVATE Armadillo::armadillo Threads::Threads - Gflags::gflags Matio::matio Gnsstk::gnsstk ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(obsdiff PRIVATE Gflags::gflags) + target_compile_definitions(obsdiff PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(obsdiff PRIVATE absl::flags absl::flags_parse) + endif() + if(ENABLE_STRIP) set_target_properties(obsdiff PROPERTIES LINK_FLAGS "-s") endif() diff --git a/src/utils/rinex-tools/obsdiff.cc b/src/utils/rinex-tools/obsdiff.cc index 0b156bb86..1b2cd1fc3 100644 --- a/src/utils/rinex-tools/obsdiff.cc +++ b/src/utils/rinex-tools/obsdiff.cc @@ -80,12 +80,16 @@ namespace gnsstk = gpstk; #endif #endif +#if USE_GLOG_AND_GFLAGS #if GFLAGS_OLD_NAMESPACE namespace gflags { using namespace google; } #endif +#else +#include +#endif // Create the lists of GNSS satellites std::set available_gps_prn = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, @@ -422,8 +426,12 @@ void carrier_phase_double_diff( << " [Cycles]\n"; std::cout.precision(ss); - // plots +// plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Double diff Carrier Phase error [Cycles]"); @@ -506,8 +514,12 @@ void carrier_phase_single_diff( << " [Cycles]\n"; std::cout.precision(ss); - // plots +// plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Single diff Carrier Phase error [Cycles]"); @@ -614,7 +626,11 @@ void carrier_doppler_double_diff( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Double diff Carrier Doppler error [Hz]"); @@ -697,7 +713,11 @@ void carrier_doppler_single_diff( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Single diff Carrier Doppler error [Hz]"); @@ -805,7 +825,11 @@ void code_pseudorange_double_diff( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Double diff Pseudorange error [m]"); @@ -890,7 +914,11 @@ void code_pseudorange_single_diff( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Single diff Pseudorange error [m]"); @@ -1039,7 +1067,11 @@ void coderate_phaserate_consistence( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Code rate - phase rate [m/s]"); @@ -1123,7 +1155,11 @@ void code_phase_diff( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Code range - Carrier phase range [m]"); @@ -1396,13 +1432,23 @@ void RINEX_doublediff_dupli_sat() { // special test mode for duplicated satellites // read rinex receiver-under-test observations +#if USE_GLOG_AND_GFLAGS std::map rover_obs = ReadRinexObs(FLAGS_rover_rinex_obs, 'G', std::string("1C")); +#else + std::map rover_obs = ReadRinexObs(absl::GetFlag(FLAGS_rover_rinex_obs), 'G', std::string("1C")); +#endif + + if (rover_obs.empty()) { return; } - // Cut measurement initial transitory of the measurements + // Cut measurement initial transitory of the measurements +#if USE_GLOG_AND_GFLAGS double initial_transitory_s = FLAGS_skip_obs_transitory_s; +#else + double initial_transitory_s = absl::GetFlag(FLAGS_skip_obs_transitory_s); +#endif std::cout << "Skipping initial transitory of " << initial_transitory_s << " [s]\n"; arma::uvec index; for (auto& rover_ob : rover_obs) @@ -1415,7 +1461,11 @@ void RINEX_doublediff_dupli_sat() } std::vector prn_pairs; +#if USE_GLOG_AND_GFLAGS std::stringstream ss(FLAGS_dupli_sat_prns); +#else + std::stringstream ss(absl::GetFlag(FLAGS_dupli_sat_prns)); +#endif unsigned int i; while (ss >> i) { @@ -1463,11 +1513,17 @@ void RINEX_doublediff_dupli_sat() void RINEX_doublediff(bool remove_rx_clock_error) { +#if USE_GLOG_AND_GFLAGS // read rinex base observations std::map base_obs = ReadRinexObs(FLAGS_base_rinex_obs, FLAGS_system.c_str()[0], FLAGS_signal); // read rinex receiver-under-test (rover) observations std::map rover_obs = ReadRinexObs(FLAGS_rover_rinex_obs, FLAGS_system.c_str()[0], FLAGS_signal); - +#else + // read rinex base observations + std::map base_obs = ReadRinexObs(absl::GetFlag(FLAGS_base_rinex_obs), absl::GetFlag(FLAGS_system).c_str()[0], absl::GetFlag(FLAGS_signal)); + // read rinex receiver-under-test (rover) observations + std::map rover_obs = ReadRinexObs(absl::GetFlag(FLAGS_rover_rinex_obs), absl::GetFlag(FLAGS_system).c_str()[0], absl::GetFlag(FLAGS_signal)); +#endif if (base_obs.empty() or rover_obs.empty()) { return; @@ -1478,14 +1534,24 @@ void RINEX_doublediff(bool remove_rx_clock_error) double rover_rx_clock_error_s = 0.0; if (remove_rx_clock_error == true) { +#if USE_GLOG_AND_GFLAGS base_rx_clock_error_s = compute_rx_clock_error(FLAGS_rinex_nav, FLAGS_base_rinex_obs); rover_rx_clock_error_s = compute_rx_clock_error(FLAGS_rinex_nav, FLAGS_rover_rinex_obs); +#else + base_rx_clock_error_s = compute_rx_clock_error(absl::GetFlag(FLAGS_rinex_nav), absl::GetFlag(FLAGS_base_rinex_obs)); + rover_rx_clock_error_s = compute_rx_clock_error(absl::GetFlag(FLAGS_rinex_nav), absl::GetFlag(FLAGS_rover_rinex_obs)); +#endif } double common_clock_error_s = rover_rx_clock_error_s - base_rx_clock_error_s; // Cut measurement initial transitory of the measurements + +#if USE_GLOG_AND_GFLAGS double initial_transitory_s = FLAGS_skip_obs_transitory_s; +#else + double initial_transitory_s = absl::GetFlag(FLAGS_skip_obs_transitory_s); +#endif std::cout << "Skipping initial transitory of " << initial_transitory_s << " [s]\n"; arma::uvec index; for (auto& rover_ob : rover_obs) @@ -1535,7 +1601,11 @@ void RINEX_doublediff(bool remove_rx_clock_error) base_obs_time = base_obs.begin()->second.col(0); rover_obs_time = rover_obs.begin()->second.col(0); +#if USE_GLOG_AND_GFLAGS double skip_ends_s = FLAGS_skip_obs_ends_s; +#else + double skip_ends_s = absl::GetFlag(FLAGS_skip_obs_ends_s); +#endif std::cout << "Skipping last " << skip_ends_s << " [s] of observations\n"; for (auto& rover_ob : rover_obs) { @@ -1653,16 +1723,24 @@ void RINEX_doublediff(bool remove_rx_clock_error) void RINEX_singlediff() { +#if USE_GLOG_AND_GFLAGS // read rinex receiver-under-test observations std::map rover_obs = ReadRinexObs(FLAGS_rover_rinex_obs, FLAGS_system.c_str()[0], FLAGS_signal); - +#else + // read rinex receiver-under-test observations + std::map rover_obs = ReadRinexObs(absl::GetFlag(FLAGS_rover_rinex_obs), absl::GetFlag(FLAGS_system).c_str()[0], absl::GetFlag(FLAGS_signal)); +#endif if (rover_obs.empty()) { return; } - // Cut measurement initial transitory of the measurements + // Cut measurement initial transitory of the measurements +#if USE_GLOG_AND_GFLAGS double initial_transitory_s = FLAGS_skip_obs_transitory_s; +#else + double initial_transitory_s = absl::GetFlag(FLAGS_skip_obs_transitory_s); +#endif std::cout << "Skipping initial transitory of " << initial_transitory_s << " [s]\n"; arma::uvec index; for (auto& rover_ob : rover_obs) @@ -1677,7 +1755,11 @@ void RINEX_singlediff() // also skip last seconds of the observations (some artifacts are present in some RINEX endings) arma::colvec rover_obs_time = rover_obs.begin()->second.col(0); +#if USE_GLOG_AND_GFLAGS double skip_ends_s = FLAGS_skip_obs_ends_s; +#else + double skip_ends_s = absl::GetFlag(FLAGS_skip_obs_ends_s); +#endif std::cout << "Skipping last " << skip_ends_s << " [s] of observations\n"; for (auto& rover_ob : rover_obs) { @@ -1727,12 +1809,22 @@ void RINEX_singlediff() int main(int argc, char** argv) { std::cout << "Running RINEX observables difference tool...\n"; +#if USE_GLOG_AND_GFLAGS gflags::ParseCommandLineFlags(&argc, &argv, true); +#else + absl::ParseCommandLine(argc, argv); +#endif try { +#if USE_GLOG_AND_GFLAGS if (FLAGS_single_diff) { if (FLAGS_dupli_sat) +#else + if (absl::GetFlag(FLAGS_single_diff)) + { + if (absl::GetFlag(FLAGS_dupli_sat)) +#endif { RINEX_doublediff_dupli_sat(); } @@ -1743,27 +1835,39 @@ int main(int argc, char** argv) } else { +#if USE_GLOG_AND_GFLAGS RINEX_doublediff(FLAGS_remove_rx_clock_error); +#else + RINEX_doublediff(absl::GetFlag(FLAGS_remove_rx_clock_error)); +#endif } } catch (const gnsstk::Exception& e) { std::cerr << e; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } catch (const std::exception& e) { std::cerr << "Exception: " << e.what(); +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } catch (...) { std::cerr << "Unknown error\n"; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 0; } diff --git a/src/utils/rinex-tools/obsdiff_flags.h b/src/utils/rinex-tools/obsdiff_flags.h index 961ae9536..d3b9a607c 100644 --- a/src/utils/rinex-tools/obsdiff_flags.h +++ b/src/utils/rinex-tools/obsdiff_flags.h @@ -18,6 +18,7 @@ #ifndef GNSS_SDR_OBSDIFF_FLAGS_H #define GNSS_SDR_OBSDIFF_FLAGS_H +#if USE_GLOG_AND_GFLAGS #include DEFINE_double(skip_obs_transitory_s, 30.0, "Skip the initial observable outputs to avoid transitory results [s]"); @@ -33,5 +34,24 @@ DEFINE_string(rover_rinex_obs, "base.obs", "Filename of test RINEX observation f DEFINE_string(system, "G", "GNSS satellite system: G for GPS, E for Galileo"); DEFINE_string(signal, "1C", "GNSS signal: 1C for GPS L1 CA, 1B for Galileo E1"); DEFINE_bool(remove_rx_clock_error, false, "Compute and remove the receivers clock error prior to compute observable differences (requires a valid RINEX nav file for both receivers)"); +#else +#include +#include +#include + +ABSL_FLAG(double, skip_obs_transitory_s, 30.0, "Skip the initial observable outputs to avoid transitory results [s]"); +ABSL_FLAG(double, skip_obs_ends_s, 5.0, "Skip the lasts observable outputs to avoid transitory results [s]"); +ABSL_FLAG(bool, single_diffs, false, "Compute also the single difference errors for Accumulated Carrier Phase and Carrier Doppler (requires LO synchronization between receivers)"); +ABSL_FLAG(bool, compare_with_5X, false, "Compare the E5a Doppler and Carrier Phases with the E5 full bw in RINEX (expect discrepancy due to the center frequencies difference)"); +ABSL_FLAG(bool, dupli_sat, false, "Enable special observable test mode where the scenario contains duplicated satellite orbits"); +ABSL_FLAG(bool, single_diff, false, "Enable special observable test mode using only rover observables"); +ABSL_FLAG(std::string, dupli_sat_prns, "1,2,3,4", "List of duplicated satellites PRN pairs (i.e. 1,2,3,4 indicates that the PRNs 1,2 share the same orbit. The same applies for PRNs 3,4)"); +ABSL_FLAG(std::string, base_rinex_obs, "base.obs", "Filename of reference RINEX observation file"); +ABSL_FLAG(std::string, rinex_nav, "base.nav", "Filename of reference RINEX navigation file"); +ABSL_FLAG(std::string, rover_rinex_obs, "base.obs", "Filename of test RINEX observation file"); +ABSL_FLAG(std::string, system, "G", "GNSS satellite system: G for GPS, E for Galileo"); +ABSL_FLAG(std::string, signal, "1C", "GNSS signal: 1C for GPS L1 CA, 1B for Galileo E1"); +ABSL_FLAG(bool, remove_rx_clock_error, false, "Compute and remove the receivers clock error prior to compute observable differences (requires a valid RINEX nav file for both receivers)"); #endif +#endif diff --git a/src/utils/rinex2assist/CMakeLists.txt b/src/utils/rinex2assist/CMakeLists.txt index 4f9e31b88..528beff86 100644 --- a/src/utils/rinex2assist/CMakeLists.txt +++ b/src/utils/rinex2assist/CMakeLists.txt @@ -79,11 +79,17 @@ if(Boost_FOUND) Boost::iostreams Boost::serialization ${GNSSTK_LIBRARY} - Gflags::gflags Threads::Threads core_system_parameters ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(rinex2assist PRIVATE Gflags::gflags) + target_compile_definitions(rinex2assist PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(rinex2assist PRIVATE absl::flags absl::flags_parse) + endif() + if(GNSSTK_USES_GPSTK_NAMESPACE) target_compile_definitions(rinex2assist PUBLIC -DGNSSTK_USES_GPSTK_NAMESPACE=1) target_include_directories(rinex2assist diff --git a/src/utils/rinex2assist/main.cc b/src/utils/rinex2assist/main.cc index b100ac95d..7ae45a286 100644 --- a/src/utils/rinex2assist/main.cc +++ b/src/utils/rinex2assist/main.cc @@ -27,7 +27,6 @@ #include #include #include -#include #include // for size_t #include #include @@ -44,12 +43,21 @@ namespace gnsstk = gpstk; #include #endif +#if USE_GLOG_AND_GFLAGS +#include #if GFLAGS_OLD_NAMESPACE namespace gflags { using namespace google; } #endif +#else +#include +#include +#include +#include +std::string TstVersionString() { return "1.0"; } +#endif int main(int argc, char** argv) { @@ -61,17 +69,26 @@ int main(int argc, char** argv) "Usage: \n" + " rinex2assist "); +#if USE_GLOG_AND_GFLAGS gflags::SetUsageMessage(intro_help); google::SetVersionString("1.0"); gflags::ParseCommandLineFlags(&argc, &argv, true); - +#else + absl::FlagsUsageConfig empty_config; + empty_config.version_string = &TstVersionString; + absl::SetFlagsUsageConfig(empty_config); + absl::SetProgramUsageMessage(intro_help); + absl::ParseCommandLine(argc, argv); +#endif if ((argc != 2)) { std::cerr << "Usage:\n"; std::cerr << " " << argv[0] << " " << '\n'; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } std::string xml_filename; @@ -327,14 +344,18 @@ int main(int argc, char** argv) { std::cerr << "Error reading the RINEX file: " << e.what() << '\n'; std::cerr << "No XML file will be created.\n"; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } if (i == 0 and j == 0) { std::cerr << "No navigation data found in the RINEX file. No XML file will be created.\n"; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } @@ -355,7 +376,9 @@ int main(int argc, char** argv) catch (std::exception& e) { std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << '\n'; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } std::cout << "Generated file: " << xml_filename << '\n'; @@ -373,7 +396,9 @@ int main(int argc, char** argv) catch (std::exception& e) { std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << '\n'; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } std::cout << "Generated file: " << xml_filename << '\n'; @@ -393,7 +418,9 @@ int main(int argc, char** argv) catch (std::exception& e) { std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << '\n'; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } std::cout << "Generated file: " << xml_filename << '\n'; @@ -413,7 +440,9 @@ int main(int argc, char** argv) catch (std::exception& e) { std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << '\n'; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } std::cout << "Generated file: " << xml_filename << '\n'; @@ -432,7 +461,9 @@ int main(int argc, char** argv) catch (std::exception& e) { std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << '\n'; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } std::cout << "Generated file: " << xml_filename << '\n'; @@ -450,11 +481,15 @@ int main(int argc, char** argv) catch (std::exception& e) { std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << '\n'; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } std::cout << "Generated file: " << xml_filename << '\n'; } +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 0; }