blob: c4fe50db05e6692684ed06990e844e11c21feca6 [file] [log] [blame]
Michele Di Giorgio33f41fa2021-03-09 14:09:08 +00001# -*- coding: utf-8 -*-
2
3# Copyright (c) 2017-2021 Arm Limited.
Moritz Pflanzerfc95ed22017-07-05 11:07:07 +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.
24import SCons
25import os.path
26
27Import('env')
28Import('vars')
29
30# vars is imported from arm_compute:
31variables = [
Moritz Pflanzer45634b42017-08-30 12:48:18 +010032 BoolVariable("pmu", "Enable PMU counters", False),
Michele Di Giorgio33f41fa2021-03-09 14:09:08 +000033 BoolVariable("mali", "Enable Arm® Mali™ hardware counters", False),
Moritz Pflanzerfc95ed22017-07-05 11:07:07 +010034]
35
36# We need a separate set of Variables for the Help message (Otherwise the global variables will get displayed twice)
37new_options = Variables('scons')
38
39for v in variables:
40 new_options.Add(v)
41 vars.Add(v)
42
43# Clone the environment to make sure we're not polluting the arm_compute one:
44framework_env = env.Clone()
45vars.Update(framework_env)
46
47Help(new_options.GenerateHelpText(framework_env))
48
Moritz Pflanzer47752c92017-07-18 13:38:47 +010049if(env['opencl']):
50 framework_env.Append(CPPDEFINES=['ARM_COMPUTE_CL'])
51
Moritz Pflanzerfc95ed22017-07-05 11:07:07 +010052framework_env.Append(CPPPATH = ["."])
53framework_env.Append(CPPFLAGS=['-Wno-overloaded-virtual'])
54
55files = Glob('*.cpp')
56files += Glob('command_line/*.cpp')
57files += Glob('printers/*.cpp')
58files += Glob('datasets/*.cpp')
59files += Glob('instruments/*.cpp')
60
61if not framework_env['pmu']:
62 # Remove PMU files
63 files = [f for f in files if "PMU" not in os.path.basename(str(f))]
64else:
65 framework_env.Append(CPPDEFINES = ['PMU_ENABLED'])
66
Anthony Barbiere8895f82017-11-23 16:58:52 +000067if not env['opencl']:
Anthony Barbier6e433492017-11-09 15:52:00 +000068 # Remove OpenCLTimer files
Anthony Barbier35aa6a32018-04-23 16:12:12 +010069 files = [f for f in files if "OpenCL" not in os.path.basename(str(f))]
Anthony Barbier6e433492017-11-09 15:52:00 +000070
Moritz Pflanzer45634b42017-08-30 12:48:18 +010071if not framework_env['mali']:
Michele Di Giorgio33f41fa2021-03-09 14:09:08 +000072 # Remove Arm® Mali™ files
Moritz Pflanzer45634b42017-08-30 12:48:18 +010073 files = [f for f in files if "MaliCounter" not in os.path.basename(str(f))]
74else:
75 framework_env.Append(CPPDEFINES = ['MALI_ENABLED'])
76
Moritz Pflanzerfc95ed22017-07-05 11:07:07 +010077arm_compute_test_framework = framework_env.StaticLibrary('arm_compute_test_framework', files)
78
79Default(arm_compute_test_framework)
80Export('arm_compute_test_framework')