mirror of
https://github.com/eclipse/wakaama.git
synced 2025-05-08 23:31:37 +08:00
cmake: Allow transport layer selection from CMake
The implementation of the transport layer can now be selected with a CMake cache variable.
This commit is contained in:
parent
206b688781
commit
5d42449283
@ -91,7 +91,15 @@ The logging infrastructure can be configured with CMake cache variables (e.g. `c
|
||||
- WAKAAMA_LOG_CUSTOM_HANDLER: Set this define to provide a custom handler function for log entries. See the default implementation for details.
|
||||
- WAKAAMA_LOG_MAX_MSG_TXT_SIZE: The max. size of the formatted log message. This is only the message without additional data like severity and function name.
|
||||
|
||||
### Transport
|
||||
|
||||
- WAKAAMA_TRANSPORT: Select the implementation of the transport layer. One of:
|
||||
- POSIX_UDP: A simple UDP implementation using the POSIX socket API.
|
||||
- TINYDTLS: Use DTLS with the 'tinydtls' library.
|
||||
- TESTING: A special transport layer used for unit testing.
|
||||
- NONE: No transport layer is provided.
|
||||
|
||||
If `NONE` is chosen, the user of Wakaama needs to implement a custom transport layer. Check the available implementations for more information.
|
||||
|
||||
## Development
|
||||
|
||||
|
@ -65,6 +65,13 @@ set(WAKAAMA_LOG_MAX_MSG_TXT_SIZE
|
||||
CACHE STRING "The buffer size for the log message (without additional data)"
|
||||
)
|
||||
|
||||
# Transport
|
||||
set(WAKAAMA_TRANSPORT
|
||||
NONE
|
||||
CACHE STRING "The transport layer implementation"
|
||||
)
|
||||
set_property(CACHE WAKAAMA_TRANSPORT PROPERTY STRINGS NONE POSIX_UDP TINYDTLS TESTING)
|
||||
|
||||
# Possibility to disable the examples
|
||||
option(WAKAAMA_ENABLE_EXAMPLES "Build all the example applications" ON)
|
||||
|
||||
@ -241,10 +248,10 @@ function(target_sources_shared target)
|
||||
|
||||
set_defines(${target})
|
||||
|
||||
if(NOT TARGET_PROPERTY_CONN_IMPL)
|
||||
if(NOT TARGET_PROPERTY_CONN_IMPL OR WAKAAMA_TRANSPORT STREQUAL POSIX_UDP)
|
||||
target_sources(${target} PRIVATE ${WAKAAMA_TOP_LEVEL_DIRECTORY}/transport/udp/connection.c)
|
||||
target_include_directories(${target} PUBLIC ${WAKAAMA_TOP_LEVEL_DIRECTORY}/transport/udp/include)
|
||||
elseif(TARGET_PROPERTY_CONN_IMPL MATCHES "tinydtls")
|
||||
elseif(TARGET_PROPERTY_CONN_IMPL MATCHES "tinydtls" OR WAKAAMA_TRANSPORT STREQUAL TINYDTLS)
|
||||
include(${WAKAAMA_TOP_LEVEL_DIRECTORY}/transport/tinydtls/tinydtls.cmake)
|
||||
target_sources(${target} PRIVATE ${WAKAAMA_TOP_LEVEL_DIRECTORY}/transport/tinydtls/connection.c)
|
||||
target_compile_definitions(${target} PRIVATE WITH_TINYDTLS)
|
||||
@ -253,7 +260,7 @@ function(target_sources_shared target)
|
||||
${WAKAAMA_TOP_LEVEL_DIRECTORY}/transport/tinydtls/third_party
|
||||
)
|
||||
target_sources_tinydtls(${target})
|
||||
elseif(TARGET_PROPERTY_CONN_IMPL MATCHES "testing")
|
||||
elseif(TARGET_PROPERTY_CONN_IMPL MATCHES "testing" OR WAKAAMA_TRANSPORT STREQUAL TESTING)
|
||||
target_include_directories(${target} PRIVATE ${WAKAAMA_TOP_LEVEL_DIRECTORY}/tests/helper/)
|
||||
target_sources(${target} PRIVATE ${WAKAAMA_TOP_LEVEL_DIRECTORY}/tests/helper/connection.c)
|
||||
else()
|
||||
|
Loading…
x
Reference in New Issue
Block a user