blob: 7e09240768b6000b3f48367878570aaab7551047 [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
Anthony Barbier6ff3b192017-09-04 18:44:23 +010029
30VERSION = "v0.0-unreleased"
morgolock16846ab2020-11-19 15:27:30 +000031LIBRARY_VERSION_MAJOR = 21
Sang-Hoon Park6d0b3842020-08-14 14:48:08 +010032LIBRARY_VERSION_MINOR = 0
Georgios Pinitas35fcc432020-03-26 18:47:46 +000033LIBRARY_VERSION_PATCH = 0
34SONAME_VERSION = str(LIBRARY_VERSION_MAJOR) + "." + str(LIBRARY_VERSION_MINOR) + "." + str(LIBRARY_VERSION_PATCH)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010035
36Import('env')
37Import('vars')
Anthony Barbier01bbd5f2018-11-01 15:10:51 +000038Import('install_lib')
Anthony Barbier6ff3b192017-09-04 18:44:23 +010039
Michalis Spyrou748a7c82019-10-07 13:00:44 +010040def build_bootcode_objs(sources):
41
42 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 Pinitas4d9687e2020-10-21 18:33:36 +010048def build_library(name, build_env, sources, static=False, libs=[]):
Anthony Barbier6ff3b192017-09-04 18:44:23 +010049 if static:
Georgios Pinitas4d9687e2020-10-21 18:33:36 +010050 obj = build_env.StaticLibrary(name, source=sources, LIBS = arm_compute_env["LIBS"] + libs)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010051 else:
52 if env['set_soname']:
Georgios Pinitas4d9687e2020-10-21 18:33:36 +010053 obj = build_env.SharedLibrary(name, source=sources, SHLIBVERSION = SONAME_VERSION, LIBS = arm_compute_env["LIBS"] + libs)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010054 else:
Georgios Pinitas4d9687e2020-10-21 18:33:36 +010055 obj = build_env.SharedLibrary(name, source=sources, LIBS = arm_compute_env["LIBS"] + libs)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010056
Anthony Barbier01bbd5f2018-11-01 15:10:51 +000057 obj = install_lib(obj)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010058 Default(obj)
59 return obj
60
Georgios Pinitasf605bd22020-11-26 11:55:09 +000061def remove_incode_comments(code):
62 def replace_with_empty(match):
63 s = match.group(0)
64 if s.startswith('/'):
65 return " "
66 else:
67 return s
68
69 comment_regex = re.compile(r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"', re.DOTALL | re.MULTILINE)
70 return re.sub(comment_regex, replace_with_empty, code)
71
Anthony Barbier6ff3b192017-09-04 18:44:23 +010072def resolve_includes(target, source, env):
73 # File collection
74 FileEntry = collections.namedtuple('FileEntry', 'target_name file_contents')
75
76 # Include pattern
77 pattern = re.compile("#include \"(.*)\"")
78
79 # Get file contents
80 files = []
81 for i in range(len(source)):
82 src = source[i]
83 dst = target[i]
Georgios Pinitasf605bd22020-11-26 11:55:09 +000084 contents = src.get_contents().decode('utf-8')
85 contents = remove_incode_comments(contents).splitlines()
Anthony Barbier6ff3b192017-09-04 18:44:23 +010086 entry = FileEntry(target_name=dst, file_contents=contents)
87 files.append((os.path.basename(src.get_path()),entry))
88
89 # Create dictionary of tupled list
90 files_dict = dict(files)
91
92 # Check for includes (can only be files in the same folder)
93 final_files = []
94 for file in files:
95 done = False
96 tmp_file = file[1].file_contents
97 while not done:
98 file_count = 0
99 updated_file = []
100 for line in tmp_file:
101 found = pattern.search(line)
102 if found:
103 include_file = found.group(1)
104 data = files_dict[include_file].file_contents
105 updated_file.extend(data)
106 else:
107 updated_file.append(line)
108 file_count += 1
109
110 # Check if all include are replaced.
111 if file_count == len(tmp_file):
112 done = True
113
114 # Update temp file
115 tmp_file = updated_file
116
117 # Append and prepend string literal identifiers and add expanded file to final list
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100118 entry = FileEntry(target_name=file[1].target_name, file_contents=tmp_file)
119 final_files.append((file[0], entry))
120
121 # Write output files
122 for file in final_files:
123 with open(file[1].target_name.get_path(), 'w+') as out_file:
Georgios Pinitasea857272021-01-22 05:47:37 +0000124 file_to_write = "\n".join( file[1].file_contents )
125 if env['compress_kernels']:
126 file_to_write = zlib.compress(file_to_write, 9).encode("base64").replace("\n", "")
127 file_to_write = "R\"(" + file_to_write + ")\""
128 out_file.write(file_to_write)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100129
130def create_version_file(target, source, env):
131# Generate string with build options library version to embed in the library:
132 try:
133 git_hash = subprocess.check_output(["git", "rev-parse", "HEAD"])
134 except (OSError, subprocess.CalledProcessError):
135 git_hash="unknown"
136
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100137 build_info = "\"arm_compute_version=%s Build options: %s Git hash=%s\"" % (VERSION, vars.args, git_hash.strip())
138 with open(target[0].get_path(), "w") as fd:
139 fd.write(build_info)
140
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100141arm_compute_env = env.Clone()
Anthony Barbier0e72c692018-08-24 11:22:08 +0100142version_file = arm_compute_env.Command("src/core/arm_compute_version.embed", "", action=create_version_file)
143arm_compute_env.AlwaysBuild(version_file)
Anthony Barbier6a3daf12018-02-19 17:24:27 +0000144
Georgios Pinitas45514032020-12-30 00:03:09 +0000145default_cpp_compiler = 'g++' if env['os'] not in ['android', 'macos'] else 'clang++'
Georgios Pinitas4d9687e2020-10-21 18:33:36 +0100146cpp_compiler = os.environ.get('CXX', default_cpp_compiler)
147
Anthony Barbier6a3daf12018-02-19 17:24:27 +0000148# Generate embed files
Anthony Barbier0e72c692018-08-24 11:22:08 +0100149generate_embed = [ version_file ]
Anthony Barbier6a3daf12018-02-19 17:24:27 +0000150if env['opencl'] and env['embed_kernels']:
151 cl_files = Glob('src/core/CL/cl_kernels/*.cl')
152 cl_files += Glob('src/core/CL/cl_kernels/*.h')
153
154 embed_files = [ f.get_path()+"embed" for f in cl_files ]
155 arm_compute_env.Append(CPPPATH =[Dir("./src/core/CL/").path] )
156
157 generate_embed.append(arm_compute_env.Command(embed_files, cl_files, action=resolve_includes))
158
159if env['gles_compute'] and env['embed_kernels']:
160 cs_files = Glob('src/core/GLES_COMPUTE/cs_shaders/*.cs')
161 cs_files += Glob('src/core/GLES_COMPUTE/cs_shaders/*.h')
162
163 embed_files = [ f.get_path()+"embed" for f in cs_files ]
164 arm_compute_env.Append(CPPPATH =[Dir("./src/core/GLES_COMPUTE/").path] )
165
166 generate_embed.append(arm_compute_env.Command(embed_files, cs_files, action=resolve_includes))
167
168Default(generate_embed)
169if env["build"] == "embed_only":
170 Return()
171
Georgios Pinitas35fcc432020-03-26 18:47:46 +0000172# Append version defines for semantic versioning
173arm_compute_env.Append(CPPDEFINES = [('ARM_COMPUTE_VERSION_MAJOR', LIBRARY_VERSION_MAJOR),
174 ('ARM_COMPUTE_VERSION_MINOR', LIBRARY_VERSION_MINOR),
175 ('ARM_COMPUTE_VERSION_PATCH', LIBRARY_VERSION_PATCH)])
176
177
Isabella Gottardib28f29d2017-11-09 17:05:07 +0000178# Don't allow undefined references in the libraries:
Georgios Pinitas45514032020-12-30 00:03:09 +0000179undefined_flag = '-Wl,-undefined,error' if 'macos' in arm_compute_env["os"] else '-Wl,--no-undefined'
180arm_compute_env.Append(LINKFLAGS=[undefined_flag])
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100181arm_compute_env.Append(CPPPATH =[Dir("./src/core/").path] )
182
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100183arm_compute_env.Append(LIBS = ['dl'])
184
185core_files = Glob('src/core/*.cpp')
186core_files += Glob('src/core/CPP/*.cpp')
187core_files += Glob('src/core/CPP/kernels/*.cpp')
Sang-Hoon Park68dd25f2020-10-19 16:00:11 +0100188core_files += Glob('src/core/helpers/*.cpp')
Sang-Hoon Park3687ee12020-06-24 13:34:04 +0100189core_files += Glob('src/core/utils/*.cpp')
Michalis Spyrou7043d362018-12-03 13:58:32 +0000190core_files += Glob('src/core/utils/helpers/*.cpp')
191core_files += Glob('src/core/utils/io/*.cpp')
192core_files += Glob('src/core/utils/quantization/*.cpp')
Georgios Pinitasb8d5b952019-05-16 14:13:03 +0100193core_files += Glob('src/core/utils/misc/*.cpp')
Michalis Spyrou7043d362018-12-03 13:58:32 +0000194if env["logging"]:
195 core_files += Glob('src/core/utils/logging/*.cpp')
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100196
Anthony Barbier8e6faf12017-08-01 17:03:19 +0100197runtime_files = Glob('src/runtime/*.cpp')
Georgios Pinitas8795ffb2017-12-01 16:13:40 +0000198runtime_files += Glob('src/runtime/CPP/ICPPSimpleFunction.cpp')
199runtime_files += Glob('src/runtime/CPP/functions/*.cpp')
200
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100201# CLHarrisCorners uses the Scheduler to run CPP kernels
Anthony Barbier8e6faf12017-08-01 17:03:19 +0100202runtime_files += Glob('src/runtime/CPP/SingleThreadScheduler.cpp')
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100203
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100204graph_files = Glob('src/graph/*.cpp')
205graph_files += Glob('src/graph/*/*.cpp')
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000206
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100207if env['cppthreads']:
Anthony Barbier8e6faf12017-08-01 17:03:19 +0100208 runtime_files += Glob('src/runtime/CPP/CPPScheduler.cpp')
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100209
210if env['openmp']:
Anthony Barbier8e6faf12017-08-01 17:03:19 +0100211 runtime_files += Glob('src/runtime/OMP/OMPScheduler.cpp')
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100212
213if env['opencl']:
214 core_files += Glob('src/core/CL/*.cpp')
215 core_files += Glob('src/core/CL/kernels/*.cpp')
Gian Marco Iodice926afe12019-03-19 11:44:13 +0000216 core_files += Glob('src/core/CL/gemm/*.cpp')
Gian Marco Iodice06be6f82019-06-24 17:47:51 +0100217 core_files += Glob('src/core/CL/gemm/native/*.cpp')
Gian Marco Iodice926afe12019-03-19 11:44:13 +0000218 core_files += Glob('src/core/CL/gemm/reshaped/*.cpp')
219 core_files += Glob('src/core/CL/gemm/reshaped_only_rhs/*.cpp')
Michele Di Giorgio7d61ff02021-01-18 21:15:59 +0000220 core_files += Glob('src/core/gpu/cl/*.cpp')
221 core_files += Glob('src/core/gpu/cl/kernels/*.cpp')
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100222
Anthony Barbier8e6faf12017-08-01 17:03:19 +0100223 runtime_files += Glob('src/runtime/CL/*.cpp')
224 runtime_files += Glob('src/runtime/CL/functions/*.cpp')
Gian Marco Iodice5a4fe192020-03-16 12:22:37 +0000225 runtime_files += Glob('src/runtime/CL/gemm/*.cpp')
Georgios Pinitasc0d1c862018-03-23 15:13:15 +0000226 runtime_files += Glob('src/runtime/CL/tuners/*.cpp')
Michele Di Giorgio7d61ff02021-01-18 21:15:59 +0000227 runtime_files += Glob('src/runtime/gpu/cl/*.cpp')
228 runtime_files += Glob('src/runtime/gpu/cl/operators/*.cpp')
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100229
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100230 graph_files += Glob('src/graph/backends/CL/*.cpp')
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000231
232
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100233if env['neon']:
234 core_files += Glob('src/core/NEON/*.cpp')
235 core_files += Glob('src/core/NEON/kernels/*.cpp')
Anthony Barbierc8e84b52018-07-17 16:48:42 +0100236 core_files += Glob('src/core/NEON/kernels/assembly/*.cpp')
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100237
Pablo Telloeb82fd22018-02-23 13:43:50 +0000238 core_files += Glob('src/core/NEON/kernels/arm_gemm/*.cpp')
Michele Di Giorgiod556d7b2020-10-27 10:56:31 +0000239 core_files += Glob('src/core/NEON/kernels/arm_conv/*.cpp')
240 core_files += Glob('src/core/NEON/kernels/arm_conv/pooling/*.cpp')
241 core_files += Glob('src/core/NEON/kernels/arm_conv/pooling/kernels/cpp_*/*.cpp')
Pablo Telloeb82fd22018-02-23 13:43:50 +0000242
Georgios Pinitas30271c72019-06-24 14:56:34 +0100243 # build winograd/depthwise sources for either v7a / v8a
Georgios Pinitas4074c992018-01-30 18:13:46 +0000244 core_files += Glob('src/core/NEON/kernels/convolution/*/*.cpp')
245 core_files += Glob('src/core/NEON/kernels/convolution/winograd/*/*.cpp')
Sang-Hoon Park68dd25f2020-10-19 16:00:11 +0100246 arm_compute_env.Append(CPPPATH = ["src/core/NEON/kernels/convolution/common/",
Michele Di Giorgio6ad60af2020-06-09 14:52:15 +0100247 "src/core/NEON/kernels/convolution/winograd/",
Sang-Hoon Park68dd25f2020-10-19 16:00:11 +0100248 "src/core/NEON/kernels/convolution/depthwise/",
249 "src/core/NEON/kernels/assembly/",
Georgios Pinitas30271c72019-06-24 14:56:34 +0100250 "arm_compute/core/NEON/kernels/assembly/"])
Pablo Tello9ceebbe2018-01-10 16:44:13 +0000251
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100252 graph_files += Glob('src/graph/backends/NEON/*.cpp')
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000253
Georgios Pinitasf2cdce32019-12-09 18:35:57 +0000254 if env['estate'] == '32':
Pablo Telloeb82fd22018-02-23 13:43:50 +0000255 core_files += Glob('src/core/NEON/kernels/arm_gemm/kernels/a32_*/*.cpp')
256
Georgios Pinitasf2cdce32019-12-09 18:35:57 +0000257 if env['estate'] == '64':
Pablo Telloeb82fd22018-02-23 13:43:50 +0000258 core_files += Glob('src/core/NEON/kernels/arm_gemm/kernels/a64_*/*.cpp')
Michele Di Giorgiod556d7b2020-10-27 10:56:31 +0000259 core_files += Glob('src/core/NEON/kernels/arm_conv/pooling/kernels/a64_*/*.cpp')
Georgios Pinitas421405b2018-10-26 19:05:32 +0100260 if "sve" in env['arch']:
261 core_files += Glob('src/core/NEON/kernels/arm_gemm/kernels/sve_*/*.cpp')
Michele Di Giorgiod556d7b2020-10-27 10:56:31 +0000262 core_files += Glob('src/core/NEON/kernels/arm_conv/pooling/kernels/sve_*/*.cpp')
Moritz Pflanzerbeabe3b2017-08-31 14:56:32 +0100263
Georgios Pinitasff4fca02020-10-02 21:00:00 +0100264 if any(i in env['data_type_support'] for i in ['all', 'fp16']):
Michalis Spyrouaa51a5b2020-11-22 00:49:42 +0000265 core_files += Glob('src/core/NEON/kernels/*/impl/*/fp16.cpp')
Georgios Pinitasff4fca02020-10-02 21:00:00 +0100266 if any(i in env['data_type_support'] for i in ['all', 'fp32']):
Michalis Spyrouaa51a5b2020-11-22 00:49:42 +0000267 core_files += Glob('src/core/NEON/kernels/*/impl/*/fp32.cpp')
Michalis Spyrouc4d45552020-10-19 12:41:30 +0100268 if any(i in env['data_type_support'] for i in ['all', 'qasymm8']):
Michalis Spyrouaa51a5b2020-11-22 00:49:42 +0000269 core_files += Glob('src/core/NEON/kernels/*/impl/*/qasymm8.cpp')
Michalis Spyrouc4d45552020-10-19 12:41:30 +0100270 if any(i in env['data_type_support'] for i in ['all', 'qasymm8_signed']):
Michalis Spyrouaa51a5b2020-11-22 00:49:42 +0000271 core_files += Glob('src/core/NEON/kernels/*/impl/*/qasymm8_signed.cpp')
Michalis Spyrouc4d45552020-10-19 12:41:30 +0100272 if any(i in env['data_type_support'] for i in ['all', 'qsymm16']):
Michalis Spyrouaa51a5b2020-11-22 00:49:42 +0000273 core_files += Glob('src/core/NEON/kernels/*/impl/*/qsymm16.cpp')
Michalis Spyroua3c9a3b2020-12-08 21:02:16 +0000274 if any(i in env['data_type_support'] for i in ['all', 'integer']):
275 core_files += Glob('src/core/NEON/kernels/*/impl/*/integer.cpp')
Georgios Pinitasff4fca02020-10-02 21:00:00 +0100276
Anthony Barbier8e6faf12017-08-01 17:03:19 +0100277 runtime_files += Glob('src/runtime/NEON/*.cpp')
278 runtime_files += Glob('src/runtime/NEON/functions/*.cpp')
Anthony Barbierc8e84b52018-07-17 16:48:42 +0100279 runtime_files += Glob('src/runtime/NEON/functions/assembly/*.cpp')
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100280
Georgios Pinitas70eb53b2021-01-06 19:42:21 +0000281 core_files += Glob('src/core/cpu/*.cpp')
282 core_files += Glob('src/core/cpu/kernels/*.cpp')
283 core_files += Glob('src/core/cpu/kernels/*/*.cpp')
284 if any(i in env['data_type_support'] for i in ['all', 'fp16']):
Georgios Pinitasf8f04422021-01-08 17:25:55 +0000285 core_files += Glob('src/core/cpu/kernels/*/*/fp16.cpp')
Georgios Pinitas70eb53b2021-01-06 19:42:21 +0000286 if any(i in env['data_type_support'] for i in ['all', 'fp32']):
Georgios Pinitasf8f04422021-01-08 17:25:55 +0000287 core_files += Glob('src/core/cpu/kernels/*/*/fp32.cpp')
Georgios Pinitas70eb53b2021-01-06 19:42:21 +0000288 if any(i in env['data_type_support'] for i in ['all', 'qasymm8']):
Georgios Pinitasf8f04422021-01-08 17:25:55 +0000289 core_files += Glob('src/core/cpu/kernels/*/*/qasymm8.cpp')
Georgios Pinitas70eb53b2021-01-06 19:42:21 +0000290 if any(i in env['data_type_support'] for i in ['all', 'qasymm8_signed']):
Georgios Pinitasf8f04422021-01-08 17:25:55 +0000291 core_files += Glob('src/core/cpu/kernels/*/*/qasymm8_signed.cpp')
Georgios Pinitas70eb53b2021-01-06 19:42:21 +0000292 if any(i in env['data_type_support'] for i in ['all', 'qsymm16']):
Georgios Pinitasf8f04422021-01-08 17:25:55 +0000293 core_files += Glob('src/core/cpu/kernels/*/*/qsymm16.cpp')
Sheri Zhang61243902021-01-12 18:25:16 +0000294 if any(i in env['data_type_support'] for i in ['all', 'integer']):
295 core_files += Glob('src/core/cpu/kernels/*/*/integer.cpp')
Georgios Pinitas70eb53b2021-01-06 19:42:21 +0000296
297 runtime_files += Glob('src/runtime/cpu/*.cpp')
298 runtime_files += Glob('src/runtime/cpu/operators/*.cpp')
299
Anthony Barbier7068f992017-10-26 15:23:08 +0100300if env['gles_compute']:
301 if env['os'] != 'android':
302 arm_compute_env.Append(CPPPATH = ["#opengles-3.1/include", "#opengles-3.1/mali_include"])
303
304 core_files += Glob('src/core/GLES_COMPUTE/*.cpp')
305 core_files += Glob('src/core/GLES_COMPUTE/kernels/*.cpp')
306
307 runtime_files += Glob('src/runtime/GLES_COMPUTE/*.cpp')
308 runtime_files += Glob('src/runtime/GLES_COMPUTE/functions/*.cpp')
309
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100310 graph_files += Glob('src/graph/backends/GLES/*.cpp')
Anthony Barbierb4670212018-05-18 16:55:39 +0100311if env['tracing']:
312 arm_compute_env.Append(CPPDEFINES = ['ARM_COMPUTE_TRACING_ENABLED'])
313else:
314 # Remove TracePoint files if tracing is disabled:
315 core_files = [ f for f in core_files if not "TracePoint" in str(f)]
316 runtime_files = [ f for f in runtime_files if not "TracePoint" in str(f)]
Georgios Pinitasfbb80542018-03-27 17:15:49 +0100317
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100318bootcode_o = []
319if env['os'] == 'bare_metal':
320 bootcode_files = Glob('bootcode/*.s')
321 bootcode_o = build_bootcode_objs(bootcode_files)
322Export('bootcode_o')
323
Georgios Pinitas4d9687e2020-10-21 18:33:36 +0100324arm_compute_core_a = build_library('arm_compute_core-static', arm_compute_env, core_files, static=True)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100325Export('arm_compute_core_a')
326
Pablo Telloc6cb35a2017-06-21 15:39:47 +0100327if env['os'] != 'bare_metal' and not env['standalone']:
Georgios Pinitas4d9687e2020-10-21 18:33:36 +0100328 arm_compute_core_so = build_library('arm_compute_core', arm_compute_env, core_files, static=False)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100329 Export('arm_compute_core_so')
330
Georgios Pinitas4d9687e2020-10-21 18:33:36 +0100331arm_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 +0100332Export('arm_compute_a')
333
Pablo Telloc6cb35a2017-06-21 15:39:47 +0100334if env['os'] != 'bare_metal' and not env['standalone']:
Georgios Pinitas4d9687e2020-10-21 18:33:36 +0100335 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 +0100336 Depends(arm_compute_so, arm_compute_core_so)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100337 Export('arm_compute_so')
338
Sang-Hoon Park18fbb922021-01-14 14:50:25 +0000339arm_compute_graph_env = arm_compute_env.Clone()
340
341arm_compute_graph_env.Append(CXXFLAGS = ['-Wno-redundant-move', '-Wno-pessimizing-move'])
342
Georgios Pinitas4d9687e2020-10-21 18:33:36 +0100343arm_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 +0100344Export('arm_compute_graph_a')
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000345
346if env['os'] != 'bare_metal' and not env['standalone']:
Georgios Pinitas4d9687e2020-10-21 18:33:36 +0100347 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 +0000348 Depends(arm_compute_graph_so, arm_compute_so)
Anthony Barbier2a07e182017-08-04 18:20:27 +0100349 Export('arm_compute_graph_so')
350
Pablo Telloc6cb35a2017-06-21 15:39:47 +0100351if env['standalone']:
352 alias = arm_compute_env.Alias("arm_compute", [arm_compute_a])
353else:
354 alias = arm_compute_env.Alias("arm_compute", [arm_compute_a, arm_compute_so])
355
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100356Default(alias)
357
Pablo Telloc6cb35a2017-06-21 15:39:47 +0100358if env['standalone']:
359 Depends([alias,arm_compute_core_a], generate_embed)
360else:
361 Depends([alias,arm_compute_core_so, arm_compute_core_a], generate_embed)