cmake: Rename mbedcrypto target to tfpsacrypto

Rename mbedcrypto target to tfpsacrypto and
prefix all cmake related variables with
tfpsacrypto instead of mbedcrypto.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron 2024-10-25 16:01:14 +02:00
parent 020e026779
commit b7d0e52e16
18 changed files with 54 additions and 54 deletions

View File

@ -13,7 +13,7 @@
# - MBEDTLS_TARGET_PREFIX: CMake targets are designed to be alterable by calling
# CMake in order to avoid target name clashes, via the use of
# MBEDTLS_TARGET_PREFIX. The value of this variable is prefixed to the
# mbedtls, mbedx509, mbedcrypto and mbedtls-apidoc targets.
# mbedtls, mbedx509, tfpsacrypto and mbedtls-apidoc targets.
#
# We specify a minimum requirement of 3.10.2, but for now use 3.5.1 here
@ -100,12 +100,12 @@ option(USE_SHARED_MBEDTLS_LIBRARY "Build Mbed TLS shared library." OFF)
option(LINK_WITH_PTHREAD "Explicitly link Mbed TLS library to pthread." OFF)
option(LINK_WITH_TRUSTED_STORAGE "Explicitly link Mbed TLS library to trusted_storage." OFF)
set(mbedcrypto_target "${MBEDTLS_TARGET_PREFIX}mbedcrypto")
set(tfpsacrypto_target "${MBEDTLS_TARGET_PREFIX}tfpsacrypto")
if (USE_STATIC_MBEDTLS_LIBRARY)
set(mbedcrypto_static_target ${mbedcrypto_target})
set(tfpsacrypto_static_target ${tfpsacrypto_target})
endif()
if(USE_STATIC_MBEDTLS_LIBRARY AND USE_SHARED_MBEDTLS_LIBRARY)
string(APPEND mbedcrypto_static_target "_static")
string(APPEND tfpsacrypto_static_target "_static")
endif()
# Warning string - created as a list for compatibility with CMake 2.8

View File

@ -156,7 +156,7 @@ if(USE_STATIC_MBEDTLS_LIBRARY)
set_base_compile_options(${mbedx509_static_target})
target_compile_options(${mbedx509_static_target} PRIVATE ${LIBS_C_FLAGS})
set_target_properties(${mbedx509_static_target} PROPERTIES OUTPUT_NAME mbedx509)
target_link_libraries(${mbedx509_static_target} PUBLIC ${libs} ${mbedcrypto_static_target})
target_link_libraries(${mbedx509_static_target} PUBLIC ${libs} ${tfpsacrypto_static_target})
add_library(${mbedtls_static_target} STATIC ${src_tls})
set_base_compile_options(${mbedtls_static_target})
@ -170,7 +170,7 @@ if(USE_SHARED_MBEDTLS_LIBRARY)
set_base_compile_options(${mbedx509_target})
target_compile_options(${mbedx509_target} PRIVATE ${LIBS_C_FLAGS})
set_target_properties(${mbedx509_target} PROPERTIES VERSION 4.0.0 SOVERSION 7)
target_link_libraries(${mbedx509_target} PUBLIC ${libs} ${mbedcrypto_target})
target_link_libraries(${mbedx509_target} PUBLIC ${libs} ${tfpsacrypto_target})
add_library(${mbedtls_target} SHARED ${src_tls})
set_base_compile_options(${mbedtls_target})

View File

@ -6,7 +6,7 @@ add_dependencies(${programs_target} ${executables})
foreach(exe IN LISTS executables)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
set_base_compile_options(${exe})
target_link_libraries(${exe} ${mbedcrypto_target} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(${exe} ${tfpsacrypto_target} ${CMAKE_THREAD_LIBS_INIT})
target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include)
endforeach()

View File

@ -6,7 +6,7 @@ add_dependencies(${programs_target} ${executables})
foreach(exe IN LISTS executables)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
set_base_compile_options(${exe})
target_link_libraries(${exe} ${mbedcrypto_target} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(${exe} ${tfpsacrypto_target} ${CMAKE_THREAD_LIBS_INIT})
target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include)
endforeach()

View File

@ -8,7 +8,7 @@ add_dependencies(${programs_target} ${executables})
foreach(exe IN LISTS executables)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
set_base_compile_options(${exe})
target_link_libraries(${exe} ${mbedcrypto_target} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(${exe} ${tfpsacrypto_target} ${CMAKE_THREAD_LIBS_INIT})
target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include)
endforeach()

