1#/** @file
2# * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved.
3# * SPDX-License-Identifier : Apache-2.0
4# *
5# * Licensed under the Apache License, Version 2.0 (the "License");
6# * you may not use this file except in compliance with the License.
7# * You may obtain a copy of the License at
8# *
9# *  http://www.apache.org/licenses/LICENSE-2.0
10# *
11# * Unless required by applicable law or agreed to in writing, software
12# * distributed under the License is distributed on an "AS IS" BASIS,
13# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# * See the License for the specific language governing permissions and
15# * limitations under the License.
16#**/
17
18# Listing all the sources from val
19list(APPEND VAL_SRC_C_SPE
20	${PSA_ROOT_DIR}/val/spe/val_driver_service_apis.c
21)
22
23# Listing common sources from partition
24list(APPEND PARTITION_COMMON_SRC_C_SPE
25	${PSA_ROOT_DIR}/ff/partition/driver_partition.c
26)
27
28# Listing sources from partition for client
29list(APPEND PARTITION_IPC_CLIENT_SRC_C_SPE
30	${PSA_ROOT_DIR}/ff/partition/client_partition.c
31)
32# Listing sources from partition for server
33list(APPEND PARTITION_IPC_SERVER_SRC_C_SPE
34	${PSA_ROOT_DIR}/ff/partition/server_partition.c
35)
36
37foreach(src_file ${SUITE_CC_SOURCE_SPE})
38	get_filename_component(FILE_NAME ${src_file} NAME)
39	string(SUBSTRING ${FILE_NAME} 0 9 TEST_STR)
40	if(${TEST_STR} STREQUAL "test_supp")
41		list(APPEND SUITE_SERVER_CC_SRC_SPE ${src_file})
42	else()
43		list(APPEND SUITE_CLIENT_CC_SRC_SPE ${src_file})
44	endif()
45endforeach()
46
47# Create Driver partition library
48add_library(${PSA_TARGET_DRIVER_PARTITION_LIB} STATIC ${VAL_SRC_C_SPE} ${PARTITION_COMMON_SRC_C_SPE} ${PAL_SRC_C_DRIVER_SP})
49
50# Create Client partition library
51add_library(${PSA_TARGET_CLIENT_PARTITION_LIB} STATIC ${PARTITION_IPC_CLIENT_SRC_C_SPE} ${SUITE_CLIENT_CC_SRC_SPE})
52
53# Create Server partition library
54add_library(${PSA_TARGET_SERVER_PARTITION_LIB} STATIC ${PARTITION_IPC_SERVER_SRC_C_SPE} ${SUITE_SERVER_CC_SRC_SPE})
55
56target_include_directories(${PSA_TARGET_DRIVER_PARTITION_LIB} PRIVATE
57	${CMAKE_CURRENT_BINARY_DIR}
58	${PSA_ROOT_DIR}/val/common
59	${PSA_ROOT_DIR}/val/spe
60	${PSA_ROOT_DIR}/ff/partition
61	${PSA_ROOT_DIR}/platform/targets/common/nspe
62	${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe
63)
64
65# Include paths from platform for driver partition build
66foreach(inc_path ${PAL_DRIVER_INCLUDE_PATHS})
67	target_include_directories(${PSA_TARGET_DRIVER_PARTITION_LIB} PRIVATE ${inc_path})
68endforeach()
69
70target_include_directories(${PSA_TARGET_CLIENT_PARTITION_LIB} PRIVATE
71	${CMAKE_CURRENT_BINARY_DIR}
72	${PSA_ROOT_DIR}/val/common
73	${PSA_ROOT_DIR}/val/nspe
74	${PSA_ROOT_DIR}/val/spe
75	${PSA_ROOT_DIR}/platform/targets/common/nspe
76	${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe
77	${PSA_ROOT_DIR}/ff/partition
78)
79target_include_directories(${PSA_TARGET_SERVER_PARTITION_LIB} PRIVATE
80	${CMAKE_CURRENT_BINARY_DIR}
81	${PSA_ROOT_DIR}/val/common
82	${PSA_ROOT_DIR}/val/spe
83	${PSA_ROOT_DIR}/platform/targets/common/nspe
84	${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe
85	${PSA_ROOT_DIR}/ff/partition
86)
87
88# PSA Include directories
89foreach(psa_inc_path ${PSA_INCLUDE_PATHS})
90	target_include_directories(${PSA_TARGET_DRIVER_PARTITION_LIB} PRIVATE ${psa_inc_path})
91	target_include_directories(${PSA_TARGET_CLIENT_PARTITION_LIB} PRIVATE ${psa_inc_path})
92	target_include_directories(${PSA_TARGET_SERVER_PARTITION_LIB} PRIVATE ${psa_inc_path})
93endforeach()
94