aboutsummaryrefslogtreecommitdiff
path: root/deployments/libts/linux-pc/CMakeLists.txt
blob: 9c798ad3ea57af584e140442ab875ea5bde04d4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#-------------------------------------------------------------------------------
# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.16)
include(../../deployment.cmake REQUIRED)

#-------------------------------------------------------------------------------
#  The CMakeLists.txt for building the libts deployment for linux-pc
#
#  Used for building the libts library for the linux-pc enviroment.  Also
#  builds the libts-test executable that acts as a client for the services
#  accessed via libts.  For the linux-pc deployment, libts contains
#  standalone versions of a set of trusted services to support client
#  application development in a native PC environment.
#-------------------------------------------------------------------------------
include(${TS_ROOT}/environments/linux-pc/env_shared_lib.cmake)
project(trusted-services LANGUAGES CXX C)
add_library(ts SHARED)
target_include_directories(ts PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")

#-------------------------------------------------------------------------------
#  Components that are specific to deployment in the linux-pc environment.
#
#-------------------------------------------------------------------------------
add_components(
	TARGET "ts"
	BASE_DIR ${TS_ROOT}
	COMPONENTS
		"components/rpc/direct"
		"components/common/tlv"
		"components/service/common"
		"components/service/common/serializer/protobuf"
		"components/service/common/provider"
		"components/service/locator/standalone"
		"components/service/locator/standalone/services/crypto"
		"components/service/crypto/provider/mbedcrypto"
		"components/service/crypto/provider/mbedcrypto/entropy_source/mock"
		"components/service/crypto/provider/serializer/protobuf"
		"components/service/crypto/provider/serializer/packed-c"
		"components/service/secure_storage/client/psa"
		"components/service/secure_storage/provider/secure_flash_store"
		"components/service/secure_storage/provider/secure_flash_store/flash_fs"
		"components/service/secure_storage/provider/secure_flash_store/flash"
		"protocols/rpc/common/packed-c"
		"protocols/service/crypto/packed-c"
		"protocols/service/crypto/protobuf"
		"protocols/service/secure_storage/packed-c"
)

#-------------------------------------------------------------------------------
#  Extend with components that are common across all deployments of
#  libts
#
#-------------------------------------------------------------------------------
include(../libts.cmake REQUIRED)

#-------------------------------------------------------------------------------
#  Components used by libts from external projects
#
#-------------------------------------------------------------------------------

# Nanopb
include(${TS_ROOT}/external/nanopb/nanopb.cmake)
target_link_libraries(ts PRIVATE nanopb::protobuf-nanopb-static)
protobuf_generate_all(TGT "ts" NAMESPACE "protobuf" BASE_DIR "${TS_ROOT}/protocols")

# Mbedcrypto
include(${TS_ROOT}/external/mbed-crypto/mbedcrypto.cmake)
target_link_libraries(ts PRIVATE mbedcrypto)

#-------------------------------------------------------------------------------
#  Test executable (libts-test) for testing libts static library
#
#-------------------------------------------------------------------------------
add_executable(libts-test)
target_include_directories(libts-test PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")
target_link_libraries(libts-test PRIVATE "-Wl,--whole-archive" ts "-Wl,--no-whole-archive")

add_components(
	TARGET "libts-test"
	BASE_DIR ${TS_ROOT}
	COMPONENTS
		"components/app/test-runner"
		"components/common/tlv"
		"components/service/crypto/test/service"
		"components/service/crypto/test/service/protobuf"
		"components/service/crypto/test/service/packed-c"
		"components/service/crypto/client/cpp"
		"components/service/crypto/client/cpp/protobuf"
		"components/service/crypto/client/cpp/packed-c"
		"components/service/common/serializer/protobuf"
		"protocols/service/crypto/protobuf"
		"protocols/service/crypto/packed-c"
)

#-------------------------------------------------------------------------------
#  Components used by libts-test from external projects
#
#-------------------------------------------------------------------------------

# CppUTest
include(${TS_ROOT}/external/CppUTest/CppUTest.cmake)
target_link_libraries(libts-test PRIVATE CppUTest)

# Nanopb
target_link_libraries(libts-test PRIVATE nanopb::protobuf-nanopb-static)
protobuf_generate_all(TGT "libts-test" NAMESPACE "protobuf" BASE_DIR "${TS_ROOT}/protocols")

# Mbedcrypto
target_link_libraries(libts-test PRIVATE mbedcrypto)