cmake: Whitespace and commentary fixes

Cosmetics, no functional change expected.
Fixed leading space alignment.
Replaced tabs with spaces.
Emulation error message output is now aligned.

To locate tabs in cmake, the following bash is useful:
grep -PRil "\t" * | grep -i cmake | grep -v ^sanity

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
This commit is contained in:
Mark Ruvald Pedersen 2018-12-19 10:40:57 +01:00 committed by Carles Cufí
parent b6ab4e8a7f
commit 0efad5f7fd
12 changed files with 118 additions and 120 deletions

View file

@ -34,15 +34,16 @@ if(NOT PROPERTY_LINKER_SCRIPT_DEFINES)
endif()
define_property(GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT BRIEF_DOCS " " FULL_DOCS " ")
set_property( GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT elf32-little${ARCH})
set_property( GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT elf32-little${ARCH}) # BFD format
# zephyr_interface is a source-less library that has all the global
# "zephyr_interface" is a source-less library that encapsulates all the global
# compiler options needed by all source files. All zephyr libraries,
# including the library named "zephyr" link with this library to
# obtain these flags.
# https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#interface-libraries
add_library(zephyr_interface INTERFACE)
# zephyr is a catchall CMake library for source files that can be
# "zephyr" is a catch-all CMake library for source files that can be
# built purely with the include paths, defines, and other compiler
# flags that come with zephyr_interface.
zephyr_library_named(zephyr)
@ -780,9 +781,9 @@ if(CONFIG_APPLICATION_MEMORY)
set(def "${def} ${f}")
endforeach()
set_property(GLOBAL APPEND PROPERTY
PROPERTY_LINKER_SCRIPT_DEFINES
${def}
)
PROPERTY_LINKER_SCRIPT_DEFINES
${def}
)
endif() # CONFIG_APPLICATION_MEMORY
if (CONFIG_CODE_DATA_RELOCATION)
@ -1391,13 +1392,12 @@ else()
COMMAND
${CMAKE_COMMAND} -E echo
"==================================================="
"Emulation/Simulation not supported with this board."
"Emulation/Simulation not supported with this board."
"==================================================="
)
endif()
add_subdirectory(cmake/flash)
add_subdirectory(cmake/usage)
add_subdirectory(cmake/reports)
@ -1407,14 +1407,14 @@ if(CONFIG_ASSERT AND (NOT CONFIG_FORCE_NO_ASSERT))
--- WARNING: __ASSERT() statements are globally ENABLED ---
--- The kernel will run more slowly and use more memory ---
------------------------------------------------------------"
)
)
endif()
if(CONFIG_BOARD_DEPRECATED)
message(WARNING "
WARNING: The board '${BOARD}' is deprecated and will be
removed in version ${CONFIG_BOARD_DEPRECATED}"
)
)
endif()
if(CONFIG_X86 AND CONFIG_USERSPACE AND NOT CONFIG_X86_NO_MELTDOWN)
@ -1423,5 +1423,5 @@ if(CONFIG_X86 AND CONFIG_USERSPACE AND NOT CONFIG_X86_NO_MELTDOWN)
If your CPU is vulnerable to the Meltdown CPU bug, security of
supervisor-only memory pages is not guaranteed. This version of Zephyr
does not contain a fix for this issue."
)
)
endif()

View file

