blob: 3378ee3f30a2653f94b7045abc983dda4a094c4d [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 Hallb1d5d5f2020-11-23 18:23:48 +010034 "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"
julhal013ec4c322021-02-05 17:30:49 +000039 "components/service/locator/standalone/services/test-runner"
Julian Hallb1d5d5f2020-11-23 18:23:48 +010040 "components/service/crypto/provider/mbedcrypto"
julhal012c18fbf2021-02-01 08:29:28 +000041 "components/service/crypto/provider/mbedcrypto/trng_adapter/linux"
Julian Hallb1d5d5f2020-11-23 18:23:48 +010042 "components/service/crypto/provider/serializer/protobuf"
julhal01734dbad2020-12-21 10:27:41 +000043 "components/service/crypto/provider/serializer/packed-c"
julhal011260f102021-02-15 17:34:08 +000044 "components/service/secure_storage/frontend/psa/its"
45 "components/service/secure_storage/frontend/secure_storage_provider"
46 "components/service/secure_storage/backend/secure_storage_client"
47 "components/service/secure_storage/backend/secure_flash_store"
48 "components/service/secure_storage/backend/secure_flash_store/flash_fs"
49 "components/service/secure_storage/backend/secure_flash_store/flash"
julhal013ec4c322021-02-05 17:30:49 +000050 "components/service/test_runner/provider"
51 "components/service/test_runner/provider/serializer/packed-c"
52 "components/service/test_runner/provider/backend/mock"
julhal015fe411b2021-02-08 17:11:28 +000053 "components/service/test_runner/provider/backend/simple_c"
Julian Hallb1d5d5f2020-11-23 18:23:48 +010054 "protocols/rpc/common/packed-c"
55 "protocols/service/crypto/packed-c"
56 "protocols/service/crypto/protobuf"
57 "protocols/service/secure_storage/packed-c"
58)
59
60#-------------------------------------------------------------------------------
61# Extend with components that are common across all deployments of
62# libts
63#
64#-------------------------------------------------------------------------------
65include(../libts.cmake REQUIRED)
66
67#-------------------------------------------------------------------------------
68# Components used by libts from external projects
69#
70#-------------------------------------------------------------------------------
71
72# Nanopb
73include(${TS_ROOT}/external/nanopb/nanopb.cmake)
74target_link_libraries(ts PRIVATE nanopb::protobuf-nanopb-static)
75protobuf_generate_all(TGT "ts" NAMESPACE "protobuf" BASE_DIR "${TS_ROOT}/protocols")
76
77# Mbedcrypto
78include(${TS_ROOT}/external/mbed-crypto/mbedcrypto.cmake)
79target_link_libraries(ts PRIVATE mbedcrypto)
80
81#-------------------------------------------------------------------------------
82# Test executable (libts-test) for testing libts static library
83#
84#-------------------------------------------------------------------------------
85add_executable(libts-test)
86target_include_directories(libts-test PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")
87target_link_libraries(libts-test PRIVATE "-Wl,--whole-archive" ts "-Wl,--no-whole-archive")
88
89add_components(
90 TARGET "libts-test"
91 BASE_DIR ${TS_ROOT}
92 COMPONENTS
93 "components/app/test-runner"
julhal01734dbad2020-12-21 10:27:41 +000094 "components/common/tlv"
Julian Hallb1d5d5f2020-11-23 18:23:48 +010095 "components/service/crypto/test/service"
julhal01734dbad2020-12-21 10:27:41 +000096 "components/service/crypto/test/service/protobuf"
97 "components/service/crypto/test/service/packed-c"
Julian Hallb1d5d5f2020-11-23 18:23:48 +010098 "components/service/crypto/client/cpp"
julhal01734dbad2020-12-21 10:27:41 +000099 "components/service/crypto/client/cpp/protobuf"
100 "components/service/crypto/client/cpp/packed-c"
Julian Hallb1d5d5f2020-11-23 18:23:48 +0100101 "components/service/common/serializer/protobuf"
102 "protocols/service/crypto/protobuf"
julhal01734dbad2020-12-21 10:27:41 +0000103 "protocols/service/crypto/packed-c"
Julian Hallb1d5d5f2020-11-23 18:23:48 +0100104)
105
106#-------------------------------------------------------------------------------
107# Components used by libts-test from external projects
108#
109#-------------------------------------------------------------------------------
110
111# CppUTest
112include(${TS_ROOT}/external/CppUTest/CppUTest.cmake)
113target_link_libraries(libts-test PRIVATE CppUTest)
114
115# Nanopb
116target_link_libraries(libts-test PRIVATE nanopb::protobuf-nanopb-static)
117protobuf_generate_all(TGT "libts-test" NAMESPACE "protobuf" BASE_DIR "${TS_ROOT}/protocols")
118
119# Mbedcrypto
120target_link_libraries(libts-test PRIVATE mbedcrypto)