mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Update to Mbed TLS 3.3.0 (#1558)
* Convert mbedtls to subproject * Align cmake to subproject and mbedtls 3.3.0 * mdebtls 3.3.0 * Add cxx_std_20 for Windows build
This commit is contained in:
parent
f327b5063e
commit
ef7ceb0bbf
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -12,3 +12,6 @@
|
|||||||
[submodule "dependencies/external/qmdnsengine"]
|
[submodule "dependencies/external/qmdnsengine"]
|
||||||
path = dependencies/external/qmdnsengine
|
path = dependencies/external/qmdnsengine
|
||||||
url = https://github.com/nitroshare/qmdnsengine.git
|
url = https://github.com/nitroshare/qmdnsengine.git
|
||||||
|
[submodule "dependencies/external/mbedtls"]
|
||||||
|
path = dependencies/external/mbedtls
|
||||||
|
url = ../../Mbed-TLS/mbedtls.git
|
||||||
|
37
dependencies/CMakeLists-mbedtls.txt.in
vendored
37
dependencies/CMakeLists-mbedtls.txt.in
vendored
@ -1,37 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.2)
|
|
||||||
|
|
||||||
project(mbedtls)
|
|
||||||
|
|
||||||
set(DOWNLOAD_DIR "@MBEDTLS_DOWNLOAD_DIR@")
|
|
||||||
set(SOURCE_DIR "@MBEDTLS_SOURCE_DIR@")
|
|
||||||
set(BINARY_DIR "@MBEDTLS_BINARY_DIR@")
|
|
||||||
set(INSTALL_DIR "@MBEDTLS_INSTALL_DIR@")
|
|
||||||
set(CMAKE_ARGS "@MBEDTLS_CMAKE_ARGS@")
|
|
||||||
set(LOGGING "@MBEDTLS_LOGGING@")
|
|
||||||
|
|
||||||
include(ExternalProject)
|
|
||||||
|
|
||||||
ExternalProject_Add(
|
|
||||||
mbedtls
|
|
||||||
GIT_REPOSITORY "https://github.com/ARMmbed/mbedtls.git"
|
|
||||||
GIT_TAG "v3.1.0" # Bump versions manually if necessary, do not rely on origin/master to be stable
|
|
||||||
BUILD_ALWAYS OFF
|
|
||||||
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
|
|
||||||
SOURCE_DIR "${SOURCE_DIR}"
|
|
||||||
BINARY_DIR "${BINARY_DIR}"
|
|
||||||
INSTALL_DIR "${INSTALL_DIR}"
|
|
||||||
CMAKE_ARGS ${CMAKE_ARGS}
|
|
||||||
CONFIGURE_COMMAND ""
|
|
||||||
UPDATE_COMMAND ""
|
|
||||||
BUILD_COMMAND ""
|
|
||||||
INSTALL_COMMAND ""
|
|
||||||
LOG_DOWNLOAD ${LOGGING}
|
|
||||||
LOG_UPDATE ${LOGGING}
|
|
||||||
LOG_PATCH ${LOGGING}
|
|
||||||
LOG_CONFIGURE ${LOGGING}
|
|
||||||
LOG_BUILD ${LOGGING}
|
|
||||||
LOG_INSTALL ${LOGGING}
|
|
||||||
LOG_TEST ${LOGGING}
|
|
||||||
LOG_MERGED_STDOUTERR ${LOGGING}
|
|
||||||
LOG_OUTPUT_ON_FAILURE ${LOGGING}
|
|
||||||
)
|
|
76
dependencies/CMakeLists.txt
vendored
76
dependencies/CMakeLists.txt
vendored
@ -265,15 +265,19 @@ if(ENABLE_DEV_NETWORK)
|
|||||||
set(DEFAULT_USE_SYSTEM_MBEDTLS_LIBS OFF PARENT_SCOPE)
|
set(DEFAULT_USE_SYSTEM_MBEDTLS_LIBS OFF PARENT_SCOPE)
|
||||||
set(USE_SYSTEM_MBEDTLS_LIBS OFF)
|
set(USE_SYSTEM_MBEDTLS_LIBS OFF)
|
||||||
endif (NOT MBEDTLS_FOUND)
|
endif (NOT MBEDTLS_FOUND)
|
||||||
endif (USE_SYSTEM_MBEDTLS_LIBS)
|
else()
|
||||||
|
|
||||||
if (NOT USE_SYSTEM_MBEDTLS_LIBS)
|
|
||||||
cmake_minimum_required(VERSION 3.2)
|
cmake_minimum_required(VERSION 3.2)
|
||||||
|
|
||||||
|
set(CMAKE_POLICY_DEFAULT_CMP0071 NEW)
|
||||||
|
|
||||||
set(DEFAULT_USE_SYSTEM_MBEDTLS_LIBS OFF CACHE BOOL "system mbedtls libraries not found, disable use system mbedtls libraries")
|
set(DEFAULT_USE_SYSTEM_MBEDTLS_LIBS OFF CACHE BOOL "system mbedtls libraries not found, disable use system mbedtls libraries")
|
||||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared mbedtls libraries")
|
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared mbedtls libraries")
|
||||||
|
|
||||||
set(ENABLE_TESTING OFF CACHE BOOL "Disable mbedTLS tests")
|
set(ENABLE_TESTING OFF CACHE BOOL "Disable mbedTLS tests")
|
||||||
|
set(GEN_FILES OFF CACHE BOOL "Disable mbedTLS auto-generated files")
|
||||||
set(ENABLE_PROGRAMS OFF CACHE BOOL "Disable mbedTLS programs")
|
set(ENABLE_PROGRAMS OFF CACHE BOOL "Disable mbedTLS programs")
|
||||||
|
#set(LINK_WITH_PTHREAD ON CACHE BOOL "Enable mbedTLS library linked to pthread.")
|
||||||
|
|
||||||
set(USE_SHARED_MBEDTLS_LIBRARY OFF CACHE BOOL "Disable mbedTLS shared libraries")
|
set(USE_SHARED_MBEDTLS_LIBRARY OFF CACHE BOOL "Disable mbedTLS shared libraries")
|
||||||
set(USE_STATIC_MBEDTLS_LIBRARY ON CACHE BOOL "Enable mbedTLS static libraries")
|
set(USE_STATIC_MBEDTLS_LIBRARY ON CACHE BOOL "Enable mbedTLS static libraries")
|
||||||
|
|
||||||
@ -287,69 +291,7 @@ if(ENABLE_DEV_NETWORK)
|
|||||||
set(MBEDTLS_LOGGING 0)
|
set(MBEDTLS_LOGGING 0)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set(MBEDTLS_CMAKE_ARGS
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/mbedtls)
|
||||||
-DCMAKE_INSTALL_PREFIX:PATH=${MBEDTLS_INSTALL_DIR}
|
|
||||||
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
|
|
||||||
-DUSE_SHARED_MBEDTLS_LIBRARY:BOOL=OFF
|
|
||||||
-DUSE_STATIC_MBEDTLS_LIBRARY:BOOL=ON
|
|
||||||
-DENABLE_TESTING:BOOL=OFF
|
|
||||||
-DENABLE_PROGRAMS:BOOL=OFF
|
|
||||||
-DLINK_WITH_PTHREAD:BOOL=ON
|
|
||||||
-Wno-dev
|
|
||||||
#-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=TRUE
|
|
||||||
)
|
|
||||||
|
|
||||||
set(ENABLE_MBEDTLS_FETCH_CONTENT ON)
|
|
||||||
|
|
||||||
if (ENABLE_MBEDTLS_FETCH_CONTENT AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.11)
|
|
||||||
|
|
||||||
include(FetchContent)
|
|
||||||
|
|
||||||
FetchContent_Declare(
|
|
||||||
mbedtls
|
|
||||||
GIT_REPOSITORY https://github.com/ARMmbed/mbedtls.git
|
|
||||||
GIT_TAG "v3.1.0" # Bump versions manually if necessary, do not rely on origin/master to be stable
|
|
||||||
BUILD_ALWAYS OFF
|
|
||||||
GIT_PROGRESS 1
|
|
||||||
DOWNLOAD_DIR "${MBEDTLS_DOWNLOAD_DIR}"
|
|
||||||
SOURCE_DIR "${MBEDTLS_SOURCE_DIR}"
|
|
||||||
BINARY_DIR "${MBEDTLS_BINARY_DIR}"
|
|
||||||
INSTALL_DIR "${MBEDTLS_INSTALL_DIR}"
|
|
||||||
CMAKE_ARGS ${MBEDTLS_CMAKE_ARGS}
|
|
||||||
BUILD_COMMAND ""
|
|
||||||
INSTALL_COMMAND ""
|
|
||||||
LOG_DOWNLOAD ${MBEDTLS_LOGGING}
|
|
||||||
LOG_UPDATE ${MBEDTLS_LOGGING}
|
|
||||||
LOG_PATCH ${MBEDTLS_LOGGING}
|
|
||||||
LOG_CONFIGURE ${MBEDTLS_LOGGING}
|
|
||||||
LOG_BUILD ${MBEDTLS_LOGGING}
|
|
||||||
LOG_INSTALL ${MBEDTLS_LOGGING}
|
|
||||||
LOG_TEST ${MBEDTLS_LOGGING}
|
|
||||||
LOG_MERGED_STDOUTERR ${MBEDTLS_LOGGING}
|
|
||||||
LOG_OUTPUT_ON_FAILURE ${MBEDTLS_LOGGING}
|
|
||||||
)
|
|
||||||
|
|
||||||
if (CMAKE_VERSION VERSION_LESS 3.14)
|
|
||||||
macro (FetchContent_MakeAvailable NAME)
|
|
||||||
FetchContent_GetProperties(${NAME})
|
|
||||||
if (NOT ${NAME}_POPULATED)
|
|
||||||
FetchContent_Populate(${NAME})
|
|
||||||
add_subdirectory(${${NAME}_SOURCE_DIR} ${${NAME}_BINARY_DIR})
|
|
||||||
endif ()
|
|
||||||
endmacro ()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
FetchContent_MakeAvailable(mbedtls)
|
|
||||||
else ()
|
|
||||||
set(ENABLE_MBEDTLS_FETCH_CONTENT OFF PARENT_SCOPE)
|
|
||||||
if(NOT DEFINED BUILD_MBEDTLS_ONCE)
|
|
||||||
set(BUILD_MBEDTLS_ONCE CACHE INTERNAL "Done")
|
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/dependencies/CMakeLists-mbedtls.txt.in ${MBEDTLS_DOWNLOAD_DIR}/CMakeLists.txt @ONLY)
|
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX:PATH=${MBEDTLS_INSTALL_DIR} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -G "${CMAKE_GENERATOR}" . WORKING_DIRECTORY ${MBEDTLS_DOWNLOAD_DIR})
|
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} --build . WORKING_DIRECTORY ${MBEDTLS_DOWNLOAD_DIR})
|
|
||||||
add_subdirectory(${MBEDTLS_SOURCE_DIR} ${MBEDTLS_BINARY_DIR})
|
|
||||||
endif()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
set (MBEDTLS_INCLUDE_DIR "${MBEDTLS_SOURCE_DIR}/include")
|
set (MBEDTLS_INCLUDE_DIR "${MBEDTLS_SOURCE_DIR}/include")
|
||||||
set (MBEDTLS_INCLUDE_DIR ${MBEDTLS_INCLUDE_DIR} PARENT_SCOPE)
|
set (MBEDTLS_INCLUDE_DIR ${MBEDTLS_INCLUDE_DIR} PARENT_SCOPE)
|
||||||
@ -387,5 +329,5 @@ if(ENABLE_DEV_NETWORK)
|
|||||||
|
|
||||||
mark_as_advanced (MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARIES MBEDTLS_SSL_LIBRARY MBEDTLS_X509_LIBRARY MBEDTLS_CRYPTO_LIBRARY)
|
mark_as_advanced (MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARIES MBEDTLS_SSL_LIBRARY MBEDTLS_X509_LIBRARY MBEDTLS_CRYPTO_LIBRARY)
|
||||||
|
|
||||||
endif (NOT USE_SYSTEM_MBEDTLS_LIBS)
|
endif (USE_SYSTEM_MBEDTLS_LIBS)
|
||||||
endif(ENABLE_DEV_NETWORK)
|
endif(ENABLE_DEV_NETWORK)
|
||||||
|
1
dependencies/external/mbedtls
vendored
Submodule
1
dependencies/external/mbedtls
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 8c89224991adff88d53cd380f42a2baa36f91454
|
@ -118,7 +118,10 @@ if(ENABLE_DEV_NETWORK)
|
|||||||
string(REGEX MATCH "[0-9]+|-([A-Za-z0-9_.]+)" MBEDTLS_MAJOR ${MBEDTLS_VERSION})
|
string(REGEX MATCH "[0-9]+|-([A-Za-z0-9_.]+)" MBEDTLS_MAJOR ${MBEDTLS_VERSION})
|
||||||
if (MBEDTLS_MAJOR EQUAL "3")
|
if (MBEDTLS_MAJOR EQUAL "3")
|
||||||
target_compile_definitions(leddevice PRIVATE USE_MBEDTLS3)
|
target_compile_definitions(leddevice PRIVATE USE_MBEDTLS3)
|
||||||
endif()
|
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||||
|
target_compile_features(leddevice PRIVATE cxx_std_20)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_DEV_SERIAL)
|
if(ENABLE_DEV_SERIAL)
|
||||||
@ -160,3 +163,4 @@ endif()
|
|||||||
if(ENABLE_MDNS)
|
if(ENABLE_MDNS)
|
||||||
target_link_libraries(leddevice mdns)
|
target_link_libraries(leddevice mdns)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user