blob: b4d39a1870f232f1b869da468ca5b1b3fdd56a08 [file] [log] [blame]
Julian Hallb1d5d5f2020-11-23 18:23:48 +01001#-------------------------------------------------------------------------------
julhal01734dbad2020-12-21 10:27:41 +00002# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
Julian Hallb1d5d5f2020-11-23 18:23:48 +01003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7cmake_minimum_required(VERSION 3.16)
8include(../../deployment.cmake REQUIRED)
9
10#-------------------------------------------------------------------------------
11# The CMakeLists.txt for building the libts deployment for linux-pc
12#
13# Used for building the libts library for the linux-pc enviroment. Also
14# builds the libts-test executable that acts as a client for the services
15# accessed via libts. For the linux-pc deployment, libts contains
16# standalone versions of a set of trusted services to support client
17# application development in a native PC environment.
18#-------------------------------------------------------------------------------
19include(${TS_ROOT}/environments/linux-pc/env_shared_lib.cmake)
20project(trusted-services LANGUAGES CXX C)
21add_library(ts SHARED)
22target_include_directories(ts PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")
23
24#-------------------------------------------------------------------------------
25# Components that are specific to deployment in the linux-pc environment.
26#
27#-------------------------------------------------------------------------------
28add_components(
29 TARGET "ts"
30 BASE_DIR ${TS_ROOT}
31 COMPONENTS
32 "components/rpc/direct"
julhal01734dbad2020-12-21 10:27:41 +000033 "components/common/tlv"
Julian Hall700aa362021-05-13 15:30:39 +010034 "components/common/endian"
Julian Hall7048d302021-06-03 16:07:28 +010035 "components/config/ramstore"
Julian Halla7e76c82021-04-14 11:12:11 +010036 "components/service/common/include"
Julian Hallb1d5d5f2020-11-23 18:23:48 +010037 "components/service/common/serializer/protobuf"
38 "components/service/common/provider"
39 "components/service/locator/standalone"
40 "components/service/locator/standalone/services/crypto"
julhal013a4207d2021-03-08 13:32:08 +000041 "components/service/locator/standalone/services/internal-trusted-storage"
42 "components/service/locator/standalone/services/protected-storage"
julhal013ec4c322021-02-05 17:30:49 +000043 "components/service/locator/standalone/services/test-runner"
Julian Hall700aa362021-05-13 15:30:39 +010044 "components/service/locator/standalone/services/attestation"
45 "components/service/attestation/include"
46 "components/service/attestation/claims"
Julian Hall04464912021-05-18 15:32:49 +010047 "components/service/attestation/claims/sources/boot_seed_generator"
48 "components/service/attestation/claims/sources/null_lifecycle"
49 "components/service/attestation/claims/sources/instance_id"
Julian Hall700aa362021-05-13 15:30:39 +010050 "components/service/attestation/claims/sources/event_log"
51 "components/service/attestation/claims/sources/event_log/mock"
Julian Hall644b57a2021-06-30 08:45:19 +010052 "components/service/attestation/reporter/local"
53 "components/service/attestation/reporter/eat"
54 "components/service/attestation/key_mngr/local"
Julian Hall700aa362021-05-13 15:30:39 +010055 "components/service/attestation/provider"
56 "components/service/attestation/provider/serializer/packed-c"
Julian Hall9061e6c2021-06-29 14:24:20 +010057 "components/service/crypto/provider"
Julian Hallb1d5d5f2020-11-23 18:23:48 +010058 "components/service/crypto/provider/serializer/protobuf"
julhal01734dbad2020-12-21 10:27:41 +000059 "components/service/crypto/provider/serializer/packed-c"
Julian Hall7bfb18e2021-07-13 15:48:13 +010060 "components/service/crypto/provider/extension/hash"
61 "components/service/crypto/provider/extension/hash/serializer/packed-c"
62 "components/service/crypto/factory/full"
Julian Hall9061e6c2021-06-29 14:24:20 +010063 "components/service/crypto/backend/mbedcrypto"
64 "components/service/crypto/backend/mbedcrypto/trng_adapter/linux"
Julian Halla7e76c82021-04-14 11:12:11 +010065 "components/service/secure_storage/include"
julhal011260f102021-02-15 17:34:08 +000066 "components/service/secure_storage/frontend/psa/its"
67 "components/service/secure_storage/frontend/secure_storage_provider"
68 "components/service/secure_storage/backend/secure_storage_client"
julhal013a4207d2021-03-08 13:32:08 +000069 "components/service/secure_storage/backend/mock_store"
70 "components/service/secure_storage/backend/null_store"
julhal013ec4c322021-02-05 17:30:49 +000071 "components/service/test_runner/provider"
72 "components/service/test_runner/provider/serializer/packed-c"
73 "components/service/test_runner/provider/backend/mock"
julhal015fe411b2021-02-08 17:11:28 +000074 "components/service/test_runner/provider/backend/simple_c"
Julian Hallb1d5d5f2020-11-23 18:23:48 +010075 "protocols/rpc/common/packed-c"
76 "protocols/service/crypto/packed-c"
77 "protocols/service/crypto/protobuf"
78 "protocols/service/secure_storage/packed-c"
79)
80
81#-------------------------------------------------------------------------------
82# Extend with components that are common across all deployments of
83# libts
84#
85#-------------------------------------------------------------------------------
86include(../libts.cmake REQUIRED)
87
88#-------------------------------------------------------------------------------
89# Components used by libts from external projects
90#
91#-------------------------------------------------------------------------------
92
93# Nanopb
94include(${TS_ROOT}/external/nanopb/nanopb.cmake)
95target_link_libraries(ts PRIVATE nanopb::protobuf-nanopb-static)
96protobuf_generate_all(TGT "ts" NAMESPACE "protobuf" BASE_DIR "${TS_ROOT}/protocols")
97
Balint Dobszay3c52ce62021-05-10 16:27:18 +020098# Mbed TLS provides libmbedcrypto
99include(${TS_ROOT}/external/MbedTLS/MbedTLS.cmake)
Julian Hallb1d5d5f2020-11-23 18:23:48 +0100100target_link_libraries(ts PRIVATE mbedcrypto)
101
Julian Hall700aa362021-05-13 15:30:39 +0100102# Qcbor
103include(${TS_ROOT}/external/qcbor/qcbor.cmake)
104target_link_libraries(ts PRIVATE qcbor)
105
106# t_cose
107include(${TS_ROOT}/external/t_cose/t_cose.cmake)
108target_link_libraries(ts PRIVATE t_cose)
109
Julian Hallb1d5d5f2020-11-23 18:23:48 +0100110#-------------------------------------------------------------------------------
111# Test executable (libts-test) for testing libts static library
112#
113#-------------------------------------------------------------------------------
114add_executable(libts-test)
115target_include_directories(libts-test PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")
116target_link_libraries(libts-test PRIVATE "-Wl,--whole-archive" ts "-Wl,--no-whole-archive")
117
118add_components(
119 TARGET "libts-test"
120 BASE_DIR ${TS_ROOT}
121 COMPONENTS
122 "components/app/test-runner"
julhal01734dbad2020-12-21 10:27:41 +0000123 "components/common/tlv"
Julian Halla7e76c82021-04-14 11:12:11 +0100124 "components/service/common/include"
125 "components/service/secure_storage/include"
julhal013a4207d2021-03-08 13:32:08 +0000126 "components/service/secure_storage/test/service"
127 "components/service/secure_storage/frontend/psa/its"
128 "components/service/secure_storage/frontend/psa/its/test"
129 "components/service/secure_storage/frontend/psa/ps"
130 "components/service/secure_storage/frontend/psa/ps/test"
131 "components/service/secure_storage/backend/secure_storage_client"
Julian Hallb1d5d5f2020-11-23 18:23:48 +0100132 "components/service/crypto/test/service"
julhal01734dbad2020-12-21 10:27:41 +0000133 "components/service/crypto/test/service/protobuf"
134 "components/service/crypto/test/service/packed-c"
Julian Hallb1d5d5f2020-11-23 18:23:48 +0100135 "components/service/crypto/client/cpp"
julhal01734dbad2020-12-21 10:27:41 +0000136 "components/service/crypto/client/cpp/protobuf"
137 "components/service/crypto/client/cpp/packed-c"
Julian Hallb1d5d5f2020-11-23 18:23:48 +0100138 "components/service/common/serializer/protobuf"
139 "protocols/service/crypto/protobuf"
julhal01734dbad2020-12-21 10:27:41 +0000140 "protocols/service/crypto/packed-c"
Julian Hallb1d5d5f2020-11-23 18:23:48 +0100141)
142
143#-------------------------------------------------------------------------------
144# Components used by libts-test from external projects
145#
146#-------------------------------------------------------------------------------
147
148# CppUTest
149include(${TS_ROOT}/external/CppUTest/CppUTest.cmake)
150target_link_libraries(libts-test PRIVATE CppUTest)
151
152# Nanopb
153target_link_libraries(libts-test PRIVATE nanopb::protobuf-nanopb-static)
154protobuf_generate_all(TGT "libts-test" NAMESPACE "protobuf" BASE_DIR "${TS_ROOT}/protocols")
155
156# Mbedcrypto
157target_link_libraries(libts-test PRIVATE mbedcrypto)