alexander | 31ae9f0 | 2022-02-10 16:15:54 +0000 | [diff] [blame] | 1 | #---------------------------------------------------------------------------- |
| 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 | # HAL library # |
| 20 | ######################################################### |
| 21 | |
| 22 | cmake_minimum_required(VERSION 3.15.6) |
| 23 | |
| 24 | set(HAL_TARGET hal) |
| 25 | |
| 26 | project(${HAL_TARGET} |
| 27 | DESCRIPTION "HAL library" |
| 28 | LANGUAGES C CXX) |
| 29 | |
| 30 | # Create static library |
| 31 | add_library(${HAL_TARGET} STATIC) |
| 32 | |
| 33 | # Select which profile needs to be used: |
| 34 | if (${CMAKE_CROSSCOMPILING}) |
| 35 | set(PLATFORM_PROFILE bare-metal) |
| 36 | else() |
| 37 | set(PLATFORM_PROFILE native) |
| 38 | endif() |
| 39 | |
Kshitij Sisodia | c22e80e | 2022-03-14 09:26:48 +0000 | [diff] [blame^] | 40 | set(PLATFORM_PROFILE_DIR source/profiles/${PLATFORM_PROFILE}) |
alexander | 31ae9f0 | 2022-02-10 16:15:54 +0000 | [diff] [blame] | 41 | |
| 42 | ## Common include directories - public |
| 43 | target_include_directories(${HAL_TARGET} |
| 44 | PUBLIC |
| 45 | include |
Kshitij Sisodia | a1256e3 | 2022-02-23 14:40:45 +0000 | [diff] [blame] | 46 | ${PLATFORM_PROFILE_DIR}/timer/include) |
alexander | 31ae9f0 | 2022-02-10 16:15:54 +0000 | [diff] [blame] | 47 | |
| 48 | ## Common sources for all profiles |
| 49 | target_sources(${HAL_TARGET} |
| 50 | PRIVATE |
Kshitij Sisodia | c22e80e | 2022-03-14 09:26:48 +0000 | [diff] [blame^] | 51 | source/hal.c |
| 52 | source/data_psn.c |
| 53 | source/data_acq.c |
Kshitij Sisodia | a1256e3 | 2022-02-23 14:40:45 +0000 | [diff] [blame] | 54 | ${PLATFORM_PROFILE_DIR}/timer/platform_timer.c) |
alexander | 31ae9f0 | 2022-02-10 16:15:54 +0000 | [diff] [blame] | 55 | |
| 56 | if (DEFINED VERIFY_TEST_OUTPUT) |
| 57 | message(STATUS "Test output verification flag is: ${VERIFY_TEST_OUTPUT}") |
| 58 | target_compile_definitions(${HAL_TARGET} PUBLIC |
| 59 | VERIFY_TEST_OUTPUT=${VERIFY_TEST_OUTPUT}) |
| 60 | endif () |
| 61 | |
Kshitij Sisodia | a1256e3 | 2022-02-23 14:40:45 +0000 | [diff] [blame] | 62 | if (NOT DEFINED PLATFORM_DRIVERS_DIR) |
Kshitij Sisodia | c22e80e | 2022-03-14 09:26:48 +0000 | [diff] [blame^] | 63 | message(FATAL_ERROR "PLATFORM_DRIVERS_DIR undefined") |
alexander | 31ae9f0 | 2022-02-10 16:15:54 +0000 | [diff] [blame] | 64 | endif() |
| 65 | |
Kshitij Sisodia | d5679cc | 2022-03-03 16:30:07 +0000 | [diff] [blame] | 66 | # Add platform_drivers target |
Kshitij Sisodia | a1256e3 | 2022-02-23 14:40:45 +0000 | [diff] [blame] | 67 | add_subdirectory(${PLATFORM_DRIVERS_DIR} ${CMAKE_BINARY_DIR}/platform_driver) |
| 68 | |
| 69 | # Link time library targets: |
| 70 | target_link_libraries(${HAL_TARGET} |
| 71 | PUBLIC |
Kshitij Sisodia | c22e80e | 2022-03-14 09:26:48 +0000 | [diff] [blame^] | 72 | log # Logging functions |
| 73 | lcd_iface # LCD interface |
| 74 | stdout_iface # Standard output (and error) interface |
| 75 | platform_drivers # Platform drivers implementing the required interfaces |
| 76 | ) |
Kshitij Sisodia | a1256e3 | 2022-02-23 14:40:45 +0000 | [diff] [blame] | 77 | |
alexander | 31ae9f0 | 2022-02-10 16:15:54 +0000 | [diff] [blame] | 78 | # Display status: |
| 79 | message(STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR}) |
| 80 | message(STATUS "*******************************************************") |
| 81 | message(STATUS "Library : " ${HAL_TARGET}) |
| 82 | message(STATUS "CMAKE_SYSTEM_PROCESSOR : " ${CMAKE_SYSTEM_PROCESSOR}) |
| 83 | message(STATUS "*******************************************************") |