build: use system MbedTLS when available

Since MbedTLS pre-3.0.0 doesn't ship neither a pkg-config file nor a
CMake package config file it is required to use a custom
FindMbedTLS.cmake file.

Since yuzu requires CMAC support it is also needed to check for the
`mbedtls_cipher_cmac` symbol.

I also changed src/core/CMakeLists.txt to only link against mbedcrypto,
as yuzu doesn't use the full MbedTLS library
This commit is contained in:
Andrea Pappacoda
2021-09-18 15:39:20 +02:00
parent 432d48d9c8
commit caa25146f2
4 changed files with 53 additions and 5 deletions

View File

@@ -30,9 +30,14 @@ if (NOT TARGET inih::INIReader)
add_subdirectory(inih)
endif()
# mbedtls
add_subdirectory(mbedtls EXCLUDE_FROM_ALL)
target_include_directories(mbedtls PUBLIC ./mbedtls/include)
# MbedTLS
find_package(MbedTLS 2.16)
if(NOT MbedTLS_FOUND)
message(STATUS "MbedTLS not found, falling back to externals")
add_subdirectory(mbedtls EXCLUDE_FROM_ALL)
target_include_directories(mbedcrypto PUBLIC ./mbedtls/include)
add_library(MbedTLS::mbedcrypto ALIAS mbedcrypto)
endif()
# MicroProfile
add_library(microprofile INTERFACE)