diff --git a/CMakeLists.txt b/CMakeLists.txt index 49218e7ed..49787612b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -657,6 +657,17 @@ endif(NOT ARMADILLO_FOUND) # OpenCL ############################################################################### find_package(OpenCL) +if($ENV{DISABLE_OPENCL}) + set(DISABLE_OPENCL TRUE) +endif($ENV{DISABLE_OPENCL}) +if(DISABLE_OPENCL) + set(OPENCL_FOUND FALSE) +else(DISABLE_OPENCL) + if(OPENCL_FOUND) + message(STATUS "OpenCL has been found and will be used by some processing blocks") + message(STATUS "You can disable OpenCL use by doing 'cmake -DDISABLE_OPENCL=1 ../' ") + endif(OPENCL_FOUND) +endif(DISABLE_OPENCL) if(NOT OPENCL_FOUND) message(STATUS "Processing blocks using OpenCL will not be built.") endif(NOT OPENCL_FOUND) diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index 47fedc374..840275471 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -98,10 +98,12 @@ if( RTLSDR_DRIVER ) endif( RTLSDR_DRIVER ) #Enable OpenCL if found in the system -if ( OPENCL_FOUND ) +if(OPENCL_FOUND) message(STATUS "Adding processing blocks implemented using OpenCL" ) - add_definitions(-DOPENCL=1) -endif( OPENCL_FOUND ) + add_definitions(-DOPENCL_BLOCKS=1) +else(OPENCL_FOUND) + add_definitions(-DOPENCL_BLOCKS=0) +endif(OPENCL_FOUND) add_library(gnss_rx ${GNSS_RECEIVER_SOURCES}) diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index b713e9577..22c3b580e 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -79,7 +79,7 @@ #include "gps_l1_ca_pvt.h" #include "galileo_e1_pvt.h" -#if OPENCL +#if OPENCL_BLOCKS #include "gps_l1_ca_pcps_opencl_acquisition.h" #endif @@ -403,7 +403,7 @@ GNSSBlockInterface* GNSSBlockFactory::GetBlock( out_streams, queue); } -#if OPENCL +#if OPENCL_BLOCKS else if (implementation.compare("GPS_L1_CA_PCPS_OpenCl_Acquisition") == 0) { block = new GpsL1CaPcpsOpenClAcquisition(configuration, role, in_streams, diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index e162355f4..6cc3dd09c 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -80,6 +80,7 @@ else(NOT GTEST_DIR_LOCAL) set(GTEST_LIBRARIES gtest) endif(NOT GTEST_DIR_LOCAL) + include_directories( ${GTEST_INCLUDE_DIRECTORIES} @@ -104,6 +105,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/algorithms/acquisition/adapters ${CMAKE_SOURCE_DIR}/src/algorithms/acquisition/gnuradio_blocks ${CMAKE_SOURCE_DIR}/src/algorithms/output_filter/adapters + ${CMAKE_SOURCE_DIR}/src/algorithms/pvt/libs ${GLOG_INCLUDE_DIRS} ${GFlags_INCLUDE_DIRS} ${GNURADIO_RUNTIME_INCLUDE_DIRS} @@ -120,6 +122,10 @@ if(OS_IS_MACOSX) endif(MACOSX_MAVERICKS) endif(OS_IS_MACOSX) +if(OPENCL_FOUND) + add_definitions(-DOPENCL_BLOCKS_TEST=1) +endif(OPENCL_FOUND) + add_executable(run_tests ${CMAKE_CURRENT_SOURCE_DIR}/test_main.cc) target_link_libraries(run_tests ${MAC_LIBRARIES} @@ -135,6 +141,8 @@ target_link_libraries(run_tests ${MAC_LIBRARIES} gnss_rx signal_generator_blocks signal_generator_adapters + out_adapters + pvt_gr_blocks ) install(TARGETS run_tests DESTINATION ${CMAKE_SOURCE_DIR}/install) @@ -168,7 +176,7 @@ add_executable(gnss_block_test EXCLUDE_FROM_ALL ${CMAKE_CURRENT_SOURCE_DIR}/gnss_block/gps_l1_ca_pcps_acquisition_test.cc ${CMAKE_CURRENT_SOURCE_DIR}/gnss_block/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc ${CMAKE_CURRENT_SOURCE_DIR}/gnss_block/gps_l1_ca_pcps_multithread_acquisition_gsoc2013_test.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gnss_block/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc +# ${CMAKE_CURRENT_SOURCE_DIR}/gnss_block/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc ${CMAKE_CURRENT_SOURCE_DIR}/gnss_block/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc ${CMAKE_CURRENT_SOURCE_DIR}/gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc ${CMAKE_CURRENT_SOURCE_DIR}/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc @@ -187,6 +195,7 @@ target_link_libraries(gnss_block_test ${Boost_LIBRARIES} gnss_sp_libs gnss_rx signal_generator_blocks + out_adapters ) add_test(gnss_block_test gnss_block_test) diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index 9f0baa403..0d72eaa9d 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -78,6 +78,7 @@ #include "string_converter/string_converter_test.cc" //#include "flowgraph/gnss_flowgraph_test.cc" +#include "gnss_block/rtcm_printer_test.cc" #include "gnss_block/file_output_filter_test.cc" #include "gnss_block/file_signal_source_test.cc" #include "gnss_block/fir_filter_test.cc" @@ -85,7 +86,7 @@ #include "gnss_block/gps_l1_ca_pcps_acquisition_test.cc" #include "gnss_block/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc" //#include "gnss_block/gps_l1_ca_pcps_multithread_acquisition_gsoc2013_test.cc" -#if OPENCL +#if OPENCL_BLOCKS_TEST #include "gnss_block/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc" #endif #include "gnss_block/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc"