modify path name & stm32f2 support without mpu.
This commit is contained in:
176
mkrtos_cmake/backports/FindPythonInterp.cmake
Normal file
176
mkrtos_cmake/backports/FindPythonInterp.cmake
Normal file
@@ -0,0 +1,176 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#.rst:
|
||||
# FindPythonInterp
|
||||
# ----------------
|
||||
#
|
||||
# Find python interpreter
|
||||
#
|
||||
# This module finds if Python interpreter is installed and determines
|
||||
# where the executables are. This code sets the following variables:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# PYTHONINTERP_FOUND - Was the Python executable found
|
||||
# PYTHON_EXECUTABLE - path to the Python interpreter
|
||||
#
|
||||
#
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# PYTHON_VERSION_STRING - Python version found e.g. 2.5.2
|
||||
# PYTHON_VERSION_MAJOR - Python major version found e.g. 2
|
||||
# PYTHON_VERSION_MINOR - Python minor version found e.g. 5
|
||||
# PYTHON_VERSION_PATCH - Python patch version found e.g. 2
|
||||
#
|
||||
#
|
||||
#
|
||||
# The Python_ADDITIONAL_VERSIONS variable can be used to specify a list
|
||||
# of version numbers that should be taken into account when searching
|
||||
# for Python. You need to set this variable before calling
|
||||
# find_package(PythonInterp).
|
||||
#
|
||||
# If calling both ``find_package(PythonInterp)`` and
|
||||
# ``find_package(PythonLibs)``, call ``find_package(PythonInterp)`` first to
|
||||
# get the currently active Python version by default with a consistent version
|
||||
# of PYTHON_LIBRARIES.
|
||||
|
||||
function(determine_python_version exe result)
|
||||
execute_process(COMMAND "${exe}" -c
|
||||
"import sys; sys.stdout.write(';'.join([str(x) for x in sys.version_info[:3]]))"
|
||||
OUTPUT_VARIABLE _VERSION
|
||||
RESULT_VARIABLE _PYTHON_VERSION_RESULT
|
||||
ERROR_QUIET)
|
||||
if(_PYTHON_VERSION_RESULT)
|
||||
# sys.version predates sys.version_info, so use that
|
||||
execute_process(COMMAND "${exe}" -c "import sys; sys.stdout.write(sys.version)"
|
||||
OUTPUT_VARIABLE _VERSION
|
||||
RESULT_VARIABLE _PYTHON_VERSION_RESULT
|
||||
ERROR_QUIET)
|
||||
if(_PYTHON_VERSION_RESULT)
|
||||
# sys.version was first documented for Python 1.5, so assume
|
||||
# this is older.
|
||||
set(ver "1.4")
|
||||
else()
|
||||
string(REGEX REPLACE " .*" "" ver "${_VERSION}")
|
||||
endif()
|
||||
else()
|
||||
string(REPLACE ";" "." ver "${_VERSION}")
|
||||
endif()
|
||||
set(${result} ${ver} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Find out if the 'python' executable on path has the correct version,
|
||||
# and choose it if it does. This gives this executable the highest
|
||||
# priority, which is expected behaviour.
|
||||
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)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
unset(_Python_NAMES)
|
||||
|
||||
set(_PYTHON1_VERSIONS 1.6 1.5)
|
||||
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
|
||||
set(_PYTHON3_VERSIONS 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
||||
|
||||
if(PythonInterp_FIND_VERSION)
|
||||
if(PythonInterp_FIND_VERSION_COUNT GREATER 1)
|
||||
set(_PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION_MAJOR}.${PythonInterp_FIND_VERSION_MINOR}")
|
||||
list(APPEND _Python_NAMES
|
||||
python${_PYTHON_FIND_MAJ_MIN}
|
||||
python${PythonInterp_FIND_VERSION_MAJOR})
|
||||
unset(_PYTHON_FIND_OTHER_VERSIONS)
|
||||
if(NOT PythonInterp_FIND_VERSION_EXACT)
|
||||
foreach(_PYTHON_V ${_PYTHON${PythonInterp_FIND_VERSION_MAJOR}_VERSIONS})
|
||||
if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
|
||||
list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
unset(_PYTHON_FIND_MAJ_MIN)
|
||||
else()
|
||||
list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION_MAJOR})
|
||||
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION_MAJOR}_VERSIONS})
|
||||
endif()
|
||||
else()
|
||||
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
|
||||
endif()
|
||||
find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES})
|
||||
|
||||
# Set up the versions we know about, in the order we will search. Always add
|
||||
# the user supplied additional versions to the front.
|
||||
set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS})
|
||||
# If FindPythonInterp has already found the major and minor version,
|
||||
# insert that version next to get consistent versions of the interpreter and
|
||||
# library.
|
||||
if(DEFINED PYTHONLIBS_VERSION_STRING)
|
||||
string(REPLACE "." ";" _PYTHONLIBS_VERSION "${PYTHONLIBS_VERSION_STRING}")
|
||||
list(GET _PYTHONLIBS_VERSION 0 _PYTHONLIBS_VERSION_MAJOR)
|
||||
list(GET _PYTHONLIBS_VERSION 1 _PYTHONLIBS_VERSION_MINOR)
|
||||
list(APPEND _Python_VERSIONS ${_PYTHONLIBS_VERSION_MAJOR}.${_PYTHONLIBS_VERSION_MINOR})
|
||||
endif()
|
||||
|
||||
# Search for the current active python version first on Linux, and last on Windows
|
||||
if(NOT WIN32)
|
||||
list(APPEND _Python_VERSIONS ";")
|
||||
endif()
|
||||
|
||||
list(APPEND _Python_VERSIONS ${_PYTHON_FIND_OTHER_VERSIONS})
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND _Python_VERSIONS ";")
|
||||
endif()
|
||||
|
||||
unset(_PYTHON_FIND_OTHER_VERSIONS)
|
||||
unset(_PYTHON1_VERSIONS)
|
||||
unset(_PYTHON2_VERSIONS)
|
||||
unset(_PYTHON3_VERSIONS)
|
||||
|
||||
# Search for newest python version if python executable isn't found
|
||||
if(NOT PYTHON_EXECUTABLE)
|
||||
foreach(_CURRENT_VERSION IN LISTS _Python_VERSIONS)
|
||||
set(_Python_NAMES python${_CURRENT_VERSION})
|
||||
if(WIN32)
|
||||
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()
|
||||
|
||||
find_program(PYTHON_EXECUTABLE
|
||||
NAMES ${_Python_NAMES}
|
||||
PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# determine python version string
|
||||
if(PYTHON_EXECUTABLE)
|
||||
determine_python_version(${PYTHON_EXECUTABLE} 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}")
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp REQUIRED_VARS PYTHON_EXECUTABLE VERSION_VAR PYTHON_VERSION_STRING)
|
||||
|
||||
mark_as_advanced(PYTHON_EXECUTABLE)
|
||||
1580
mkrtos_cmake/extensions.cmake
Normal file
1580
mkrtos_cmake/extensions.cmake
Normal file
File diff suppressed because it is too large
Load Diff
273
mkrtos_cmake/kconfig.cmake
Normal file
273
mkrtos_cmake/kconfig.cmake
Normal file
@@ -0,0 +1,273 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Folders needed for conf/mconf files (kconfig has no method of redirecting all output files).
|
||||
# conf/mconf needs to be run from a different directory because of: GH-3408
|
||||
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/kconfig/include/generated)
|
||||
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/kconfig/include/config)
|
||||
|
||||
if(KCONFIG_ROOT)
|
||||
# KCONFIG_ROOT has either been specified as a CMake variable or is
|
||||
# already in the CMakeCache.txt. This has precedence.
|
||||
elseif(EXISTS ${APPLICATION_SOURCE_DIR}/Kconfig)
|
||||
set(KCONFIG_ROOT ${APPLICATION_SOURCE_DIR}/Kconfig)
|
||||
else()
|
||||
set(KCONFIG_ROOT ${ZEPHYR_BASE}/Kconfig)
|
||||
endif()
|
||||
|
||||
set(BOARD_DEFCONFIG ${BOARD_DIR}/${BOARD}_defconfig)
|
||||
set(DOTCONFIG ${PROJECT_BINARY_DIR}/.config)
|
||||
set(PARSED_KCONFIG_SOURCES_TXT ${PROJECT_BINARY_DIR}/kconfig/sources.txt)
|
||||
|
||||
if(CONF_FILE)
|
||||
string(REPLACE " " ";" CONF_FILE_AS_LIST "${CONF_FILE}")
|
||||
endif()
|
||||
|
||||
if(OVERLAY_CONFIG)
|
||||
string(REPLACE " " ";" OVERLAY_CONFIG_AS_LIST "${OVERLAY_CONFIG}")
|
||||
endif()
|
||||
|
||||
# DTS_ROOT_BINDINGS is a semicolon separated list, this causes
|
||||
# problems when invoking kconfig_target since semicolon is a special
|
||||
# character in the C shell, so we make it into a question-mark
|
||||
# separated list instead.
|
||||
string(REPLACE ";" "?" DTS_ROOT_BINDINGS "${DTS_ROOT_BINDINGS}")
|
||||
|
||||
set(ENV{srctree} ${PROJECT_ROOT})
|
||||
set(ENV{KCONFIG_BASE} ${PROJECT_ROOT})
|
||||
set(ENV{KERNELVERSION} ${KERNELVERSION})
|
||||
set(ENV{KCONFIG_CONFIG} ${DOTCONFIG})
|
||||
set(ENV{PYTHON_EXECUTABLE} ${PYTHON_EXECUTABLE})
|
||||
|
||||
# Set environment variables so that Kconfig can prune Kconfig source
|
||||
# files for other architectures
|
||||
set(ENV{ARCH} ${ARCH})
|
||||
set(ENV{BOARD_DIR} ${BOARD_DIR})
|
||||
set(ENV{SOC_DIR} ${SOC_DIR})
|
||||
set(ENV{SHIELD_AS_LIST} "${SHIELD_AS_LIST}")
|
||||
set(ENV{CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR})
|
||||
set(ENV{ARCH_DIR} ${ARCH_DIR})
|
||||
set(ENV{DEVICETREE_CONF} ${DEVICETREE_CONF})
|
||||
set(ENV{DTS_POST_CPP} ${DTS_POST_CPP})
|
||||
set(ENV{DTS_ROOT_BINDINGS} "${DTS_ROOT_BINDINGS}")
|
||||
set(ENV{TOOLCHAIN_KCONFIG_DIR} "${TOOLCHAIN_KCONFIG_DIR}")
|
||||
|
||||
# Allow out-of-tree users to add their own Kconfig python frontend
|
||||
# targets by appending targets to the CMake list
|
||||
# 'EXTRA_KCONFIG_TARGETS' and setting variables named
|
||||
# 'EXTRA_KCONFIG_TARGET_COMMAND_FOR_<target>'
|
||||
#
|
||||
# e.g.
|
||||
# cmake -DEXTRA_KCONFIG_TARGETS=cli
|
||||
# -DEXTRA_KCONFIG_TARGET_COMMAND_FOR_cli=cli_kconfig_frontend.py
|
||||
|
||||
set(EXTRA_KCONFIG_TARGET_COMMAND_FOR_menuconfig
|
||||
${PROJECT_ROOT}/scripts/kconfig/menuconfig.py
|
||||
)
|
||||
|
||||
set(EXTRA_KCONFIG_TARGET_COMMAND_FOR_guiconfig
|
||||
${PROJECT_ROOT}/scripts/kconfig/guiconfig.py
|
||||
)
|
||||
|
||||
set(EXTRA_KCONFIG_TARGET_COMMAND_FOR_hardenconfig
|
||||
${PROJECT_ROOT}/scripts/kconfig/hardenconfig.py
|
||||
)
|
||||
|
||||
foreach(kconfig_target
|
||||
menuconfig
|
||||
guiconfig
|
||||
hardenconfig
|
||||
${EXTRA_KCONFIG_TARGETS}
|
||||
)
|
||||
add_custom_target(
|
||||
${kconfig_target}
|
||||
${CMAKE_COMMAND} -E env
|
||||
PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
|
||||
srctree=${ZEPHYR_BASE}
|
||||
KERNELVERSION=${KERNELVERSION}
|
||||
KCONFIG_BASE=${PROJECT_BASE}
|
||||
KCONFIG_CONFIG=${DOTCONFIG}
|
||||
ARCH=$ENV{ARCH}
|
||||
BOARD_DIR=$ENV{BOARD_DIR}
|
||||
SOC_DIR=$ENV{SOC_DIR}
|
||||
SHIELD_AS_LIST=$ENV{SHIELD_AS_LIST}
|
||||
CMAKE_BINARY_DIR=$ENV{CMAKE_BINARY_DIR}
|
||||
ZEPHYR_TOOLCHAIN_VARIANT=${ZEPHYR_TOOLCHAIN_VARIANT}
|
||||
TOOLCHAIN_KCONFIG_DIR=${TOOLCHAIN_KCONFIG_DIR}
|
||||
ARCH_DIR=$ENV{ARCH_DIR}
|
||||
DEVICETREE_CONF=${DEVICETREE_CONF}
|
||||
DTS_POST_CPP=${DTS_POST_CPP}
|
||||
DTS_ROOT_BINDINGS=${DTS_ROOT_BINDINGS}
|
||||
${PYTHON_EXECUTABLE}
|
||||
${EXTRA_KCONFIG_TARGET_COMMAND_FOR_${kconfig_target}}
|
||||
${KCONFIG_ROOT}
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/kconfig
|
||||
USES_TERMINAL
|
||||
)
|
||||
endforeach()
|
||||
|
||||
# Support assigning Kconfig symbols on the command-line with CMake
|
||||
# cache variables prefixed with 'CONFIG_'. This feature is
|
||||
# experimental and undocumented until it has undergone more
|
||||
# user-testing.
|
||||
unset(EXTRA_KCONFIG_OPTIONS)
|
||||
get_cmake_property(cache_variable_names CACHE_VARIABLES)
|
||||
foreach (name ${cache_variable_names})
|
||||
if("${name}" MATCHES "^CONFIG_")
|
||||
# When a cache variable starts with 'CONFIG_', it is assumed to be
|
||||
# a Kconfig symbol assignment from the CMake command line.
|
||||
set(EXTRA_KCONFIG_OPTIONS
|
||||
"${EXTRA_KCONFIG_OPTIONS}\n${name}=${${name}}"
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(EXTRA_KCONFIG_OPTIONS)
|
||||
set(EXTRA_KCONFIG_OPTIONS_FILE ${PROJECT_BINARY_DIR}/misc/generated/extra_kconfig_options.conf)
|
||||
file(WRITE
|
||||
${EXTRA_KCONFIG_OPTIONS_FILE}
|
||||
${EXTRA_KCONFIG_OPTIONS}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Bring in extra configuration files dropped in by the user or anyone else;
|
||||
# make sure they are set at the end so we can override any other setting
|
||||
file(GLOB config_files ${APPLICATION_BINARY_DIR}/*.conf)
|
||||
list(SORT config_files)
|
||||
set(
|
||||
merge_config_files
|
||||
${BOARD_DEFCONFIG}
|
||||
${CONF_FILE_AS_LIST}
|
||||
${shield_conf_files}
|
||||
${OVERLAY_CONFIG_AS_LIST}
|
||||
${EXTRA_KCONFIG_OPTIONS_FILE}
|
||||
${config_files}
|
||||
)
|
||||
message(${merge_config_files})
|
||||
# Create a list of absolute paths to the .config sources from
|
||||
# merge_config_files, which is a mix of absolute and relative paths.
|
||||
set(merge_config_files_with_absolute_paths "")
|
||||
foreach(f ${merge_config_files})
|
||||
if(IS_ABSOLUTE ${f})
|
||||
set(path ${f})
|
||||
else()
|
||||
set(path ${APPLICATION_SOURCE_DIR}/${f})
|
||||
endif()
|
||||
|
||||
list(APPEND merge_config_files_with_absolute_paths ${path})
|
||||
endforeach()
|
||||
|
||||
foreach(f ${merge_config_files_with_absolute_paths})
|
||||
if(NOT EXISTS ${f} OR IS_DIRECTORY ${f})
|
||||
message(FATAL_ERROR "File not found: ${f}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Calculate a checksum of merge_config_files to determine if we need
|
||||
# to re-generate .config
|
||||
set(merge_config_files_checksum "")
|
||||
foreach(f ${merge_config_files_with_absolute_paths})
|
||||
file(MD5 ${f} checksum)
|
||||
set(merge_config_files_checksum "${merge_config_files_checksum}${checksum}")
|
||||
endforeach()
|
||||
|
||||
# Create a new .config if it does not exists, or if the checksum of
|
||||
# the dependencies has changed
|
||||
set(merge_config_files_checksum_file ${PROJECT_BINARY_DIR}/.cmake.dotconfig.checksum)
|
||||
set(CREATE_NEW_DOTCONFIG 1)
|
||||
# Check if the checksum file exists too before trying to open it, though it
|
||||
# should under normal circumstances
|
||||
if(EXISTS ${DOTCONFIG} AND EXISTS ${merge_config_files_checksum_file})
|
||||
# Read out what the checksum was previously
|
||||
file(READ
|
||||
${merge_config_files_checksum_file}
|
||||
merge_config_files_checksum_prev
|
||||
)
|
||||
if(
|
||||
${merge_config_files_checksum} STREQUAL
|
||||
${merge_config_files_checksum_prev}
|
||||
)
|
||||
# Checksum is the same as before
|
||||
set(CREATE_NEW_DOTCONFIG 0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CREATE_NEW_DOTCONFIG)
|
||||
set(input_configs_are_handwritten --handwritten-input-configs)
|
||||
set(input_configs ${merge_config_files})
|
||||
else()
|
||||
set(input_configs ${DOTCONFIG})
|
||||
endif()
|
||||
|
||||
|
||||
message(
|
||||
${PYTHON_EXECUTABLE} " "
|
||||
${PROJECT_ROOT}/mkrtos_tool/kconfig/kconfig.py " "
|
||||
${input_configs_are_handwritten} " "
|
||||
${KCONFIG_ROOT} " "
|
||||
${DOTCONFIG} " "
|
||||
${AUTOCONF_H} " "
|
||||
${PARSED_KCONFIG_SOURCES_TXT} " "
|
||||
${input_configs} " "
|
||||
)
|
||||
execute_process(
|
||||
COMMAND
|
||||
${PYTHON_EXECUTABLE}
|
||||
${PROJECT_ROOT}/mkrtos_tool/kconfig/kconfig.py
|
||||
${input_configs_are_handwritten}
|
||||
${KCONFIG_ROOT}
|
||||
${DOTCONFIG}
|
||||
${AUTOCONF_H}
|
||||
${PARSED_KCONFIG_SOURCES_TXT}
|
||||
${input_configs}
|
||||
WORKING_DIRECTORY ${PROJECT_ROOT}
|
||||
# The working directory is set to the app dir such that the user
|
||||
# can use relative paths in CONF_FILE, e.g. CONF_FILE=nrf5.conf
|
||||
RESULT_VARIABLE ret
|
||||
)
|
||||
if(NOT "${ret}" STREQUAL "0")
|
||||
message(FATAL_ERROR "command failed with return code: ${ret}")
|
||||
endif()
|
||||
|
||||
if(CREATE_NEW_DOTCONFIG)
|
||||
# Write the new configuration fragment checksum. Only do this if kconfig.py
|
||||
# succeeds, to avoid marking zephyr/.config as up-to-date when it hasn't been
|
||||
# regenerated.
|
||||
file(WRITE ${merge_config_files_checksum_file}
|
||||
${merge_config_files_checksum})
|
||||
endif()
|
||||
|
||||
# Read out the list of 'Kconfig' sources that were used by the engine.
|
||||
file(STRINGS ${PARSED_KCONFIG_SOURCES_TXT} PARSED_KCONFIG_SOURCES_LIST)
|
||||
|
||||
# Force CMAKE configure when the Kconfig sources or configuration files changes.
|
||||
foreach(kconfig_input
|
||||
${merge_config_files}
|
||||
${DOTCONFIG}
|
||||
${PARSED_KCONFIG_SOURCES_LIST}
|
||||
)
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${kconfig_input})
|
||||
endforeach()
|
||||
|
||||
add_custom_target(config-sanitycheck DEPENDS ${DOTCONFIG})
|
||||
|
||||
# Remove the CLI Kconfig symbols from the namespace and
|
||||
# CMakeCache.txt. If the symbols end up in DOTCONFIG they will be
|
||||
# re-introduced to the namespace through 'import_kconfig'.
|
||||
foreach (name ${cache_variable_names})
|
||||
if("${name}" MATCHES "^CONFIG_")
|
||||
unset(${name})
|
||||
unset(${name} CACHE)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Parse the lines prefixed with CONFIG_ in the .config file from Kconfig
|
||||
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()
|
||||
endif()
|
||||
endforeach()
|
||||
22
mkrtos_cmake/python.cmake
Normal file
22
mkrtos_cmake/python.cmake
Normal file
@@ -0,0 +1,22 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# On Windows, instruct Python to output UTF-8 even when not
|
||||
# interacting with a terminal. This is required since Python scripts
|
||||
# are invoked by CMake code and, on Windows, standard I/O encoding defaults
|
||||
# to the current code page if not connected to a terminal, which is often
|
||||
# not what we want.
|
||||
if (WIN32)
|
||||
set(ENV{PYTHONIOENCODING} "utf-8")
|
||||
endif()
|
||||
|
||||
# The 'FindPythonInterp' that is distributed with CMake 3.8 has a bug
|
||||
# that we need to work around until we upgrade to 3.13. Until then we
|
||||
# maintain a patched copy in our repo. Bug:
|
||||
# https://github.com/zephyrproject-rtos/zephyr/issues/11103
|
||||
set(PythonInterp_FIND_VERSION 3.6)
|
||||
set(PythonInterp_FIND_VERSION_COUNT 2)
|
||||
set(PythonInterp_FIND_VERSION_MAJOR 3)
|
||||
set(PythonInterp_FIND_VERSION_MINOR 6)
|
||||
set(PythonInterp_FIND_VERSION_EXACT 0)
|
||||
set(PythonInterp_FIND_REQUIRED 1)
|
||||
include(mkrtos_cmake/backports/FindPythonInterp.cmake)
|
||||
12
mkrtos_cmake/top.cmake
Normal file
12
mkrtos_cmake/top.cmake
Normal file
@@ -0,0 +1,12 @@
|
||||
set(PROJECT_ROOT ${CMAKE_SOURCE_DIR})
|
||||
set(KCONFIG_ROOT ${CMAKE_SOURCE_DIR}/Kconfig)
|
||||
set(BOARD_DIR ${CMAKE_SOURCE_DIR}/mkrtos_configs)
|
||||
set(AUTOCONF_H ${CMAKE_CURRENT_BINARY_DIR}/autoconf.h)
|
||||
|
||||
# Re-configure (Re-execute all CMakeLists.txt code) when autoconf.h changes
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${AUTOCONF_H})
|
||||
|
||||
include(mkrtos_cmake/extensions.cmake)
|
||||
include(mkrtos_cmake/python.cmake)
|
||||
include(mkrtos_cmake/kconfig.cmake)
|
||||
|
||||
Reference in New Issue
Block a user