1#-------------------------------------------------------------------------------
2# Copyright (c) 2020, Arm Limited. All rights reserved.
3# Copyright (c) 2021 STMicroelectronics. All rights reserved.
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7#-------------------------------------------------------------------------------
8# Allow linking to things 'upwards' in the directory tree (in this case bl2 / tfm_partition_crypto)
9cmake_policy(SET CMP0079 NEW)
10# Allow relative paths
11cmake_policy(SET CMP0076 NEW)
12
13if(NOT DEFINED PLATFORM_DIR)
14    set(PLATFORM_DIR ../../.. CACHE PATH "Path to plaform dir")
15endif()
16target_compile_definitions(platform_bl2
17    PRIVATE
18        CRYPTO_HW_ACCELERATOR
19)
20
21################################ BL2 ###########################################
22if(BL2)
23
24    set(STM_LIB_TARGET bl2_crypto_hw)
25
26    target_compile_definitions(bl2_mbedcrypto
27        PUBLIC
28            CRYPTO_HW_ACCELERATOR
29    )
30
31    target_compile_options(bl2_mbedcrypto
32        PRIVATE
33            $<$<C_COMPILER_ID:GNU>:-Wno-unused-parameter>
34            $<$<C_COMPILER_ID:ARMClang>:-Wno-unused-parameter>
35    )
36endif()
37include(${PLATFORM_DIR}/ext/target/${TFM_PLATFORM}/accelerator/CMakeLists.txt)
38
39if (TFM_PARTITION_CRYPTO)
40    set(STM_LIB_TARGET crypto_service_crypto_hw)
41
42    target_link_libraries(crypto_service_mbedcrypto
43        PUBLIC
44            crypto_service_crypto_hw
45    )
46
47    target_compile_definitions(crypto_service_mbedcrypto
48        PUBLIC
49            CRYPTO_HW_ACCELERATOR
50            LEGACY_DRIVER_API_ENABLED
51    )
52
53    target_compile_options(crypto_service_mbedcrypto
54        PRIVATE
55            $<$<C_COMPILER_ID:GNU>:-Wno-unused-parameter>
56            $<$<C_COMPILER_ID:ARMClang>:-Wno-unused-parameter>
57    )
58endif()
59