cmake: Ported mbedTLS to use Zephyr interface libraries
mbedTLS include directories will now default to be in the 'app' include path when mbedTLS has been enabled. Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This commit is contained in:
parent
3c8331d390
commit
6f642a19fd
|
@ -1,4 +1,4 @@
|
||||||
add_library(mbedTLS INTERFACE)
|
zephyr_interface_library_named(mbedTLS)
|
||||||
target_compile_definitions(mbedTLS INTERFACE
|
target_compile_definitions(mbedTLS INTERFACE
|
||||||
MBEDTLS_CONFIG_FILE="${CONFIG_MBEDTLS_CFG_FILE}"
|
MBEDTLS_CONFIG_FILE="${CONFIG_MBEDTLS_CFG_FILE}"
|
||||||
)
|
)
|
||||||
|
|
|
@ -98,3 +98,12 @@ config MBEDTLS_HEAP_SIZE
|
||||||
application. For server application 15000 bytes should be enough.
|
application. For server application 15000 bytes should be enough.
|
||||||
For some dedicated and specific usage of mbedtls API, the 1000 bytes
|
For some dedicated and specific usage of mbedtls API, the 1000 bytes
|
||||||
might be ok.
|
might be ok.
|
||||||
|
|
||||||
|
config APP_LINK_WITH_MBEDTLS
|
||||||
|
bool "Link 'app' with MBEDTLS"
|
||||||
|
default y
|
||||||
|
depends on MBEDTLS
|
||||||
|
help
|
||||||
|
Add MBEDTLS header files to the 'app' include path. It may be
|
||||||
|
disabled if the include paths for MBEDTLS are causing aliasing
|
||||||
|
issues for 'app'.
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
||||||
project(NONE)
|
project(NONE)
|
||||||
|
|
||||||
target_link_libraries(app mbedTLS)
|
|
||||||
|
|
||||||
FILE(GLOB app_sources src/*.c)
|
FILE(GLOB app_sources src/*.c)
|
||||||
target_sources(app PRIVATE ${app_sources})
|
target_sources(app PRIVATE ${app_sources})
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
||||||
project(NONE)
|
project(NONE)
|
||||||
|
|
||||||
target_link_libraries(app mbedTLS)
|
|
||||||
|
|
||||||
FILE(GLOB app_sources src/*.c)
|
FILE(GLOB app_sources src/*.c)
|
||||||
target_sources(app PRIVATE ${app_sources})
|
target_sources(app PRIVATE ${app_sources})
|
||||||
|
|
|
@ -6,5 +6,3 @@ target_sources_ifdef(CONFIG_NET_UDP app PRIVATE src/udp.c)
|
||||||
target_sources_ifdef(CONFIG_NET_TCP app PRIVATE src/tcp.c)
|
target_sources_ifdef(CONFIG_NET_TCP app PRIVATE src/tcp.c)
|
||||||
|
|
||||||
include($ENV{ZEPHYR_BASE}/samples/net/common/common.cmake)
|
include($ENV{ZEPHYR_BASE}/samples/net/common/common.cmake)
|
||||||
|
|
||||||
target_link_libraries_ifdef(CONFIG_MBEDTLS app mbedTLS)
|
|
||||||
|
|
|
@ -6,5 +6,3 @@ target_sources_ifdef(CONFIG_NET_UDP app PRIVATE src/udp.c)
|
||||||
target_sources_ifdef(CONFIG_NET_TCP app PRIVATE src/tcp.c)
|
target_sources_ifdef(CONFIG_NET_TCP app PRIVATE src/tcp.c)
|
||||||
|
|
||||||
include($ENV{ZEPHYR_BASE}/samples/net/common/common.cmake)
|
include($ENV{ZEPHYR_BASE}/samples/net/common/common.cmake)
|
||||||
|
|
||||||
target_link_libraries_ifdef(CONFIG_MBEDTLS app mbedTLS)
|
|
||||||
|
|
|
@ -19,5 +19,3 @@ foreach(inc_file
|
||||||
${ZEPHYR_BINARY_DIR}/include/generated/${inc_file}.inc
|
${ZEPHYR_BINARY_DIR}/include/generated/${inc_file}.inc
|
||||||
)
|
)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
target_link_libraries_ifdef(CONFIG_MBEDTLS app mbedTLS)
|
|
||||||
|
|
|
@ -5,5 +5,3 @@ FILE(GLOB app_sources src/*.c)
|
||||||
target_sources(app PRIVATE ${app_sources})
|
target_sources(app PRIVATE ${app_sources})
|
||||||
|
|
||||||
include($ENV{ZEPHYR_BASE}/samples/net/common/common.cmake)
|
include($ENV{ZEPHYR_BASE}/samples/net/common/common.cmake)
|
||||||
|
|
||||||
target_link_libraries_ifdef(CONFIG_MBEDTLS app mbedTLS)
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
||||||
project(NONE)
|
project(NONE)
|
||||||
|
|
||||||
target_link_libraries(app mbedTLS)
|
|
||||||
|
|
||||||
FILE(GLOB app_sources src/*.c)
|
FILE(GLOB app_sources src/*.c)
|
||||||
target_sources(app PRIVATE ${app_sources})
|
target_sources(app PRIVATE ${app_sources})
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
||||||
project(NONE)
|
project(NONE)
|
||||||
|
|
||||||
target_link_libraries(app mbedTLS)
|
|
||||||
|
|
||||||
FILE(GLOB app_sources src/*.c)
|
FILE(GLOB app_sources src/*.c)
|
||||||
target_sources(app PRIVATE ${app_sources})
|
target_sources(app PRIVATE ${app_sources})
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
||||||
project(NONE)
|
project(NONE)
|
||||||
|
|
||||||
target_link_libraries(app mbedTLS)
|
|
||||||
|
|
||||||
FILE(GLOB app_sources src/*.c)
|
FILE(GLOB app_sources src/*.c)
|
||||||
target_sources(app PRIVATE ${app_sources})
|
target_sources(app PRIVATE ${app_sources})
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
||||||
project(NONE)
|
project(NONE)
|
||||||
|
|
||||||
target_link_libraries(app mbedTLS)
|
|
||||||
FILE(GLOB app_sources src/*.c)
|
FILE(GLOB app_sources src/*.c)
|
||||||
target_sources(app PRIVATE ${app_sources})
|
target_sources(app PRIVATE ${app_sources})
|
||||||
|
|
|
@ -5,8 +5,5 @@ target_include_directories(app PRIVATE
|
||||||
$ENV{ZEPHYR_BASE}/subsys/net/ip
|
$ENV{ZEPHYR_BASE}/subsys/net/ip
|
||||||
$ENV{ZEPHYR_BASE}/subsys/net/lib/mqtt
|
$ENV{ZEPHYR_BASE}/subsys/net/lib/mqtt
|
||||||
)
|
)
|
||||||
if(CONFIG_MBEDTLS)
|
|
||||||
target_link_libraries(app mbedTLS)
|
|
||||||
endif()
|
|
||||||
FILE(GLOB app_sources src/*.c)
|
FILE(GLOB app_sources src/*.c)
|
||||||
target_sources(app PRIVATE ${app_sources})
|
target_sources(app PRIVATE ${app_sources})
|
||||||
|
|
Loading…
Reference in a new issue