1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-11-13 21:57:14 +00:00

Add more imported targets to CMake scripts

This commit is contained in:
Carles Fernandez
2019-02-04 16:07:29 +01:00
parent 4f440f63dc
commit 9b94a4dec0
21 changed files with 207 additions and 116 deletions

View File

@@ -24,9 +24,6 @@ if(ENABLE_RAW_UDP)
if(NOT PCAP_FOUND)
message(FATAL_ERROR "PCAP required to compile custom UDP packet sample source (ENABLE_RAW_UDP)")
endif()
get_filename_component(PCAP_LIBRARY_DIRS ${PCAP_LIBRARY} DIRECTORY CACHE)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${PCAP_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${PCAP_INCLUDE_DIRS})
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} custom_udp_signal_source.cc)
set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} custom_udp_signal_source.h)
endif()
@@ -41,8 +38,6 @@ if(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2)
message(STATUS " * gnuradio-iio from https://github.com/analogdevicesinc/gr-iio")
message(FATAL_ERROR "gnuradio-iio is required for building gnss-sdr with this option enabled.")
endif()
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${IIO_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${IIO_INCLUDE_DIRS})
endif()
if(ENABLE_AD9361)
@@ -55,8 +50,6 @@ if(ENABLE_AD9361)
message(STATUS " * gnuradio-iio from https://github.com/analogdevicesinc/gr-iio")
message(FATAL_ERROR "libiio is required for building gnss-sdr with this option enabled.")
endif()
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${LIBIIO_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${LIBIIO_INCLUDE_DIRS})
endif()
@@ -154,15 +147,8 @@ if(ENABLE_OSMOSDR)
list(REMOVE_ITEM SIGNAL_SOURCE_ADAPTER_HEADERS ${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/adapters/osmosdr_signal_source.h)
endif()
else()
# set OSMO include dirs
set(OSMO_DRIVER_INCLUDE_DIRS
${OPT_DRIVER_INCLUDE_DIRS}
${GROSMOSDR_INCLUDE_DIR}/osmosdr
)
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} osmosdr_signal_source.cc)
set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} osmosdr_signal_source.h)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${GROSMOSDR_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${OSMO_DRIVER_INCLUDE_DIRS})
endif()
endif()
@@ -170,8 +156,6 @@ endif()
if(ENABLE_UHD AND GNURADIO_UHD_LIBRARIES_gnuradio-uhd)
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} uhd_signal_source.cc)
set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} uhd_signal_source.h)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${UHD_LIBRARIES} ${GNURADIO_UHD_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${UHD_INCLUDE_DIRS})
endif()
@@ -206,14 +190,13 @@ if(PC_GNURADIO_RUNTIME_VERSION VERSION_GREATER 3.7.3)
two_bit_packed_file_signal_source.h)
endif()
add_definitions(-DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}")
list(SORT SIGNAL_SOURCE_ADAPTER_HEADERS)
list(SORT SIGNAL_SOURCE_ADAPTER_SOURCES)
add_library(signal_source_adapters ${SIGNAL_SOURCE_ADAPTER_SOURCES} ${SIGNAL_SOURCE_ADAPTER_HEADERS})
source_group(Headers FILES ${SIGNAL_SOURCE_ADAPTER_HEADERS})
add_library(signal_source_adapters ${SIGNAL_SOURCE_ADAPTER_SOURCES} ${SIGNAL_SOURCE_ADAPTER_HEADERS})
target_include_directories(signal_source_adapters PUBLIC ${CMAKE_SOURCE_DIR}/src/algorithms/libs)
target_link_libraries(signal_source_adapters
@@ -232,6 +215,38 @@ target_link_libraries(signal_source_adapters
Volk::volk
)
if(ENABLE_UHD AND GNURADIO_UHD_LIBRARIES_gnuradio-uhd)
target_link_libraries(signal_source_adapters
PUBLIC
Gnuradio::uhd
PRIVATE
Uhd::uhd
)
endif()
if(ENABLE_OSMOSDR AND GROSMOSDR_FOUND)
target_link_libraries(signal_source_adapters
PUBLIC
Gnuradio::osmosdr
PRIVATE
Osmosdr::osmosdr
)
endif()
if(ENABLE_AD9361 AND LIBIIO_FOUND)
target_link_libraries(signal_source_adapters
PRIVATE
Osmosdr::osmosdr
)
endif()
if(ENABLE_RAW_UDP AND PCAP_FOUND)
target_link_libraries(signal_source_adapters
PRIVATE
Pcap::pcap
)
endif()
target_compile_definitions(signal_source_adapters PRIVATE -DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}")
set_property(TARGET signal_source_adapters APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES

View File

@@ -1,4 +1,4 @@
# Copyright (C) 2012-2018 (see AUTHORS file for a list of contributors)
# Copyright (C) 2012-2019 (see AUTHORS file for a list of contributors)
#
# This file is part of GNSS-SDR.
#
@@ -22,9 +22,6 @@ if(ENABLE_RAW_UDP)
if(NOT PCAP_FOUND)
message(FATAL_ERROR "PCAP required to compile custom UDP packet sample source")
endif()
get_filename_component(PCAP_LIBRARY_DIRS ${PCAP_LIBRARY} DIRECTORY CACHE)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${PCAP_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${PCAP_INCLUDE_DIRS})
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} gr_complex_ip_packet_source.cc)
set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} gr_complex_ip_packet_source.h)
endif()
@@ -55,11 +52,6 @@ set(SIGNAL_SOURCE_GR_BLOCKS_HEADERS
${OPT_DRIVER_HEADERS}
)
include_directories(
${OPT_DRIVER_INCLUDE_DIRS}
)
list(SORT SIGNAL_SOURCE_GR_BLOCKS_HEADERS)
list(SORT SIGNAL_SOURCE_GR_BLOCKS_SOURCES)
@@ -75,15 +67,18 @@ target_link_libraries(signal_source_gr_blocks
signal_source_lib
Gnuradio::runtime
Boost::thread
${OPT_LIBRARIES}
PRIVATE
Gflags::gflags
Glog::glog
)
target_include_directories(signal_source_gr_blocks PUBLIC ${OPT_DRIVER_INCLUDE_DIRS})
if(ENABLE_RAW_UDP AND PCAP_FOUND)
target_link_libraries(signal_source_gr_blocks
PUBLIC
Pcap::pcap
)
endif()
set_property(TARGET signal_source_gr_blocks APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${OPT_DRIVER_INCLUDE_DIRS}>
)

