blob: 87907f40fcd4f627fb720f745a042e0e1a1bd952 [file] [log] [blame]
Michele Di Giorgio33f41fa2021-03-09 14:09:08 +00001# -*- coding: utf-8 -*-
2
SiCong Li68c22002022-03-15 10:17:29 +00003# Copyright (c) 2017-2022 Arm Limited.
Anthony Barbier6ff3b192017-09-04 18:44:23 +01004#
5# SPDX-License-Identifier: MIT
6#
7# Permission is hereby granted, free of charge, to any person obtaining a copy
8# of this software and associated documentation files (the "Software"), to
9# deal in the Software without restriction, including without limitation the
10# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
11# sell copies of the Software, and to permit persons to whom the Software is
12# furnished to do so, subject to the following conditions:
13#
14# The above copyright notice and this permission notice shall be included in all
15# copies or substantial portions of the Software.
16#
17# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23# SOFTWARE.
Anthony Barbier6ff3b192017-09-04 18:44:23 +010024import os.path
25
26Import('env')
27Import('vars')
Anthony Barbier01bbd5f2018-11-01 15:10:51 +000028Import('install_bin')
Anthony Barbier6ff3b192017-09-04 18:44:23 +010029
30# vars is imported from arm_compute:
31variables = [
Michele Di Giorgiof9a611a2021-03-12 11:22:55 +000032 BoolVariable("benchmark_examples", "Build benchmark examples programs", False),
33 BoolVariable("validate_examples", "Build validate examples programs", False),
Michalis Spyroud1d77222020-04-08 14:10:15 +010034 BoolVariable("reference_openmp", "Build reference validation with openmp", True),
Michele Di Giorgiof9a611a2021-03-12 11:22:55 +000035 BoolVariable("validation_tests", "Build validation test programs", False),
36 BoolVariable("benchmark_tests", "Build benchmark test programs", False),
Pablo Telloea1c9502017-11-09 11:49:18 +000037 ("test_filter", "Pattern to specify the tests' filenames to be compiled", "*.cpp")
Anthony Barbier6ff3b192017-09-04 18:44:23 +010038]
39
40# We need a separate set of Variables for the Help message (Otherwise the global variables will get displayed twice)
41new_options = Variables('scons')
42
43for v in variables:
44 new_options.Add(v)
45 vars.Add(v)
46
47# Clone the environment to make sure we're not polluting the arm_compute one:
Moritz Pflanzerc7d15032017-07-18 16:21:16 +010048test_env = env.Clone()
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010049vars.Update(test_env)
50
51Help(new_options.GenerateHelpText(test_env))
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010052
Georgios Pinitas6a342642020-01-28 15:54:20 +000053# Check if we need to build the test framework
54build_test_framework = False
55for opt in new_options.keys():
56 option_value = test_env[opt]
57 if type(option_value) is bool and option_value:
58 build_test_framework = True
59 break
60
61if not build_test_framework:
62 Return()
63else:
64 SConscript('./framework/SConscript', duplicate=0)
65
Anthony Barbier6db0ff52018-01-05 10:59:12 +000066Import("arm_compute_test_framework")
67test_env.Append(LIBS = arm_compute_test_framework)
68
Georgios Pinitas6a342642020-01-28 15:54:20 +000069# Disable floating-point expression contraction (e.g. fused multiply-add operations)
70test_env.Append(CXXFLAGS = ['-ffp-contract=off'])
71
Georgios Pinitasf8d8f3a2018-06-06 17:57:04 +010072# Remove -Wnoexcept from tests
73if 'g++' in test_env['CXX'] and '-Wnoexcept' in test_env['CXXFLAGS']:
74 test_env['CXXFLAGS'].remove("-Wnoexcept")
75
Georgios Pinitas45514032020-12-30 00:03:09 +000076load_whole_archive = '-Wl,--whole-archive'
77noload_whole_archive = '-Wl,--no-whole-archive'
78if 'macos' in test_env['os']:
79 load_whole_archive = '-Wl,-force_load'
80 noload_whole_archive = '-Wl,-noall_load'
81
82if env['os'] in ['android', 'macos', 'bare_metal'] or env['standalone']:
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010083 Import("arm_compute_a")
Anthony Barbierb2881fc2017-09-29 17:12:12 +010084 Import("arm_compute_core_a")
Georgios Pinitas5c2fb3f2018-05-01 15:26:20 +010085 Import("arm_compute_graph_a")
86 test_env.Append(LIBS = [arm_compute_graph_a, arm_compute_a, arm_compute_core_a])
87 arm_compute_lib = arm_compute_graph_a
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010088else:
Georgios Pinitas5c2fb3f2018-05-01 15:26:20 +010089 Import("arm_compute_graph_so")
Anthony Barbier2df1f992018-07-11 13:37:23 +010090 Import("arm_compute_core_a")
Georgios Pinitas5c2fb3f2018-05-01 15:26:20 +010091 test_env.Append(LIBS = ["arm_compute_graph", "arm_compute", "arm_compute_core"])
92 arm_compute_lib = arm_compute_graph_so
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010093
Michalis Spyrou748a7c82019-10-07 13:00:44 +010094if env['os'] in ['bare_metal']:
95 Import("bootcode_o")
96
Michele Di Giorgio72610dc2020-11-18 15:29:08 +000097if env['external_tests_dir']:
98 test_env.Append(CPPPATH = [env['external_tests_dir'] + "/include"])
99 test_env.Append(LIBPATH = [env['external_tests_dir'] + "/%s/%s" % (env['os'], env['arch'])])
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100100
Moritz Pflanzera09de0c2017-09-01 20:41:12 +0100101common_files = Glob('*.cpp')
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100102common_objects = [test_env.StaticObject(f) for f in common_files]
103
Moritz Pflanzera09de0c2017-09-01 20:41:12 +0100104files_benchmark = Glob('benchmark/*.cpp')
Michele Di Giorgio72610dc2020-11-18 15:29:08 +0000105if env['external_tests_dir']:
106 files_benchmark += Glob(env['external_tests_dir'] + '/tests/benchmark/*.cpp')
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100107
Abe Mbise925ca0f2017-10-02 19:16:33 +0100108# Add unit tests
Anthony Barbier979dc4f2018-03-07 09:27:48 +0000109files_validation = Glob('validation/UNIT/*/*.cpp')
Abe Mbise925ca0f2017-10-02 19:16:33 +0100110files_validation += Glob('validation/UNIT/*.cpp')
111
Georgios Pinitas8795ffb2017-12-01 16:13:40 +0000112# Add CPP tests
113filter_pattern = test_env['test_filter']
114files_validation += Glob('validation/CPP/' + filter_pattern)
115
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100116if env['opencl']:
Giorgio Arena892b70a2022-03-30 12:23:10 +0100117 if env['experimental_dynamic_fusion']:
Giorgio Arena232c4522022-03-03 10:09:01 +0000118 test_env.Append(CPPDEFINES = ['ENABLE_EXPERIMENTAL_DYNAMIC_FUSION'])
Giorgio Arena892b70a2022-03-30 12:23:10 +0100119 files_validation += Glob('validation/CL/UNIT/dynamic_fusion/' + filter_pattern)
Giorgio Arena232c4522022-03-03 10:09:01 +0000120
Pablo Telloea1c9502017-11-09 11:49:18 +0000121 filter_pattern = test_env['test_filter']
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100122
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100123 test_env.Append(CPPDEFINES=['ARM_COMPUTE_CL'])
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100124
Pablo Telloea1c9502017-11-09 11:49:18 +0000125 files_benchmark += Glob('benchmark/CL/*/' + filter_pattern)
126 files_benchmark += Glob('benchmark/CL/' + filter_pattern)
Michele Di Giorgio72610dc2020-11-18 15:29:08 +0000127 if env['external_tests_dir']:
128 files_benchmark += Glob(env['external_tests_dir'] + '/tests/benchmark/CL/' + filter_pattern)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100129
Pablo Telloea1c9502017-11-09 11:49:18 +0000130 files_validation += Glob('validation/CL/*/' + filter_pattern)
131 files_validation += Glob('validation/CL/' + filter_pattern)
Giorgio Arena892b70a2022-03-30 12:23:10 +0100132
Michele Di Giorgio72610dc2020-11-18 15:29:08 +0000133 if env['external_tests_dir']:
134 files_validation += Glob(env['external_tests_dir'] + '/tests/validation/CL/' + filter_pattern)
Georgios Pinitas8a5146f2021-01-12 15:51:07 +0000135 files_validation += Glob('validation/gpu/unit/*.cpp')
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100136
137if env['neon']:
Pablo Telloea1c9502017-11-09 11:49:18 +0000138 filter_pattern = test_env['test_filter']
139 files_benchmark += Glob('benchmark/NEON/*/' + filter_pattern)
140 files_benchmark += Glob('benchmark/NEON/' + filter_pattern)
Georgios Pinitas7891a732021-08-20 21:39:25 +0100141 test_env.Append(CPPPATH = ["#/src/cpu/kernels/assembly/"])
Michele Di Giorgio72610dc2020-11-18 15:29:08 +0000142 if env['external_tests_dir']:
143 files_benchmark += Glob(env['external_tests_dir'] + '/tests/benchmark/NEON/' + filter_pattern)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100144
Pablo Telloea1c9502017-11-09 11:49:18 +0000145 files_validation += Glob('validation/NEON/' + filter_pattern)
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100146 if env['os'] == 'bare_metal':
147 files_validation += Glob('validation/NEON/UNIT/MemoryManager.cpp' + filter_pattern)
148 files_validation += Glob('validation/NEON/UNIT/DynamicTensor.cpp' + filter_pattern)
149 files_validation += Glob('validation/NEON/UNIT/TensorAllocator.cpp' + filter_pattern)
150 else:
151 files_validation += Glob('validation/NEON/*/' + filter_pattern)
Michele Di Giorgio72610dc2020-11-18 15:29:08 +0000152 if env['external_tests_dir']:
153 files_validation += Glob(env['external_tests_dir'] + '/tests/validation/NEON/' + filter_pattern)
Georgios Pinitas8a5146f2021-01-12 15:51:07 +0000154 files_validation += Glob('validation/cpu/unit/*.cpp')
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100155
Michalis Spyrou6a9e8012020-02-07 09:45:55 +0000156extra_link_flags = []
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100157if env['os'] == 'android':
158 test_env.Append(LIBS = ["log"])
Georgios Pinitas45514032020-12-30 00:03:09 +0000159elif env['os'] not in ['bare_metal', 'macos']:
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100160 test_env.Append(LIBS = ["rt"])
Michalis Spyrou6a9e8012020-02-07 09:45:55 +0000161 extra_link_flags += ['-fstack-protector-strong']
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100162
Moritz Pflanzera09de0c2017-09-01 20:41:12 +0100163if test_env['benchmark_tests']:
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100164 arm_compute_benchmark = test_env.Program('arm_compute_benchmark', files_benchmark + common_objects)
Anthony Barbier01bbd5f2018-11-01 15:10:51 +0000165 arm_compute_benchmark = install_bin(arm_compute_benchmark)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100166 Depends(arm_compute_benchmark, arm_compute_test_framework)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100167 Depends(arm_compute_benchmark, arm_compute_lib)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100168 Default(arm_compute_benchmark)
169 Export('arm_compute_benchmark')
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100170
Michalis Spyrou6a9e8012020-02-07 09:45:55 +0000171bm_link_flags = []
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100172if test_env['linker_script']:
Michalis Spyrou7d303522020-01-07 12:56:01 +0000173 bm_link_flags += ['-Wl,--build-id=none', '-T', env['linker_script']]
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100174
Georgios Pinitas45514032020-12-30 00:03:09 +0000175if test_env['reference_openmp'] and env['os'] not in ['bare_metal', 'macos']:
Giorgio Arenab83e6722022-03-24 14:23:07 +0000176 test_env['CXXFLAGS'].append('-fopenmp')
177 test_env['LINKFLAGS'].append('-fopenmp')
178
179 if 'ndk_above_r21' in env:
180 test_env['LINKFLAGS'].append('-static-openmp')
Michalis Spyroud1d77222020-04-08 14:10:15 +0100181
Moritz Pflanzera09de0c2017-09-01 20:41:12 +0100182if test_env['validation_tests']:
Michalis Spyroud1d77222020-04-08 14:10:15 +0100183 arm_compute_validation_framework = env.StaticLibrary('arm_compute_validation_framework', Glob('validation/reference/*.cpp') + Glob('validation/*.cpp'), LINKFLAGS=test_env['LINKFLAGS'], CXXFLAGS=test_env['CXXFLAGS'], LIBS= [ arm_compute_test_framework, arm_compute_core_a])
Anthony Barbier2df1f992018-07-11 13:37:23 +0100184 Depends(arm_compute_validation_framework , arm_compute_test_framework)
185 Depends(arm_compute_validation_framework , arm_compute_core_a)
186
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100187 program_objects = files_validation + common_objects
188 if test_env['os'] == 'bare_metal':
189 Depends(arm_compute_validation_framework , bootcode_o)
190 program_objects += bootcode_o
191
192
193 arm_compute_validation = test_env.Program('arm_compute_validation', program_objects, LIBS=[arm_compute_validation_framework] + test_env['LIBS'], LINKFLAGS=test_env['LINKFLAGS'] + bm_link_flags)
Anthony Barbier01bbd5f2018-11-01 15:10:51 +0000194 arm_compute_validation = install_bin(arm_compute_validation)
Anthony Barbier2df1f992018-07-11 13:37:23 +0100195 Depends(arm_compute_validation, arm_compute_validation_framework)
Moritz Pflanzera09de0c2017-09-01 20:41:12 +0100196 Depends(arm_compute_validation, arm_compute_test_framework)
197 Depends(arm_compute_validation, arm_compute_lib)
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100198
Moritz Pflanzera09de0c2017-09-01 20:41:12 +0100199 Default(arm_compute_validation)
200 Export('arm_compute_validation')
Anthony Barbier6db0ff52018-01-05 10:59:12 +0000201
Anthony Barbier979dc4f2018-03-07 09:27:48 +0000202 if test_env['validate_examples']:
Anthony Barbier2df1f992018-07-11 13:37:23 +0100203 files_validate_examples = [ test_env.Object('validate_examples/RunExample.cpp') ] + [ x for x in common_objects if not "main.o" in str(x)]
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100204 if test_env['os'] == 'bare_metal':
205 files_validate_examples += bootcode_o
206
Anthony Barbier979dc4f2018-03-07 09:27:48 +0000207 arm_compute_validate_examples = []
208 if test_env['neon']:
209 for file in Glob("validate_examples/neon_*.cpp"):
210 example = "validate_" + os.path.basename(os.path.splitext(str(file))[0])
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100211 arm_compute_validate_examples += [ test_env.Program(example, [ test_env.Object(source=file, target=example) ] + files_validate_examples, LIBS = [ arm_compute_validation_framework], LINKFLAGS=test_env['LINKFLAGS'] + bm_link_flags) ]
Anthony Barbier979dc4f2018-03-07 09:27:48 +0000212 if test_env['opencl']:
213 cl_examples = []
214 files = Glob("validate_examples/cl_*.cpp")
215 if test_env['neon']:
216 files += Glob("validate_examples/neoncl_*.cpp")
217 for file in files:
218 example = "validate_" + os.path.basename(os.path.splitext(str(file))[0])
Anthony Barbier2df1f992018-07-11 13:37:23 +0100219 cl_examples += [ test_env.Program(example, [ test_env.Object(source=file, target=example) ] + files_validate_examples, LIBS = test_env["LIBS"] + [ arm_compute_validation_framework ]) ]
Anthony Barbier979dc4f2018-03-07 09:27:48 +0000220 arm_compute_validate_examples += cl_examples
221 if test_env['opencl'] and test_env['neon']:
Anthony Barbier979dc4f2018-03-07 09:27:48 +0000222 graph_utils = test_env.Object(source="../utils/GraphUtils.cpp", target="GraphUtils")
223 for file in Glob("validate_examples/graph_*.cpp"):
224 example = "validate_" + os.path.basename(os.path.splitext(str(file))[0])
Georgios Pinitas45514032020-12-30 00:03:09 +0000225 if env['os'] in ['android', 'macos', 'bare_metal'] or env['standalone']:
226 prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils]+ files_validate_examples, LIBS = test_env["LIBS"] + [ arm_compute_validation_framework ], LINKFLAGS=test_env["LINKFLAGS"]+[load_whole_archive, arm_compute_lib, noload_whole_archive] + bm_link_flags + extra_link_flags)
Anthony Barbier979dc4f2018-03-07 09:27:48 +0000227 arm_compute_validate_examples += [ prog ]
228 else:
229 #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies
Anthony Barbier2df1f992018-07-11 13:37:23 +0100230 prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils]+ files_validate_examples, LIBS = test_env["LIBS"] + ["arm_compute_graph", arm_compute_validation_framework], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--allow-shlib-undefined'] )
Anthony Barbier979dc4f2018-03-07 09:27:48 +0000231 arm_compute_validate_examples += [ prog ]
Anthony Barbier01bbd5f2018-11-01 15:10:51 +0000232 arm_compute_validate_examples = install_bin(arm_compute_validate_examples)
Anthony Barbier2df1f992018-07-11 13:37:23 +0100233 Depends(arm_compute_validate_examples, arm_compute_validation_framework)
Anthony Barbier979dc4f2018-03-07 09:27:48 +0000234 Depends(arm_compute_validate_examples, arm_compute_test_framework)
235 Depends(arm_compute_validate_examples, arm_compute_lib)
236 Default(arm_compute_validate_examples)
237 Export('arm_compute_validate_examples')
238
Anthony Barbier6db0ff52018-01-05 10:59:12 +0000239if test_env['benchmark_examples']:
240 files_benchmark_examples = test_env.Object('benchmark_examples/RunExample.cpp')
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100241 if test_env['os'] == 'bare_metal':
242 files_benchmark_examples += bootcode_o
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100243 graph_utils = test_env.Object(source="../utils/GraphUtils.cpp", target="GraphUtils")
Georgios Pinitas12be7ab2018-07-03 12:06:23 +0100244 graph_params = test_env.Object(source="../utils/CommonGraphOptions.cpp", target="CommonGraphOptions")
Anthony Barbier3b6cdbb2018-09-14 11:58:05 +0100245 arm_compute_benchmark_examples = []
Michele Di Giorgio72610dc2020-11-18 15:29:08 +0000246 all_examples_folders = ["../examples"]
247 if env['external_tests_dir']:
248 all_examples_folders.append(env['external_tests_dir'] + "/examples")
249 for examples_folder in all_examples_folders:
Anthony Barbier3b6cdbb2018-09-14 11:58:05 +0100250 if test_env['neon']:
251 for file in Glob("%s/neon_*.cpp" % examples_folder):
252 example = "benchmark_" + os.path.basename(os.path.splitext(str(file))[0])
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100253 arm_compute_benchmark_examples += [ test_env.Program(example, [ test_env.Object(source=file, target=example) ] + files_benchmark_examples, LINKFLAGS=test_env["LINKFLAGS"]+ bm_link_flags) ]
Anthony Barbier3b6cdbb2018-09-14 11:58:05 +0100254 if test_env['opencl']:
255 cl_examples = []
256 files = Glob("%s/cl_*.cpp" % examples_folder)
257 if test_env['neon']:
258 files += Glob("%s/neoncl_*.cpp" % examples_folder)
259 for file in files:
260 example = "benchmark_" + os.path.basename(os.path.splitext(str(file))[0])
261 cl_examples += [ test_env.Program(example, [ test_env.Object(source=file, target=example) ] + files_benchmark_examples, LIBS = test_env["LIBS"]) ]
262 arm_compute_benchmark_examples += cl_examples
263
SiCong Li8b4c7302019-09-19 12:18:15 +0100264 if test_env['gemm_tuner'] and test_env['opencl']:
265 gemm_tuner_examples = []
SiCong Li240b79d2019-09-24 15:50:34 +0100266 gemm_tuner_common_options = test_env.Object(source="../examples/gemm_tuner/CommonGemmExampleOptions.cpp", target="CommonGemmExampleOptions")
SiCong Li8b4c7302019-09-19 12:18:15 +0100267 files = Glob("%s/gemm_tuner/cl_*.cpp" % examples_folder)
268 for file in files:
269 example = "benchmark_" + os.path.basename(os.path.splitext(str(file))[0])
270 example = os.path.join("gemm_tuner", example)
SiCong Li240b79d2019-09-24 15:50:34 +0100271 gemm_tuner_examples += [ test_env.Program(example, [ test_env.Object(source=file, target=example), gemm_tuner_common_options ] + files_benchmark_examples, LIBS = test_env["LIBS"]) ]
SiCong Li8b4c7302019-09-19 12:18:15 +0100272 arm_compute_benchmark_examples += gemm_tuner_examples
273
Anthony Barbier3b6cdbb2018-09-14 11:58:05 +0100274 # Graph examples
275 for file in Glob("%s/graph_*.cpp" % examples_folder ):
276 example = "benchmark_" + os.path.basename(os.path.splitext(str(file))[0])
Georgios Pinitas45514032020-12-30 00:03:09 +0000277 if env['os'] in ['android', 'macos', 'bare_metal'] or env['standalone']:
278 prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils, graph_params]+ files_benchmark_examples, LIBS = test_env["LIBS"], LINKFLAGS=test_env["LINKFLAGS"]+[load_whole_archive, arm_compute_lib, noload_whole_archive] + bm_link_flags + extra_link_flags)
Anthony Barbier3b6cdbb2018-09-14 11:58:05 +0100279 arm_compute_benchmark_examples += [ prog ]
280 else:
281 #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100282 prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils, graph_params]+ files_benchmark_examples, LIBS = test_env["LIBS"] + ["arm_compute_graph"], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--allow-shlib-undefined'])
Anthony Barbier3b6cdbb2018-09-14 11:58:05 +0100283 arm_compute_benchmark_examples += [ prog ]
SiCong Lib63b1192022-01-28 18:24:39 +0000284
285 # Dynamic fusion examples
286 if env['opencl']:
287 if env['experimental_dynamic_fusion']:
288 for file in Glob("%s/dynamic_fusion/*.cpp" % examples_folder):
289 example = "benchmark_" + os.path.basename(os.path.splitext(str(file))[0])
290 if env['os'] in ['android', 'macos', 'bare_metal'] or env['standalone']:
291 prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils, graph_params]+ files_benchmark_examples, LIBS = test_env["LIBS"], LINKFLAGS=test_env["LINKFLAGS"]+[load_whole_archive, arm_compute_lib, noload_whole_archive] + bm_link_flags + extra_link_flags)
292 arm_compute_benchmark_examples += [ prog ]
293 else:
294 #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies
295 prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils, graph_params]+ files_benchmark_examples, LIBS = test_env["LIBS"] + ["arm_compute_graph"], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--allow-shlib-undefined'])
296 arm_compute_benchmark_examples += [ prog ]
297
Anthony Barbier01bbd5f2018-11-01 15:10:51 +0000298 arm_compute_benchmark_examples = install_bin(arm_compute_benchmark_examples)
Anthony Barbier6db0ff52018-01-05 10:59:12 +0000299 Depends(arm_compute_benchmark_examples, arm_compute_test_framework)
300 Depends(arm_compute_benchmark_examples, arm_compute_lib)
301 Default(arm_compute_benchmark_examples)
SiCong Li7061eb22021-01-08 15:16:02 +0000302 Export('arm_compute_benchmark_examples')