@ -71,7 +71,7 @@ add_custom_target(code_data_relocation_target)
# CMake's 'project' concept has proven to not be very useful for Zephyr
# due in part to how Zephyr is organized and in part to it not fitting well
# with cross compilation.
# CMake therefore tries to rely as little as possible on project()
# Zephyr therefore tries to rely as little as possible on project()
# and its associated variables, e.g. PROJECT_SOURCE_DIR.
# It is recommended to always use ZEPHYR_BASE instead of PROJECT_SOURCE_DIR
# when trying to reference ENV${ZEPHYR_BASE}.
@ -200,12 +200,12 @@ foreach(root ${BOARD_ROOT})
# NB: find_path will return immediately if the output variable is
# already set
find_path(BOARD_DIR
NAMES ${BOARD}_defconfig
PATHS ${root}/boards/*/*
NO_DEFAULT_PATH
)
NAMES ${BOARD}_defconfig
PATHS ${root}/boards/*/*
NO_DEFAULT_PATH
)
if(BOARD_DIR AND NOT (${root} STREQUAL ${ZEPHYR_BASE}))
set(USING_OUT_OF_TREE_BOARD 1)
set(USING_OUT_OF_TREE_BOARD 1)
endif()
endforeach()
@ -216,8 +216,8 @@ if(NOT BOARD_DIR)
message(FATAL_ERROR "Invalid usage")
endif()
get_filename_component(BOARD_ARCH_DIR ${BOARD_DIR} DIRECTORY)
get_filename_component(BOARD_FAMILY ${BOARD_DIR} NAME )
get_filename_component(BOARD_ARCH_DIR ${BOARD_DIR} DIRECTORY)
get_filename_component(BOARD_FAMILY ${BOARD_DIR} NAME)
get_filename_component(ARCH ${BOARD_ARCH_DIR} NAME)
if(CONF_FILE)
@ -298,7 +298,7 @@ if(GIT_FOUND)
endif()
endif()
set(SOC_NAME ${CONFIG_SOC})
set(SOC_NAME ${CONFIG_SOC})
set(SOC_SERIES ${CONFIG_SOC_SERIES})
set(SOC_FAMILY ${CONFIG_SOC_FAMILY})
@ -341,17 +341,18 @@ if(CONFIG_QEMU_TARGET)
if(CONFIG_NET_QEMU_ETHERNET)
if(CONFIG_ETH_NIC_MODEL)
list(APPEND QEMU_FLAGS_${ARCH}
-nic tap,model=${CONFIG_ETH_NIC_MODEL},script=no,downscript=no,ifname=zeth
)
-nic tap,model=${CONFIG_ETH_NIC_MODEL},script=no,downscript=no,ifname=zeth
)
else()
message(FATAL_ERROR
"No Qemu ethernet driver configured!
Enable Qemu supported ethernet driver like e1000 at drivers/ethernet")
message(FATAL_ERROR "
No Qemu ethernet driver configured!
Enable Qemu supported ethernet driver like e1000 at drivers/ethernet"
)
endif()
else()
list(APPEND QEMU_FLAGS_${ARCH}
-net none
)
)
endif()
endif()

View file

@ -46,7 +46,7 @@ function(determine_python_version exe result)
message(FATAL_ERROR "Failed to test python version")
else()
string(REPLACE ";" "." ver "${_VERSION}")
set(${result} ${ver} PARENT_SCOPE)
set(${result} ${ver} PARENT_SCOPE)
endif()
endfunction()
@ -57,10 +57,10 @@ find_program(PYTHON_EXECUTABLE python)
if(NOT (${PYTHON_EXECUTABLE} STREQUAL PYTHON_EXECUTABLE-NOTFOUND))
determine_python_version(${PYTHON_EXECUTABLE} ver)
if(${ver} VERSION_LESS PythonInterp_FIND_VERSION)
# We didn't find the correct version on path, so forget about it
# and continue looking.
unset(PYTHON_EXECUTABLE)
unset(PYTHON_EXECUTABLE CACHE)
# We didn't find the correct version on path, so forget about it
# and continue looking.
unset(PYTHON_EXECUTABLE)
unset(PYTHON_EXECUTABLE CACHE)
endif()
endif()
@ -131,12 +131,12 @@ if(NOT PYTHON_EXECUTABLE)
list(APPEND _Python_NAMES python)
endif()
if(WIN32)
find_program(PYTHON_EXECUTABLE
NAMES ${_Python_NAMES}
HINTS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]
)
endif()
if(WIN32)
find_program(PYTHON_EXECUTABLE
NAMES ${_Python_NAMES}
HINTS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]
)
endif()
find_program(PYTHON_EXECUTABLE
NAMES ${_Python_NAMES}
@ -148,15 +148,15 @@ endif()
# determine python version string
if(PYTHON_EXECUTABLE)
determine_python_version(${PYTHON_EXECUTABLE} res)
set(PYTHON_VERSION_STRING ${res})
set(PYTHON_VERSION_STRING ${res})
if(PYTHON_VERSION_STRING MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)")
set(PYTHON_VERSION_PATCH "${CMAKE_MATCH_3}")
else()
set(PYTHON_VERSION_PATCH "0")
endif()
set(PYTHON_VERSION_MAJOR "${CMAKE_MATCH_1}")
set(PYTHON_VERSION_MINOR "${CMAKE_MATCH_2}")
if(PYTHON_VERSION_STRING MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)")
set(PYTHON_VERSION_PATCH "${CMAKE_MATCH_3}")
else()
set(PYTHON_VERSION_PATCH "0")
endif()
set(PYTHON_VERSION_MAJOR "${CMAKE_MATCH_1}")
set(PYTHON_VERSION_MINOR "${CMAKE_MATCH_2}")
endif()
include(FindPackageHandleStandardArgs)

View file

@ -49,9 +49,9 @@ endforeach()
if("${ZEPHYR_TOOLCHAIN_VARIANT}" STREQUAL "xcc")
list(APPEND TOOLCHAIN_LIBS
gcc
hal
)
gcc
hal
)
else()
include(${ZEPHYR_BASE}/cmake/gcc-m-cpu.cmake)

