diff --git a/.github/workflows/volk_android.yml b/.github/workflows/volk_android.yml new file mode 100644 index 000000000..ebdf9fc9d --- /dev/null +++ b/.github/workflows/volk_android.yml @@ -0,0 +1,56 @@ +# SPDX-License-Identifier: GPL-3.0-or-later +# SPDX-FileCopyrightText: 2022 Carles Fernandez-Prades +on: + push: + paths: + - 'src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/**' + workflow_dispatch: + pull_request: + paths: + - 'src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/**' + workflow_dispatch: + +name: Build volk-gnssdr on Android NDK +jobs: + build: + name: Build on Android NDK ${{ matrix.arch.name }} + + strategy: + fail-fast: false + matrix: + arch: + - { name: armeabi-v7a, allow_fail: false } + - { name: arm64-v8a, allow_fail: false } + - { name: x86, allow_fail: false } + - { name: x86_64, allow_fail: false } + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3.0.0 + + - name: Update repositories + run: sudo apt update + + # All dependencies + - name: Install dependencies + run: sudo apt install -y cmake openjdk-11-jre-headless wget unzip make python3-mako + + # Setup Android SDK, and auto-accept licenses + - name: Install Android SDK + run: wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip && mkdir android-sdk-linux && unzip -qq android-sdk.zip -d android-sdk-linux && export ANDROID_HOME=./android-sdk-linux && echo y | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=android-sdk-linux --update && (echo y; echo y; echo y; echo y; echo y; echo y; echo y; echo y) | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=android-sdk-linux --licenses + + # Call SDKManager to install the Android NDK + - name: Install Android NDK + run: $GITHUB_WORKSPACE/android-sdk-linux/cmdline-tools/bin/sdkmanager --sdk_root=$GITHUB_WORKSPACE/android-sdk-linux --install "ndk;24.0.8215888" --channel=3 + + # Setup build directory + - name: Setup ${{ matrix.arch.name }} + shell: bash + run: cd $GITHUB_WORKSPACE/ && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/android-sdk-linux/ndk/24.0.8215888/build/cmake/android.toolchain.cmake -DANDROID_ABI=${{ matrix.arch.name }} -DANDROID_PLATFORM=android-24 ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr + + # Build + - name: Build ${{ matrix.arch.name }} + shell: bash + run: cd $GITHUB_WORKSPACE/build && make + continue-on-error: ${{ matrix.arch.allow_fail }} diff --git a/CMakeLists.txt b/CMakeLists.txt index d713872e7..0928912f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ endif() # Build type can still be overridden by setting -DCMAKE_BUILD_TYPE= set(CMAKE_BUILD_TYPE "Release" CACHE STRING "") -cmake_minimum_required(VERSION 2.8.12...3.23) +cmake_minimum_required(VERSION 2.8.12...3.24) project(gnss-sdr CXX C) set(GNSSSDR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) # Allows to be a sub-project @@ -348,7 +348,7 @@ set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master") set(GNSSSDR_GNSSTK_LOCAL_VERSION "13.4.0") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.23") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.12") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.4") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.5") set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.7.0") set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7") diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt index de55de80e..e40ea69e8 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt @@ -8,7 +8,7 @@ ######################################################################## # Project setup ######################################################################## -cmake_minimum_required(VERSION 2.8.12...3.23) +cmake_minimum_required(VERSION 2.8.12...3.24) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() @@ -209,7 +209,7 @@ message(STATUS "Build type set to ${CMAKE_BUILD_TYPE}.") set(VERSION_INFO_MAJOR_VERSION 0) set(VERSION_INFO_MINOR_VERSION 0) -set(VERSION_INFO_MAINT_VERSION 17) +set(VERSION_INFO_MAINT_VERSION 17.git) include(VolkGnsssdrVersion) # setup version info @@ -362,16 +362,7 @@ endif() ######################################################################## find_package(Doxygen) if(DOXYGEN_FOUND) - configure_file( - ${PROJECT_SOURCE_DIR}/Doxyfile.in - ${PROJECT_BINARY_DIR}/Doxyfile - @ONLY - ) - add_custom_target(doc - ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile - WORKING_DIRECTORY ${PROJECT_BINARY_DIR} - COMMENT "Generating documentation with Doxygen" VERBATIM - ) + add_subdirectory(docs) endif() @@ -396,13 +387,13 @@ set(libdir "\${exec_prefix}/lib${LIB_SUFFIX}") set(includedir "\${prefix}/include") configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/volk_gnsssdr.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr.pc + ${PROJECT_SOURCE_DIR}/tmpl/volk_gnsssdr.pc.in + ${PROJECT_BINARY_DIR}/volk_gnsssdr.pc @ONLY ) install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr.pc + FILES ${PROJECT_BINARY_DIR}/volk_gnsssdr.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig COMPONENT "volk_gnsssdr_devel" ) @@ -471,14 +462,14 @@ endif() ######################################################################## configure_file( ${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake + ${PROJECT_BINARY_DIR}/cmake_uninstall.cmake @ONLY ) # Only add the target if there isn't one defined already if(NOT TARGET uninstall) add_custom_target(uninstall - ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake + ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/cmake_uninstall.cmake ) endif() @@ -513,8 +504,8 @@ endif() install( FILES - ${CMAKE_CURRENT_BINARY_DIR}/cmake/Modules/VolkGnsssdrConfig.cmake - ${CMAKE_CURRENT_BINARY_DIR}/cmake/Modules/VolkGnsssdrConfigVersion.cmake + ${PROJECT_BINARY_DIR}/cmake/Modules/VolkGnsssdrConfig.cmake + ${PROJECT_BINARY_DIR}/cmake/Modules/VolkGnsssdrConfigVersion.cmake DESTINATION ${CMAKE_MODULES_DIR}/volk_gnsssdr COMPONENT "volk_gnsssdr_devel" ) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/docs/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/docs/CMakeLists.txt new file mode 100644 index 000000000..6ef45ece5 --- /dev/null +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/docs/CMakeLists.txt @@ -0,0 +1,17 @@ +# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +# This file is part of GNSS-SDR. +# +# SPDX-FileCopyrightText: 2022 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-License-Identifier: BSD-3-Clause + +message(STATUS "Doxygen in docs |${DOXYGEN_FOUND}|") +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in + ${CMAKE_BINARY_DIR}/Doxyfile +@ONLY) + +add_custom_target(volk_gnsssdr_doc + ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Generating documentation with Doxygen" VERBATIM +) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/Doxyfile.in b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/docs/Doxyfile.in similarity index 99% rename from src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/Doxyfile.in rename to src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/docs/Doxyfile.in index 24696f8d0..85866c7eb 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/Doxyfile.in +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/docs/Doxyfile.in @@ -776,7 +776,7 @@ FILE_VERSION_FILTER = # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE # tag is left empty. -LAYOUT_FILE = @PROJECT_SOURCE_DIR@/DoxygenLayout.xml +LAYOUT_FILE = @PROJECT_SOURCE_DIR@/docs/DoxygenLayout.xml # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/DoxygenLayout.xml b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/docs/DoxygenLayout.xml similarity index 100% rename from src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/DoxygenLayout.xml rename to src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/docs/DoxygenLayout.xml diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/include/volk_gnsssdr/volk_gnsssdr_alloc.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/include/volk_gnsssdr/volk_gnsssdr_alloc.h index 5f468f3ea..7e670d90a 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/include/volk_gnsssdr/volk_gnsssdr_alloc.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/include/volk_gnsssdr/volk_gnsssdr_alloc.h @@ -2,7 +2,7 @@ * \file volk_gnsssdr_alloc.h * \author Carles Fernandez, 2019. cfernandez(at)cttc.es * \brief C++11 allocator using volk_gnsssdr_malloc and volk_gnsssdr_free. - * Based on https://github.com/gnuradio/volk/pull/284/ by @hcab14 + * Based on https://github.com/gnuradio/volk/pull/284/ by hcab14 * * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn.h index 0af2194e2..ed6bb85de 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn.h @@ -72,7 +72,7 @@ static inline void volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn_g lv_32fc_t phase_doppler = (*phase); int n_vec; unsigned int n; -#if _WIN32 +#if _WIN32 || __ANDROID_API__ const float arga = cargf(phase_inc_rate); #endif for (n_vec = 0; n_vec < num_a_vectors; n_vec++) @@ -92,7 +92,7 @@ static inline void volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn_g } tmp32_1 = *in_common++ * (*phase); phase_doppler *= phase_inc; -#if _WIN32 +#if _WIN32 || __ANDROID_API__ const float theta = (float)(n * n) * arga; phase_doppler_rate = lv_cmake(cosf(theta), sinf(theta)); #else diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt index 035c8038f..3e3b709f1 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt @@ -482,6 +482,7 @@ message(STATUS "Loading version ${VERSION} into constants...") # double escape for windows backslash path separators string(REPLACE "\\" "\\\\" prefix "${prefix}") +string(REPLACE "${CMAKE_SOURCE_DIR}" "$BUILD_DIR" COMPILER_INFO "${COMPILER_INFO}") configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/constants.c.in @@ -638,7 +639,9 @@ if(ENABLE_STATIC_LIBS) if(ORC_FOUND) target_link_libraries(volk_gnsssdr_static PUBLIC ${ORC_LIBRARIES_STATIC}) endif() - target_link_libraries(volk_gnsssdr_static PRIVATE pthread) + if(NOT ANDROID) + target_link_libraries(volk_gnsssdr_static PRIVATE pthread) + endif() if(NOT MSVC) target_link_libraries(volk_gnsssdr_static PUBLIC m) endif() diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/volk_gnsssdr.pc.in b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/tmpl/volk_gnsssdr.pc.in similarity index 100% rename from src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/volk_gnsssdr.pc.in rename to src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/tmpl/volk_gnsssdr.pc.in