COMPMID-1819 Add option to build library with -fno-exceptions
Change-Id: I3de6bb33746d52f8d8c337ab7776eccee8c205fb
Reviewed-on: https://review.mlplatform.org/328
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Reviewed-by: Pablo Marquez <pablo.tello@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
diff --git a/SConstruct b/SConstruct
index 11fbd8b..49b1d17 100644
--- a/SConstruct
+++ b/SConstruct
@@ -55,6 +55,7 @@
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),
+ BoolVariable("exceptions", "Enable/disable C++ exception support", True),
#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", ""),
@@ -118,6 +119,14 @@
print("ERROR: OpenMP and C++11 threads not supported in bare_metal. Use cppthreads=0 openmp=0")
Exit(1)
+if not env['exceptions']:
+ if env['opencl'] or env['gles_compute']:
+ print("ERROR: OpenCL and GLES are not supported when building without exceptions. Use opencl=0 gles_compute=0")
+ Exit(1)
+
+ env.Append(CPPDEFINES = ['ARM_COMPUTE_EXCEPTIONS_DISABLED'])
+ env.Append(CXXFLAGS = ['-fno-exceptions'])
+
env.Append(CXXFLAGS = ['-Wno-deprecated-declarations','-Wall','-DARCH_ARM',
'-Wextra','-Wno-unused-parameter','-pedantic','-Wdisabled-optimization','-Wformat=2',
'-Winit-self','-Wstrict-overflow=2','-Wswitch-default',
@@ -297,8 +306,8 @@
SConscript('./SConscript', variant_dir=build_path, duplicate=0)
-if env['examples'] and env['os'] != 'bare_metal':
+if env['examples'] and env['os'] != 'bare_metal' and env['exceptions']:
SConscript('./examples/SConscript', variant_dir='%s/examples' % build_path, duplicate=0)
-if env['os'] != 'bare_metal':
+if env['os'] != 'bare_metal' and env['exceptions']:
SConscript('./tests/SConscript', variant_dir='%s/tests' % build_path, duplicate=0)