View file

@ -9,8 +9,8 @@ find_program(CMAKE_RANLILB ranlib )
find_program(CMAKE_READELF readelf)
find_program(CMAKE_GDB gdb )
set(CMAKE_C_FLAGS -m32 )
set(CMAKE_CXX_FLAGS -m32 )
set(CMAKE_C_FLAGS -m32 )
set(CMAKE_CXX_FLAGS -m32 )
set(CMAKE_SHARED_LINKER_FLAGS -m32 )
if(CONFIG_CPLUSPLUS)

View file

@ -36,23 +36,23 @@ foreach(board_root ${BOARD_ROOT})
# we construct a list of shield names by extracting file name and
# removing the extension.
foreach(shield_path ${shields_refs_list})
get_filename_component(shield ${shield_path} NAME_WE)
get_filename_component(shield ${shield_path} NAME_WE)
# Generate CONFIG flags matching each shield
string(TOUPPER "CONFIG_SHIELD_${shield}" shield_config)
# Generate CONFIG flags matching each shield
string(TOUPPER "CONFIG_SHIELD_${shield}" shield_config)
if(${shield_config})
if(${shield_config})
# if shield config flag is on, add shield overlay to the shield overlays
# list and dts_fixup file to the shield fixup file
list(APPEND
dts_files
${shield_dir}/${shield_path}
)
dts_files
${shield_dir}/${shield_path}
)
list(APPEND
dts_fixups
${shield_dir}/${shield}/dts_fixup.h
)
endif()
dts_fixups
${shield_dir}/${shield}/dts_fixup.h
)
endif()
endforeach()
endforeach()
@ -73,13 +73,13 @@ if(CONFIG_HAS_DTS)
list(APPEND DTC_INCLUDE_FLAG_FOR_DTS
-include ${dts_file})
if(i EQUAL 0)
message(STATUS "Loading ${dts_file} as base")
else()
message(STATUS "Overlaying ${dts_file}")
endif()
if(i EQUAL 0)
message(STATUS "Loading ${dts_file} as base")
else()
message(STATUS "Overlaying ${dts_file}")
endif()
math(EXPR i "${i}+1")
math(EXPR i "${i}+1")
endforeach()
# TODO: Cut down on CMake configuration time by avoiding
@ -133,17 +133,17 @@ if(CONFIG_HAS_DTS)
# Error-out when the deprecated naming convention is found (until
# after 1.14.0 has been released)
foreach(path
${BOARD_DIR}/dts.fixup
${PROJECT_SOURCE_DIR}/soc/${ARCH}/${SOC_PATH}/dts.fixup
${BOARD_DIR}/dts.fixup
${PROJECT_SOURCE_DIR}/soc/${ARCH}/${SOC_PATH}/dts.fixup
${APPLICATION_SOURCE_DIR}/dts.fixup
)
if(EXISTS ${path})
message(FATAL_ERROR
"A deprecated filename has been detected. Porting is required."
"The file '${path}' exists, but it should be named dts_fixup.h instead."
"See https://github.com/zephyrproject-rtos/zephyr/pull/10352 for more details"
)
endif()
)
if(EXISTS ${path})
message(FATAL_ERROR
"A deprecated filename has been detected. Porting is required."
"The file '${path}' exists, but it should be named dts_fixup.h instead."
"See https://github.com/zephyrproject-rtos/zephyr/pull/10352 for more details"
)
endif()
endforeach()
# Run extract_dts_includes.py for the header file

