blob: f65e4ba94087bac47059bf69cc59d9d31b297174 [file] [log] [blame]
Kristofer Jonsson116a6352020-08-20 17:25:23 +02001#
Mikael Olssond4ad9e52024-02-07 11:22:26 +01002# SPDX-FileCopyrightText: Copyright 2020-2022, 2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
Kristofer Jonsson116a6352020-08-20 17:25:23 +02003# 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
18cmake_minimum_required(VERSION 3.0.2)
19
20# Set the project name and version
21project("linux_driver_stack" VERSION 1.0)
22
23# Default options
24option(BUILD_KERNEL "Build the kernel driver" ON)
25option(BUILD_MAILBOX "Build the MHU mailbox kernel module" ON)
Per Åstrand87ca5da2021-04-15 09:47:03 +020026option(BUILD_REMOTEPROC "Build the remoteproc kernel module" ON)
Kristofer Jonsson116a6352020-08-20 17:25:23 +020027
Lior Dekelc3f4a832021-12-02 10:58:12 +020028# Set variables
29if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
30 set(ARCH "arm64")
31else()
32 set(ARCH "arm")
33endif()
34
35string(REGEX REPLACE "(.*)gcc$" "\\1" CROSS_COMPILE "${CMAKE_C_COMPILER}")
36
Kristofer Jonsson116a6352020-08-20 17:25:23 +020037# Add rpath to library directory
38set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
39
40# Add include directory
Mikael Olssond4ad9e52024-02-07 11:22:26 +010041include_directories("kernel/include")
Kristofer Jonsson116a6352020-08-20 17:25:23 +020042
43# Add sub directories
44if(BUILD_KERNEL)
45 add_subdirectory(kernel)
46endif()
47
Davide Grohmannf0364232022-06-16 17:42:58 +020048if(BUILD_MAILBOX)
Kristofer Jonsson116a6352020-08-20 17:25:23 +020049 add_subdirectory(mailbox)
50endif()
51
Davide Grohmannf0364232022-06-16 17:42:58 +020052if(BUILD_REMOTEPROC)
Lior Dekelc3f4a832021-12-02 10:58:12 +020053 add_subdirectory(remoteproc)
Per Åstrand87ca5da2021-04-15 09:47:03 +020054endif()
55
Kristofer Jonssonb74492c2020-09-10 13:26:01 +020056# Build driver library
Kristofer Jonsson116a6352020-08-20 17:25:23 +020057add_subdirectory(driver_library)
Kristofer Jonssonb74492c2020-09-10 13:26:01 +020058
59# Build utils
Kristofer Jonsson116a6352020-08-20 17:25:23 +020060add_subdirectory(utils)
Davide Grohmannf0364232022-06-16 17:42:58 +020061
62# Build tests
63if(ETHOSU_TARGET_NPU_CONFIG)
64 add_subdirectory(tests)
65endif()
Rajasekaran Kalidoss77042ef2024-03-26 15:34:30 +010066
67#
68# Print build status
69#
70
71message(STATUS "*******************************************************")
72message(STATUS "PROJECT_NAME : ${PROJECT_NAME}")
73message(STATUS "BUILD_KERNEL : ${BUILD_KERNEL}")
74message(STATUS "BUILD_MAILBOX : ${BUILD_MAILBOX}")
75message(STATUS "BUILD_REMOTEPROC : ${BUILD_REMOTEPROC}")
76message(STATUS "KDIR : ${KDIR}")
77message(STATUS "*******************************************************")