1*c217d954SCole Faust#!/usr/bin/python 2*c217d954SCole Faust# -*- coding: utf-8 -*- 3*c217d954SCole Faust 4*c217d954SCole Faust# Copyright (c) 2017-2022 Arm Limited. 5*c217d954SCole Faust# 6*c217d954SCole Faust# SPDX-License-Identifier: MIT 7*c217d954SCole Faust# 8*c217d954SCole Faust# Permission is hereby granted, free of charge, to any person obtaining a copy 9*c217d954SCole Faust# of this software and associated documentation files (the "Software"), to 10*c217d954SCole Faust# deal in the Software without restriction, including without limitation the 11*c217d954SCole Faust# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 12*c217d954SCole Faust# sell copies of the Software, and to permit persons to whom the Software is 13*c217d954SCole Faust# furnished to do so, subject to the following conditions: 14*c217d954SCole Faust# 15*c217d954SCole Faust# The above copyright notice and this permission notice shall be included in all 16*c217d954SCole Faust# copies or substantial portions of the Software. 17*c217d954SCole Faust# 18*c217d954SCole Faust# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19*c217d954SCole Faust# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20*c217d954SCole Faust# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21*c217d954SCole Faust# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22*c217d954SCole Faust# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23*c217d954SCole Faust# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24*c217d954SCole Faust# SOFTWARE. 25*c217d954SCole Faustimport SCons 26*c217d954SCole Faustimport os.path 27*c217d954SCole Faust 28*c217d954SCole FaustImport('env') 29*c217d954SCole FaustImport('vars') 30*c217d954SCole Faust 31*c217d954SCole Faust# vars is imported from arm_compute: 32*c217d954SCole Faustvariables = [ 33*c217d954SCole Faust BoolVariable("pmu", "Enable the PMU cycle counter to measure execution time in benchmark tests. (Your device needs to support it)", False), 34*c217d954SCole Faust 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*c217d954SCole Faust] 36*c217d954SCole Faust 37*c217d954SCole Faust# We need a separate set of Variables for the Help message (Otherwise the global variables will get displayed twice) 38*c217d954SCole Faustnew_options = Variables('scons') 39*c217d954SCole Faust 40*c217d954SCole Faustfor v in variables: 41*c217d954SCole Faust new_options.Add(v) 42*c217d954SCole Faust vars.Add(v) 43*c217d954SCole Faust 44*c217d954SCole Faust# Clone the environment to make sure we're not polluting the arm_compute one: 45*c217d954SCole Faustframework_env = env.Clone() 46*c217d954SCole Faustvars.Update(framework_env) 47*c217d954SCole Faust 48*c217d954SCole FaustHelp(new_options.GenerateHelpText(framework_env)) 49*c217d954SCole Faust 50*c217d954SCole Faustif(env['opencl']): 51*c217d954SCole Faust framework_env.Append(CPPDEFINES=['ARM_COMPUTE_CL']) 52*c217d954SCole Faust 53*c217d954SCole Faustframework_env.Append(CPPPATH = ["."]) 54*c217d954SCole Faustframework_env.Append(CPPFLAGS=['-Wno-overloaded-virtual']) 55*c217d954SCole Faust 56*c217d954SCole Faustfiles = Glob('*.cpp') 57*c217d954SCole Faustfiles += Glob('command_line/*.cpp') 58*c217d954SCole Faustfiles += Glob('printers/*.cpp') 59*c217d954SCole Faustfiles += Glob('datasets/*.cpp') 60*c217d954SCole Faustfiles += Glob('instruments/*.cpp') 61*c217d954SCole Faust 62*c217d954SCole Faustif not framework_env['pmu']: 63*c217d954SCole Faust # Remove PMU files 64*c217d954SCole Faust files = [f for f in files if "PMU" not in os.path.basename(str(f))] 65*c217d954SCole Faustelse: 66*c217d954SCole Faust framework_env.Append(CPPDEFINES = ['PMU_ENABLED']) 67*c217d954SCole Faust 68*c217d954SCole Faustif not env['opencl']: 69*c217d954SCole Faust # Remove OpenCLTimer files 70*c217d954SCole Faust files = [f for f in files if "OpenCL" not in os.path.basename(str(f))] 71*c217d954SCole Faust 72*c217d954SCole Faustif not framework_env['mali']: 73*c217d954SCole Faust # Remove Arm® Mali™ files 74*c217d954SCole Faust files = [f for f in files if "MaliCounter" not in os.path.basename(str(f))] 75*c217d954SCole Faustelse: 76*c217d954SCole Faust framework_env.Append(CPPDEFINES = ['MALI_ENABLED']) 77*c217d954SCole Faust 78*c217d954SCole Faustarm_compute_test_framework = framework_env.StaticLibrary('arm_compute_test_framework', files) 79*c217d954SCole Faust 80*c217d954SCole FaustDefault(arm_compute_test_framework) 81*c217d954SCole FaustExport('arm_compute_test_framework') 82