mirror of
https://github.com/espressif/openthread.git
synced 2026-08-18 08:29:52 +00:00
[cmake] enable user specified mbedtls target (#4812)
This commit allows users to specify the mbedtls target by a OT_EXTERNAL_MBEDTLS option. The native cmake build system of mbedtls is not so "modern" (for backward compatibility, it maybe hard to change it soon) and applications using mbedtls are likely to write wrapper cmake files and targets by themselves.
This commit is contained in:
+1
-1
@@ -30,8 +30,8 @@ cmake_minimum_required(VERSION 3.13.1)
|
||||
project(openthread)
|
||||
|
||||
option(OT_BUILD_EXECUTABLES "Build executables" ON)
|
||||
option(OT_BUILTIN_MBEDTLS "Enable builtin mbedTLS" ON)
|
||||
option(OT_COVERAGE "enable coverage" OFF)
|
||||
set(OT_EXTERNAL_MBEDTLS "" CACHE STRING "Specify external mbedtls library")
|
||||
|
||||
include(TestBigEndian)
|
||||
TEST_BIG_ENDIAN(OT_BIG_ENDIAN)
|
||||
|
||||
@@ -41,9 +41,11 @@ if(OT_BORDER_ROUTER)
|
||||
list(APPEND OT_PRIVATE_DEFINES "OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
if(OT_BUILTIN_MBEDTLS)
|
||||
if(NOT OT_EXTERNAL_MBEDTLS)
|
||||
set(OT_MBEDTLS mbedtls)
|
||||
list(APPEND OT_PRIVATE_DEFINES "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=1")
|
||||
else()
|
||||
set(OT_MBEDTLS ${OT_EXTERNAL_MBEDTLS})
|
||||
list(APPEND OT_PRIVATE_DEFINES "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=0")
|
||||
endif()
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ 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"
|
||||
mbedtls
|
||||
${OT_MBEDTLS}
|
||||
)
|
||||
target_link_options(openthread-cc1352
|
||||
PUBLIC
|
||||
|
||||
@@ -71,7 +71,7 @@ target_link_libraries(openthread-cc2650
|
||||
PUBLIC
|
||||
cc26x0-driver
|
||||
PRIVATE
|
||||
mbedtls
|
||||
${OT_MBEDTLS}
|
||||
openthread-platform-utils
|
||||
)
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ set_property(TARGET openthread-cc2652 PROPERTY C_STANDARD 99)
|
||||
target_link_libraries(openthread-cc2652
|
||||
PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/third_party/ti/devices/cc13x2_cc26x2/driverlib/bin/gcc/driverlib.a"
|
||||
mbedtls
|
||||
${OT_MBEDTLS}
|
||||
)
|
||||
target_link_options(openthread-cc2652
|
||||
PUBLIC
|
||||
|
||||
@@ -72,7 +72,7 @@ set_property(TARGET openthread-qpg6095 PROPERTY C_STANDARD 99)
|
||||
target_link_libraries(openthread-qpg6095
|
||||
PRIVATE
|
||||
qpg6095-driver
|
||||
mbedtls
|
||||
${OT_MBEDTLS}
|
||||
)
|
||||
|
||||
target_link_options(openthread-qpg6095
|
||||
|
||||
@@ -70,7 +70,7 @@ target_link_libraries(openthread-samr21
|
||||
PUBLIC
|
||||
samr21-driver
|
||||
PRIVATE
|
||||
mbedtls
|
||||
${OT_MBEDTLS}
|
||||
)
|
||||
|
||||
target_link_options(openthread-samr21
|
||||
|
||||
@@ -83,12 +83,12 @@ target_link_libraries(openthread-cli-ftd
|
||||
PUBLIC
|
||||
openthread-ftd
|
||||
PRIVATE
|
||||
mbedtls
|
||||
${OT_MBEDTLS}
|
||||
)
|
||||
|
||||
target_link_libraries(openthread-cli-mtd
|
||||
PUBLIC
|
||||
openthread-mtd
|
||||
PRIVATE
|
||||
mbedtls
|
||||
${OT_MBEDTLS}
|
||||
)
|
||||
|
||||
@@ -245,10 +245,10 @@ target_sources(openthread-radio PRIVATE
|
||||
|
||||
target_link_libraries(openthread-ftd
|
||||
PRIVATE
|
||||
mbedtls
|
||||
${OT_MBEDTLS}
|
||||
)
|
||||
|
||||
target_link_libraries(openthread-mtd
|
||||
PRIVATE
|
||||
mbedtls
|
||||
${OT_MBEDTLS}
|
||||
)
|
||||
|
||||
@@ -105,7 +105,7 @@ target_link_libraries(openthread-ncp-ftd
|
||||
PUBLIC
|
||||
openthread-ftd
|
||||
PRIVATE
|
||||
mbedtls
|
||||
${OT_MBEDTLS}
|
||||
openthread-hdlc
|
||||
openthread-spinel-ncp
|
||||
)
|
||||
@@ -114,7 +114,7 @@ target_link_libraries(openthread-ncp-mtd
|
||||
PUBLIC
|
||||
openthread-mtd
|
||||
PRIVATE
|
||||
mbedtls
|
||||
${OT_MBEDTLS}
|
||||
openthread-hdlc
|
||||
openthread-spinel-ncp
|
||||
)
|
||||
|
||||
@@ -34,7 +34,7 @@ set(COMMON_SOURCES
|
||||
set(COMMON_LIBS
|
||||
openthread-ftd
|
||||
openthread-ncp-ftd
|
||||
mbedtls
|
||||
${OT_MBEDTLS}
|
||||
util
|
||||
)
|
||||
|
||||
|
||||
Vendored
+2
-1
@@ -26,9 +26,10 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
if(OT_BUILTIN_MBEDTLS)
|
||||
if(NOT OT_EXTERNAL_MBEDTLS)
|
||||
add_subdirectory(mbedtls)
|
||||
endif()
|
||||
|
||||
if(OT_PLATFORM STREQUAL "kw41z")
|
||||
add_subdirectory(nxp)
|
||||
elseif(OT_PLATFORM STREQUAL "cc2650")
|
||||
|
||||
Reference in New Issue
Block a user