1# Copyright (C) 2022 Huawei Technologies Co., Ltd. 2# Licensed under the Mulan PSL v2. 3# You can use this software according to the terms and conditions of the Mulan 4# PSL v2. 5# You may obtain a copy of Mulan PSL v2 at: 6# http://license.coscl.org.cn/MulanPSL2 7# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY 8# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO 9# NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 10# See the Mulan PSL v2 for more details. 11cmake_minimum_required(VERSION 3.16 FATAL_ERROR) 12project(tee_sdk C) 13 14if (PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) 15 message(FATAL_ERROR "Forbid compiling in the source tree") 16endif() 17 18# API_LEVEL which indicates the GP API version of TA 19# API_LEVEL=2 indicates GP 1.1.1 which is the current version of the partner 20# API_LEVEL=3 indicates GP 1.2 which is the version we both going to support 21# If no API_LEVEL is specified, API of GP 1.1.1 will be taken 22# TEE flags 23set(COMMON_CFLAGS -DAPI_LEVEL=2) 24 25include($ENV{TEE_OH_BUILD_PATH}/cmake/common.cmake) 26 27set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) 28set(CURRENT_TARGET_SO "combine") 29 30file(GLOB SOURCES *.c) 31 32set(SDK_C_SOURCES 33 ${SDK_C_SOURCES} 34 ${SOURCES} 35) 36 37add_library(${CURRENT_TARGET_SO} SHARED ${SDK_C_SOURCES}) 38target_include_directories(${CURRENT_TARGET_SO} PUBLIC ${COMMON_INCLUDES}) 39target_compile_options(${CURRENT_TARGET_SO} PRIVATE ${COMMON_CFLAGS}) 40target_link_options(${CURRENT_TARGET_SO} PRIVATE ${COMMON_LDFLAGS}) 41