blob: 94ba6d423f987c644f6cbc53cdda6445b7824e70 [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.
22import collections
23import os.path
24import re
25import subprocess
Georgios Pinitasea857272021-01-22 05:47:37 +000026import zlib
27import base64
28import string
Georgios Pinitasbdcdc392021-04-22 16:42:03 +010029import json
Anthony Barbier6ff3b192017-09-04 18:44:23 +010030
31VERSION = "v0.0-unreleased"
Sheri Zhang5b114252021-05-06 09:49:05 +010032LIBRARY_VERSION_MAJOR = 23
Sang-Hoon Park6d0b3842020-08-14 14:48:08 +010033LIBRARY_VERSION_MINOR = 0
Georgios Pinitas35fcc432020-03-26 18:47:46 +000034LIBRARY_VERSION_PATCH = 0
35SONAME_VERSION = str(LIBRARY_VERSION_MAJOR) + "." + str(LIBRARY_VERSION_MINOR) + "." + str(LIBRARY_VERSION_PATCH)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010036
37Import('env')
38Import('vars')
Anthony Barbier01bbd5f2018-11-01 15:10:51 +000039Import('install_lib')
Anthony Barbier6ff3b192017-09-04 18:44:23 +010040
Michalis Spyrou748a7c82019-10-07 13:00:44 +010041def build_bootcode_objs(sources):
Michalis Spyrou748a7c82019-10-07 13:00:44 +010042 arm_compute_env.Append(ASFLAGS = "-I bootcode/")
43 obj = arm_compute_env.Object(sources)
44 obj = install_lib(obj)
45 Default(obj)
46 return obj
47
Georgios Pinitasbdcdc392021-04-22 16:42:03 +010048def build_sve_objs(sources):
49 tmp_env = arm_compute_env.Clone()
50 tmp_env.Append(CXXFLAGS = "-march=armv8.2-a+sve+fp16")
51 obj = tmp_env.SharedObject(sources)
52 obj = install_lib(obj)
53 Default(obj)
54 return obj
55
Georgios Pinitas4d9687e2020-10-21 18:33:36 +010056def build_library(name, build_env, sources, static=False, libs=[]):
Anthony Barbier6ff3b192017-09-04 18:44:23 +010057 if static:
Georgios Pinitas4d9687e2020-10-21 18:33:36 +010058 obj = build_env.StaticLibrary(name, source=sources, LIBS = arm_compute_env["LIBS"] + libs)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010059 else:
60 if env['set_soname']:
Georgios Pinitas4d9687e2020-10-21 18:33:36 +010061 obj = build_env.SharedLibrary(name, source=sources, SHLIBVERSION = SONAME_VERSION, LIBS = arm_compute_env["LIBS"] + libs)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010062 else:
Georgios Pinitas4d9687e2020-10-21 18:33:36 +010063 obj = build_env.SharedLibrary(name, source=sources, LIBS = arm_compute_env["LIBS"] + libs)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010064
Anthony Barbier01bbd5f2018-11-01 15:10:51 +000065 obj = install_lib(obj)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010066 Default(obj)
67 return obj
68
Georgios Pinitasf605bd22020-11-26 11:55:09 +000069def remove_incode_comments(code):
70 def replace_with_empty(match):
71 s = match.group(0)
72 if s.startswith('/'):
73 return " "
74 else:
75 return s
76
77 comment_regex = re.compile(r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"', re.DOTALL | re.MULTILINE)
78 return re.sub(comment_regex, replace_with_empty, code)
79
Anthony Barbier6ff3b192017-09-04 18:44:23 +010080def resolve_includes(target, source, env):
81 # File collection
82 FileEntry = collections.namedtuple('FileEntry', 'target_name file_contents')
83
84 # Include pattern
85 pattern = re.compile("#include \"(.*)\"")
86
87 # Get file contents
88 files = []
89 for i in range(len(source)):
90 src = source[i]
91 dst = target[i]
Georgios Pinitasf605bd22020-11-26 11:55:09 +000092 contents = src.get_contents().decode('utf-8')
93 contents = remove_incode_comments(contents).splitlines()
Anthony Barbier6ff3b192017-09-04 18:44:23 +010094 entry = FileEntry(target_name=dst, file_contents=contents)
95 files.append((os.path.basename(src.get_path()),entry))
96
97 # Create dictionary of tupled list
98 files_dict = dict(files)
99
100 # Check for includes (can only be files in the same folder)
101 final_files = []
102 for file in files:
103 done = False
104 tmp_file = file[1].file_contents
105 while not done:
106 file_count = 0
107 updated_file = []
108 for line in tmp_file:
109 found = pattern.search(line)
110 if found:
111 include_file = found.group(1)
112 data = files_dict[include_file].file_contents
113 updated_file.extend(data)
114 else:
115 updated_file.append(line)
116 file_count += 1
117
118 # Check if all include are replaced.
119 if file_count == len(tmp_file):
120 done = True
121
122 # Update temp file
123 tmp_file = updated_file
124
125 # Append and prepend string literal identifiers and add expanded file to final list
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100126 entry = FileEntry(target_name=file[1].target_name, file_contents=tmp_file)
127 final_files.append((file[0], entry))
128
129 # Write output files
130 for file in final_files:
131 with open(file[1].target_name.get_path(), 'w+') as out_file:
Georgios Pinitasea857272021-01-22 05:47:37 +0000132 file_to_write = "\n".join( file[1].file_contents )
133 if env['compress_kernels']:
134 file_to_write = zlib.compress(file_to_write, 9).encode("base64").replace("\n", "")
135 file_to_write = "R\"(" + file_to_write + ")\""
136 out_file.write(file_to_write)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100137
138def create_version_file(target, source, env):
139# Generate string with build options library version to embed in the library:
140 try:
141 git_hash = subprocess.check_output(["git", "rev-parse", "HEAD"])
142 except (OSError, subprocess.CalledProcessError):
143 git_hash="unknown"
144
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100145 build_info = "\"arm_compute_version=%s Build options: %s Git hash=%s\"" % (VERSION, vars.args, git_hash.strip())
146 with open(target[0].get_path(), "w") as fd:
147 fd.write(build_info)
148
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100149arm_compute_env = env.Clone()
Anthony Barbier0e72c692018-08-24 11:22:08 +0100150version_file = arm_compute_env.Command("src/core/arm_compute_version.embed", "", action=create_version_file)
151arm_compute_env.AlwaysBuild(version_file)
Anthony Barbier6a3daf12018-02-19 17:24:27 +0000152
Georgios Pinitas45514032020-12-30 00:03:09 +0000153default_cpp_compiler = 'g++' if env['os'] not in ['android', 'macos'] else 'clang++'
Georgios Pinitas4d9687e2020-10-21 18:33:36 +0100154cpp_compiler = os.environ.get('CXX', default_cpp_compiler)
155
Anthony Barbier6a3daf12018-02-19 17:24:27 +0000156# Generate embed files
Anthony Barbier0e72c692018-08-24 11:22:08 +0100157generate_embed = [ version_file ]
Anthony Barbier6a3daf12018-02-19 17:24:27 +0000158if env['opencl'] and env['embed_kernels']:
159 cl_files = Glob('src/core/CL/cl_kernels/*.cl')
160 cl_files += Glob('src/core/CL/cl_kernels/*.h')
161
162 embed_files = [ f.get_path()+"embed" for f in cl_files ]
163 arm_compute_env.Append(CPPPATH =[Dir("./src/core/CL/").path] )
164
165 generate_embed.append(arm_compute_env.Command(embed_files, cl_files, action=resolve_includes))
166
Anthony Barbier6a3daf12018-02-19 17:24:27 +0000167Default(generate_embed)
168if env["build"] == "embed_only":
169 Return()
170
Georgios Pinitas35fcc432020-03-26 18:47:46 +0000171# Append version defines for semantic versioning
172arm_compute_env.Append(CPPDEFINES = [('ARM_COMPUTE_VERSION_MAJOR', LIBRARY_VERSION_MAJOR),
173 ('ARM_COMPUTE_VERSION_MINOR', LIBRARY_VERSION_MINOR),
174 ('ARM_COMPUTE_VERSION_PATCH', LIBRARY_VERSION_PATCH)])
175
Isabella Gottardib28f29d2017-11-09 17:05:07 +0000176# Don't allow undefined references in the libraries:
Georgios Pinitas45514032020-12-30 00:03:09 +0000177undefined_flag = '-Wl,-undefined,error' if 'macos' in arm_compute_env["os"] else '-Wl,--no-undefined'
178arm_compute_env.Append(LINKFLAGS=[undefined_flag])
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100179arm_compute_env.Append(CPPPATH =[Dir("./src/core/").path] )
180
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100181arm_compute_env.Append(LIBS = ['dl'])
182
Georgios Pinitasbdcdc392021-04-22 16:42:03 +0100183with (open(Dir('#').path + '/filelist.json')) as fp:
184 filelist = json.load(fp)
185
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100186core_files = Glob('src/core/*.cpp')
187core_files += Glob('src/core/CPP/*.cpp')
188core_files += Glob('src/core/CPP/kernels/*.cpp')
Sang-Hoon Park68dd25f2020-10-19 16:00:11 +0100189core_files += Glob('src/core/helpers/*.cpp')
Sang-Hoon Park3687ee12020-06-24 13:34:04 +0100190core_files += Glob('src/core/utils/*.cpp')
Michalis Spyrou7043d362018-12-03 13:58:32 +0000191core_files += Glob('src/core/utils/helpers/*.cpp')
192core_files += Glob('src/core/utils/io/*.cpp')
193core_files += Glob('src/core/utils/quantization/*.cpp')
Georgios Pinitasb8d5b952019-05-16 14:13:03 +0100194core_files += Glob('src/core/utils/misc/*.cpp')
Michalis Spyrou7043d362018-12-03 13:58:32 +0000195if env["logging"]:
196 core_files += Glob('src/core/utils/logging/*.cpp')
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100197
Anthony Barbier8e6faf12017-08-01 17:03:19 +0100198runtime_files = Glob('src/runtime/*.cpp')
Georgios Pinitas8795ffb2017-12-01 16:13:40 +0000199runtime_files += Glob('src/runtime/CPP/ICPPSimpleFunction.cpp')
200runtime_files += Glob('src/runtime/CPP/functions/*.cpp')
201
Georgios Pinitasc3c352e2021-03-18 10:59:40 +0000202# C API files
Georgios Pinitasbdcdc392021-04-22 16:42:03 +0100203runtime_files += filelist['c_api']['cpu']
204
Georgios Pinitasc3c352e2021-03-18 10:59:40 +0000205if env['opencl']:
Georgios Pinitasbdcdc392021-04-22 16:42:03 +0100206 runtime_files += filelist['c_api']['gpu']
Georgios Pinitas8a5146f2021-01-12 15:51:07 +0000207
Georgios Pinitasc3c352e2021-03-18 10:59:40 +0000208# Common backend files
Georgios Pinitasbdcdc392021-04-22 16:42:03 +0100209core_files += filelist['common']
Georgios Pinitasc3c352e2021-03-18 10:59:40 +0000210
Anthony Barbier8e6faf12017-08-01 17:03:19 +0100211runtime_files += Glob('src/runtime/CPP/SingleThreadScheduler.cpp')
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100212
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100213graph_files = Glob('src/graph/*.cpp')
214graph_files += Glob('src/graph/*/*.cpp')
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000215
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100216if env['cppthreads']:
Anthony Barbier8e6faf12017-08-01 17:03:19 +0100217 runtime_files += Glob('src/runtime/CPP/CPPScheduler.cpp')
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100218
219if env['openmp']:
Anthony Barbier8e6faf12017-08-01 17:03:19 +0100220 runtime_files += Glob('src/runtime/OMP/OMPScheduler.cpp')
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100221
222if env['opencl']:
Georgios Pinitas856f66e2021-04-22 21:13:21 +0100223 cl_kernel_hp_files = ['src/core/gpu/cl/kernels/gemm/ClGemmHelpers.cpp',
224 'src/core/gpu/cl/kernels/gemm/native/ClGemmDefaultConfigNativeBifrost.cpp',
225 'src/core/gpu/cl/kernels/gemm/native/ClGemmDefaultConfigNativeMidgard.cpp',
226 'src/core/gpu/cl/kernels/gemm/native/ClGemmDefaultConfigNativeValhall.cpp',
227 'src/core/gpu/cl/kernels/gemm/reshaped/ClGemmDefaultConfigReshapedBifrost.cpp',
228 'src/core/gpu/cl/kernels/gemm/reshaped/ClGemmDefaultConfigReshapedValhall.cpp',
229 'src/core/gpu/cl/kernels/gemm/reshaped_only_rhs/ClGemmDefaultConfigReshapedRhsOnlyBifrost.cpp',
230 'src/core/gpu/cl/kernels/gemm/reshaped_only_rhs/ClGemmDefaultConfigReshapedRhsOnlyValhall.cpp',
231 ]
232 core_files += cl_kernel_hp_files
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100233 core_files += Glob('src/core/CL/*.cpp')
Michele Di Giorgio7d61ff02021-01-18 21:15:59 +0000234 core_files += Glob('src/core/gpu/cl/*.cpp')
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100235
Anthony Barbier8e6faf12017-08-01 17:03:19 +0100236 runtime_files += Glob('src/runtime/CL/*.cpp')
237 runtime_files += Glob('src/runtime/CL/functions/*.cpp')
Gian Marco Iodice5a4fe192020-03-16 12:22:37 +0000238 runtime_files += Glob('src/runtime/CL/gemm/*.cpp')
Georgios Pinitasc0d1c862018-03-23 15:13:15 +0000239 runtime_files += Glob('src/runtime/CL/tuners/*.cpp')
Michele Di Giorgio7d61ff02021-01-18 21:15:59 +0000240 runtime_files += Glob('src/runtime/gpu/cl/*.cpp')
241 runtime_files += Glob('src/runtime/gpu/cl/operators/*.cpp')
SiCong Li7061eb22021-01-08 15:16:02 +0000242 runtime_files += Glob('src/runtime/CL/mlgo/*.cpp')
SiCong Libd8b1e22021-02-04 13:07:09 +0000243 runtime_files += Glob('src/runtime/CL/gemm_auto_heuristics/*.cpp')
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100244
Georgios Pinitas8a5146f2021-01-12 15:51:07 +0000245 runtime_files += Glob('src/gpu/cl/*.cpp')
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100246 graph_files += Glob('src/graph/backends/CL/*.cpp')
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000247
Georgios Pinitasbdcdc392021-04-22 16:42:03 +0100248 core_files += filelist['gpu']['core']['kernels']['high_priority'] + filelist['gpu']['core']['kernels']['all']
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000249
Georgios Pinitasbdcdc392021-04-22 16:42:03 +0100250sve_o = []
251core_files_sve = []
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100252if env['neon']:
253 core_files += Glob('src/core/NEON/*.cpp')
254 core_files += Glob('src/core/NEON/kernels/*.cpp')
Anthony Barbierc8e84b52018-07-17 16:48:42 +0100255 core_files += Glob('src/core/NEON/kernels/assembly/*.cpp')
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100256
Pablo Telloeb82fd22018-02-23 13:43:50 +0000257 core_files += Glob('src/core/NEON/kernels/arm_gemm/*.cpp')
Michele Di Giorgiod556d7b2020-10-27 10:56:31 +0000258 core_files += Glob('src/core/NEON/kernels/arm_conv/*.cpp')
259 core_files += Glob('src/core/NEON/kernels/arm_conv/pooling/*.cpp')
260 core_files += Glob('src/core/NEON/kernels/arm_conv/pooling/kernels/cpp_*/*.cpp')
Pablo Telloeb82fd22018-02-23 13:43:50 +0000261
Georgios Pinitas30271c72019-06-24 14:56:34 +0100262 # build winograd/depthwise sources for either v7a / v8a
Georgios Pinitas4074c992018-01-30 18:13:46 +0000263 core_files += Glob('src/core/NEON/kernels/convolution/*/*.cpp')
264 core_files += Glob('src/core/NEON/kernels/convolution/winograd/*/*.cpp')
Sang-Hoon Park68dd25f2020-10-19 16:00:11 +0100265 arm_compute_env.Append(CPPPATH = ["src/core/NEON/kernels/convolution/common/",
Michele Di Giorgio6ad60af2020-06-09 14:52:15 +0100266 "src/core/NEON/kernels/convolution/winograd/",
Sang-Hoon Park68dd25f2020-10-19 16:00:11 +0100267 "src/core/NEON/kernels/convolution/depthwise/",
268 "src/core/NEON/kernels/assembly/",
Sang-Hoon Park4f7693d2021-05-12 13:59:10 +0100269 "arm_compute/core/NEON/kernels/assembly/",
270 "src/core/cpu/kernels/assembly/",])
Pablo Tello9ceebbe2018-01-10 16:44:13 +0000271
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100272 graph_files += Glob('src/graph/backends/NEON/*.cpp')
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000273
Georgios Pinitasf2cdce32019-12-09 18:35:57 +0000274 if env['estate'] == '32':
Pablo Telloeb82fd22018-02-23 13:43:50 +0000275 core_files += Glob('src/core/NEON/kernels/arm_gemm/kernels/a32_*/*.cpp')
276
Georgios Pinitasf2cdce32019-12-09 18:35:57 +0000277 if env['estate'] == '64':
Pablo Telloeb82fd22018-02-23 13:43:50 +0000278 core_files += Glob('src/core/NEON/kernels/arm_gemm/kernels/a64_*/*.cpp')
Michele Di Giorgiod556d7b2020-10-27 10:56:31 +0000279 core_files += Glob('src/core/NEON/kernels/arm_conv/pooling/kernels/a64_*/*.cpp')
Georgios Pinitasbdcdc392021-04-22 16:42:03 +0100280 if "sve" in env['arch'] or env['fat_binary']:
281 core_files_sve += filelist['cpu']['core']['sve']['all']
282 core_files_sve += Glob('src/core/NEON/kernels/arm_gemm/kernels/sve_*/*.cpp')
283 core_files_sve += Glob('src/core/NEON/kernels/arm_conv/pooling/kernels/sve_*/*.cpp')
284
285 if any(i in env['data_layout_support'] for i in ['all', 'nchw']):
286 core_files += filelist['cpu']['core']['neon']['nchw']
Moritz Pflanzerbeabe3b2017-08-31 14:56:32 +0100287
Georgios Pinitasff4fca02020-10-02 21:00:00 +0100288 if any(i in env['data_type_support'] for i in ['all', 'fp16']):
Georgios Pinitasbdcdc392021-04-22 16:42:03 +0100289 if not "sve" in env['arch'] or env['fat_binary']:
290 core_files += filelist['cpu']['core']['neon']['fp16']
291 if "sve" in env['arch'] or env['fat_binary']:
292 core_files_sve += filelist['cpu']['core']['sve']['fp16']
Georgios Pinitasff4fca02020-10-02 21:00:00 +0100293 if any(i in env['data_type_support'] for i in ['all', 'fp32']):
Georgios Pinitasbdcdc392021-04-22 16:42:03 +0100294 if not "sve" in env['arch'] or env['fat_binary']:
295 core_files += filelist['cpu']['core']['neon']['fp32']
296 if "sve" in env['arch'] or env['fat_binary']:
297 core_files_sve += filelist['cpu']['core']['sve']['fp32']
Michalis Spyrouc4d45552020-10-19 12:41:30 +0100298 if any(i in env['data_type_support'] for i in ['all', 'qasymm8']):
Georgios Pinitasbdcdc392021-04-22 16:42:03 +0100299 core_files += filelist['cpu']['core']['neon']['qasymm8']
300 core_files_sve += filelist['cpu']['core']['sve']['qasymm8']
Michalis Spyrouc4d45552020-10-19 12:41:30 +0100301 if any(i in env['data_type_support'] for i in ['all', 'qasymm8_signed']):
Georgios Pinitasbdcdc392021-04-22 16:42:03 +0100302 core_files += filelist['cpu']['core']['neon']['qasymm8_signed']
303 core_files_sve += filelist['cpu']['core']['sve']['qasymm8_signed']
Michalis Spyrouc4d45552020-10-19 12:41:30 +0100304 if any(i in env['data_type_support'] for i in ['all', 'qsymm16']):
Georgios Pinitasbdcdc392021-04-22 16:42:03 +0100305 core_files += filelist['cpu']['core']['neon']['qsymm16']
306 core_files_sve += filelist['cpu']['core']['sve']['qsymm16']
Michalis Spyroua3c9a3b2020-12-08 21:02:16 +0000307 if any(i in env['data_type_support'] for i in ['all', 'integer']):
Georgios Pinitasbdcdc392021-04-22 16:42:03 +0100308 if not "sve" in env['arch'] or env['fat_binary']:
309 core_files += filelist['cpu']['core']['neon']['integer']
310 if "sve" in env['arch'] or env['fat_binary']:
311 core_files_sve += filelist['cpu']['core']['sve']['integer']
312
313 core_files += Glob('src/core/cpu/kernels/*/*.cpp')
314 core_files += filelist['cpu']['core']['kernels']['high_priority'] + filelist['cpu']['core']['kernels']['all']
Georgios Pinitasff4fca02020-10-02 21:00:00 +0100315
Anthony Barbier8e6faf12017-08-01 17:03:19 +0100316 runtime_files += Glob('src/runtime/NEON/*.cpp')
317 runtime_files += Glob('src/runtime/NEON/functions/*.cpp')
Anthony Barbierc8e84b52018-07-17 16:48:42 +0100318 runtime_files += Glob('src/runtime/NEON/functions/assembly/*.cpp')
Georgios Pinitasbdcdc392021-04-22 16:42:03 +0100319 runtime_files += filelist['cpu']['runtime']['all'] + filelist['cpu']['runtime']['operators']['high_priority'] \
320 + filelist['cpu']['runtime']['operators']['all'] + filelist['cpu']['runtime']['operators']['internal']
Georgios Pinitas70eb53b2021-01-06 19:42:21 +0000321
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100322bootcode_o = []
323if env['os'] == 'bare_metal':
324 bootcode_files = Glob('bootcode/*.s')
325 bootcode_o = build_bootcode_objs(bootcode_files)
326Export('bootcode_o')
327
Georgios Pinitasbdcdc392021-04-22 16:42:03 +0100328if (env['fat_binary']):
329 sve_o = build_sve_objs(core_files_sve)
330 arm_compute_core_a = build_library('arm_compute_core-static', arm_compute_env, core_files + sve_o, static=True)
331else:
332 arm_compute_core_a = build_library('arm_compute_core-static', arm_compute_env, core_files + core_files_sve, static=True)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100333Export('arm_compute_core_a')
334
Pablo Telloc6cb35a2017-06-21 15:39:47 +0100335if env['os'] != 'bare_metal' and not env['standalone']:
Georgios Pinitasbdcdc392021-04-22 16:42:03 +0100336 if (env['fat_binary']):
337 arm_compute_core_so = build_library('arm_compute_core', arm_compute_env, core_files + sve_o, static=False)
338 else:
339 arm_compute_core_so = build_library('arm_compute_core', arm_compute_env, core_files + core_files_sve, static=False)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100340 Export('arm_compute_core_so')
341
Georgios Pinitas4d9687e2020-10-21 18:33:36 +0100342arm_compute_a = build_library('arm_compute-static', arm_compute_env, runtime_files, static=True, libs = [ arm_compute_core_a ])
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100343Export('arm_compute_a')
344
Pablo Telloc6cb35a2017-06-21 15:39:47 +0100345if env['os'] != 'bare_metal' and not env['standalone']:
Georgios Pinitas4d9687e2020-10-21 18:33:36 +0100346 arm_compute_so = build_library('arm_compute', arm_compute_env, runtime_files, static=False, libs = [ "arm_compute_core" ])
Anthony Barbierb2881fc2017-09-29 17:12:12 +0100347 Depends(arm_compute_so, arm_compute_core_so)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100348 Export('arm_compute_so')
349
Sang-Hoon Park18fbb922021-01-14 14:50:25 +0000350arm_compute_graph_env = arm_compute_env.Clone()
351
352arm_compute_graph_env.Append(CXXFLAGS = ['-Wno-redundant-move', '-Wno-pessimizing-move'])
353
Georgios Pinitas4d9687e2020-10-21 18:33:36 +0100354arm_compute_graph_a = build_library('arm_compute_graph-static', arm_compute_graph_env, graph_files, static=True, libs = [ arm_compute_a])
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100355Export('arm_compute_graph_a')
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000356
357if env['os'] != 'bare_metal' and not env['standalone']:
Georgios Pinitas4d9687e2020-10-21 18:33:36 +0100358 arm_compute_graph_so = build_library('arm_compute_graph', arm_compute_graph_env, graph_files, static=False, libs = [ "arm_compute" , "arm_compute_core"])
Georgios Pinitas9873ea32017-12-05 15:28:55 +0000359 Depends(arm_compute_graph_so, arm_compute_so)
Anthony Barbier2a07e182017-08-04 18:20:27 +0100360 Export('arm_compute_graph_so')
361
Pablo Telloc6cb35a2017-06-21 15:39:47 +0100362if env['standalone']:
363 alias = arm_compute_env.Alias("arm_compute", [arm_compute_a])
364else:
365 alias = arm_compute_env.Alias("arm_compute", [arm_compute_a, arm_compute_so])
366
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100367Default(alias)
368
Pablo Telloc6cb35a2017-06-21 15:39:47 +0100369if env['standalone']:
370 Depends([alias,arm_compute_core_a], generate_embed)
371else:
372 Depends([alias,arm_compute_core_so, arm_compute_core_a], generate_embed)