diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 24c340930..6462666b8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -83,6 +83,18 @@ jobs: run: find . -iname "*.md" | xargs prettier --parser markdown --print-width 80 --prose-wrap always --list-different + cmakelint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: install dependencies + run: | + sudo python -m pip install --upgrade pip + sudo pip install cmakelint + - name: check CMake scripts + run: find . -iname "CMakeLists.txt" -o -iname "*.cmake" | xargs cmakelint --filter=-linelength,-readability/wonkycase + + volk-gnsssdr-windows: runs-on: windows-latest steps: diff --git a/CMakeLists.txt b/CMakeLists.txt index 21ed8d540..14016b365 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -925,7 +925,7 @@ if(NOT VOLKGNSSSDR_FOUND) SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr_module/build CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS} - -DCMAKE_BUILD_TYPE=$<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:ASAN> + -DCMAKE_BUILD_TYPE=$<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:ASAN> DOWNLOAD_COMMAND "" UPDATE_COMMAND "" PATCH_COMMAND "" diff --git a/cmake/Modules/FindFILESYSTEM.cmake b/cmake/Modules/FindFILESYSTEM.cmake index 277bed3b9..acda31f88 100644 --- a/cmake/Modules/FindFILESYSTEM.cmake +++ b/cmake/Modules/FindFILESYSTEM.cmake @@ -255,6 +255,9 @@ cmake_pop_check_state() set(FILESYSTEM_FOUND ${_found} CACHE BOOL "TRUE if we can compile and link a program using std::filesystem" FORCE) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(FILESYSTEM DEFAULT_MSG FILESYSTEM_FOUND) + if(FILESYSTEM_FIND_REQUIRED AND NOT FILESYSTEM_FOUND) message(FATAL_ERROR "Cannot compile a simple program using std::filesystem") endif() diff --git a/cmake/Modules/FindGNURADIO.cmake b/cmake/Modules/FindGNURADIO.cmake index 0ea74ec66..6957858df 100644 --- a/cmake/Modules/FindGNURADIO.cmake +++ b/cmake/Modules/FindGNURADIO.cmake @@ -13,6 +13,7 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +include(FindPackageHandleStandardArgs) # if GR_REQUIRED_COMPONENTS is not defined, it will be set to the following list if(NOT GR_REQUIRED_COMPONENTS) @@ -236,10 +237,6 @@ if(NOT PC_GNURADIO_RUNTIME_VERSION) endif() endif() -# Trick for feature_summary -if(NOT DEFINED GNURADIO_FOUND) - set(GNURADIO_FOUND TRUE) -endif() set(GNURADIO_VERSION ${PC_GNURADIO_RUNTIME_VERSION}) if(NOT GNSSSDR_GNURADIO_MIN_VERSION) @@ -271,6 +268,7 @@ else() ) endif() +find_package_handle_standard_args(GNURADIO DEFAULT_MSG GNURADIO_RUNTIME_FOUND) # Search for IIO component if(GNURADIO_VERSION VERSION_GREATER 3.8.99) @@ -328,7 +326,7 @@ if(GNURADIO_VERSION VERSION_GREATER 3.8.99) message(STATUS " * LIBS=${GNURADIO_IIO_LIBRARIES}") endif() if(GNURADIO_IIO_LIBRARIES AND GNURADIO_IIO_INCLUDE_DIRS) - set(GNURADIO_IIO_FOUND TRUE) + set(GNURADIO_IIO_FOUND TRUE) endif() if(GNURADIO_IIO_FOUND) message(STATUS "GNURADIO_IIO_FOUND = ${GNURADIO_IIO_FOUND}") diff --git a/cmake/Modules/FindLOG4CPP.cmake b/cmake/Modules/FindLOG4CPP.cmake index 7fca44e07..ffa2c5f4e 100644 --- a/cmake/Modules/FindLOG4CPP.cmake +++ b/cmake/Modules/FindLOG4CPP.cmake @@ -142,14 +142,14 @@ else() ) endif() -if (LOG4CPP_FOUND AND NOT TARGET Log4cpp::log4cpp) - add_library(Log4cpp::log4cpp SHARED IMPORTED) - set_target_properties(Log4cpp::log4cpp PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${LOG4CPP_LIBRARIES}" - INTERFACE_INCLUDE_DIRECTORIES "${LOG4CPP_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "${LOG4CPP_LIBRARIES}" - ) +if(LOG4CPP_FOUND AND NOT TARGET Log4cpp::log4cpp) + add_library(Log4cpp::log4cpp SHARED IMPORTED) + set_target_properties(Log4cpp::log4cpp PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${LOG4CPP_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${LOG4CPP_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${LOG4CPP_LIBRARIES}" + ) endif() mark_as_advanced(LOG4CPP_LIBRARIES LOG4CPP_INCLUDE_DIRS) diff --git a/cmake/Modules/FindOPENCL.cmake b/cmake/Modules/FindOPENCL.cmake index 8c567fbbd..962616c1b 100644 --- a/cmake/Modules/FindOPENCL.cmake +++ b/cmake/Modules/FindOPENCL.cmake @@ -92,9 +92,9 @@ find_path(_OPENCL_CPP_INCLUDE_DIRS ENV OCL_ROOT /usr/local/cuda/include PATH_SUFFIXES - include - OpenCL/common/inc - "AMD APP/include" + include + OpenCL/common/inc + "AMD APP/include" ) set(OPENCL_INCLUDE_DIRS ${OPENCL_INCLUDE_DIR}) @@ -105,7 +105,7 @@ if(_OPENCL_CPP_INCLUDE_DIRS) list(REMOVE_DUPLICATES OPENCL_INCLUDE_DIRS) endif() -_FIND_OPENCL_VERSION() +_find_opencl_version() if(WIN32) if(CMAKE_SIZEOF_VOID_P EQUAL 4) diff --git a/cmake/Toolchains/zynq-7000.cmake b/cmake/Toolchains/zynq-7000.cmake index 17e3d8ca1..b33e48c7e 100644 --- a/cmake/Toolchains/zynq-7000.cmake +++ b/cmake/Toolchains/zynq-7000.cmake @@ -18,17 +18,21 @@ set(CMAKE_SYSROOT /home/carlesfernandez/binary) ### POINT THIS TO YOUR ROOTFS set(CMAKE_C_COMPILER /usr/bin/arm-linux-gnueabihf-gcc) set(CMAKE_CXX_COMPILER /usr/bin/arm-linux-gnueabihf-g++) -set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT} ) +set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -set(ZYNQ_FLAGS "-march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7") +set(ZYNQ_FLAGS + "-march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7" +) set(CMAKE_ASM_FLAGS ${ZYNQ_FLAGS} CACHE STRING "" FORCE) set(CMAKE_C_FLAGS ${ZYNQ_FLAGS} CACHE STRING "" FORCE) set(CMAKE_CXX_FLAGS ${ZYNQ_FLAGS} CACHE STRING "" FORCE) -set(CMAKE_LIBRARY_PATH ${CMAKE_SYSROOT}/usr/lib - ${CMAKE_SYSROOT}/usr/lib/arm-linux-gnueabihf) +set(CMAKE_LIBRARY_PATH + ${CMAKE_SYSROOT}/usr/lib + ${CMAKE_SYSROOT}/usr/lib/arm-linux-gnueabihf +) set(CMAKE_INSTALL_PREFIX ${CMAKE_SYSROOT}/usr CACHE STRING "" FORCE) diff --git a/docs/changelog.md b/docs/changelog.md index 56a674fb1..f0adf6405 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -104,14 +104,16 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades ) -endif(MSVC) +endif() target_include_directories(volk_gnsssdr_profile PRIVATE $ diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/CMakeParseArgumentsCopy.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/CMakeParseArgumentsCopy.cmake index 7eedef7ec..0b8f05552 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/CMakeParseArgumentsCopy.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/CMakeParseArgumentsCopy.cmake @@ -77,12 +77,12 @@ set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE) function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames) # first set all result variables to empty/FALSE foreach(arg_name ${_singleArgNames} ${_multiArgNames}) - set(${prefix}_${arg_name}) - endforeach(arg_name) + set(${prefix}_${arg_name}) + endforeach() foreach(option ${_optionNames}) - set(${prefix}_${option} FALSE) - endforeach(option) + set(${prefix}_${option} FALSE) + endforeach() set(${prefix}_UNPARSED_ARGUMENTS) @@ -103,9 +103,9 @@ function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgName elseif("${insideValues}" STREQUAL "MULTI") list(APPEND ${prefix}_${currentArgName} ${currentArg}) endif() - else(insideValues) + else() list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) - endif(insideValues) + endif() else() if(NOT ${optionIndex} EQUAL -1) set(${prefix}_${currentArg} TRUE) @@ -121,12 +121,12 @@ function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgName endif() endif() - endforeach(currentArg) + endforeach() # propagate the result variables to the caller: foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) - endforeach(arg_name) + endforeach() set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) -endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs) +endfunction() diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindFILESYSTEM.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindFILESYSTEM.cmake index 6903ddb6c..24657a63c 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindFILESYSTEM.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindFILESYSTEM.cmake @@ -254,6 +254,9 @@ cmake_pop_check_state() set(FILESYSTEM_FOUND ${_found} CACHE BOOL "TRUE if we can compile and link a program using std::filesystem" FORCE) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(FILESYSTEM DEFAULT_MSG FILESYSTEM_FOUND) + if(FILESYSTEM_FIND_REQUIRED AND NOT FILESYSTEM_FOUND) message(FATAL_ERROR "Cannot compile a simple program using std::filesystem") endif() diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake index 2da630715..b75a61164 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake @@ -34,7 +34,7 @@ macro(VOLK_PYTHON_CHECK_MODULE_RAW desc python_code have) endmacro() macro(VOLK_PYTHON_CHECK_MODULE desc mod cmd have) - VOLK_PYTHON_CHECK_MODULE_RAW( + volk_python_check_module_raw( "${desc}" " ######################################### try: 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 82bb4e133..c472dae9d 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 @@ -309,7 +309,7 @@ if(NOT CROSSCOMPILE_MULTILIB AND CPU_IS_x86) if(${SIZEOF_CPU} EQUAL 64 AND MSVC) overrule_arch(mmx "No MMX for Win64") if(MSVC_VERSION GREATER 1700) - OVERRULE_ARCH(sse "No SSE for Win64 Visual Studio 2013") + overrule_arch(sse "No SSE for Win64 Visual Studio 2013") endif() endif() diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/python/volk_gnsssdr_modtool/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/python/volk_gnsssdr_modtool/CMakeLists.txt index 2345a6d66..ee1cc66bf 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/python/volk_gnsssdr_modtool/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/python/volk_gnsssdr_modtool/CMakeLists.txt @@ -12,7 +12,7 @@ ######################################################################## include(VolkPython) -VOLK_PYTHON_INSTALL( +volk_python_install( FILES __init__.py cfg.py @@ -21,7 +21,7 @@ VOLK_PYTHON_INSTALL( COMPONENT "volk_gnsssdr" ) -VOLK_PYTHON_INSTALL( +volk_python_install( PROGRAMS volk_gnsssdr_modtool DESTINATION ${VOLK_RUNTIME_DIR} diff --git a/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt b/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt index 4eabb0e27..06a6136ed 100644 --- a/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt @@ -35,7 +35,7 @@ target_link_libraries(resampler_gr_blocks Gnuradio::runtime Boost::headers # Fix for homebrew PRIVATE - Volk::volk + Volk::volk ) if(ENABLE_CLANG_TIDY) diff --git a/src/utils/rinex-tools/CMakeLists.txt b/src/utils/rinex-tools/CMakeLists.txt index 7cae35ccd..513323b08 100644 --- a/src/utils/rinex-tools/CMakeLists.txt +++ b/src/utils/rinex-tools/CMakeLists.txt @@ -24,10 +24,10 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND set_property(TARGET obsdiff PROPERTY CXX_STANDARD 14) # Required by GPSTk v3.0.0 # Do not show warnings raised by GPSTk v3.0.0 if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - target_compile_options(obsdiff - PUBLIC - -Wno-deprecated -Wno-unused-parameter -Wno-sign-compare -Wno-reorder -Wno-deprecated-copy -Wno-extra -Wno-unused-but-set-variable -Wno-unknown-pragmas - ) + target_compile_options(obsdiff + PUBLIC + -Wno-deprecated -Wno-unused-parameter -Wno-sign-compare -Wno-reorder -Wno-deprecated-copy -Wno-extra -Wno-unused-but-set-variable -Wno-unknown-pragmas + ) endif() if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") target_compile_options(obsdiff @@ -65,8 +65,8 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND ) add_custom_command(TARGET obsdiff POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ - ${CMAKE_SOURCE_DIR}/install/$ + COMMAND ${CMAKE_COMMAND} -E copy $ + ${CMAKE_SOURCE_DIR}/install/$ ) install(TARGETS obsdiff diff --git a/src/utils/rinex2assist/CMakeLists.txt b/src/utils/rinex2assist/CMakeLists.txt index af5c2b51a..d6a9ca6f0 100644 --- a/src/utils/rinex2assist/CMakeLists.txt +++ b/src/utils/rinex2assist/CMakeLists.txt @@ -50,10 +50,10 @@ if(Boost_FOUND) set_property(TARGET rinex2assist PROPERTY CXX_STANDARD 14) # Required by GPSTk # Do not show warnings raised by GPSTk v3.0.0 if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - target_compile_options(rinex2assist - PUBLIC - -Wno-deprecated -Wno-unused-parameter -Wno-sign-compare -Wno-type-limits -Wno-unused-but-set-variable -Wno-deprecated-copy -Wno-extra - ) + target_compile_options(rinex2assist + PUBLIC + -Wno-deprecated -Wno-unused-parameter -Wno-sign-compare -Wno-type-limits -Wno-unused-but-set-variable -Wno-deprecated-copy -Wno-extra + ) endif() if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") target_compile_options(rinex2assist