From 7c72e095faf7f824fc43c0f481c066091d30a683 Mon Sep 17 00:00:00 2001 From: Lindsay Roberts Date: Tue, 19 Feb 2019 14:42:15 +0200 Subject: [PATCH] Fix Flann compilation under nvcc + NEON All includes in core/cv_cpu_dispatch.h are protected by an ifndef __CUDACC__ to prevent attempting to use neon intrinsics when compiling cuda kernels (.cu) -- this prevents hard errors such as error: identifier "__builtin_neon_qi" is undefined Add this same protection to flann/dist.h to fix compilation involving flann.hpp. --- modules/flann/include/opencv2/flann/dist.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/flann/include/opencv2/flann/dist.h b/modules/flann/include/opencv2/flann/dist.h index a65e712aed..2bb4fc947a 100644 --- a/modules/flann/include/opencv2/flann/dist.h +++ b/modules/flann/include/opencv2/flann/dist.h @@ -47,7 +47,7 @@ typedef unsigned __int64 uint64_t; # include #endif -#ifdef __ARM_NEON__ +#if defined(__ARM_NEON__) && !defined(__CUDACC__) # include "arm_neon.h" #endif @@ -425,7 +425,7 @@ struct Hamming ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const { ResultType result = 0; -#ifdef __ARM_NEON__ +#if defined(__ARM_NEON__) && !defined(__CUDACC__) { uint32x4_t bits = vmovq_n_u32(0); for (size_t i = 0; i < size; i += 16) {