View file

@ -24,7 +24,7 @@
# 1.1. zephyr_*
#
# The following methods are for modifying the CMake library[0] called
# "zephyr". zephyr is a catchall CMake library for source files that
# "zephyr". zephyr is a catch-all CMake library for source files that
# can be built purely with the include paths, defines, and other
# compiler flags that all zephyr source files use.
# [0] https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html
@ -33,13 +33,13 @@
# zephyr_sources(
# random_esp32.c
# utils.c
# )
# )
#
# Is short for:
# target_sources(zephyr PRIVATE
# ${CMAKE_CURRENT_SOURCE_DIR}/random_esp32.c
# ${CMAKE_CURRENT_SOURCE_DIR}/utils.c
# )
# )
# https://cmake.org/cmake/help/latest/command/target_sources.html
function(zephyr_sources)
@ -1106,14 +1106,14 @@ macro(assert_exists var)
endmacro()
function(print_usage)
message("see usage:")
string(REPLACE ";" " " BOARD_ROOT_SPACE_SEPARATED "${BOARD_ROOT}")
execute_process(
COMMAND
${CMAKE_COMMAND}
-DBOARD_ROOT_SPACE_SEPARATED=${BOARD_ROOT_SPACE_SEPARATED}
-P ${ZEPHYR_BASE}/cmake/usage/usage.cmake
)
message("see usage:")
string(REPLACE ";" " " BOARD_ROOT_SPACE_SEPARATED "${BOARD_ROOT}")
execute_process(
COMMAND
${CMAKE_COMMAND}
-DBOARD_ROOT_SPACE_SEPARATED=${BOARD_ROOT_SPACE_SEPARATED}
-P ${ZEPHYR_BASE}/cmake/usage/usage.cmake
)
endfunction()
# 3.5. File system management
@ -1190,10 +1190,7 @@ function(find_appropriate_cache_directory dir)
set(${dir} ${local_dir} PARENT_SCOPE)
endfunction()
function(generate_unique_target_name_from_filename
filename
target_name
)
function(generate_unique_target_name_from_filename filename target_name)
get_filename_component(basename ${filename} NAME)
string(REPLACE "." "_" x ${basename})
string(REPLACE "@" "_" x ${x})

View file

