blob: f2a121dd5d4a396caf4506c3da3b47f1b7b32cfa [file] [log] [blame]
Kristofer Jonsson116a6352020-08-20 17:25:23 +02001#
Davide Grohmann80f8ddf2022-04-07 14:50:50 +02002# Copyright (c) 2020-2022 Arm Limited. All rights reserved.
Kristofer Jonsson116a6352020-08-20 17:25:23 +02003#
4# SPDX-License-Identifier: Apache-2.0
5#
6# Licensed under the Apache License, Version 2.0 (the License); you may
7# not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an AS IS BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18
19cmake_minimum_required(VERSION 3.0.2)
20
21# Set the project name and version
22project("linux_driver_stack" VERSION 1.0)
23
24# Default options
25option(BUILD_KERNEL "Build the kernel driver" ON)
26option(BUILD_MAILBOX "Build the MHU mailbox kernel module" ON)
Per Åstrand87ca5da2021-04-15 09:47:03 +020027option(BUILD_REMOTEPROC "Build the remoteproc kernel module" ON)
Kristofer Jonsson116a6352020-08-20 17:25:23 +020028
Lior Dekelc3f4a832021-12-02 10:58:12 +020029# Set variables
30if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
31 set(ARCH "arm64")
32else()
33 set(ARCH "arm")
34endif()
35
36string(REGEX REPLACE "(.*)gcc$" "\\1" CROSS_COMPILE "${CMAKE_C_COMPILER}")
37
Kristofer Jonsson116a6352020-08-20 17:25:23 +020038# Add rpath to library directory
39set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
40
41# Add include directory
42include_directories("kernel")
43
44# Add sub directories
45if(BUILD_KERNEL)
46 add_subdirectory(kernel)
47endif()
48
Davide Grohmannf0364232022-06-16 17:42:58 +020049if(BUILD_MAILBOX)
Kristofer Jonsson116a6352020-08-20 17:25:23 +020050 add_subdirectory(mailbox)
51endif()
52
Davide Grohmannf0364232022-06-16 17:42:58 +020053if(BUILD_REMOTEPROC)
Lior Dekelc3f4a832021-12-02 10:58:12 +020054 add_subdirectory(remoteproc)
Per Åstrand87ca5da2021-04-15 09:47:03 +020055endif()
56
Kristofer Jonssonb74492c2020-09-10 13:26:01 +020057# Build driver library
Kristofer Jonsson116a6352020-08-20 17:25:23 +020058add_subdirectory(driver_library)
Kristofer Jonssonb74492c2020-09-10 13:26:01 +020059
60# Build utils
Kristofer Jonsson116a6352020-08-20 17:25:23 +020061add_subdirectory(utils)
Davide Grohmannf0364232022-06-16 17:42:58 +020062
63# Build tests
64if(ETHOSU_TARGET_NPU_CONFIG)
65 add_subdirectory(tests)
66endif()