From c885105a87d60742e644fd6c5079dc2cdbfa1ceb Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 2 Jun 2019 23:28:37 +0200 Subject: [PATCH] Build: Linux: added libbladeRF external library --- devices/bladerf1/CMakeLists.txt | 4 +++ devices/bladerf2/CMakeLists.txt | 4 +++ external/CMakeLists.txt | 31 ++++++++++++------- .../samplesink/bladerf1output/CMakeLists.txt | 4 +++ .../samplesink/bladerf2output/CMakeLists.txt | 4 +++ .../samplesource/bladerf1input/CMakeLists.txt | 4 +++ .../samplesource/bladerf2input/CMakeLists.txt | 4 +++ 7 files changed, 44 insertions(+), 11 deletions(-) diff --git a/devices/bladerf1/CMakeLists.txt b/devices/bladerf1/CMakeLists.txt index 06039c412..989c5c4d7 100644 --- a/devices/bladerf1/CMakeLists.txt +++ b/devices/bladerf1/CMakeLists.txt @@ -21,6 +21,10 @@ add_library(bladerf1device SHARED ${bladerf1device_SOURCES} ) +if(ENABLE_EXTERNAL_LIBRARIES) + add_dependencies(bladerf1device bladerf) +endif() + set_target_properties(bladerf1device PROPERTIES DEFINE_SYMBOL "devices_EXPORTS") diff --git a/devices/bladerf2/CMakeLists.txt b/devices/bladerf2/CMakeLists.txt index 2c35973ed..1f5930e45 100644 --- a/devices/bladerf2/CMakeLists.txt +++ b/devices/bladerf2/CMakeLists.txt @@ -18,6 +18,10 @@ add_library(bladerf2device SHARED ${bladerf2device_SOURCES} ) +if(ENABLE_EXTERNAL_LIBRARIES) + add_dependencies(bladerf2device bladerf) +endif() + set_target_properties(bladerf2device PROPERTIES DEFINE_SYMBOL "devices_EXPORTS") diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index bcb3d0f6d..4f7e7de08 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -14,6 +14,7 @@ set(MBELIB_TAG "debian/1.3.0") set(SERIALDV_TAG abd65a0fc2d5339808194862d14119b0cba70424) set(DSDCC_TAG 952fb5f5f7bf1928a290ad62acce35492df13f5d) set(LIMESUITE_TAG "v19.01.0") +set(BLADERF_TAG 896d2431b3a35a4b31b6e729386202ebf5fdc5c0) # For some external project macros @@ -181,9 +182,10 @@ else() set(LIBDSDCC_LIBRARIES "${binary_dir}/libdsdcc${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "") endif() +# Device interface libraries. Use external libraries build for these. Only Linux for now. if (LINUX) - # apt install liblimesuite-dev (only on ubuntu 18.04). Can be picky on version though so let's build it. Linux only for now. - # needs pkgconfig, libusb and sqlite3 + # apt install liblimesuite-dev (only on ubuntu 18.04). Can be picky on version though so let's build it. + # needs pkgconfig and libusb ExternalProject_Add(limesuite GIT_REPOSITORY https://github.com/myriadrf/LimeSuite.git GIT_TAG ${LIMESUITE_TAG} @@ -195,6 +197,22 @@ if (LINUX) set(LIMESUITE_FOUND ON CACHE INTERNAL "") set(LIMESUITE_INCLUDE_DIR "${EXTERNAL_BUILD_LIBRARIES}/limesuite/src/limesuite/src" CACHE INTERNAL "") set(LIMESUITE_LIBRARY "${EXTERNAL_BUILD_LIBRARIES}/lib/libLimeSuite.so" CACHE INTERNAL "") + + # apt install libbladerf-dev + # needs pkgconfig and libusb + ExternalProject_Add(bladerf + GIT_REPOSITORY https://github.com/Nuand/bladeRF.git + GIT_TAG ${BLADERF_TAG} + GIT_SUBMODULES + PREFIX "${EXTERNAL_BUILD_LIBRARIES}/bladerf" + CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORY} + SOURCE_SUBDIR host/ + INSTALL_COMMAND "" + TEST_COMMAND "" + ) + set(LIBBLADERF_FOUND ON CACHE INTERNAL "") + set(LIBBLADERF_INCLUDE_DIRS "${EXTERNAL_BUILD_LIBRARIES}/bladerf/src/bladerf/host/libraries/libbladeRF/include" CACHE INTERNAL "") + set(LIBBLADERF_LIBRARIES "${EXTERNAL_BUILD_LIBRARIES}/lib/libbladeRF.so" CACHE INTERNAL "") endif() # already on the respository @@ -249,15 +267,6 @@ ExternalProject_Add(rtlsdr PREFIX "${EXTERNAL_BUILD_LIBRARIES}/rtlsdr" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES} ) -# apt install libbladerf-dev -# needs pkgconfig and libusb -ExternalProject_Add(bladerf - GIT_REPOSITORY https://github.com/Nuand/bladeRF.git - GIT_TAG 1da130cb5ac9e9f722737e9aee141ecccebef00d - GIT_SUBMODULES - PREFIX "${EXTERNAL_BUILD_LIBRARIES}/bladerf" - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES} -) # apt install libmirisdr-dev # needs pkgconfig and libusb ExternalProject_Add(mirisdr diff --git a/plugins/samplesink/bladerf1output/CMakeLists.txt b/plugins/samplesink/bladerf1output/CMakeLists.txt index eecebcc13..651970748 100644 --- a/plugins/samplesink/bladerf1output/CMakeLists.txt +++ b/plugins/samplesink/bladerf1output/CMakeLists.txt @@ -47,6 +47,10 @@ add_library(${TARGET_NAME} SHARED ${bladerf1output_SOURCES} ) +if(ENABLE_EXTERNAL_LIBRARIES) + add_dependencies(${TARGET_NAME} bladerf) +endif() + target_link_libraries(${TARGET_NAME} Qt5::Core ${TARGET_LIB} diff --git a/plugins/samplesink/bladerf2output/CMakeLists.txt b/plugins/samplesink/bladerf2output/CMakeLists.txt index fb2e74156..79a5cd98a 100644 --- a/plugins/samplesink/bladerf2output/CMakeLists.txt +++ b/plugins/samplesink/bladerf2output/CMakeLists.txt @@ -47,6 +47,10 @@ add_library(${TARGET_NAME} SHARED ${bladerf2output_SOURCES} ) +if(ENABLE_EXTERNAL_LIBRARIES) + add_dependencies(${TARGET_NAME} bladerf) +endif() + target_link_libraries(${TARGET_NAME} Qt5::Core ${TARGET_LIB} diff --git a/plugins/samplesource/bladerf1input/CMakeLists.txt b/plugins/samplesource/bladerf1input/CMakeLists.txt index 85e68acd1..445a9e7ba 100644 --- a/plugins/samplesource/bladerf1input/CMakeLists.txt +++ b/plugins/samplesource/bladerf1input/CMakeLists.txt @@ -47,6 +47,10 @@ add_library(${TARGET_NAME} SHARED ${bladerf1input_SOURCES} ) +if(ENABLE_EXTERNAL_LIBRARIES) + add_dependencies(${TARGET_NAME} bladerf) +endif() + target_link_libraries(${TARGET_NAME} Qt5::Core ${TARGET_LIB} diff --git a/plugins/samplesource/bladerf2input/CMakeLists.txt b/plugins/samplesource/bladerf2input/CMakeLists.txt index e522c2936..05ee4738e 100644 --- a/plugins/samplesource/bladerf2input/CMakeLists.txt +++ b/plugins/samplesource/bladerf2input/CMakeLists.txt @@ -47,6 +47,10 @@ add_library(${TARGET_NAME} SHARED ${bladerf2input_SOURCES} ) +if(ENABLE_EXTERNAL_LIBRARIES) + add_dependencies(${TARGET_NAME} bladerf) +endif() + target_link_libraries(${TARGET_NAME} Qt5::Core ${TARGET_LIB}