@ -22,11 +22,11 @@ execute_process(
string(REGEX MATCH "Version: DTC ([0-9]+\.[0-9]+.[0-9]+).*" out_var ${dtc_version_output})
if(${CMAKE_MATCH_1} VERSION_LESS ${MIN_DTC_VERSION})
assert(0 "The detected dtc version is unsupported. \n\
The version was found to be ${CMAKE_MATCH_1} \n\
But the minimum supported version is ${MIN_DTC_VERSION} \n\
See https://docs.zephyrproject.org/latest/getting_started/getting_started.html \n\
for how to use the SDK's dtc alongside a custom toolchain."
)
The version was found to be ${CMAKE_MATCH_1} \n\
But the minimum supported version is ${MIN_DTC_VERSION} \n\
See https://docs.zephyrproject.org/latest/getting_started/getting_started.html \n\
for how to use the SDK's dtc alongside a custom toolchain."
)
endif()
find_program(

View file

@ -171,8 +171,8 @@ add_custom_target(config-sanitycheck DEPENDS ${DOTCONFIG})
# re-introduced to the namespace through 'import_kconfig'.
foreach (name ${cache_variable_names})
if("${name}" MATCHES "^CONFIG_")
unset(${name})
unset(${name} CACHE)
unset(${name})
unset(${name} CACHE)
endif()
endforeach()
@ -182,8 +182,8 @@ import_kconfig(CONFIG_ ${DOTCONFIG})
# Re-introduce the CLI Kconfig symbols that survived
foreach (name ${cache_variable_names})
if("${name}" MATCHES "^CONFIG_")
if(DEFINED ${name})
set(${name} ${${name}} CACHE STRING "")
endif()
if(DEFINED ${name})
set(${name} ${${name}} CACHE STRING "")
endif()
endif()
endforeach()

View file

@ -11,7 +11,7 @@ set( GNUARMEMB_TOOLCHAIN_PATH ${GNUARMEMB_TOOLCHAIN_PATH} CACHE PATH "gnua
assert( GNUARMEMB_TOOLCHAIN_PATH "GNUARMEMB_TOOLCHAIN_PATH is not set")
if(NOT EXISTS ${GNUARMEMB_TOOLCHAIN_PATH})
message(FATAL_ERROR "Nothing found at GNUARMEMB_TOOLCHAIN_PATH: '${GNUARMEMB_TOOLCHAIN_PATH}'")
message(FATAL_ERROR "Nothing found at GNUARMEMB_TOOLCHAIN_PATH: '${GNUARMEMB_TOOLCHAIN_PATH}'")
endif()
set(TOOLCHAIN_HOME ${GNUARMEMB_TOOLCHAIN_PATH})

View file

@ -16,25 +16,25 @@ string(REPLACE " " ";" BOARD_ROOT "${BOARD_ROOT_SPACE_SEPARATED}")
foreach(arch ${arch_list})
foreach(root ${BOARD_ROOT})
set(board_arch_dir ${root}/boards/${arch})
set(board_arch_dir ${root}/boards/${arch})
# Match the .yanl files in the board directories to make sure we are
# finding boards, e.g. qemu_xtensa/qemu_xtensa.yaml
file(GLOB_RECURSE yamls_for_${arch}
# Match the .yaml files in the board directories to make sure we are
# finding boards, e.g. qemu_xtensa/qemu_xtensa.yaml
file(GLOB_RECURSE yamls_for_${arch}
RELATIVE ${board_arch_dir}
${board_arch_dir}/*.yaml
)
# The above gives a list like
# nrf51_blenano/nrf51_blenano_yaml;nrf51_pca10028/nrf51_pca10028_yaml
# we construct a list of board names by removing both the .yaml
# suffix and the path.
set(boards_for_${arch} "")
foreach(yaml_path ${yamls_for_${arch}})
# The above gives a list like
# nrf51_blenano/nrf51_blenano_yaml;nrf51_pca10028/nrf51_pca10028_yaml
# we construct a list of board names by removing both the .yaml
# suffix and the path.
set(boards_for_${arch} "")
foreach(yaml_path ${yamls_for_${arch}})
get_filename_component(board ${yaml_path} NAME_WE)
list(APPEND boards_for_${arch} ${board})
endforeach()
endforeach()
endforeach()
endforeach()
@ -78,7 +78,7 @@ message("Build flags:")
message("")
message(" ${generator} VERBOSE=1 [targets] verbose build")
message(" cmake -DW=n Enable extra gcc checks, n=1,2,3 where")
message(" 1: warnings which may be relevant and do not occur too often")
message(" 2: warnings which occur quite often but may still be relevant")
message(" 3: more obscure warnings, can most likely be ignored")
message(" Multiple levels can be combined with W=12 or W=123")
message(" 1: warnings which may be relevant and do not occur too often")
message(" 2: warnings which occur quite often but may still be relevant")
message(" 3: more obscure warnings, can most likely be ignored")
message(" Multiple levels can be combined with W=12 or W=123")

View file

@ -12,6 +12,6 @@ set(DEST_FILE ${CMAKE_ARGV3})
file(REMOVE ${DEST_FILE})
foreach(i RANGE 4 ${ARGC})
file(READ ${CMAKE_ARGV${i}} BUF)
file(APPEND ${DEST_FILE} ${BUF})
file(READ ${CMAKE_ARGV${i}} BUF)
file(APPEND ${DEST_FILE} ${BUF})
endforeach()