blob: 20cf0e42c822218aebf5a65290b17651e950e642 [file] [log] [blame]
David Svantessone0c42ef2022-12-15 16:25:57 +00001# 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
23include(CMakeDependentOption)
24
25# ---------------------------------------------------------------------
26
27option(BUILD_SHARED_LIBS "Build shared libraries" ON)
28
29option(DEBUG "Enable ['-O0','-g','-gdwarf-2'] compilation flags" OFF)
30option(WERROR "Enable the -Werror compilation flag" OFF)
31option(EXCEPTIONS "Enable C++ exception support" ON)
32option(LOGGING "Enable logging" OFF)
33
34option(GEMM_TUNER "Build gemm_tuner programs" OFF) # Not used atm
35option(BUILD_EXAMPLES "Build example programs" OFF)
36
37option(BUILD_TESTING "Build tests" OFF)
38option(CPPTHREADS "Enable C++11 threads backend" OFF)
39option(OPENMP "Enable OpenMP backend" ON)
40
41#
42if(CPPTHREADS)
43 add_definitions(-DARM_COMPUTE_CPP_SCHEDULER)
44endif()
45#
46if(LOGGING)
47 add_definitions(-DARM_COMPUTE_LOGGING_ENABLED)
48endif()
49
50# ---------------------------------------------------------------------
51# Backends
52
53# TODO Add help string for each setting (Should user be able to )
54option(ENABLE_NEON "Enable Arm® Neon™ support" ON)
55option(ARM_COMPUTE_CPU_ENABLED "" ON)
56option(ARM_COMPUTE_ENABLE_NEON "" ON)
57option(ARM_COMPUTE_ENABLE_FP16 "" ON)
58option(ARM_COMPUTE_ENABLE_I8MM "" ON)
59option(ENABLE_FP16_KERNELS "" ON)
60option(ENABLE_FP32_KERNELS "" ON)
61option(ENABLE_QASYMM8_KERNELS "" ON)
62option(ENABLE_QASYMM8_SIGNED_KERNELS "" ON)
63option(ENABLE_QSYMM16_KERNELS "" ON)
64option(ENABLE_INTEGER_KERNELS "" ON)
65option(ENABLE_NHWC_KERNELS "" ON)
66option(ENABLE_NCHW_KERNELS "" ON)
67option(ARM_COMPUTE_GRAPH_ENABLED "" ON)
68option(ARM_COMPUTE_ENABLE_BF16 "" ON)
69option(ARM_COMPUTE_ENABLE_SVEF32MM "" ON)
70option(ARM_COMPUTE_ENABLE_FIXED_FORMAT_KERNELS "" ON)
71
72# TODO Check if this is required
73if(ENABLE_NEON)
74 add_definitions(-DENABLE_NEON)
75endif()
76if(ARM_COMPUTE_CPU_ENABLED)
77 add_definitions(-DARM_COMPUTE_CPU_ENABLED)
78endif()
79if(ARM_COMPUTE_ENABLE_NEON)
80 add_definitions(-DARM_COMPUTE_ENABLE_NEON)
81endif()
82if(ARM_COMPUTE_ENABLE_FP16)
83 add_definitions(-DARM_COMPUTE_ENABLE_FP16)
84endif()
85if(ARM_COMPUTE_ENABLE_I8MM)
86 add_definitions(-DARM_COMPUTE_ENABLE_I8MM)
87endif()
88if(ENABLE_FP16_KERNELS)
89 add_definitions(-DENABLE_FP16_KERNELS)
90endif()
91if(ENABLE_FP32_KERNELS)
92 add_definitions(-DENABLE_FP32_KERNELS)
93endif()
94if(ENABLE_QASYMM8_KERNELS)
95 add_definitions(-DENABLE_QASYMM8_KERNELS)
96endif()
97if(ENABLE_QASYMM8_SIGNED_KERNELS)
98 add_definitions(-DENABLE_QASYMM8_SIGNED_KERNELS)
99endif()
100if(ENABLE_QSYMM16_KERNELS)
101 add_definitions(-DENABLE_QSYMM16_KERNELS)
102endif()
103if(ENABLE_INTEGER_KERNELS)
104 add_definitions(-DENABLE_INTEGER_KERNELS)
105endif()
106if(ENABLE_NHWC_KERNELS)
107 add_definitions(-DENABLE_NHWC_KERNELS)
108endif()
109if(ENABLE_NCHW_KERNELS)
110 add_definitions(-DENABLE_NCHW_KERNELS)
111endif()
112if(ARM_COMPUTE_GRAPH_ENABLED)
113 add_definitions(-DARM_COMPUTE_GRAPH_ENABLED)
114endif()
115if(ARM_COMPUTE_ENABLE_BF16)
116 add_definitions(-DARM_COMPUTE_ENABLE_BF16)
117endif()
118if(ARM_COMPUTE_ENABLE_SVEF32MM)
119 add_definitions(-DARM_COMPUTE_ENABLE_SVEF32MM)
120endif()
121if(ARM_COMPUTE_ENABLE_FIXED_FORMAT_KERNELS)
122 add_definitions(-DARM_COMPUTE_ENABLE_FIXED_FORMAT_KERNELS)
123endif()