mirror of
https://github.com/espressif/openthread.git
synced 2026-10-19 14:08:13 +00:00
[cmake] generate a mbedtls-config.h without private headers (#5084)
This commit is contained in:
Vendored
+23
-1
@@ -26,15 +26,37 @@
|
|||||||
# POSSIBILITY OF SUCH DAMAGE.
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
#
|
#
|
||||||
|
|
||||||
set(OT_MBEDTLS_DEFAULT_CONFIG_FILE \"${CMAKE_CURRENT_SOURCE_DIR}/mbedtls-config.h\")
|
set(OT_MBEDTLS_DEFAULT_CONFIG_FILE \"${CMAKE_CURRENT_BINARY_DIR}/mbedtls-config.h\")
|
||||||
|
|
||||||
set(OT_MBEDTLS_CONFIG_FILE "" CACHE STRING "The mbedTLS config file")
|
set(OT_MBEDTLS_CONFIG_FILE "" CACHE STRING "The mbedTLS config file")
|
||||||
|
|
||||||
set(ENABLE_TESTING OFF CACHE BOOL "Disable mbedtls test" FORCE)
|
set(ENABLE_TESTING OFF CACHE BOOL "Disable mbedtls test" FORCE)
|
||||||
set(ENABLE_PROGRAMS OFF CACHE BOOL "Disable mbetls program" FORCE)
|
set(ENABLE_PROGRAMS OFF CACHE BOOL "Disable mbetls program" FORCE)
|
||||||
|
|
||||||
|
find_program(UNIFDEFALL_EXE unifdefall)
|
||||||
|
find_program(SED_EXE sed)
|
||||||
|
|
||||||
add_subdirectory(repo)
|
add_subdirectory(repo)
|
||||||
|
|
||||||
|
if(UNIFDEFALL_EXE AND SED_EXE)
|
||||||
|
add_custom_target(mbedtls-config.h
|
||||||
|
${UNIFDEFALL_EXE}
|
||||||
|
"'-D$<JOIN:$<TARGET_PROPERTY:ot-config,INTERFACE_COMPILE_DEFINITIONS>,';'-D>'"
|
||||||
|
"-I$<JOIN:$<TARGET_PROPERTY:ot-config,INTERFACE_INCLUDE_DIRECTORIES>,;-I>"
|
||||||
|
"-I$<JOIN:${OT_PUBLIC_INCLUDES},;-I>"
|
||||||
|
"-I${CMAKE_CURRENT_SOURCE_DIR}/repo/include"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/mbedtls-config.h" |
|
||||||
|
${SED_EXE} '/openthread-core-config\.h/d' >
|
||||||
|
${OT_MBEDTLS_DEFAULT_CONFIG_FILE}
|
||||||
|
COMMAND_EXPAND_LISTS
|
||||||
|
)
|
||||||
|
add_dependencies(mbedtls mbedtls-config.h)
|
||||||
|
add_dependencies(mbedx509 mbedtls-config.h)
|
||||||
|
add_dependencies(mbedcrypto mbedtls-config.h)
|
||||||
|
else()
|
||||||
|
configure_file(mbedtls-config.h mbedtls-config.h COPYONLY)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(mbedtls
|
target_compile_definitions(mbedtls
|
||||||
PUBLIC
|
PUBLIC
|
||||||
"MBEDTLS_CONFIG_FILE=$<IF:$<BOOL:${OT_MBEDTLS_CONFIG_FILE}>,${OT_MBEDTLS_CONFIG_FILE},${OT_MBEDTLS_DEFAULT_CONFIG_FILE}>"
|
"MBEDTLS_CONFIG_FILE=$<IF:$<BOOL:${OT_MBEDTLS_CONFIG_FILE}>,${OT_MBEDTLS_CONFIG_FILE},${OT_MBEDTLS_DEFAULT_CONFIG_FILE}>"
|
||||||
|
|||||||
Vendored
+7
-4
@@ -26,7 +26,9 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MBEDTLS_CONFIG_H
|
// Spans multiple lines to avoid being processed by unifdef
|
||||||
|
#ifndef \
|
||||||
|
MBEDTLS_CONFIG_H
|
||||||
#define MBEDTLS_CONFIG_H
|
#define MBEDTLS_CONFIG_H
|
||||||
|
|
||||||
#include "openthread-core-config.h"
|
#include "openthread-core-config.h"
|
||||||
@@ -76,8 +78,7 @@
|
|||||||
#define MBEDTLS_SSL_PROTO_DTLS
|
#define MBEDTLS_SSL_PROTO_DTLS
|
||||||
#define MBEDTLS_SSL_TLS_C
|
#define MBEDTLS_SSL_TLS_C
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE || OPENTHREAD_CONFIG_COMMISSIONER_ENABLE || \
|
#if OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE || OPENTHREAD_CONFIG_COMMISSIONER_ENABLE || OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE
|
||||||
OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE
|
|
||||||
#define MBEDTLS_SSL_COOKIE_C
|
#define MBEDTLS_SSL_COOKIE_C
|
||||||
#define MBEDTLS_SSL_SRV_C
|
#define MBEDTLS_SSL_SRV_C
|
||||||
#endif
|
#endif
|
||||||
@@ -129,7 +130,9 @@
|
|||||||
|
|
||||||
#define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8
|
#define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8
|
||||||
|
|
||||||
#if defined(MBEDTLS_USER_CONFIG_FILE)
|
// Spans multiple lines to avoid being processed by unifdef
|
||||||
|
#if defined(\
|
||||||
|
MBEDTLS_USER_CONFIG_FILE)
|
||||||
#include MBEDTLS_USER_CONFIG_FILE
|
#include MBEDTLS_USER_CONFIG_FILE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user