Gabor Toth | 172659d | 2023-04-27 08:51:21 +0200 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2023, Arm Limited and Contributors. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
| 8 | #------------------------------------------------------------------------------- |
Gabor Toth | ee2e7cb | 2024-10-07 17:02:56 +0200 | [diff] [blame^] | 9 | # The base build file shared between deployments of 'libpsats' for different |
| 10 | # environments. libpsats provides an interface for accessing PSA API-s. |
Gabor Toth | 172659d | 2023-04-27 08:51:21 +0200 | [diff] [blame] | 11 | # Building with each build type results in different postfix for the library. |
| 12 | # For details, please refer to deployment.cmake. |
| 13 | #------------------------------------------------------------------------------- |
| 14 | |
| 15 | #------------------------------------------------------------------------------- |
Gabor Toth | ee2e7cb | 2024-10-07 17:02:56 +0200 | [diff] [blame^] | 16 | # Common API version implemented by all libpsats deployments |
Gabor Toth | 172659d | 2023-04-27 08:51:21 +0200 | [diff] [blame] | 17 | #------------------------------------------------------------------------------- |
| 18 | version_semver_read(FILE "${CMAKE_CURRENT_LIST_DIR}/version.txt" |
| 19 | MAJOR _major MINOR _minor PATCH _patch) |
Gabor Toth | ee2e7cb | 2024-10-07 17:02:56 +0200 | [diff] [blame^] | 20 | set_target_properties(psats PROPERTIES VERSION "${_major}.${_minor}.${_patch}") |
| 21 | set_target_properties(psats PROPERTIES SOVERSION "${_major}") |
Gabor Toth | 172659d | 2023-04-27 08:51:21 +0200 | [diff] [blame] | 22 | unset(_major) |
| 23 | unset(_minor) |
| 24 | unset(_patch) |
| 25 | |
Gabor Toth | ee2e7cb | 2024-10-07 17:02:56 +0200 | [diff] [blame^] | 26 | add_library(libpsats::psats ALIAS psats) |
Gabor Toth | 172659d | 2023-04-27 08:51:21 +0200 | [diff] [blame] | 27 | |
| 28 | if (COVERAGE) |
Gabor Toth | ee2e7cb | 2024-10-07 17:02:56 +0200 | [diff] [blame^] | 29 | set(LIBPSATS_BUILD_TYPE "DebugCoverage" CACHE STRING "Build type." FORCE) |
Gabor Toth | 172659d | 2023-04-27 08:51:21 +0200 | [diff] [blame] | 30 | endif() |
| 31 | |
| 32 | #------------------------------------------------------------------------------- |
| 33 | # Use libts for locating and accessing services. An appropriate version of |
| 34 | # libts will be imported for the environment in which service tests are |
| 35 | # deployed. |
| 36 | #------------------------------------------------------------------------------- |
| 37 | include(${TS_ROOT}/deployments/libts/libts-import.cmake) |
Gabor Toth | ee2e7cb | 2024-10-07 17:02:56 +0200 | [diff] [blame^] | 38 | target_link_libraries(psats PUBLIC libts::ts) |
Gabor Toth | 172659d | 2023-04-27 08:51:21 +0200 | [diff] [blame] | 39 | |
| 40 | #------------------------------------------------------------------------------- |
| 41 | # Components that are common across all deployments |
| 42 | # |
| 43 | #------------------------------------------------------------------------------- |
| 44 | |
| 45 | add_components( |
Gabor Toth | ee2e7cb | 2024-10-07 17:02:56 +0200 | [diff] [blame^] | 46 | TARGET "psats" |
Gabor Toth | 172659d | 2023-04-27 08:51:21 +0200 | [diff] [blame] | 47 | BASE_DIR ${TS_ROOT} |
| 48 | COMPONENTS |
| 49 | "environments/${TS_ENV}" |
| 50 | "components/common/utils" |
| 51 | "components/common/trace" |
Gabor Toth | ee2e7cb | 2024-10-07 17:02:56 +0200 | [diff] [blame^] | 52 | "components/common/libpsats" |
Gabor Toth | 172659d | 2023-04-27 08:51:21 +0200 | [diff] [blame] | 53 | "components/common/tlv" |
| 54 | "components/service/common/include" |
| 55 | "components/service/common/client" |
| 56 | "components/service/crypto/include" |
| 57 | "components/service/crypto/client/psa" |
| 58 | "components/service/attestation/include" |
| 59 | "components/service/attestation/client/psa" |
| 60 | "components/service/attestation/client/provision" |
| 61 | "components/service/secure_storage/include" |
| 62 | "components/service/secure_storage/frontend/psa/its" |
| 63 | "components/service/secure_storage/frontend/psa/ps" |
| 64 | "components/service/secure_storage/backend/secure_storage_client" |
| 65 | ) |
| 66 | |
| 67 | #------------------------------------------------------------------------------- |
| 68 | # Define public interfaces for library |
| 69 | # |
| 70 | #------------------------------------------------------------------------------- |
| 71 | |
| 72 | # Enable exporting interface symbols for library public interface |
Gabor Toth | ee2e7cb | 2024-10-07 17:02:56 +0200 | [diff] [blame^] | 73 | target_compile_definitions(psats PRIVATE |
| 74 | EXPORT_PUBLIC_INTERFACE_LIBPSATS |
Gabor Toth | 172659d | 2023-04-27 08:51:21 +0200 | [diff] [blame] | 75 | EXPORT_PUBLIC_INTERFACE_PSA_CRYPTO |
| 76 | EXPORT_PUBLIC_INTERFACE_PSA_ATTEST |
| 77 | EXPORT_PUBLIC_INTERFACE_PSA_ITS |
| 78 | EXPORT_PUBLIC_INTERFACE_PSA_PS |
| 79 | ) |
| 80 | |
| 81 | #------------------------------------------------------------------------------- |
| 82 | # Export the library and the corresponding public interface header files |
| 83 | # |
| 84 | #------------------------------------------------------------------------------- |
| 85 | include(${TS_ROOT}/tools/cmake/common/ExportLibrary.cmake REQUIRED) |
| 86 | |
| 87 | # Exports library information in preparation for install |
| 88 | export_library( |
Gabor Toth | ee2e7cb | 2024-10-07 17:02:56 +0200 | [diff] [blame^] | 89 | TARGET "psats" |
| 90 | LIB_NAME "libpsats" |
| 91 | PKG_CONFIG_FILE "${CMAKE_CURRENT_LIST_DIR}/libpsatsConfig.cmake.in" |
Gabor Toth | 172659d | 2023-04-27 08:51:21 +0200 | [diff] [blame] | 92 | ) |
| 93 | |
| 94 | install(DIRECTORY "${TS_ROOT}/components/service/crypto/include" |
| 95 | DIRECTORY "${TS_ROOT}/components/service/attestation/include" |
| 96 | DIRECTORY "${TS_ROOT}/components/service/secure_storage/include" |
| 97 | DESTINATION "${TS_ENV}" |
| 98 | FILES_MATCHING PATTERN "*.h" |
| 99 | ) |
| 100 | |
| 101 | install(FILES "${TS_ROOT}/components/service/common/include/psa/error.h" |
| 102 | DESTINATION ${TS_ENV}/include/psa |
| 103 | ) |
| 104 | |
Gabor Toth | ee2e7cb | 2024-10-07 17:02:56 +0200 | [diff] [blame^] | 105 | install(FILES "${TS_ROOT}/components/common/libpsats/libpsats.h" |
Gabor Toth | 172659d | 2023-04-27 08:51:21 +0200 | [diff] [blame] | 106 | DESTINATION ${TS_ENV}/include |
| 107 | ) |