Gyorgy Szing | 4909180 | 2020-11-24 00:33:09 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Julian Hall | 6e02acf | 2022-02-22 16:25:03 +0000 | [diff] [blame^] | 2 | # Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved. |
Gyorgy Szing | 4909180 | 2020-11-24 00:33:09 +0100 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
| 8 | #GNUARM v8 and v9 compilers use a different triplet. |
Gyorgy Szing | d80f856 | 2021-02-11 19:31:43 +0100 | [diff] [blame] | 9 | if(NOT CROSS_COMPILE AND NOT DEFINED ENV{CROSS_COMPILE}) |
Gyorgy Szing | daf2efd | 2021-03-09 07:30:34 +0100 | [diff] [blame] | 10 | set(CROSS_COMPILE "aarch64-elf-;aarch64-none-elf-;aarch64-linux-gnu-;aarch64-none-linux-gnu-" CACHE STRING "List of GCC prefix triplets to use.") |
Gyorgy Szing | 4909180 | 2020-11-24 00:33:09 +0100 | [diff] [blame] | 11 | endif() |
| 12 | |
| 13 | set(CMAKE_CROSSCOMPILING True) |
| 14 | set(CMAKE_SYSTEM_NAME Generic) |
| 15 | set(CMAKE_SYSTEM_PROCESSOR arm) |
| 16 | set(CMAKE_POSITION_INDEPENDENT_CODE True) |
| 17 | |
Gyorgy Szing | 4909180 | 2020-11-24 00:33:09 +0100 | [diff] [blame] | 18 | include($ENV{TS_ROOT}/tools/cmake/compiler/GCC.cmake REQUIRED) |
Julian Hall | 0051ed1 | 2021-07-22 13:59:24 +0100 | [diff] [blame] | 19 | include($ENV{TS_ROOT}/tools/cmake/compiler/config_iface.cmake REQUIRED) |
Julian Hall | 6e02acf | 2022-02-22 16:25:03 +0000 | [diff] [blame^] | 20 | |
Andrew Beggs | 97a00d4 | 2021-06-15 15:45:46 +0000 | [diff] [blame] | 21 | # Set mandatory compiler and linker flags for this environment: |
Andrew Beggs | 97a00d4 | 2021-06-15 15:45:46 +0000 | [diff] [blame] | 22 | # - Compile position independent code |
| 23 | string(APPEND CMAKE_C_FLAGS_INIT " -fpic") |
Julian Hall | 6e02acf | 2022-02-22 16:25:03 +0000 | [diff] [blame^] | 24 | |
| 25 | # Set compiler warning level for the root build context. External components |
| 26 | # are responsible for setting their own warning level. |
| 27 | if(DEFINED TS_ROOT) |
| 28 | string(APPEND CMAKE_C_FLAGS_INIT " -Wall") |
| 29 | endif() |
| 30 | |
Imre Kis | 23583e3 | 2021-10-22 14:54:51 +0200 | [diff] [blame] | 31 | # - Link position independent executable |
Gyorgy Szing | 693877e | 2021-12-12 02:51:10 +0100 | [diff] [blame] | 32 | string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " -pie") |