Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Balint Dobszay | 047aea8 | 2022-05-16 14:20:53 +0200 | [diff] [blame] | 2 | # Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved. |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
Balint Dobszay | 047aea8 | 2022-05-16 14:20:53 +0200 | [diff] [blame] | 7 | cmake_minimum_required(VERSION 3.18 FATAL_ERROR) |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 8 | include(../../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 | #------------------------------------------------------------------------------- |
| 19 | include(${TS_ROOT}/environments/linux-pc/env_shared_lib.cmake) |
| 20 | project(trusted-services LANGUAGES CXX C) |
| 21 | add_library(ts SHARED) |
| 22 | target_include_directories(ts PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}") |
| 23 | |
| 24 | #------------------------------------------------------------------------------- |
Julian Hall | 9497010 | 2022-09-28 11:02:48 +0100 | [diff] [blame] | 25 | # External project source-level dependencies |
| 26 | # |
| 27 | #------------------------------------------------------------------------------- |
| 28 | include(${TS_ROOT}/external/tf_a/tf-a.cmake) |
| 29 | add_tfa_dependency(TARGET "ts") |
| 30 | |
| 31 | #------------------------------------------------------------------------------- |
Julian Hall | 2ca63d8 | 2022-12-21 15:20:43 +0000 | [diff] [blame^] | 32 | # Define public interfaces for library |
| 33 | # |
| 34 | #------------------------------------------------------------------------------- |
| 35 | |
| 36 | # Extend libts public interface for linux-pc to allow for alternative fwu |
| 37 | # device configurations. This is intended for test. |
| 38 | target_compile_definitions(ts PRIVATE |
| 39 | EXPORT_PUBLIC_INTERFACE_FWU_SERVICE_CONTEXT |
| 40 | ) |
| 41 | |
| 42 | #------------------------------------------------------------------------------- |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 43 | # Components that are specific to deployment in the linux-pc environment. |
| 44 | # |
| 45 | #------------------------------------------------------------------------------- |
| 46 | add_components( |
| 47 | TARGET "ts" |
| 48 | BASE_DIR ${TS_ROOT} |
| 49 | COMPONENTS |
| 50 | "components/rpc/direct" |
Julian Hall | 2ca63d8 | 2022-12-21 15:20:43 +0000 | [diff] [blame^] | 51 | "components/rpc/common/demux" |
julhal01 | 734dbad | 2020-12-21 10:27:41 +0000 | [diff] [blame] | 52 | "components/common/tlv" |
Julian Hall | b901999 | 2022-07-05 17:05:14 +0100 | [diff] [blame] | 53 | "components/common/uuid" |
Julian Hall | 700aa36 | 2021-05-13 15:30:39 +0100 | [diff] [blame] | 54 | "components/common/endian" |
Julian Hall | 976f9cd | 2021-10-08 09:52:01 +0100 | [diff] [blame] | 55 | "components/common/utils" |
Imre Kis | bcaeb25 | 2022-09-16 15:17:12 +0200 | [diff] [blame] | 56 | "components/common/trace" |
Julian Hall | 9497010 | 2022-09-28 11:02:48 +0100 | [diff] [blame] | 57 | "components/common/crc32/native" |
Julian Hall | 7048d30 | 2021-06-03 16:07:28 +0100 | [diff] [blame] | 58 | "components/config/ramstore" |
Julian Hall | a7e76c8 | 2021-04-14 11:12:11 +0100 | [diff] [blame] | 59 | "components/service/common/include" |
Julian Hall | 99a57e3 | 2021-07-28 14:18:50 +0100 | [diff] [blame] | 60 | "components/service/common/client" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 61 | "components/service/common/serializer/protobuf" |
| 62 | "components/service/common/provider" |
Julian Hall | 3e61454 | 2021-07-29 11:47:47 +0100 | [diff] [blame] | 63 | "components/service/discovery/provider" |
| 64 | "components/service/discovery/provider/serializer/packed-c" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 65 | "components/service/locator/standalone" |
| 66 | "components/service/locator/standalone/services/crypto" |
julhal01 | 3a4207d | 2021-03-08 13:32:08 +0000 | [diff] [blame] | 67 | "components/service/locator/standalone/services/internal-trusted-storage" |
| 68 | "components/service/locator/standalone/services/protected-storage" |
julhal01 | 3ec4c32 | 2021-02-05 17:30:49 +0000 | [diff] [blame] | 69 | "components/service/locator/standalone/services/test-runner" |
Julian Hall | 700aa36 | 2021-05-13 15:30:39 +0100 | [diff] [blame] | 70 | "components/service/locator/standalone/services/attestation" |
Julian Hall | eae7179 | 2022-07-05 15:57:40 +0100 | [diff] [blame] | 71 | "components/service/locator/standalone/services/block-storage" |
Julian Hall | 2ca63d8 | 2022-12-21 15:20:43 +0000 | [diff] [blame^] | 72 | "components/service/locator/standalone/services/fwu" |
Julian Hall | 976f9cd | 2021-10-08 09:52:01 +0100 | [diff] [blame] | 73 | "components/service/locator/standalone/services/smm-variable" |
Julian Hall | 700aa36 | 2021-05-13 15:30:39 +0100 | [diff] [blame] | 74 | "components/service/attestation/include" |
| 75 | "components/service/attestation/claims" |
Julian Hall | 0446491 | 2021-05-18 15:32:49 +0100 | [diff] [blame] | 76 | "components/service/attestation/claims/sources/boot_seed_generator" |
| 77 | "components/service/attestation/claims/sources/null_lifecycle" |
| 78 | "components/service/attestation/claims/sources/instance_id" |
Julian Hall | b7db580 | 2021-07-26 16:20:40 +0100 | [diff] [blame] | 79 | "components/service/attestation/claims/sources/implementation_id" |
Julian Hall | 700aa36 | 2021-05-13 15:30:39 +0100 | [diff] [blame] | 80 | "components/service/attestation/claims/sources/event_log" |
| 81 | "components/service/attestation/claims/sources/event_log/mock" |
Julian Hall | 644b57a | 2021-06-30 08:45:19 +0100 | [diff] [blame] | 82 | "components/service/attestation/reporter/local" |
| 83 | "components/service/attestation/reporter/eat" |
| 84 | "components/service/attestation/key_mngr/local" |
Julian Hall | 700aa36 | 2021-05-13 15:30:39 +0100 | [diff] [blame] | 85 | "components/service/attestation/provider" |
| 86 | "components/service/attestation/provider/serializer/packed-c" |
Julian Hall | eae7179 | 2022-07-05 15:57:40 +0100 | [diff] [blame] | 87 | "components/service/block_storage/block_store" |
| 88 | "components/service/block_storage/block_store/device" |
| 89 | "components/service/block_storage/block_store/device/ram" |
| 90 | "components/service/block_storage/block_store/partitioned" |
Julian Hall | af91035 | 2022-07-26 14:42:34 +0100 | [diff] [blame] | 91 | "components/service/block_storage/block_store/client" |
Julian Hall | eae7179 | 2022-07-05 15:57:40 +0100 | [diff] [blame] | 92 | "components/service/block_storage/provider" |
| 93 | "components/service/block_storage/provider/serializer/packed-c" |
Julian Hall | 9497010 | 2022-09-28 11:02:48 +0100 | [diff] [blame] | 94 | "components/service/block_storage/config/gpt" |
Julian Hall | b901999 | 2022-07-05 17:05:14 +0100 | [diff] [blame] | 95 | "components/service/block_storage/config/ref" |
Julian Hall | 9497010 | 2022-09-28 11:02:48 +0100 | [diff] [blame] | 96 | "components/service/block_storage/factory/ref_ram_gpt" |
Julian Hall | af91035 | 2022-07-26 14:42:34 +0100 | [diff] [blame] | 97 | "components/service/block_storage/factory/client" |
Julian Hall | 9061e6c | 2021-06-29 14:24:20 +0100 | [diff] [blame] | 98 | "components/service/crypto/provider" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 99 | "components/service/crypto/provider/serializer/protobuf" |
julhal01 | 734dbad | 2020-12-21 10:27:41 +0000 | [diff] [blame] | 100 | "components/service/crypto/provider/serializer/packed-c" |
Julian Hall | 7bfb18e | 2021-07-13 15:48:13 +0100 | [diff] [blame] | 101 | "components/service/crypto/provider/extension/hash" |
| 102 | "components/service/crypto/provider/extension/hash/serializer/packed-c" |
Julian Hall | e7bccbe | 2021-07-16 09:50:34 +0100 | [diff] [blame] | 103 | "components/service/crypto/provider/extension/cipher" |
| 104 | "components/service/crypto/provider/extension/cipher/serializer/packed-c" |
Julian Hall | fe487b7 | 2021-07-19 10:29:59 +0100 | [diff] [blame] | 105 | "components/service/crypto/provider/extension/key_derivation" |
| 106 | "components/service/crypto/provider/extension/key_derivation/serializer/packed-c" |
Julian Hall | a6d3cbc | 2021-07-20 10:13:21 +0100 | [diff] [blame] | 107 | "components/service/crypto/provider/extension/mac" |
| 108 | "components/service/crypto/provider/extension/mac/serializer/packed-c" |
Julian Hall | ee8e824 | 2022-02-11 14:24:53 +0000 | [diff] [blame] | 109 | "components/service/crypto/provider/extension/aead" |
| 110 | "components/service/crypto/provider/extension/aead/serializer/packed-c" |
Julian Hall | 7bfb18e | 2021-07-13 15:48:13 +0100 | [diff] [blame] | 111 | "components/service/crypto/factory/full" |
Julian Hall | 9061e6c | 2021-06-29 14:24:20 +0100 | [diff] [blame] | 112 | "components/service/crypto/backend/mbedcrypto" |
| 113 | "components/service/crypto/backend/mbedcrypto/trng_adapter/linux" |
Julian Hall | a7e76c8 | 2021-04-14 11:12:11 +0100 | [diff] [blame] | 114 | "components/service/secure_storage/include" |
julhal01 | 1260f10 | 2021-02-15 17:34:08 +0000 | [diff] [blame] | 115 | "components/service/secure_storage/frontend/psa/its" |
| 116 | "components/service/secure_storage/frontend/secure_storage_provider" |
| 117 | "components/service/secure_storage/backend/secure_storage_client" |
julhal01 | 3a4207d | 2021-03-08 13:32:08 +0000 | [diff] [blame] | 118 | "components/service/secure_storage/backend/mock_store" |
| 119 | "components/service/secure_storage/backend/null_store" |
Julian Hall | af91035 | 2022-07-26 14:42:34 +0100 | [diff] [blame] | 120 | "components/service/secure_storage/backend/secure_flash_store" |
| 121 | "components/service/secure_storage/backend/secure_flash_store/flash_fs" |
| 122 | "components/service/secure_storage/backend/secure_flash_store/flash" |
| 123 | "components/service/secure_storage/backend/secure_flash_store/flash/block_store_adapter" |
julhal01 | 3ec4c32 | 2021-02-05 17:30:49 +0000 | [diff] [blame] | 124 | "components/service/test_runner/provider" |
| 125 | "components/service/test_runner/provider/serializer/packed-c" |
| 126 | "components/service/test_runner/provider/backend/mock" |
julhal01 | 5fe411b | 2021-02-08 17:11:28 +0000 | [diff] [blame] | 127 | "components/service/test_runner/provider/backend/simple_c" |
Julian Hall | 976f9cd | 2021-10-08 09:52:01 +0100 | [diff] [blame] | 128 | "components/service/smm_variable/backend" |
| 129 | "components/service/smm_variable/provider" |
Julian Hall | 9497010 | 2022-09-28 11:02:48 +0100 | [diff] [blame] | 130 | "components/media/disk" |
| 131 | "components/media/disk/disk_images" |
| 132 | "components/media/disk/formatter" |
Julian Hall | 4a658ac | 2022-10-20 10:44:49 +0100 | [diff] [blame] | 133 | "components/media/volume" |
Julian Hall | 9497010 | 2022-09-28 11:02:48 +0100 | [diff] [blame] | 134 | "components/media/volume/index" |
| 135 | "components/media/volume/base_io_dev" |
Julian Hall | 4a658ac | 2022-10-20 10:44:49 +0100 | [diff] [blame] | 136 | "components/media/volume/block_volume" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 137 | "protocols/rpc/common/packed-c" |
| 138 | "protocols/service/crypto/packed-c" |
| 139 | "protocols/service/crypto/protobuf" |
| 140 | "protocols/service/secure_storage/packed-c" |
| 141 | ) |
| 142 | |
| 143 | #------------------------------------------------------------------------------- |
Imre Kis | bcaeb25 | 2022-09-16 15:17:12 +0200 | [diff] [blame] | 144 | # Configure added components |
| 145 | # |
| 146 | #------------------------------------------------------------------------------- |
| 147 | # Force trace level to TRACE_LEVEL_NONE to disable trace messages. This is |
| 148 | # needed till proper trace enablement for the linux-pc environment is done. |
| 149 | target_compile_definitions(ts PUBLIC TRACE_LEVEL=0) |
| 150 | |
| 151 | #------------------------------------------------------------------------------- |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 152 | # Extend with components that are common across all deployments of |
| 153 | # libts |
| 154 | # |
| 155 | #------------------------------------------------------------------------------- |
| 156 | include(../libts.cmake REQUIRED) |
| 157 | |
| 158 | #------------------------------------------------------------------------------- |
| 159 | # Components used by libts from external projects |
| 160 | # |
| 161 | #------------------------------------------------------------------------------- |
| 162 | |
| 163 | # Nanopb |
| 164 | include(${TS_ROOT}/external/nanopb/nanopb.cmake) |
| 165 | target_link_libraries(ts PRIVATE nanopb::protobuf-nanopb-static) |
| 166 | protobuf_generate_all(TGT "ts" NAMESPACE "protobuf" BASE_DIR "${TS_ROOT}/protocols") |
| 167 | |
Balint Dobszay | 3c52ce6 | 2021-05-10 16:27:18 +0200 | [diff] [blame] | 168 | # Mbed TLS provides libmbedcrypto |
| 169 | include(${TS_ROOT}/external/MbedTLS/MbedTLS.cmake) |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 170 | target_link_libraries(ts PRIVATE mbedcrypto) |
| 171 | |
Julian Hall | 700aa36 | 2021-05-13 15:30:39 +0100 | [diff] [blame] | 172 | # Qcbor |
| 173 | include(${TS_ROOT}/external/qcbor/qcbor.cmake) |
| 174 | target_link_libraries(ts PRIVATE qcbor) |
| 175 | |
| 176 | # t_cose |
| 177 | include(${TS_ROOT}/external/t_cose/t_cose.cmake) |
| 178 | target_link_libraries(ts PRIVATE t_cose) |
| 179 | |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 180 | #------------------------------------------------------------------------------- |
| 181 | # Test executable (libts-test) for testing libts static library |
| 182 | # |
| 183 | #------------------------------------------------------------------------------- |
| 184 | add_executable(libts-test) |
| 185 | target_include_directories(libts-test PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}") |
| 186 | target_link_libraries(libts-test PRIVATE "-Wl,--whole-archive" ts "-Wl,--no-whole-archive") |
| 187 | |
| 188 | add_components( |
| 189 | TARGET "libts-test" |
| 190 | BASE_DIR ${TS_ROOT} |
| 191 | COMPONENTS |
| 192 | "components/app/test-runner" |
julhal01 | 734dbad | 2020-12-21 10:27:41 +0000 | [diff] [blame] | 193 | "components/common/tlv" |
Julian Hall | a7e76c8 | 2021-04-14 11:12:11 +0100 | [diff] [blame] | 194 | "components/service/common/include" |
Julian Hall | c6e7a8a | 2021-08-09 14:28:13 +0100 | [diff] [blame] | 195 | "components/service/discovery/client" |
Julian Hall | a7e76c8 | 2021-04-14 11:12:11 +0100 | [diff] [blame] | 196 | "components/service/secure_storage/include" |
julhal01 | 3a4207d | 2021-03-08 13:32:08 +0000 | [diff] [blame] | 197 | "components/service/secure_storage/test/service" |
| 198 | "components/service/secure_storage/frontend/psa/its" |
| 199 | "components/service/secure_storage/frontend/psa/its/test" |
| 200 | "components/service/secure_storage/frontend/psa/ps" |
| 201 | "components/service/secure_storage/frontend/psa/ps/test" |
| 202 | "components/service/secure_storage/backend/secure_storage_client" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 203 | "components/service/crypto/test/service" |
julhal01 | 734dbad | 2020-12-21 10:27:41 +0000 | [diff] [blame] | 204 | "components/service/crypto/test/service/protobuf" |
| 205 | "components/service/crypto/test/service/packed-c" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 206 | "components/service/crypto/client/cpp" |
Julian Hall | 7a70340 | 2021-08-04 09:20:43 +0100 | [diff] [blame] | 207 | "components/service/crypto/client/cpp/protocol/protobuf" |
| 208 | "components/service/crypto/client/cpp/protocol/packed-c" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 209 | "components/service/common/serializer/protobuf" |
Julian Hall | 99a57e3 | 2021-07-28 14:18:50 +0100 | [diff] [blame] | 210 | "components/service/common/client" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 211 | "protocols/service/crypto/protobuf" |
julhal01 | 734dbad | 2020-12-21 10:27:41 +0000 | [diff] [blame] | 212 | "protocols/service/crypto/packed-c" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 213 | ) |
| 214 | |
| 215 | #------------------------------------------------------------------------------- |
| 216 | # Components used by libts-test from external projects |
| 217 | # |
| 218 | #------------------------------------------------------------------------------- |
| 219 | |
| 220 | # CppUTest |
| 221 | include(${TS_ROOT}/external/CppUTest/CppUTest.cmake) |
| 222 | target_link_libraries(libts-test PRIVATE CppUTest) |
| 223 | |
| 224 | # Nanopb |
| 225 | target_link_libraries(libts-test PRIVATE nanopb::protobuf-nanopb-static) |
| 226 | protobuf_generate_all(TGT "libts-test" NAMESPACE "protobuf" BASE_DIR "${TS_ROOT}/protocols") |
| 227 | |
| 228 | # Mbedcrypto |
| 229 | target_link_libraries(libts-test PRIVATE mbedcrypto) |