From 15d5ac8dd039132926ac8012559ca5e3a405f858 Mon Sep 17 00:00:00 2001 From: Anthony Barbier Date: Mon, 17 Jul 2017 15:22:17 +0100 Subject: COMPMID-415 Fix issue with OpenCL examples Change-Id: Ie4797e88fd2ad38f30cb69651ed37481b835fae8 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/80781 Reviewed-by: Moritz Pflanzer Tested-by: Kaizen --- examples/SConscript | 4 ++-- examples/cl_convolution.cpp | 5 ++++- examples/cl_events.cpp | 5 ++++- examples/neoncl_scale_median_gaussian.cpp | 5 ++++- 4 files changed, 14 insertions(+), 5 deletions(-) (limited to 'examples') diff --git a/examples/SConscript b/examples/SConscript index 04569c6ceb..2303109bf5 100644 --- a/examples/SConscript +++ b/examples/SConscript @@ -48,7 +48,7 @@ else: 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], LIBS = [arm_compute_lib, "OpenCL"]) + prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_CL'], LIBS = [arm_compute_lib, "OpenCL"]) Depends(prog, [arm_compute_dependency, opencl]) alias = examples_env.Alias(example, prog) Default(alias) @@ -56,7 +56,7 @@ if env['opencl'] and env['neon']: 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], LIBS = [arm_compute_lib, "OpenCL"]) + prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_CL'], LIBS = [arm_compute_lib, "OpenCL"]) Depends(prog, [arm_compute_dependency, opencl]) alias = examples_env.Alias(example, prog) Default(alias) diff --git a/examples/cl_convolution.cpp b/examples/cl_convolution.cpp index 06f6f144e1..b780193f14 100644 --- a/examples/cl_convolution.cpp +++ b/examples/cl_convolution.cpp @@ -21,7 +21,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#define ARM_COMPUTE_CL /* So that OpenCL exceptions get caught too */ +#ifndef ARM_COMPUTE_CL /* Needed by Utils.cpp to handle OpenCL exceptions properly */ +#error "This example needs to be built with -DARM_COMPUTE_CL" +#endif /* ARM_COMPUTE_CL */ + #include "arm_compute/core/Types.h" #include "arm_compute/runtime/CL/CLFunctions.h" #include "arm_compute/runtime/CL/CLScheduler.h" diff --git a/examples/cl_events.cpp b/examples/cl_events.cpp index 768f620622..213f4a19df 100644 --- a/examples/cl_events.cpp +++ b/examples/cl_events.cpp @@ -21,7 +21,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#define ARM_COMPUTE_CL /* So that OpenCL exceptions get caught too */ +#ifndef ARM_COMPUTE_CL /* Needed by Utils.cpp to handle OpenCL exceptions properly */ +#error "This example needs to be built with -DARM_COMPUTE_CL" +#endif /* ARM_COMPUTE_CL */ + #include "arm_compute/core/Types.h" #include "arm_compute/runtime/CL/CLFunctions.h" #include "arm_compute/runtime/CL/CLScheduler.h" diff --git a/examples/neoncl_scale_median_gaussian.cpp b/examples/neoncl_scale_median_gaussian.cpp index a32ba6daf6..e53a48e07d 100644 --- a/examples/neoncl_scale_median_gaussian.cpp +++ b/examples/neoncl_scale_median_gaussian.cpp @@ -21,7 +21,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#define ARM_COMPUTE_CL /* So that OpenCL exceptions get caught too */ +#ifndef ARM_COMPUTE_CL /* Needed by Utils.cpp to handle OpenCL exceptions properly */ +#error "This example needs to be built with -DARM_COMPUTE_CL" +#endif /* ARM_COMPUTE_CL */ + #include "arm_compute/core/Types.h" #include "arm_compute/runtime/CL/CLFunctions.h" #include "arm_compute/runtime/CL/CLScheduler.h" -- cgit v1.2.1