Tamas Ban | c2e0c18 | 2020-01-07 15:09:16 +0000 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Anton Komlev | 1e77550 | 2025-04-25 16:37:55 +0100 | [diff] [blame] | 2 | # SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors |
Tamas Ban | c2e0c18 | 2020-01-07 15:09:16 +0000 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
David Hu | 1249f0d | 2023-12-04 22:57:56 +0800 | [diff] [blame] | 8 | cmake_minimum_required(VERSION 3.21) |
Tamas Ban | c2e0c18 | 2020-01-07 15:09:16 +0000 | [diff] [blame] | 9 | |
Adam Kulesza | 4ced6b3 | 2022-05-24 19:13:56 +0200 | [diff] [blame] | 10 | # Default configuration of T_COSE repository |
| 11 | set(T_COSE_PATH "DOWNLOAD" CACHE PATH "Path to t_cose (or DOWNLOAD to fetch automatically") |
| 12 | set(T_COSE_VERSION "v2.0-alpha-2" CACHE STRING "The version of t_cose to use") |
| 13 | |
| 14 | fetch_remote_library( |
| 15 | LIB_NAME t_cose |
| 16 | LIB_SOURCE_PATH_VAR T_COSE_PATH |
| 17 | LIB_PATCH_DIR ${CMAKE_CURRENT_LIST_DIR} |
| 18 | LIB_BASE_DIR "${CMAKE_BINARY_DIR}/lib/ext" |
| 19 | FETCH_CONTENT_ARGS |
| 20 | GIT_REPOSITORY https://github.com/laurencelundblade/t_cose.git |
| 21 | GIT_TAG ${T_COSE_VERSION} |
| 22 | GIT_SHALLOW TRUE |
| 23 | GIT_PROGRESS TRUE |
Anton Komlev | 1e77550 | 2025-04-25 16:37:55 +0100 | [diff] [blame] | 24 | # The FetchContent_MakeAvailable() function automatically adds the fetched library |
| 25 | # directory to the build using add_subdirectory(). However, the TF-M t_cose module |
| 26 | # defines its own custom target instead of using the default one provided by the |
| 27 | # remote library. |
| 28 | # We set the SOURCE_SUBDIR variable to a non-existent directory as a workaround. |
| 29 | # Related issue: https://gitlab.kitware.com/cmake/cmake/-/issues/26220 |
| 30 | SOURCE_SUBDIR non-exist-dir |
Adam Kulesza | 4ced6b3 | 2022-05-24 19:13:56 +0200 | [diff] [blame] | 31 | ) |
| 32 | |
Anton Komlev | 1e77550 | 2025-04-25 16:37:55 +0100 | [diff] [blame] | 33 | include(tfm_t_cose.cmake) |
Antonio de Angelis | 34a0ffd | 2023-02-16 11:56:46 +0000 | [diff] [blame] | 34 | |
shejia01 | d853fe8 | 2021-07-12 20:03:55 +0800 | [diff] [blame] | 35 | ############################ t_cose secure ##################################### |
| 36 | |
| 37 | add_library(tfm_t_cose_s STATIC EXCLUDE_FROM_ALL) |
| 38 | |
| 39 | target_link_libraries(tfm_t_cose_s |
| 40 | PUBLIC |
shejia01 | d853fe8 | 2021-07-12 20:03:55 +0800 | [diff] [blame] | 41 | tfm_t_cose_defs |
Jamie Fox | 10f0870 | 2024-06-21 14:21:34 +0100 | [diff] [blame] | 42 | PRIVATE |
| 43 | tfm_t_cose_common |
shejia01 | d853fe8 | 2021-07-12 20:03:55 +0800 | [diff] [blame] | 44 | psa_interface |
David Vincze | 3de4228 | 2022-11-10 16:26:45 +0100 | [diff] [blame] | 45 | qcbor |
Antonio de Angelis | 8bb9851 | 2024-01-16 14:13:36 +0000 | [diff] [blame] | 46 | platform_s |
shejia01 | d853fe8 | 2021-07-12 20:03:55 +0800 | [diff] [blame] | 47 | ) |
| 48 | |
Feder Liang | d4dbaa9 | 2021-09-07 15:34:46 +0800 | [diff] [blame] | 49 | target_compile_options(tfm_t_cose_s |
Jamie Fox | 10f0870 | 2024-06-21 14:21:34 +0100 | [diff] [blame] | 50 | PRIVATE |
Feder Liang | d4dbaa9 | 2021-09-07 15:34:46 +0800 | [diff] [blame] | 51 | ${COMPILER_CP_FLAG} |
Raef Coles | 1971538 | 2020-07-10 09:50:17 +0100 | [diff] [blame] | 52 | ) |