blob: ab55daaaa3793d0bd1c7922d4a1708068e255c27 [file] [log] [blame]
Michele Di Giorgiod9eaf612020-07-08 11:12:57 +01001# Copyright (c) 2016, 2017 Arm Limited.
Anthony Barbier6ff3b192017-09-04 18:44:23 +01002#
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
23import SCons
24import os
25import subprocess
26
27def version_at_least(version, required):
28 end = min(len(version), len(required))
29
30 for i in range(0, end, 2):
31 if int(version[i]) < int(required[i]):
32 return False
33 elif int(version[i]) > int(required[i]):
34 return True
35
36 return True
37
38vars = Variables("scons")
39vars.AddVariables(
40 BoolVariable("debug", "Debug", False),
41 BoolVariable("asserts", "Enable asserts (this flag is forced to 1 for debug=1)", False),
Georgios Pinitas3faea252017-10-30 14:13:50 +000042 BoolVariable("logging", "Logging (this flag is forced to 1 for debug=1)", False),
Georgios Pinitasf2cdce32019-12-09 18:35:57 +000043 EnumVariable("arch", "Target Architecture", "armv7a",
Georgios Pinitas94672fb2020-01-22 18:36:27 +000044 allowed_values=("armv7a", "arm64-v8a", "arm64-v8.2-a", "arm64-v8.2-a-sve", "x86_32", "x86_64",
Georgios Pinitas49c6ced2020-09-21 17:16:09 +010045 "armv8a", "armv8.2-a", "armv8.2-a-sve", "armv8.6-a", "armv8.6-a-sve", "x86")),
Georgios Pinitasf2cdce32019-12-09 18:35:57 +000046 EnumVariable("estate", "Execution State", "auto", allowed_values=("auto", "32", "64")),
Inki Dae51a95582020-03-23 08:29:02 +090047 EnumVariable("os", "Target OS", "linux", allowed_values=("linux", "android", "tizen", "bare_metal")),
Anthony Barbier6a3daf12018-02-19 17:24:27 +000048 EnumVariable("build", "Build type", "cross_compile", allowed_values=("native", "cross_compile", "embed_only")),
Anthony Barbier6ff3b192017-09-04 18:44:23 +010049 BoolVariable("examples", "Build example programs", True),
SiCong Li8b4c7302019-09-19 12:18:15 +010050 BoolVariable("gemm_tuner", "Build gemm_tuner programs", True),
Anthony Barbier6ff3b192017-09-04 18:44:23 +010051 BoolVariable("Werror", "Enable/disable the -Werror compilation flag", True),
Pablo Telloc6cb35a2017-06-21 15:39:47 +010052 BoolVariable("standalone", "Builds the tests as standalone executables, links statically with libgcc, libstdc++ and libarm_compute", False),
Anthony Barbier6ff3b192017-09-04 18:44:23 +010053 BoolVariable("opencl", "Enable OpenCL support", True),
54 BoolVariable("neon", "Enable Neon support", False),
Anthony Barbier7068f992017-10-26 15:23:08 +010055 BoolVariable("gles_compute", "Enable OpenGL ES Compute Shader support", False),
Anthony Barbiercc0a80b2017-12-15 11:37:29 +000056 BoolVariable("embed_kernels", "Embed OpenCL kernels and OpenGL ES compute shaders in library binary", True),
Anthony Barbier6ff3b192017-09-04 18:44:23 +010057 BoolVariable("set_soname", "Set the library's soname and shlibversion (requires SCons 2.4 or above)", False),
Anthony Barbierb4670212018-05-18 16:55:39 +010058 BoolVariable("tracing", "Enable runtime tracing", False),
Anthony Barbier6ff3b192017-09-04 18:44:23 +010059 BoolVariable("openmp", "Enable OpenMP backend", False),
60 BoolVariable("cppthreads", "Enable C++11 threads backend", True),
61 PathVariable("build_dir", "Specify sub-folder for the build", ".", PathVariable.PathAccept),
Anthony Barbier01bbd5f2018-11-01 15:10:51 +000062 PathVariable("install_dir", "Specify sub-folder for the install", "", PathVariable.PathAccept),
Michalis Spyrou323ce0f2018-11-30 16:30:43 +000063 BoolVariable("exceptions", "Enable/disable C++ exception support", True),
Michalis Spyrou748a7c82019-10-07 13:00:44 +010064 PathVariable("linker_script", "Use an external linker script", "", PathVariable.PathAccept),
Anthony Barbiera4e5e1e2017-10-05 14:55:34 +010065 #FIXME Remove before release (And remove all references to INTERNAL_ONLY)
Georgios Pinitas37831162018-08-20 15:41:10 +010066 BoolVariable("internal_only", "Enable ARM internal only tests", False),
Georgios Pinitas49c6ced2020-09-21 17:16:09 +010067 ListVariable("custom_options", "Custom options that can be used to turn on/off features", "none", ["disable_mmla_fp"]),
Anthony Barbier149de5b2018-12-06 10:27:37 +000068 ("toolchain_prefix", "Override the toolchain prefix", ""),
alered01d8872c12020-02-10 11:29:45 +000069 ("compiler_prefix", "Override the compiler prefix", ""),
Anthony Barbier7390e052018-03-13 09:29:41 +000070 ("extra_cxx_flags", "Extra CXX flags to be appended to the build command", ""),
Georgios Pinitas421405b2018-10-26 19:05:32 +010071 ("extra_link_flags", "Extra LD flags to be appended to the build command", ""),
Anthony Barbier7390e052018-03-13 09:29:41 +000072 ("compiler_cache", "Command to prefix to the C and C++ compiler (e.g ccache)", "")
Anthony Barbier6ff3b192017-09-04 18:44:23 +010073)
74
75env = Environment(platform="posix", variables=vars, ENV = os.environ)
Anthony Barbiere8a55df2018-10-26 09:05:01 +010076build_path = env['build_dir']
77# If build_dir is a relative path then add a #build/ prefix:
78if not env['build_dir'].startswith('/'):
79 SConsignFile('build/%s/.scons' % build_path)
80 build_path = "#build/%s" % build_path
81else:
82 SConsignFile('%s/.scons' % build_path)
83
Anthony Barbier01bbd5f2018-11-01 15:10:51 +000084install_path = env['install_dir']
85#If the install_dir is a relative path then assume it's from inside build_dir
86if not env['install_dir'].startswith('/') and install_path != "":
87 install_path = "%s/%s" % (build_path, install_path)
88
Anthony Barbiere8a55df2018-10-26 09:05:01 +010089env.Append(LIBPATH = [build_path])
Anthony Barbier6a3daf12018-02-19 17:24:27 +000090Export('env')
91Export('vars')
Anthony Barbier6ff3b192017-09-04 18:44:23 +010092
Anthony Barbier01bbd5f2018-11-01 15:10:51 +000093def install_lib( lib ):
94 # If there is no install folder, then there is nothing to do:
95 if install_path == "":
96 return lib
97 return env.Install( "%s/lib/" % install_path, lib)
98def install_bin( bin ):
99 # If there is no install folder, then there is nothing to do:
100 if install_path == "":
101 return bin
102 return env.Install( "%s/bin/" % install_path, bin)
103def install_include( inc ):
104 if install_path == "":
105 return inc
106 return env.Install( "%s/include/" % install_path, inc)
107
108Export('install_lib')
109Export('install_bin')
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100110
111Help(vars.GenerateHelpText(env))
112
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100113if env['linker_script'] and env['os'] != 'bare_metal':
114 print("Linker script is only supported for bare_metal builds")
115 Exit(1)
116
Anthony Barbier6a3daf12018-02-19 17:24:27 +0000117if env['build'] == "embed_only":
Anthony Barbiere8a55df2018-10-26 09:05:01 +0100118 SConscript('./SConscript', variant_dir=build_path, duplicate=0)
Anthony Barbier6a3daf12018-02-19 17:24:27 +0000119 Return()
120
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100121if env['neon'] and 'x86' in env['arch']:
ggardet767c9f72018-06-29 17:01:01 +0200122 print("Cannot compile NEON for x86")
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100123 Exit(1)
124
125if env['set_soname'] and not version_at_least(SCons.__version__, "2.4"):
ggardet767c9f72018-06-29 17:01:01 +0200126 print("Setting the library's SONAME / SHLIBVERSION requires SCons 2.4 or above")
127 print("Update your version of SCons or use set_soname=0")
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100128 Exit(1)
129
130if env['os'] == 'bare_metal':
131 if env['cppthreads'] or env['openmp']:
132 print("ERROR: OpenMP and C++11 threads not supported in bare_metal. Use cppthreads=0 openmp=0")
133 Exit(1)
134
Michalis Spyrou323ce0f2018-11-30 16:30:43 +0000135if not env['exceptions']:
136 if env['opencl'] or env['gles_compute']:
137 print("ERROR: OpenCL and GLES are not supported when building without exceptions. Use opencl=0 gles_compute=0")
138 Exit(1)
139
140 env.Append(CPPDEFINES = ['ARM_COMPUTE_EXCEPTIONS_DISABLED'])
141 env.Append(CXXFLAGS = ['-fno-exceptions'])
142
Michalis Spyrou6bff1952019-10-02 17:22:11 +0100143env.Append(CXXFLAGS = ['-Wall','-DARCH_ARM',
Michalis Spyrou7c60c992019-10-10 14:33:47 +0100144 '-Wextra','-pedantic','-Wdisabled-optimization','-Wformat=2',
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100145 '-Winit-self','-Wstrict-overflow=2','-Wswitch-default',
Michalis Spyrou2d22c3f2020-02-12 14:50:19 +0000146 '-std=gnu++11','-Woverloaded-virtual', '-Wformat-security',
Michalis Spyroufae513c2019-10-16 17:41:33 +0100147 '-Wctor-dtor-privacy','-Wsign-promo','-Weffc++','-Wno-overlength-strings'])
Isabella Gottardib28f29d2017-11-09 17:05:07 +0000148
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100149env.Append(CPPDEFINES = ['_GLIBCXX_USE_NANOSLEEP'])
150
Anthony Barbiera026e982018-01-18 10:57:52 +0000151default_cpp_compiler = 'g++' if env['os'] != 'android' else 'clang++'
152default_c_compiler = 'gcc' if env['os'] != 'android' else 'clang'
153cpp_compiler = os.environ.get('CXX', default_cpp_compiler)
154c_compiler = os.environ.get('CC', default_c_compiler)
155
Anthony Barbierdd669372018-03-01 17:08:54 +0000156if env['os'] == 'android' and ( 'clang++' not in cpp_compiler or 'clang' not in c_compiler ):
ggardet767c9f72018-06-29 17:01:01 +0200157 print( "WARNING: Only clang is officially supported to build the Compute Library for Android")
Anthony Barbiera026e982018-01-18 10:57:52 +0000158
Anthony Barbierdd669372018-03-01 17:08:54 +0000159if 'clang++' in cpp_compiler:
Michalis Spyrou7c60c992019-10-10 14:33:47 +0100160 env.Append(CXXFLAGS = ['-Wno-vla-extension'])
Georgios Pinitase874ef92019-09-09 17:40:33 +0100161elif 'armclang' in cpp_compiler:
162 pass
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100163else:
Michalis Spyrou7c60c992019-10-10 14:33:47 +0100164 env.Append(CXXFLAGS = ['-Wlogical-op','-Wnoexcept','-Wstrict-null-sentinel'])
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100165
166if env['cppthreads']:
167 env.Append(CPPDEFINES = [('ARM_COMPUTE_CPP_SCHEDULER', 1)])
168
169if env['openmp']:
Anthony Barbierdd669372018-03-01 17:08:54 +0000170 if 'clang++' in cpp_compiler:
ggardet767c9f72018-06-29 17:01:01 +0200171 print( "Clang does not support OpenMP. Use scheduler=cpp.")
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100172 Exit(1)
173
174 env.Append(CPPDEFINES = [('ARM_COMPUTE_OPENMP_SCHEDULER', 1)])
175 env.Append(CXXFLAGS = ['-fopenmp'])
176 env.Append(LINKFLAGS = ['-fopenmp'])
177
Georgios Pinitasf2cdce32019-12-09 18:35:57 +0000178# Validate and define state
179if env['estate'] == 'auto':
180 if 'v7a' in env['arch']:
181 env['estate'] = '32'
182 else:
183 env['estate'] = '64'
184
185# Map legacy arch
186if 'arm64' in env['arch']:
187 env['estate'] = '64'
188
189if 'v7a' in env['estate'] and env['estate'] == '64':
190 print("ERROR: armv7a architecture has only 32-bit execution state")
191 Exit(1)
192
Georgios Pinitase874ef92019-09-09 17:40:33 +0100193# Add architecture specific flags
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100194prefix = ""
Georgios Pinitasf2cdce32019-12-09 18:35:57 +0000195if 'v7a' in env['arch']:
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100196 env.Append(CXXFLAGS = ['-march=armv7-a', '-mthumb', '-mfpu=neon'])
Inki Dae51a95582020-03-23 08:29:02 +0900197 if env['os'] == 'android' or env['os'] == 'tizen':
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100198 env.Append(CXXFLAGS = ['-mfloat-abi=softfp'])
Georgios Pinitasf2cdce32019-12-09 18:35:57 +0000199 else:
200 env.Append(CXXFLAGS = ['-mfloat-abi=hard'])
Georgios Pinitas94672fb2020-01-22 18:36:27 +0000201elif 'v8' in env['arch']:
Georgios Pinitasf2cdce32019-12-09 18:35:57 +0000202 if 'sve' in env['arch']:
Georgios Pinitas421405b2018-10-26 19:05:32 +0100203 env.Append(CXXFLAGS = ['-march=armv8.2-a+sve+fp16+dotprod'])
Georgios Pinitas94672fb2020-01-22 18:36:27 +0000204 elif 'v8.2-a' in env['arch']:
Georgios Pinitas421405b2018-10-26 19:05:32 +0100205 env.Append(CXXFLAGS = ['-march=armv8.2-a+fp16']) # explicitly enable fp16 extension otherwise __ARM_FEATURE_FP16_VECTOR_ARITHMETIC is undefined
Georgios Pinitas94672fb2020-01-22 18:36:27 +0000206 else:
207 env.Append(CXXFLAGS = ['-march=armv8-a'])
208
209 if 'v8.6-a' in env['arch']:
Georgios Pinitas49c6ced2020-09-21 17:16:09 +0100210 env.Append(CPPDEFINES = ['MMLA_INT8', 'V8P6', 'V8P6_BF', 'ARM_COMPUTE_FORCE_BF16'])
211 if "disable_mmla_fp" not in env['custom_options']:
212 env.Append(CPPDEFINES = ['MMLA_FP32'])
Georgios Pinitas94672fb2020-01-22 18:36:27 +0000213
Georgios Pinitasf2cdce32019-12-09 18:35:57 +0000214elif 'x86' in env['arch']:
215 if env['estate'] == '32':
216 env.Append(CCFLAGS = ['-m32'])
217 env.Append(LINKFLAGS = ['-m32'])
218 else:
219 env.Append(CXXFLAGS = ['-fPIC'])
220 env.Append(CCFLAGS = ['-m64'])
221 env.Append(LINKFLAGS = ['-m64'])
222
223# Define toolchain
224prefix = ""
225if 'x86' not in env['arch']:
226 if env['estate'] == '32':
227 if env['os'] == 'linux':
228 prefix = "arm-linux-gnueabihf-" if 'v7' in env['arch'] else "armv8l-linux-gnueabihf-"
229 elif env['os'] == 'bare_metal':
230 prefix = "arm-eabi-"
231 elif env['os'] == 'android':
232 prefix = "arm-linux-androideabi-"
Inki Dae51a95582020-03-23 08:29:02 +0900233 elif env['os'] == 'tizen':
234 prefix = "armv7l-tizen-linux-gnueabi-"
Georgios Pinitasf2cdce32019-12-09 18:35:57 +0000235 elif env['estate'] == '64' and 'v8' in env['arch']:
236 if env['os'] == 'linux':
237 prefix = "aarch64-linux-gnu-"
238 elif env['os'] == 'bare_metal':
239 prefix = "aarch64-elf-"
240 elif env['os'] == 'android':
241 prefix = "aarch64-linux-android-"
Inki Dae51a95582020-03-23 08:29:02 +0900242 elif env['os'] == 'tizen':
243 prefix = "aarch64-tizen-linux-gnu-"
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100244
245if env['build'] == 'native':
246 prefix = ""
247
Anthony Barbier149de5b2018-12-06 10:27:37 +0000248if env["toolchain_prefix"] != "":
249 prefix = env["toolchain_prefix"]
250
alered01d8872c12020-02-10 11:29:45 +0000251compiler_prefix = prefix
252if env["compiler_prefix"] != "":
253 compiler_prefix = env["compiler_prefix"]
254
255env['CC'] = env['compiler_cache']+ " " + compiler_prefix + c_compiler
256env['CXX'] = env['compiler_cache']+ " " + compiler_prefix + cpp_compiler
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100257env['LD'] = prefix + "ld"
258env['AS'] = prefix + "as"
259env['AR'] = prefix + "ar"
260env['RANLIB'] = prefix + "ranlib"
261
262if not GetOption("help"):
263 try:
Anthony Barbier907dba82017-08-25 10:11:39 +0100264 compiler_ver = subprocess.check_output(env['CXX'].split() + ["-dumpversion"]).strip()
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100265 except OSError:
266 print("ERROR: Compiler '%s' not found" % env['CXX'])
267 Exit(1)
268
Georgios Pinitase874ef92019-09-09 17:40:33 +0100269 if 'armclang' in cpp_compiler:
270 pass
271 elif 'clang++' not in cpp_compiler:
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100272 if env['arch'] == 'arm64-v8.2-a' and not version_at_least(compiler_ver, '6.2.1'):
ggardet767c9f72018-06-29 17:01:01 +0200273 print("GCC 6.2.1 or newer is required to compile armv8.2-a code")
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100274 Exit(1)
275 elif env['arch'] == 'arm64-v8a' and not version_at_least(compiler_ver, '4.9'):
ggardet767c9f72018-06-29 17:01:01 +0200276 print("GCC 4.9 or newer is required to compile NEON code for AArch64")
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100277 Exit(1)
278
279 if version_at_least(compiler_ver, '6.1'):
280 env.Append(CXXFLAGS = ['-Wno-ignored-attributes'])
281
282 if compiler_ver == '4.8.3':
283 env.Append(CXXFLAGS = ['-Wno-array-bounds'])
284
Pablo Telloc6cb35a2017-06-21 15:39:47 +0100285if env['standalone']:
286 env.Append(CXXFLAGS = ['-fPIC'])
Anthony Barbier665c89b2018-07-16 11:40:09 +0100287 env.Append(LINKFLAGS = ['-static-libgcc','-static-libstdc++'])
Pablo Telloc6cb35a2017-06-21 15:39:47 +0100288
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100289if env['Werror']:
290 env.Append(CXXFLAGS = ['-Werror'])
291
292if env['os'] == 'android':
293 env.Append(CPPDEFINES = ['ANDROID'])
Michalis Spyrou2d22c3f2020-02-12 14:50:19 +0000294 env.Append(LINKFLAGS = ['-pie', '-static-libstdc++', '-ldl'])
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100295elif env['os'] == 'bare_metal':
296 env.Append(LINKFLAGS = ['-static'])
Michalis Spyrou07781ac2017-08-31 15:11:41 +0100297 env.Append(LINKFLAGS = ['-specs=rdimon.specs'])
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100298 env.Append(CXXFLAGS = ['-fPIC'])
299 env.Append(CPPDEFINES = ['NO_MULTI_THREADING'])
Michalis Spyrou07781ac2017-08-31 15:11:41 +0100300 env.Append(CPPDEFINES = ['BARE_METAL'])
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100301
302if env['opencl']:
Georgios Pinitase6032da2017-10-26 14:13:35 +0100303 if env['os'] in ['bare_metal'] or env['standalone']:
Anthony Barbier5f0124d2018-04-13 14:05:34 +0100304 print("Cannot link OpenCL statically, which is required for bare metal / standalone builds")
305 Exit(1)
306
307if env['gles_compute']:
308 if env['os'] in ['bare_metal'] or env['standalone']:
309 print("Cannot link OpenGLES statically, which is required for bare metal / standalone builds")
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100310 Exit(1)
311
Anthony Barbier9fb0cac2018-04-20 15:46:21 +0100312if env["os"] not in ["android", "bare_metal"] and (env['opencl'] or env['cppthreads']):
313 env.Append(LIBS = ['pthread'])
314
Anthony Barbier7068f992017-10-26 15:23:08 +0100315if env['opencl'] or env['gles_compute']:
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100316 if env['embed_kernels']:
317 env.Append(CPPDEFINES = ['EMBEDDED_KERNELS'])
318
319if env['debug']:
320 env['asserts'] = True
Georgios Pinitas3faea252017-10-30 14:13:50 +0000321 env['logging'] = True
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100322 env.Append(CXXFLAGS = ['-O0','-g','-gdwarf-2'])
323 env.Append(CPPDEFINES = ['ARM_COMPUTE_DEBUG_ENABLED'])
324else:
Ramana Radhakrishnand176d542019-07-04 11:38:45 +0100325 env.Append(CXXFLAGS = ['-O3'])
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100326
327if env['asserts']:
328 env.Append(CPPDEFINES = ['ARM_COMPUTE_ASSERTS_ENABLED'])
Moritz Pflanzer8b74c782017-09-14 14:33:20 +0100329 env.Append(CXXFLAGS = ['-fstack-protector-strong'])
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100330
Georgios Pinitas7d3d1b92017-10-12 17:34:20 +0100331if env['logging']:
332 env.Append(CPPDEFINES = ['ARM_COMPUTE_LOGGING_ENABLED'])
333
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100334env.Append(CPPPATH = ['#/include', "#"])
335env.Append(CXXFLAGS = env['extra_cxx_flags'])
Georgios Pinitas421405b2018-10-26 19:05:32 +0100336env.Append(LINKFLAGS = env['extra_link_flags'])
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100337
Anthony Barbier01bbd5f2018-11-01 15:10:51 +0000338Default( install_include("arm_compute"))
Anthony Barbier10565952018-11-15 09:50:06 +0000339Default( install_include("support"))
Michele Di Giorgio6afea902019-04-03 11:40:20 +0100340Default( install_include("utils"))
341for dirname in os.listdir("./include"):
342 Default( install_include("include/%s" % dirname))
Anthony Barbier01bbd5f2018-11-01 15:10:51 +0000343
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100344Export('version_at_least')
345
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100346
Anthony Barbier7068f992017-10-26 15:23:08 +0100347if env['gles_compute'] and env['os'] != 'android':
Anthony Barbier14c86a92017-12-14 16:27:41 +0000348 env.Append(CPPPATH = ['#/include/linux'])
Anthony Barbier7068f992017-10-26 15:23:08 +0100349
Anthony Barbiere8a55df2018-10-26 09:05:01 +0100350SConscript('./SConscript', variant_dir=build_path, duplicate=0)
Anthony Barbier6c0348f2017-11-10 18:32:38 +0000351
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100352if env['examples'] and env['exceptions']:
353 if env['os'] == 'bare_metal' and env['arch'] == 'armv7a':
Michalis Spyrou35f35a62019-12-23 11:29:52 +0000354 print("WARNING: Building examples for bare metal and armv7a is not supported. Use examples=0")
355 Return()
Anthony Barbiere8a55df2018-10-26 09:05:01 +0100356 SConscript('./examples/SConscript', variant_dir='%s/examples' % build_path, duplicate=0)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100357
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100358if env['exceptions']:
359 if env['os'] == 'bare_metal' and env['arch'] == 'armv7a':
360 print("WARNING: Building tests for bare metal and armv7a is not supported")
361 Return()
Anthony Barbiere8a55df2018-10-26 09:05:01 +0100362 SConscript('./tests/SConscript', variant_dir='%s/tests' % build_path, duplicate=0)