BVLC/caffe — pull request #1236 by mlapin (2014-10-07 21:00:10+00:00)
Title: Legacy nvcc support

Hey,

unfortunately, commit 0ba046bc3ec7362b49d239d9d0947c2598a75ef0 (merge PR #1070) breaks compilation in our legacy environment (we currently use cuda toolkit 5.0 and nvcc with gcc 4.4). The compilation errors we get are of the following type:
```
emmintrin.h(1312): error: identifier "__builtin_ia32_vec_ext_v8hi" is undefined
```
This could be related to a similar issue with intrinsics when compiling under OSX (mentioned in #1070).

The proposed fix is to avoid inclusion of the opencv header when compiling with nvcc and the host gcc is < 4.7.

I kept the original workaround with the OSX flag for now, but my guess is the whole check could be simplified as:
```
#if __NVCC__
namespace cv {class Mat;}
#else
#include
#endif
```
that is, the cuda code does not actually require opencv, except for the class declaration `cv::Mat`.

The downside of this approach is that `ReadImageToCVMat` is not inlined.