blob: ac383e68d1c26d6403e2ac846039d44b4f501400 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001# Copyright (c) 2016, 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
23import SCons
24import os
25import subprocess
26
27def version_at_least(version, required):
28 end = min(len(version), len(required))
29
30 for i in range(0, end, 2):
31 if int(version[i]) < int(required[i]):
32 return False
33 elif int(version[i]) > int(required[i]):
34 return True
35
36 return True
37
38vars = Variables("scons")
39vars.AddVariables(
40 BoolVariable("debug", "Debug", False),
41 BoolVariable("asserts", "Enable asserts (this flag is forced to 1 for debug=1)", False),
Georgios Pinitas3faea252017-10-30 14:13:50 +000042 BoolVariable("logging", "Logging (this flag is forced to 1 for debug=1)", False),
Georgios Pinitas421405b2018-10-26 19:05:32 +010043 EnumVariable("arch", "Target Architecture", "armv7a", allowed_values=("armv7a", "arm64-v8a", "arm64-v8.2-a", "arm64-v8.2-a-sve", "x86_32", "x86_64")),
Anthony Barbier6ff3b192017-09-04 18:44:23 +010044 EnumVariable("os", "Target OS", "linux", allowed_values=("linux", "android", "bare_metal")),
Anthony Barbier6a3daf12018-02-19 17:24:27 +000045 EnumVariable("build", "Build type", "cross_compile", allowed_values=("native", "cross_compile", "embed_only")),
Anthony Barbier6ff3b192017-09-04 18:44:23 +010046 BoolVariable("examples", "Build example programs", True),
47 BoolVariable("Werror", "Enable/disable the -Werror compilation flag", True),
Pablo Telloc6cb35a2017-06-21 15:39:47 +010048 BoolVariable("standalone", "Builds the tests as standalone executables, links statically with libgcc, libstdc++ and libarm_compute", False),
Anthony Barbier6ff3b192017-09-04 18:44:23 +010049 BoolVariable("opencl", "Enable OpenCL support", True),
50 BoolVariable("neon", "Enable Neon support", False),
Anthony Barbier7068f992017-10-26 15:23:08 +010051 BoolVariable("gles_compute", "Enable OpenGL ES Compute Shader support", False),
Anthony Barbiercc0a80b2017-12-15 11:37:29 +000052 BoolVariable("embed_kernels", "Embed OpenCL kernels and OpenGL ES compute shaders in library binary", True),
Anthony Barbier6ff3b192017-09-04 18:44:23 +010053 BoolVariable("set_soname", "Set the library's soname and shlibversion (requires SCons 2.4 or above)", False),
54 BoolVariable("openmp", "Enable OpenMP backend", False),
55 BoolVariable("cppthreads", "Enable C++11 threads backend", True),
56 PathVariable("build_dir", "Specify sub-folder for the build", ".", PathVariable.PathAccept),
Anthony Barbier01bbd5f2018-11-01 15:10:51 +000057 PathVariable("install_dir", "Specify sub-folder for the install", "", PathVariable.PathAccept),
Michalis Spyrou323ce0f2018-11-30 16:30:43 +000058 BoolVariable("exceptions", "Enable/disable C++ exception support", True),
Anthony Barbier149de5b2018-12-06 10:27:37 +000059 ("toolchain_prefix", "Override the toolchain prefix", ""),
Anthony Barbier7390e052018-03-13 09:29:41 +000060 ("extra_cxx_flags", "Extra CXX flags to be appended to the build command", ""),
Georgios Pinitas421405b2018-10-26 19:05:32 +010061 ("extra_link_flags", "Extra LD flags to be appended to the build command", ""),
Anthony Barbier7390e052018-03-13 09:29:41 +000062 ("compiler_cache", "Command to prefix to the C and C++ compiler (e.g ccache)", "")
Anthony Barbier6ff3b192017-09-04 18:44:23 +010063)
64
65env = Environment(platform="posix", variables=vars, ENV = os.environ)
Anthony Barbiere8a55df2018-10-26 09:05:01 +010066build_path = env['build_dir']
67# If build_dir is a relative path then add a #build/ prefix:
68if not env['build_dir'].startswith('/'):
69 SConsignFile('build/%s/.scons' % build_path)
70 build_path = "#build/%s" % build_path
71else:
72 SConsignFile('%s/.scons' % build_path)
73
Anthony Barbier01bbd5f2018-11-01 15:10:51 +000074install_path = env['install_dir']
75#If the install_dir is a relative path then assume it's from inside build_dir
76if not env['install_dir'].startswith('/') and install_path != "":
77 install_path = "%s/%s" % (build_path, install_path)
78
Anthony Barbiere8a55df2018-10-26 09:05:01 +010079env.Append(LIBPATH = [build_path])
Anthony Barbier6a3daf12018-02-19 17:24:27 +000080Export('env')
81Export('vars')
Anthony Barbier6ff3b192017-09-04 18:44:23 +010082
Anthony Barbier01bbd5f2018-11-01 15:10:51 +000083def install_lib( lib ):
84 # If there is no install folder, then there is nothing to do:
85 if install_path == "":
86 return lib
87 return env.Install( "%s/lib/" % install_path, lib)
88def install_bin( bin ):
89 # If there is no install folder, then there is nothing to do:
90 if install_path == "":
91 return bin
92 return env.Install( "%s/bin/" % install_path, bin)
93def install_include( inc ):
94 if install_path == "":
95 return inc
96 return env.Install( "%s/include/" % install_path, inc)
97
98Export('install_lib')
99Export('install_bin')
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100100
101Help(vars.GenerateHelpText(env))
102
Anthony Barbier6a3daf12018-02-19 17:24:27 +0000103if env['build'] == "embed_only":
Anthony Barbiere8a55df2018-10-26 09:05:01 +0100104 SConscript('./SConscript', variant_dir=build_path, duplicate=0)
Anthony Barbier6a3daf12018-02-19 17:24:27 +0000105 Return()
106
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100107if env['neon'] and 'x86' in env['arch']:
ggardet767c9f72018-06-29 17:01:01 +0200108 print("Cannot compile NEON for x86")
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100109 Exit(1)
110
111if env['set_soname'] and not version_at_least(SCons.__version__, "2.4"):
ggardet767c9f72018-06-29 17:01:01 +0200112 print("Setting the library's SONAME / SHLIBVERSION requires SCons 2.4 or above")
113 print("Update your version of SCons or use set_soname=0")
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100114 Exit(1)
115
116if env['os'] == 'bare_metal':
117 if env['cppthreads'] or env['openmp']:
118 print("ERROR: OpenMP and C++11 threads not supported in bare_metal. Use cppthreads=0 openmp=0")
119 Exit(1)
120
Michalis Spyrou323ce0f2018-11-30 16:30:43 +0000121if not env['exceptions']:
122 if env['opencl'] or env['gles_compute']:
123 print("ERROR: OpenCL and GLES are not supported when building without exceptions. Use opencl=0 gles_compute=0")
124 Exit(1)
125
126 env.Append(CPPDEFINES = ['ARM_COMPUTE_EXCEPTIONS_DISABLED'])
127 env.Append(CXXFLAGS = ['-fno-exceptions'])
128
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100129env.Append(CXXFLAGS = ['-Wno-deprecated-declarations','-Wall','-DARCH_ARM',
130 '-Wextra','-Wno-unused-parameter','-pedantic','-Wdisabled-optimization','-Wformat=2',
131 '-Winit-self','-Wstrict-overflow=2','-Wswitch-default',
132 '-fpermissive','-std=gnu++11','-Wno-vla','-Woverloaded-virtual',
Anthony Barbier95008d82018-07-02 09:27:20 +0100133 '-Wctor-dtor-privacy','-Wsign-promo','-Weffc++','-Wno-format-nonliteral','-Wno-overlength-strings','-Wno-strict-overflow'])
Isabella Gottardib28f29d2017-11-09 17:05:07 +0000134
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100135env.Append(CPPDEFINES = ['_GLIBCXX_USE_NANOSLEEP'])
136
Anthony Barbiera026e982018-01-18 10:57:52 +0000137default_cpp_compiler = 'g++' if env['os'] != 'android' else 'clang++'
138default_c_compiler = 'gcc' if env['os'] != 'android' else 'clang'
139cpp_compiler = os.environ.get('CXX', default_cpp_compiler)
140c_compiler = os.environ.get('CC', default_c_compiler)
141
Anthony Barbierdd669372018-03-01 17:08:54 +0000142if env['os'] == 'android' and ( 'clang++' not in cpp_compiler or 'clang' not in c_compiler ):
ggardet767c9f72018-06-29 17:01:01 +0200143 print( "WARNING: Only clang is officially supported to build the Compute Library for Android")
Anthony Barbiera026e982018-01-18 10:57:52 +0000144
Anthony Barbierdd669372018-03-01 17:08:54 +0000145if 'clang++' in cpp_compiler:
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100146 env.Append(CXXFLAGS = ['-Wno-format-nonliteral','-Wno-deprecated-increment-bool','-Wno-vla-extension','-Wno-mismatched-tags'])
147else:
Georgios Pinitas72593c72018-07-03 11:33:41 +0100148 env.Append(CXXFLAGS = ['-Wlogical-op','-Wnoexcept','-Wstrict-null-sentinel','-Wno-implicit-fallthrough'])
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100149
150if env['cppthreads']:
151 env.Append(CPPDEFINES = [('ARM_COMPUTE_CPP_SCHEDULER', 1)])
152
153if env['openmp']:
Anthony Barbierdd669372018-03-01 17:08:54 +0000154 if 'clang++' in cpp_compiler:
ggardet767c9f72018-06-29 17:01:01 +0200155 print( "Clang does not support OpenMP. Use scheduler=cpp.")
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100156 Exit(1)
157
158 env.Append(CPPDEFINES = [('ARM_COMPUTE_OPENMP_SCHEDULER', 1)])
159 env.Append(CXXFLAGS = ['-fopenmp'])
160 env.Append(LINKFLAGS = ['-fopenmp'])
161
162prefix = ""
163if env['arch'] == 'armv7a':
164 env.Append(CXXFLAGS = ['-march=armv7-a', '-mthumb', '-mfpu=neon'])
165
Michalis Spyrou07781ac2017-08-31 15:11:41 +0100166 if env['os'] == 'linux':
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100167 prefix = "arm-linux-gnueabihf-"
168 env.Append(CXXFLAGS = ['-mfloat-abi=hard'])
Michalis Spyrou07781ac2017-08-31 15:11:41 +0100169 elif env['os'] == 'bare_metal':
Michalis Spyrou6e52ba32017-10-04 15:40:38 +0100170 prefix = "arm-eabi-"
Michalis Spyrou07781ac2017-08-31 15:11:41 +0100171 env.Append(CXXFLAGS = ['-mfloat-abi=hard'])
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100172 elif env['os'] == 'android':
173 prefix = "arm-linux-androideabi-"
174 env.Append(CXXFLAGS = ['-mfloat-abi=softfp'])
175elif env['arch'] == 'arm64-v8a':
176 env.Append(CXXFLAGS = ['-march=armv8-a'])
Pablo Telloeb82fd22018-02-23 13:43:50 +0000177 env.Append(CPPDEFINES = ['ARM_COMPUTE_AARCH64_V8A','NO_DOT_IN_TOOLCHAIN'])
Michalis Spyrou07781ac2017-08-31 15:11:41 +0100178 if env['os'] == 'linux':
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100179 prefix = "aarch64-linux-gnu-"
Michalis Spyrou07781ac2017-08-31 15:11:41 +0100180 elif env['os'] == 'bare_metal':
Michalis Spyrou6e52ba32017-10-04 15:40:38 +0100181 prefix = "aarch64-elf-"
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100182 elif env['os'] == 'android':
183 prefix = "aarch64-linux-android-"
Anthony Barbier2539dd22018-03-15 14:16:52 +0000184 if 'clang++' in cpp_compiler:
Pablo Telloeb82fd22018-02-23 13:43:50 +0000185 env.Append(CXXFLAGS = ['-no-integrated-as'])
Georgios Pinitas421405b2018-10-26 19:05:32 +0100186elif 'arm64-v8.2-a' in env['arch']:
187 if env['arch'] == 'arm64-v8.2-a-sve':
188 if env['os'] != 'bare_metal':
189 print("Only bare metal SVE is supported at the moment")
190 Exit(1)
191 env.Append(CXXFLAGS = ['-march=armv8.2-a+sve+fp16+dotprod'])
192 else:
193 env.Append(CXXFLAGS = ['-march=armv8.2-a+fp16']) # explicitly enable fp16 extension otherwise __ARM_FEATURE_FP16_VECTOR_ARITHMETIC is undefined
194 if env['os'] == 'linux':
195 prefix = "aarch64-linux-gnu-"
196 elif env['os'] == 'bare_metal':
197 prefix = "aarch64-elf-"
198 elif env['os'] == 'android':
199 prefix = "aarch64-linux-android-"
Pablo Telloeb82fd22018-02-23 13:43:50 +0000200 env.Append(CPPDEFINES = ['ARM_COMPUTE_AARCH64_V8_2','NO_DOT_IN_TOOLCHAIN'])
Anthony Barbierdd669372018-03-01 17:08:54 +0000201 if 'clang++' in cpp_compiler:
Anthony Barbier2539dd22018-03-15 14:16:52 +0000202 env.Append(CXXFLAGS = ['-no-integrated-as'])
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100203elif env['arch'] == 'x86_32':
204 env.Append(CCFLAGS = ['-m32'])
205 env.Append(LINKFLAGS = ['-m32'])
206elif env['arch'] == 'x86_64':
Michalis Spyrou3814b302019-03-14 16:51:31 +0000207 env.Append(CXXFLAGS = ['-fPIC'])
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100208 env.Append(CCFLAGS = ['-m64'])
209 env.Append(LINKFLAGS = ['-m64'])
210
211if env['build'] == 'native':
212 prefix = ""
213
Anthony Barbier149de5b2018-12-06 10:27:37 +0000214if env["toolchain_prefix"] != "":
215 prefix = env["toolchain_prefix"]
216
Anthony Barbier7390e052018-03-13 09:29:41 +0000217env['CC'] = env['compiler_cache']+" "+prefix + c_compiler
218env['CXX'] = env['compiler_cache']+" "+prefix + cpp_compiler
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100219env['LD'] = prefix + "ld"
220env['AS'] = prefix + "as"
221env['AR'] = prefix + "ar"
222env['RANLIB'] = prefix + "ranlib"
223
224if not GetOption("help"):
225 try:
Anthony Barbier907dba82017-08-25 10:11:39 +0100226 compiler_ver = subprocess.check_output(env['CXX'].split() + ["-dumpversion"]).strip()
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100227 except OSError:
228 print("ERROR: Compiler '%s' not found" % env['CXX'])
229 Exit(1)
230
Anthony Barbierdd669372018-03-01 17:08:54 +0000231 if 'clang++' not in cpp_compiler:
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100232 if env['arch'] == 'arm64-v8.2-a' and not version_at_least(compiler_ver, '6.2.1'):
ggardet767c9f72018-06-29 17:01:01 +0200233 print("GCC 6.2.1 or newer is required to compile armv8.2-a code")
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100234 Exit(1)
235 elif env['arch'] == 'arm64-v8a' and not version_at_least(compiler_ver, '4.9'):
ggardet767c9f72018-06-29 17:01:01 +0200236 print("GCC 4.9 or newer is required to compile NEON code for AArch64")
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100237 Exit(1)
238
239 if version_at_least(compiler_ver, '6.1'):
240 env.Append(CXXFLAGS = ['-Wno-ignored-attributes'])
241
242 if compiler_ver == '4.8.3':
243 env.Append(CXXFLAGS = ['-Wno-array-bounds'])
244
Pablo Telloc6cb35a2017-06-21 15:39:47 +0100245if env['standalone']:
246 env.Append(CXXFLAGS = ['-fPIC'])
Anthony Barbier665c89b2018-07-16 11:40:09 +0100247 env.Append(LINKFLAGS = ['-static-libgcc','-static-libstdc++'])
Pablo Telloc6cb35a2017-06-21 15:39:47 +0100248
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100249if env['Werror']:
250 env.Append(CXXFLAGS = ['-Werror'])
251
252if env['os'] == 'android':
253 env.Append(CPPDEFINES = ['ANDROID'])
Anthony Barbier665c89b2018-07-16 11:40:09 +0100254 env.Append(LINKFLAGS = ['-pie', '-static-libstdc++'])
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100255elif env['os'] == 'bare_metal':
256 env.Append(LINKFLAGS = ['-static'])
Michalis Spyrou07781ac2017-08-31 15:11:41 +0100257 env.Append(LINKFLAGS = ['-specs=rdimon.specs'])
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100258 env.Append(CXXFLAGS = ['-fPIC'])
259 env.Append(CPPDEFINES = ['NO_MULTI_THREADING'])
Michalis Spyrou07781ac2017-08-31 15:11:41 +0100260 env.Append(CPPDEFINES = ['BARE_METAL'])
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100261
262if env['opencl']:
Georgios Pinitase6032da2017-10-26 14:13:35 +0100263 if env['os'] in ['bare_metal'] or env['standalone']:
Anthony Barbier5f0124d2018-04-13 14:05:34 +0100264 print("Cannot link OpenCL statically, which is required for bare metal / standalone builds")
265 Exit(1)
266
267if env['gles_compute']:
268 if env['os'] in ['bare_metal'] or env['standalone']:
269 print("Cannot link OpenGLES statically, which is required for bare metal / standalone builds")
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100270 Exit(1)
271
Anthony Barbier9fb0cac2018-04-20 15:46:21 +0100272if env["os"] not in ["android", "bare_metal"] and (env['opencl'] or env['cppthreads']):
273 env.Append(LIBS = ['pthread'])
274
Anthony Barbier7068f992017-10-26 15:23:08 +0100275if env['opencl'] or env['gles_compute']:
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100276 if env['embed_kernels']:
277 env.Append(CPPDEFINES = ['EMBEDDED_KERNELS'])
278
279if env['debug']:
280 env['asserts'] = True
Georgios Pinitas3faea252017-10-30 14:13:50 +0000281 env['logging'] = True
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100282 env.Append(CXXFLAGS = ['-O0','-g','-gdwarf-2'])
283 env.Append(CPPDEFINES = ['ARM_COMPUTE_DEBUG_ENABLED'])
284else:
285 env.Append(CXXFLAGS = ['-O3','-ftree-vectorize'])
286
287if env['asserts']:
288 env.Append(CPPDEFINES = ['ARM_COMPUTE_ASSERTS_ENABLED'])
Moritz Pflanzer8b74c782017-09-14 14:33:20 +0100289 env.Append(CXXFLAGS = ['-fstack-protector-strong'])
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100290
Georgios Pinitas7d3d1b92017-10-12 17:34:20 +0100291if env['logging']:
292 env.Append(CPPDEFINES = ['ARM_COMPUTE_LOGGING_ENABLED'])
293
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100294env.Append(CPPPATH = ['#/include', "#"])
295env.Append(CXXFLAGS = env['extra_cxx_flags'])
Georgios Pinitas421405b2018-10-26 19:05:32 +0100296env.Append(LINKFLAGS = env['extra_link_flags'])
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100297
Anthony Barbier01bbd5f2018-11-01 15:10:51 +0000298Default( install_include("arm_compute"))
Anthony Barbier10565952018-11-15 09:50:06 +0000299Default( install_include("support"))
Michele Di Giorgio6afea902019-04-03 11:40:20 +0100300Default( install_include("utils"))
301for dirname in os.listdir("./include"):
302 Default( install_include("include/%s" % dirname))
Anthony Barbier01bbd5f2018-11-01 15:10:51 +0000303
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100304Export('version_at_least')
305
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100306if env['opencl']:
Anthony Barbiere8a55df2018-10-26 09:05:01 +0100307 SConscript("./opencl-1.2-stubs/SConscript", variant_dir="%s/opencl-1.2-stubs" % build_path, duplicate=0)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100308
Anthony Barbier7068f992017-10-26 15:23:08 +0100309if env['gles_compute'] and env['os'] != 'android':
Anthony Barbier14c86a92017-12-14 16:27:41 +0000310 env.Append(CPPPATH = ['#/include/linux'])
Anthony Barbiere8a55df2018-10-26 09:05:01 +0100311 SConscript("./opengles-3.1-stubs/SConscript", variant_dir="%s/opengles-3.1-stubs" % build_path, duplicate=0)
Anthony Barbier7068f992017-10-26 15:23:08 +0100312
Anthony Barbiere8a55df2018-10-26 09:05:01 +0100313SConscript('./SConscript', variant_dir=build_path, duplicate=0)
Anthony Barbier6c0348f2017-11-10 18:32:38 +0000314
Michalis Spyrou323ce0f2018-11-30 16:30:43 +0000315if env['examples'] and env['os'] != 'bare_metal' and env['exceptions']:
Anthony Barbiere8a55df2018-10-26 09:05:01 +0100316 SConscript('./examples/SConscript', variant_dir='%s/examples' % build_path, duplicate=0)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100317
Michalis Spyrou323ce0f2018-11-30 16:30:43 +0000318if env['os'] != 'bare_metal' and env['exceptions']:
Anthony Barbiere8a55df2018-10-26 09:05:01 +0100319 SConscript('./tests/SConscript', variant_dir='%s/tests' % build_path, duplicate=0)