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 = [ |
Moritz Pflanzer | 45634b4 | 2017-08-30 12:48:18 +0100 | [diff] [blame] | 30 | BoolVariable("pmu", "Enable PMU counters", False), |
Anthony Barbier | 6e43349 | 2017-11-09 15:52:00 +0000 | [diff] [blame] | 31 | BoolVariable("mali", "Enable Mali hardware counters", False), |
Moritz Pflanzer | fc95ed2 | 2017-07-05 11:07:07 +0100 | [diff] [blame] | 32 | ] |
| 33 | |
| 34 | # We need a separate set of Variables for the Help message (Otherwise the global variables will get displayed twice) |
| 35 | new_options = Variables('scons') |
| 36 | |
| 37 | for v in variables: |
| 38 | new_options.Add(v) |
| 39 | vars.Add(v) |
| 40 | |
| 41 | # Clone the environment to make sure we're not polluting the arm_compute one: |
| 42 | framework_env = env.Clone() |
| 43 | vars.Update(framework_env) |
| 44 | |
| 45 | Help(new_options.GenerateHelpText(framework_env)) |
| 46 | |
Moritz Pflanzer | 47752c9 | 2017-07-18 13:38:47 +0100 | [diff] [blame] | 47 | if(env['opencl']): |
| 48 | framework_env.Append(CPPDEFINES=['ARM_COMPUTE_CL']) |
| 49 | |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 50 | if(env['gles_compute']): |
| 51 | framework_env.Append(CPPDEFINES=['ARM_COMPUTE_GC']) |
| 52 | if env['os'] != 'android': |
| 53 | framework_env.Append(CPPPATH = ["#opengles-3.1/include", "#opengles-3.1/mali_include"]) |
| 54 | |
Moritz Pflanzer | fc95ed2 | 2017-07-05 11:07:07 +0100 | [diff] [blame] | 55 | framework_env.Append(CPPPATH = ["."]) |
| 56 | framework_env.Append(CPPFLAGS=['-Wno-overloaded-virtual']) |
| 57 | |
| 58 | files = Glob('*.cpp') |
| 59 | files += Glob('command_line/*.cpp') |
| 60 | files += Glob('printers/*.cpp') |
| 61 | files += Glob('datasets/*.cpp') |
| 62 | files += Glob('instruments/*.cpp') |
| 63 | |
| 64 | if not framework_env['pmu']: |
| 65 | # Remove PMU files |
| 66 | files = [f for f in files if "PMU" not in os.path.basename(str(f))] |
| 67 | else: |
| 68 | framework_env.Append(CPPDEFINES = ['PMU_ENABLED']) |
| 69 | |
Anthony Barbier | e8895f8 | 2017-11-23 16:58:52 +0000 | [diff] [blame] | 70 | if not env['opencl']: |
Anthony Barbier | 6e43349 | 2017-11-09 15:52:00 +0000 | [diff] [blame] | 71 | # Remove OpenCLTimer files |
| 72 | files = [f for f in files if "OpenCLTimer" not in os.path.basename(str(f))] |
Anthony Barbier | 6e43349 | 2017-11-09 15:52:00 +0000 | [diff] [blame] | 73 | |
Moritz Pflanzer | 45634b4 | 2017-08-30 12:48:18 +0100 | [diff] [blame] | 74 | if not framework_env['mali']: |
| 75 | # Remove MALI files |
| 76 | files = [f for f in files if "MaliCounter" not in os.path.basename(str(f))] |
| 77 | else: |
| 78 | framework_env.Append(CPPDEFINES = ['MALI_ENABLED']) |
| 79 | |
Moritz Pflanzer | fc95ed2 | 2017-07-05 11:07:07 +0100 | [diff] [blame] | 80 | arm_compute_test_framework = framework_env.StaticLibrary('arm_compute_test_framework', files) |
| 81 | |
| 82 | Default(arm_compute_test_framework) |
| 83 | Export('arm_compute_test_framework') |