blob: e0cc711a0c05a257bfee3e4e165cfc6fda08878c [file] [log] [blame]
Kshitij Sisodiaa1256e32022-02-23 14:40:45 +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# Native target platform support library #
20#########################################################
21
22cmake_minimum_required(VERSION 3.15.6)
23
Kshitij Sisodiad5679cc2022-03-03 16:30:07 +000024set(PLATFORM_DRIVERS_TARGET platform_drivers)
Kshitij Sisodiaa1256e32022-02-23 14:40:45 +000025
26project(${PLATFORM_DRIVERS_TARGET}
27 DESCRIPTION "Platform drivers library for native target"
28 LANGUAGES C CXX)
29
30# We should not be cross-compiling
31if (${CMAKE_CROSSCOMPILING})
32 message(FATAL_ERROR "Native drivers not available when cross-compiling.")
33endif()
34
Kshitij Sisodiaa1256e32022-02-23 14:40:45 +000035# Create static library
36add_library(${PLATFORM_DRIVERS_TARGET} STATIC)
37
38## Include directories - public
39target_include_directories(${PLATFORM_DRIVERS_TARGET}
40 PUBLIC
41 include)
42
43## Platform sources
44target_sources(${PLATFORM_DRIVERS_TARGET}
45 PRIVATE
Kshitij Sisodiada2ec062022-04-01 14:43:53 +010046 source/platform_drivers.c
47 source/timer_native.c)
Kshitij Sisodiaa1256e32022-02-23 14:40:45 +000048
Kshitij Sisodiac22e80e2022-03-14 09:26:48 +000049## Platform component directory
50if (NOT DEFINED COMPONENTS_DIR)
51 set(COMPONENTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../components)
52endif()
53
54## Platform component: stdout
55set(STDOUT_RETARGET OFF CACHE BOOL "Retarget stdout/err to UART")
56add_subdirectory(${COMPONENTS_DIR}/stdout ${CMAKE_BINARY_DIR}/stdout)
57
58## Platform component: lcd
59add_subdirectory(${COMPONENTS_DIR}/lcd ${CMAKE_BINARY_DIR}/lcd)
60
Kshitij Sisodiada2ec062022-04-01 14:43:53 +010061## Platform component: PMU
62add_subdirectory(${COMPONENTS_DIR}/platform_pmu ${CMAKE_BINARY_DIR}/platform_pmu)
63
Kshitij Sisodiaa1256e32022-02-23 14:40:45 +000064# Add dependencies:
Kshitij Sisodiac22e80e2022-03-14 09:26:48 +000065target_link_libraries(${PLATFORM_DRIVERS_TARGET}
66 PUBLIC
67 log
Kshitij Sisodiada2ec062022-04-01 14:43:53 +010068 platform_pmu
Kshitij Sisodiac22e80e2022-03-14 09:26:48 +000069 stdout
70 lcd_stubs)
Kshitij Sisodiaa1256e32022-02-23 14:40:45 +000071
72# Display status:
73message(STATUS "*******************************************************")
74message(STATUS "Library : " ${PLATFORM_DRIVERS_TARGET})
75message(STATUS "CMAKE_SYSTEM_PROCESSOR : " ${CMAKE_SYSTEM_PROCESSOR})
76message(STATUS "*******************************************************")