View File

@@ -26,27 +26,18 @@ if(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2)
message(STATUS " * gnuradio-iio from https://github.com/analogdevicesinc/gr-iio")
message(FATAL_ERROR "gnuradio-iio is required for building gnss-sdr with this option enabled")
endif()
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${IIO_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${IIO_INCLUDE_DIRS})
endif()
if(ENABLE_FMCOMMS2 OR ENABLE_AD9361)
find_package(LIBIIO REQUIRED)
if(NOT LIBIIO_FOUND)
message(STATUS "libiio not found, its installation is required.")
message(STATUS "Please build and install the following projects:")
message(STATUS " * libiio from https://github.com/analogdevicesinc/libiio")
message(STATUS " * libad9361-iio from https://github.com/analogdevicesinc/libad9361-iio")
message(STATUS " * gnuradio-iio from https://github.com/analogdevicesinc/gr-iio")
message(FATAL_ERROR "libiio is required for building gnss-sdr with this option enabled")
endif()
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${LIBIIO_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${LIBIIO_INCLUDE_DIRS})
###############################################
# FMCOMMS2 based SDR Hardware
###############################################
if(LIBIIO_FOUND)
if(NOT LIBIIO_FOUND)
message(STATUS "libiio not found, its installation is required.")
message(STATUS "Please build and install the following projects:")
message(STATUS " * libiio from https://github.com/analogdevicesinc/libiio")
message(STATUS " * libad9361-iio from https://github.com/analogdevicesinc/libad9361-iio")
message(STATUS " * gnuradio-iio from https://github.com/analogdevicesinc/gr-iio")
message(FATAL_ERROR "libiio is required for building gnss-sdr with this option enabled")
else()
set(OPT_SIGNAL_SOURCE_LIB_SOURCES ad9361_manager.cc)
set(OPT_SIGNAL_SOURCE_LIB_HEADERS ad9361_manager.h)
endif()
@@ -79,14 +70,26 @@ source_group(Headers FILES ${SIGNAL_SOURCE_LIB_HEADERS})
target_link_libraries(signal_source_lib
PUBLIC
Boost::boost
${OPT_LIBRARIES}
PRIVATE
Glog::glog
)
target_include_directories(signal_source_lib PUBLIC ${OPT_DRIVER_INCLUDE_DIRS})
if(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2)
target_link_libraries(signal_source_lib
PUBLIC
Gnuradio::iio
PRIVATE
Iio::iio
)
endif()
if(ENABLE_FMCOMMS2 OR ENABLE_AD9361)
target_link_libraries(signal_source_lib
PUBLIC
Iio::iio
)
endif()
set_property(TARGET signal_source_lib APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${OPT_DRIVER_INCLUDE_DIRS}>
)