View File

@ -36,7 +36,7 @@ add_dependencies(${programs_target} ${executables_mbedcrypto})
foreach(exe IN LISTS executables_mbedcrypto)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
set_base_compile_options(${exe})
target_link_libraries(${exe} ${mbedcrypto_target} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(${exe} ${tfpsacrypto_target} ${CMAKE_THREAD_LIBS_INIT})
target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include)
endforeach()

View File

@ -30,7 +30,7 @@ endif()
foreach(exe IN LISTS executables)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
set_base_compile_options(${exe})
target_link_libraries(${exe} ${mbedcrypto_target} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(${exe} ${tfpsacrypto_target} ${CMAKE_THREAD_LIBS_INIT})
target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include)
endforeach()

View File

@ -7,7 +7,7 @@ add_dependencies(${programs_target} ${executables})
foreach(exe IN LISTS executables)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
set_base_compile_options(${exe})
target_link_libraries(${exe} ${mbedcrypto_target} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(${exe} ${tfpsacrypto_target} ${CMAKE_THREAD_LIBS_INIT})
target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include)
endforeach()

View File

@ -34,7 +34,7 @@ if(TEST_CPP)
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../include
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tf-psa-crypto/include
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tf-psa-crypto/drivers/builtin/include)
target_link_libraries(cpp_dummy_build ${mbedcrypto_target} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(cpp_dummy_build ${tfpsacrypto_target} ${CMAKE_THREAD_LIBS_INIT})
endif()
if(USE_SHARED_MBEDTLS_LIBRARY AND
@ -102,7 +102,7 @@ foreach(exe IN LISTS executables_libs executables_mbedcrypto)
if (${exe_index} GREATER -1)
target_link_libraries(${exe} ${libs} ${CMAKE_THREAD_LIBS_INIT})
else()
target_link_libraries(${exe} ${mbedcrypto_target} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(${exe} ${tfpsacrypto_target} ${CMAKE_THREAD_LIBS_INIT})
endif()
endforeach()

View File

@ -35,4 +35,4 @@ find_package(MbedTLS REQUIRED)
add_executable(cmake_package cmake_package.c)
target_link_libraries(cmake_package
MbedTLS::mbedcrypto MbedTLS::mbedtls MbedTLS::mbedx509)
MbedTLS::tfpsacrypto MbedTLS::mbedtls MbedTLS::mbedx509)

View File

@ -38,4 +38,4 @@ find_package(MbedTLS REQUIRED)
add_executable(cmake_package_install cmake_package_install.c)
target_link_libraries(cmake_package_install
MbedTLS::mbedcrypto MbedTLS::mbedtls MbedTLS::mbedx509)
MbedTLS::tfpsacrypto MbedTLS::mbedtls MbedTLS::mbedx509)

View File

@ -14,7 +14,7 @@ add_subdirectory(${MBEDTLS_DIR} build)
# Link against all the Mbed TLS libraries. Verifies that the targets have been
# created using the specified prefix
set(libs
subproject_test_mbedcrypto
subproject_test_tfpsacrypto
subproject_test_mbedx509
subproject_test_mbedtls
)

View File

@ -1,5 +1,5 @@
set(libs
${mbedcrypto_target}
${tfpsacrypto_target}
${mbedx509_target}
)

View File

@ -118,12 +118,12 @@ option(USE_SHARED_TF_PSA_CRYPTO_LIBRARY "Build TF-PSA-Crypto shared library." OF
option(LINK_WITH_PTHREAD "Explicitly link Mbed TLS library to pthread." OFF)
option(LINK_WITH_TRUSTED_STORAGE "Explicitly link Mbed TLS library to trusted_storage." OFF)
set(mbedcrypto_target "${TF_PSA_CRYPTO_TARGET_PREFIX}mbedcrypto")
set(tfpsacrypto_target "${TF_PSA_CRYPTO_TARGET_PREFIX}tfpsacrypto")
if (USE_STATIC_TF_PSA_CRYPTO_LIBRARY)
set(mbedcrypto_static_target ${mbedcrypto_target})
set(tfpsacrypto_static_target ${tfpsacrypto_target})
endif()
if(USE_STATIC_TF_PSA_CRYPTO_LIBRARY AND USE_SHARED_TF_PSA_CRYPTO_LIBRARY)
string(APPEND mbedcrypto_static_target "_static")
string(APPEND tfpsacrypto_static_target "_static")
endif()
# Warning string - created as a list for compatibility with CMake 2.8

View File

@ -68,61 +68,61 @@ if (NOT USE_STATIC_TF_PSA_CRYPTO_LIBRARY AND NOT USE_SHARED_TF_PSA_CRYPTO_LIBRAR
message(FATAL_ERROR "Need to choose static or shared TF-PSA-Crypto build!")
endif(NOT USE_STATIC_TF_PSA_CRYPTO_LIBRARY AND NOT USE_SHARED_TF_PSA_CRYPTO_LIBRARY)
set(mbedcrypto_target "${TF_PSA_CRYPTO_TARGET_PREFIX}mbedcrypto")
set(tfpsacrypto_target "${TF_PSA_CRYPTO_TARGET_PREFIX}tfpsacrypto")
set(builtin_target "${TF_PSA_CRYPTO_TARGET_PREFIX}builtin")
if (USE_STATIC_TF_PSA_CRYPTO_LIBRARY)
set(mbedcrypto_static_target ${mbedcrypto_target})
set(tfpsacrypto_static_target ${tfpsacrypto_target})
set(builtin_static_target ${builtin_target})
endif()
set(target_libraries ${mbedcrypto_target})
set(target_libraries ${tfpsacrypto_target})
if(USE_STATIC_TF_PSA_CRYPTO_LIBRARY AND USE_SHARED_TF_PSA_CRYPTO_LIBRARY)
string(APPEND mbedcrypto_static_target "_static")
string(APPEND tfpsacrypto_static_target "_static")
string(APPEND builtin_static_target "_static")
list(APPEND target_libraries
${mbedcrypto_static_target})
${tfpsacrypto_static_target})
endif()
set(p256m_target "${TF_PSA_CRYPTO_TARGET_PREFIX}p256m")
set(everest_target "${TF_PSA_CRYPTO_TARGET_PREFIX}everest")
if(USE_STATIC_TF_PSA_CRYPTO_LIBRARY)
add_library(${mbedcrypto_static_target} STATIC ${src_crypto})
set_base_compile_options(${mbedcrypto_static_target})
target_compile_options(${mbedcrypto_static_target} PRIVATE ${LIBS_C_FLAGS})
set_target_properties(${mbedcrypto_static_target} PROPERTIES OUTPUT_NAME mbedcrypto)
target_link_libraries(${mbedcrypto_static_target} PUBLIC ${libs})
add_library(${tfpsacrypto_static_target} STATIC ${src_crypto})
set_base_compile_options(${tfpsacrypto_static_target})
target_compile_options(${tfpsacrypto_static_target} PRIVATE ${LIBS_C_FLAGS})
set_target_properties(${tfpsacrypto_static_target} PROPERTIES OUTPUT_NAME mbedcrypto)
target_link_libraries(${tfpsacrypto_static_target} PUBLIC ${libs})
target_link_libraries(${mbedcrypto_static_target} PUBLIC ${builtin_static_target})
target_link_libraries(${tfpsacrypto_static_target} PUBLIC ${builtin_static_target})
if(TARGET ${everest_target})
target_link_libraries(${mbedcrypto_static_target} PUBLIC ${everest_target})
target_link_libraries(${tfpsacrypto_static_target} PUBLIC ${everest_target})
endif()
if(TARGET ${p256m_target})
target_link_libraries(${mbedcrypto_static_target} PUBLIC ${p256m_target})
target_link_libraries(${tfpsacrypto_static_target} PUBLIC ${p256m_target})
endif()
endif(USE_STATIC_TF_PSA_CRYPTO_LIBRARY)
if(USE_SHARED_TF_PSA_CRYPTO_LIBRARY)
set(CMAKE_LIBRARY_PATH ${CMAKE_CURRENT_BINARY_DIR})
add_library(${mbedcrypto_target} SHARED ${src_crypto})
set_base_compile_options(${mbedcrypto_target})
target_compile_options(${mbedcrypto_target} PRIVATE ${LIBS_C_FLAGS})
set_target_properties(${mbedcrypto_target} PROPERTIES VERSION 4.0.0 SOVERSION 16)
target_link_libraries(${mbedcrypto_target} PUBLIC ${libs})
add_library(${tfpsacrypto_target} SHARED ${src_crypto})
set_base_compile_options(${tfpsacrypto_target})
target_compile_options(${tfpsacrypto_target} PRIVATE ${LIBS_C_FLAGS})
set_target_properties(${tfpsacrypto_target} PROPERTIES VERSION 4.0.0 SOVERSION 16)
target_link_libraries(${tfpsacrypto_target} PUBLIC ${libs})
target_link_libraries(${mbedcrypto_target} PUBLIC ${builtin_target})
target_link_libraries(${tfpsacrypto_target} PUBLIC ${builtin_target})
if(TARGET ${everest_target})
target_link_libraries(${mbedcrypto_target} PUBLIC ${everest_target})
target_link_libraries(${tfpsacrypto_target} PUBLIC ${everest_target})
endif()
if(TARGET ${p256m_target})
target_link_libraries(${mbedcrypto_target} PUBLIC ${p256m_target})
target_link_libraries(${tfpsacrypto_target} PUBLIC ${p256m_target})
endif()
endif(USE_SHARED_TF_PSA_CRYPTO_LIBRARY)
@ -159,23 +159,23 @@ endforeach(target)
if(USE_STATIC_TF_PSA_CRYPTO_LIBRARY)
add_custom_command(
TARGET ${mbedcrypto_static_target}
TARGET ${tfpsacrypto_static_target}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy $<TARGET_FILE:${mbedcrypto_static_target}> ${CMAKE_BINARY_DIR}/library)
ARGS -E copy $<TARGET_FILE:${tfpsacrypto_static_target}> ${CMAKE_BINARY_DIR}/library)
endif(USE_STATIC_TF_PSA_CRYPTO_LIBRARY)
if(USE_SHARED_TF_PSA_CRYPTO_LIBRARY)
add_custom_command(
TARGET ${mbedcrypto_target}
TARGET ${tfpsacrypto_target}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy $<TARGET_FILE:${mbedcrypto_target}>
${CMAKE_BINARY_DIR}/library/$<TARGET_FILE_NAME:${mbedcrypto_target}>)
ARGS -E copy $<TARGET_FILE:${tfpsacrypto_target}>
${CMAKE_BINARY_DIR}/library/$<TARGET_FILE_NAME:${tfpsacrypto_target}>)
add_custom_command(
TARGET ${mbedcrypto_target}
TARGET ${tfpsacrypto_target}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy $<TARGET_LINKER_FILE:${mbedcrypto_target}>
${CMAKE_BINARY_DIR}/library/$<TARGET_LINKER_FILE_NAME:${mbedcrypto_target}>)
ARGS -E copy $<TARGET_LINKER_FILE:${tfpsacrypto_target}>
${CMAKE_BINARY_DIR}/library/$<TARGET_LINKER_FILE_NAME:${tfpsacrypto_target}>)
endif(USE_SHARED_TF_PSA_CRYPTO_LIBRARY)

