1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-13 03:30:33 +00:00

Fixing compilation when CUDA is not present

This commit is contained in:
Carles Fernandez 2015-08-25 17:07:36 +02:00
parent e38cb40d4f
commit 429e4e8776
7 changed files with 41 additions and 36 deletions

View File

@ -961,11 +961,12 @@ if($ENV{CUDA_GPU_ACCEL})
endif($ENV{CUDA_GPU_ACCEL})
if(ENABLE_CUDA)
FIND_PACKAGE(CUDA REQUIRED)
message(STATUS "NVIDIA CUDA GPU Acceleration will be enabled." )
message(STATUS "You can disable it with 'cmake -DENABLE_CUDA=OFF ../'" )
else(ENABLE_CUDA)
message(STATUS "NVIDIA CUDA GPU Acceleration will is not enabled." )
message(STATUS "Enable it with 'cmake -DENABLE_CUDA=ON ../' to add support for the Teleorbit Flexiband front-end." )
message(STATUS "Enable it with 'cmake -DENABLE_CUDA=ON ../' to add support for GPU-based acceleration using CUDA." )
endif(ENABLE_CUDA)

View File

@ -17,8 +17,8 @@
#
if(ENABLE_CUDA)
FIND_PACKAGE(CUDA REQUIRED)
set(OPT_TRACKING_ADAPTERS ${OPT_TRACKING_ADAPTERS} gps_l1_ca_dll_pll_tracking_gpu.cc)
set(OPT_TRACKING_ADAPTERS ${OPT_TRACKING_ADAPTERS} gps_l1_ca_dll_pll_tracking_gpu.cc)
set(OPT_TRACKING_INCLUDE_DIRS ${OPT_TRACKING_INCLUDE_DIRS} ${CUDA_INCLUDE_DIRS})
endif(ENABLE_CUDA)
set(TRACKING_ADAPTER_SOURCES
@ -45,7 +45,7 @@ include_directories(
${GLOG_INCLUDE_DIRS}
${GFlags_INCLUDE_DIRS}
${GNURADIO_RUNTIME_INCLUDE_DIRS}
${CUDA_INCLUDE_DIRS}
${OPT_TRACKING_INCLUDE_DIRS}
)
file(GLOB TRACKING_ADAPTER_HEADERS "*.h")

View File

@ -18,8 +18,10 @@
if(ENABLE_CUDA)
FIND_PACKAGE(CUDA REQUIRED)
set(OPT_TRACKING_BLOCKS ${OPT_TRACKING_BLOCKS} gps_l1_ca_dll_pll_tracking_gpu_cc.cc)
set(OPT_TRACKING_BLOCKS ${OPT_TRACKING_BLOCKS} gps_l1_ca_dll_pll_tracking_gpu_cc.cc)
set(OPT_TRACKING_INCLUDES ${OPT_TRACKING_INCLUDES} ${CUDA_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/src/algorithms/tracking/libs/cudahelpers)
set(OPT_TRACKING_LIBRARIES ${OPT_TRACKING_LIBRARIES} ${CUDA_LIBRARIES})
endif(ENABLE_CUDA)
set(TRACKING_GR_BLOCKS_SOURCES
@ -32,7 +34,7 @@ set(TRACKING_GR_BLOCKS_SOURCES
gps_l1_ca_tcp_connector_tracking_cc.cc
galileo_e5a_dll_pll_tracking_cc.cc
gps_l2_m_dll_pll_tracking_cc.cc
${OPT_TRACKING_BLOCKS}
${OPT_TRACKING_BLOCKS}
)
include_directories(
@ -47,8 +49,7 @@ include_directories(
${Boost_INCLUDE_DIRS}
${GNURADIO_RUNTIME_INCLUDE_DIRS}
${VOLK_GNSSSDR_INCLUDE_DIRS}
${CUDA_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/src/algorithms/tracking/libs/cudahelpers
${OPT_TRACKING_INCLUDES}
)
if(ENABLE_GENERIC_ARCH)
@ -59,7 +60,8 @@ file(GLOB TRACKING_GR_BLOCKS_HEADERS "*.h")
add_library(tracking_gr_blocks ${TRACKING_GR_BLOCKS_SOURCES} ${TRACKING_GR_BLOCKS_HEADERS})
source_group(Headers FILES ${TRACKING_GR_BLOCKS_HEADERS})
target_link_libraries(tracking_gr_blocks tracking_lib ${GNURADIO_RUNTIME_LIBRARIES} gnss_sp_libs ${Boost_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES} ${CUDA_LIBRARIES})
target_link_libraries(tracking_gr_blocks tracking_lib ${GNURADIO_RUNTIME_LIBRARIES} gnss_sp_libs ${Boost_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES} ${OPT_TRACKING_LIBRARIES})
if(NOT VOLK_GNSSSDR_FOUND)
add_dependencies(tracking_gr_blocks volk_gnsssdr_module)
endif(NOT VOLK_GNSSSDR_FOUND)

View File

@ -18,21 +18,19 @@
if(ENABLE_CUDA)
FIND_PACKAGE(CUDA REQUIRED)
# Append current NVCC flags by something, eg comput capability
# set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --gpu-architecture sm_30)
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_30,code=sm_30; -std=c++11;-O3; -use_fast_math -default-stream per-thread")
SET(CUDA_PROPAGATE_HOST_FLAGS OFF)
CUDA_INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/cudahelpers
)
# Append current NVCC flags by something, eg comput capability
# set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --gpu-architecture sm_30)
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_30,code=sm_30; -std=c++11;-O3; -use_fast_math -default-stream per-thread")
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
CUDA_INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/cudahelpers
)
SET(LIB_TYPE STATIC) #set the lib type
CUDA_ADD_LIBRARY(CUDA_CORRELATOR_LIB ${LIB_TYPE} cuda_multicorrelator.h cuda_multicorrelator.cu)
set(LIB_TYPE STATIC) #set the lib type
CUDA_ADD_LIBRARY(CUDA_CORRELATOR_LIB ${LIB_TYPE} cuda_multicorrelator.h cuda_multicorrelator.cu)
set(OPT_TRACKING_LIBRARIES ${OPT_TRACKING_LIBRARIES} CUDA_CORRELATOR_LIB)
set(OPT_TRACKING_INCLUDES ${OPT_TRACKING_INCLUDES} ${CUDA_INCLUDE_DIRS})
endif(ENABLE_CUDA)
@ -53,7 +51,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/core/interfaces
${CMAKE_SOURCE_DIR}/src/core/receiver
${VOLK_INCLUDE_DIRS}
${CUDA_INCLUDE_DIRS}
${OPT_TRACKING_INCLUDES}
)
if(ENABLE_GENERIC_ARCH)
@ -68,4 +66,4 @@ endif(SSE3_AVAILABLE)
file(GLOB TRACKING_LIB_HEADERS "*.h")
add_library(tracking_lib ${TRACKING_LIB_SOURCES} ${TRACKING_LIB_HEADERS})
source_group(Headers FILES ${TRACKING_LIB_HEADERS})
target_link_libraries(tracking_lib CUDA_CORRELATOR_LIB ${VOLK_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES})
target_link_libraries(tracking_lib ${OPT_TRACKING_LIBRARIES} ${VOLK_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES})

View File

@ -16,10 +16,6 @@
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
if(ENABLE_CUDA)
FIND_PACKAGE(CUDA REQUIRED)
add_definitions(-DCUDA_GPU_ACCEL=1)
endif(ENABLE_CUDA)
set(GNSS_RECEIVER_SOURCES
control_thread.cc
@ -35,6 +31,11 @@ if(PC_GNURADIO_RUNTIME_VERSION VERSION_GREATER 3.7.3)
add_definitions(-DMODERN_GNURADIO=1)
endif(PC_GNURADIO_RUNTIME_VERSION VERSION_GREATER 3.7.3)
if(ENABLE_CUDA)
add_definitions(-DCUDA_GPU_ACCEL=1)
set(OPT_RECEIVER_INCLUDE_DIRS ${OPT_RECEIVER_INCLUDE_DIRS} ${CUDA_INCLUDE_DIRS})
endif(ENABLE_CUDA)
include_directories(
$(CMAKE_CURRENT_SOURCE_DIR)
@ -75,7 +76,7 @@ include_directories(
${GFlags_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${GNURADIO_RUNTIME_INCLUDE_DIRS}
${CUDA_INCLUDE_DIRS}
${OPT_RECEIVER_INCLUDE_DIRS}
)
if(Boost_VERSION LESS 105000)

View File

@ -77,7 +77,6 @@
#include "galileo_e1_pcps_quicksync_ambiguous_acquisition.h"
#include "galileo_e5a_noncoherent_iq_acquisition_caf.h"
#include "gps_l1_ca_dll_pll_tracking.h"
#include "gps_l1_ca_dll_pll_tracking_gpu.h"
#include "gps_l1_ca_dll_pll_optim_tracking.h"
#include "gps_l1_ca_dll_fll_pll_tracking.h"
#include "gps_l1_ca_tcp_connector_tracking.h"
@ -123,6 +122,10 @@
#include "flexiband_signal_source.h"
#endif
#if CUDA_GPU_ACCEL
#include "gps_l1_ca_dll_pll_tracking_gpu.h"
#endif
using google::LogMessage;

View File

@ -34,8 +34,9 @@ if(ENABLE_UHD)
endif(ENABLE_UHD)
if(ENABLE_CUDA)
FIND_PACKAGE(CUDA REQUIRED)
add_definitions(-DCUDA_GPU_ACCEL=1)
set(GNSS_SDR_OPTIONAL_LIBS ${GNSS_SDR_OPTIONAL_LIBS} ${CUDA_LIBRARIES})
set(GNSS_SDR_OPTIONAL_HEADERS ${GNSS_SDR_OPTIONAL_HEADERS} ${CUDA_INCLUDE_DIRS})
endif(ENABLE_CUDA)
@ -54,7 +55,7 @@ include_directories(
${GNURADIO_RUNTIME_INCLUDE_DIRS}
${GNSS_SDR_OPTIONAL_HEADERS}
${VOLK_GNSSSDR_INCLUDE_DIRS}
${CUDA_INCLUDE_DIRS}
${OPT_GNSSSDR_INCLUDE_DIRS}
)
add_definitions( -DGNSS_SDR_VERSION="${VERSION}" )
@ -86,7 +87,6 @@ target_link_libraries(gnss-sdr ${MAC_LIBRARIES}
${GNSS_SDR_OPTIONAL_LIBS}
gnss_sp_libs
gnss_rx
${CUDA_LIBRARIES}
)
@ -126,4 +126,4 @@ if(NOT GZIP_NOTFOUND)
install(FILES ${CMAKE_BINARY_DIR}/volk_gnsssdr_profile.1.gz DESTINATION share/man/man1)
endif(NOT VOLK_GNSSSDR_FOUND)
endif(NOT GZIP_NOTFOUND)
endif(NOT GZIP_NOTFOUND)