David Svantesson | e0c42ef | 2022-12-15 16:25:57 +0000 | [diff] [blame] | 1 | # Copyright (c) 2023 Arm Limited. |
| 2 | # |
| 3 | # SPDX-License-Identifier: MIT |
| 4 | # |
| 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy |
| 6 | # of this software and associated documentation files (the "Software"), to |
| 7 | # deal in the Software without restriction, including without limitation the |
| 8 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 9 | # sell copies of the Software, and to permit persons to whom the Software is |
| 10 | # furnished to do so, subject to the following conditions: |
| 11 | # |
| 12 | # The above copyright notice and this permission notice shall be included in all |
| 13 | # copies or substantial portions of the Software. |
| 14 | # |
| 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 21 | # SOFTWARE. |
| 22 | |
| 23 | include(CMakeDependentOption) |
| 24 | |
| 25 | # --------------------------------------------------------------------- |
| 26 | |
| 27 | option(BUILD_SHARED_LIBS "Build shared libraries" ON) |
| 28 | |
| 29 | option(DEBUG "Enable ['-O0','-g','-gdwarf-2'] compilation flags" OFF) |
| 30 | option(WERROR "Enable the -Werror compilation flag" OFF) |
| 31 | option(EXCEPTIONS "Enable C++ exception support" ON) |
| 32 | option(LOGGING "Enable logging" OFF) |
| 33 | |
| 34 | option(GEMM_TUNER "Build gemm_tuner programs" OFF) # Not used atm |
| 35 | option(BUILD_EXAMPLES "Build example programs" OFF) |
| 36 | |
| 37 | option(BUILD_TESTING "Build tests" OFF) |
| 38 | option(CPPTHREADS "Enable C++11 threads backend" OFF) |
| 39 | option(OPENMP "Enable OpenMP backend" ON) |
| 40 | |
| 41 | # |
| 42 | if(CPPTHREADS) |
| 43 | add_definitions(-DARM_COMPUTE_CPP_SCHEDULER) |
| 44 | endif() |
| 45 | # |
| 46 | if(LOGGING) |
| 47 | add_definitions(-DARM_COMPUTE_LOGGING_ENABLED) |
| 48 | endif() |
| 49 | |
| 50 | # --------------------------------------------------------------------- |
| 51 | # Backends |
| 52 | |
| 53 | # TODO Add help string for each setting (Should user be able to ) |
| 54 | option(ENABLE_NEON "Enable Arm® Neon™ support" ON) |
| 55 | option(ARM_COMPUTE_CPU_ENABLED "" ON) |
| 56 | option(ARM_COMPUTE_ENABLE_NEON "" ON) |
| 57 | option(ARM_COMPUTE_ENABLE_FP16 "" ON) |
| 58 | option(ARM_COMPUTE_ENABLE_I8MM "" ON) |
| 59 | option(ENABLE_FP16_KERNELS "" ON) |
| 60 | option(ENABLE_FP32_KERNELS "" ON) |
| 61 | option(ENABLE_QASYMM8_KERNELS "" ON) |
| 62 | option(ENABLE_QASYMM8_SIGNED_KERNELS "" ON) |
| 63 | option(ENABLE_QSYMM16_KERNELS "" ON) |
| 64 | option(ENABLE_INTEGER_KERNELS "" ON) |
| 65 | option(ENABLE_NHWC_KERNELS "" ON) |
| 66 | option(ENABLE_NCHW_KERNELS "" ON) |
| 67 | option(ARM_COMPUTE_GRAPH_ENABLED "" ON) |
| 68 | option(ARM_COMPUTE_ENABLE_BF16 "" ON) |
| 69 | option(ARM_COMPUTE_ENABLE_SVEF32MM "" ON) |
| 70 | option(ARM_COMPUTE_ENABLE_FIXED_FORMAT_KERNELS "" ON) |
| 71 | |
| 72 | # TODO Check if this is required |
| 73 | if(ENABLE_NEON) |
| 74 | add_definitions(-DENABLE_NEON) |
| 75 | endif() |
| 76 | if(ARM_COMPUTE_CPU_ENABLED) |
| 77 | add_definitions(-DARM_COMPUTE_CPU_ENABLED) |
| 78 | endif() |
| 79 | if(ARM_COMPUTE_ENABLE_NEON) |
| 80 | add_definitions(-DARM_COMPUTE_ENABLE_NEON) |
| 81 | endif() |
| 82 | if(ARM_COMPUTE_ENABLE_FP16) |
| 83 | add_definitions(-DARM_COMPUTE_ENABLE_FP16) |
| 84 | endif() |
| 85 | if(ARM_COMPUTE_ENABLE_I8MM) |
| 86 | add_definitions(-DARM_COMPUTE_ENABLE_I8MM) |
| 87 | endif() |
| 88 | if(ENABLE_FP16_KERNELS) |
| 89 | add_definitions(-DENABLE_FP16_KERNELS) |
| 90 | endif() |
| 91 | if(ENABLE_FP32_KERNELS) |
| 92 | add_definitions(-DENABLE_FP32_KERNELS) |
| 93 | endif() |
| 94 | if(ENABLE_QASYMM8_KERNELS) |
| 95 | add_definitions(-DENABLE_QASYMM8_KERNELS) |
| 96 | endif() |
| 97 | if(ENABLE_QASYMM8_SIGNED_KERNELS) |
| 98 | add_definitions(-DENABLE_QASYMM8_SIGNED_KERNELS) |
| 99 | endif() |
| 100 | if(ENABLE_QSYMM16_KERNELS) |
| 101 | add_definitions(-DENABLE_QSYMM16_KERNELS) |
| 102 | endif() |
| 103 | if(ENABLE_INTEGER_KERNELS) |
| 104 | add_definitions(-DENABLE_INTEGER_KERNELS) |
| 105 | endif() |
| 106 | if(ENABLE_NHWC_KERNELS) |
| 107 | add_definitions(-DENABLE_NHWC_KERNELS) |
| 108 | endif() |
| 109 | if(ENABLE_NCHW_KERNELS) |
| 110 | add_definitions(-DENABLE_NCHW_KERNELS) |
| 111 | endif() |
| 112 | if(ARM_COMPUTE_GRAPH_ENABLED) |
| 113 | add_definitions(-DARM_COMPUTE_GRAPH_ENABLED) |
| 114 | endif() |
| 115 | if(ARM_COMPUTE_ENABLE_BF16) |
| 116 | add_definitions(-DARM_COMPUTE_ENABLE_BF16) |
| 117 | endif() |
| 118 | if(ARM_COMPUTE_ENABLE_SVEF32MM) |
| 119 | add_definitions(-DARM_COMPUTE_ENABLE_SVEF32MM) |
| 120 | endif() |
| 121 | if(ARM_COMPUTE_ENABLE_FIXED_FORMAT_KERNELS) |
| 122 | add_definitions(-DARM_COMPUTE_ENABLE_FIXED_FORMAT_KERNELS) |
| 123 | endif() |