blob: 450ffd77b001e5d9aff042074533b85dc237c820 [file] [log] [blame]
Michalis Spyroua8caa022022-05-18 17:43:39 +01001#!/usr/bin/python
Michele Di Giorgio33f41fa2021-03-09 14:09:08 +00002# -*- coding: utf-8 -*-
3
Michalis Spyroua8caa022022-05-18 17:43:39 +01004# Copyright (c) 2017-2022 Arm Limited.
Moritz Pflanzerfc95ed22017-07-05 11:07:07 +01005#
6# SPDX-License-Identifier: MIT
7#
8# Permission is hereby granted, free of charge, to any person obtaining a copy
9# of this software and associated documentation files (the "Software"), to
10# deal in the Software without restriction, including without limitation the
11# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12# sell copies of the Software, and to permit persons to whom the Software is
13# furnished to do so, subject to the following conditions:
14#
15# The above copyright notice and this permission notice shall be included in all
16# copies or substantial portions of the Software.
17#
18# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24# SOFTWARE.
25import SCons
26import os.path
27
28Import('env')
29Import('vars')
30
31# vars is imported from arm_compute:
32variables = [
Michalis Spyroua3f7cd22022-07-04 15:32:02 +010033 BoolVariable("pmu", "Enable the PMU cycle counter to measure execution time in benchmark tests. (Your device needs to support it)", False),
34 BoolVariable("mali", "Enable the collection of Arm® Mali™ hardware counters to measure execution time in benchmark tests. (Your device needs to have a Arm® Mali™ driver that supports it)", False),
Moritz Pflanzerfc95ed22017-07-05 11:07:07 +010035]
36
37# We need a separate set of Variables for the Help message (Otherwise the global variables will get displayed twice)
38new_options = Variables('scons')
39
40for v in variables:
41 new_options.Add(v)
42 vars.Add(v)
43
44# Clone the environment to make sure we're not polluting the arm_compute one:
45framework_env = env.Clone()
46vars.Update(framework_env)
47
48Help(new_options.GenerateHelpText(framework_env))
49
Moritz Pflanzer47752c92017-07-18 13:38:47 +010050if(env['opencl']):
51 framework_env.Append(CPPDEFINES=['ARM_COMPUTE_CL'])
52
Moritz Pflanzerfc95ed22017-07-05 11:07:07 +010053framework_env.Append(CPPPATH = ["."])
54framework_env.Append(CPPFLAGS=['-Wno-overloaded-virtual'])
55
56files = Glob('*.cpp')
57files += Glob('command_line/*.cpp')
58files += Glob('printers/*.cpp')
59files += Glob('datasets/*.cpp')
60files += Glob('instruments/*.cpp')
61
62if not framework_env['pmu']:
63 # Remove PMU files
64 files = [f for f in files if "PMU" not in os.path.basename(str(f))]
65else:
66 framework_env.Append(CPPDEFINES = ['PMU_ENABLED'])
67
Anthony Barbiere8895f82017-11-23 16:58:52 +000068if not env['opencl']:
Anthony Barbier6e433492017-11-09 15:52:00 +000069 # Remove OpenCLTimer files
Anthony Barbier35aa6a32018-04-23 16:12:12 +010070 files = [f for f in files if "OpenCL" not in os.path.basename(str(f))]
Anthony Barbier6e433492017-11-09 15:52:00 +000071
Moritz Pflanzer45634b42017-08-30 12:48:18 +010072if not framework_env['mali']:
Michele Di Giorgio33f41fa2021-03-09 14:09:08 +000073 # Remove Arm® Mali™ files
Moritz Pflanzer45634b42017-08-30 12:48:18 +010074 files = [f for f in files if "MaliCounter" not in os.path.basename(str(f))]
75else:
76 framework_env.Append(CPPDEFINES = ['MALI_ENABLED'])
77
Moritz Pflanzerfc95ed22017-07-05 11:07:07 +010078arm_compute_test_framework = framework_env.StaticLibrary('arm_compute_test_framework', files)
79
80Default(arm_compute_test_framework)
81Export('arm_compute_test_framework')