Michele Di Giorgio | d9eaf61 | 2020-07-08 11:12:57 +0100 | [diff] [blame] | 1 | # Copyright (c) 2016, 2017 Arm Limited. |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 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 collections |
| 23 | import os.path |
| 24 | import re |
| 25 | import subprocess |
| 26 | |
| 27 | VERSION = "v0.0-unreleased" |
morgolock | 16846ab | 2020-11-19 15:27:30 +0000 | [diff] [blame] | 28 | LIBRARY_VERSION_MAJOR = 21 |
Sang-Hoon Park | 6d0b384 | 2020-08-14 14:48:08 +0100 | [diff] [blame] | 29 | LIBRARY_VERSION_MINOR = 0 |
Georgios Pinitas | 35fcc43 | 2020-03-26 18:47:46 +0000 | [diff] [blame] | 30 | LIBRARY_VERSION_PATCH = 0 |
| 31 | SONAME_VERSION = str(LIBRARY_VERSION_MAJOR) + "." + str(LIBRARY_VERSION_MINOR) + "." + str(LIBRARY_VERSION_PATCH) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 32 | |
| 33 | Import('env') |
| 34 | Import('vars') |
Anthony Barbier | 01bbd5f | 2018-11-01 15:10:51 +0000 | [diff] [blame] | 35 | Import('install_lib') |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 36 | |
Michalis Spyrou | 748a7c8 | 2019-10-07 13:00:44 +0100 | [diff] [blame] | 37 | def build_bootcode_objs(sources): |
| 38 | |
| 39 | arm_compute_env.Append(ASFLAGS = "-I bootcode/") |
| 40 | obj = arm_compute_env.Object(sources) |
| 41 | obj = install_lib(obj) |
| 42 | Default(obj) |
| 43 | return obj |
| 44 | |
Georgios Pinitas | 4d9687e | 2020-10-21 18:33:36 +0100 | [diff] [blame] | 45 | def build_library(name, build_env, sources, static=False, libs=[]): |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 46 | if static: |
Georgios Pinitas | 4d9687e | 2020-10-21 18:33:36 +0100 | [diff] [blame] | 47 | obj = build_env.StaticLibrary(name, source=sources, LIBS = arm_compute_env["LIBS"] + libs) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 48 | else: |
| 49 | if env['set_soname']: |
Georgios Pinitas | 4d9687e | 2020-10-21 18:33:36 +0100 | [diff] [blame] | 50 | obj = build_env.SharedLibrary(name, source=sources, SHLIBVERSION = SONAME_VERSION, LIBS = arm_compute_env["LIBS"] + libs) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 51 | else: |
Georgios Pinitas | 4d9687e | 2020-10-21 18:33:36 +0100 | [diff] [blame] | 52 | obj = build_env.SharedLibrary(name, source=sources, LIBS = arm_compute_env["LIBS"] + libs) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 53 | |
Anthony Barbier | 01bbd5f | 2018-11-01 15:10:51 +0000 | [diff] [blame] | 54 | obj = install_lib(obj) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 55 | Default(obj) |
| 56 | return obj |
| 57 | |
Georgios Pinitas | f605bd2 | 2020-11-26 11:55:09 +0000 | [diff] [blame] | 58 | def remove_incode_comments(code): |
| 59 | def replace_with_empty(match): |
| 60 | s = match.group(0) |
| 61 | if s.startswith('/'): |
| 62 | return " " |
| 63 | else: |
| 64 | return s |
| 65 | |
| 66 | comment_regex = re.compile(r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"', re.DOTALL | re.MULTILINE) |
| 67 | return re.sub(comment_regex, replace_with_empty, code) |
| 68 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 69 | def resolve_includes(target, source, env): |
| 70 | # File collection |
| 71 | FileEntry = collections.namedtuple('FileEntry', 'target_name file_contents') |
| 72 | |
| 73 | # Include pattern |
| 74 | pattern = re.compile("#include \"(.*)\"") |
| 75 | |
| 76 | # Get file contents |
| 77 | files = [] |
| 78 | for i in range(len(source)): |
| 79 | src = source[i] |
| 80 | dst = target[i] |
Georgios Pinitas | f605bd2 | 2020-11-26 11:55:09 +0000 | [diff] [blame] | 81 | contents = src.get_contents().decode('utf-8') |
| 82 | contents = remove_incode_comments(contents).splitlines() |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 83 | entry = FileEntry(target_name=dst, file_contents=contents) |
| 84 | files.append((os.path.basename(src.get_path()),entry)) |
| 85 | |
| 86 | # Create dictionary of tupled list |
| 87 | files_dict = dict(files) |
| 88 | |
| 89 | # Check for includes (can only be files in the same folder) |
| 90 | final_files = [] |
| 91 | for file in files: |
| 92 | done = False |
| 93 | tmp_file = file[1].file_contents |
| 94 | while not done: |
| 95 | file_count = 0 |
| 96 | updated_file = [] |
| 97 | for line in tmp_file: |
| 98 | found = pattern.search(line) |
| 99 | if found: |
| 100 | include_file = found.group(1) |
| 101 | data = files_dict[include_file].file_contents |
| 102 | updated_file.extend(data) |
| 103 | else: |
| 104 | updated_file.append(line) |
| 105 | file_count += 1 |
| 106 | |
| 107 | # Check if all include are replaced. |
| 108 | if file_count == len(tmp_file): |
| 109 | done = True |
| 110 | |
| 111 | # Update temp file |
| 112 | tmp_file = updated_file |
| 113 | |
| 114 | # Append and prepend string literal identifiers and add expanded file to final list |
| 115 | tmp_file.insert(0, "R\"(\n") |
| 116 | tmp_file.append("\n)\"") |
| 117 | entry = FileEntry(target_name=file[1].target_name, file_contents=tmp_file) |
| 118 | final_files.append((file[0], entry)) |
| 119 | |
| 120 | # Write output files |
| 121 | for file in final_files: |
| 122 | with open(file[1].target_name.get_path(), 'w+') as out_file: |
| 123 | out_file.write( "\n".join( file[1].file_contents )) |
| 124 | |
| 125 | def create_version_file(target, source, env): |
| 126 | # Generate string with build options library version to embed in the library: |
| 127 | try: |
| 128 | git_hash = subprocess.check_output(["git", "rev-parse", "HEAD"]) |
| 129 | except (OSError, subprocess.CalledProcessError): |
| 130 | git_hash="unknown" |
| 131 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 132 | build_info = "\"arm_compute_version=%s Build options: %s Git hash=%s\"" % (VERSION, vars.args, git_hash.strip()) |
| 133 | with open(target[0].get_path(), "w") as fd: |
| 134 | fd.write(build_info) |
| 135 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 136 | arm_compute_env = env.Clone() |
Anthony Barbier | 0e72c69 | 2018-08-24 11:22:08 +0100 | [diff] [blame] | 137 | version_file = arm_compute_env.Command("src/core/arm_compute_version.embed", "", action=create_version_file) |
| 138 | arm_compute_env.AlwaysBuild(version_file) |
Anthony Barbier | 6a3daf1 | 2018-02-19 17:24:27 +0000 | [diff] [blame] | 139 | |
Georgios Pinitas | 4d9687e | 2020-10-21 18:33:36 +0100 | [diff] [blame] | 140 | default_cpp_compiler = 'g++' if env['os'] != 'android' else 'clang++' |
| 141 | cpp_compiler = os.environ.get('CXX', default_cpp_compiler) |
| 142 | |
Anthony Barbier | 6a3daf1 | 2018-02-19 17:24:27 +0000 | [diff] [blame] | 143 | # Generate embed files |
Anthony Barbier | 0e72c69 | 2018-08-24 11:22:08 +0100 | [diff] [blame] | 144 | generate_embed = [ version_file ] |
Anthony Barbier | 6a3daf1 | 2018-02-19 17:24:27 +0000 | [diff] [blame] | 145 | if env['opencl'] and env['embed_kernels']: |
| 146 | cl_files = Glob('src/core/CL/cl_kernels/*.cl') |
| 147 | cl_files += Glob('src/core/CL/cl_kernels/*.h') |
| 148 | |
| 149 | embed_files = [ f.get_path()+"embed" for f in cl_files ] |
| 150 | arm_compute_env.Append(CPPPATH =[Dir("./src/core/CL/").path] ) |
| 151 | |
| 152 | generate_embed.append(arm_compute_env.Command(embed_files, cl_files, action=resolve_includes)) |
| 153 | |
| 154 | if env['gles_compute'] and env['embed_kernels']: |
| 155 | cs_files = Glob('src/core/GLES_COMPUTE/cs_shaders/*.cs') |
| 156 | cs_files += Glob('src/core/GLES_COMPUTE/cs_shaders/*.h') |
| 157 | |
| 158 | embed_files = [ f.get_path()+"embed" for f in cs_files ] |
| 159 | arm_compute_env.Append(CPPPATH =[Dir("./src/core/GLES_COMPUTE/").path] ) |
| 160 | |
| 161 | generate_embed.append(arm_compute_env.Command(embed_files, cs_files, action=resolve_includes)) |
| 162 | |
| 163 | Default(generate_embed) |
| 164 | if env["build"] == "embed_only": |
| 165 | Return() |
| 166 | |
Georgios Pinitas | 35fcc43 | 2020-03-26 18:47:46 +0000 | [diff] [blame] | 167 | # Append version defines for semantic versioning |
| 168 | arm_compute_env.Append(CPPDEFINES = [('ARM_COMPUTE_VERSION_MAJOR', LIBRARY_VERSION_MAJOR), |
| 169 | ('ARM_COMPUTE_VERSION_MINOR', LIBRARY_VERSION_MINOR), |
| 170 | ('ARM_COMPUTE_VERSION_PATCH', LIBRARY_VERSION_PATCH)]) |
| 171 | |
| 172 | |
Isabella Gottardi | b28f29d | 2017-11-09 17:05:07 +0000 | [diff] [blame] | 173 | # Don't allow undefined references in the libraries: |
Michalis Spyrou | 989f1b5 | 2018-01-23 16:47:45 +0000 | [diff] [blame] | 174 | arm_compute_env.Append(LINKFLAGS=['-Wl,--no-undefined']) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 175 | arm_compute_env.Append(CPPPATH =[Dir("./src/core/").path] ) |
| 176 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 177 | arm_compute_env.Append(LIBS = ['dl']) |
| 178 | |
| 179 | core_files = Glob('src/core/*.cpp') |
| 180 | core_files += Glob('src/core/CPP/*.cpp') |
| 181 | core_files += Glob('src/core/CPP/kernels/*.cpp') |
Sang-Hoon Park | 68dd25f | 2020-10-19 16:00:11 +0100 | [diff] [blame] | 182 | core_files += Glob('src/core/helpers/*.cpp') |
Sang-Hoon Park | 3687ee1 | 2020-06-24 13:34:04 +0100 | [diff] [blame] | 183 | core_files += Glob('src/core/utils/*.cpp') |
Michalis Spyrou | 7043d36 | 2018-12-03 13:58:32 +0000 | [diff] [blame] | 184 | core_files += Glob('src/core/utils/helpers/*.cpp') |
| 185 | core_files += Glob('src/core/utils/io/*.cpp') |
| 186 | core_files += Glob('src/core/utils/quantization/*.cpp') |
Georgios Pinitas | b8d5b95 | 2019-05-16 14:13:03 +0100 | [diff] [blame] | 187 | core_files += Glob('src/core/utils/misc/*.cpp') |
Michalis Spyrou | 7043d36 | 2018-12-03 13:58:32 +0000 | [diff] [blame] | 188 | if env["logging"]: |
| 189 | core_files += Glob('src/core/utils/logging/*.cpp') |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 190 | |
Anthony Barbier | 8e6faf1 | 2017-08-01 17:03:19 +0100 | [diff] [blame] | 191 | runtime_files = Glob('src/runtime/*.cpp') |
Georgios Pinitas | 8795ffb | 2017-12-01 16:13:40 +0000 | [diff] [blame] | 192 | runtime_files += Glob('src/runtime/CPP/ICPPSimpleFunction.cpp') |
| 193 | runtime_files += Glob('src/runtime/CPP/functions/*.cpp') |
| 194 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 195 | # CLHarrisCorners uses the Scheduler to run CPP kernels |
Anthony Barbier | 8e6faf1 | 2017-08-01 17:03:19 +0100 | [diff] [blame] | 196 | runtime_files += Glob('src/runtime/CPP/SingleThreadScheduler.cpp') |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 197 | |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 198 | graph_files = Glob('src/graph/*.cpp') |
| 199 | graph_files += Glob('src/graph/*/*.cpp') |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 200 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 201 | if env['cppthreads']: |
Anthony Barbier | 8e6faf1 | 2017-08-01 17:03:19 +0100 | [diff] [blame] | 202 | runtime_files += Glob('src/runtime/CPP/CPPScheduler.cpp') |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 203 | |
| 204 | if env['openmp']: |
Anthony Barbier | 8e6faf1 | 2017-08-01 17:03:19 +0100 | [diff] [blame] | 205 | runtime_files += Glob('src/runtime/OMP/OMPScheduler.cpp') |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 206 | |
| 207 | if env['opencl']: |
| 208 | core_files += Glob('src/core/CL/*.cpp') |
| 209 | core_files += Glob('src/core/CL/kernels/*.cpp') |
Gian Marco Iodice | 926afe1 | 2019-03-19 11:44:13 +0000 | [diff] [blame] | 210 | core_files += Glob('src/core/CL/gemm/*.cpp') |
Gian Marco Iodice | 06be6f8 | 2019-06-24 17:47:51 +0100 | [diff] [blame] | 211 | core_files += Glob('src/core/CL/gemm/native/*.cpp') |
Gian Marco Iodice | 926afe1 | 2019-03-19 11:44:13 +0000 | [diff] [blame] | 212 | core_files += Glob('src/core/CL/gemm/reshaped/*.cpp') |
| 213 | core_files += Glob('src/core/CL/gemm/reshaped_only_rhs/*.cpp') |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 214 | |
Anthony Barbier | 8e6faf1 | 2017-08-01 17:03:19 +0100 | [diff] [blame] | 215 | runtime_files += Glob('src/runtime/CL/*.cpp') |
| 216 | runtime_files += Glob('src/runtime/CL/functions/*.cpp') |
Gian Marco Iodice | 5a4fe19 | 2020-03-16 12:22:37 +0000 | [diff] [blame] | 217 | runtime_files += Glob('src/runtime/CL/gemm/*.cpp') |
Georgios Pinitas | c0d1c86 | 2018-03-23 15:13:15 +0000 | [diff] [blame] | 218 | runtime_files += Glob('src/runtime/CL/tuners/*.cpp') |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 219 | |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 220 | graph_files += Glob('src/graph/backends/CL/*.cpp') |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 221 | |
| 222 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 223 | if env['neon']: |
| 224 | core_files += Glob('src/core/NEON/*.cpp') |
| 225 | core_files += Glob('src/core/NEON/kernels/*.cpp') |
Anthony Barbier | c8e84b5 | 2018-07-17 16:48:42 +0100 | [diff] [blame] | 226 | core_files += Glob('src/core/NEON/kernels/assembly/*.cpp') |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 227 | |
Pablo Tello | eb82fd2 | 2018-02-23 13:43:50 +0000 | [diff] [blame] | 228 | core_files += Glob('src/core/NEON/kernels/arm_gemm/*.cpp') |
| 229 | |
Georgios Pinitas | 30271c7 | 2019-06-24 14:56:34 +0100 | [diff] [blame] | 230 | # build winograd/depthwise sources for either v7a / v8a |
Georgios Pinitas | 4074c99 | 2018-01-30 18:13:46 +0000 | [diff] [blame] | 231 | core_files += Glob('src/core/NEON/kernels/convolution/*/*.cpp') |
| 232 | core_files += Glob('src/core/NEON/kernels/convolution/winograd/*/*.cpp') |
Sang-Hoon Park | 68dd25f | 2020-10-19 16:00:11 +0100 | [diff] [blame] | 233 | arm_compute_env.Append(CPPPATH = ["src/core/NEON/kernels/convolution/common/", |
Michele Di Giorgio | 6ad60af | 2020-06-09 14:52:15 +0100 | [diff] [blame] | 234 | "src/core/NEON/kernels/convolution/winograd/", |
Sang-Hoon Park | 68dd25f | 2020-10-19 16:00:11 +0100 | [diff] [blame] | 235 | "src/core/NEON/kernels/convolution/depthwise/", |
| 236 | "src/core/NEON/kernels/assembly/", |
Georgios Pinitas | 30271c7 | 2019-06-24 14:56:34 +0100 | [diff] [blame] | 237 | "arm_compute/core/NEON/kernels/assembly/"]) |
Pablo Tello | 9ceebbe | 2018-01-10 16:44:13 +0000 | [diff] [blame] | 238 | |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 239 | graph_files += Glob('src/graph/backends/NEON/*.cpp') |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 240 | |
Georgios Pinitas | f2cdce3 | 2019-12-09 18:35:57 +0000 | [diff] [blame] | 241 | if env['estate'] == '32': |
Pablo Tello | eb82fd2 | 2018-02-23 13:43:50 +0000 | [diff] [blame] | 242 | core_files += Glob('src/core/NEON/kernels/arm_gemm/kernels/a32_*/*.cpp') |
| 243 | |
Georgios Pinitas | f2cdce3 | 2019-12-09 18:35:57 +0000 | [diff] [blame] | 244 | if env['estate'] == '64': |
Pablo Tello | eb82fd2 | 2018-02-23 13:43:50 +0000 | [diff] [blame] | 245 | core_files += Glob('src/core/NEON/kernels/arm_gemm/kernels/a64_*/*.cpp') |
Georgios Pinitas | 421405b | 2018-10-26 19:05:32 +0100 | [diff] [blame] | 246 | if "sve" in env['arch']: |
| 247 | core_files += Glob('src/core/NEON/kernels/arm_gemm/kernels/sve_*/*.cpp') |
Moritz Pflanzer | beabe3b | 2017-08-31 14:56:32 +0100 | [diff] [blame] | 248 | |
Georgios Pinitas | ff4fca0 | 2020-10-02 21:00:00 +0100 | [diff] [blame] | 249 | if any(i in env['data_type_support'] for i in ['all', 'fp16']): |
Michalis Spyrou | aa51a5b | 2020-11-22 00:49:42 +0000 | [diff] [blame] | 250 | core_files += Glob('src/core/NEON/kernels/*/impl/*/fp16.cpp') |
Georgios Pinitas | ff4fca0 | 2020-10-02 21:00:00 +0100 | [diff] [blame] | 251 | if any(i in env['data_type_support'] for i in ['all', 'fp32']): |
Michalis Spyrou | aa51a5b | 2020-11-22 00:49:42 +0000 | [diff] [blame] | 252 | core_files += Glob('src/core/NEON/kernels/*/impl/*/fp32.cpp') |
Michalis Spyrou | c4d4555 | 2020-10-19 12:41:30 +0100 | [diff] [blame] | 253 | if any(i in env['data_type_support'] for i in ['all', 'qasymm8']): |
Michalis Spyrou | aa51a5b | 2020-11-22 00:49:42 +0000 | [diff] [blame] | 254 | core_files += Glob('src/core/NEON/kernels/*/impl/*/qasymm8.cpp') |
Michalis Spyrou | c4d4555 | 2020-10-19 12:41:30 +0100 | [diff] [blame] | 255 | if any(i in env['data_type_support'] for i in ['all', 'qasymm8_signed']): |
Michalis Spyrou | aa51a5b | 2020-11-22 00:49:42 +0000 | [diff] [blame] | 256 | core_files += Glob('src/core/NEON/kernels/*/impl/*/qasymm8_signed.cpp') |
Michalis Spyrou | c4d4555 | 2020-10-19 12:41:30 +0100 | [diff] [blame] | 257 | if any(i in env['data_type_support'] for i in ['all', 'qsymm16']): |
Michalis Spyrou | aa51a5b | 2020-11-22 00:49:42 +0000 | [diff] [blame] | 258 | core_files += Glob('src/core/NEON/kernels/*/impl/*/qsymm16.cpp') |
Michalis Spyrou | a3c9a3b | 2020-12-08 21:02:16 +0000 | [diff] [blame] | 259 | if any(i in env['data_type_support'] for i in ['all', 'integer']): |
| 260 | core_files += Glob('src/core/NEON/kernels/*/impl/*/integer.cpp') |
Georgios Pinitas | ff4fca0 | 2020-10-02 21:00:00 +0100 | [diff] [blame] | 261 | |
Anthony Barbier | 8e6faf1 | 2017-08-01 17:03:19 +0100 | [diff] [blame] | 262 | runtime_files += Glob('src/runtime/NEON/*.cpp') |
| 263 | runtime_files += Glob('src/runtime/NEON/functions/*.cpp') |
Anthony Barbier | c8e84b5 | 2018-07-17 16:48:42 +0100 | [diff] [blame] | 264 | runtime_files += Glob('src/runtime/NEON/functions/assembly/*.cpp') |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 265 | |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 266 | if env['gles_compute']: |
| 267 | if env['os'] != 'android': |
| 268 | arm_compute_env.Append(CPPPATH = ["#opengles-3.1/include", "#opengles-3.1/mali_include"]) |
| 269 | |
| 270 | core_files += Glob('src/core/GLES_COMPUTE/*.cpp') |
| 271 | core_files += Glob('src/core/GLES_COMPUTE/kernels/*.cpp') |
| 272 | |
| 273 | runtime_files += Glob('src/runtime/GLES_COMPUTE/*.cpp') |
| 274 | runtime_files += Glob('src/runtime/GLES_COMPUTE/functions/*.cpp') |
| 275 | |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 276 | graph_files += Glob('src/graph/backends/GLES/*.cpp') |
Anthony Barbier | b467021 | 2018-05-18 16:55:39 +0100 | [diff] [blame] | 277 | if env['tracing']: |
| 278 | arm_compute_env.Append(CPPDEFINES = ['ARM_COMPUTE_TRACING_ENABLED']) |
| 279 | else: |
| 280 | # Remove TracePoint files if tracing is disabled: |
| 281 | core_files = [ f for f in core_files if not "TracePoint" in str(f)] |
| 282 | runtime_files = [ f for f in runtime_files if not "TracePoint" in str(f)] |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 283 | |
Michalis Spyrou | 748a7c8 | 2019-10-07 13:00:44 +0100 | [diff] [blame] | 284 | bootcode_o = [] |
| 285 | if env['os'] == 'bare_metal': |
| 286 | bootcode_files = Glob('bootcode/*.s') |
| 287 | bootcode_o = build_bootcode_objs(bootcode_files) |
| 288 | Export('bootcode_o') |
| 289 | |
Georgios Pinitas | 4d9687e | 2020-10-21 18:33:36 +0100 | [diff] [blame] | 290 | arm_compute_core_a = build_library('arm_compute_core-static', arm_compute_env, core_files, static=True) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 291 | Export('arm_compute_core_a') |
| 292 | |
Pablo Tello | c6cb35a | 2017-06-21 15:39:47 +0100 | [diff] [blame] | 293 | if env['os'] != 'bare_metal' and not env['standalone']: |
Georgios Pinitas | 4d9687e | 2020-10-21 18:33:36 +0100 | [diff] [blame] | 294 | arm_compute_core_so = build_library('arm_compute_core', arm_compute_env, core_files, static=False) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 295 | Export('arm_compute_core_so') |
| 296 | |
Georgios Pinitas | 4d9687e | 2020-10-21 18:33:36 +0100 | [diff] [blame] | 297 | arm_compute_a = build_library('arm_compute-static', arm_compute_env, runtime_files, static=True, libs = [ arm_compute_core_a ]) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 298 | Export('arm_compute_a') |
| 299 | |
Pablo Tello | c6cb35a | 2017-06-21 15:39:47 +0100 | [diff] [blame] | 300 | if env['os'] != 'bare_metal' and not env['standalone']: |
Georgios Pinitas | 4d9687e | 2020-10-21 18:33:36 +0100 | [diff] [blame] | 301 | arm_compute_so = build_library('arm_compute', arm_compute_env, runtime_files, static=False, libs = [ "arm_compute_core" ]) |
Anthony Barbier | b2881fc | 2017-09-29 17:12:12 +0100 | [diff] [blame] | 302 | Depends(arm_compute_so, arm_compute_core_so) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 303 | Export('arm_compute_so') |
| 304 | |
Georgios Pinitas | 4d9687e | 2020-10-21 18:33:36 +0100 | [diff] [blame] | 305 | arm_compute_graph_env = arm_compute_env.Clone(); |
| 306 | if 'clang++' in cpp_compiler: |
| 307 | arm_compute_graph_env.Append(CXXFLAGS = ['-Wno-pessimizing-move']) |
| 308 | arm_compute_graph_a = build_library('arm_compute_graph-static', arm_compute_graph_env, graph_files, static=True, libs = [ arm_compute_a]) |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 309 | Export('arm_compute_graph_a') |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 310 | |
| 311 | if env['os'] != 'bare_metal' and not env['standalone']: |
Georgios Pinitas | 4d9687e | 2020-10-21 18:33:36 +0100 | [diff] [blame] | 312 | arm_compute_graph_so = build_library('arm_compute_graph', arm_compute_graph_env, graph_files, static=False, libs = [ "arm_compute" , "arm_compute_core"]) |
Georgios Pinitas | 9873ea3 | 2017-12-05 15:28:55 +0000 | [diff] [blame] | 313 | Depends(arm_compute_graph_so, arm_compute_so) |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 314 | Export('arm_compute_graph_so') |
| 315 | |
Pablo Tello | c6cb35a | 2017-06-21 15:39:47 +0100 | [diff] [blame] | 316 | if env['standalone']: |
| 317 | alias = arm_compute_env.Alias("arm_compute", [arm_compute_a]) |
| 318 | else: |
| 319 | alias = arm_compute_env.Alias("arm_compute", [arm_compute_a, arm_compute_so]) |
| 320 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 321 | Default(alias) |
| 322 | |
Pablo Tello | c6cb35a | 2017-06-21 15:39:47 +0100 | [diff] [blame] | 323 | if env['standalone']: |
| 324 | Depends([alias,arm_compute_core_a], generate_embed) |
| 325 | else: |
| 326 | Depends([alias,arm_compute_core_so, arm_compute_core_a], generate_embed) |