Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 1 | # |
Per Åstrand | 87ca5da | 2021-04-15 09:47:03 +0200 | [diff] [blame] | 2 | # Copyright (c) 2020-2021 Arm Limited. All rights reserved. |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 3 | # |
| 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 | |
| 19 | cmake_minimum_required(VERSION 3.0.2) |
| 20 | |
| 21 | # Set the project name and version |
| 22 | project("linux_driver_stack" VERSION 1.0) |
| 23 | |
| 24 | # Default options |
| 25 | option(BUILD_KERNEL "Build the kernel driver" ON) |
| 26 | option(BUILD_MAILBOX "Build the MHU mailbox kernel module" ON) |
Per Åstrand | 87ca5da | 2021-04-15 09:47:03 +0200 | [diff] [blame] | 27 | option(BUILD_REMOTEPROC "Build the remoteproc kernel module" ON) |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 28 | |
Lior Dekel | c3f4a83 | 2021-12-02 10:58:12 +0200 | [diff] [blame] | 29 | # Set variables |
| 30 | if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") |
| 31 | set(ARCH "arm64") |
| 32 | else() |
| 33 | set(ARCH "arm") |
| 34 | endif() |
| 35 | |
| 36 | string(REGEX REPLACE "(.*)gcc$" "\\1" CROSS_COMPILE "${CMAKE_C_COMPILER}") |
| 37 | |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 38 | # Add rpath to library directory |
| 39 | set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") |
| 40 | |
| 41 | # Add include directory |
| 42 | include_directories("kernel") |
| 43 | |
| 44 | # Add sub directories |
| 45 | if(BUILD_KERNEL) |
| 46 | add_subdirectory(kernel) |
| 47 | endif() |
| 48 | |
| 49 | if (BUILD_MAILBOX) |
| 50 | add_subdirectory(mailbox) |
| 51 | endif() |
| 52 | |
Per Åstrand | 87ca5da | 2021-04-15 09:47:03 +0200 | [diff] [blame] | 53 | if (BUILD_REMOTEPROC) |
Lior Dekel | c3f4a83 | 2021-12-02 10:58:12 +0200 | [diff] [blame] | 54 | add_subdirectory(remoteproc) |
Per Åstrand | 87ca5da | 2021-04-15 09:47:03 +0200 | [diff] [blame] | 55 | endif() |
| 56 | |
Kristofer Jonsson | b74492c | 2020-09-10 13:26:01 +0200 | [diff] [blame] | 57 | # Build flatbuffers |
| 58 | unset(PROJECT_VERSION) |
| 59 | unset(PROJECT_VERSION_MAJOR) |
| 60 | unset(PROJECT_VERSION_MINOR) |
| 61 | option(FLATBUFFERS_BUILD_TESTS OFF) |
| 62 | option(FLATBUFFERS_INSTALL OFF) |
| 63 | option(FLATBUFFERS_BUILD_FLATC OFF) |
| 64 | option(FLATBUFFERS_BUILD_FLATHASH OFF) |
| 65 | add_subdirectory(flatbuffers) |
| 66 | |
| 67 | # Build driver library |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 68 | add_subdirectory(driver_library) |
Kristofer Jonsson | b74492c | 2020-09-10 13:26:01 +0200 | [diff] [blame] | 69 | |
| 70 | # Build utils |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 71 | add_subdirectory(utils) |