Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 1 | # |
Mikael Olsson | d4ad9e5 | 2024-02-07 11:22:26 +0100 | [diff] [blame] | 2 | # SPDX-FileCopyrightText: Copyright 2020-2022, 2024 Arm Limited and/or its affiliates <open-source-office@arm.com> |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 3 | # SPDX-License-Identifier: Apache-2.0 |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the License); you may |
| 6 | # not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # 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, WITHOUT |
| 13 | # 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 | cmake_minimum_required(VERSION 3.0.2) |
| 19 | |
| 20 | # Set the project name and version |
| 21 | project("linux_driver_stack" VERSION 1.0) |
| 22 | |
| 23 | # Default options |
| 24 | option(BUILD_KERNEL "Build the kernel driver" ON) |
| 25 | option(BUILD_MAILBOX "Build the MHU mailbox kernel module" ON) |
Per Åstrand | 87ca5da | 2021-04-15 09:47:03 +0200 | [diff] [blame] | 26 | option(BUILD_REMOTEPROC "Build the remoteproc kernel module" ON) |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 27 | |
Lior Dekel | c3f4a83 | 2021-12-02 10:58:12 +0200 | [diff] [blame] | 28 | # Set variables |
| 29 | if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") |
| 30 | set(ARCH "arm64") |
| 31 | else() |
| 32 | set(ARCH "arm") |
| 33 | endif() |
| 34 | |
| 35 | string(REGEX REPLACE "(.*)gcc$" "\\1" CROSS_COMPILE "${CMAKE_C_COMPILER}") |
| 36 | |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 37 | # Add rpath to library directory |
| 38 | set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") |
| 39 | |
| 40 | # Add include directory |
Mikael Olsson | d4ad9e5 | 2024-02-07 11:22:26 +0100 | [diff] [blame] | 41 | include_directories("kernel/include") |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 42 | |
| 43 | # Add sub directories |
| 44 | if(BUILD_KERNEL) |
| 45 | add_subdirectory(kernel) |
| 46 | endif() |
| 47 | |
Davide Grohmann | f036423 | 2022-06-16 17:42:58 +0200 | [diff] [blame] | 48 | if(BUILD_MAILBOX) |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 49 | add_subdirectory(mailbox) |
| 50 | endif() |
| 51 | |
Davide Grohmann | f036423 | 2022-06-16 17:42:58 +0200 | [diff] [blame] | 52 | if(BUILD_REMOTEPROC) |
Lior Dekel | c3f4a83 | 2021-12-02 10:58:12 +0200 | [diff] [blame] | 53 | add_subdirectory(remoteproc) |
Per Åstrand | 87ca5da | 2021-04-15 09:47:03 +0200 | [diff] [blame] | 54 | endif() |
| 55 | |
Kristofer Jonsson | b74492c | 2020-09-10 13:26:01 +0200 | [diff] [blame] | 56 | # Build driver library |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 57 | add_subdirectory(driver_library) |
Kristofer Jonsson | b74492c | 2020-09-10 13:26:01 +0200 | [diff] [blame] | 58 | |
| 59 | # Build utils |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 60 | add_subdirectory(utils) |
Davide Grohmann | f036423 | 2022-06-16 17:42:58 +0200 | [diff] [blame] | 61 | |
| 62 | # Build tests |
| 63 | if(ETHOSU_TARGET_NPU_CONFIG) |
| 64 | add_subdirectory(tests) |
| 65 | endif() |
Rajasekaran Kalidoss | 77042ef | 2024-03-26 15:34:30 +0100 | [diff] [blame] | 66 | |
| 67 | # |
| 68 | # Print build status |
| 69 | # |
| 70 | |
| 71 | message(STATUS "*******************************************************") |
| 72 | message(STATUS "PROJECT_NAME : ${PROJECT_NAME}") |
| 73 | message(STATUS "BUILD_KERNEL : ${BUILD_KERNEL}") |
| 74 | message(STATUS "BUILD_MAILBOX : ${BUILD_MAILBOX}") |
| 75 | message(STATUS "BUILD_REMOTEPROC : ${BUILD_REMOTEPROC}") |
| 76 | message(STATUS "KDIR : ${KDIR}") |
| 77 | message(STATUS "*******************************************************") |