Michele Di Giorgio | 33f41fa | 2021-03-09 14:09:08 +0000 | [diff] [blame^] | 1 | # -*- coding: utf-8 -*- |
| 2 | |
| 3 | # Copyright (c) 2017-2021 Arm Limited. |
Moritz Pflanzer | fc95ed2 | 2017-07-05 11:07:07 +0100 | [diff] [blame] | 4 | # |
| 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. |
| 24 | import SCons |
| 25 | import os.path |
| 26 | |
| 27 | Import('env') |
| 28 | Import('vars') |
| 29 | |
| 30 | # vars is imported from arm_compute: |
| 31 | variables = [ |
Moritz Pflanzer | 45634b4 | 2017-08-30 12:48:18 +0100 | [diff] [blame] | 32 | BoolVariable("pmu", "Enable PMU counters", False), |
Michele Di Giorgio | 33f41fa | 2021-03-09 14:09:08 +0000 | [diff] [blame^] | 33 | BoolVariable("mali", "Enable Arm® Mali™ hardware counters", False), |
Moritz Pflanzer | fc95ed2 | 2017-07-05 11:07:07 +0100 | [diff] [blame] | 34 | ] |
| 35 | |
| 36 | # We need a separate set of Variables for the Help message (Otherwise the global variables will get displayed twice) |
| 37 | new_options = Variables('scons') |
| 38 | |
| 39 | for 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: |
| 44 | framework_env = env.Clone() |
| 45 | vars.Update(framework_env) |
| 46 | |
| 47 | Help(new_options.GenerateHelpText(framework_env)) |
| 48 | |
Moritz Pflanzer | 47752c9 | 2017-07-18 13:38:47 +0100 | [diff] [blame] | 49 | if(env['opencl']): |
| 50 | framework_env.Append(CPPDEFINES=['ARM_COMPUTE_CL']) |
| 51 | |
Moritz Pflanzer | fc95ed2 | 2017-07-05 11:07:07 +0100 | [diff] [blame] | 52 | framework_env.Append(CPPPATH = ["."]) |
| 53 | framework_env.Append(CPPFLAGS=['-Wno-overloaded-virtual']) |
| 54 | |
| 55 | files = Glob('*.cpp') |
| 56 | files += Glob('command_line/*.cpp') |
| 57 | files += Glob('printers/*.cpp') |
| 58 | files += Glob('datasets/*.cpp') |
| 59 | files += Glob('instruments/*.cpp') |
| 60 | |
| 61 | if not framework_env['pmu']: |
| 62 | # Remove PMU files |
| 63 | files = [f for f in files if "PMU" not in os.path.basename(str(f))] |
| 64 | else: |
| 65 | framework_env.Append(CPPDEFINES = ['PMU_ENABLED']) |
| 66 | |
Anthony Barbier | e8895f8 | 2017-11-23 16:58:52 +0000 | [diff] [blame] | 67 | if not env['opencl']: |
Anthony Barbier | 6e43349 | 2017-11-09 15:52:00 +0000 | [diff] [blame] | 68 | # Remove OpenCLTimer files |
Anthony Barbier | 35aa6a3 | 2018-04-23 16:12:12 +0100 | [diff] [blame] | 69 | files = [f for f in files if "OpenCL" not in os.path.basename(str(f))] |
Anthony Barbier | 6e43349 | 2017-11-09 15:52:00 +0000 | [diff] [blame] | 70 | |
Moritz Pflanzer | 45634b4 | 2017-08-30 12:48:18 +0100 | [diff] [blame] | 71 | if not framework_env['mali']: |
Michele Di Giorgio | 33f41fa | 2021-03-09 14:09:08 +0000 | [diff] [blame^] | 72 | # Remove Arm® Mali™ files |
Moritz Pflanzer | 45634b4 | 2017-08-30 12:48:18 +0100 | [diff] [blame] | 73 | files = [f for f in files if "MaliCounter" not in os.path.basename(str(f))] |
| 74 | else: |
| 75 | framework_env.Append(CPPDEFINES = ['MALI_ENABLED']) |
| 76 | |
Moritz Pflanzer | fc95ed2 | 2017-07-05 11:07:07 +0100 | [diff] [blame] | 77 | arm_compute_test_framework = framework_env.StaticLibrary('arm_compute_test_framework', files) |
| 78 | |
| 79 | Default(arm_compute_test_framework) |
| 80 | Export('arm_compute_test_framework') |