1#-------------------------------------------------------------------------------
2# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8#-------------------------------------------------------------------------------
9#  The base build file shared between deployments of 'libts' for
10#  different environments.  libts provides a client interface for locating
11#  service instances and establishing RPC sessions for using services.
12#-------------------------------------------------------------------------------
13
14#-------------------------------------------------------------------------------
15#  Common API version implemented by all libts deployments
16#-------------------------------------------------------------------------------
17version_semver_read(FILE "${CMAKE_CURRENT_LIST_DIR}/version.txt"
18					MAJOR _major MINOR _minor PATCH _patch)
19set_target_properties(ts PROPERTIES VERSION "${_major}.${_minor}.${_patch}")
20set_target_properties(ts PROPERTIES SOVERSION "${_major}")
21unset(_major)
22unset(_minor)
23unset(_patch)
24
25add_library(libts::ts ALIAS ts)
26
27if (COVERAGE)
28	set(LIBTS_BUILD_TYPE "DebugCoverage" CACHE STRING "Build type." FORCE)
29endif()
30
31#-------------------------------------------------------------------------------
32#  Components that are common across all deployments
33#
34#-------------------------------------------------------------------------------
35add_components(
36	TARGET "ts"
37	BASE_DIR ${TS_ROOT}
38	COMPONENTS
39		"environments/${TS_ENV}"
40		"components/common/trace"
41		"components/rpc/common/caller"
42		"components/rpc/common/interface"
43		"components/service/locator"
44		"components/service/locator/interface"
45)
46
47#-------------------------------------------------------------------------------
48#  Define public interfaces for library
49#
50#-------------------------------------------------------------------------------
51
52# Enable exporting interface symbols for library public interface
53target_compile_definitions(ts PRIVATE
54	EXPORT_PUBLIC_INTERFACE_TRACE
55	EXPORT_PUBLIC_INTERFACE_RPC_CALLER
56	EXPORT_PUBLIC_INTERFACE_RPC_SERVICE
57	EXPORT_PUBLIC_INTERFACE_SERVICE_LOCATOR
58)
59
60# Do not export symbols from static libraries linked to this library
61target_link_options(ts PRIVATE -Wl,--exclude-libs,ALL)
62
63#-------------------------------------------------------------------------------
64#  Export the library and the corresponding public interface header files
65#
66#-------------------------------------------------------------------------------
67include(${TS_ROOT}/tools/cmake/common/ExportLibrary.cmake REQUIRED)
68
69set_property(TARGET "ts" APPEND PROPERTY
70			PUBLIC_HEADER "${TS_ROOT}/components/common/trace/include/trace.h")
71
72# Exports library information in preparation for install
73export_library(
74	TARGET "ts"
75	LIB_NAME "libts"
76	PKG_CONFIG_FILE "${CMAKE_CURRENT_LIST_DIR}/libtsConfig.cmake.in"
77)
78