blob: 9ce0039fe15550cd11f6550bbcad68386562bb39 [file] [log] [blame]
Gabor Toth172659d2023-04-27 08:51:21 +02001#-------------------------------------------------------------------------------
2# Copyright (c) 2023, Arm Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8#-------------------------------------------------------------------------------
Gabor Tothee2e7cb2024-10-07 17:02:56 +02009# The base build file shared between deployments of 'libpsats' for different
10# environments. libpsats provides an interface for accessing PSA API-s.
Gabor Toth172659d2023-04-27 08:51:21 +020011# Building with each build type results in different postfix for the library.
12# For details, please refer to deployment.cmake.
13#-------------------------------------------------------------------------------
14
15#-------------------------------------------------------------------------------
Gabor Tothee2e7cb2024-10-07 17:02:56 +020016# Common API version implemented by all libpsats deployments
Gabor Toth172659d2023-04-27 08:51:21 +020017#-------------------------------------------------------------------------------
18version_semver_read(FILE "${CMAKE_CURRENT_LIST_DIR}/version.txt"
19 MAJOR _major MINOR _minor PATCH _patch)
Gabor Tothee2e7cb2024-10-07 17:02:56 +020020set_target_properties(psats PROPERTIES VERSION "${_major}.${_minor}.${_patch}")
21set_target_properties(psats PROPERTIES SOVERSION "${_major}")
Gabor Toth172659d2023-04-27 08:51:21 +020022unset(_major)
23unset(_minor)
24unset(_patch)
25
Gabor Tothee2e7cb2024-10-07 17:02:56 +020026add_library(libpsats::psats ALIAS psats)
Gabor Toth172659d2023-04-27 08:51:21 +020027
28if (COVERAGE)
Gabor Tothee2e7cb2024-10-07 17:02:56 +020029 set(LIBPSATS_BUILD_TYPE "DebugCoverage" CACHE STRING "Build type." FORCE)
Gabor Toth172659d2023-04-27 08:51:21 +020030endif()
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#-------------------------------------------------------------------------------
37include(${TS_ROOT}/deployments/libts/libts-import.cmake)
Gabor Tothee2e7cb2024-10-07 17:02:56 +020038target_link_libraries(psats PUBLIC libts::ts)
Gabor Toth172659d2023-04-27 08:51:21 +020039
40#-------------------------------------------------------------------------------
41# Components that are common across all deployments
42#
43#-------------------------------------------------------------------------------
44
45add_components(
Gabor Tothee2e7cb2024-10-07 17:02:56 +020046 TARGET "psats"
Gabor Toth172659d2023-04-27 08:51:21 +020047 BASE_DIR ${TS_ROOT}
48 COMPONENTS
49 "environments/${TS_ENV}"
50 "components/common/utils"
51 "components/common/trace"
Gabor Tothee2e7cb2024-10-07 17:02:56 +020052 "components/common/libpsats"
Gabor Toth172659d2023-04-27 08:51:21 +020053 "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 Tothee2e7cb2024-10-07 17:02:56 +020073target_compile_definitions(psats PRIVATE
74 EXPORT_PUBLIC_INTERFACE_LIBPSATS
Gabor Toth172659d2023-04-27 08:51:21 +020075 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#-------------------------------------------------------------------------------
85include(${TS_ROOT}/tools/cmake/common/ExportLibrary.cmake REQUIRED)
86
87# Exports library information in preparation for install
88export_library(
Gabor Tothee2e7cb2024-10-07 17:02:56 +020089 TARGET "psats"
90 LIB_NAME "libpsats"
91 PKG_CONFIG_FILE "${CMAKE_CURRENT_LIST_DIR}/libpsatsConfig.cmake.in"
Gabor Toth172659d2023-04-27 08:51:21 +020092)
93
94install(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
101install(FILES "${TS_ROOT}/components/service/common/include/psa/error.h"
102 DESTINATION ${TS_ENV}/include/psa
103)
104
Gabor Tothee2e7cb2024-10-07 17:02:56 +0200105install(FILES "${TS_ROOT}/components/common/libpsats/libpsats.h"
Gabor Toth172659d2023-04-27 08:51:21 +0200106 DESTINATION ${TS_ENV}/include
107)