blob: fe61fb73045c2ea8a1612de5534ba10d96d18e97 [file] [log] [blame]
Summer Qin153f3df2022-11-17 15:51:02 +08001#-------------------------------------------------------------------------------
2# Copyright (c) 2023, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8cmake_minimum_required(VERSION 3.15)
9cmake_policy(SET CMP0097 NEW)
10
11# Set eRPC config file. Need to provide config file with an absolute path.
12if (ERPC_CONFIG_FILE)
13 if (NOT EXISTS ${ERPC_CONFIG_FILE})
14 message(FATAL_ERROR "ERPC_CONFIG_FILE does not exist. Please provide it with an absolute path.")
15 endif()
16 # Get the path of the customized eRPC config file
17 get_filename_component(ERPC_CONFIG_FILE_PATH ${ERPC_CONFIG_FILE} DIRECTORY)
18else()
19 # Use default one
20 set(ERPC_CONFIG_FILE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/config")
21endif()
22
23add_library(erpc_server STATIC)
24
25target_sources(erpc_server
26 PRIVATE
27 erpc_server_start.c
28 erpc_server_wrapper.c
29 # eRPC files
30 ${ERPC_REPO_PATH}/erpc_c/infra/erpc_basic_codec.cpp
31 ${ERPC_REPO_PATH}/erpc_c/infra/erpc_crc16.cpp
32 ${ERPC_REPO_PATH}/erpc_c/infra/erpc_framed_transport.cpp
33 ${ERPC_REPO_PATH}/erpc_c/infra/erpc_message_buffer.cpp
34 ${ERPC_REPO_PATH}/erpc_c/infra/erpc_server.cpp
35 ${ERPC_REPO_PATH}/erpc_c/infra/erpc_simple_server.cpp
36 ${ERPC_REPO_PATH}/erpc_c/port/erpc_port_stdlib.cpp
37 ${ERPC_REPO_PATH}/erpc_c/setup/erpc_setup_mbf_dynamic.cpp
38 ${ERPC_REPO_PATH}/erpc_c/setup/erpc_server_setup.cpp
39 # Generated files
40 ${CMAKE_CURRENT_SOURCE_DIR}/../generated_files/tfm_erpc_psa_client_api_server.cpp
41 $<$<BOOL:${CONFIG_TFM_CONNECTION_BASED_SERVICE_API}>:${CMAKE_CURRENT_SOURCE_DIR}/../generated_files/tfm_erpc_psa_connection_api_server.cpp>
42)
43
44target_include_directories(erpc_server
45 PUBLIC
46 ${ERPC_REPO_PATH}/erpc_c/port
47 ${ERPC_REPO_PATH}/erpc_c/infra
48 ${ERPC_REPO_PATH}/erpc_c/transports
49 ${ERPC_REPO_PATH}/erpc_c/setup
50 ${CMAKE_CURRENT_SOURCE_DIR}/
51 ${CMAKE_CURRENT_SOURCE_DIR}/../generated_files
52 ${ERPC_CONFIG_FILE_PATH}/
53)
54
55target_link_libraries(erpc_server
56 PUBLIC
57 tfm_api_ns
58 platform_ns # UART driver header and target config
59)
60
61target_compile_definitions(erpc_server
62 PUBLIC
63 $<$<BOOL:${CONFIG_TFM_CONNECTION_BASED_SERVICE_API}>:CONFIG_TFM_CONNECTION_BASED_SERVICE_API=1>
64)