1#!/usr/bin/python 2# -*- coding: utf-8 -*- 3 4# Copyright (c) 2017-2022 Arm Limited. 5# 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 = [ 33 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), 35] 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 50if(env['opencl']): 51 framework_env.Append(CPPDEFINES=['ARM_COMPUTE_CL']) 52 53framework_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 68if not env['opencl']: 69 # Remove OpenCLTimer files 70 files = [f for f in files if "OpenCL" not in os.path.basename(str(f))] 71 72if not framework_env['mali']: 73 # Remove Arm® Mali™ files 74 files = [f for f in files if "MaliCounter" not in os.path.basename(str(f))] 75else: 76 framework_env.Append(CPPDEFINES = ['MALI_ENABLED']) 77 78arm_compute_test_framework = framework_env.StaticLibrary('arm_compute_test_framework', files) 79 80Default(arm_compute_test_framework) 81Export('arm_compute_test_framework') 82