From 72b895fc677af4e47cc31b5ee23f82d49f044c3f Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Fri, 2 Sep 2022 20:08:16 +0200 Subject: [PATCH] android fixes --- android/app/build.gradle | 4 ++-- core/CMakeLists.txt | 12 +++++------- source_modules/airspy_source/CMakeLists.txt | 7 +++---- source_modules/airspy_source/src/main.cpp | 2 +- source_modules/airspyhf_source/CMakeLists.txt | 7 +++---- source_modules/airspyhf_source/src/main.cpp | 2 +- source_modules/hackrf_source/CMakeLists.txt | 7 +++---- source_modules/hackrf_source/src/main.cpp | 2 +- source_modules/rtl_sdr_source/CMakeLists.txt | 9 ++------- source_modules/rtl_sdr_source/src/main.cpp | 2 +- 10 files changed, 22 insertions(+), 32 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 5c167eee..288d8a42 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'kotlin-android' android { compileSdkVersion 28 buildToolsVersion "30.0.3" - ndkVersion "23.0.7599858" + ndkVersion "25.1.8937393" defaultConfig { applicationId "org.sdrpp.sdrpp" minSdkVersion 28 @@ -14,7 +14,7 @@ android { externalNativeBuild { cmake { - arguments "-DOPT_BACKEND_GLFW=OFF", "-DOPT_BACKEND_ANDROID=ON", "-DOPT_BUILD_SOAPY_SOURCE=OFF", "-DOPT_BUILD_ANDROID_AUDIO_SINK=ON", "-DOPT_BUILD_AUDIO_SINK=OFF", "-DOPT_BUILD_DISCORD_PRESENCE=OFF", "-DOPT_BUILD_M17_DECODER=ON" + arguments "-DOPT_BACKEND_GLFW=OFF", "-DOPT_BACKEND_ANDROID=ON", "-DOPT_BUILD_SOAPY_SOURCE=OFF", "-DOPT_BUILD_ANDROID_AUDIO_SINK=ON", "-DOPT_BUILD_AUDIO_SINK=OFF", "-DOPT_BUILD_DISCORD_PRESENCE=OFF", "-DOPT_BUILD_M17_DECODER=OFF", "-DOPT_BUILD_PLUTOSDR_SOURCE=OFF" } } } diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 675cdee8..8b289ecf 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -108,17 +108,15 @@ if (MSVC) target_link_libraries(sdrpp_core PUBLIC zstd::libzstd_shared) elseif (ANDROID) target_include_directories(sdrpp_core PUBLIC - ../android/deps/volk/jni - ../android/deps/fftw3/jni - /mnt/android_sdr/zstd/lib + /sdr-kit/${ANDROID_ABI}/include ${ANDROID_NDK}/sources/android/native_app_glue ) target_link_libraries(sdrpp_core PUBLIC - ${PROJECT_SOURCE_DIR}/../android/deps/volk/${ANDROID_ABI}/libcpu_features.a - ${PROJECT_SOURCE_DIR}/../android/deps/volk/${ANDROID_ABI}/libvolk.so - ${PROJECT_SOURCE_DIR}/../android/deps/fftw3/${ANDROID_ABI}/libfftw3f.a - /mnt/android_sdr/output/zstd/${ANDROID_ABI}/libzstd.so + /sdr-kit/${ANDROID_ABI}/lib/libcpu_features.a + /sdr-kit/${ANDROID_ABI}/lib/libvolk.so + /sdr-kit/${ANDROID_ABI}/lib/libfftw3f.so + /sdr-kit/${ANDROID_ABI}/lib/libzstd.so android EGL GLESv3 diff --git a/source_modules/airspy_source/CMakeLists.txt b/source_modules/airspy_source/CMakeLists.txt index b206da92..3b818ae6 100644 --- a/source_modules/airspy_source/CMakeLists.txt +++ b/source_modules/airspy_source/CMakeLists.txt @@ -26,13 +26,12 @@ if (MSVC) target_link_libraries(airspy_source PRIVATE airspy) elseif (ANDROID) target_include_directories(airspy_source PUBLIC - /mnt/android_sdr/libusb/libusb - /mnt/android_sdr/airspyone_host/libairspy/src + /sdr-kit/${ANDROID_ABI}/include/libairspy ) target_link_libraries(airspy_source PUBLIC - /mnt/android_sdr/output/libusb/${ANDROID_ABI}/libusb1.0.so - /mnt/android_sdr/output/libairspy/${ANDROID_ABI}/libairspy.so + /sdr-kit/${ANDROID_ABI}/lib/libusb1.0.so + /sdr-kit/${ANDROID_ABI}/lib/libairspy.so ) else (MSVC) find_package(PkgConfig) diff --git a/source_modules/airspy_source/src/main.cpp b/source_modules/airspy_source/src/main.cpp index db359fd5..f318cc04 100644 --- a/source_modules/airspy_source/src/main.cpp +++ b/source_modules/airspy_source/src/main.cpp @@ -131,7 +131,7 @@ public: #ifndef __ANDROID__ int err = airspy_open_sn(&dev, serial); #else - int err = airspy_open_sn(&dev, devFd); + int err = airspy_open_fd(&dev, devFd); #endif if (err != 0) { char buf[1024]; diff --git a/source_modules/airspyhf_source/CMakeLists.txt b/source_modules/airspyhf_source/CMakeLists.txt index 03446ad9..6490b65d 100644 --- a/source_modules/airspyhf_source/CMakeLists.txt +++ b/source_modules/airspyhf_source/CMakeLists.txt @@ -26,13 +26,12 @@ if (MSVC) target_link_libraries(airspyhf_source PRIVATE airspyhf) elseif (ANDROID) target_include_directories(airspyhf_source PUBLIC - /mnt/android_sdr/libusb/libusb - /mnt/android_sdr/airspyhf/libairspyhf/src + /sdr-kit/${ANDROID_ABI}/include/libairspyhf ) target_link_libraries(airspyhf_source PUBLIC - /mnt/android_sdr/output/libusb/${ANDROID_ABI}/libusb1.0.so - /mnt/android_sdr/output/libairspyhf/${ANDROID_ABI}/libairspyhf.so + /sdr-kit/${ANDROID_ABI}/lib/libusb1.0.so + /sdr-kit/${ANDROID_ABI}/lib/libairspyhf.so ) else (MSVC) find_package(PkgConfig) diff --git a/source_modules/airspyhf_source/src/main.cpp b/source_modules/airspyhf_source/src/main.cpp index e5da7810..6a218925 100644 --- a/source_modules/airspyhf_source/src/main.cpp +++ b/source_modules/airspyhf_source/src/main.cpp @@ -132,7 +132,7 @@ public: #ifndef __ANDROID__ int err = airspyhf_open_sn(&dev, serial); #else - int err = airspyhf_open_sn(&dev, devFd); + int err = airspyhf_open_fd(&dev, devFd); #endif if (err != 0) { char buf[1024]; diff --git a/source_modules/hackrf_source/CMakeLists.txt b/source_modules/hackrf_source/CMakeLists.txt index 6b69c751..c3b1a247 100644 --- a/source_modules/hackrf_source/CMakeLists.txt +++ b/source_modules/hackrf_source/CMakeLists.txt @@ -24,13 +24,12 @@ if (MSVC) target_link_libraries(hackrf_source PRIVATE hackrf) elseif (ANDROID) target_include_directories(hackrf_source PUBLIC - /mnt/android_sdr/libusb/libusb - /mnt/android_sdr/hackrf/host/libhackrf/src + /sdr-kit/${ANDROID_ABI}/include/libhackrf ) target_link_libraries(hackrf_source PUBLIC - /mnt/android_sdr/output/libusb/${ANDROID_ABI}/libusb1.0.so - /mnt/android_sdr/output/libhackrf/${ANDROID_ABI}/libhackrf.so + /sdr-kit/${ANDROID_ABI}/lib/libusb1.0.so + /sdr-kit/${ANDROID_ABI}/lib/libhackrf.so ) else (MSVC) find_package(PkgConfig) diff --git a/source_modules/hackrf_source/src/main.cpp b/source_modules/hackrf_source/src/main.cpp index c236152d..d5947e1b 100644 --- a/source_modules/hackrf_source/src/main.cpp +++ b/source_modules/hackrf_source/src/main.cpp @@ -248,7 +248,7 @@ private: #ifndef __ANDROID__ hackrf_error err = (hackrf_error)hackrf_open_by_serial(_this->selectedSerial.c_str(), &_this->openDev); #else - hackrf_error err = (hackrf_error)hackrf_open_by_fd(&_this->openDev, _this->devFd); + hackrf_error err = (hackrf_error)hackrf_open_by_fd(_this->devFd, &_this->openDev); #endif if (err != HACKRF_SUCCESS) { spdlog::error("Could not open HackRF {0}: {1}", _this->selectedSerial, hackrf_error_name(err)); diff --git a/source_modules/rtl_sdr_source/CMakeLists.txt b/source_modules/rtl_sdr_source/CMakeLists.txt index 3df82b21..d8ce757f 100644 --- a/source_modules/rtl_sdr_source/CMakeLists.txt +++ b/source_modules/rtl_sdr_source/CMakeLists.txt @@ -23,14 +23,9 @@ if (MSVC) target_link_libraries(rtl_sdr_source PRIVATE rtlsdr) elseif (ANDROID) - target_include_directories(rtl_sdr_source PUBLIC - /mnt/android_sdr/libusb/libusb - /mnt/android_sdr/librtlsdr/include - ) - target_link_libraries(rtl_sdr_source PUBLIC - /mnt/android_sdr/output/libusb/${ANDROID_ABI}/libusb1.0.so - /mnt/android_sdr/output/librtlsdr/${ANDROID_ABI}/librtlsdr.so + /sdr-kit/${ANDROID_ABI}/lib/libusb1.0.so + /sdr-kit/${ANDROID_ABI}/lib/librtlsdr.so ) else (MSVC) find_package(PkgConfig) diff --git a/source_modules/rtl_sdr_source/src/main.cpp b/source_modules/rtl_sdr_source/src/main.cpp index 172cb3c6..e8e122cb 100644 --- a/source_modules/rtl_sdr_source/src/main.cpp +++ b/source_modules/rtl_sdr_source/src/main.cpp @@ -285,7 +285,7 @@ private: #ifndef __ANDROID__ int oret = rtlsdr_open(&_this->openDev, _this->devId); #else - int oret = rtlsdr_open(&_this->openDev, _this->devFd); + int oret = rtlsdr_open_fd(&_this->openDev, _this->devFd); #endif if (oret < 0) {