View File

@ -32,4 +32,4 @@ find_package(TF-PSA-Crypto REQUIRED)
#
add_executable(cmake_package cmake_package.c)
target_link_libraries(cmake_package TF-PSA-Crypto::mbedcrypto)
target_link_libraries(cmake_package TF-PSA-Crypto::tfpsacrypto)

View File

@ -15,4 +15,4 @@ add_subdirectory(${TF_PSA_CRYPTO_DIR} build)
# created using the specified prefix
add_executable(cmake_subproject cmake_subproject.c)
target_link_libraries(cmake_subproject subproject_test_mbedcrypto ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(cmake_subproject subproject_test_tfpsacrypto ${CMAKE_THREAD_LIBS_INIT})

View File

@ -1,5 +1,5 @@
set(libs
${mbedcrypto_target}
${tfpsacrypto_target}
${CMAKE_THREAD_LIBS_INIT}
)
@ -287,7 +287,7 @@ function(add_test_suite suite_name)
${CMAKE_CURRENT_SOURCE_DIR}/suites/main_test.function
${CMAKE_CURRENT_SOURCE_DIR}/suites/host_test.function
${CMAKE_CURRENT_SOURCE_DIR}/suites/helpers.function
${mbedcrypto_target}
${tfpsacrypto_target}
BYPRODUCTS
test_suite_${data_name}.datax
)