components: update with build system changes

This commit is contained in:
Renz Christian Bagaporo
2019-05-10 10:53:08 +08:00
parent ee92352bf8
commit ffec9d4947
49 changed files with 329 additions and 307 deletions
+19 -29
View File
@@ -18,7 +18,7 @@ function(project)
endfunction()
# Needed to for include_next includes to work from within mbedtls
include_directories("${COMPONENT_PATH}/port/include")
include_directories("${COMPONENT_DIR}/port/include")
# Workaround issue with creating symbolic links due to issues with native
# path conversion (TO_NATIVE_PATH). The following summarizes what CMake invocations
@@ -46,20 +46,21 @@ if(CMAKE_HOST_WIN32)
"mbedtls/scripts")
foreach(target_link ${target_links})
file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/${target_link} link)
file(TO_NATIVE_PATH ${COMPONENT_PATH}/${target_link} target)
file(TO_NATIVE_PATH ${COMPONENT_DIR}/${target_link} target)
idf_build_get_property(python PYTHON)
if(NOT EXISTS ${link})
if (IS_DIRECTORY ${target})
set(command ${PYTHON} ${COMPONENT_PATH}/mklink.py /j ${link} ${target})
if(IS_DIRECTORY ${target})
set(command ${python} ${COMPONENT_DIR}/mklink.py /j ${link} ${target})
else()
set(command ${PYTHON} ${COMPONENT_PATH}/mklink.py /h ${link} ${target})
set(command ${python} ${COMPONENT_DIR}/mklink.py /h ${link} ${target})
endif()
execute_process(COMMAND ${command}
RESULT_VARIABLE result
ERROR_VARIABLE output)
if (NOT ${result} EQUAL 0)
if(NOT ${result} EQUAL 0)
message(FATAL_ERROR "Could not create symbolic link for: ${target} --> ${output}")
endif()
endif()
@@ -78,37 +79,26 @@ set_property(TARGET mbedtls PROPERTY SOURCES ${src_tls})
set(mbedtls_targets mbedtls mbedcrypto mbedx509)
# Add port files to mbedtls targets
target_sources(mbedtls PRIVATE "${COMPONENT_PATH}/port/esp_bignum.c"
"${COMPONENT_PATH}/port/esp_hardware.c"
"${COMPONENT_PATH}/port/esp_mem.c"
target_sources(mbedtls PRIVATE "${COMPONENT_DIR}/port/esp_bignum.c"
"${COMPONENT_DIR}/port/esp_hardware.c"
"${COMPONENT_PATH}/port/esp_sha.c"
"${COMPONENT_PATH}/port/esp_sha1.c"
"${COMPONENT_PATH}/port/esp_sha256.c"
"${COMPONENT_PATH}/port/esp_sha512.c"
"${COMPONENT_PATH}/port/mbedtls_debug.c"
"${COMPONENT_PATH}/port/net_sockets.c"
"${COMPONENT_PATH}/port/esp32/aes.c"
"${COMPONENT_PATH}/port/esp32/sha.c")
"${COMPONENT_DIR}/port/esp_sha1.c"
"${COMPONENT_DIR}/port/esp_sha256.c"
"${COMPONENT_DIR}/port/esp_sha512.c"
"${COMPONENT_DIR}/port/mbedtls_debug.c"
"${COMPONENT_DIR}/port/net_sockets.c"
"${COMPONENT_DIR}/port/esp32/aes.c"
"${COMPONENT_DIR}/port/esp32/sha.c")
target_sources(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/esp_mem.c")
foreach(target ${mbedtls_targets})
# Propagate compile options to mbedtls library targets
target_include_directories(${target} PRIVATE "${IDF_INCLUDE_DIRECTORIES}")
target_compile_options(${target} PRIVATE "${IDF_COMPILE_OPTIONS};${IDF_C_COMPILE_OPTIONS}")
target_compile_definitions(${target} PRIVATE "${IDF_COMPILE_DEFINITIONS}")
target_compile_definitions(${target} PUBLIC -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h")
# The mbedtls targets also depends on core components
foreach(common ${MBEDTLS_PRIV_REQUIRES})
component_get_target(common_target ${common})
set_property(TARGET ${target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${common_target})
set_property(TARGET ${target} APPEND PROPERTY LINK_LIBRARIES ${common_target})
endforeach()
endforeach()
# Link mbedtls libraries to component library
target_link_libraries(${COMPONENT_TARGET} ${mbedtls_targets})
target_link_libraries(${COMPONENT_LIB} ${mbedtls_targets})
# Catch usage of deprecated mbedTLS functions when building tests
if(mbedtls_test IN_LIST BUILD_TEST_COMPONENTS)
add_definitions(-DMBEDTLS_DEPRECATED_WARNING)
endif()
endif()