From 6a3daf1f566c0bb722207f125d2aaee6930e9947 Mon Sep 17 00:00:00 2001 From: Anthony Barbier Date: Mon, 19 Feb 2018 17:24:27 +0000 Subject: COMPMID-942: Created 'embed_only' build target for ArmNN Change-Id: I579943339fc77c31ce29253cdbc3d8654ac0c6f0 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/121167 Reviewed-by: Pablo Tello Tested-by: Jenkins --- SConscript | 50 +++++++++++++++++++++++++------------------------- SConstruct | 10 +++++++--- 2 files changed, 32 insertions(+), 28 deletions(-) diff --git a/SConscript b/SConscript index f021f34615..6f7ea3c36b 100644 --- a/SConscript +++ b/SConscript @@ -123,12 +123,34 @@ def create_version_file(target, source, env): with open(target[0].get_path(), "w") as fd: fd.write(build_info) - arm_compute_env = env.Clone() -# Don't allow undefined references in the libraries: -arm_compute_env.Append(LINKFLAGS=['-Wl,--no-undefined']) +# Generate embed files generate_embed = [ arm_compute_env.Command("src/core/arm_compute_version.embed", "", action=create_version_file) ] +if env['opencl'] and env['embed_kernels']: + cl_files = Glob('src/core/CL/cl_kernels/*.cl') + cl_files += Glob('src/core/CL/cl_kernels/*.h') + + embed_files = [ f.get_path()+"embed" for f in cl_files ] + arm_compute_env.Append(CPPPATH =[Dir("./src/core/CL/").path] ) + + generate_embed.append(arm_compute_env.Command(embed_files, cl_files, action=resolve_includes)) + +if env['gles_compute'] and env['embed_kernels']: + cs_files = Glob('src/core/GLES_COMPUTE/cs_shaders/*.cs') + cs_files += Glob('src/core/GLES_COMPUTE/cs_shaders/*.h') + + embed_files = [ f.get_path()+"embed" for f in cs_files ] + arm_compute_env.Append(CPPPATH =[Dir("./src/core/GLES_COMPUTE/").path] ) + + generate_embed.append(arm_compute_env.Command(embed_files, cs_files, action=resolve_includes)) + +Default(generate_embed) +if env["build"] == "embed_only": + Return() + +# Don't allow undefined references in the libraries: +arm_compute_env.Append(LINKFLAGS=['-Wl,--no-undefined']) arm_compute_env.Append(CPPPATH =[Dir("./src/core/").path] ) if env["os"] not in ["android", "bare_metal"]: @@ -161,16 +183,6 @@ if env['opencl']: runtime_files += Glob('src/runtime/CL/*.cpp') runtime_files += Glob('src/runtime/CL/functions/*.cpp') - # Generate embed files - if env['embed_kernels']: - cl_files = Glob('src/core/CL/cl_kernels/*.cl') - cl_files += Glob('src/core/CL/cl_kernels/*.h') - - embed_files = [ f.get_path()+"embed" for f in cl_files ] - arm_compute_env.Append(CPPPATH =[Dir("./src/core/CL/").path] ) - - generate_embed.append(arm_compute_env.Command(embed_files, cl_files, action=resolve_includes)) - if env['neon']: core_files += Glob('src/core/NEON/*.cpp') core_files += Glob('src/core/NEON/kernels/*.cpp') @@ -199,16 +211,6 @@ if env['gles_compute']: runtime_files += Glob('src/runtime/GLES_COMPUTE/*.cpp') runtime_files += Glob('src/runtime/GLES_COMPUTE/functions/*.cpp') - # Generate embed files - if env['embed_kernels']: - cs_files = Glob('src/core/GLES_COMPUTE/cs_shaders/*.cs') - cs_files += Glob('src/core/GLES_COMPUTE/cs_shaders/*.h') - - embed_files = [ f.get_path()+"embed" for f in cs_files ] - arm_compute_env.Append(CPPPATH =[Dir("./src/core/GLES_COMPUTE/").path] ) - - generate_embed.append(arm_compute_env.Command(embed_files, cs_files, action=resolve_includes)) - arm_compute_core_a = build_library('arm_compute_core-static', core_files, static=True) Export('arm_compute_core_a') @@ -255,8 +257,6 @@ else: Default(alias) -Default(generate_embed) - if env['standalone']: Depends([alias,arm_compute_core_a], generate_embed) else: diff --git a/SConstruct b/SConstruct index 82100decfa..b74a6b9a2a 100644 --- a/SConstruct +++ b/SConstruct @@ -42,7 +42,7 @@ vars.AddVariables( BoolVariable("logging", "Logging (this flag is forced to 1 for debug=1)", False), EnumVariable("arch", "Target Architecture", "armv7a", allowed_values=("armv7a", "arm64-v8a", "arm64-v8.2-a", "x86_32", "x86_64")), EnumVariable("os", "Target OS", "linux", allowed_values=("linux", "android", "bare_metal")), - EnumVariable("build", "Build type", "cross_compile", allowed_values=("native", "cross_compile")), + EnumVariable("build", "Build type", "cross_compile", allowed_values=("native", "cross_compile", "embed_only")), BoolVariable("examples", "Build example programs", True), BoolVariable("Werror", "Enable/disable the -Werror compilation flag", True), BoolVariable("standalone", "Builds the tests as standalone executables, links statically with libgcc, libstdc++ and libarm_compute", False), @@ -61,11 +61,17 @@ vars.AddVariables( env = Environment(platform="posix", variables=vars, ENV = os.environ) env.Append(LIBPATH = ["#build/%s" % env['build_dir']]) +Export('env') +Export('vars') SConsignFile('build/.%s' % env['build_dir']) Help(vars.GenerateHelpText(env)) +if env['build'] == "embed_only": + SConscript('./SConscript', variant_dir='#build/%s' % env['build_dir'], duplicate=0) + Return() + if env['neon'] and 'x86' in env['arch']: print "Cannot compile NEON for x86" Exit(1) @@ -231,8 +237,6 @@ if env['logging']: env.Append(CPPPATH = ['#/include', "#"]) env.Append(CXXFLAGS = env['extra_cxx_flags']) -Export('vars') -Export('env') Export('version_at_least') if env['opencl']: -- cgit v1.2.1