From 01bbd5fd0af0847ac847c78c7064b3c9810a924a Mon Sep 17 00:00:00 2001 From: Anthony Barbier Date: Thu, 1 Nov 2018 15:10:51 +0000 Subject: COMPMID-1737: Add support for install_dir Note: Only ComputeLibrary files get copied over (Stub CL / GLES drivers don't, nor are the 3rdparty includes) utils/ files are not copied either (They're not part of the core library) Change-Id: I55e01c0ba4a5f7e649877fcdd11fdb0a51071b18 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/156339 Reviewed-by: Pablo Tello Reviewed-by: Georgios Pinitas Tested-by: bsgcomp --- SConscript | 2 ++ SConstruct | 25 +++++++++++++++++++++++++ examples/SConscript | 31 ++++++++++++++++++++----------- tests/SConscript | 5 +++++ 4 files changed, 52 insertions(+), 11 deletions(-) diff --git a/SConscript b/SConscript index 36fa7b6af9..86f2789de5 100644 --- a/SConscript +++ b/SConscript @@ -29,6 +29,7 @@ SONAME_VERSION="1.0.0" Import('env') Import('vars') +Import('install_lib') def build_library(name, sources, static=False, libs=[]): if static: @@ -53,6 +54,7 @@ def build_library(name, sources, static=False, libs=[]): else: obj = arm_compute_env.SharedLibrary(name, source=sources, LIBS = arm_compute_env["LIBS"] + libs) + obj = install_lib(obj) Default(obj) return obj diff --git a/SConstruct b/SConstruct index 4278e0b679..c1d1f716a8 100644 --- a/SConstruct +++ b/SConstruct @@ -54,6 +54,7 @@ vars.AddVariables( BoolVariable("openmp", "Enable OpenMP backend", False), BoolVariable("cppthreads", "Enable C++11 threads backend", True), PathVariable("build_dir", "Specify sub-folder for the build", ".", PathVariable.PathAccept), + PathVariable("install_dir", "Specify sub-folder for the install", "", PathVariable.PathAccept), #FIXME Remove before release (And remove all references to INTERNAL_ONLY) BoolVariable("internal_only", "Enable ARM internal only tests", False), ("extra_cxx_flags", "Extra CXX flags to be appended to the build command", ""), @@ -69,10 +70,32 @@ if not env['build_dir'].startswith('/'): else: SConsignFile('%s/.scons' % build_path) +install_path = env['install_dir'] +#If the install_dir is a relative path then assume it's from inside build_dir +if not env['install_dir'].startswith('/') and install_path != "": + install_path = "%s/%s" % (build_path, install_path) + env.Append(LIBPATH = [build_path]) Export('env') Export('vars') +def install_lib( lib ): + # If there is no install folder, then there is nothing to do: + if install_path == "": + return lib + return env.Install( "%s/lib/" % install_path, lib) +def install_bin( bin ): + # If there is no install folder, then there is nothing to do: + if install_path == "": + return bin + return env.Install( "%s/bin/" % install_path, bin) +def install_include( inc ): + if install_path == "": + return inc + return env.Install( "%s/include/" % install_path, inc) + +Export('install_lib') +Export('install_bin') Help(vars.GenerateHelpText(env)) @@ -252,6 +275,8 @@ if env['logging']: env.Append(CPPPATH = ['#/include', "#"]) env.Append(CXXFLAGS = env['extra_cxx_flags']) +Default( install_include("arm_compute")) + Export('version_at_least') if env['opencl']: diff --git a/examples/SConscript b/examples/SConscript index fbfdaad064..7af8a7fd0e 100644 --- a/examples/SConscript +++ b/examples/SConscript @@ -23,6 +23,7 @@ import SCons import os.path Import('env') +Import('install_bin') examples_env = env.Clone() @@ -57,10 +58,12 @@ for file in Glob("./graph_*.cpp"): if env['os'] in ['android', 'bare_metal'] or env['standalone']: prog = examples_env.Program(example, ["{}.cpp".format(example), utils, graph_utils], LIBS = examples_libs + arm_compute_graph_libs, LINKFLAGS=examples_env["LINKFLAGS"]+['-Wl,--whole-archive',graph_dependency,'-Wl,--no-whole-archive']) + prog = install_bin(prog) Depends(prog, graph_dependency) else: #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies prog = examples_env.Program(example, ["{}.cpp".format(example), utils, graph_utils], LIBS = examples_libs + arm_compute_graph_libs, LINKFLAGS=examples_env["LINKFLAGS"]+['-Wl,--allow-shlib-undefined'] ) + prog = install_bin(prog) Depends(prog, graph_dependency) alias = examples_env.Alias(example, prog) Default(alias) @@ -69,6 +72,7 @@ if env['opencl'] and env['neon']: for file in Glob("./neoncl_*.cpp"): example = os.path.basename(os.path.splitext(str(file))[0]) prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_CL'], LIBS = examples_libs + arm_compute_libs) + prog = install_bin(prog) Depends(prog, arm_compute_dependency) alias = examples_env.Alias(example, prog) Default(alias) @@ -77,6 +81,7 @@ if env['opencl']: for file in Glob("./cl_*.cpp"): example = os.path.basename(os.path.splitext(str(file))[0]) prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_CL'], LIBS = examples_libs + arm_compute_libs) + prog = install_bin(prog) Depends(prog, arm_compute_dependency) alias = examples_env.Alias(example, prog) Default(alias) @@ -85,6 +90,7 @@ if env['neon']: for file in Glob("./neon_*.cpp"): example = os.path.basename(os.path.splitext(str(file))[0]) prog = examples_env.Program(example, ["{}.cpp".format(example), utils], LIBS = examples_libs + arm_compute_libs) + prog = install_bin(prog) Depends(prog, arm_compute_dependency) alias = examples_env.Alias(example, prog) Default(alias) @@ -93,21 +99,24 @@ if env['gles_compute']: for file in Glob("./gc_*.cpp"): example = os.path.basename(os.path.splitext(str(file))[0]) prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_GC'], LIBS = examples_libs + arm_compute_libs) + prog = install_bin(prog) Depends(prog, arm_compute_dependency) alias = examples_env.Alias(example, prog) Default(alias) #FIXME Delete 3rdparty builds before release for file in Glob("#3rdparty/examples/graph_*.cpp"): - example = os.path.basename(os.path.splitext(str(file))[0]) - prog = None + example = os.path.basename(os.path.splitext(str(file))[0]) + prog = None - if env['os'] in ['android', 'bare_metal'] or env['standalone']: - prog = examples_env.Program(example, [examples_env.Object(source=file, target=example), utils, graph_utils], LIBS = examples_libs + arm_compute_graph_libs, LINKFLAGS=examples_env["LINKFLAGS"]+['-Wl,--whole-archive',graph_dependency,'-Wl,--no-whole-archive']) - Depends(prog, graph_dependency) - else: - #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies - prog = examples_env.Program(example, [examples_env.Object(source=file, target=example), utils, graph_utils], LIBS = examples_libs + arm_compute_graph_libs, LINKFLAGS=examples_env["LINKFLAGS"]+['-Wl,--allow-shlib-undefined'] ) - Depends(prog, graph_dependency) - alias = examples_env.Alias(example, prog) - Default(alias) + if env['os'] in ['android', 'bare_metal'] or env['standalone']: + prog = examples_env.Program(example, [examples_env.Object(source=file, target=example), utils, graph_utils], LIBS = examples_libs + arm_compute_graph_libs, LINKFLAGS=examples_env["LINKFLAGS"]+['-Wl,--whole-archive',graph_dependency,'-Wl,--no-whole-archive']) + prog = install_bin(prog) + Depends(prog, graph_dependency) + else: + #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies + prog = examples_env.Program(example, [examples_env.Object(source=file, target=example), utils, graph_utils], LIBS = examples_libs + arm_compute_graph_libs, LINKFLAGS=examples_env["LINKFLAGS"]+['-Wl,--allow-shlib-undefined'] ) + prog = install_bin(prog) + Depends(prog, graph_dependency) + alias = examples_env.Alias(example, prog) + Default(alias) diff --git a/tests/SConscript b/tests/SConscript index 2e265a13ce..ac826f848d 100644 --- a/tests/SConscript +++ b/tests/SConscript @@ -24,6 +24,7 @@ import os.path Import('env') Import('vars') +Import('install_bin') SConscript('./framework/SConscript', duplicate=0) @@ -128,6 +129,7 @@ else: if test_env['benchmark_tests']: arm_compute_benchmark = test_env.Program('arm_compute_benchmark', files_benchmark + common_objects) + arm_compute_benchmark = install_bin(arm_compute_benchmark) Depends(arm_compute_benchmark, arm_compute_test_framework) Depends(arm_compute_benchmark, arm_compute_lib) Default(arm_compute_benchmark) @@ -139,6 +141,7 @@ if test_env['validation_tests']: Depends(arm_compute_validation_framework , arm_compute_core_a) arm_compute_validation = test_env.Program('arm_compute_validation', files_validation + common_objects, LIBS=[arm_compute_validation_framework] + test_env['LIBS']) + arm_compute_validation = install_bin(arm_compute_validation) Depends(arm_compute_validation, arm_compute_validation_framework) Depends(arm_compute_validation, arm_compute_test_framework) Depends(arm_compute_validation, arm_compute_lib) @@ -174,6 +177,7 @@ if test_env['validation_tests']: #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils]+ files_validate_examples, LIBS = test_env["LIBS"] + ["arm_compute_graph", arm_compute_validation_framework], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--allow-shlib-undefined'] ) arm_compute_validate_examples += [ prog ] + arm_compute_validate_examples = install_bin(arm_compute_validate_examples) Depends(arm_compute_validate_examples, arm_compute_validation_framework) Depends(arm_compute_validate_examples, arm_compute_test_framework) Depends(arm_compute_validate_examples, arm_compute_lib) @@ -211,6 +215,7 @@ if test_env['benchmark_examples']: #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils, graph_params]+ files_benchmark_examples, LIBS = test_env["LIBS"] + ["arm_compute_graph"], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--allow-shlib-undefined'] ) arm_compute_benchmark_examples += [ prog ] + arm_compute_benchmark_examples = install_bin(arm_compute_benchmark_examples) Depends(arm_compute_benchmark_examples, arm_compute_test_framework) Depends(arm_compute_benchmark_examples, arm_compute_lib) Default(arm_compute_benchmark_examples) -- cgit v1.2.1