blob: 9be03adeb7f081a57d30c9ceca03ea05aec6e473 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001# Copyright (c) 2017 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.
22import SCons
23import os.path
24
25Import('env')
26Import('vars')
Anthony Barbier6ff3b192017-09-04 18:44:23 +010027
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010028SConscript('./framework/SConscript', duplicate=0)
29
30#FIXME: Remove before release
31SConscript('./validation_old/SConscript', duplicate=0)
32
Anthony Barbier6ff3b192017-09-04 18:44:23 +010033# vars is imported from arm_compute:
34variables = [
35 #FIXME Remove before release (And remove all references to INTERNAL_ONLY)
36 BoolVariable("internal_only", "Enable ARM internal only tests", True),
37 BoolVariable("pmu", "Enable PMU counters", False),
38 BoolVariable("validation_tests", "Build validation test programs", True),
Anthony Barbier79c61782017-06-23 11:48:24 +010039 BoolVariable("benchmark_tests", "Build benchmark test programs", True)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010040]
41
42# We need a separate set of Variables for the Help message (Otherwise the global variables will get displayed twice)
43new_options = Variables('scons')
44
45for v in variables:
46 new_options.Add(v)
47 vars.Add(v)
48
49# Clone the environment to make sure we're not polluting the arm_compute one:
Moritz Pflanzerc7d15032017-07-18 16:21:16 +010050test_env = env.Clone()
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010051vars.Update(test_env)
52
53Help(new_options.GenerateHelpText(test_env))
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010054
55if env['os'] in ['android', 'bare_metal'] or env['standalone']:
56 Import("arm_compute_a")
Moritz Pflanzerc7d15032017-07-18 16:21:16 +010057 test_env.Append(LIBS = [arm_compute_a])
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010058 arm_compute_lib = arm_compute_a
59else:
Moritz Pflanzerc7d15032017-07-18 16:21:16 +010060 Import("arm_compute_so")
61 test_env.Append(LIBS = ["arm_compute"])
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010062 arm_compute_lib = arm_compute_so
63
64#FIXME Delete before release
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010065if test_env['internal_only']:
Moritz Pflanzerc7d15032017-07-18 16:21:16 +010066 test_env.Append(CPPDEFINES=['INTERNAL_ONLY'])
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010067
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010068test_env.Append(CPPPATH = ["#3rdparty/include"])
Moritz Pflanzerc7d15032017-07-18 16:21:16 +010069test_env.Append(LIBPATH = ["#3rdparty/%s/%s" % (env['os'], env['arch'])])
70test_env.Append(LIBPATH = ["#build/%s" % env['build_dir']])
Moritz Pflanzerc7d15032017-07-18 16:21:16 +010071test_env.Append(LIBPATH = ["#build/%s/opencl-1.2-stubs" % env['build_dir']])
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010072
73Import("arm_compute_test_framework")
Moritz Pflanzerc7d15032017-07-18 16:21:16 +010074test_env.Append(LIBS = arm_compute_test_framework)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010075
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010076common_files = Glob('*.cpp')
Moritz Pflanzerc7d15032017-07-18 16:21:16 +010077common_objects = [test_env.StaticObject(f) for f in common_files]
78
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010079files_benchmark = Glob('benchmark/*.cpp')
80files_validation = Glob('validation/*.cpp')
Moritz Pflanzerc7d15032017-07-18 16:21:16 +010081
82# Always compile reference for validation
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010083files_validation += Glob('validation/CPP/*.cpp')
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010084
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010085if env['opencl']:
86 Import('opencl')
87
Moritz Pflanzerc7d15032017-07-18 16:21:16 +010088 test_env.Append(CPPDEFINES=['ARM_COMPUTE_CL'])
89 test_env.Append(LIBS = ["OpenCL"])
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010090
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010091 files_benchmark += Glob('benchmark/CL/*/*.cpp')
92 files_benchmark += Glob('benchmark/CL/*.cpp')
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010093
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010094 files_validation += Glob('validation/CL/*/*.cpp')
95 files_validation += Glob('validation/CL/*.cpp')
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010096
97if env['neon']:
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010098 files_benchmark += Glob('benchmark/NEON/*/*.cpp')
99 files_benchmark += Glob('benchmark/NEON/*.cpp')
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100100
Moritz Pflanzera09de0c2017-09-01 20:41:12 +0100101 files_validation += Glob('validation/NEON/*/*.cpp')
102 files_validation += Glob('validation/NEON/*.cpp')
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100103
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100104if env['os'] == 'android':
105 test_env.Append(LIBS = ["log"])
106else:
107 test_env.Append(LIBS = ["rt"])
108
Moritz Pflanzera09de0c2017-09-01 20:41:12 +0100109if test_env['benchmark_tests']:
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100110 arm_compute_benchmark = test_env.Program('arm_compute_benchmark', files_benchmark + common_objects)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100111 Depends(arm_compute_benchmark, arm_compute_test_framework)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100112 Depends(arm_compute_benchmark, arm_compute_lib)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100113
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100114 if env['opencl']:
115 Depends(arm_compute_benchmark, opencl)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100116
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100117 Default(arm_compute_benchmark)
118 Export('arm_compute_benchmark')
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100119
Moritz Pflanzera09de0c2017-09-01 20:41:12 +0100120if test_env['validation_tests']:
121 arm_compute_validation = test_env.Program('arm_compute_validation', files_validation + common_objects)
122 Depends(arm_compute_validation, arm_compute_test_framework)
123 Depends(arm_compute_validation, arm_compute_lib)
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100124
125 if env['opencl']:
Moritz Pflanzera09de0c2017-09-01 20:41:12 +0100126 Depends(arm_compute_validation, opencl)
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100127
Moritz Pflanzera09de0c2017-09-01 20:41:12 +0100128 Default(arm_compute_validation)
129 Export('arm_compute_validation')