mirror of
https://github.com/espressif/openthread.git
synced 2026-08-05 18:37:45 +00:00
[mbedtls] leverage cmake provided by mbedtls (#4803)
This commit is contained in:
@@ -35,11 +35,12 @@ endif()
|
||||
|
||||
list(APPEND OT_PLATFORM_DEFINES
|
||||
"OPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=\"openthread-core-cc1352-config-check.h\""
|
||||
"MBEDTLS_CONFIG_FILE=\"mbedtls-config.h\""
|
||||
)
|
||||
set(OT_PLATFORM_DEFINES ${OT_PLATFORM_DEFINES} PARENT_SCOPE)
|
||||
|
||||
list(APPEND OT_PRIVATE_DEFINES "MBEDTLS_USER_CONFIG_FILE=\"cc1352-mbedtls-config.h\"")
|
||||
set(OT_PRIVATE_DEFINES ${OT_PRIVATE_DEFINES} PARENT_SCOPE)
|
||||
|
||||
list(APPEND OT_PUBLIC_INCLUDES
|
||||
"${PROJECT_SOURCE_DIR}/examples/platforms/cc1352/crypto"
|
||||
"${PROJECT_SOURCE_DIR}/third_party/ti/devices/cc13x2_cc26x2"
|
||||
@@ -66,9 +67,19 @@ add_library(openthread-cc1352
|
||||
|
||||
set_property(TARGET openthread-cc1352 PROPERTY C_STANDARD 99)
|
||||
|
||||
target_link_libraries(openthread-cc1352 PRIVATE "${PROJECT_SOURCE_DIR}/third_party/ti/devices/cc13x2_cc26x2/driverlib/bin/gcc/driverlib.a")
|
||||
target_link_options(openthread-cc1352 PUBLIC -T${PROJECT_SOURCE_DIR}/third_party/ti/devices/cc13x2_cc26x2/linker_files/cc26x2r1f.lds)
|
||||
target_link_options(openthread-cc1352 PUBLIC -Wl,-Map=$<TARGET_PROPERTY:NAME>.map)
|
||||
target_link_libraries(openthread-cc1352
|
||||
PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/third_party/ti/devices/cc13x2_cc26x2/driverlib/bin/gcc/driverlib.a"
|
||||
mbedtls
|
||||
)
|
||||
target_link_options(openthread-cc1352
|
||||
PUBLIC
|
||||
-T${PROJECT_SOURCE_DIR}/third_party/ti/devices/cc13x2_cc26x2/linker_files/cc26x2r1f.lds
|
||||
)
|
||||
target_link_options(openthread-cc1352
|
||||
PUBLIC
|
||||
-Wl,-Map=$<TARGET_PROPERTY:NAME>.map
|
||||
)
|
||||
|
||||
target_compile_definitions(openthread-cc1352
|
||||
PUBLIC
|
||||
|
||||
@@ -82,9 +82,13 @@ target_sources(openthread-cli-mtd PRIVATE ${COMMON_SOURCES})
|
||||
target_link_libraries(openthread-cli-ftd
|
||||
PUBLIC
|
||||
openthread-ftd
|
||||
PRIVATE
|
||||
mbedtls
|
||||
)
|
||||
|
||||
target_link_libraries(openthread-cli-mtd
|
||||
PUBLIC
|
||||
openthread-mtd
|
||||
PRIVATE
|
||||
mbedtls
|
||||
)
|
||||
|
||||
+8
-10
@@ -243,14 +243,12 @@ target_sources(openthread-radio PRIVATE
|
||||
utils/parse_cmdline.cpp
|
||||
)
|
||||
|
||||
if(OT_BUILTIN_MBEDTLS)
|
||||
target_link_libraries(openthread-ftd
|
||||
PUBLIC
|
||||
mbedcrypto
|
||||
)
|
||||
target_link_libraries(openthread-ftd
|
||||
PRIVATE
|
||||
mbedtls
|
||||
)
|
||||
|
||||
target_link_libraries(openthread-mtd
|
||||
PUBLIC
|
||||
mbedcrypto
|
||||
)
|
||||
endif()
|
||||
target_link_libraries(openthread-mtd
|
||||
PRIVATE
|
||||
mbedtls
|
||||
)
|
||||
|
||||
@@ -105,6 +105,7 @@ target_link_libraries(openthread-ncp-ftd
|
||||
PUBLIC
|
||||
openthread-ftd
|
||||
PRIVATE
|
||||
mbedtls
|
||||
openthread-hdlc
|
||||
openthread-spinel-ncp
|
||||
)
|
||||
@@ -113,6 +114,7 @@ target_link_libraries(openthread-ncp-mtd
|
||||
PUBLIC
|
||||
openthread-mtd
|
||||
PRIVATE
|
||||
mbedtls
|
||||
openthread-hdlc
|
||||
openthread-spinel-ncp
|
||||
)
|
||||
|
||||
Vendored
+39
-56
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2019, The OpenThread Authors.
|
||||
# Copyright (c) 2020, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@@ -26,73 +26,56 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
add_library(mbedcrypto)
|
||||
|
||||
set(OT_MBEDTLS_DEFAULT_CONFIG_FILE "\"mbedtls-config.h\"")
|
||||
set(OT_MBEDTLS_DEFAULT_CONFIG_FILE \"${CMAKE_CURRENT_SOURCE_DIR}/mbedtls-config.h\")
|
||||
|
||||
set(OT_MBEDTLS_CONFIG_FILE "" CACHE STRING "The mbedTLS config file")
|
||||
|
||||
set(ENABLE_TESTING OFF CACHE BOOL "Disable mbedtls test" FORCE)
|
||||
set(ENABLE_PROGRAMS OFF CACHE BOOL "Disable mbetls program" FORCE)
|
||||
|
||||
add_subdirectory(repo)
|
||||
|
||||
target_compile_definitions(mbedtls
|
||||
PUBLIC
|
||||
"MBEDTLS_CONFIG_FILE=$<IF:$<BOOL:${OT_MBEDTLS_CONFIG_FILE}>,${OT_MBEDTLS_CONFIG_FILE},${OT_MBEDTLS_DEFAULT_CONFIG_FILE}>"
|
||||
PRIVATE
|
||||
${OT_PRIVATE_DEFINES}
|
||||
)
|
||||
target_include_directories(mbedtls
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/repo/include
|
||||
PRIVATE
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
${OT_PRIVATE_INCLUDES}
|
||||
${PROJECT_SOURCE_DIR}/src/core
|
||||
)
|
||||
|
||||
target_compile_definitions(mbedx509
|
||||
PUBLIC
|
||||
"MBEDTLS_CONFIG_FILE=$<IF:$<BOOL:${OT_MBEDTLS_CONFIG_FILE}>,${OT_MBEDTLS_CONFIG_FILE},${OT_MBEDTLS_DEFAULT_CONFIG_FILE}>"
|
||||
PRIVATE
|
||||
${OT_PRIVATE_DEFINES}
|
||||
)
|
||||
target_include_directories(mbedx509
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/repo/include
|
||||
PRIVATE
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
${OT_PRIVATE_INCLUDES}
|
||||
${PROJECT_SOURCE_DIR}/src/core
|
||||
)
|
||||
|
||||
target_compile_definitions(mbedcrypto
|
||||
PUBLIC
|
||||
"MBEDTLS_CONFIG_FILE=$<IF:$<BOOL:${OT_MBEDTLS_CONFIG_FILE}>,${OT_MBEDTLS_CONFIG_FILE},${OT_MBEDTLS_DEFAULT_CONFIG_FILE}>"
|
||||
PRIVATE
|
||||
${OT_PRIVATE_DEFINES}
|
||||
)
|
||||
|
||||
target_include_directories(mbedcrypto
|
||||
PUBLIC
|
||||
${PROJECT_SOURCE_DIR}/third_party/mbedtls/repo/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/repo/include
|
||||
PRIVATE
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
${OT_PRIVATE_INCLUDES}
|
||||
)
|
||||
|
||||
if (NOT OT_MBEDTLS_CONFIG_FILE)
|
||||
target_include_directories(mbedcrypto
|
||||
PUBLIC
|
||||
${PROJECT_SOURCE_DIR}/src/core
|
||||
${PROJECT_SOURCE_DIR}/third_party/mbedtls
|
||||
)
|
||||
endif()
|
||||
|
||||
target_sources(mbedcrypto PRIVATE
|
||||
repo/library/aes.c
|
||||
repo/library/asn1parse.c
|
||||
repo/library/asn1write.c
|
||||
repo/library/base64.c
|
||||
repo/library/bignum.c
|
||||
repo/library/ccm.c
|
||||
repo/library/cipher.c
|
||||
repo/library/cipher_wrap.c
|
||||
repo/library/cmac.c
|
||||
repo/library/ctr_drbg.c
|
||||
repo/library/debug.c
|
||||
repo/library/ecdh.c
|
||||
repo/library/ecdsa.c
|
||||
repo/library/ecjpake.c
|
||||
repo/library/ecp.c
|
||||
repo/library/ecp_curves.c
|
||||
repo/library/entropy.c
|
||||
repo/library/entropy_poll.c
|
||||
repo/library/md.c
|
||||
repo/library/md_wrap.c
|
||||
repo/library/memory_buffer_alloc.c
|
||||
repo/library/oid.c
|
||||
repo/library/pem.c
|
||||
repo/library/pk.c
|
||||
repo/library/pk_wrap.c
|
||||
repo/library/pkparse.c
|
||||
repo/library/platform.c
|
||||
repo/library/platform_util.c
|
||||
repo/library/sha256.c
|
||||
repo/library/ssl_cookie.c
|
||||
repo/library/ssl_ciphersuites.c
|
||||
repo/library/ssl_cli.c
|
||||
repo/library/ssl_srv.c
|
||||
repo/library/ssl_ticket.c
|
||||
repo/library/ssl_tls.c
|
||||
repo/library/threading.c
|
||||
repo/library/timing.c
|
||||
repo/library/x509.c
|
||||
repo/library/x509_crt.c
|
||||
${PROJECT_SOURCE_DIR}/src/core
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user