aboutsummaryrefslogtreecommitdiff
path: root/SConscript
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2020-10-21 18:33:36 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2020-12-15 18:07:31 +0000
commit4d9687e70e2d71097cd43929d5f63377c3c44523 (patch)
tree09b5b89fd51d7b44613f21b889669939bc2c6bb3 /SConscript
parentaa51a5ba9a3f05be08b94859b53c398edee5d2e3 (diff)
downloadComputeLibrary-4d9687e70e2d71097cd43929d5f63377c3c44523.tar.gz
Address RVO issue on some compilers
Suppresses pessimizing-move during clang compilation as for some gcc toolchains RVO is not ensured until C++17 thus an explicit call to std::move might be required to avoid compilation error for non-copyable ojects (e.g. std::unique_ptr) Resolves: COMPMID-3599 Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com> Change-Id: Ie3fa44fb0cf631655aecbeb6c82021a68f500a33 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4230 Reviewed-by: Giorgio Arena <giorgio.arena@arm.com> Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'SConscript')
-rw-r--r--SConscript26
1 files changed, 16 insertions, 10 deletions
diff --git a/SConscript b/SConscript
index 656336d555..2b70ca18b8 100644
--- a/SConscript
+++ b/SConscript
@@ -42,14 +42,14 @@ def build_bootcode_objs(sources):
Default(obj)
return obj
-def build_library(name, sources, static=False, libs=[]):
+def build_library(name, build_env, sources, static=False, libs=[]):
if static:
- obj = arm_compute_env.StaticLibrary(name, source=sources, LIBS = arm_compute_env["LIBS"] + libs)
+ obj = build_env.StaticLibrary(name, source=sources, LIBS = arm_compute_env["LIBS"] + libs)
else:
if env['set_soname']:
- obj = arm_compute_env.SharedLibrary(name, source=sources, SHLIBVERSION = SONAME_VERSION, LIBS = arm_compute_env["LIBS"] + libs)
+ obj = build_env.SharedLibrary(name, source=sources, SHLIBVERSION = SONAME_VERSION, LIBS = arm_compute_env["LIBS"] + libs)
else:
- obj = arm_compute_env.SharedLibrary(name, source=sources, LIBS = arm_compute_env["LIBS"] + libs)
+ obj = build_env.SharedLibrary(name, source=sources, LIBS = arm_compute_env["LIBS"] + libs)
obj = install_lib(obj)
Default(obj)
@@ -137,6 +137,9 @@ arm_compute_env = env.Clone()
version_file = arm_compute_env.Command("src/core/arm_compute_version.embed", "", action=create_version_file)
arm_compute_env.AlwaysBuild(version_file)
+default_cpp_compiler = 'g++' if env['os'] != 'android' else 'clang++'
+cpp_compiler = os.environ.get('CXX', default_cpp_compiler)
+
# Generate embed files
generate_embed = [ version_file ]
if env['opencl'] and env['embed_kernels']:
@@ -282,26 +285,29 @@ if env['os'] == 'bare_metal':
bootcode_o = build_bootcode_objs(bootcode_files)
Export('bootcode_o')
-arm_compute_core_a = build_library('arm_compute_core-static', core_files, static=True)
+arm_compute_core_a = build_library('arm_compute_core-static', arm_compute_env, core_files, static=True)
Export('arm_compute_core_a')
if env['os'] != 'bare_metal' and not env['standalone']:
- arm_compute_core_so = build_library('arm_compute_core', core_files, static=False)
+ arm_compute_core_so = build_library('arm_compute_core', arm_compute_env, core_files, static=False)
Export('arm_compute_core_so')
-arm_compute_a = build_library('arm_compute-static', runtime_files, static=True, libs = [ arm_compute_core_a ])
+arm_compute_a = build_library('arm_compute-static', arm_compute_env, runtime_files, static=True, libs = [ arm_compute_core_a ])
Export('arm_compute_a')
if env['os'] != 'bare_metal' and not env['standalone']:
- arm_compute_so = build_library('arm_compute', runtime_files, static=False, libs = [ "arm_compute_core" ])
+ arm_compute_so = build_library('arm_compute', arm_compute_env, runtime_files, static=False, libs = [ "arm_compute_core" ])
Depends(arm_compute_so, arm_compute_core_so)
Export('arm_compute_so')
-arm_compute_graph_a = build_library('arm_compute_graph-static', graph_files, static=True, libs = [ arm_compute_a])
+arm_compute_graph_env = arm_compute_env.Clone();
+if 'clang++' in cpp_compiler:
+ arm_compute_graph_env.Append(CXXFLAGS = ['-Wno-pessimizing-move'])
+arm_compute_graph_a = build_library('arm_compute_graph-static', arm_compute_graph_env, graph_files, static=True, libs = [ arm_compute_a])
Export('arm_compute_graph_a')
if env['os'] != 'bare_metal' and not env['standalone']:
- arm_compute_graph_so = build_library('arm_compute_graph', graph_files, static=False, libs = [ "arm_compute" , "arm_compute_core"])
+ arm_compute_graph_so = build_library('arm_compute_graph', arm_compute_graph_env, graph_files, static=False, libs = [ "arm_compute" , "arm_compute_core"])
Depends(arm_compute_graph_so, arm_compute_so)
Export('arm_compute_graph_so')