blob: b5f94c1834bae20f6fd309d7eb929472781c53e9 [file] [log] [blame]
Kshitij Sisodiad5679cc2022-03-03 16:30:07 +00001#----------------------------------------------------------------------------
2# Copyright (c) 2022 Arm Limited. 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#########################################################
19# Ethos-U NPU timing adapter initialization library #
20#########################################################
21
22cmake_minimum_required(VERSION 3.15.6)
23set(ETHOS_U_NPU_TA_COMPONENT ethosu_ta_init_component)
24project(${ETHOS_U_NPU_TA_COMPONENT}
25 DESCRIPTION "Ethos-U NPU timing adapter initialization library"
26 LANGUAGES C CXX ASM)
27
28# Checks
29## If a TA config file is provided, we generate a settings file
30if (DEFINED TA_CONFIG_FILE)
31 include(${TA_CONFIG_FILE})
32 set(TA_SETTINGS_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/timing_adapter_settings.template)
33 configure_file("${TA_SETTINGS_TEMPLATE}" "${SOURCE_GEN_DIR}/timing_adapter_settings.h")
34endif()
35
36## Timing adapter Source path check
37if (NOT DEFINED ETHOS_U_NPU_TIMING_ADAPTER_SRC_PATH)
38 message(FATAL_ERROR "ETHOS_U_NPU_TIMING_ADAPTER_SRC_PATH should"
39 " be defined when ETHOS_U_NPU_ENABLED=${ETHOS_U_NPU_ENABLED}")
40endif()
41
42add_subdirectory(${ETHOS_U_NPU_TIMING_ADAPTER_SRC_PATH} ${CMAKE_BINARY_DIR}/timing_adapter)
43
44# Create static library
45add_library(${ETHOS_U_NPU_TA_COMPONENT} STATIC)
46
47## Include directories - public
48target_include_directories(${ETHOS_U_NPU_TA_COMPONENT}
49 PUBLIC
50 include
51 ${SOURCE_GEN_DIR})
52
53## Component sources
54target_sources(${ETHOS_U_NPU_TA_COMPONENT}
55 PRIVATE
56 ethosu_ta_init.c)
57
58## Add dependencies
59target_link_libraries(${ETHOS_U_NPU_TA_COMPONENT} PUBLIC
60 timing_adapter
61 log)
62
63# Display status
64message(STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR})
65message(STATUS "*******************************************************")
66message(STATUS "Library : " ${ETHOS_U_NPU_TA_COMPONENT})
67message(STATUS "*******************************************************")