diff --git a/cmake/Modules/FindVolk.cmake b/cmake/Modules/FindVolk.cmake index a8e82a467..ffe0a4883 100644 --- a/cmake/Modules/FindVolk.cmake +++ b/cmake/Modules/FindVolk.cmake @@ -9,22 +9,22 @@ FIND_PATH( VOLK_INCLUDE_DIRS NAMES volk/volk.h HINTS $ENV{VOLK_DIR}/include - ${PC_VOLK_INCLUDEDIR} + ${PC_VOLK_INCLUDEDIR} PATHS /usr/local/include /usr/include - ${GNURADIO_INSTALL_PREFIX}/include + ${CMAKE_INSTALL_PREFIX}/include ) FIND_LIBRARY( VOLK_LIBRARIES NAMES volk HINTS $ENV{VOLK_DIR}/lib - ${PC_VOLK_LIBDIR} + ${PC_VOLK_LIBDIR} PATHS /usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64 - ${GNURADIO_INSTALL_PREFIX}/lib + ${CMAKE_INSTALL_PREFIX}/lib ) set(VOLK_VERSION ${PC_VOLK_VERSION}) diff --git a/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt b/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt index 70d887f61..37aae6978 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt @@ -47,6 +47,32 @@ include_directories( ) +## Workaround for issues with the change of VOLK API +## See https://github.com/gnuradio/volk/issues/84 +## and https://github.com/gnss-sdr/gnss-sdr/issues/31 + +if(NOT VOLK_VERSION) + set(VOLK_VERSION "1.2.2") +endif(NOT VOLK_VERSION) + +if(VOLK_VERSION VERSION_EQUAL 1.2.2) + find_file(VOLK_GREATER_THAN_122 + NAMES volk/volk_32f_index_max_32u.h + HINTS ${CMAKE_INSTALL_PREFIX}/include + PATHS /usr/local/include + /usr/include + ${CMAKE_INSTALL_PREFIX}/include + ) + if(VOLK_GREATER_THAN_122) + set(VOLK_VERSION "1.2.3+") + endif(VOLK_GREATER_THAN_122) +endif(VOLK_VERSION VERSION_EQUAL 1.2.2) + +if(VOLK_VERSION VERSION_GREATER 1.2.2) + add_definitions(-DVOLK_GT_122=1) +endif(VOLK_VERSION VERSION_GREATER 1.2.2) + + if(OPENCL_FOUND) include_directories( ${OPENCL_INCLUDE_DIRS} ) if(OS_IS_MACOSX) 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 94734e707..d08a7bd81 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 @@ -424,11 +424,19 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items // initialize acquisition algorithm int doppler; +#if VOLK_GT_122 uint16_t indext = 0; uint16_t indext_IA = 0; uint16_t indext_IB = 0; uint16_t indext_QA = 0; uint16_t indext_QB = 0; +#else + unsigned int indext = 0; + unsigned int indext_IA = 0; + unsigned int indext_IB = 0; + unsigned int indext_QA = 0; + unsigned int indext_QB = 0; +#endif float magt = 0.0; float magt_IA = 0.0; float magt_IB = 0.0; 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 191a94ff7..13a0be91b 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 @@ -242,9 +242,15 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items, { // initialize acquisition algorithm int doppler; +#if VOLK_GT_122 uint16_t indext = 0; uint16_t indext_A = 0; uint16_t indext_B = 0; +#else + unsigned int indext = 0; + unsigned int indext_A = 0; + unsigned int indext_B = 0; +#endif float magt = 0.0; float magt_A = 0.0; float magt_B = 0.0; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc index 0f8ef0fba..c48d79c3c 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc @@ -284,7 +284,11 @@ int pcps_acquisition_cc::general_work(int noutput_items, { // initialize acquisition algorithm int doppler; +#if VOLK_GT_122 uint16_t indext = 0; +#else + unsigned int indext = 0; +#endif float magt = 0.0; const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer 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 b81eeb5f0..ecc44801f 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 @@ -222,8 +222,13 @@ double pcps_acquisition_fine_doppler_cc::search_maximum() float magt = 0.0; float fft_normalization_factor; int index_doppler = 0; +#if VOLK_GT_122 uint16_t tmp_intex_t; uint16_t index_time = 0; +#else + unsigned int tmp_intex_t = 0; + unsigned int index_time = 0; +#endif for (int i=0;iget_outbuf(), fft_size_extended); +#if VOLK_GT_122 uint16_t tmp_index_freq = 0; +#else + unsigned int tmp_index_freq = 0; +#endif volk_32f_index_max_16u(&tmp_index_freq, p_tmp_vector, fft_size_extended); //case even diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_sc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_sc.cc index 1d45f45e6..855ec01ae 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_sc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_sc.cc @@ -281,7 +281,11 @@ int pcps_acquisition_sc::general_work(int noutput_items, { // initialize acquisition algorithm int doppler; +#if VOLK_GT_122 uint16_t indext = 0; +#else + unsigned int indext = 0; +#endif float magt = 0.0; const lv_16sc_t *in = (const lv_16sc_t *)input_items[0]; //Get the input samples pointer int effective_fft_size = ( d_bit_transition_flag ? d_fft_size/2 : d_fft_size ); 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 6e31447d6..980a3b5ee 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc @@ -268,8 +268,13 @@ double pcps_assisted_acquisition_cc::search_maximum() float magt = 0.0; float fft_normalization_factor; int index_doppler = 0; +#if VOLK_GT_122 uint16_t tmp_intex_t; uint16_t index_time = 0; +#else + unsigned int tmp_intex_t = 0; + unsigned int index_time = 0; +#endif for (int i=0;i(d_fft_size) * static_cast(d_fft_size); gr_complex* in = d_in_buffer[d_well_count]; @@ -508,7 +512,11 @@ void pcps_opencl_acquisition_cc::acquisition_core_opencl() { // initialize acquisition algorithm int doppler; +#if VOLK_GT_122 uint16_t indext = 0; +#else + unsigned int indext = 0; +#endif float magt = 0.0; float fft_normalization_factor = (static_cast(d_fft_size_pow2) * static_cast(d_fft_size)); //This works, but I am not sure why. gr_complex* in = d_in_buffer[d_well_count]; 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 35dbc49df..60fd66896 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc @@ -301,7 +301,11 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items, /* initialize acquisition implementing the QuickSync algorithm*/ //DLOG(INFO) << "START CASE 1"; int doppler; +#if VOLK_GT_122 uint16_t indext = 0; +#else + unsigned int indext = 0; +#endif float magt = 0.0; const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer 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 e7d1cca89..ada08ce96 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc @@ -279,7 +279,11 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items, { // initialize acquisition algorithm int doppler; +#if VOLK_GT_122 uint16_t indext = 0; +#else + unsigned int indext = 0; +#endif float magt = 0.0; const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer float fft_normalization_factor = static_cast(d_fft_size) * static_cast(d_fft_size);