cmake: Style cleanup, add cmake linter to gitlab CI

This commit is contained in:
Angus Gratton 2018-03-20 12:27:00 +11:00 committed by Angus Gratton
parent 2ea359ad0c
commit b44c8b125f
6 changed files with 21 additions and 15 deletions

View file

@ -234,6 +234,12 @@ build_docs:
- make html
- ../check_doc_warnings.sh
verify_cmake_style:
stage: build
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
script:
tools/cmake/run_cmake_lint.sh
test_nvs_on_host:
stage: test
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG

View file

@ -1,7 +1,7 @@
set(COMPONENT_SRCDIRS "." "gcov")
set(COMPONENT_ADD_INCLUDEDIRS "include")
if (CONFIG_SYSVIEW_ENABLE)
if(CONFIG_SYSVIEW_ENABLE)
list(APPEND COMPONENT_ADD_INCLUDEDIRS
sys_view/Config
sys_view/SEGGER

View file

@ -15,7 +15,7 @@ if(CONFIG_BLUEDROID_ENABLED)
bluedroid/hci/include
bluedroid/osi/include
bluedroid/external/sbc/decoder/include
bluedroid/external/sbc/encoder/include
bluedroid/external/sbc/encoder/include
bluedroid/btc/profile/esp/blufi/include
bluedroid/btc/profile/esp/include
bluedroid/btc/profile/std/a2dp/include
@ -51,7 +51,7 @@ if(CONFIG_BLUEDROID_ENABLED)
bluedroid/main
bluedroid/osi
bluedroid/external/sbc/decoder/srce
bluedroid/external/sbc/encoder/srce
bluedroid/external/sbc/encoder/srce
bluedroid/btc/core
bluedroid/btc/profile/esp/blufi
bluedroid/btc/profile/std/gap

View file

@ -18,10 +18,10 @@ function(crosstool_version_check expected_ctng_version)
string(REGEX MATCH "crosstool-ng-[0-9a-g\\.-]+" ctng_version "${toolchain_stderr}")
string(REPLACE "crosstool-ng-" "" ctng_version "${ctng_version}")
# We use FIND to match version instead of STREQUAL because some toolchains are built
# with longer git hash strings than others. This will match any version which starts with
# the expected version string.
string(FIND "${ctng_version}" "${expected_ctng_version}" found_expected_version)
# We use FIND to match version instead of STREQUAL because some toolchains are built
# with longer git hash strings than others. This will match any version which starts with
# the expected version string.
string(FIND "${ctng_version}" "${expected_ctng_version}" found_expected_version)
if(NOT ctng_version)
message(WARNING "Xtensa toolchain ${CMAKE_C_COMPILER} does not appear to be built with crosstool-ng. "
"${ctng_version_warning}")

View file

@ -18,7 +18,7 @@ macro(idf_set_global_variables)
# (cmake calls this CMAKE_SOURCE_DIR, keeping old name for compatibility.)
set(PROJECT_PATH "${CMAKE_SOURCE_DIR}")
# Note: Unlike older build system, "main" is no longer a component. See build docs for details.
# Note: Unlike older build system, "main" is no longer a component. See build docs for details.
set_default(COMPONENT_DIRS "${PROJECT_PATH}/components ${EXTRA_COMPONENT_DIRS} ${IDF_PATH}/components")
spaces2list(COMPONENT_DIRS)
@ -97,12 +97,12 @@ function(idf_set_global_compiler_options)
add_compile_options("-I${CMAKE_BINARY_DIR}") # for sdkconfig.h
# Enable ccache if it's on the path
if(NOT CCACHE_DISABLE)
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
message(STATUS "ccache will be used for faster builds")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
endif()
if(NOT CCACHE_DISABLE)
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
message(STATUS "ccache will be used for faster builds")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
endif()
endif()
endfunction()

View file

@ -7,7 +7,7 @@ set(IDF_PATH "$ENV{IDF_PATH}")
if(NOT IDF_PATH)
# Documentation says you should set IDF_PATH in your environment, but we
# can infer it here if it's not set.
set(IDF_PATH ${CMAKE_CURRENT_LIST_DIR})
set(IDF_PATH ${CMAKE_CURRENT_LIST_DIR})
endif()
file(TO_CMAKE_PATH "${IDF_PATH}" IDF_PATH)
set($ENV{IDF_PATH} "${IDF_PATH}")