Christophe Favergeon | 6b604eb | 2019-05-17 13:46:33 +0200 | [diff] [blame^] | 1 | include(CMakePrintHelpers) |
| 2 | |
| 3 | SET(CORTEXM ON) |
| 4 | option(FASTMATH "Fast Math enabled" ON) |
| 5 | option(NEON "Neon acceleration" OFF) |
| 6 | option(NEONEXPERIMENTAL "Neon experimental acceleration" OFF) |
| 7 | option(LOOPUNROLL "Loop unrolling" ON) |
| 8 | option(ROUNDING "Rounding" OFF) |
| 9 | option(MATRIXCHECK "Matrix Checks" OFF) |
| 10 | |
| 11 | ################### |
| 12 | # |
| 13 | # ALL CORTEX |
| 14 | # |
| 15 | |
| 16 | target_compile_options(CMSISDSP PUBLIC "-mfloat-abi=hard;-mlittle-endian") |
| 17 | |
| 18 | if (FASTMATH) |
| 19 | target_compile_options(CMSISDSP PUBLIC "-ffast-math") |
| 20 | endif() |
| 21 | |
| 22 | if (LOOPUNROLL) |
| 23 | target_compile_definitions(CMSISDSP PRIVATE ARM_MATH_LOOPUNROLL) |
| 24 | endif() |
| 25 | |
| 26 | if (ROUNDING) |
| 27 | target_compile_definitions(CMSISDSP PRIVATE ARM_MATH_ROUNDING) |
| 28 | endif() |
| 29 | |
| 30 | if (MATRIXCHECK) |
| 31 | target_compile_definitions(CMSISDSP PRIVATE ARM_MATH_MATRIX_CHECK) |
| 32 | endif() |
| 33 | |
| 34 | |
| 35 | ################### |
| 36 | # |
| 37 | # CORTEX-A |
| 38 | # |
| 39 | |
| 40 | # CORTEX-A9 |
| 41 | if (ARM_CPU STREQUAL "cortex-a9" ) |
| 42 | target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core_A/Include") |
| 43 | SET(CORTEXM OFF) |
| 44 | |
| 45 | if (NOT (NEON OR NEONEXPERIMENTAL)) |
| 46 | target_compile_options(CMSISDSP PUBLIC "-mfpu=vfpv3-d16-fp16") |
| 47 | endif() |
| 48 | |
| 49 | endif() |
| 50 | |
| 51 | # CORTEX-A7 |
| 52 | if (ARM_CPU STREQUAL "cortex-a7" ) |
| 53 | target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core_A/Include") |
| 54 | SET(CORTEXM OFF) |
| 55 | |
| 56 | if (NOT (NEON OR NEONEXPERIMENTAL)) |
| 57 | target_compile_options(CMSISDSP PUBLIC "-mfpu=vfpv4-d16") |
| 58 | endif() |
| 59 | |
| 60 | endif() |
| 61 | |
| 62 | # CORTEX-A5 |
| 63 | if (ARM_CPU STREQUAL "cortex-a5" ) |
| 64 | target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core_A/Include") |
| 65 | SET(CORTEXM OFF) |
| 66 | |
| 67 | if ((NEON OR NEONEXPERIMENTAL)) |
| 68 | target_compile_options(CMSISDSP PUBLIC "-mfpu=neon-vfpv4") |
| 69 | else() |
| 70 | target_compile_options(CMSISDSP PUBLIC "-mfpu=vfpv4-d16") |
| 71 | endif() |
| 72 | endif() |
| 73 | |
| 74 | |
| 75 | ################### |
| 76 | # |
| 77 | # CORTEX-M |
| 78 | # |
| 79 | |
| 80 | # CORTEX-M35 |
| 81 | if (ARM_CPU STREQUAL "cortex-m35") |
| 82 | target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core/Include") |
| 83 | endif() |
| 84 | |
| 85 | # CORTEX-M33 |
| 86 | if (ARM_CPU STREQUAL "cortex-m33") |
| 87 | target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core/Include") |
| 88 | endif() |
| 89 | |
| 90 | # CORTEX-M23 |
| 91 | if (ARM_CPU STREQUAL "cortex-m23") |
| 92 | target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core/Include") |
| 93 | endif() |
| 94 | |
| 95 | # CORTEX-M7 |
| 96 | if (ARM_CPU STREQUAL "cortex-m7") |
| 97 | target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core/Include") |
| 98 | endif() |
| 99 | |
| 100 | # CORTEX-M4 |
| 101 | if (ARM_CPU STREQUAL "cortex-m4") |
| 102 | target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core/Include") |
| 103 | |
| 104 | endif() |
| 105 | |
| 106 | # CORTEX-M3 |
| 107 | if (ARM_CPU STREQUAL "cortex-m3") |
| 108 | target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core/Include") |
| 109 | endif() |
| 110 | |
| 111 | # CORTEX-M0plus |
| 112 | if (ARM_CPU STREQUAL "cortex-m0p") |
| 113 | target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core/Include") |
| 114 | endif() |
| 115 | |
| 116 | # CORTEX-M0 |
| 117 | if (ARM_CPU STREQUAL "cortex-m0") |
| 118 | target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core/Include") |
| 119 | endif() |
| 120 | |
| 121 | ################### |
| 122 | # |
| 123 | # FEATURES |
| 124 | # |
| 125 | |
| 126 | |
| 127 | |
| 128 | if (NEON AND NOT CORTEXM) |
| 129 | target_compile_definitions(CMSISDSP PRIVATE ARM_MATH_NEON __FPU_PRESENT) |
| 130 | endif() |
| 131 | |
| 132 | if (NEONEXPERIMENTAL AND NOT CORTEXM) |
| 133 | target_compile_definitions(CMSISDSP PRIVATE ARM_MATH_NEON_EXPERIMENTAL __FPU_PRESENT) |
| 134 | endif() |