mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 10:47:19 +02:00
Merge branch 'bugfix/various_cmake_fixes_v4.0' into 'release/v4.0'
CMake: Various backports See merge request espressif/esp-idf!5933
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
idf_component_register(SRCS "esp_tls.c"
|
idf_component_register(SRCS "esp_tls.c"
|
||||||
INCLUDE_DIRS "."
|
INCLUDE_DIRS "."
|
||||||
PRIVATE_INCLUDE_DIRS "private_include"
|
PRIV_INCLUDE_DIRS "private_include"
|
||||||
REQUIRES mbedtls
|
REQUIRES mbedtls
|
||||||
PRIV_REQUIRES lwip nghttp)
|
PRIV_REQUIRES lwip nghttp)
|
||||||
|
@ -10,7 +10,7 @@ ifneq ("$(filter esp32,$(TEST_COMPONENTS_LIST))","")
|
|||||||
CPPFLAGS += -DESP_TIMER_DYNAMIC_OVERFLOW_VAL
|
CPPFLAGS += -DESP_TIMER_DYNAMIC_OVERFLOW_VAL
|
||||||
endif
|
endif
|
||||||
ESP32_LINKER_SCRIPT_TEMPLATE := $(COMPONENT_PATH)/ld/esp32.project.ld.in
|
ESP32_LINKER_SCRIPT_TEMPLATE := $(COMPONENT_PATH)/ld/esp32.project.ld.in
|
||||||
ESP32_LINKER_SCRIPT_OUTPUT_DIR := $(abspath $(BUILD_DIR_BASE)/esp32)
|
ESP32_LINKER_SCRIPT_OUTPUT_DIR := $(realpath $(BUILD_DIR_BASE)/esp32)
|
||||||
|
|
||||||
# Target to generate linker script generator from fragments presented by each of
|
# Target to generate linker script generator from fragments presented by each of
|
||||||
# the components
|
# the components
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
--encrypt ${ESPTOOLPY_FLASH_PROJECT_OPTIONS}
|
--encrypt ${ESPTOOLPY_FLASH_PROJECT_OPTIONS}
|
||||||
$<JOIN:$<TARGET_PROPERTY:flash_project_args_target,FLASH_PROJECT_ARGS>,
|
$<JOIN:${FLASH_PROJECT_ARGS},
|
||||||
>
|
>
|
||||||
|
@ -19,17 +19,18 @@ set_property(TARGET mbedtls PROPERTY SOURCES ${src_tls})
|
|||||||
set(mbedtls_targets mbedtls mbedcrypto mbedx509)
|
set(mbedtls_targets mbedtls mbedcrypto mbedx509)
|
||||||
|
|
||||||
# Add port files to mbedtls targets
|
# Add port files to mbedtls targets
|
||||||
target_sources(mbedtls PRIVATE "${COMPONENT_DIR}/port/esp_bignum.c"
|
target_sources(mbedtls PRIVATE "${COMPONENT_DIR}/port/mbedtls_debug.c"
|
||||||
|
"${COMPONENT_DIR}/port/net_sockets.c")
|
||||||
|
|
||||||
|
target_sources(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/esp_bignum.c"
|
||||||
"${COMPONENT_DIR}/port/esp_hardware.c"
|
"${COMPONENT_DIR}/port/esp_hardware.c"
|
||||||
"${COMPONENT_PATH}/port/esp_sha.c"
|
"${COMPONENT_DIR}/port/esp_mem.c"
|
||||||
|
"${COMPONENT_DIR}/port/esp_sha.c"
|
||||||
"${COMPONENT_DIR}/port/esp_sha1.c"
|
"${COMPONENT_DIR}/port/esp_sha1.c"
|
||||||
"${COMPONENT_DIR}/port/esp_sha256.c"
|
"${COMPONENT_DIR}/port/esp_sha256.c"
|
||||||
"${COMPONENT_DIR}/port/esp_sha512.c"
|
"${COMPONENT_DIR}/port/esp_sha512.c"
|
||||||
"${COMPONENT_DIR}/port/mbedtls_debug.c"
|
|
||||||
"${COMPONENT_DIR}/port/net_sockets.c"
|
|
||||||
"${COMPONENT_DIR}/port/esp32/aes.c"
|
"${COMPONENT_DIR}/port/esp32/aes.c"
|
||||||
"${COMPONENT_DIR}/port/esp32/sha.c")
|
"${COMPONENT_DIR}/port/esp32/sha.c")
|
||||||
target_sources(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/esp_mem.c")
|
|
||||||
|
|
||||||
foreach(target ${mbedtls_targets})
|
foreach(target ${mbedtls_targets})
|
||||||
target_compile_definitions(${target} PUBLIC -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h")
|
target_compile_definitions(${target} PUBLIC -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h")
|
||||||
|
@ -5,5 +5,5 @@ idf_component_register(SRCS "transport.c"
|
|||||||
"transport_utils.c"
|
"transport_utils.c"
|
||||||
"transport_strcasestr.c"
|
"transport_strcasestr.c"
|
||||||
INCLUDE_DIRS "include"
|
INCLUDE_DIRS "include"
|
||||||
PRIVATE_INCLUDE_DIRS "private_include"
|
PRIV_INCLUDE_DIRS "private_include"
|
||||||
REQUIRES lwip esp-tls)
|
REQUIRES lwip esp-tls)
|
||||||
|
@ -973,7 +973,7 @@ The call requires the target chip to be specified with *target* argument. Option
|
|||||||
|
|
||||||
- PROJECT_DIR - directory of the project; defaults to CMAKE_SOURCE_DIR
|
- PROJECT_DIR - directory of the project; defaults to CMAKE_SOURCE_DIR
|
||||||
- PROJECT_NAME - name of the project; defaults to CMAKE_PROJECT_NAME
|
- PROJECT_NAME - name of the project; defaults to CMAKE_PROJECT_NAME
|
||||||
- PROJECT_VER - version/revision of the project; defaults to "0.0.0"
|
- PROJECT_VER - version/revision of the project; defaults to "1"
|
||||||
- SDKCONFIG - output path of generated sdkconfig file; defaults to PROJECT_DIR/sdkconfig or CMAKE_SOURCE_DIR/sdkconfig depending if PROJECT_DIR is set
|
- SDKCONFIG - output path of generated sdkconfig file; defaults to PROJECT_DIR/sdkconfig or CMAKE_SOURCE_DIR/sdkconfig depending if PROJECT_DIR is set
|
||||||
- SDKCONFIG_DEFAULTS - defaults file to use for the build; defaults to empty
|
- SDKCONFIG_DEFAULTS - defaults file to use for the build; defaults to empty
|
||||||
- BUILD_DIR - directory to place ESP-IDF build-related artifacts, such as generated binaries, text files, components; defaults to CMAKE_BINARY_DIR
|
- BUILD_DIR - directory to place ESP-IDF build-related artifacts, such as generated binaries, text files, components; defaults to CMAKE_BINARY_DIR
|
||||||
|
@ -510,6 +510,14 @@ endmenu\n" >> ${IDF_PATH}/Kconfig;
|
|||||||
mv CMakeLists.txt.bak CMakeLists.txt
|
mv CMakeLists.txt.bak CMakeLists.txt
|
||||||
rm -rf CMakeLists.txt.bak
|
rm -rf CMakeLists.txt.bak
|
||||||
|
|
||||||
|
print_status "Component properties are set"
|
||||||
|
clean_build_dir
|
||||||
|
cp CMakeLists.txt CMakeLists.txt.bak
|
||||||
|
printf "\nidf_component_get_property(srcs main SRCS)\nmessage(STATUS SRCS:\${srcs})" >> CMakeLists.txt
|
||||||
|
(idf.py reconfigure | grep "SRCS:$(realpath main/main.c)") || failure "Component properties should be set"
|
||||||
|
rm -rf CMakeLists.txt
|
||||||
|
mv CMakeLists.txt.bak CMakeLists.txt
|
||||||
|
rm -rf CMakeLists.txt.bak
|
||||||
|
|
||||||
print_status "All tests completed"
|
print_status "All tests completed"
|
||||||
if [ -n "${FAILURES}" ]; then
|
if [ -n "${FAILURES}" ]; then
|
||||||
|
@ -295,7 +295,7 @@ endmacro()
|
|||||||
#
|
#
|
||||||
macro(__build_set_default var default)
|
macro(__build_set_default var default)
|
||||||
set(_var __${var})
|
set(_var __${var})
|
||||||
if(${_var})
|
if(NOT "${_var}" STREQUAL "")
|
||||||
idf_build_set_property(${var} "${${_var}}")
|
idf_build_set_property(${var} "${${_var}}")
|
||||||
else()
|
else()
|
||||||
idf_build_set_property(${var} "${default}")
|
idf_build_set_property(${var} "${default}")
|
||||||
@ -330,7 +330,7 @@ endfunction()
|
|||||||
# @param[in, optional] PROJECT_DIR (single value) directory of the main project the buildsystem
|
# @param[in, optional] PROJECT_DIR (single value) directory of the main project the buildsystem
|
||||||
# is processed for; defaults to CMAKE_SOURCE_DIR
|
# is processed for; defaults to CMAKE_SOURCE_DIR
|
||||||
# @param[in, optional] PROJECT_VER (single value) version string of the main project; defaults
|
# @param[in, optional] PROJECT_VER (single value) version string of the main project; defaults
|
||||||
# to 0.0.0
|
# to 1
|
||||||
# @param[in, optional] PROJECT_NAME (single value) main project name, defaults to CMAKE_PROJECT_NAME
|
# @param[in, optional] PROJECT_NAME (single value) main project name, defaults to CMAKE_PROJECT_NAME
|
||||||
# @param[in, optional] SDKCONFIG (single value) sdkconfig output path, defaults to PROJECT_DIR/sdkconfig
|
# @param[in, optional] SDKCONFIG (single value) sdkconfig output path, defaults to PROJECT_DIR/sdkconfig
|
||||||
# if PROJECT_DIR is set and CMAKE_SOURCE_DIR/sdkconfig if not
|
# if PROJECT_DIR is set and CMAKE_SOURCE_DIR/sdkconfig if not
|
||||||
@ -366,7 +366,7 @@ macro(idf_build_process target)
|
|||||||
|
|
||||||
__build_set_default(PROJECT_DIR ${CMAKE_SOURCE_DIR})
|
__build_set_default(PROJECT_DIR ${CMAKE_SOURCE_DIR})
|
||||||
__build_set_default(PROJECT_NAME ${CMAKE_PROJECT_NAME})
|
__build_set_default(PROJECT_NAME ${CMAKE_PROJECT_NAME})
|
||||||
__build_set_default(PROJECT_VER "0.0.0")
|
__build_set_default(PROJECT_VER 1)
|
||||||
__build_set_default(BUILD_DIR ${CMAKE_BINARY_DIR})
|
__build_set_default(BUILD_DIR ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
idf_build_get_property(project_dir PROJECT_DIR)
|
idf_build_get_property(project_dir PROJECT_DIR)
|
||||||
|
@ -213,6 +213,7 @@ function(__component_get_requirements)
|
|||||||
__component_write_properties(${component_properties_file})
|
__component_write_properties(${component_properties_file})
|
||||||
|
|
||||||
execute_process(COMMAND "${CMAKE_COMMAND}"
|
execute_process(COMMAND "${CMAKE_COMMAND}"
|
||||||
|
-D "ESP_PLATFORM=1"
|
||||||
-D "BUILD_PROPERTIES_FILE=${build_properties_file}"
|
-D "BUILD_PROPERTIES_FILE=${build_properties_file}"
|
||||||
-D "COMPONENT_PROPERTIES_FILE=${component_properties_file}"
|
-D "COMPONENT_PROPERTIES_FILE=${component_properties_file}"
|
||||||
-D "COMPONENT_REQUIRES_FILE=${component_requires_file}"
|
-D "COMPONENT_REQUIRES_FILE=${component_requires_file}"
|
||||||
@ -232,10 +233,10 @@ function(__component_get_requirements)
|
|||||||
file(REMOVE ${component_requires_file})
|
file(REMOVE ${component_requires_file})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# __component_add_sources, __component_check_target
|
# __component_add_sources, __component_check_target, __component_add_include_dirs
|
||||||
#
|
#
|
||||||
# Utility macros for component registration. Adds source files and checks target requirements
|
# Utility macros for component registration. Adds source files and checks target requirements,
|
||||||
# respectively.
|
# and adds include directories respectively.
|
||||||
macro(__component_add_sources sources)
|
macro(__component_add_sources sources)
|
||||||
set(sources "")
|
set(sources "")
|
||||||
if(__SRCS)
|
if(__SRCS)
|
||||||
@ -279,6 +280,16 @@ macro(__component_add_sources sources)
|
|||||||
list(REMOVE_DUPLICATES sources)
|
list(REMOVE_DUPLICATES sources)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
macro(__component_add_include_dirs lib dirs type)
|
||||||
|
foreach(dir ${dirs})
|
||||||
|
get_filename_component(_dir ${dir} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
if(NOT IS_DIRECTORY ${_dir})
|
||||||
|
message(FATAL_ERROR "Include directory '${_dir}' is not a directory.")
|
||||||
|
endif()
|
||||||
|
target_include_directories(${lib} ${type} ${_dir})
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
macro(__component_check_target)
|
macro(__component_check_target)
|
||||||
if(__REQUIRED_IDF_TARGETS)
|
if(__REQUIRED_IDF_TARGETS)
|
||||||
idf_build_get_property(idf_target IDF_TARGET)
|
idf_build_get_property(idf_target IDF_TARGET)
|
||||||
@ -324,6 +335,7 @@ macro(__component_set_all_dependencies)
|
|||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
# idf_component_get_property
|
# idf_component_get_property
|
||||||
#
|
#
|
||||||
# @brief Retrieve the value of the specified component property
|
# @brief Retrieve the value of the specified component property
|
||||||
@ -436,16 +448,16 @@ function(idf_component_register)
|
|||||||
if(sources OR __EMBED_FILES OR __EMBED_TXTFILES)
|
if(sources OR __EMBED_FILES OR __EMBED_TXTFILES)
|
||||||
add_library(${component_lib} STATIC ${sources})
|
add_library(${component_lib} STATIC ${sources})
|
||||||
__component_set_property(${component_target} COMPONENT_TYPE LIBRARY)
|
__component_set_property(${component_target} COMPONENT_TYPE LIBRARY)
|
||||||
target_include_directories(${component_lib} PUBLIC ${__INCLUDE_DIRS})
|
__component_add_include_dirs(${component_lib} "${__INCLUDE_DIRS}" PUBLIC)
|
||||||
target_include_directories(${component_lib} PRIVATE ${__PRIV_INCLUDE_DIRS})
|
__component_add_include_dirs(${component_lib} "${__PRIV_INCLUDE_DIRS}" PRIVATE)
|
||||||
target_include_directories(${component_lib} PUBLIC ${config_dir})
|
__component_add_include_dirs(${component_lib} "${config_dir}" PUBLIC)
|
||||||
set_target_properties(${component_lib} PROPERTIES OUTPUT_NAME ${COMPONENT_NAME})
|
set_target_properties(${component_lib} PROPERTIES OUTPUT_NAME ${COMPONENT_NAME})
|
||||||
__ldgen_add_component(${component_lib})
|
__ldgen_add_component(${component_lib})
|
||||||
else()
|
else()
|
||||||
add_library(${component_lib} INTERFACE)
|
add_library(${component_lib} INTERFACE)
|
||||||
__component_set_property(${component_target} COMPONENT_TYPE CONFIG_ONLY)
|
__component_set_property(${component_target} COMPONENT_TYPE CONFIG_ONLY)
|
||||||
target_include_directories(${component_lib} INTERFACE ${__INCLUDE_DIRS})
|
__component_add_include_dirs(${component_lib} "${__INCLUDE_DIRS}" INTERFACE)
|
||||||
target_include_directories(${component_lib} INTERFACE ${config_dir})
|
__component_add_include_dirs(${component_lib} "${config_dir}" INTERFACE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Alias the static/interface library created for linking to external targets.
|
# Alias the static/interface library created for linking to external targets.
|
||||||
@ -479,6 +491,8 @@ function(idf_component_register)
|
|||||||
# COMPONENT_TARGET is deprecated but is made available with same function
|
# COMPONENT_TARGET is deprecated but is made available with same function
|
||||||
# as COMPONENT_LIB for compatibility.
|
# as COMPONENT_LIB for compatibility.
|
||||||
set(COMPONENT_TARGET ${component_lib} PARENT_SCOPE)
|
set(COMPONENT_TARGET ${component_lib} PARENT_SCOPE)
|
||||||
|
|
||||||
|
__component_set_properties()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -47,7 +47,7 @@ function(__kconfig_init)
|
|||||||
externalproject_add(mconf-idf
|
externalproject_add(mconf-idf
|
||||||
SOURCE_DIR ${src_path}
|
SOURCE_DIR ${src_path}
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
BINARY_DIR "kconfig_bin"
|
BINARY_DIR "${CMAKE_BINARY_DIR}/kconfig_bin"
|
||||||
BUILD_COMMAND rm -f ${src_path}/zconf.lex.c ${src_path}/zconf.hash.c
|
BUILD_COMMAND rm -f ${src_path}/zconf.lex.c ${src_path}/zconf.hash.c
|
||||||
COMMAND make -f ${src_path}/Makefile mconf-idf
|
COMMAND make -f ${src_path}/Makefile mconf-idf
|
||||||
BUILD_BYPRODUCTS ${MCONF}
|
BUILD_BYPRODUCTS ${MCONF}
|
||||||
|
@ -38,9 +38,9 @@ function(__project_get_revision var)
|
|||||||
if(PROJECT_VER_GIT)
|
if(PROJECT_VER_GIT)
|
||||||
set(PROJECT_VER ${PROJECT_VER_GIT})
|
set(PROJECT_VER ${PROJECT_VER_GIT})
|
||||||
else()
|
else()
|
||||||
message(STATUS "Project is not inside a git repository, \
|
message(STATUS "Project is not inside a git repository, or git repository has no commits;"
|
||||||
will not use 'git describe' to determine PROJECT_VER.")
|
" will not use 'git describe' to determine PROJECT_VER.")
|
||||||
set(PROJECT_VER "1")
|
set(PROJECT_VER 1)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -24,10 +24,12 @@ if(HEAD_CONTENTS MATCHES "ref")
|
|||||||
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
|
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
|
||||||
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
|
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
|
||||||
else()
|
else()
|
||||||
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
|
if(EXISTS "@GIT_DIR@/packed-refs")
|
||||||
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
|
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
|
||||||
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
|
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
|
||||||
set(HEAD_HASH "${CMAKE_MATCH_1}")
|
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
|
||||||
|
set(HEAD_HASH "${CMAKE_MATCH_1}")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
|
Reference in New Issue
Block a user