Moritz Pflanzer | fc95ed2 | 2017-07-05 11:07:07 +0100 | [diff] [blame] | 1 | # Copyright (c) 2017 ARM Limited. |
| 2 | # |
| 3 | # SPDX-License-Identifier: MIT |
| 4 | # |
| 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy |
| 6 | # of this software and associated documentation files (the "Software"), to |
| 7 | # deal in the Software without restriction, including without limitation the |
| 8 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 9 | # sell copies of the Software, and to permit persons to whom the Software is |
| 10 | # furnished to do so, subject to the following conditions: |
| 11 | # |
| 12 | # The above copyright notice and this permission notice shall be included in all |
| 13 | # copies or substantial portions of the Software. |
| 14 | # |
| 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 21 | # SOFTWARE. |
| 22 | import SCons |
| 23 | import os.path |
| 24 | |
| 25 | Import('env') |
| 26 | Import('vars') |
| 27 | |
| 28 | # vars is imported from arm_compute: |
| 29 | variables = [ |
| 30 | BoolVariable("pmu", "Enable PMU counters", False) |
| 31 | ] |
| 32 | |
| 33 | # We need a separate set of Variables for the Help message (Otherwise the global variables will get displayed twice) |
| 34 | new_options = Variables('scons') |
| 35 | |
| 36 | for v in variables: |
| 37 | new_options.Add(v) |
| 38 | vars.Add(v) |
| 39 | |
| 40 | # Clone the environment to make sure we're not polluting the arm_compute one: |
| 41 | framework_env = env.Clone() |
| 42 | vars.Update(framework_env) |
| 43 | |
| 44 | Help(new_options.GenerateHelpText(framework_env)) |
| 45 | |
| 46 | if env['os'] == 'android' and framework_env['pmu']: |
| 47 | print("pmu=1 is not supported for os=android") |
| 48 | Exit(1) |
| 49 | |
| 50 | framework_env.Append(CPPPATH = ["."]) |
| 51 | framework_env.Append(CPPFLAGS=['-Wno-overloaded-virtual']) |
| 52 | |
| 53 | files = Glob('*.cpp') |
| 54 | files += Glob('command_line/*.cpp') |
| 55 | files += Glob('printers/*.cpp') |
| 56 | files += Glob('datasets/*.cpp') |
| 57 | files += Glob('instruments/*.cpp') |
| 58 | |
| 59 | if not framework_env['pmu']: |
| 60 | # Remove PMU files |
| 61 | files = [f for f in files if "PMU" not in os.path.basename(str(f))] |
| 62 | else: |
| 63 | framework_env.Append(CPPDEFINES = ['PMU_ENABLED']) |
| 64 | |
| 65 | arm_compute_test_framework = framework_env.StaticLibrary('arm_compute_test_framework', files) |
| 66 | |
| 67 | Default(arm_compute_test_framework) |
| 68 | Export('arm_compute_test_framework') |