blob: 9472dc0895ef95d225bb4064214ce2e5eecc8f66 [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)
9
10if (NOT DEFINED TFM_INSTALL_PATH)
11 if (DEFINED ENV{TFM_INSTALL_PATH})
12 set(TFM_INSTALL_PATH $ENV{TFM_INSTALL_PATH})
13 else()
14 message(FATAL_ERROR "TFM_INSTALL_PATH not found. Please set TFM_INSTALL_PATH environment variable or pass -DTFM_INSTALL_PATH flag.")
15 endif()
16endif()
17
18if (NOT DEFINED ERPC_REPO_PATH)
19 if (DEFINED ENV{ERPC_REPO_PATH})
20 set(ERPC_REPO_PATH $ENV{ERPC_REPO_PATH})
21 else()
22 message(FATAL_ERROR "ERPC_REPO_PATH not found. Please set ERPC_REPO_PATH environment variable or pass -DERPC_REPO_PATH flag.")
23 endif()
24endif()
25
26# Set eRPC config file. Need to provide config file with an absolute path.
27if (ERPC_CONFIG_FILE)
28 if (NOT EXISTS ${ERPC_CONFIG_FILE})
29 message(FATAL_ERROR "ERPC_CONFIG_FILE does not exist. Please provide it with an absolute path.")
30 endif()
31 # Get the path of the customized eRPC config file
32 get_filename_component(ERPC_CONFIG_FILE_PATH ${ERPC_CONFIG_FILE} DIRECTORY)
33else()
34 # Use default one
35 set(ERPC_CONFIG_FILE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/config")
36endif()
37
38add_library(erpc_client STATIC)
39
40target_sources(erpc_client
41 PRIVATE
42 erpc_client_wrapper.c
43 erpc_client_start.c
44 # eRPC files
45 ${ERPC_REPO_PATH}/erpc_c/infra/erpc_basic_codec.cpp
46 ${ERPC_REPO_PATH}/erpc_c/infra/erpc_client_manager.cpp
47 ${ERPC_REPO_PATH}/erpc_c/infra/erpc_crc16.cpp
48 ${ERPC_REPO_PATH}/erpc_c/infra/erpc_framed_transport.cpp
49 ${ERPC_REPO_PATH}/erpc_c/infra/erpc_message_buffer.cpp
50 ${ERPC_REPO_PATH}/erpc_c/port/erpc_serial.cpp
51 ${ERPC_REPO_PATH}/erpc_c/setup/erpc_client_setup.cpp
52 ${ERPC_REPO_PATH}/erpc_c/setup/erpc_setup_mbf_dynamic.cpp
53 # Generated files
Kevin Peng0eca5ea2023-07-21 17:32:31 +080054 ${CMAKE_CURRENT_SOURCE_DIR}/../generated_files/tfm_erpc_client.cpp
Summer Qin153f3df2022-11-17 15:51:02 +080055)
56
57target_include_directories(erpc_client
58 PUBLIC
59 ${ERPC_REPO_PATH}/erpc_c/port
60 ${ERPC_REPO_PATH}/erpc_c/infra
61 ${ERPC_REPO_PATH}/erpc_c/transports
62 ${ERPC_REPO_PATH}/erpc_c/setup
63 ${CMAKE_CURRENT_SOURCE_DIR}/
64 ${CMAKE_CURRENT_SOURCE_DIR}/../generated_files
65 ${TFM_INSTALL_PATH}/interface/include
66 ${ERPC_CONFIG_FILE_PATH}/
67)