Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
julhal01 | 734dbad | 2020-12-21 10:27:41 +0000 | [diff] [blame] | 2 | # Copyright (c) 2020-2021, 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 | #------------------------------------------------------------------------------- |
| 7 | cmake_minimum_required(VERSION 3.16) |
| 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 | #------------------------------------------------------------------------------- |
| 25 | # Components that are specific to deployment in the linux-pc environment. |
| 26 | # |
| 27 | #------------------------------------------------------------------------------- |
| 28 | add_components( |
| 29 | TARGET "ts" |
| 30 | BASE_DIR ${TS_ROOT} |
| 31 | COMPONENTS |
| 32 | "components/rpc/direct" |
julhal01 | 734dbad | 2020-12-21 10:27:41 +0000 | [diff] [blame] | 33 | "components/common/tlv" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 34 | "components/service/common" |
| 35 | "components/service/common/serializer/protobuf" |
| 36 | "components/service/common/provider" |
| 37 | "components/service/locator/standalone" |
| 38 | "components/service/locator/standalone/services/crypto" |
julhal01 | 3a4207d | 2021-03-08 13:32:08 +0000 | [diff] [blame] | 39 | "components/service/locator/standalone/services/internal-trusted-storage" |
| 40 | "components/service/locator/standalone/services/protected-storage" |
julhal01 | 3ec4c32 | 2021-02-05 17:30:49 +0000 | [diff] [blame] | 41 | "components/service/locator/standalone/services/test-runner" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 42 | "components/service/crypto/provider/mbedcrypto" |
julhal01 | 2c18fbf | 2021-02-01 08:29:28 +0000 | [diff] [blame] | 43 | "components/service/crypto/provider/mbedcrypto/trng_adapter/linux" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 44 | "components/service/crypto/provider/serializer/protobuf" |
julhal01 | 734dbad | 2020-12-21 10:27:41 +0000 | [diff] [blame] | 45 | "components/service/crypto/provider/serializer/packed-c" |
julhal01 | 1260f10 | 2021-02-15 17:34:08 +0000 | [diff] [blame] | 46 | "components/service/secure_storage/frontend/psa/its" |
| 47 | "components/service/secure_storage/frontend/secure_storage_provider" |
| 48 | "components/service/secure_storage/backend/secure_storage_client" |
julhal01 | 3a4207d | 2021-03-08 13:32:08 +0000 | [diff] [blame] | 49 | "components/service/secure_storage/backend/mock_store" |
| 50 | "components/service/secure_storage/backend/null_store" |
julhal01 | 3ec4c32 | 2021-02-05 17:30:49 +0000 | [diff] [blame] | 51 | "components/service/test_runner/provider" |
| 52 | "components/service/test_runner/provider/serializer/packed-c" |
| 53 | "components/service/test_runner/provider/backend/mock" |
julhal01 | 5fe411b | 2021-02-08 17:11:28 +0000 | [diff] [blame] | 54 | "components/service/test_runner/provider/backend/simple_c" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 55 | "protocols/rpc/common/packed-c" |
| 56 | "protocols/service/crypto/packed-c" |
| 57 | "protocols/service/crypto/protobuf" |
| 58 | "protocols/service/secure_storage/packed-c" |
| 59 | ) |
| 60 | |
| 61 | #------------------------------------------------------------------------------- |
| 62 | # Extend with components that are common across all deployments of |
| 63 | # libts |
| 64 | # |
| 65 | #------------------------------------------------------------------------------- |
| 66 | include(../libts.cmake REQUIRED) |
| 67 | |
| 68 | #------------------------------------------------------------------------------- |
| 69 | # Components used by libts from external projects |
| 70 | # |
| 71 | #------------------------------------------------------------------------------- |
| 72 | |
| 73 | # Nanopb |
| 74 | include(${TS_ROOT}/external/nanopb/nanopb.cmake) |
| 75 | target_link_libraries(ts PRIVATE nanopb::protobuf-nanopb-static) |
| 76 | protobuf_generate_all(TGT "ts" NAMESPACE "protobuf" BASE_DIR "${TS_ROOT}/protocols") |
| 77 | |
Balint Dobszay | 3c52ce6 | 2021-05-10 16:27:18 +0200 | [diff] [blame] | 78 | # Mbed TLS provides libmbedcrypto |
| 79 | include(${TS_ROOT}/external/MbedTLS/MbedTLS.cmake) |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 80 | target_link_libraries(ts PRIVATE mbedcrypto) |
| 81 | |
| 82 | #------------------------------------------------------------------------------- |
| 83 | # Test executable (libts-test) for testing libts static library |
| 84 | # |
| 85 | #------------------------------------------------------------------------------- |
| 86 | add_executable(libts-test) |
| 87 | target_include_directories(libts-test PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}") |
| 88 | target_link_libraries(libts-test PRIVATE "-Wl,--whole-archive" ts "-Wl,--no-whole-archive") |
| 89 | |
| 90 | add_components( |
| 91 | TARGET "libts-test" |
| 92 | BASE_DIR ${TS_ROOT} |
| 93 | COMPONENTS |
| 94 | "components/app/test-runner" |
julhal01 | 734dbad | 2020-12-21 10:27:41 +0000 | [diff] [blame] | 95 | "components/common/tlv" |
julhal01 | 3a4207d | 2021-03-08 13:32:08 +0000 | [diff] [blame] | 96 | "components/service/common" |
| 97 | "components/service/secure_storage/test/service" |
| 98 | "components/service/secure_storage/frontend/psa/its" |
| 99 | "components/service/secure_storage/frontend/psa/its/test" |
| 100 | "components/service/secure_storage/frontend/psa/ps" |
| 101 | "components/service/secure_storage/frontend/psa/ps/test" |
| 102 | "components/service/secure_storage/backend/secure_storage_client" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 103 | "components/service/crypto/test/service" |
julhal01 | 734dbad | 2020-12-21 10:27:41 +0000 | [diff] [blame] | 104 | "components/service/crypto/test/service/protobuf" |
| 105 | "components/service/crypto/test/service/packed-c" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 106 | "components/service/crypto/client/cpp" |
julhal01 | 734dbad | 2020-12-21 10:27:41 +0000 | [diff] [blame] | 107 | "components/service/crypto/client/cpp/protobuf" |
| 108 | "components/service/crypto/client/cpp/packed-c" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 109 | "components/service/common/serializer/protobuf" |
| 110 | "protocols/service/crypto/protobuf" |
julhal01 | 734dbad | 2020-12-21 10:27:41 +0000 | [diff] [blame] | 111 | "protocols/service/crypto/packed-c" |
Julian Hall | b1d5d5f | 2020-11-23 18:23:48 +0100 | [diff] [blame] | 112 | ) |
| 113 | |
| 114 | #------------------------------------------------------------------------------- |
| 115 | # Components used by libts-test from external projects |
| 116 | # |
| 117 | #------------------------------------------------------------------------------- |
| 118 | |
| 119 | # CppUTest |
| 120 | include(${TS_ROOT}/external/CppUTest/CppUTest.cmake) |
| 121 | target_link_libraries(libts-test PRIVATE CppUTest) |
| 122 | |
| 123 | # Nanopb |
| 124 | target_link_libraries(libts-test PRIVATE nanopb::protobuf-nanopb-static) |
| 125 | protobuf_generate_all(TGT "libts-test" NAMESPACE "protobuf" BASE_DIR "${TS_ROOT}/protocols") |
| 126 | |
| 127 | # Mbedcrypto |
| 128 | target_link_libraries(libts-test PRIVATE mbedcrypto) |