blob: d5ca8e5a1fc2b6ac8e25a1f0f98cf516d78178a0 [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#-------------------------------------------------------------------------------
9# The base build file shared between deployments of 'libpsa' for different
10# environments. libpsa provides an interface for accessing PSA API-s.
11# Building with each build type results in different postfix for the library.
12# For details, please refer to deployment.cmake.
13#-------------------------------------------------------------------------------
14
15#-------------------------------------------------------------------------------
16# Common API version implemented by all libpsa deployments
17#-------------------------------------------------------------------------------
18version_semver_read(FILE "${CMAKE_CURRENT_LIST_DIR}/version.txt"
19 MAJOR _major MINOR _minor PATCH _patch)
20set_target_properties(psa PROPERTIES VERSION "${_major}.${_minor}.${_patch}")
21set_target_properties(psa PROPERTIES SOVERSION "${_major}")
22unset(_major)
23unset(_minor)
24unset(_patch)
25
26add_library(libpsa::psa ALIAS psa)
27
28if (COVERAGE)
29 set(LIBPSA_BUILD_TYPE "DebugCoverage" CACHE STRING "Build type." FORCE)
30endif()
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)
38target_link_libraries(psa PUBLIC libts::ts)
39
40#-------------------------------------------------------------------------------
41# Components that are common across all deployments
42#
43#-------------------------------------------------------------------------------
44
45add_components(
46 TARGET "psa"
47 BASE_DIR ${TS_ROOT}
48 COMPONENTS
49 "environments/${TS_ENV}"
50 "components/common/utils"
51 "components/common/trace"
52 "components/common/libpsa"
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
73target_compile_definitions(psa PRIVATE
74 EXPORT_PUBLIC_INTERFACE_LIBPSA
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#-------------------------------------------------------------------------------
85include(${TS_ROOT}/tools/cmake/common/ExportLibrary.cmake REQUIRED)
86
87# Exports library information in preparation for install
88export_library(
89 TARGET "psa"
90 LIB_NAME "libpsa"
91 PKG_CONFIG_FILE "${CMAKE_CURRENT_LIST_DIR}/libpsaConfig.cmake.in"
92)
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
105install(FILES "${TS_ROOT}/components/common/libpsa/libpsa.h"
106 DESTINATION ${TS_ENV}/include
107)